Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:53

0001 /* 7/18/95                                                                    */
0002 /*----------------------------------------------------------------------------*/
0003 /*      Residual Data header definitions and prototypes                       */
0004 /*----------------------------------------------------------------------------*/
0005 
0006 /* Structure map for RESIDUAL on PowerPC Reference Platform                   */
0007 /* residual.h - Residual data structure passed in r3.                         */
0008 /*              Load point passed in r4 to boot image.                        */
0009 /* For enum's: if given in hex then they are bit significant,                 */
0010 /*             i.e. only one bit is on for each enum                          */
0011 /* Reserved fields must be filled with zeros.                                */
0012 
0013 
0014 #ifndef _RESIDUAL_
0015 #define _RESIDUAL_
0016 
0017 #ifndef ASM
0018 
0019 #include <stdint.h>
0020 
0021 #define MAX_CPUS 32                     /* These should be set to the maximum */
0022 #define MAX_MEMS 64                     /* number possible for this system.   */
0023 #define MAX_DEVICES 256                 /* Changing these will change the     */
0024 #define AVE_PNP_SIZE 32                 /* structure, hence the version of    */
0025 #define MAX_MEM_SEGS 64                 /* this header file.                  */
0026 
0027 /*----------------------------------------------------------------------------*/
0028 /*               Public structures...                                         */
0029 /*----------------------------------------------------------------------------*/
0030 
0031 #include <bsp/pnp.h>
0032 
0033 typedef enum _L1CACHE_TYPE {
0034   NoneCAC = 0,
0035   SplitCAC = 1,
0036   CombinedCAC = 2
0037   } L1CACHE_TYPE;
0038 
0039 typedef enum _TLB_TYPE {
0040   NoneTLB = 0,
0041   SplitTLB = 1,
0042   CombinedTLB = 2
0043   } TLB_TYPE;
0044 
0045 typedef enum _FIRMWARE_SUPPORT {
0046   Conventional = 0x01,
0047   OpenFirmware = 0x02,
0048   Diagnostics = 0x04,
0049   LowDebug = 0x08,
0050   Multiboot = 0x10,
0051   LowClient = 0x20,
0052   Hex41 = 0x40,
0053   FAT = 0x80,
0054   ISO9660 = 0x0100,
0055   SCSI_InitiatorID_Override = 0x0200,
0056   Tape_Boot = 0x0400,
0057   FW_Boot_Path = 0x0800
0058   } FIRMWARE_SUPPORT;
0059 
0060 typedef enum _FIRMWARE_SUPPLIERS {
0061   IBMFirmware = 0x00,
0062   MotoFirmware = 0x01,                  /* 7/18/95                            */
0063   FirmWorks = 0x02,                     /* 10/5/95                            */
0064   Bull = 0x03,                          /* 04/03/96                           */
0065   QEMU = ('q'<<24) | ('e'<<16) | ('m'<<8) | ('u'<<0),
0066   } FIRMWARE_SUPPLIERS;
0067 
0068 typedef enum _ENDIAN_SWITCH_METHODS {
0069   UsePort92 = 0x01,
0070   UsePCIConfigA8 = 0x02,
0071   UseFF001030 = 0x03,
0072   } ENDIAN_SWITCH_METHODS;
0073 
0074 typedef enum _SPREAD_IO_METHODS {
0075   UsePort850 = 0x00,
0076 /*UsePCIConfigA8 = 0x02,*/
0077   } SPREAD_IO_METHODS;
0078 
0079 typedef struct _VPD {
0080 
0081   /* Box dependent stuff */
0082   unsigned char PrintableModel[32];     /* Null terminated string.
0083                                            Must be of the form:
0084                                            vvv,<20h>,<model designation>,<0x0>
0085                                            where vvv is the vendor ID
0086                                            e.g. IBM PPS MODEL 6015<0x0>       */
0087   unsigned char Serial[16];             /* 12/94:
0088                                            Serial Number; must be of the form:
0089                                            vvv<serial number> where vvv is the
0090                                            vendor ID.
0091                                            e.g. IBM60151234567<20h><20h>      */
0092   unsigned char Reserved[48];
0093   unsigned long FirmwareSupplier;       /* See FirmwareSuppliers enum         */
0094   unsigned long FirmwareSupports;       /* See FirmwareSupport enum           */
0095   unsigned long NvramSize;              /* Size of nvram in bytes             */
0096   unsigned long NumSIMMSlots;
0097   unsigned short EndianSwitchMethod;    /* See EndianSwitchMethods enum       */
0098   unsigned short SpreadIOMethod;        /* See SpreadIOMethods enum           */
0099   unsigned long SmpIar;
0100   unsigned long RAMErrLogOffset;        /* Heap offset to error log           */
0101   unsigned long Reserved5;
0102   unsigned long Reserved6;
0103   unsigned long ProcessorHz;            /* Processor clock frequency in Hertz */
0104   unsigned long ProcessorBusHz;         /* Processor bus clock frequency      */
0105   unsigned long Reserved7;
0106   unsigned long TimeBaseDivisor;        /* (Bus clocks per timebase tic)*1000 */
0107   unsigned long WordWidth;              /* Word width in bits                 */
0108   unsigned long PageSize;               /* Page size in bytes                 */
0109   unsigned long CoherenceBlockSize;     /* Unit of transfer in/out of cache
0110                                            for which coherency is maintained;
0111                                            normally <= CacheLineSize.         */
0112   unsigned long GranuleSize;            /* Unit of lock allocation to avoid   */
0113                                         /*   false sharing of locks.          */
0114 
0115   /* L1 Cache variables */
0116   unsigned long CacheSize;              /* L1 Cache size in KB. This is the   */
0117                                         /*   total size of the L1, whether    */
0118                                         /*   combined or split                */
0119   unsigned long CacheAttrib;            /* L1CACHE_TYPE                       */
0120   unsigned long CacheAssoc;             /* L1 Cache associativity. Use this
0121                                            for combined cache. If split, put
0122                                            zeros here.                        */
0123   unsigned long CacheLineSize;          /* L1 Cache line size in bytes. Use
0124                                            for combined cache. If split, put
0125                                            zeros here.                        */
0126   /* For split L1 Cache: (= combined if combined cache) */
0127   unsigned long I_CacheSize;
0128   unsigned long I_CacheAssoc;
0129   unsigned long I_CacheLineSize;
0130   unsigned long D_CacheSize;
0131   unsigned long D_CacheAssoc;
0132   unsigned long D_CacheLineSize;
0133 
0134   /* Translation Lookaside Buffer variables */
0135   unsigned long TLBSize;                /* Total number of TLBs on the system */
0136   unsigned long TLBAttrib;              /* Combined I+D or split TLB          */
0137   unsigned long TLBAssoc;               /* TLB Associativity. Use this for
0138                                            combined TLB. If split, put zeros
0139                                            here.                              */
0140   /* For split TLB: (= combined if combined TLB) */
0141   unsigned long I_TLBSize;
0142   unsigned long I_TLBAssoc;
0143   unsigned long D_TLBSize;
0144   unsigned long D_TLBAssoc;
0145 
0146   unsigned long ExtendedVPD;            /* Offset to extended VPD area;
0147                                            null if unused                     */
0148   } VPD;
0149 
0150 typedef enum _DEVICE_FLAGS {
0151   Enabled = 0x4000,                     /* 1 - PCI device is enabled          */
0152   Integrated = 0x2000,
0153   Failed = 0x1000,                      /* 1 - device failed POST code tests  */
0154   Static = 0x0800,                      /* 0 - dynamically configurable
0155                                            1 - static                         */
0156   Dock = 0x0400,                        /* 0 - not a docking station device
0157                                            1 - is a docking station device    */
0158   Boot = 0x0200,                        /* 0 - device cannot be used for BOOT
0159                                            1 - can be a BOOT device           */
0160   Configurable = 0x0100,                /* 1 - device is configurable         */
0161   Disableable = 0x80,                   /* 1 - device can be disabled         */
0162   PowerManaged = 0x40,                  /* 0 - not managed; 1 - managed       */
0163   ReadOnly = 0x20,                      /* 1 - device is read only            */
0164   Removable = 0x10,                     /* 1 - device is removable            */
0165   ConsoleIn = 0x08,
0166   ConsoleOut = 0x04,
0167   Input = 0x02,
0168   Output = 0x01
0169   } DEVICE_FLAGS;
0170 
0171 typedef enum _BUS_ID {
0172   ISADEVICE = 0x01,
0173   EISADEVICE = 0x02,
0174   PCIDEVICE = 0x04,
0175   PCMCIADEVICE = 0x08,
0176   PNPISADEVICE = 0x10,
0177   MCADEVICE = 0x20,
0178   MXDEVICE = 0x40,                      /* Devices on mezzanine bus           */
0179   PROCESSORDEVICE = 0x80,               /* Devices on processor bus           */
0180   VMEDEVICE = 0x100,
0181   } BUS_ID;
0182 
0183 typedef struct _DEVICE_ID {
0184   unsigned long BusId;                  /* See BUS_ID enum above              */
0185   unsigned long DevId;                  /* Big Endian format                  */
0186   unsigned long SerialNum;              /* For multiple usage of a single
0187                                            DevId                              */
0188   unsigned long Flags;                  /* See DEVICE_FLAGS enum above        */
0189   unsigned char BaseType;               /* See pnp.h for bit definitions      */
0190   unsigned char SubType;                /* See pnp.h for bit definitions      */
0191   unsigned char Interface;              /* See pnp.h for bit definitions      */
0192   unsigned char Spare;
0193   } DEVICE_ID;
0194 
0195 typedef union _BUS_ACCESS {
0196   struct _PnPAccess{
0197     unsigned char CSN;
0198     unsigned char LogicalDevNumber;
0199     unsigned short ReadDataPort;
0200     } PnPAccess;
0201   struct _ISAAccess{
0202     unsigned char SlotNumber;           /* ISA Slot Number generally not
0203                                            available; 0 if unknown            */
0204     unsigned char LogicalDevNumber;
0205     unsigned short ISAReserved;
0206     } ISAAccess;
0207   struct _MCAAccess{
0208     unsigned char SlotNumber;
0209     unsigned char LogicalDevNumber;
0210     unsigned short MCAReserved;
0211     } MCAAccess;
0212   struct _PCMCIAAccess{
0213     unsigned char SlotNumber;
0214     unsigned char LogicalDevNumber;
0215     unsigned short PCMCIAReserved;
0216     } PCMCIAAccess;
0217   struct _EISAAccess{
0218     unsigned char SlotNumber;
0219     unsigned char FunctionNumber;
0220     unsigned short EISAReserved;
0221     } EISAAccess;
0222   struct _PCIAccess{
0223     unsigned char BusNumber;
0224     unsigned char DevFuncNumber;
0225     unsigned short PCIReserved;
0226     } PCIAccess;
0227   struct _ProcBusAccess{
0228     unsigned char BusNumber;
0229     unsigned char BUID;
0230     unsigned short ProcBusReserved;
0231     } ProcBusAccess;
0232   } BUS_ACCESS;
0233 
0234 /* Per logical device information */
0235 typedef struct _PPC_DEVICE {
0236   DEVICE_ID DeviceId;
0237   BUS_ACCESS BusAccess;
0238 
0239   /* The following three are offsets into the DevicePnPHeap */
0240   /* All are in PnP compressed format                       */
0241   unsigned long AllocatedOffset;        /* Allocated resource description     */
0242   unsigned long PossibleOffset;         /* Possible resource description      */
0243   unsigned long CompatibleOffset;       /* Compatible device identifiers      */
0244   } PPC_DEVICE;
0245 
0246 typedef enum _CPU_STATE {
0247   CPU_GOOD = 0,                         /* CPU is present, and active         */
0248   CPU_GOOD_FW = 1,                      /* CPU is present, and in firmware    */
0249   CPU_OFF = 2,                          /* CPU is present, but inactive       */
0250   CPU_FAILED = 3,                       /* CPU is present, but failed POST    */
0251   CPU_NOT_PRESENT = 255                 /* CPU not present                    */
0252   } CPU_STATE;
0253 
0254 typedef struct _PPC_CPU {
0255   unsigned long CpuType;                /* Result of mfspr from Processor
0256                                            Version Register (PVR).
0257                                            PVR(0-15) = Version (e.g. 601)
0258                                            PVR(16-31 = EC Level               */
0259   unsigned char CpuNumber;              /* CPU Number for this processor      */
0260   unsigned char CpuState;               /* CPU State, see CPU_STATE enum      */
0261   unsigned short Reserved;
0262   } PPC_CPU;
0263 
0264 typedef struct _PPC_MEM {
0265   unsigned long SIMMSize;               /* 0 - absent or bad
0266                                            8M, 32M (in MB)                    */
0267   } PPC_MEM;
0268 
0269 typedef enum _MEM_USAGE {
0270   Other = 0x8000,
0271   ResumeBlock = 0x4000,                 /* for use by power management        */
0272   SystemROM = 0x2000,                   /* Flash memory (populated)           */
0273   UnPopSystemROM = 0x1000,              /* Unpopulated part of SystemROM area */
0274   IOMemory = 0x0800,
0275   SystemIO = 0x0400,
0276   SystemRegs = 0x0200,
0277   PCIAddr = 0x0100,
0278   PCIConfig = 0x80,
0279   ISAAddr = 0x40,
0280   Unpopulated = 0x20,                   /* Unpopulated part of System Memory  */
0281   Free = 0x10,                          /* Free part of System Memory         */
0282   BootImage = 0x08,                     /* BootImage part of System Memory    */
0283   FirmwareCode = 0x04,                  /* FirmwareCode part of System Memory */
0284   FirmwareHeap = 0x02,                  /* FirmwareHeap part of System Memory */
0285   FirmwareStack = 0x01                  /* FirmwareStack part of System Memory*/
0286   } MEM_USAGE;
0287 
0288 typedef struct _MEM_MAP {
0289   unsigned long Usage;                  /* See MEM_USAGE above                */
0290   unsigned long BasePage;               /* Page number measured in 4KB pages  */
0291   unsigned long PageCount;              /* Page count measured in 4KB pages   */
0292   } MEM_MAP;
0293 
0294 typedef struct _RESIDUAL {
0295   unsigned long ResidualLength;         /* Length of Residual                 */
0296   unsigned char Version;                /* of this data structure             */
0297   unsigned char Revision;               /* of this data structure             */
0298   unsigned short EC;                    /* of this data structure             */
0299   /* VPD */
0300   VPD VitalProductData;
0301   /* CPU */
0302   unsigned short MaxNumCpus;            /* Max CPUs in this system            */
0303   unsigned short ActualNumCpus;         /* ActualNumCpus < MaxNumCpus means   */
0304                                         /* that there are unpopulated or      */
0305                                         /* otherwise unusable cpu locations   */
0306   PPC_CPU Cpus[MAX_CPUS];
0307   /* Memory */
0308   unsigned long TotalMemory;            /* Total amount of memory installed   */
0309   unsigned long GoodMemory;             /* Total amount of good memory        */
0310   unsigned long ActualNumMemSegs;
0311   MEM_MAP Segs[MAX_MEM_SEGS];
0312   unsigned long ActualNumMemories;
0313   PPC_MEM Memories[MAX_MEMS];
0314   /* Devices */
0315   unsigned long ActualNumDevices;
0316   PPC_DEVICE Devices[MAX_DEVICES];
0317   unsigned char DevicePnPHeap[2*MAX_DEVICES*AVE_PNP_SIZE];
0318   } RESIDUAL;
0319 
0320 #ifndef NULL
0321 #define NULL    0
0322 #endif
0323 
0324 static inline int
0325 residual_fw_is_qemu(RESIDUAL *r)
0326 {
0327     return QEMU == r->VitalProductData.FirmwareSupplier;
0328 }
0329 
0330 extern RESIDUAL residualCopy;
0331 
0332 extern void print_residual_device_info(void);
0333 #ifndef __BOOT__
0334 extern PPC_DEVICE *residual_find_device(RESIDUAL *res, unsigned long BusMask,
0335                     unsigned char * DevID, int BaseType,
0336                     int SubType, int Interface, int n);
0337 #else
0338 extern PPC_DEVICE *residual_find_device(unsigned long BusMask,
0339                     unsigned char * DevID, int BaseType,
0340                     int SubType, int Interface, int n);
0341 #endif
0342 extern PnP_TAG_PACKET *PnP_find_packet(unsigned char *p, unsigned packet_tag,
0343                        int n);
0344 extern PnP_TAG_PACKET *PnP_find_small_vendor_packet(unsigned char *p,
0345                             unsigned packet_type,
0346                             int n);
0347 extern PnP_TAG_PACKET *PnP_find_large_vendor_packet(unsigned char *p,
0348                             unsigned packet_type,
0349                             int n);
0350 /*
0351  * Prototypes for methods called only from .S for dependency tracking
0352  */
0353 uint32_t res_copy(void);
0354 
0355 #endif /* ASM */
0356 #endif  /* ndef _RESIDUAL_ */