[U-Boot] [PATCH] mc : Add support to run MC in 128 MB DDR size

ls2088, ls1088 : minimum DDR size for MC is 128 MB lx2 : minimum DDR size for MC is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com --- drivers/net/fsl-mc/mc.c | 20 +++++++++++++++++--- include/configs/ls1088a_common.h | 2 +- include/configs/ls2080a_common.h | 2 +- include/configs/lx2160a_common.h | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index fa0a05d..98c57ed 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -684,7 +684,15 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) size_t mc_ram_size = mc_get_dram_block_size();
mc_ram_num_256mb_blocks = mc_ram_size / MC_RAM_SIZE_ALIGNMENT; - if (mc_ram_num_256mb_blocks < 1 || mc_ram_num_256mb_blocks > 0xff) { + + /* + * To support 128 MB DDR Size for MC + */ + if (mc_ram_num_256mb_blocks == 0) { + mc_ram_num_256mb_blocks = 0xFF; + } + + if (mc_ram_num_256mb_blocks > 0xff) { error = -EINVAL; printf("fsl-mc: ERROR: invalid MC private RAM size (%lu)\n", mc_ram_size); @@ -731,8 +739,14 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) /* * Tell MC what is the address range of the DRAM block assigned to it: */ - reg_mcfbalr = (u32)mc_ram_addr | - (mc_ram_num_256mb_blocks - 1); + if (mc_ram_num_256mb_blocks < 0xFF) { + reg_mcfbalr = (u32)mc_ram_addr | + (mc_ram_num_256mb_blocks - 1); + } else { + reg_mcfbalr = (u32)mc_ram_addr | + (mc_ram_num_256mb_blocks); + } + out_le32(&mc_ccsr_regs->reg_mcfbalr, reg_mcfbalr); out_le32(&mc_ccsr_regs->reg_mcfbahr, (u32)(mc_ram_addr >> 32)); diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index 89133c2..1509292 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -154,7 +154,7 @@ unsigned long long get_qixis_addr(void); */
#if defined(CONFIG_FSL_MC_ENET) -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (128UL * 1024 * 1024) #endif /* Command line configuration */ #define CONFIG_CMD_CACHE diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h index ab38981..7c1d35b 100644 --- a/include/configs/ls2080a_common.h +++ b/include/configs/ls2080a_common.h @@ -159,7 +159,7 @@ unsigned long long get_qixis_addr(void); * 512MB aligned, so the min size to hide is 512MB. */ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (128UL * 1024 * 1024) #endif
/* Command line configuration */ diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h index 0f1a621..c4bbe96 100644 --- a/include/configs/lx2160a_common.h +++ b/include/configs/lx2160a_common.h @@ -102,7 +102,7 @@ * 512MB aligned, so the min size to hide is 512MB. */ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (256UL * 1024 * 1024) #endif
/* I2C bus multiplexer */

-----Original Message----- From: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Sent: Tuesday, February 12, 2019 2:44 PM To: u-boot@lists.denx.de; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Subject: [PATCH] mc : Add support to run MC in 128 MB DDR size
Ashish: Rephrase to "Reduce MC memory size to 128M" from the above it sound like system DDR is 128MB
ls2088, ls1088 : minimum DDR size for MC is 128 MB lx2 : minimum DDR size for MC is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com
drivers/net/fsl-mc/mc.c | 20 +++++++++++++++++--- include/configs/ls1088a_common.h | 2 +- include/configs/ls2080a_common.h | 2 +- include/configs/lx2160a_common.h | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index fa0a05d..98c57ed 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -684,7 +684,15 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) size_t mc_ram_size = mc_get_dram_block_size();
mc_ram_num_256mb_blocks = mc_ram_size / MC_RAM_SIZE_ALIGNMENT;
- if (mc_ram_num_256mb_blocks < 1 || mc_ram_num_256mb_blocks >
0xff) {
- /*
* To support 128 MB DDR Size for MC
*/
Ashish: How does the MC grow now, wrt to MC base ?. Earlier it was 2 blocks of 256 up and rest down. Considering MC base alignment is 512. 256 MB is always wasted from top of the memory, now since the minimum block is 128MB
- if (mc_ram_num_256mb_blocks == 0) {
mc_ram_num_256mb_blocks = 0xFF;
- }
- if (mc_ram_num_256mb_blocks > 0xff) { error = -EINVAL; printf("fsl-mc: ERROR: invalid MC private RAM size (%lu)\n", mc_ram_size);
@@ -731,8 +739,14 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) /* * Tell MC what is the address range of the DRAM block assigned to it: */
- reg_mcfbalr = (u32)mc_ram_addr |
(mc_ram_num_256mb_blocks - 1);
- if (mc_ram_num_256mb_blocks < 0xFF) {
reg_mcfbalr = (u32)mc_ram_addr |
(mc_ram_num_256mb_blocks - 1);
- } else {
reg_mcfbalr = (u32)mc_ram_addr |
(mc_ram_num_256mb_blocks);
- }
- out_le32(&mc_ccsr_regs->reg_mcfbalr, reg_mcfbalr); out_le32(&mc_ccsr_regs->reg_mcfbahr, (u32)(mc_ram_addr >> 32));
diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index 89133c2..1509292 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -154,7 +154,7 @@ unsigned long long get_qixis_addr(void); */
#if defined(CONFIG_FSL_MC_ENET) -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (128UL * 1024 * 1024) #endif /* Command line configuration */ #define CONFIG_CMD_CACHE diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h index ab38981..7c1d35b 100644 --- a/include/configs/ls2080a_common.h +++ b/include/configs/ls2080a_common.h @@ -159,7 +159,7 @@ unsigned long long get_qixis_addr(void);
- 512MB aligned, so the min size to hide is 512MB.
*/ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (128UL * 1024 * 1024) #endif
/* Command line configuration */ diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h index 0f1a621..c4bbe96 100644 --- a/include/configs/lx2160a_common.h +++ b/include/configs/lx2160a_common.h @@ -102,7 +102,7 @@
- 512MB aligned, so the min size to hide is 512MB.
*/ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (256UL * 1024 * 1024) #endif
/* I2C bus multiplexer */
1.9.1

-----Original Message----- From: Ashish Kumar Sent: Tuesday, February 12, 2019 10:12 AM To: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com; u- boot@lists.denx.de; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Subject: RE: [PATCH] mc : Add support to run MC in 128 MB DDR size
-----Original Message----- From: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Sent: Tuesday, February 12, 2019 2:44 PM To: u-boot@lists.denx.de; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Subject: [PATCH] mc : Add support to run MC in 128 MB DDR size
Ashish: Rephrase to "Reduce MC memory size to 128M" from the above it sound like system DDR is 128MB
ls2088, ls1088 : minimum DDR size for MC is 128 MB lx2 : minimum DDR size for MC is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com
drivers/net/fsl-mc/mc.c | 20 +++++++++++++++++--- include/configs/ls1088a_common.h | 2 +- include/configs/ls2080a_common.h | 2 +- include/configs/lx2160a_common.h | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index fa0a05d..98c57ed 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -684,7 +684,15 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) size_t mc_ram_size = mc_get_dram_block_size();
mc_ram_num_256mb_blocks = mc_ram_size /
MC_RAM_SIZE_ALIGNMENT;
- if (mc_ram_num_256mb_blocks < 1 || mc_ram_num_256mb_blocks >
0xff) {
- /*
* To support 128 MB DDR Size for MC
*/
Ashish: How does the MC grow now, wrt to MC base ?. Earlier it was 2 blocks of 256 up and rest down.
No changes done in this respect, it is same as before depending on MC size. For 128 MB, we are reserving only 128 M up and rest down.
Considering MC base alignment is 512. 256 MB is always wasted from top of the memory, now since the minimum block is 128MB
We are reserving only DDR memory according to the size of MC, so if it is 128 M, then we are reserving only 128 M (surely, base address is 512 MB aligned). Rest DDR memory is available for uboot to use and is marked as free.
- if (mc_ram_num_256mb_blocks == 0) {
mc_ram_num_256mb_blocks = 0xFF;
- }
- if (mc_ram_num_256mb_blocks > 0xff) { error = -EINVAL; printf("fsl-mc: ERROR: invalid MC private RAM size (%lu)\n", mc_ram_size);
@@ -731,8 +739,14 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) /* * Tell MC what is the address range of the DRAM block assigned to it: */
- reg_mcfbalr = (u32)mc_ram_addr |
(mc_ram_num_256mb_blocks - 1);
- if (mc_ram_num_256mb_blocks < 0xFF) {
reg_mcfbalr = (u32)mc_ram_addr |
(mc_ram_num_256mb_blocks - 1);
- } else {
reg_mcfbalr = (u32)mc_ram_addr |
(mc_ram_num_256mb_blocks);
- }
- out_le32(&mc_ccsr_regs->reg_mcfbalr, reg_mcfbalr); out_le32(&mc_ccsr_regs->reg_mcfbahr, (u32)(mc_ram_addr >> 32));
diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index 89133c2..1509292 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -154,7 +154,7 @@ unsigned long long get_qixis_addr(void); */
#if defined(CONFIG_FSL_MC_ENET) -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE
(512UL *
1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE
(128UL *
1024 * 1024) #endif /* Command line configuration */ #define CONFIG_CMD_CACHE diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h index ab38981..7c1d35b 100644 --- a/include/configs/ls2080a_common.h +++ b/include/configs/ls2080a_common.h @@ -159,7 +159,7 @@ unsigned long long get_qixis_addr(void);
- 512MB aligned, so the min size to hide is 512MB.
*/ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE
(512UL *
1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE
(128UL *
1024 * 1024) #endif
/* Command line configuration */ diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h index 0f1a621..c4bbe96 100644 --- a/include/configs/lx2160a_common.h +++ b/include/configs/lx2160a_common.h @@ -102,7 +102,7 @@
- 512MB aligned, so the min size to hide is 512MB.
*/ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024
+#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (256UL * 1024
#endif
/* I2C bus multiplexer */
1.9.1

From: AKASHI Takahiro takahiro.akashi@linaro.org
"memmap" command prints uefi-specific memory map information. => efi memmap Type Start End Attributes ================ ================ ================ ========== CONVENTIONAL 0000000040000000-000000007de27000 WB RUNTIME DATA 000000007de27000-000000007de28000 WB|RT RESERVED 000000007de28000-000000007de2a000 WB RUNTIME DATA 000000007de2a000-000000007de2b000 WB|RT RESERVED 000000007de2b000-000000007de2c000 WB RUNTIME DATA 000000007de2c000-000000007de2d000 WB|RT LOADER DATA 000000007de2d000-000000007ff37000 WB RUNTIME CODE 000000007ff37000-000000007ff38000 WB|RT LOADER DATA 000000007ff38000-0000000080000000 WB
Signed-off-by: AKASHI Takahiro takahiro.akashi@linaro.org Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de --- cmd/efidebug.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-)
diff --git a/cmd/efidebug.c b/cmd/efidebug.c index e3a2d09..5072a7b 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -335,6 +335,127 @@ static int do_efi_show_images(cmd_tbl_t *cmdtp, int flag, return CMD_RET_SUCCESS; }
+static const char * const efi_mem_type_string[] = { + [EFI_RESERVED_MEMORY_TYPE] = "RESERVED", + [EFI_LOADER_CODE] = "LOADER CODE", + [EFI_LOADER_DATA] = "LOADER DATA", + [EFI_BOOT_SERVICES_CODE] = "BOOT CODE", + [EFI_BOOT_SERVICES_DATA] = "BOOT DATA", + [EFI_RUNTIME_SERVICES_CODE] = "RUNTIME CODE", + [EFI_RUNTIME_SERVICES_DATA] = "RUNTIME DATA", + [EFI_CONVENTIONAL_MEMORY] = "CONVENTIONAL", + [EFI_UNUSABLE_MEMORY] = "UNUSABLE MEM", + [EFI_ACPI_RECLAIM_MEMORY] = "ACPI RECLAIM MEM", + [EFI_ACPI_MEMORY_NVS] = "ACPI NVS", + [EFI_MMAP_IO] = "IO", + [EFI_MMAP_IO_PORT] = "IO PORT", + [EFI_PAL_CODE] = "PAL", +}; + +static const struct efi_mem_attrs { + const u64 bit; + const char *text; +} efi_mem_attrs[] = { + {EFI_MEMORY_UC, "UC"}, + {EFI_MEMORY_UC, "UC"}, + {EFI_MEMORY_WC, "WC"}, + {EFI_MEMORY_WT, "WT"}, + {EFI_MEMORY_WB, "WB"}, + {EFI_MEMORY_UCE, "UCE"}, + {EFI_MEMORY_WP, "WP"}, + {EFI_MEMORY_RP, "RP"}, + {EFI_MEMORY_XP, "WP"}, + {EFI_MEMORY_NV, "NV"}, + {EFI_MEMORY_MORE_RELIABLE, "REL"}, + {EFI_MEMORY_RO, "RO"}, + {EFI_MEMORY_RUNTIME, "RT"}, +}; + +/** + * print_memory_attributes() - print memory map attributes + * @attributes: Attribute value + * + * Print memory map attributes + */ +static void print_memory_attributes(u64 attributes) +{ + int sep, i; + + for (sep = 0, i = 0; i < ARRAY_SIZE(efi_mem_attrs); i++) + if (attributes & efi_mem_attrs[i].bit) { + if (sep) { + putc('|'); + } else { + putc(' '); + sep = 1; + } + puts(efi_mem_attrs[i].text); + } +} + +#define EFI_PHYS_ADDR_WIDTH (int)(sizeof(efi_physical_addr_t) * 2) + +/** + * do_efi_show_memmap() - show UEFI memory map + * + * @cmdtp: Command table + * @flag: Command flag + * @argc: Number of arguments + * @argv: Argument array + * Return: CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure + * + * Implement efidebug "memmap" sub-command. + * Show UEFI memory map. + */ +static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + struct efi_mem_desc *memmap = NULL, *map; + efi_uintn_t map_size = 0; + const char *type; + int i; + efi_status_t ret; + + ret = EFI_CALL(BS->get_memory_map(&map_size, memmap, NULL, NULL, NULL)); + if (ret == EFI_BUFFER_TOO_SMALL) { + map_size += sizeof(struct efi_mem_desc); /* for my own */ + ret = EFI_CALL(BS->allocate_pool(EFI_LOADER_DATA, + map_size, (void *)&memmap)); + if (ret != EFI_SUCCESS) + return CMD_RET_FAILURE; + ret = EFI_CALL(BS->get_memory_map(&map_size, memmap, + NULL, NULL, NULL)); + } + if (ret != EFI_SUCCESS) { + EFI_CALL(BS->free_pool(memmap)); + return CMD_RET_FAILURE; + } + + printf("Type Start%.*s End%.*s Attributes\n", + EFI_PHYS_ADDR_WIDTH - 5, spc, EFI_PHYS_ADDR_WIDTH - 3, spc); + printf("================ %.*s %.*s ==========\n", + EFI_PHYS_ADDR_WIDTH, sep, EFI_PHYS_ADDR_WIDTH, sep); + for (i = 0, map = memmap; i < map_size / sizeof(*map); map++, i++) { + if (map->type < EFI_MAX_MEMORY_TYPE) + type = efi_mem_type_string[map->type]; + else + type = "(unknown)"; + + printf("%-16s %.*llx-%.*llx", type, + EFI_PHYS_ADDR_WIDTH, + map->physical_start, + EFI_PHYS_ADDR_WIDTH, + map->physical_start + map->num_pages * EFI_PAGE_SIZE); + + print_memory_attributes(map->attribute); + putc('\n'); + } + + EFI_CALL(BS->free_pool(memmap)); + + return CMD_RET_SUCCESS; +} + /** * do_efi_boot_add() - set UEFI load option * @@ -845,6 +966,8 @@ static cmd_tbl_t cmd_efidebug_sub[] = { "", ""), U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images, "", ""), + U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap, + "", ""), };
/** @@ -911,7 +1034,9 @@ static char efidebug_help_text[] = "efidebug dh\n" " - show uefi handles\n" "efidebug images\n" - " - show loaded images\n"; + " - show loaded images\n" + "efidebug memmap\n" + " - show uefi memory map\n"; #endif
U_BOOT_CMD(

Please ignore, it is sent by mistake.
-----Original Message----- From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Meenakshi Aggarwal Sent: Wednesday, February 27, 2019 2:41 PM To: u-boot@lists.denx.de; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Subject: [U-Boot] [PATCH 1/2] cmd: efidebug: add memmap command
From: AKASHI Takahiro takahiro.akashi@linaro.org
"memmap" command prints uefi-specific memory map information. => efi memmap Type Start End Attributes ================ ================ ================ ========== CONVENTIONAL 0000000040000000-000000007de27000 WB RUNTIME DATA 000000007de27000-000000007de28000 WB|RT RESERVED 000000007de28000-000000007de2a000 WB RUNTIME DATA 000000007de2a000-000000007de2b000 WB|RT RESERVED 000000007de2b000-000000007de2c000 WB RUNTIME DATA 000000007de2c000-000000007de2d000 WB|RT LOADER DATA 000000007de2d000-000000007ff37000 WB RUNTIME CODE 000000007ff37000-000000007ff38000 WB|RT LOADER DATA 000000007ff38000-0000000080000000 WB
Signed-off-by: AKASHI Takahiro takahiro.akashi@linaro.org Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de
cmd/efidebug.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-)
diff --git a/cmd/efidebug.c b/cmd/efidebug.c index e3a2d09..5072a7b 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -335,6 +335,127 @@ static int do_efi_show_images(cmd_tbl_t *cmdtp, int flag, return CMD_RET_SUCCESS; }
+static const char * const efi_mem_type_string[] = {
- [EFI_RESERVED_MEMORY_TYPE] = "RESERVED",
- [EFI_LOADER_CODE] = "LOADER CODE",
- [EFI_LOADER_DATA] = "LOADER DATA",
- [EFI_BOOT_SERVICES_CODE] = "BOOT CODE",
- [EFI_BOOT_SERVICES_DATA] = "BOOT DATA",
- [EFI_RUNTIME_SERVICES_CODE] = "RUNTIME CODE",
- [EFI_RUNTIME_SERVICES_DATA] = "RUNTIME DATA",
- [EFI_CONVENTIONAL_MEMORY] = "CONVENTIONAL",
- [EFI_UNUSABLE_MEMORY] = "UNUSABLE MEM",
- [EFI_ACPI_RECLAIM_MEMORY] = "ACPI RECLAIM MEM",
- [EFI_ACPI_MEMORY_NVS] = "ACPI NVS",
- [EFI_MMAP_IO] = "IO",
- [EFI_MMAP_IO_PORT] = "IO PORT",
- [EFI_PAL_CODE] = "PAL",
+};
+static const struct efi_mem_attrs {
- const u64 bit;
- const char *text;
+} efi_mem_attrs[] = {
- {EFI_MEMORY_UC, "UC"},
- {EFI_MEMORY_UC, "UC"},
- {EFI_MEMORY_WC, "WC"},
- {EFI_MEMORY_WT, "WT"},
- {EFI_MEMORY_WB, "WB"},
- {EFI_MEMORY_UCE, "UCE"},
- {EFI_MEMORY_WP, "WP"},
- {EFI_MEMORY_RP, "RP"},
- {EFI_MEMORY_XP, "WP"},
- {EFI_MEMORY_NV, "NV"},
- {EFI_MEMORY_MORE_RELIABLE, "REL"},
- {EFI_MEMORY_RO, "RO"},
- {EFI_MEMORY_RUNTIME, "RT"},
+};
+/**
- print_memory_attributes() - print memory map attributes
- @attributes: Attribute value
- Print memory map attributes
- */
+static void print_memory_attributes(u64 attributes) {
- int sep, i;
- for (sep = 0, i = 0; i < ARRAY_SIZE(efi_mem_attrs); i++)
if (attributes & efi_mem_attrs[i].bit) {
if (sep) {
putc('|');
} else {
putc(' ');
sep = 1;
}
puts(efi_mem_attrs[i].text);
}
+}
+#define EFI_PHYS_ADDR_WIDTH (int)(sizeof(efi_physical_addr_t) * 2)
+/**
- do_efi_show_memmap() - show UEFI memory map
- @cmdtp: Command table
- @flag: Command flag
- @argc: Number of arguments
- @argv: Argument array
- Return: CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on
failure
- Implement efidebug "memmap" sub-command.
- Show UEFI memory map.
- */
+static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[]) {
- struct efi_mem_desc *memmap = NULL, *map;
- efi_uintn_t map_size = 0;
- const char *type;
- int i;
- efi_status_t ret;
- ret = EFI_CALL(BS->get_memory_map(&map_size, memmap, NULL,
NULL, NULL));
- if (ret == EFI_BUFFER_TOO_SMALL) {
map_size += sizeof(struct efi_mem_desc); /* for my own */
ret = EFI_CALL(BS->allocate_pool(EFI_LOADER_DATA,
map_size, (void
*)&memmap));
if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
ret = EFI_CALL(BS->get_memory_map(&map_size, memmap,
NULL, NULL, NULL));
- }
- if (ret != EFI_SUCCESS) {
EFI_CALL(BS->free_pool(memmap));
return CMD_RET_FAILURE;
- }
- printf("Type Start%.*s End%.*s Attributes\n",
EFI_PHYS_ADDR_WIDTH - 5, spc, EFI_PHYS_ADDR_WIDTH - 3, spc);
- printf("================ %.*s %.*s ==========\n",
EFI_PHYS_ADDR_WIDTH, sep, EFI_PHYS_ADDR_WIDTH, sep);
- for (i = 0, map = memmap; i < map_size / sizeof(*map); map++, i++) {
if (map->type < EFI_MAX_MEMORY_TYPE)
type = efi_mem_type_string[map->type];
else
type = "(unknown)";
printf("%-16s %.*llx-%.*llx", type,
EFI_PHYS_ADDR_WIDTH,
map->physical_start,
EFI_PHYS_ADDR_WIDTH,
map->physical_start + map->num_pages * EFI_PAGE_SIZE);
print_memory_attributes(map->attribute);
putc('\n');
- }
- EFI_CALL(BS->free_pool(memmap));
- return CMD_RET_SUCCESS;
+}
/**
- do_efi_boot_add() - set UEFI load option
@@ -845,6 +966,8 @@ static cmd_tbl_t cmd_efidebug_sub[] = { "", ""), U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images, "", ""),
- U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1,
do_efi_show_memmap,
"", ""),
};
/** @@ -911,7 +1034,9 @@ static char efidebug_help_text[] = "efidebug dh\n" " - show uefi handles\n" "efidebug images\n"
- " - show loaded images\n";
- " - show loaded images\n"
- "efidebug memmap\n"
- " - show uefi memory map\n";
#endif
U_BOOT_CMD(
1.9.1
U-Boot mailing list U-Boot@lists.denx.de https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.de nx.de%2Flistinfo%2Fu- boot&data=02%7C01%7Cmeenakshi.aggarwal%40nxp.com%7Cf6d2c8270 9004cdb237708d69c634a7f%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C 0%7C636868347604262106&sdata=5uxeibcyDGCCEu1yYYp3gXqz8huNvnoc GqFVj5lumd8%3D&reserved=0

ls2088, ls1088 : minimum MC Memory size is 128 MB lx2 : minimum MC memory size is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com --- drivers/net/fsl-mc/mc.c | 23 +++++++++++++++++++---- include/configs/ls1088a_common.h | 2 +- include/configs/ls2080a_common.h | 2 +- include/configs/lx2160a_common.h | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index a51b8a4..a56edc3 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -28,6 +28,7 @@ #define MC_MEM_SIZE_ENV_VAR "mcmemsize" #define MC_BOOT_TIMEOUT_ENV_VAR "mcboottimeout" #define MC_BOOT_ENV_VAR "mcinitcmd" +#define MC_DRAM_BLOCK_DEFAULT_SIZE (512UL * 1024 * 1024)
DECLARE_GLOBAL_DATA_PTR; static int mc_memset_resv_ram; @@ -680,7 +681,8 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) size_t mc_ram_size = mc_get_dram_block_size();
mc_ram_num_256mb_blocks = mc_ram_size / MC_RAM_SIZE_ALIGNMENT; - if (mc_ram_num_256mb_blocks < 1 || mc_ram_num_256mb_blocks > 0xff) { + + if (mc_ram_num_256mb_blocks >= 0xff) { error = -EINVAL; printf("fsl-mc: ERROR: invalid MC private RAM size (%lu)\n", mc_ram_size); @@ -688,6 +690,13 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) }
/* + * To support 128 MB DDR Size for MC + */ + if (mc_ram_num_256mb_blocks == 0) { + mc_ram_num_256mb_blocks = 0xFF; + } + + /* * Management Complex cores should be held at reset out of POR. * U-Boot should be the first software to touch MC. To be safe, * we reset all cores again by setting GCR1 to 0. It doesn't do @@ -727,8 +736,14 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) /* * Tell MC what is the address range of the DRAM block assigned to it: */ - reg_mcfbalr = (u32)mc_ram_addr | - (mc_ram_num_256mb_blocks - 1); + if (mc_ram_num_256mb_blocks < 0xFF) { + reg_mcfbalr = (u32)mc_ram_addr | + (mc_ram_num_256mb_blocks - 1); + } else { + reg_mcfbalr = (u32)mc_ram_addr | + (mc_ram_num_256mb_blocks); + } + out_le32(&mc_ccsr_regs->reg_mcfbalr, reg_mcfbalr); out_le32(&mc_ccsr_regs->reg_mcfbahr, (u32)(mc_ram_addr >> 32)); @@ -878,7 +893,7 @@ unsigned long mc_get_dram_block_size(void) "' environment variable: %lu\n", dram_block_size);
- dram_block_size = CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE; + dram_block_size = MC_DRAM_BLOCK_DEFAULT_SIZE; } }
diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index b663937..fa9c8c8 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -151,7 +151,7 @@ unsigned long long get_qixis_addr(void); */
#if defined(CONFIG_FSL_MC_ENET) -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (128UL * 1024 * 1024) #endif /* Command line configuration */ #define CONFIG_CMD_CACHE diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h index 0a6c90d..682f068 100644 --- a/include/configs/ls2080a_common.h +++ b/include/configs/ls2080a_common.h @@ -155,7 +155,7 @@ unsigned long long get_qixis_addr(void); * 512MB aligned, so the min size to hide is 512MB. */ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (128UL * 1024 * 1024) #endif
/* Command line configuration */ diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h index 4b5608b..637619c 100644 --- a/include/configs/lx2160a_common.h +++ b/include/configs/lx2160a_common.h @@ -100,7 +100,7 @@ * 512MB aligned, so the min size to hide is 512MB. */ #ifdef CONFIG_FSL_MC_ENET -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (256UL * 1024 * 1024) #endif
/* I2C bus multiplexer */

