1
2
3
4
5
6
7
8
9
10
11
12
13#ifdef __KERNEL__
14#ifndef _RESIDUAL_
15#define _RESIDUAL_
16
17#ifndef __ASSEMBLY__
18
19#define MAX_CPUS 32
20#define MAX_MEMS 64
21#define MAX_DEVICES 256
22#define AVE_PNP_SIZE 32
23#define MAX_MEM_SEGS 64
24
25
26
27
28
29#include <asm/pnp.h>
30
31typedef enum _L1CACHE_TYPE {
32 NoneCAC = 0,
33 SplitCAC = 1,
34 CombinedCAC = 2
35 } L1CACHE_TYPE;
36
37typedef enum _TLB_TYPE {
38 NoneTLB = 0,
39 SplitTLB = 1,
40 CombinedTLB = 2
41 } TLB_TYPE;
42
43typedef enum _FIRMWARE_SUPPORT {
44 Conventional = 0x01,
45 OpenFirmware = 0x02,
46 Diagnostics = 0x04,
47 LowDebug = 0x08,
48 Multiboot = 0x10,
49 LowClient = 0x20,
50 Hex41 = 0x40,
51 FAT = 0x80,
52 ISO9660 = 0x0100,
53 SCSI_InitiatorID_Override = 0x0200,
54 Tape_Boot = 0x0400,
55 FW_Boot_Path = 0x0800
56 } FIRMWARE_SUPPORT;
57
58typedef enum _FIRMWARE_SUPPLIERS {
59 IBMFirmware = 0x00,
60 MotoFirmware = 0x01,
61 FirmWorks = 0x02,
62 Bull = 0x03,
63 } FIRMWARE_SUPPLIERS;
64
65typedef enum _ENDIAN_SWITCH_METHODS {
66 UsePort92 = 0x01,
67 UsePCIConfigA8 = 0x02,
68 UseFF001030 = 0x03,
69 } ENDIAN_SWITCH_METHODS;
70
71typedef enum _SPREAD_IO_METHODS {
72 UsePort850 = 0x00,
73
74 } SPREAD_IO_METHODS;
75
76typedef struct _VPD {
77
78
79 unsigned char PrintableModel[32];
80
81
82
83
84 unsigned char Serial[16];
85
86
87
88
89 unsigned char Reserved[48];
90 unsigned long FirmwareSupplier;
91 unsigned long FirmwareSupports;
92 unsigned long NvramSize;
93 unsigned long NumSIMMSlots;
94 unsigned short EndianSwitchMethod;
95 unsigned short SpreadIOMethod;
96 unsigned long SmpIar;
97 unsigned long RAMErrLogOffset;
98 unsigned long Reserved5;
99 unsigned long Reserved6;
100 unsigned long ProcessorHz;
101 unsigned long ProcessorBusHz;
102 unsigned long Reserved7;
103 unsigned long TimeBaseDivisor;
104 unsigned long WordWidth;
105 unsigned long PageSize;
106 unsigned long CoherenceBlockSize;
107
108
109 unsigned long GranuleSize;
110
111
112
113 unsigned long CacheSize;
114
115
116 unsigned long CacheAttrib;
117 unsigned long CacheAssoc;
118
119
120 unsigned long CacheLineSize;
121
122
123
124 unsigned long I_CacheSize;
125 unsigned long I_CacheAssoc;
126 unsigned long I_CacheLineSize;
127 unsigned long D_CacheSize;
128 unsigned long D_CacheAssoc;
129 unsigned long D_CacheLineSize;
130
131
132 unsigned long TLBSize;
133 unsigned long TLBAttrib;
134 unsigned long TLBAssoc;
135
136
137
138 unsigned long I_TLBSize;
139 unsigned long I_TLBAssoc;
140 unsigned long D_TLBSize;
141 unsigned long D_TLBAssoc;
142
143 unsigned long ExtendedVPD;
144
145 } VPD;
146
147typedef enum _DEVICE_FLAGS {
148 Enabled = 0x4000,
149 Integrated = 0x2000,
150 Failed = 0x1000,
151 Static = 0x0800,
152
153 Dock = 0x0400,
154
155 Boot = 0x0200,
156
157 Configurable = 0x0100,
158 Disableable = 0x80,
159 PowerManaged = 0x40,
160 ReadOnly = 0x20,
161 Removable = 0x10,
162 ConsoleIn = 0x08,
163 ConsoleOut = 0x04,
164 Input = 0x02,
165 Output = 0x01
166 } DEVICE_FLAGS;
167
168typedef enum _BUS_ID {
169 ISADEVICE = 0x01,
170 EISADEVICE = 0x02,
171 PCIDEVICE = 0x04,
172 PCMCIADEVICE = 0x08,
173 PNPISADEVICE = 0x10,
174 MCADEVICE = 0x20,
175 MXDEVICE = 0x40,
176 PROCESSORDEVICE = 0x80,
177 VMEDEVICE = 0x100,
178 } BUS_ID;
179
180typedef struct _DEVICE_ID {
181 unsigned long BusId;
182 unsigned long DevId;
183 unsigned long SerialNum;
184
185 unsigned long Flags;
186 unsigned char BaseType;
187 unsigned char SubType;
188 unsigned char Interface;
189 unsigned char Spare;
190 } DEVICE_ID;
191
192typedef union _BUS_ACCESS {
193 struct _PnPAccess{
194 unsigned char CSN;
195 unsigned char LogicalDevNumber;
196 unsigned short ReadDataPort;
197 } PnPAccess;
198 struct _ISAAccess{
199 unsigned char SlotNumber;
200
201 unsigned char LogicalDevNumber;
202 unsigned short ISAReserved;
203 } ISAAccess;
204 struct _MCAAccess{
205 unsigned char SlotNumber;
206 unsigned char LogicalDevNumber;
207 unsigned short MCAReserved;
208 } MCAAccess;
209 struct _PCMCIAAccess{
210 unsigned char SlotNumber;
211 unsigned char LogicalDevNumber;
212 unsigned short PCMCIAReserved;
213 } PCMCIAAccess;
214 struct _EISAAccess{
215 unsigned char SlotNumber;
216 unsigned char FunctionNumber;
217 unsigned short EISAReserved;
218 } EISAAccess;
219 struct _PCIAccess{
220 unsigned char BusNumber;
221 unsigned char DevFuncNumber;
222 unsigned short PCIReserved;
223 } PCIAccess;
224 struct _ProcBusAccess{
225 unsigned char BusNumber;
226 unsigned char BUID;
227 unsigned short ProcBusReserved;
228 } ProcBusAccess;
229 } BUS_ACCESS;
230
231
232typedef struct _PPC_DEVICE {
233 DEVICE_ID DeviceId;
234 BUS_ACCESS BusAccess;
235
236
237
238 unsigned long AllocatedOffset;
239 unsigned long PossibleOffset;
240 unsigned long CompatibleOffset;
241 } PPC_DEVICE;
242
243typedef enum _CPU_STATE {
244 CPU_GOOD = 0,
245 CPU_GOOD_FW = 1,
246 CPU_OFF = 2,
247 CPU_FAILED = 3,
248 CPU_NOT_PRESENT = 255
249 } CPU_STATE;
250
251typedef struct _PPC_CPU {
252 unsigned long CpuType;
253
254
255
256 unsigned char CpuNumber;
257 unsigned char CpuState;
258 unsigned short Reserved;
259 } PPC_CPU;
260
261typedef struct _PPC_MEM {
262 unsigned long SIMMSize;
263
264 } PPC_MEM;
265
266typedef enum _MEM_USAGE {
267 Other = 0x8000,
268 ResumeBlock = 0x4000,
269 SystemROM = 0x2000,
270 UnPopSystemROM = 0x1000,
271 IOMemory = 0x0800,
272 SystemIO = 0x0400,
273 SystemRegs = 0x0200,
274 PCIAddr = 0x0100,
275 PCIConfig = 0x80,
276 ISAAddr = 0x40,
277 Unpopulated = 0x20,
278 Free = 0x10,
279 BootImage = 0x08,
280 FirmwareCode = 0x04,
281 FirmwareHeap = 0x02,
282 FirmwareStack = 0x01
283 } MEM_USAGE;
284
285typedef struct _MEM_MAP {
286 unsigned long Usage;
287 unsigned long BasePage;
288 unsigned long PageCount;
289 } MEM_MAP;
290
291typedef struct _RESIDUAL {
292 unsigned long ResidualLength;
293 unsigned char Version;
294 unsigned char Revision;
295 unsigned short EC;
296
297 VPD VitalProductData;
298
299 unsigned short MaxNumCpus;
300 unsigned short ActualNumCpus;
301
302
303 PPC_CPU Cpus[MAX_CPUS];
304
305 unsigned long TotalMemory;
306 unsigned long GoodMemory;
307 unsigned long ActualNumMemSegs;
308 MEM_MAP Segs[MAX_MEM_SEGS];
309 unsigned long ActualNumMemories;
310 PPC_MEM Memories[MAX_MEMS];
311
312 unsigned long ActualNumDevices;
313 PPC_DEVICE Devices[MAX_DEVICES];
314 unsigned char DevicePnPHeap[2*MAX_DEVICES*AVE_PNP_SIZE];
315 } RESIDUAL;
316
317
318
319
320
321
322struct pci_dev;
323
324extern RESIDUAL *res;
325extern void print_residual_device_info(void);
326extern PPC_DEVICE *residual_find_device(unsigned long BusMask,
327 unsigned char * DevID, int BaseType,
328 int SubType, int Interface, int n);
329extern int residual_pcidev_irq(struct pci_dev *dev);
330extern void residual_irq_mask(char *irq_edge_mask_lo, char *irq_edge_mask_hi);
331extern unsigned int residual_isapic_addr(void);
332extern PnP_TAG_PACKET *PnP_find_packet(unsigned char *p, unsigned packet_tag,
333 int n);
334extern PnP_TAG_PACKET *PnP_find_small_vendor_packet(unsigned char *p,
335 unsigned packet_type,
336 int n);
337extern PnP_TAG_PACKET *PnP_find_large_vendor_packet(unsigned char *p,
338 unsigned packet_type,
339 int n);
340
341#ifdef CONFIG_PREP_RESIDUAL
342#define have_residual_data (res && res->ResidualLength)
343#else
344#define have_residual_data 0
345#endif
346
347#endif
348#endif
349
350#endif
351