1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <amdblocks/iomap.h>
4 #include <amdblocks/memmap.h>
5 #include <amdblocks/root_complex.h>
6 #include <device/device.h>
7 #include <stdint.h>
8 #include <vendorcode/amd/opensil/stub/opensil.h>
9
10 /*
11 * +--------------------------------+
12 * | |
13 * | |
14 * | |
15 * | |
16 * | |
17 * | |
18 * | |
19 * reserved_dram_end +--------------------------------+
20 * | |
21 * | verstage (if reqd) |
22 * | (VERSTAGE_SIZE) |
23 * +--------------------------------+ VERSTAGE_ADDR
24 * | |
25 * | FSP-M |
26 * | (FSP_M_SIZE) |
27 * +--------------------------------+ FSP_M_ADDR
28 * | romstage |
29 * | (ROMSTAGE_SIZE) |
30 * +--------------------------------+ ROMSTAGE_ADDR = BOOTBLOCK_END
31 * | | X86_RESET_VECTOR = BOOTBLOCK_END - 0x10
32 * | bootblock |
33 * | (C_ENV_BOOTBLOCK_SIZE) |
34 * +--------------------------------+ BOOTBLOCK_ADDR = BOOTBLOCK_END - C_ENV_BOOTBLOCK_SIZE
35 * | Unused hole |
36 * | (30KiB) |
37 * +--------------------------------+
38 * | FMAP cache (FMAP_SIZE) |
39 * +--------------------------------+ PSP_SHAREDMEM_BASE + PSP_SHAREDMEM_SIZE + PRERAM_CBMEM_CONSOLE_SIZE + 0x200
40 * | Early Timestamp region (512B) |
41 * +--------------------------------+ PSP_SHAREDMEM_BASE + PSP_SHAREDMEM_SIZE + PRERAM_CBMEM_CONSOLE_SIZE
42 * | Preram CBMEM console |
43 * | (PRERAM_CBMEM_CONSOLE_SIZE) |
44 * +--------------------------------+ PSP_SHAREDMEM_BASE + PSP_SHAREDMEM_SIZE
45 * | PSP shared (vboot workbuf) |
46 * | (PSP_SHAREDMEM_SIZE) |
47 * +--------------------------------+ PSP_SHAREDMEM_BASE
48 * | APOB (120KiB) |
49 * +--------------------------------+ PSP_APOB_DRAM_ADDRESS
50 * | Early BSP stack |
51 * | (EARLYRAM_BSP_STACK_SIZE) |
52 * reserved_dram_start +--------------------------------+ EARLY_RESERVED_DRAM_BASE
53 * | DRAM |
54 * +--------------------------------+ 0x100000
55 * | Option ROM |
56 * +--------------------------------+ 0xc0000
57 * | Legacy VGA |
58 * +--------------------------------+ 0xa0000
59 * | DRAM |
60 * +--------------------------------+ 0x0
61 */
read_soc_memmap_resources(struct device * dev,unsigned long * idx)62 void read_soc_memmap_resources(struct device *dev, unsigned long *idx)
63 {
64 read_lower_soc_memmap_resources(dev, idx);
65
66 /* Reserve fixed IOMMU MMIO region */
67 mmio_range(dev, (*idx)++, IOMMU_RESERVED_MMIO_BASE, IOMMU_RESERVED_MMIO_SIZE);
68
69 if (CONFIG(PLATFORM_USES_FSP2_0))
70 read_fsp_resources(dev, idx);
71 else
72 add_opensil_memmap(dev, idx);
73 }
74