source: rtems/c/src/lib/libbsp/powerpc/shared/residual/residual.h @ 58127230

4.115
Last change on this file since 58127230 was 58127230, checked in by Till Straumann <strauman@…>, on 07/16/11 at 01:29:05

2011-07-15 Till Straumann <strauman@…>

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