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
7
/*
8
* Gale boards dedicate to the board ID three GPIOs in ternary mode: 64, 65
9
* and 66.
10
*/
11
12
static
int
board_id_value
= -1;
13
14
static
uint8_t
get_board_id
(
void
)
15
{
16
uint8_t
bid;
17
gpio_t
hw_rev_gpios[] = {[2] = 66, [1] = 65, [0] = 64};
/* 64 is LSB */
18
19
bid =
gpio_binary_first_base3_value
(hw_rev_gpios,
20
ARRAY_SIZE
(hw_rev_gpios));
21
printk
(
BIOS_INFO
,
"Board ID %d\n"
, bid);
22
23
return
bid;
24
}
25
26
uint32_t
board_id
(
void
)
27
{
28
if
(
board_id_value
< 0)
29
board_id_value
=
get_board_id
();
30
31
return
board_id_value
;
32
}
boardid.h
ARRAY_SIZE
#define ARRAY_SIZE(a)
Definition:
helpers.h:12
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
board_id
uint32_t board_id(void)
board_id() - Get the board version
Definition:
boardid.c:6
gpio_binary_first_base3_value
static uint32_t gpio_binary_first_base3_value(const gpio_t gpio[], int num_gpio)
Definition:
gpio.h:93
BIOS_INFO
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition:
loglevel.h:113
get_board_id
static uint8_t get_board_id(void)
Definition:
boardid.c:14
board_id_value
static int board_id_value
Definition:
boardid.c:12
uint32_t
unsigned int uint32_t
Definition:
stdint.h:14
uint8_t
unsigned char uint8_t
Definition:
stdint.h:8
gpio_t
Definition:
gpio_base.h:7
src
mainboard
google
gale
boardid.c
Generated by
1.9.1