From 7fe5051929add5ef30982c174434e7d7cff52a2e Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 31 Dec 2023 19:05:24 +0100 Subject: [PATCH 6/8] sparc32: Drop mem= support If there is a need to limit the memory available the feature can be added later using early_param support etc. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Andreas Larsson --- arch/sparc/include/asm/setup.h | 3 --- arch/sparc/kernel/setup_32.c | 18 ------------------ arch/sparc/mm/init_32.c | 32 +++----------------------------- 3 files changed, 3 insertions(+), 50 deletions(-) diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h index 72205684e51e..e6f7eb383b1f 100644 --- a/arch/sparc/include/asm/setup.h +++ b/arch/sparc/include/asm/setup.h @@ -37,9 +37,6 @@ extern unsigned long pdma_areasize; int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler); -/* setup_32.c */ -extern unsigned long cmdline_memory_size; - /* devices.c */ void __init device_scan(void); diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 75c36f734dfb..c8b3e19472af 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -88,9 +88,6 @@ static void prom_sync_me(void) static unsigned int boot_flags __initdata = 0; #define BOOTME_DEBUG 0x1 -/* Exported for mm/init.c:paging_init. */ -unsigned long cmdline_memory_size __initdata = 0; - /* which CPU booted us (0xff = not set) */ unsigned char boot_cpu_id = 0xff; /* 0xff will make it into DATA section... */ @@ -148,21 +145,6 @@ static void __init boot_flags_init(char *commands) process_switch(*commands++); continue; } - if (!strncmp(commands, "mem=", 4)) { - /* - * "mem=XXX[kKmM] overrides the PROM-reported - * memory size. - */ - cmdline_memory_size = simple_strtoul(commands + 4, - &commands, 0); - if (*commands == 'K' || *commands == 'k') { - cmdline_memory_size <<= 10; - commands++; - } else if (*commands=='M' || *commands=='m') { - cmdline_memory_size <<= 20; - commands++; - } - } while (*commands && *commands != ' ') commands++; } diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index a55d34c94d12..cd16e9ae81b6 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -99,33 +99,7 @@ static void __init find_ramdisk(unsigned long end_of_phys_memory) void __init bootmem_init(void) { - unsigned long start_pfn, bytes_avail, size; - unsigned long end_of_phys_memory = 0; - int i; - - bytes_avail = 0UL; - for (i = 0; sp_banks[i].num_bytes != 0; i++) { - end_of_phys_memory = sp_banks[i].base_addr + - sp_banks[i].num_bytes; - bytes_avail += sp_banks[i].num_bytes; - if (cmdline_memory_size) { - if (bytes_avail > cmdline_memory_size) { - unsigned long slack = bytes_avail - cmdline_memory_size; - - bytes_avail -= slack; - end_of_phys_memory -= slack; - - sp_banks[i].num_bytes -= slack; - if (sp_banks[i].num_bytes == 0) { - sp_banks[i].base_addr = 0xdeadbeef; - } else { - sp_banks[i+1].num_bytes = 0; - sp_banks[i+1].base_addr = 0xdeadbeef; - } - break; - } - } - } + unsigned long start_pfn, size; /* Start with page aligned address of last symbol in kernel * image. @@ -135,7 +109,7 @@ void __init bootmem_init(void) /* Now shift down to get the real physical page frame number. */ start_pfn >>= PAGE_SHIFT; - max_pfn = end_of_phys_memory >> PAGE_SHIFT; + max_pfn = PFN_DOWN(memblock_end_of_DRAM()); max_low_pfn = max_pfn; highstart_pfn = highend_pfn = max_pfn; @@ -145,7 +119,7 @@ void __init bootmem_init(void) max_low_pfn = calc_max_low_pfn(); } - find_ramdisk(end_of_phys_memory); + find_ramdisk(memblock_end_of_DRAM()); /* Reserve the kernel text/data/bss. */ size = (start_pfn << PAGE_SHIFT) - phys_base; -- 2.53.0