On 2/27/19 10:11 AM, Meenakshi Aggarwal wrote:
ls2088, ls1088 : minimum MC Memory size is 128 MB lx2 : minimum MC memory size is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com
Hello Joe,
in patchwork I have reassigned the patch https://patchwork.ozlabs.org/patch/1048656/ to you.
The first patch of the series received a comment by the author: "Please ignore, it is sent by mistake." So I set it to superseeded.
Best regards
Heinrich

On Fri, Mar 1, 2019 at 2:48 PM Heinrich Schuchardt xypron.debian@gmx.de wrote:
On 2/27/19 10:11 AM, Meenakshi Aggarwal wrote:
ls2088, ls1088 : minimum MC Memory size is 128 MB lx2 : minimum MC memory size is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com
Hello Joe,
in patchwork I have reassigned the patch https://patchwork.ozlabs.org/patch/1048656/ to you.
The first patch of the series received a comment by the author: "Please ignore, it is sent by mistake." So I set it to superseeded.
Thanks for the heads up! -Joe
Best regards
Heinrich _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Tue, Feb 26, 2019 at 9:26 PM Meenakshi Aggarwal meenakshi.aggarwal@nxp.com wrote:
ls2088, ls1088 : minimum MC Memory size is 128 MB lx2 : minimum MC memory size is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

-----Original Message----- From: Joe Hershberger joe.hershberger@gmail.com Sent: Saturday, March 2, 2019 2:56 AM To: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Cc: u-boot u-boot@lists.denx.de; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Subject: Re: [U-Boot] [PATCH 2/2] mc : Reduce MC memory size to 128M
On Tue, Feb 26, 2019 at 9:26 PM Meenakshi Aggarwal meenakshi.aggarwal@nxp.com wrote:
ls2088, ls1088 : minimum MC Memory size is 128 MB lx2 : minimum MC memory size is 256 MB
Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com
Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied u-boot-fsl-qoriq, awaiting upstream
--pk

Hi Meenakshi,
https://patchwork.ozlabs.org/patch/1048656/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks! -Joe
participants (6)
-
Ashish Kumar
-
Heinrich Schuchardt
-
Joe Hershberger
-
Joe Hershberger
-
Meenakshi Aggarwal
-
Prabhakar Kushwaha