Files
system76-coreboot/src/mainboard/intel/tglrvp/board_id.c
Jeremy Compostella f65ae7490a clean-up: Remove the no more necessary ENV_HAS_DATA_SECTION flag
With commit b7832de026 ("x86: Add .data
section support for pre-memory stages"), the `ENV_HAS_DATA_SECTION'
flag and its derivatives can now be removed from the code.

Change-Id: Ic0afac76264a9bd4a9c93ca35c90bd84e9b747a2
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77291
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2023-09-18 13:18:23 +00:00

40 lines
765 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <boardid.h>
#include <ec/acpi/ec.h>
#include <ec/google/chromeec/ec.h>
#include <stdint.h>
#include "board_id.h"
static uint32_t get_board_id_via_ext_ec(void)
{
uint32_t id = BOARD_ID_INIT;
if (google_chromeec_get_board_version(&id))
id = BOARD_ID_UNKNOWN;
return id;
}
/* Get Board ID via EC I/O port write/read */
int get_board_id(void)
{
static int id = -1;
if (id < 0) {
if (CONFIG(EC_GOOGLE_CHROMEEC)) {
id = get_board_id_via_ext_ec();
} else {
uint8_t buffer[2];
uint8_t index;
if (send_ec_command(EC_FAB_ID_CMD) == 0) {
for (index = 0; index < sizeof(buffer); index++)
buffer[index] = recv_ec_data();
id = (buffer[0] << 8) | buffer[1];
}
}
}
return id;
}