limine: Add SMBIOS request

This commit is contained in:
mintsuki 2022-03-17 19:59:03 +01:00
parent 4f90e0c723
commit 50076656f4
3 changed files with 56 additions and 0 deletions

View File

@ -184,4 +184,21 @@ struct limine_rsdp_request {
LIMINE_PTR(struct limine_rsdp_response *) response;
};
// SMBIOS
#define LIMINE_SMBIOS_REQUEST { LIMINE_COMMON_MAGIC, 0x9e9046f11e095391, 0xaa4a520fefbde5ee }
struct limine_smbios_response {
uint64_t flags;
LIMINE_PTR(void *) entry_32;
LIMINE_PTR(void *) entry_64;
};
struct limine_smbios_request {
uint64_t id[4];
uint64_t flags;
LIMINE_PTR(struct limine_smbios_response *) response;
};
#endif

View File

@ -256,6 +256,29 @@ FEAT_START
rsdp_request->response = reported_addr(rsdp_response);
FEAT_END
// SMBIOS feature
FEAT_START
struct limine_smbios_request *smbios_request = get_request(LIMINE_SMBIOS_REQUEST);
if (smbios_request == NULL) {
break; // next feature
}
struct limine_smbios_response *smbios_response =
ext_mem_alloc(sizeof(struct limine_smbios_response));
void *smbios_entry_32 = NULL, *smbios_entry_64 = NULL;
acpi_get_smbios(&smbios_entry_32, &smbios_entry_64);
if (smbios_entry_32) {
smbios_response->entry_32 = reported_addr(smbios_entry_32);
}
if (smbios_entry_64) {
smbios_response->entry_64 = reported_addr(smbios_entry_64);
}
smbios_request->response = reported_addr(smbios_response);
FEAT_END
// Modules
FEAT_START
struct limine_module_request *module_request = get_request(LIMINE_MODULE_REQUEST);

View File

@ -43,6 +43,12 @@ static struct limine_rsdp_request rsdp_request = {
.flags = 0, .response = NULL
};
__attribute__((used))
static struct limine_smbios_request smbios_request = {
.id = LIMINE_SMBIOS_REQUEST,
.flags = 0, .response = NULL
};
static char *get_memmap_type(uint64_t type) {
switch (type) {
case LIMINE_MEMMAP_USABLE:
@ -167,5 +173,15 @@ FEAT_START
e9_printf("RSDP at: %x", rsdp_response->address);
FEAT_END
FEAT_START
if (smbios_request.response == NULL) {
e9_printf("SMBIOS not passed");
break;
}
struct limine_smbios_response *smbios_response = smbios_request.response;
e9_printf("SMBIOS 32-bit entry at: %x", smbios_response->entry_32);
e9_printf("SMBIOS 64-bit entry at: %x", smbios_response->entry_64);
FEAT_END
for (;;);
}