Exemplo n.º 1
0
const struct imsm_orom *find_imsm_efi(enum sys_dev_type hba_id)
{
	if (hba_id >= SYS_DEV_MAX)
		return NULL;

	dprintf("EFI CAP: %p,  pid: %d pop: %d\n",
		&imsm_efi[hba_id], (int) getpid(), populated_efi[hba_id]);

	/* it's static data so we only need to read it once */
	if (populated_efi[hba_id]) {
		dprintf("EFI CAP: %p, pid: %d pop: %d\n",
			&imsm_efi[hba_id], (int) getpid(), populated_efi[hba_id]);
		return &imsm_efi[hba_id];
	}
	if (check_env("IMSM_TEST_AHCI_EFI") ||
	    check_env("IMSM_TEST_SCU_EFI")) {
		dprintf("OROM CAP: %p,  pid: %d pop: %d\n",
			&imsm_efi[hba_id], (int) getpid(), populated_efi[hba_id]);
		return imsm_platform_test(hba_id, &populated_efi[hba_id], &imsm_efi[hba_id]);
	}
	/* OROM test is set, return that there is no EFI capabilities */
	if (check_env("IMSM_TEST_OROM"))
		return NULL;

	if (read_efi_variable(&imsm_efi[hba_id], sizeof(imsm_efi[0]), hba_id == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID)) {
		populated_efi[hba_id] = 0;
		return NULL;
	}

	populated_efi[hba_id] = 1;
	return &imsm_efi[hba_id];
}
Exemplo n.º 2
0
char* boot_entry_name(uint16_t id) {
    char buffer[9];
    uint16_t *data = NULL;
    int length, i;
    char* name = (char *)malloc(64 * sizeof(char));
    sprintf_s(buffer, 9, "Boot%04x", id);
    length = read_efi_variable(buffer, &data);
    for (i = 3; i < length; i++) {
        if (data[i] == 0) break;
        name[i - 3] = data[i];
    }
    name[i - 3] = 0;
    return name;
}
Exemplo n.º 3
0
int boot_entry_list(uint16_t** list) {
    uint16_t *data = NULL;
    int length = read_efi_variable("BootOrder", &data);
    *list = data;
    return length;
}