• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
9 /*
10  *                     +--------------------------------+
11  *                     |                                |
12  *                     |                                |
13  *                     |                                |
14  *                     |                                |
15  *                     |                                |
16  *                     |                                |
17  *                     |                                |
18  *   reserved_dram_end +--------------------------------+
19  *                     |                                |
20  *                     |       verstage (if reqd)       |
21  *                     |          (VERSTAGE_SIZE)       |
22  *                     +--------------------------------+ VERSTAGE_ADDR
23  *                     |                                |
24  *                     |            FSP-M               |
25  *                     |         (FSP_M_SIZE)           |
26  *                     +--------------------------------+ FSP_M_ADDR
27  *                     |           romstage             |
28  *                     |        (ROMSTAGE_SIZE)         |
29  *                     +--------------------------------+ ROMSTAGE_ADDR = BOOTBLOCK_END
30  *                     |                                | X86_RESET_VECTOR = BOOTBLOCK_END  - 0x10
31  *                     |           bootblock            |
32  *                     |     (C_ENV_BOOTBLOCK_SIZE)     |
33  *                     +--------------------------------+ BOOTBLOCK_ADDR = BOOTBLOCK_END - C_ENV_BOOTBLOCK_SIZE
34  *                     |          Unused hole           |
35  *                     |            (86KiB)             |
36  *                     +--------------------------------+
37  *                     |     FMAP cache (FMAP_SIZE)     |
38  *                     +--------------------------------+ PSP_SHAREDMEM_BASE + PSP_SHAREDMEM_SIZE + PRERAM_CBMEM_CONSOLE_SIZE + 0x200
39  *                     |  Early Timestamp region (512B) |
40  *                     +--------------------------------+ PSP_SHAREDMEM_BASE + PSP_SHAREDMEM_SIZE + PRERAM_CBMEM_CONSOLE_SIZE
41  *                     |      Preram CBMEM console      |
42  *                     |   (PRERAM_CBMEM_CONSOLE_SIZE)  |
43  *                     +--------------------------------+ PSP_SHAREDMEM_BASE + PSP_SHAREDMEM_SIZE
44  *                     |   PSP shared (vboot workbuf)   |
45  *                     |      (PSP_SHAREDMEM_SIZE)      |
46  *                     +--------------------------------+ PSP_SHAREDMEM_BASE
47  *                     |          APOB (64KiB)          |
48  *                     +--------------------------------+ PSP_APOB_DRAM_ADDRESS
49  *                     |        Early BSP stack         |
50  *                     |   (EARLYRAM_BSP_STACK_SIZE)    |
51  * reserved_dram_start +--------------------------------+ EARLY_RESERVED_DRAM_BASE
52  *                     |              DRAM              |
53  *                     +--------------------------------+ 0x100000
54  *                     |           Option ROM           |
55  *                     +--------------------------------+ 0xc0000
56  *                     |           Legacy VGA           |
57  *                     +--------------------------------+ 0xa0000
58  *                     |              DRAM              |
59  *                     +--------------------------------+ 0x0
60  */
read_soc_memmap_resources(struct device * dev,unsigned long * idx)61 void read_soc_memmap_resources(struct device *dev, unsigned long *idx)
62 {
63 	read_lower_soc_memmap_resources(dev, idx);
64 
65 	/* Reserve fixed IOMMU MMIO region */
66 	mmio_range(dev, (*idx)++, IOMMU_RESERVED_MMIO_BASE, IOMMU_RESERVED_MMIO_SIZE);
67 
68 	read_fsp_resources(dev, idx);
69 }
70