1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1999 by Sun Microsystems, Inc. 24 * All rights reserved. 25 * Copyright (c) 2020 Peter Tribble. 26 */ 27 28 #ifndef _PDEVINFO_SUN4U_H 29 #define _PDEVINFO_SUN4U_H 30 31 #include <sys/obpdefs.h> 32 #include <sys/envctrl_gen.h> 33 #include <sys/envctrl_ue250.h> 34 #include <sys/envctrl_ue450.h> 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /* 41 * These were formerly defined in sys/ac.h, which was specific to sunfire, 42 * but usage has leaked into generic code. 43 */ 44 #ifndef TRUE 45 #define TRUE (1) 46 #endif 47 #ifndef FALSE 48 #define FALSE (0) 49 #endif 50 51 /* 52 * These were formerly defined as part of the board_type enum in sys/fhc.h, 53 * which was specific to sunfire, but usage has leaked into generic code. 54 */ 55 #define UNKNOWN_BOARD 1 56 #define CPU_BOARD 2 57 58 /* Define names of nodes to search for */ 59 #define SBUS_NAME "sbus" 60 #define PCI_NAME "pci" 61 #define FFB_NAME "SUNW,ffb" 62 #define AFB_NAME "SUNW,afb" 63 64 /* Environmental info for Tazmo */ 65 struct envctrl_kstat_data { 66 envctrl_ps_t ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ 67 envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */ 68 envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */ 69 }; 70 71 /* Environmental info for Javelin */ 72 struct envctrltwo_kstat_data { 73 envctrl_ps2_t ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ 74 int num_ps_kstats; 75 envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */ 76 int num_fan_kstats; 77 envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */ 78 int num_encl_kstats; 79 envctrl_temp_t temp_kstats[MAX_DEVS]; /* kstats for temperatures */ 80 int num_temp_kstats; 81 envctrl_disk_t disk_kstats[MAX_DEVS]; /* kstats for disks */ 82 int num_disk_kstats; 83 }; 84 85 struct system_kstat_data { 86 int sys_kstats_ok; /* successful kstat read occurred */ 87 struct envctrl_kstat_data env_data; /* environment data for Tazmo */ 88 int envctrl_kstat_ok; 89 struct envctrltwo_kstat_data envc_data; /* environ data for Javelin */ 90 int envctrltwo_kstat_ok; 91 }; 92 93 #define MAXSTRLEN 256 94 95 /* FFB info structure */ 96 struct ffbinfo { 97 int board; 98 int upa_id; 99 char *dev; 100 struct ffbinfo *next; 101 }; 102 103 /* FFB strap reg union */ 104 union strap_un { 105 struct { 106 uint_t unused:24; 107 uint_t afb_flag:1; 108 uint_t major_rev:2; 109 uint_t board_rev:2; 110 uint_t board_mem:1; 111 uint_t cbuf:1; 112 uint_t bbuf:1; 113 } fld; 114 uint_t ffb_strap_bits; 115 }; 116 117 /* known values for manufacturer's JED code */ 118 #define MANF_BROOKTREE 214 119 #define MANF_MITSUBISHI 28 120 121 /* FFB mnufacturer union */ 122 union manuf { 123 struct { 124 uint_t version:4; /* version of part number */ 125 uint_t partno:16; /* part number */ 126 uint_t manf:11; /* manufacturer's JED code */ 127 uint_t one:1; /* always set to '1' */ 128 } fld; 129 uint_t encoded_id; 130 }; 131 132 #define FFBIOC ('F' << 8) 133 #define FFB_SYS_INFO (FFBIOC| 80) 134 135 struct ffb_sys_info { 136 unsigned int ffb_strap_bits; /* ffb_strapping register */ 137 #define FFB_B_BUFF 0x01 /* B buffer present */ 138 #define FFB_C_BUFF 0x02 /* C buffer present */ 139 #define FB_TYPE_AFB 0x80 /* AFB or FFB */ 140 unsigned int fbc_version; /* revision of FBC chip */ 141 unsigned int dac_version; /* revision of DAC chip */ 142 unsigned int fbram_version; /* revision of FBRAMs chip */ 143 unsigned int flags; /* miscellaneous flags */ 144 #define FFB_KSIM 0x00000001 /* kernel simulator */ 145 #define FFB_PAGE_FILL_BUG 0x00000002 /* FBRAM has page fill bug */ 146 unsigned int afb_nfloats; /* no. of Float asics in AFB */ 147 unsigned int pad[58]; /* padding for AFB chips & misc. */ 148 }; 149 150 int get_id(Prom_node *); 151 152 #ifdef __cplusplus 153 } 154 #endif 155 156 #endif /* _PDEVINFO_SUN4U_H */ 157