51 lines
1.7 KiB
C
51 lines
1.7 KiB
C
/* smbios.c - get smbios tables. */
|
|
/*
|
|
* VasEBoot -- GRand Unified Bootloader
|
|
* Copyright (C) 2015 Free Software Foundation, Inc.
|
|
*
|
|
* VasEBoot is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* VasEBoot is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <VasEBoot/acpi.h>
|
|
#include <VasEBoot/smbios.h>
|
|
#include <VasEBoot/misc.h>
|
|
|
|
struct VasEBoot_smbios_eps *
|
|
VasEBoot_machine_smbios_get_eps (void)
|
|
{
|
|
VasEBoot_uint8_t *ptr;
|
|
|
|
VasEBoot_dprintf ("smbios", "Looking for SMBIOS EPS. Scanning BIOS\n");
|
|
for (ptr = (VasEBoot_uint8_t *) 0xf0000; ptr < (VasEBoot_uint8_t *) 0x100000;
|
|
ptr += 16)
|
|
if (VasEBoot_memcmp (ptr, "_SM_", 4) == 0
|
|
&& VasEBoot_byte_checksum (ptr, sizeof (struct VasEBoot_smbios_eps)) == 0)
|
|
return (struct VasEBoot_smbios_eps *) ptr;
|
|
return 0;
|
|
}
|
|
|
|
struct VasEBoot_smbios_eps3 *
|
|
VasEBoot_machine_smbios_get_eps3 (void)
|
|
{
|
|
VasEBoot_uint8_t *ptr;
|
|
|
|
VasEBoot_dprintf ("smbios", "Looking for SMBIOS3 EPS. Scanning BIOS\n");
|
|
for (ptr = (VasEBoot_uint8_t *) 0xf0000; ptr < (VasEBoot_uint8_t *) 0x100000;
|
|
ptr += 16)
|
|
if (VasEBoot_memcmp (ptr, "_SM3_", 5) == 0
|
|
&& VasEBoot_byte_checksum (ptr, sizeof (struct VasEBoot_smbios_eps3)) == 0)
|
|
return (struct VasEBoot_smbios_eps3 *) ptr;
|
|
return 0;
|
|
}
|