coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
boardid.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <boardid.h>
4 #include <console/console.h>
5 #include <gpio.h>
6 
8 {
9  static int id = -1;
10 
11  if (id < 0) {
12  id = gpio_get(GPIO(Q3)) << 0 |
13  gpio_get(GPIO(T1)) << 1 |
14  gpio_get(GPIO(X1)) << 2 |
15  gpio_get(GPIO(X4)) << 3;
16  printk(BIOS_SPEW, "Board ID: %#x.\n", id);
17  }
18 
19  return id;
20 }
#define printk(level,...)
Definition: stdlib.h:16
@ GPIO
Definition: chip.h:84
uint32_t board_id(void)
board_id() - Get the board version
Definition: boardid.c:6
int gpio_get(gpio_t gpio)
Definition: gpio.c:166
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
Definition: loglevel.h:142
unsigned int uint32_t
Definition: stdint.h:14