residual.h 14 KB

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