Pass the HCDP table address to the kernel. If no such table exists,

NULL is passed. The address of the HCDP table can be found by
iterating over the configuration tables in the EFI system table.
To avoid more duplication, a function can be called with the GUID
of interest. The function will do the scanning. Use the function
in all places where we iterate over the configuration tables in
an attempt to find a specific one.

Bump the loader version number as the result of this.

Approved by: re (blanket)
This commit is contained in:
marcel 2002-12-10 20:11:20 +00:00
parent 2efe31ec15
commit 9050c80f1d
8 changed files with 33 additions and 28 deletions

View File

@ -31,6 +31,7 @@ extern EFI_SYSTEM_TABLE *ST;
extern EFI_BOOT_SERVICES *BS;
extern EFI_RUNTIME_SERVICES *RS;
void *efi_get_table(EFI_GUID *tbl);
void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table);
EFI_STATUS main(int argc, CHAR16 *argv[]);

View File

@ -39,6 +39,8 @@
#include "bootstrap.h"
static EFI_GUID hcdp = HCDP_TABLE_GUID;
/*
* Return a 'boothowto' value corresponding to the kernel arguments in
* (kargs) and any relevant environment variables.
@ -300,6 +302,7 @@ bi_load(struct bootinfo *bi, struct preloaded_file *fp, UINTN *mapkey,
bi->bi_symtab = ssym;
bi->bi_esymtab = esym;
bi->bi_hcdp = (uint64_t)efi_get_table(&hcdp); /* DIG64 HCDP table addr. */
fpswa_init(&bi->bi_fpswa); /* find FPSWA interface */
/* find the last module in the chain */

View File

@ -59,6 +59,20 @@ arg_skipword(CHAR16 *argp)
return (argp);
}
void *
efi_get_table(EFI_GUID *tbl)
{
EFI_GUID *id;
int i;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
id = &ST->ConfigurationTable[i].VendorGuid;
if (!memcmp(id, tbl, sizeof(EFI_GUID)))
return (ST->ConfigurationTable[i].VendorTable);
}
return (NULL);
}
void exit(EFI_STATUS exit_code)
{

View File

@ -72,13 +72,8 @@ find_pal_proc(void)
};
u_int8_t *p;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
if (!memcmp(&ST->ConfigurationTable[i].VendorGuid,
&sal, sizeof(EFI_GUID)))
saltab = ST->ConfigurationTable[i].VendorTable;
}
if (!saltab) {
saltab = efi_get_table(&sal);
if (saltab == NULL) {
printf("Can't find SAL System Table\n");
return;
}
@ -336,13 +331,8 @@ command_sal(int argc, char *argv[])
};
u_int8_t *p;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
if (!memcmp(&ST->ConfigurationTable[i].VendorGuid,
&sal, sizeof(EFI_GUID)))
saltab = ST->ConfigurationTable[i].VendorTable;
}
if (!saltab) {
saltab = efi_get_table(&sal);
if (saltab == NULL) {
printf("Can't find SAL System Table\n");
return CMD_ERROR;
}

View File

@ -3,6 +3,8 @@ $FreeBSD$
NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
file is important. Make sure the current version number is on line 6.
1.1: Pass the HCDP table address to the kernel via bootinfo if one
is present in the EFI system table.
1.0: Don't map the I/O port range. We expect the kernel to do it. It
was done in the loader as a debugging aid and not intended as a
service/feature.

View File

@ -39,6 +39,8 @@
#include "bootstrap.h"
static EFI_GUID hcdp = HCDP_TABLE_GUID;
/*
* Return a 'boothowto' value corresponding to the kernel arguments in
* (kargs) and any relevant environment variables.
@ -300,6 +302,7 @@ bi_load(struct bootinfo *bi, struct preloaded_file *fp, UINTN *mapkey,
bi->bi_symtab = ssym;
bi->bi_esymtab = esym;
bi->bi_hcdp = (uint64_t)efi_get_table(&hcdp); /* DIG64 HCDP table addr. */
fpswa_init(&bi->bi_fpswa); /* find FPSWA interface */
/* find the last module in the chain */

View File

@ -72,13 +72,8 @@ find_pal_proc(void)
};
u_int8_t *p;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
if (!memcmp(&ST->ConfigurationTable[i].VendorGuid,
&sal, sizeof(EFI_GUID)))
saltab = ST->ConfigurationTable[i].VendorTable;
}
if (!saltab) {
saltab = efi_get_table(&sal);
if (saltab == NULL) {
printf("Can't find SAL System Table\n");
return;
}
@ -336,13 +331,8 @@ command_sal(int argc, char *argv[])
};
u_int8_t *p;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
if (!memcmp(&ST->ConfigurationTable[i].VendorGuid,
&sal, sizeof(EFI_GUID)))
saltab = ST->ConfigurationTable[i].VendorTable;
}
if (!saltab) {
saltab = efi_get_table(&sal);
if (saltab == NULL) {
printf("Can't find SAL System Table\n");
return CMD_ERROR;
}

View File

@ -3,6 +3,8 @@ $FreeBSD$
NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
file is important. Make sure the current version number is on line 6.
1.1: Pass the HCDP table address to the kernel via bootinfo if one
is present in the EFI system table.
1.0: Don't map the I/O port range. We expect the kernel to do it. It
was done in the loader as a debugging aid and not intended as a
service/feature.