From: James S. <jsi...@us...> - 2002-01-28 19:24:00
|
Update of /cvsroot/linux-mips/linux/arch/mips/sibyte/swarm In directory usw-pr-cvs1:/tmp/cvs-serv10439/arch/mips/sibyte/swarm Modified Files: setup.c Log Message: First cut of a highmem implementation. Only usable on CPUs that don't suffer from virtual aliases. In connection with the recent patches for 64-bit physical addresses in pagetables this patch increases the maximum memory supported by the 32-bit kernel into the gigabyte range. Index: setup.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/sibyte/swarm/setup.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- setup.c 2002/01/02 19:12:16 1.6 +++ setup.c 2002/01/28 19:23:58 1.7 @@ -26,6 +26,7 @@ #include <linux/bootmem.h> #include <linux/blk.h> #include <linux/init.h> +#include <linux/ide.h> #include <asm/irq.h> #include <asm/io.h> #include <asm/bootinfo.h> @@ -34,8 +35,9 @@ #include <asm/sibyte/sb1250.h> #include <asm/sibyte/sb1250_defs.h> #include <asm/sibyte/sb1250_regs.h> +#include <asm/sibyte/swarm_ide.h> #include <asm/reboot.h> -#include <linux/ide.h> +#include <asm/time.h> #include "cfe_xiocb.h" #include "cfe_api.h" @@ -45,7 +47,7 @@ extern int cfe_console_handle; #ifdef CONFIG_BLK_DEV_IDE_SWARM -struct ide_ops *ide_ops; +extern struct ide_ops *ide_ops; #endif @@ -54,12 +56,21 @@ #endif /* Max ram addressable in 32-bit segments */ -#define MAX_RAM_SIZE (1024*1024*256) +#ifdef CONFIG_HIGHMEM +#ifdef CONFIG_64BIT_PHYS_ADDR +/* #define MAX_RAM_SIZE (0xffffffffffffffff) */ +#define MAX_RAM_SIZE (0xffffffff) +#else +#define MAX_RAM_SIZE (0xffffffff) +#endif +#else +#define MAX_RAM_SIZE (0xfffffff) +#endif #ifndef CONFIG_SWARM_STANDALONE -long swarm_mem_region_addrs[CONFIG_SIBYTE_SWARM_MAX_MEM_REGIONS]; -long swarm_mem_region_sizes[CONFIG_SIBYTE_SWARM_MAX_MEM_REGIONS]; +phys_t swarm_mem_region_addrs[CONFIG_SIBYTE_SWARM_MAX_MEM_REGIONS]; +phys_t swarm_mem_region_sizes[CONFIG_SIBYTE_SWARM_MAX_MEM_REGIONS]; unsigned int swarm_mem_region_count; #endif @@ -132,6 +143,49 @@ /* release_region(from, extent); */ } + +void swarm_ideproc(ide_ide_action_t action, ide_drive_t *drive, + void *buffer, unsigned int count) +{ + /* slow? vlb_sync? */ + switch (action) { + case ideproc_ide_input_data: + if (drive->io_32bit) { + swarm_insl(IDE_DATA_REG, buffer, count); + } else { + swarm_insw(IDE_DATA_REG, buffer, count<<1); + } + break; + case ideproc_ide_output_data: + if (drive->io_32bit) { + swarm_outsl(IDE_DATA_REG, buffer, count); + } else { + swarm_outsw(IDE_DATA_REG, buffer, count<<1); + } + break; + case ideproc_atapi_input_bytes: + count++; + if (drive->io_32bit) { + swarm_insl(IDE_DATA_REG, buffer, count>>2); + } else { + swarm_insw(IDE_DATA_REG, buffer, count>>1); + } + if ((count & 3) >= 2) + swarm_insw(IDE_DATA_REG, (char *)buffer + (count & ~3), 1); + break; + case ideproc_atapi_output_bytes: + count++; + if (drive->io_32bit) { + swarm_outsl(IDE_DATA_REG, buffer, count>>2); + } else { + swarm_outsw(IDE_DATA_REG, buffer, count>>1); + } + if ((count & 3) >= 2) + swarm_outsw(IDE_DATA_REG, (char *)buffer + (count & ~3), 1); + break; + } +} + struct ide_ops swarm_ide_ops = { &swarm_ide_default_irq, &swarm_ide_default_io_base, @@ -144,50 +198,39 @@ }; #endif - -static void stop_this_cpu(void *dummy) -{ - printk("Cpu %d stopping\n", smp_processor_id()); - for (;;); -} -static void smp_cpu0_exit(void) +#ifdef CONFIG_SMP +static void smp_cpu0_exit(void *unused) { - printk("cpu %d poked\n", smp_processor_id()); - /* XXXKW we are in the mailbox handler... */ - __asm__(".set push\n\t" - ".set mips32\n\t" - "la $2, swarm_linux_exit\n\t" - "mtc0 $2, $24\n\t" - "eret\n\t" - ".set pop" - ::: "$2"); + printk("swarm_linux_exit called (cpu1) - passing control back to CFE\n"); + cfe_exit(1,0); } - -extern void (*smp_cpu0_finalize)(void); +#endif static void swarm_linux_exit(void) { +#ifdef CONFIG_SMP if (smp_processor_id()) { - /* Make cpu 0 do the swarm_linux_exit */ - /* XXXKW this isn't quite there yet */ - smp_cpu0_finalize = smp_cpu0_exit; - stop_this_cpu(NULL); - } else { - printk("swarm_linux_exit called...passing control back to CFE\n"); - cfe_exit(1, 0); - printk("cfe_exit returned??\n"); + smp_call_function(smp_cpu0_exit,NULL,1,1); while(1); } +#endif + printk("swarm_linux_exit called...passing control back to CFE\n"); + cfe_exit(1, 0); + printk("cfe_exit returned??\n"); + while(1); } void __init bus_error_init(void) { } +extern void swarm_time_init(void); + void __init swarm_setup(void) { extern int panic_timeout; + rtc_ops = &swarm_rtc_ops; panic_timeout = 5; /* For debug. This should probably be raised later */ _machine_restart = (void (*)(char *))swarm_linux_exit; @@ -207,10 +250,11 @@ #endif " runs\n"); + board_time_init = swarm_time_init; + #ifdef CONFIG_BLK_DEV_IDE_SWARM - ide_ops = &swarm_ide_ops; + ide_ops = &swarm_ide_ops; #endif - } /* This is the kernel command line. Actually, it's @@ -226,7 +270,7 @@ static __init void prom_meminit(void) { - unsigned long addr, size; + unsigned long long addr, size; /* regardless of 64BIT_PHYS_ADDR */ long type; unsigned int idx; int rd_flag; @@ -284,13 +328,11 @@ } #endif if (!rd_flag) { - if (addr < MAX_RAM_SIZE) { - if (size > MAX_RAM_SIZE) { - size = MAX_RAM_SIZE - addr; - } - add_memory_region(addr, size, - BOOT_MEM_RAM); - } + if (addr > MAX_RAM_SIZE) + continue; + if (addr+size > MAX_RAM_SIZE) + size = MAX_RAM_SIZE - (addr+size) + 1; + add_memory_region(addr, size, BOOT_MEM_RAM); } swarm_mem_region_addrs[swarm_mem_region_count] = addr; swarm_mem_region_sizes[swarm_mem_region_count] = size; |