coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
soc_util.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _DENVERTON_NS_SOC_UTIL_H_
4 #define _DENVERTON_NS_SOC_UTIL_H_
5 
6 #ifndef __ACPI__
7 #include <device/device.h>
8 #include <string.h>
9 
10 /* Silicon revisions */
11 typedef enum {
16 
17 /* soc_util.c */
18 #ifdef __SIMPLE_DEVICE__
23 #else
24 struct device *get_hostbridge_dev(void);
25 struct device *get_lpc_dev(void);
26 struct device *get_pmc_dev(void);
27 struct device *get_smbus_dev(void);
28 #endif
29 
35 uint16_t get_pmbase(void);
36 uint16_t get_tcobase(void);
37 
38 /*
39 * Secure functions.
40 */
41 void *memcpy_s(void *dest, const void *src, size_t n);
42 
43 void mmio_andthenor32(void *addr, uint32_t val2and, uint32_t val2or);
45 
46 /*
47 * MMIO Read/Write
48 */
49 #define MMIO8(x) (*((volatile u8 *)(x)))
50 #define MMIO16(x) (*((volatile u16 *)(x)))
51 #define MMIO32(x) (*((volatile u32 *)(x)))
52 
53 #define MMIO_AND_OR(bits, x, and, or) \
54  (MMIO##bits(x) = ((MMIO##bits(x) & (and)) | (or)))
55 
56 #define MMIO8_AND_OR(x, and, or) MMIO_AND_OR(8, x, and, or)
57 #define MMIO16_AND_OR(x, and, or) MMIO_AND_OR(16, x, and, or)
58 #define MMIO32_AND_OR(x, and, or) MMIO_AND_OR(32, x, and, or)
59 #define MMIO32_OR(x, or) MMIO_AND_OR(32, x, ~0UL, or)
60 #define MMIO32_AND(x, and) MMIO_AND_OR(32, x, and, 0UL)
61 
62 #endif //__ACPI__
63 
64 #endif /* _DENVERTON_NS_SOC_UTIL_H_ */
static u32 addr
Definition: cirrus.c:14
uint16_t get_pmbase(void)
Definition: pmutil.c:254
uint32_t get_pciebase(void)
Definition: soc_util.c:66
uint32_t get_pcielength(void)
Definition: soc_util.c:102
uint32_t get_top_of_low_memory(void)
Definition: soc_util.c:153
struct device * get_pmc_dev(void)
Definition: soc_util.c:48
uint16_t get_tcobase(void)
Definition: soc_util.c:200
void * memcpy_s(void *dest, const void *src, size_t n)
Definition: soc_util.c:243
uint8_t silicon_stepping(void)
Definition: soc_util.c:225
uint64_t get_top_of_upper_memory(void)
Definition: soc_util.c:168
uint32_t get_tseg_memory(void)
Definition: soc_util.c:138
struct device * get_hostbridge_dev(void)
Definition: soc_util.c:24
silicon_revision
Definition: soc_util.h:11
@ SILICON_REV_DENVERTON_B0
Definition: soc_util.h:14
@ SILICON_REV_DENVERTON_A0
Definition: soc_util.h:12
@ SILICON_REV_DENVERTON_A1
Definition: soc_util.h:13
struct device * get_lpc_dev(void)
Definition: soc_util.c:36
struct device * get_smbus_dev(void)
Definition: soc_util.c:60
void mmio_andthenor32(void *addr, uint32_t val2and, uint32_t val2or)
Definition: soc_util.c:215
u32 pci_devfn_t
Definition: pci_type.h:8
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
unsigned long long uint64_t
Definition: stdint.h:17
unsigned char uint8_t
Definition: stdint.h:8
Definition: device.h:107