void updateEFITree(char *rootUUID) { _EFI_DEBUG_DUMP("In updateEFITree(%s)\n", rootUUID); static EFI_CHAR8 const SYSTEM_ID[] = STATIC_SYSTEM_ID; // This is your hardcoded SYSTEM_ID (see: config/settings.h). EFI_UINT32 * targetUUID = (EFI_UINT32 *) &SYSTEM_ID; #if UNUSED_EFI_CODE // Feature to set your own, uuidgen generated string in com.apple.Boot.plist // Note: Unsupported feature in Revolution (you need to compile it anyway). const char* userDefinedUUID = newStringForKey("SystemID", &bootInfo->bootConfig); if (userDefinedUUID) { targetUUID = getUUIDFromString(userDefinedUUID); if (targetUUID) { _EFI_DEBUG_DUMP("Customizing SystemID with: %s\n", userDefinedUUID); } free ((void*) userDefinedUUID); } #endif DT__AddProperty(gPlatform.EFI.Nodes.Platform, "system-id", 16, targetUUID); // gPlatform.EFI.Nodes.Platform = NULL; setRootUUID(gPlatform.EFI.Nodes.Chosen, rootUUID); // gPlatform.EFI.Nodes.Chosen = NULL; /* * Check the architectures' target (boot) mode against the chosen setting of * EFI_64_BIT, which may not fit well and throw the dreadful * "tsc_init: EFI not supported" (due to a mismatch of the chosen/supported * boot/EFI mode) or KP with a page fault after booting with EFI_64_BIT set * to 0 on a 64-bit platform (can be done - read my comment in platform.c). */ if (bootArgs->efiMode != ((EFI_64_BIT) ? 64 : 32)) { stop("EFI_64_BIT setting (%d) error detected (%d)!\n", EFI_64_BIT, bootArgs->efiMode); } _EFI_DEBUG_SLEEP(5); }
void setupEfiDeviceTree(void) { Node *node; const char * sz_system_id=0; EFI_CHAR8* ret=0; node = DT__FindNode("/", false); if (node == 0) { stop("Couldn't get root node"); } /* We could also just do DT__FindNode("/efi/platform", true) * But I think eventually we want to fill stuff in the efi node * too so we might as well create it so we have a pointer for it too. */ node = DT__AddChild(node, "efi"); DT__AddProperty(node, FIRMWARE_REVISION_PROP, sizeof(FIRMWARE_REVISION), (EFI_UINT32*)&FIRMWARE_REVISION); DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_PROP_VALUE), (char*)FIRMWARE_ABI_PROP_VALUE); DT__AddProperty(node, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16*)FIRMWARE_VENDOR); /* TODO: Fill in other efi properties if necessary */ /* Set up the /efi/runtime-services table node similar to the way a child node of configuration-table * is set up. That is, name and table properties */ Node *runtimeServicesNode = DT__AddChild(node, "runtime-services"); /* The value of the table property is the 32-bit physical address for the RuntimeServices table. * Sice the EFI system table already has a pointer to it, we simply use the address of that pointer * for the pointer to the property data. Warning.. DT finalization calls free on that but we're not * the only thing to use a non-malloc'd pointer for something in the DT */ DT__AddProperty(runtimeServicesNode, "table", sizeof(uint64_t), &gST->RuntimeServices); /* Set up the /efi/configuration-table node which will eventually have several child nodes for * all of the configuration tables needed by various kernel extensions. */ gEfiConfigurationTableNode = DT__AddChild(node, "configuration-table"); /* Now fill in the /efi/platform Node */ Node *efiPlatformNode = DT__AddChild(node, "platform"); /* NOTE WELL: If you do add FSB Frequency detection, make sure to store * the value in the fsbFrequency global and not an malloc'd pointer * because the DT_AddProperty function does not copy its args. */ if(fsbFrequency != 0) DT__AddProperty(efiPlatformNode, FSB_Frequency_prop, sizeof(uint64_t), &fsbFrequency); // rek: Give the user a chance to set a fixed/reproduceable system UUID from the bootConfig sz_system_id = newStringForKey("SystemID", &bootInfo->bootConfig); ret = getUUIDFromString(sz_system_id); if (sz_system_id) { if (ret) { verbose("Customizing SystemID with : %s\n", sz_system_id); DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, sizeof(SYSTEM_ID), (EFI_UINT32*) ret); } free((void*) sz_system_id); } else // unable to determine UUID for host. Error: 35 fix DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, sizeof(SYSTEM_ID), (EFI_UINT32*)&SYSTEM_ID); /* Export TSC and CPU frequencies for use by the kernel or KEXTs */ if(tscFrequency != 0) DT__AddProperty(efiPlatformNode, TSC_Frequency_prop, sizeof(uint64_t), &tscFrequency); if(cpuFrequency != 0) DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(uint64_t), &cpuFrequency); /* Fill /efi/device-properties node. */ setupDeviceProperties(node); }