Exemplo n.º 1
0
/*
 * Entrypoint from boot.c
 */
void setupFakeEfi(void)
{
	// Generate efi device strings 
	setup_pci_devs(root_pci_dev);

	readSMBIOSInfo(getSmbios(SMBIOS_ORIGINAL));

	// load smbios.plist file if any
	setupSmbiosConfigFile("smbios.plist");

	setupSMBIOSTable();

	// Initialize the base table
	if (archCpuType == CPU_TYPE_I386)
	{
		setupEfiTables32();
	}
	else
	{
		setupEfiTables64();
	}

	// Initialize the device tree
	setupEfiDeviceTree();

	saveOriginalSMBIOS();

	// Add configuration table entries to both the services table and the device tree
	setupEfiConfigurationTable();
}
Exemplo n.º 2
0
/*
 * Installs all the needed configuration table entries
 */
static void setupEfiConfigurationTable()
{
	smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);
	addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL);

	setupBoardId(); //need to be called after getSmbios

	// Setup ACPI with DSDT overrides (mackerintel's patch)
	setupAcpi();

	// We've obviously changed the count.. so fix up the CRC32
	if (archCpuType == CPU_TYPE_I386)
	{
		gST32->Hdr.CRC32 = 0;
		gST32->Hdr.CRC32 = crc32(0L, gST32, gST32->Hdr.HeaderSize);
	}
	else
	{
		gST64->Hdr.CRC32 = 0;
		gST64->Hdr.CRC32 = crc32(0L, gST64, gST64->Hdr.HeaderSize);
	}

	// Setup the chosen node
	setupChosenNode();
}
Exemplo n.º 3
0
void saveOriginalSMBIOS(void)
{
	Node *node;
	SMBEntryPoint *origeps;
	void *tableAddress;

	node = DT__FindNode("/efi/platform", false);
	if (!node)
	{
		verbose("/efi/platform node not found\n");
		return;
	}

	origeps = getSmbios(SMBIOS_ORIGINAL);
	if (!origeps)
	{
		return;
	}

	tableAddress = (void *)AllocateKernelMemory(origeps->dmi.tableLength);
	if (!tableAddress)
	{
		return;
	}

	memcpy(tableAddress, (void *)origeps->dmi.tableAddress, origeps->dmi.tableLength);
	DT__AddProperty(node, "SMBIOS", origeps->dmi.tableLength, tableAddress);
}
Exemplo n.º 4
0
/* Get the SystemID from the bios dmi info */
static  EFI_CHAR8* getSmbiosUUID()
{
	struct SMBEntryPoint	*smbios;
	SMBByte			*p;
	int			i, isZero, isOnes;
	static EFI_CHAR8        uuid[UUID_LEN];

	smbios = getSmbios(SMBIOS_PATCHED);	/* checks for _SM_ anchor and table header checksum */
	if (smbios==NULL) return 0; // getSmbios() return a non null value if smbios is found

	p = (SMBByte*) FindFirstDmiTableOfType(1, 0x19); /* Type 1: (3.3.2) System Information */
	if (p==NULL) return NULL;
 
	verbose("Found SMBIOS System Information Table 1\n");
	p += 8;

	for (i=0, isZero=1, isOnes=1; i<UUID_LEN; i++) {
		if (p[i] != 0x00) isZero = 0;
		if (p[i] != 0xff) isOnes = 0;
	}
	if (isZero || isOnes) {	/* empty or setable means: no uuid present */
		verbose("No UUID present in SMBIOS System Information Table\n");
		return 0;
	}

	memcpy(uuid, p, UUID_LEN);
	return uuid;
}
Exemplo n.º 5
0
/* Load the smbios.plist override config file if any */
static void setupSmbiosConfigFile()
{
  const char * value = getStringForKey(kSMBIOS, &bootInfo->bootConfig);
  extern void scan_mem();

    if (!value)  value = "/Extra/smbios.plist";
    if (loadConfigFile(value, &bootInfo->smbiosConfig) == -1) {
      verbose("No SMBIOS replacement found\n");
    }

    // get a chance to scan mem dynamically if user asks for it while having the config options loaded as well
    // as opposed to when it was in scan_platform(), also load the orig. smbios so that we can access dmi info without
    // patching the smbios yet
    getSmbios(SMBIOS_ORIGINAL);
    scan_mem(); 
    smbios_p = (EFI_PTR32) getSmbios(SMBIOS_PATCHED);	// process smbios asap
}
Exemplo n.º 6
0
/* Installs all the needed configuration table entries */
static void setupEfiConfigurationTable()
{
  smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);
  addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL);

  // Setup ACPI with DSDT overrides (mackerintel's patch)
  setupAcpi();
  
  // We've obviously changed the count.. so fix up the CRC32
  fixupEfiSystemTableCRC32(gST);
}
Exemplo n.º 7
0
static void setupSmbiosConfigFile(const char *filename)
{
	char		dirSpecSMBIOS[128] = "";
	const char *override_pathname = NULL;
	int			len = 0, err = 0;
	extern void scan_mem();
	
	// Take in account user overriding
	if (getValueForKey(kSMBIOSKey, &override_pathname, &len, &bootInfo->bootConfig) && len > 0)
	{
		// Specify a path to a file, e.g. SMBIOS=/Extra/macProXY.plist
		sprintf(dirSpecSMBIOS, override_pathname);
		err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
	}
	else
	{
		// Check selected volume's Extra.
		sprintf(dirSpecSMBIOS, "/Extra/%s", filename);
		if (err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig))
		{
			// Check booter volume/rdbt Extra.
			sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename);
			err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
		}
	}

	if (err)
	{
		verbose("No SMBIOS replacement found.\n");
	}

	// get a chance to scan mem dynamically if user asks for it while having the config options loaded as well,
	// as opposed to when it was in scan_platform(); also load the orig. smbios so that we can access dmi info without
	// patching the smbios yet
	getSmbios(SMBIOS_ORIGINAL);
	scan_mem(); 
	smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);	// process smbios asap
}
Exemplo n.º 8
0
/** Find next original dmi Table with a particular type */
struct DMIHeader* FindNextDmiTableOfType(int type, int minlength)
{
    int i;

    if (ftTablePairInit) getSmbios(SMBIOS_ORIGINAL);

    for (i=current_pos; i < DmiTablePairCount; i++) {
        if (type == DmiTablePair[i].type && 
            DmiTablePair[i].dmi &&
            DmiTablePair[i].dmi->length >= minlength ) {
            current_pos = i+1;
            return DmiTablePair[i].dmi;
        }
    }
    return NULL; // not found
};