Get SMBIOS from bootloader

This commit is contained in:
Alex 2022-11-19 09:54:34 +02:00
parent e535a5e0c6
commit eb980a95d9
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 15 additions and 0 deletions

View File

@ -38,6 +38,10 @@ static volatile struct limine_module_request ModuleRequest = {
.id = LIMINE_MODULE_REQUEST, .id = LIMINE_MODULE_REQUEST,
.revision = 0}; .revision = 0};
static volatile struct limine_smbios_request SmbiosRequest = {
.id = LIMINE_SMBIOS_REQUEST,
.revision = 0};
void init_limine() void init_limine()
{ {
struct BootInfo binfo; struct BootInfo binfo;
@ -60,6 +64,7 @@ void init_limine()
struct limine_rsdp_response *RsdpResponse = RsdpRequest.response; struct limine_rsdp_response *RsdpResponse = RsdpRequest.response;
struct limine_kernel_file_response *KernelFileResponse = KernelFileRequest.response; struct limine_kernel_file_response *KernelFileResponse = KernelFileRequest.response;
struct limine_module_response *ModuleResponse = ModuleRequest.response; struct limine_module_response *ModuleResponse = ModuleRequest.response;
struct limine_smbios_response *SmbiosResponse = SmbiosRequest.response;
if (FrameBufferResponse == NULL || FrameBufferResponse->framebuffer_count < 1) if (FrameBufferResponse == NULL || FrameBufferResponse->framebuffer_count < 1)
{ {
@ -218,6 +223,14 @@ void init_limine()
trace("RSDP: %p(%p) [Signature: %.8s] [OEM: %.6s]", trace("RSDP: %p(%p) [Signature: %.8s] [OEM: %.6s]",
RsdpResponse->address, binfo.RSDP, binfo.RSDP->Signature, binfo.RSDP->OEMID); RsdpResponse->address, binfo.RSDP, binfo.RSDP->Signature, binfo.RSDP->OEMID);
debug("SMBIOS: %p %p", SmbiosResponse->entry_32, SmbiosResponse->entry_64);
if (SmbiosResponse->entry_32 != NULL)
binfo.SMBIOSPtr = (void *)((uint64_t)SmbiosResponse->entry_32 - 0xffff800000000000);
else if (SmbiosResponse->entry_64 != NULL)
binfo.SMBIOSPtr = (void *)((uint64_t)SmbiosResponse->entry_64 - 0xffff800000000000);
else
binfo.SMBIOSPtr = NULL;
binfo.Kernel.PhysicalBase = (void *)KernelAddressResponse->physical_base; binfo.Kernel.PhysicalBase = (void *)KernelAddressResponse->physical_base;
binfo.Kernel.VirtualBase = (void *)KernelAddressResponse->virtual_base; binfo.Kernel.VirtualBase = (void *)KernelAddressResponse->virtual_base;
binfo.Kernel.FileBase = KernelFileResponse->kernel_file->address; binfo.Kernel.FileBase = KernelFileResponse->kernel_file->address;

View File

@ -114,6 +114,8 @@ struct BootInfo
char Name[256]; char Name[256];
char Version[64]; char Version[64];
} Bootloader; } Bootloader;
void *SMBIOSPtr;
}; };
#endif // !__FENNIX_KERNEL_BOOT_INFO_H__ #endif // !__FENNIX_KERNEL_BOOT_INFO_H__