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 <gpio.h>
5 #include <console/console.h>
6 #include "gpio.h"
7 
8 static int board_id_value = -1;
9 
10 static uint8_t get_board_id(void)
11 {
12  uint8_t bid = 0;
13  static gpio_t pins[] = {[2] = BOARD_ID_2, [1] = BOARD_ID_1,
14  [0] = BOARD_ID_0};
15 
17 
18  printk(BIOS_INFO, "Board ID %d\n", bid);
19 
20  return bid;
21 }
22 
24 {
25  if (board_id_value < 0)
27 
28  return board_id_value;
29 }
30 
32 {
33  uint32_t code;
34  static gpio_t pins[] = {[3] = RAM_ID_3, [2] = RAM_ID_2, [1] = RAM_ID_1,
35  [0] = RAM_ID_0};
36 
38 
39  printk(BIOS_INFO, "RAM Config: %u\n", code);
40 
41  return code;
42 }
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define printk(level,...)
Definition: stdlib.h:16
uint32_t board_id(void)
board_id() - Get the board version
Definition: boardid.c:6
uint32_t gpio_base2_value(const gpio_t gpio[], int num_gpio)
Definition: gpio.c:30
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
uint32_t ram_code(void)
Definition: boardid.c:78
static uint8_t get_board_id(void)
Definition: boardid.c:10
static int board_id_value
Definition: boardid.c:8
#define BOARD_ID_0
Definition: gpio.h:13
#define RAM_ID_3
Definition: gpio.h:18
#define RAM_ID_2
Definition: gpio.h:10
#define BOARD_ID_1
Definition: gpio.h:14
#define BOARD_ID_2
Definition: gpio.h:15
#define RAM_ID_1
Definition: gpio.h:9
#define RAM_ID_0
Definition: gpio.h:17
static struct @1213 pins[]
unsigned int uint32_t
Definition: stdint.h:14
unsigned char uint8_t
Definition: stdint.h:8