| 1 |
/* smbios.c - get smbios tables. */ |
| 2 |
/* |
| 3 |
* GRUB -- GRand Unified Bootloader |
| 4 |
* Copyright (C) 2019 Free Software Foundation, Inc. |
| 5 |
* |
| 6 |
* GRUB is free software: you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation, either version 3 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* GRUB is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <grub/acpi.h> |
| 21 |
#include <grub/smbios.h> |
| 22 |
#include <grub/misc.h> |
| 23 |
|
| 24 |
struct grub_smbios_eps * |
| 25 |
grub_machine_smbios_get_eps (void) |
| 26 |
{ |
| 27 |
grub_uint8_t *ptr; |
| 28 |
|
| 29 |
grub_dprintf ("smbios", "Looking for SMBIOS EPS. Scanning BIOS\n"); |
| 30 |
|
| 31 |
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000; ptr += 16) |
| 32 |
if (grub_memcmp (ptr, "_SM_", 4) == 0 |
| 33 |
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps)) == 0) |
| 34 |
return (struct grub_smbios_eps *) ptr; |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |
| 38 |
|
| 39 |
struct grub_smbios_eps3 * |
| 40 |
grub_machine_smbios_get_eps3 (void) |
| 41 |
{ |
| 42 |
grub_uint8_t *ptr; |
| 43 |
|
| 44 |
grub_dprintf ("smbios", "Looking for SMBIOS3 EPS. Scanning BIOS\n"); |
| 45 |
|
| 46 |
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000; ptr += 16) |
| 47 |
if (grub_memcmp (ptr, "_SM3_", 5) == 0 |
| 48 |
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps3)) == 0) |
| 49 |
return (struct grub_smbios_eps3 *) ptr; |
| 50 |
|
| 51 |
return 0; |
| 52 |
} |