coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
soc.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <symbols.h>
6 #include <soc/ipq_uart.h>
7 
8 typedef struct {
9  uint8_t hlos1[112 * MiB], /* <-- 0x80000000 */
10  appsbl[4 * MiB], /* <-- 0x87000000 */
11  sbl[1 * MiB], /* <-- 0x87400000 */
12  rsvd[11 * MiB], /* <-- 0x87500000 */
13  hlos2[128 * MiB]; /* <-- 0x88000000 */
15 
16 #define LINUX_REGION1_START ((uintptr_t)(ipq_mem_map->hlos1))
17 #define LINUX_REGION1_START_KB (LINUX_REGION1_START / KiB)
18 #define LINUX_REGION1_SIZE (sizeof(ipq_mem_map->hlos1) + \
19  sizeof(ipq_mem_map->appsbl) + \
20  sizeof(ipq_mem_map->sbl))
21 #define LINUX_REGION1_SIZE_KB (LINUX_REGION1_SIZE / KiB)
22 
23 #define RESERVED_START ((uintptr_t)(ipq_mem_map->rsvd))
24 #define RESERVED_START_KB (RESERVED_START / KiB)
25 #define RESERVED_SIZE (sizeof(ipq_mem_map->rsvd))
26 #define RESERVED_SIZE_KB (RESERVED_SIZE / KiB)
27 
28 /* xxx_SIZE defines not needed since it goes till end of memory */
29 #define LINUX_REGION2_START ((uintptr_t)(ipq_mem_map->hlos2))
30 #define LINUX_REGION2_START_KB (LINUX_REGION2_START / KiB)
31 
32 static void soc_read_resources(struct device *dev)
33 {
34  ipq_mem_map_t *ipq_mem_map = ((ipq_mem_map_t *)_dram);
35 
37 
39 
40  /* 0x88000000 to end, is the second region for Linux */
42  (CONFIG_DRAM_SIZE_MB * KiB) -
44 }
45 
46 static void soc_init(struct device *dev)
47 {
48  /*
49  * Do this in case console is not enabled: kernel's earlyprintk()
50  * should work no matter what the firmware console configuration is.
51  */
53 
54  printk(BIOS_INFO, "CPU: QCA 40xx\n");
55 }
56 
57 static struct device_operations soc_ops = {
59  .init = soc_init,
60 };
61 
62 static void enable_soc_dev(struct device *dev)
63 {
64  dev->ops = &soc_ops;
65 }
66 
68  CHIP_NAME("SOC QCA 40xx")
69  .enable_dev = enable_soc_dev,
70 };
#define MiB
Definition: helpers.h:76
#define KiB
Definition: helpers.h:75
#define printk(level,...)
Definition: stdlib.h:16
#define CHIP_NAME(X)
Definition: device.h:32
#define ram_resource(dev, idx, basek, sizek)
Definition: device.h:321
#define reserved_ram_resource(dev, idx, basek, sizek)
Definition: device.h:324
u8 _dram[]
void ipq40xx_uart_init(void)
Definition: uart.c:224
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
static void enable_soc_dev(struct device *dev)
Definition: soc.c:62
#define RESERVED_SIZE_KB
Definition: soc.c:26
#define LINUX_REGION2_START_KB
Definition: soc.c:30
static void soc_read_resources(struct device *dev)
Definition: soc.c:32
static struct device_operations soc_ops
Definition: soc.c:57
static void soc_init(struct device *dev)
Definition: soc.c:46
#define LINUX_REGION1_SIZE_KB
Definition: soc.c:21
#define RESERVED_START_KB
Definition: soc.c:24
#define LINUX_REGION1_START_KB
Definition: soc.c:17
struct chip_operations soc_qualcomm_ipq40xx_ops
Definition: soc.c:67
unsigned char uint8_t
Definition: stdint.h:8
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107
struct device_operations * ops
Definition: device.h:143