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
16
bid =
gpio_base2_value
(
pins
,
ARRAY_SIZE
(
pins
));
17
18
printk
(
BIOS_INFO
,
"Board ID %d\n"
, bid);
19
20
return
bid;
21
}
22
23
uint32_t
board_id
(
void
)
24
{
25
if
(
board_id_value
< 0)
26
board_id_value
=
get_board_id
();
27
28
return
board_id_value
;
29
}
30
31
uint32_t
ram_code
(
void
)
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
37
code =
gpio_base2_value
(
pins
,
ARRAY_SIZE
(
pins
));
38
39
printk
(
BIOS_INFO
,
"RAM Config: %u\n"
, code);
40
41
return
code;
42
}
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_base2_value
uint32_t gpio_base2_value(const gpio_t gpio[], int num_gpio)
Definition:
gpio.c:30
BIOS_INFO
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition:
loglevel.h:113
ram_code
uint32_t ram_code(void)
Definition:
boardid.c:78
get_board_id
static uint8_t get_board_id(void)
Definition:
boardid.c:10
board_id_value
static int board_id_value
Definition:
boardid.c:8
BOARD_ID_0
#define BOARD_ID_0
Definition:
gpio.h:13
RAM_ID_3
#define RAM_ID_3
Definition:
gpio.h:18
RAM_ID_2
#define RAM_ID_2
Definition:
gpio.h:10
BOARD_ID_1
#define BOARD_ID_1
Definition:
gpio.h:14
BOARD_ID_2
#define BOARD_ID_2
Definition:
gpio.h:15
RAM_ID_1
#define RAM_ID_1
Definition:
gpio.h:9
RAM_ID_0
#define RAM_ID_0
Definition:
gpio.h:17
pins
static struct @1213 pins[]
gpio.h
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
oak
boardid.c
Generated by
1.9.1