residual.h revision 1.1.6.2 1 1.1.6.2 bouyer /* 7/18/95 */
2 1.1.6.2 bouyer /*----------------------------------------------------------------------------*/
3 1.1.6.2 bouyer /* Residual Data header definitions and prototypes */
4 1.1.6.2 bouyer /*----------------------------------------------------------------------------*/
5 1.1.6.2 bouyer
6 1.1.6.2 bouyer /* Structure map for RESIDUAL on PowerPC Reference Platform */
7 1.1.6.2 bouyer /* residual.h - Residual data structure passed in r3. */
8 1.1.6.2 bouyer /* Load point passed in r4 to boot image. */
9 1.1.6.2 bouyer /* For enum's: if given in hex then they are bit significant, */
10 1.1.6.2 bouyer /* i.e. only one bit is on for each enum */
11 1.1.6.2 bouyer /* Reserved fields must be filled with zeros. */
12 1.1.6.2 bouyer
13 1.1.6.2 bouyer #ifndef _RESIDUAL_
14 1.1.6.2 bouyer #define _RESIDUAL_
15 1.1.6.2 bouyer
16 1.1.6.2 bouyer #ifndef __ASSEMBLY__
17 1.1.6.2 bouyer
18 1.1.6.2 bouyer #define MAX_CPUS 32 /* These should be set to the maximum */
19 1.1.6.2 bouyer #define MAX_MEMS 64 /* number possible for this system. */
20 1.1.6.2 bouyer #define MAX_DEVICES 256 /* Changing these will change the */
21 1.1.6.2 bouyer #define AVE_PNP_SIZE 32 /* structure, hence the version of */
22 1.1.6.2 bouyer #define MAX_MEM_SEGS 64 /* this header file. */
23 1.1.6.2 bouyer
24 1.1.6.2 bouyer /*----------------------------------------------------------------------------*/
25 1.1.6.2 bouyer /* Public structures... */
26 1.1.6.2 bouyer /*----------------------------------------------------------------------------*/
27 1.1.6.2 bouyer
28 1.1.6.2 bouyer #include "pnp.h"
29 1.1.6.2 bouyer
30 1.1.6.2 bouyer typedef enum _L1CACHE_TYPE {
31 1.1.6.2 bouyer NoneCAC = 0,
32 1.1.6.2 bouyer SplitCAC = 1,
33 1.1.6.2 bouyer CombinedCAC = 2
34 1.1.6.2 bouyer } L1CACHE_TYPE;
35 1.1.6.2 bouyer
36 1.1.6.2 bouyer typedef enum _TLB_TYPE {
37 1.1.6.2 bouyer NoneTLB = 0,
38 1.1.6.2 bouyer SplitTLB = 1,
39 1.1.6.2 bouyer CombinedTLB = 2
40 1.1.6.2 bouyer } TLB_TYPE;
41 1.1.6.2 bouyer
42 1.1.6.2 bouyer typedef enum _FIRMWARE_SUPPORT {
43 1.1.6.2 bouyer Conventional = 0x01,
44 1.1.6.2 bouyer OpenFirmware = 0x02,
45 1.1.6.2 bouyer Diagnostics = 0x04,
46 1.1.6.2 bouyer LowDebug = 0x08,
47 1.1.6.2 bouyer Multiboot = 0x10,
48 1.1.6.2 bouyer LowClient = 0x20,
49 1.1.6.2 bouyer Hex41 = 0x40,
50 1.1.6.2 bouyer FAT = 0x80,
51 1.1.6.2 bouyer ISO9660 = 0x0100,
52 1.1.6.2 bouyer SCSI_InitiatorID_Override = 0x0200,
53 1.1.6.2 bouyer Tape_Boot = 0x0400,
54 1.1.6.2 bouyer FW_Boot_Path = 0x0800
55 1.1.6.2 bouyer } FIRMWARE_SUPPORT;
56 1.1.6.2 bouyer
57 1.1.6.2 bouyer typedef enum _FIRMWARE_SUPPLIERS {
58 1.1.6.2 bouyer IBMFirmware = 0x00,
59 1.1.6.2 bouyer MotoFirmware = 0x01, /* 7/18/95 */
60 1.1.6.2 bouyer FirmWorks = 0x02, /* 10/5/95 */
61 1.1.6.2 bouyer Bull = 0x03, /* 04/03/96 */
62 1.1.6.2 bouyer } FIRMWARE_SUPPLIERS;
63 1.1.6.2 bouyer
64 1.1.6.2 bouyer typedef enum _ENDIAN_SWITCH_METHODS {
65 1.1.6.2 bouyer UsePort92 = 0x01,
66 1.1.6.2 bouyer UsePCIConfigA8 = 0x02,
67 1.1.6.2 bouyer UseFF001030 = 0x03,
68 1.1.6.2 bouyer } ENDIAN_SWITCH_METHODS;
69 1.1.6.2 bouyer
70 1.1.6.2 bouyer typedef enum _SPREAD_IO_METHODS {
71 1.1.6.2 bouyer UsePort850 = 0x00,
72 1.1.6.2 bouyer /*UsePCIConfigA8 = 0x02,*/
73 1.1.6.2 bouyer } SPREAD_IO_METHODS;
74 1.1.6.2 bouyer
75 1.1.6.2 bouyer typedef struct _VPD {
76 1.1.6.2 bouyer
77 1.1.6.2 bouyer /* Box dependent stuff */
78 1.1.6.2 bouyer unsigned char PrintableModel[32]; /* Null terminated string.
79 1.1.6.2 bouyer Must be of the form:
80 1.1.6.2 bouyer vvv,<20h>,<model designation>,<0x0>
81 1.1.6.2 bouyer where vvv is the vendor ID
82 1.1.6.2 bouyer e.g. IBM PPS MODEL 6015<0x0> */
83 1.1.6.2 bouyer unsigned char Serial[16]; /* 12/94:
84 1.1.6.2 bouyer Serial Number; must be of the form:
85 1.1.6.2 bouyer vvv<serial number> where vvv is the
86 1.1.6.2 bouyer vendor ID.
87 1.1.6.2 bouyer e.g. IBM60151234567<20h><20h> */
88 1.1.6.2 bouyer unsigned char Reserved[48];
89 1.1.6.2 bouyer unsigned long FirmwareSupplier; /* See FirmwareSuppliers enum */
90 1.1.6.2 bouyer unsigned long FirmwareSupports; /* See FirmwareSupport enum */
91 1.1.6.2 bouyer unsigned long NvramSize; /* Size of nvram in bytes */
92 1.1.6.2 bouyer unsigned long NumSIMMSlots;
93 1.1.6.2 bouyer unsigned short EndianSwitchMethod; /* See EndianSwitchMethods enum */
94 1.1.6.2 bouyer unsigned short SpreadIOMethod; /* See SpreadIOMethods enum */
95 1.1.6.2 bouyer unsigned long SmpIar;
96 1.1.6.2 bouyer unsigned long RAMErrLogOffset; /* Heap offset to error log */
97 1.1.6.2 bouyer unsigned long Reserved5;
98 1.1.6.2 bouyer unsigned long Reserved6;
99 1.1.6.2 bouyer unsigned long ProcessorHz; /* Processor clock frequency in Hertz */
100 1.1.6.2 bouyer unsigned long ProcessorBusHz; /* Processor bus clock frequency */
101 1.1.6.2 bouyer unsigned long Reserved7;
102 1.1.6.2 bouyer unsigned long TimeBaseDivisor; /* (Bus clocks per timebase tic)*1000 */
103 1.1.6.2 bouyer unsigned long WordWidth; /* Word width in bits */
104 1.1.6.2 bouyer unsigned long PageSize; /* Page size in bytes */
105 1.1.6.2 bouyer unsigned long CoherenceBlockSize; /* Unit of transfer in/out of cache
106 1.1.6.2 bouyer for which coherency is maintained;
107 1.1.6.2 bouyer normally <= CacheLineSize. */
108 1.1.6.2 bouyer unsigned long GranuleSize; /* Unit of lock allocation to avoid */
109 1.1.6.2 bouyer /* false sharing of locks. */
110 1.1.6.2 bouyer
111 1.1.6.2 bouyer /* L1 Cache variables */
112 1.1.6.2 bouyer unsigned long CacheSize; /* L1 Cache size in KB. This is the */
113 1.1.6.2 bouyer /* total size of the L1, whether */
114 1.1.6.2 bouyer /* combined or split */
115 1.1.6.2 bouyer unsigned long CacheAttrib; /* L1CACHE_TYPE */
116 1.1.6.2 bouyer unsigned long CacheAssoc; /* L1 Cache associativity. Use this
117 1.1.6.2 bouyer for combined cache. If split, put
118 1.1.6.2 bouyer zeros here. */
119 1.1.6.2 bouyer unsigned long CacheLineSize; /* L1 Cache line size in bytes. Use
120 1.1.6.2 bouyer for combined cache. If split, put
121 1.1.6.2 bouyer zeros here. */
122 1.1.6.2 bouyer /* For split L1 Cache: (= combined if combined cache) */
123 1.1.6.2 bouyer unsigned long I_CacheSize;
124 1.1.6.2 bouyer unsigned long I_CacheAssoc;
125 1.1.6.2 bouyer unsigned long I_CacheLineSize;
126 1.1.6.2 bouyer unsigned long D_CacheSize;
127 1.1.6.2 bouyer unsigned long D_CacheAssoc;
128 1.1.6.2 bouyer unsigned long D_CacheLineSize;
129 1.1.6.2 bouyer
130 1.1.6.2 bouyer /* Translation Lookaside Buffer variables */
131 1.1.6.2 bouyer unsigned long TLBSize; /* Total number of TLBs on the system */
132 1.1.6.2 bouyer unsigned long TLBAttrib; /* Combined I+D or split TLB */
133 1.1.6.2 bouyer unsigned long TLBAssoc; /* TLB Associativity. Use this for
134 1.1.6.2 bouyer combined TLB. If split, put zeros
135 1.1.6.2 bouyer here. */
136 1.1.6.2 bouyer /* For split TLB: (= combined if combined TLB) */
137 1.1.6.2 bouyer unsigned long I_TLBSize;
138 1.1.6.2 bouyer unsigned long I_TLBAssoc;
139 1.1.6.2 bouyer unsigned long D_TLBSize;
140 1.1.6.2 bouyer unsigned long D_TLBAssoc;
141 1.1.6.2 bouyer
142 1.1.6.2 bouyer unsigned long ExtendedVPD; /* Offset to extended VPD area;
143 1.1.6.2 bouyer null if unused */
144 1.1.6.2 bouyer } VPD;
145 1.1.6.2 bouyer
146 1.1.6.2 bouyer typedef enum _DEVICE_FLAGS {
147 1.1.6.2 bouyer Enabled = 0x4000, /* 1 - PCI device is enabled */
148 1.1.6.2 bouyer Integrated = 0x2000,
149 1.1.6.2 bouyer Failed = 0x1000, /* 1 - device failed POST code tests */
150 1.1.6.2 bouyer Static = 0x0800, /* 0 - dynamically configurable
151 1.1.6.2 bouyer 1 - static */
152 1.1.6.2 bouyer Dock = 0x0400, /* 0 - not a docking station device
153 1.1.6.2 bouyer 1 - is a docking station device */
154 1.1.6.2 bouyer Boot = 0x0200, /* 0 - device cannot be used for BOOT
155 1.1.6.2 bouyer 1 - can be a BOOT device */
156 1.1.6.2 bouyer Configurable = 0x0100, /* 1 - device is configurable */
157 1.1.6.2 bouyer Disableable = 0x80, /* 1 - device can be disabled */
158 1.1.6.2 bouyer PowerManaged = 0x40, /* 0 - not managed; 1 - managed */
159 1.1.6.2 bouyer ReadOnly = 0x20, /* 1 - device is read only */
160 1.1.6.2 bouyer Removable = 0x10, /* 1 - device is removable */
161 1.1.6.2 bouyer ConsoleIn = 0x08,
162 1.1.6.2 bouyer ConsoleOut = 0x04,
163 1.1.6.2 bouyer Input = 0x02,
164 1.1.6.2 bouyer Output = 0x01
165 1.1.6.2 bouyer } DEVICE_FLAGS;
166 1.1.6.2 bouyer
167 1.1.6.2 bouyer typedef enum _BUS_ID {
168 1.1.6.2 bouyer ISADEVICE = 0x01,
169 1.1.6.2 bouyer EISADEVICE = 0x02,
170 1.1.6.2 bouyer PCIDEVICE = 0x04,
171 1.1.6.2 bouyer PCMCIADEVICE = 0x08,
172 1.1.6.2 bouyer PNPISADEVICE = 0x10,
173 1.1.6.2 bouyer MCADEVICE = 0x20,
174 1.1.6.2 bouyer MXDEVICE = 0x40, /* Devices on mezzanine bus */
175 1.1.6.2 bouyer PROCESSORDEVICE = 0x80, /* Devices on processor bus */
176 1.1.6.2 bouyer VMEDEVICE = 0x100,
177 1.1.6.2 bouyer } BUS_ID;
178 1.1.6.2 bouyer
179 1.1.6.2 bouyer typedef struct _DEVICE_ID {
180 1.1.6.2 bouyer unsigned long BusId; /* See BUS_ID enum above */
181 1.1.6.2 bouyer unsigned long DevId; /* Big Endian format */
182 1.1.6.2 bouyer unsigned long SerialNum; /* For multiple usage of a single
183 1.1.6.2 bouyer DevId */
184 1.1.6.2 bouyer unsigned long Flags; /* See DEVICE_FLAGS enum above */
185 1.1.6.2 bouyer unsigned char BaseType; /* See pnp.h for bit definitions */
186 1.1.6.2 bouyer unsigned char SubType; /* See pnp.h for bit definitions */
187 1.1.6.2 bouyer unsigned char Interface; /* See pnp.h for bit definitions */
188 1.1.6.2 bouyer unsigned char Spare;
189 1.1.6.2 bouyer } DEVICE_ID;
190 1.1.6.2 bouyer
191 1.1.6.2 bouyer typedef union _BUS_ACCESS {
192 1.1.6.2 bouyer struct _PnPAccess{
193 1.1.6.2 bouyer unsigned char CSN;
194 1.1.6.2 bouyer unsigned char LogicalDevNumber;
195 1.1.6.2 bouyer unsigned short ReadDataPort;
196 1.1.6.2 bouyer } PnPAccess;
197 1.1.6.2 bouyer struct _ISAAccess{
198 1.1.6.2 bouyer unsigned char SlotNumber; /* ISA Slot Number generally not
199 1.1.6.2 bouyer available; 0 if unknown */
200 1.1.6.2 bouyer unsigned char LogicalDevNumber;
201 1.1.6.2 bouyer unsigned short ISAReserved;
202 1.1.6.2 bouyer } ISAAccess;
203 1.1.6.2 bouyer struct _MCAAccess{
204 1.1.6.2 bouyer unsigned char SlotNumber;
205 1.1.6.2 bouyer unsigned char LogicalDevNumber;
206 1.1.6.2 bouyer unsigned short MCAReserved;
207 1.1.6.2 bouyer } MCAAccess;
208 1.1.6.2 bouyer struct _PCMCIAAccess{
209 1.1.6.2 bouyer unsigned char SlotNumber;
210 1.1.6.2 bouyer unsigned char LogicalDevNumber;
211 1.1.6.2 bouyer unsigned short PCMCIAReserved;
212 1.1.6.2 bouyer } PCMCIAAccess;
213 1.1.6.2 bouyer struct _EISAAccess{
214 1.1.6.2 bouyer unsigned char SlotNumber;
215 1.1.6.2 bouyer unsigned char FunctionNumber;
216 1.1.6.2 bouyer unsigned short EISAReserved;
217 1.1.6.2 bouyer } EISAAccess;
218 1.1.6.2 bouyer struct _PCIAccess{
219 1.1.6.2 bouyer unsigned char BusNumber;
220 1.1.6.2 bouyer unsigned char DevFuncNumber;
221 1.1.6.2 bouyer unsigned short PCIReserved;
222 1.1.6.2 bouyer } PCIAccess;
223 1.1.6.2 bouyer struct _ProcBusAccess{
224 1.1.6.2 bouyer unsigned char BusNumber;
225 1.1.6.2 bouyer unsigned char BUID;
226 1.1.6.2 bouyer unsigned short ProcBusReserved;
227 1.1.6.2 bouyer } ProcBusAccess;
228 1.1.6.2 bouyer } BUS_ACCESS;
229 1.1.6.2 bouyer
230 1.1.6.2 bouyer /* Per logical device information */
231 1.1.6.2 bouyer typedef struct _PPC_DEVICE {
232 1.1.6.2 bouyer DEVICE_ID DeviceId;
233 1.1.6.2 bouyer BUS_ACCESS BusAccess;
234 1.1.6.2 bouyer
235 1.1.6.2 bouyer /* The following three are offsets into the DevicePnPHeap */
236 1.1.6.2 bouyer /* All are in PnP compressed format */
237 1.1.6.2 bouyer unsigned long AllocatedOffset; /* Allocated resource description */
238 1.1.6.2 bouyer unsigned long PossibleOffset; /* Possible resource description */
239 1.1.6.2 bouyer unsigned long CompatibleOffset; /* Compatible device identifiers */
240 1.1.6.2 bouyer } PPC_DEVICE;
241 1.1.6.2 bouyer
242 1.1.6.2 bouyer typedef enum _CPU_STATE {
243 1.1.6.2 bouyer CPU_GOOD = 0, /* CPU is present, and active */
244 1.1.6.2 bouyer CPU_GOOD_FW = 1, /* CPU is present, and in firmware */
245 1.1.6.2 bouyer CPU_OFF = 2, /* CPU is present, but inactive */
246 1.1.6.2 bouyer CPU_FAILED = 3, /* CPU is present, but failed POST */
247 1.1.6.2 bouyer CPU_NOT_PRESENT = 255 /* CPU not present */
248 1.1.6.2 bouyer } CPU_STATE;
249 1.1.6.2 bouyer
250 1.1.6.2 bouyer typedef struct _PPC_CPU {
251 1.1.6.2 bouyer unsigned long CpuType; /* Result of mfspr from Processor
252 1.1.6.2 bouyer Version Register (PVR).
253 1.1.6.2 bouyer PVR(0-15) = Version (e.g. 601)
254 1.1.6.2 bouyer PVR(16-31 = EC Level */
255 1.1.6.2 bouyer unsigned char CpuNumber; /* CPU Number for this processor */
256 1.1.6.2 bouyer unsigned char CpuState; /* CPU State, see CPU_STATE enum */
257 1.1.6.2 bouyer unsigned short Reserved;
258 1.1.6.2 bouyer } PPC_CPU;
259 1.1.6.2 bouyer
260 1.1.6.2 bouyer typedef struct _PPC_MEM {
261 1.1.6.2 bouyer unsigned long SIMMSize; /* 0 - absent or bad
262 1.1.6.2 bouyer 8M, 32M (in MB) */
263 1.1.6.2 bouyer } PPC_MEM;
264 1.1.6.2 bouyer
265 1.1.6.2 bouyer typedef enum _MEM_USAGE {
266 1.1.6.2 bouyer Other = 0x8000,
267 1.1.6.2 bouyer ResumeBlock = 0x4000, /* for use by power management */
268 1.1.6.2 bouyer SystemROM = 0x2000, /* Flash memory (populated) */
269 1.1.6.2 bouyer UnPopSystemROM = 0x1000, /* Unpopulated part of SystemROM area */
270 1.1.6.2 bouyer IOMemory = 0x0800,
271 1.1.6.2 bouyer SystemIO = 0x0400,
272 1.1.6.2 bouyer SystemRegs = 0x0200,
273 1.1.6.2 bouyer PCIAddr = 0x0100,
274 1.1.6.2 bouyer PCIConfig = 0x80,
275 1.1.6.2 bouyer ISAAddr = 0x40,
276 1.1.6.2 bouyer Unpopulated = 0x20, /* Unpopulated part of System Memory */
277 1.1.6.2 bouyer Free = 0x10, /* Free part of System Memory */
278 1.1.6.2 bouyer BootImage = 0x08, /* BootImage part of System Memory */
279 1.1.6.2 bouyer FirmwareCode = 0x04, /* FirmwareCode part of System Memory */
280 1.1.6.2 bouyer FirmwareHeap = 0x02, /* FirmwareHeap part of System Memory */
281 1.1.6.2 bouyer FirmwareStack = 0x01 /* FirmwareStack part of System Memory*/
282 1.1.6.2 bouyer } MEM_USAGE;
283 1.1.6.2 bouyer
284 1.1.6.2 bouyer typedef struct _MEM_MAP {
285 1.1.6.2 bouyer unsigned long Usage; /* See MEM_USAGE above */
286 1.1.6.2 bouyer unsigned long BasePage; /* Page number measured in 4KB pages */
287 1.1.6.2 bouyer unsigned long PageCount; /* Page count measured in 4KB pages */
288 1.1.6.2 bouyer } MEM_MAP;
289 1.1.6.2 bouyer
290 1.1.6.2 bouyer typedef struct _RESIDUAL {
291 1.1.6.2 bouyer unsigned long ResidualLength; /* Length of Residual */
292 1.1.6.2 bouyer unsigned char Version; /* of this data structure */
293 1.1.6.2 bouyer unsigned char Revision; /* of this data structure */
294 1.1.6.2 bouyer unsigned short EC; /* of this data structure */
295 1.1.6.2 bouyer /* VPD */
296 1.1.6.2 bouyer VPD VitalProductData;
297 1.1.6.2 bouyer /* CPU */
298 1.1.6.2 bouyer unsigned short MaxNumCpus; /* Max CPUs in this system */
299 1.1.6.2 bouyer unsigned short ActualNumCpus; /* ActualNumCpus < MaxNumCpus means */
300 1.1.6.2 bouyer /* that there are unpopulated or */
301 1.1.6.2 bouyer /* otherwise unusable cpu locations */
302 1.1.6.2 bouyer PPC_CPU Cpus[MAX_CPUS];
303 1.1.6.2 bouyer /* Memory */
304 1.1.6.2 bouyer unsigned long TotalMemory; /* Total amount of memory installed */
305 1.1.6.2 bouyer unsigned long GoodMemory; /* Total amount of good memory */
306 1.1.6.2 bouyer unsigned long ActualNumMemSegs;
307 1.1.6.2 bouyer MEM_MAP Segs[MAX_MEM_SEGS];
308 1.1.6.2 bouyer unsigned long ActualNumMemories;
309 1.1.6.2 bouyer PPC_MEM Memories[MAX_MEMS];
310 1.1.6.2 bouyer /* Devices */
311 1.1.6.2 bouyer unsigned long ActualNumDevices;
312 1.1.6.2 bouyer PPC_DEVICE Devices[MAX_DEVICES];
313 1.1.6.2 bouyer unsigned char DevicePnPHeap[2*MAX_DEVICES*AVE_PNP_SIZE];
314 1.1.6.2 bouyer } RESIDUAL;
315 1.1.6.2 bouyer
316 1.1.6.2 bouyer
317 1.1.6.2 bouyer extern RESIDUAL *res;
318 1.1.6.2 bouyer extern void print_residual_device_info(void);
319 1.1.6.2 bouyer extern PPC_DEVICE *residual_find_device(unsigned long BusMask,
320 1.1.6.2 bouyer unsigned char * DevID, int BaseType,
321 1.1.6.2 bouyer int SubType, int Interface, int n);
322 1.1.6.2 bouyer extern PnP_TAG_PACKET *PnP_find_packet(unsigned char *p, unsigned packet_tag,
323 1.1.6.2 bouyer int n);
324 1.1.6.2 bouyer extern PnP_TAG_PACKET *PnP_find_small_vendor_packet(unsigned char *p,
325 1.1.6.2 bouyer unsigned packet_type,
326 1.1.6.2 bouyer int n);
327 1.1.6.2 bouyer extern PnP_TAG_PACKET *PnP_find_large_vendor_packet(unsigned char *p,
328 1.1.6.2 bouyer unsigned packet_type,
329 1.1.6.2 bouyer int n);
330 1.1.6.2 bouyer #endif /* __ASSEMBLY__ */
331 1.1.6.2 bouyer #endif /* ndef _RESIDUAL_ */
332 1.1.6.2 bouyer
333