mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: pcengines/apu2: Add serial number in SMBIOS
BUG=none
BRANCH=none
TEST=none
Change-Id: I906361ecf939bb36ec395f4fb762a5b7fc6bb712
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 01bf599ea8
Original-Change-Id: Ic8149b1dd19d70935e00881cffa7ead0960d1c78
Original-Signed-off-by: Kysti Mlkki <kyosti.malkki@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/18154
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Piotr Krl <piotr.krol@3mdeb.com>
Reviewed-on: https://chromium-review.googlesource.com/430624
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
57f8c53a94
commit
0853c91c7d
1 changed files with 32 additions and 0 deletions
|
@ -190,6 +190,38 @@ static void mainboard_enable(device_t dev)
|
|||
pirq_setup();
|
||||
}
|
||||
|
||||
/*
|
||||
* We will stuff a modified version of the first NICs (BDF 1:0.0) MAC address
|
||||
* into the smbios serial number location.
|
||||
*/
|
||||
const char *smbios_mainboard_serial_number(void)
|
||||
{
|
||||
static char serial[10];
|
||||
device_t nic_dev;
|
||||
uintptr_t bar10;
|
||||
u32 mac_addr = 0;
|
||||
int i;
|
||||
|
||||
nic_dev = dev_find_slot(1, PCI_DEVFN(0, 0));
|
||||
if ((serial[0] != 0) || !nic_dev)
|
||||
return serial;
|
||||
|
||||
/* Read in the last 3 bytes of NIC's MAC address. */
|
||||
bar10 = pci_read_config32(nic_dev, 0x10);
|
||||
bar10 &= 0xFFFE0000;
|
||||
bar10 += 0x5400;
|
||||
for (i = 3; i < 6; i++) {
|
||||
mac_addr <<= 8;
|
||||
mac_addr |= read8((u8 *)bar10 + i);
|
||||
}
|
||||
mac_addr &= 0x00FFFFFF;
|
||||
mac_addr /= 4;
|
||||
mac_addr -= 64;
|
||||
|
||||
snprintf(serial, sizeof(serial), "%d", mac_addr);
|
||||
return serial;
|
||||
}
|
||||
|
||||
/*
|
||||
* We will stuff the memory size into the smbios sku location.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue