Come to think of it, I ended up doing quite a bit of cpuid.c. See usr/src/uts/chrp/os/cpuid.c
The table of version numbers to look up properties for each model is pretty reasonably documented in a block comment in the code. The cache geometry parts of the table have been #ifdef'ed out, but not completely removed. They have fallen into disuse, in favor of getting PROM properties through VOF calls. A table is better than what was there before I arrived, but as it is implemented now, it is not ideal. The table was designed before we pretty much settled on using VOF and getting cache properties from PROM. If we move to other bootware, the method for getting cache properties might have to change, again. Since the data structure is static and fragile, in the sense that searches don't work if entries are not placed in their proper order, some mistake-proofing code was added. If Solaris/PPC ever got really seriously involved in supporting many platforms, and if it were not always done by means of VOF or OF properties, then I would rather use a mini-language to generate the C code for the table. That would hoist the mistake-proofing to build-time, where it belongs. After the really common code, cpuid() dispatches to model-specific cpuid code. The only really tested code is init_mpc745x(). Since, even the existence of HID0 and HID1 registers is model-specific, let alone the interpretation of the bits, there is no generic code to handle these. However, helper functions, like modify_hid0(), are intended to be generally re-usable by other models that have an HID0 register, even if their encoding is different. modify_hid0() is basically a glorified assignment statement. It's just that it goes out of its way to show its work. Errata ------ A skeleton of code for handling CPU errata was taken out of the cpuid code for x86. It is empty. It just preserves the form: small numbers for manufacturers' errata and 7-digit numbers for Sun bug numbers. I would bet that someone else would know better than I how to fill in some real values. chipid ------ All of the platform-specific functions, chip_plat_*() and cpuid_get_*(), are just dummy functions that show a trace message saying that they don't do anything. -- Guy Shaw