Debian Codegraph @

src/soc/mediatek/mt8173/soc.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <bootmem.h>
4 #include <device/device.h>
5 #include <program_loading.h>
6 #include <symbols.h>
7 #include <soc/emi.h>
8
9 int payload_arch_usable_ram_quirk(uint64_t start, uint64_t size)
10 {
11 if (size > REGION_SIZE(sram))
12 return 0;
13
14 if (start >= (uintptr_t)_sram && (start + size) <= (uintptr_t)_esram) {
15 printk(BIOS_DEBUG, "MT8173 uses SRAM for loading BL31.\n");
16 return 1;
17 }
18
19 return 0;
20 }
21
22 void bootmem_platform_add_ranges(void)
23 {
24 bootmem_add_range(0x101000, 124 * KiB, BM_MEM_BL31);
25 }
26
27 static void soc_read_resources(struct device *dev)
28 {
29 ram_range(dev, 0, (uintptr_t)_dram, sdram_size());
30 }
31
32 static void soc_init(struct device *dev)
33 {
34 }
35
36 static struct device_operations soc_ops = {
37 .read_resources = soc_read_resources,
38 .set_resources = noop_set_resources,
39 .init = soc_init,
40 };
41
42 static void enable_soc_dev(struct device *dev)
43 {
44 dev->ops = &soc_ops;
45 }
46
47 struct chip_operations soc_mediatek_mt8173_ops = {
48 .name = "SOC Mediatek MT8173",
49 .enable_dev = enable_soc_dev,
50 };