File indexing completed on 2025-05-11 08:23:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _RESIDUAL_
0015 #define _RESIDUAL_
0016
0017 #ifndef ASM
0018
0019 #include <stdint.h>
0020
0021 #define MAX_CPUS 32
0022 #define MAX_MEMS 64
0023 #define MAX_DEVICES 256
0024 #define AVE_PNP_SIZE 32
0025 #define MAX_MEM_SEGS 64
0026
0027
0028
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,
0063 FirmWorks = 0x02,
0064 Bull = 0x03,
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
0077 } SPREAD_IO_METHODS;
0078
0079 typedef struct _VPD {
0080
0081
0082 unsigned char PrintableModel[32];
0083
0084
0085
0086
0087 unsigned char Serial[16];
0088
0089
0090
0091
0092 unsigned char Reserved[48];
0093 unsigned long FirmwareSupplier;
0094 unsigned long FirmwareSupports;
0095 unsigned long NvramSize;
0096 unsigned long NumSIMMSlots;
0097 unsigned short EndianSwitchMethod;
0098 unsigned short SpreadIOMethod;
0099 unsigned long SmpIar;
0100 unsigned long RAMErrLogOffset;
0101 unsigned long Reserved5;
0102 unsigned long Reserved6;
0103 unsigned long ProcessorHz;
0104 unsigned long ProcessorBusHz;
0105 unsigned long Reserved7;
0106 unsigned long TimeBaseDivisor;
0107 unsigned long WordWidth;
0108 unsigned long PageSize;
0109 unsigned long CoherenceBlockSize;
0110
0111
0112 unsigned long GranuleSize;
0113
0114
0115
0116 unsigned long CacheSize;
0117
0118
0119 unsigned long CacheAttrib;
0120 unsigned long CacheAssoc;
0121
0122
0123 unsigned long CacheLineSize;
0124
0125
0126
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
0135 unsigned long TLBSize;
0136 unsigned long TLBAttrib;
0137 unsigned long TLBAssoc;
0138
0139
0140
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;
0147
0148 } VPD;
0149
0150 typedef enum _DEVICE_FLAGS {
0151 Enabled = 0x4000,
0152 Integrated = 0x2000,
0153 Failed = 0x1000,
0154 Static = 0x0800,
0155
0156 Dock = 0x0400,
0157
0158 Boot = 0x0200,
0159
0160 Configurable = 0x0100,
0161 Disableable = 0x80,
0162 PowerManaged = 0x40,
0163 ReadOnly = 0x20,
0164 Removable = 0x10,
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,
0179 PROCESSORDEVICE = 0x80,
0180 VMEDEVICE = 0x100,
0181 } BUS_ID;
0182
0183 typedef struct _DEVICE_ID {
0184 unsigned long BusId;
0185 unsigned long DevId;
0186 unsigned long SerialNum;
0187
0188 unsigned long Flags;
0189 unsigned char BaseType;
0190 unsigned char SubType;
0191 unsigned char Interface;
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;
0203
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
0235 typedef struct _PPC_DEVICE {
0236 DEVICE_ID DeviceId;
0237 BUS_ACCESS BusAccess;
0238
0239
0240
0241 unsigned long AllocatedOffset;
0242 unsigned long PossibleOffset;
0243 unsigned long CompatibleOffset;
0244 } PPC_DEVICE;
0245
0246 typedef enum _CPU_STATE {
0247 CPU_GOOD = 0,
0248 CPU_GOOD_FW = 1,
0249 CPU_OFF = 2,
0250 CPU_FAILED = 3,
0251 CPU_NOT_PRESENT = 255
0252 } CPU_STATE;
0253
0254 typedef struct _PPC_CPU {
0255 unsigned long CpuType;
0256
0257
0258
0259 unsigned char CpuNumber;
0260 unsigned char CpuState;
0261 unsigned short Reserved;
0262 } PPC_CPU;
0263
0264 typedef struct _PPC_MEM {
0265 unsigned long SIMMSize;
0266
0267 } PPC_MEM;
0268
0269 typedef enum _MEM_USAGE {
0270 Other = 0x8000,
0271 ResumeBlock = 0x4000,
0272 SystemROM = 0x2000,
0273 UnPopSystemROM = 0x1000,
0274 IOMemory = 0x0800,
0275 SystemIO = 0x0400,
0276 SystemRegs = 0x0200,
0277 PCIAddr = 0x0100,
0278 PCIConfig = 0x80,
0279 ISAAddr = 0x40,
0280 Unpopulated = 0x20,
0281 Free = 0x10,
0282 BootImage = 0x08,
0283 FirmwareCode = 0x04,
0284 FirmwareHeap = 0x02,
0285 FirmwareStack = 0x01
0286 } MEM_USAGE;
0287
0288 typedef struct _MEM_MAP {
0289 unsigned long Usage;
0290 unsigned long BasePage;
0291 unsigned long PageCount;
0292 } MEM_MAP;
0293
0294 typedef struct _RESIDUAL {
0295 unsigned long ResidualLength;
0296 unsigned char Version;
0297 unsigned char Revision;
0298 unsigned short EC;
0299
0300 VPD VitalProductData;
0301
0302 unsigned short MaxNumCpus;
0303 unsigned short ActualNumCpus;
0304
0305
0306 PPC_CPU Cpus[MAX_CPUS];
0307
0308 unsigned long TotalMemory;
0309 unsigned long GoodMemory;
0310 unsigned long ActualNumMemSegs;
0311 MEM_MAP Segs[MAX_MEM_SEGS];
0312 unsigned long ActualNumMemories;
0313 PPC_MEM Memories[MAX_MEMS];
0314
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
0352
0353 uint32_t res_copy(void);
0354
0355 #endif
0356 #endif