From 5147a4f3f13245820c19f0e9def77756b45b7735 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sat, 18 Nov 2000 13:31:16 +0000 Subject: More Atlas & Malta bits from Carsten's patch. --- arch/mips/mips-boards/atlas/atlas_setup.c | 22 ++++++++++++++--- arch/mips/mips-boards/generic/Makefile | 2 +- arch/mips/mips-boards/generic/memory.c | 41 +++++++++++++++++++------------ arch/mips/mips-boards/malta/malta_int.c | 9 ++----- arch/mips/mips-boards/malta/malta_setup.c | 38 ++++++++++++++++++++++------ 5 files changed, 77 insertions(+), 35 deletions(-) (limited to 'arch') diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c index a0b2d3526..388ea3c9a 100644 --- a/arch/mips/mips-boards/atlas/atlas_setup.c +++ b/arch/mips/mips-boards/atlas/atlas_setup.c @@ -26,11 +26,14 @@ #include #include #include +#include #include #include #include +#include #include +#include #include #if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE) @@ -62,6 +65,9 @@ void __init atlas_setup(void) #endif char *argptr; + mips_io_port_base = KSEG1; + ioport_resource.end = 0x7fffffff; + #ifdef CONFIG_SERIAL_CONSOLE argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "console=ttyS0")) == NULL) { @@ -107,12 +113,20 @@ void __init atlas_setup(void) } #endif argptr = prom_getcmdline(); -#if 0 /* Later -- Ralf */ - if ((argptr = strstr(argptr, "nofpu")) != NULL) - mips_cpu.options &= ~MIPS_CPU_FPU; -#endif rtc_ops = &atlas_rtc_ops; mips_reboot_setup(); + + /* + * Setup the North bridge to do Master byte-lane swapping when + * running in bigendian. + * Be careful to use prom_printf after this. + */ +#if defined(__MIPSEL__) + GT_WRITE(GT_PCI0_CMD_OFS, GT_PCI0_CMD_MBYTESWAP_BIT | + GT_PCI0_CMD_SBYTESWAP_BIT); +#else + GT_WRITE(GT_PCI0_CMD_OFS, 0); +#endif } diff --git a/arch/mips/mips-boards/generic/Makefile b/arch/mips/mips-boards/generic/Makefile index c76f6fd46..40aeccfff 100644 --- a/arch/mips/mips-boards/generic/Makefile +++ b/arch/mips/mips-boards/generic/Makefile @@ -37,6 +37,6 @@ all: mipsboards.o O_TARGET := mipsboards.o O_OBJS := mipsIRQ.o pci.o reset.o display.o init.o memory.o printf.o \ - cmdline.o time.o + cmdline.o time.o pci-dma.o include $(TOPDIR)/Rules.make diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c index c352ab790..67c8426ed 100644 --- a/arch/mips/mips-boards/generic/memory.c +++ b/arch/mips/mips-boards/generic/memory.c @@ -54,6 +54,12 @@ static char *mtypes[3] = { }; #endif +/* References to section boundaries */ +extern char _end; + +#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) + + struct prom_pmemblock * __init prom_getmdesc(void) { char *memsize_str; @@ -96,16 +102,21 @@ struct prom_pmemblock * __init prom_getmdesc(void) mdesc[2].base = 0x000f0000; mdesc[2].size = 0x00010000; #endif - mdesc[3].type = yamon_free; - mdesc[3].base = 0x00100000; - mdesc[3].size = memsize - mdesc[3].base; + + mdesc[3].type = yamon_dontuse; + mdesc[3].base = 0x00100000; + mdesc[3].size = PHYSADDR(PFN_ALIGN(&_end)) - mdesc[3].base; + + mdesc[4].type = yamon_free; + mdesc[4].base = PHYSADDR(PFN_ALIGN(&_end)); + mdesc[4].size = memsize - mdesc[4].base; return &mdesc[0]; } int __init page_is_ram(unsigned long pagenr) { - if ((pagenr << PAGE_SHIFT) < mdesc[3].base + mdesc[3].size) + if ((pagenr << PAGE_SHIFT) < mdesc[4].base + mdesc[4].size) return 1; return 0; @@ -172,7 +183,7 @@ void __init prom_meminit(void) p = prom_getmdesc(); while (p->size) { prom_printf("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n", - i, p, p->base, p->size, memtypes[p->type]); + i, p, p->base, p->size, mtypes[p->type]); p++; i++; } @@ -182,23 +193,21 @@ void __init prom_meminit(void) p = prom_getmdesc(); while (p->size) { pblocks[i].type = prom_memtype_classify (p->type); - pblocks[i].base = p->base | 0x80000000; + pblocks[i].base = p->base; pblocks[i].size = p->size; switch (pblocks[i].type) { case MEMTYPE_FREE: totram += pblocks[i].size; #ifdef DEBUG prom_printf("free_chunk[%d]: base=%08lx size=%d\n", - i, pblocks[i].base, - pblocks[i].size); + i, pblocks[i].base, pblocks[i].size); #endif i++; break; case MEMTYPE_PROM: #ifdef DEBUG - prom_printf("prom_chunk[%d]: base=%08lx size=%d\n", - i, pblocks[i].base, - pblocks[i].size); + prom_printf("prom_chunk[%d]: base=%08lx size=%d\n", + i, pblocks[i].base, pblocks[i].size); #endif i++; break; @@ -229,7 +238,7 @@ void __init prom_meminit(void) reserve_bootmem(largest->base, bootmap_size); printk("PROMLIB: Total free ram %d bytes (%dK,%dMB)\n", - totram, (totram/1024), (totram/1024/1024)); + totram, (totram/1024), (totram/1024/1024)); } void prom_free_prom_memory (void) @@ -244,12 +253,12 @@ void prom_free_prom_memory (void) addr = p->base; while (addr < p->base + p->size) { - ClearPageReserved(virt_to_page(addr)); - set_page_count(virt_to_page(addr), 1); + ClearPageReserved(virt_to_page(phys_to_virt(addr))); + set_page_count(virt_to_page(phys_to_virt(addr)), 1); free_page(addr); addr += PAGE_SIZE; - freed++; + freed += PAGE_SIZE; } } - printk("Freeing prom memory: %ldkk freed\n", freed >> 10); + printk("Freeing prom memory: %ldkb freed\n", freed >> 10); } diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c index 6aa55118d..62932ace8 100644 --- a/arch/mips/mips-boards/malta/malta_int.c +++ b/arch/mips/mips-boards/malta/malta_int.c @@ -321,7 +321,7 @@ void malta_hw0_irqdispatch(struct pt_regs *regs) if ( action == NULL ) return; - hardirq_enter(cpu); + irq_enter(cpu); kstat.irqs[0][irq + 8]++; do { action->handler(irq, action->dev_id, regs); @@ -329,9 +329,7 @@ void malta_hw0_irqdispatch(struct pt_regs *regs) } while (action); enable_irq(irq); - hardirq_exit(cpu); - - return; + irq_exit(cpu); } @@ -381,9 +379,6 @@ void __init maltaint_init(void) outb(cached_int_mask & 0xff, PIIX4_ICTLR1_OCW1); outb((cached_int_mask >> 8) & 0xff, PIIX4_ICTLR2_OCW1); - request_region(PIIX4_ICTLR1_ICW1, 0x20, "pic1"); - request_region(PIIX4_ICTLR2_ICW1, 0x20, "pic2"); - /* Now safe to set the exception vector. */ set_except_vector(0, mipsIRQ); } diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c index 1621fa0dd..f653ceb9e 100644 --- a/arch/mips/mips-boards/malta/malta_setup.c +++ b/arch/mips/mips-boards/malta/malta_setup.c @@ -27,10 +27,15 @@ #include #include #include +#include +#ifdef CONFIG_BLK_DEV_IDE +#include +#endif #include #include #include +#include #include #include #include @@ -65,6 +70,16 @@ extern struct rtc_ops malta_rtc_ops; extern void mips_reboot_setup(void); +struct resource standard_io_resources[] = { + { "dma1", 0x00, 0x1f, IORESOURCE_BUSY }, + { "pic1", 0x20, 0x3f, IORESOURCE_BUSY }, + { "timer", 0x40, 0x5f, IORESOURCE_BUSY }, + { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY }, + { "pic2", 0xa0, 0xbf, IORESOURCE_BUSY }, + { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, +}; + +#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) static void __init malta_irq_setup(void) { @@ -88,14 +103,14 @@ void __init malta_setup(void) extern char (*getDebugChar)(void); #endif char *argptr; + int i; irq_setup = malta_irq_setup; mips_io_port_base = MALTA_PORT_BASE; - request_region(0x00,0x20,"dma1"); - request_region(0x40,0x20,"timer"); - request_region(0x80,0x10,"dma page reg"); - request_region(0xc0,0x20,"dma2"); + /* Request I/O space for devices used on the Malta board. */ + for (i = 0; i < STANDARD_IO_RESOURCES; i++) + request_resource(&ioport_resource, standard_io_resources+i); /* * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge. @@ -140,9 +155,6 @@ void __init malta_setup(void) /* Breakpoints and stuff are in malta_irq_setup() */ } #endif - argptr = prom_getcmdline(); - if ((argptr = strstr(argptr, "nofpu")) != NULL) - mips_cpu.options &= ~MIPS_CPU_FPU; rtc_ops = &malta_rtc_ops; #ifdef CONFIG_BLK_DEV_IDE @@ -152,4 +164,16 @@ void __init malta_setup(void) fd_ops = &std_fd_ops; #endif mips_reboot_setup(); + + /* + * Setup the North bridge to do Master byte-lane swapping when + * running in bigendian. + * Be careful to use prom_printf after this. + */ +#if defined(__MIPSEL__) + GT_WRITE(GT_PCI0_CMD_OFS, GT_PCI0_CMD_MBYTESWAP_BIT | + GT_PCI0_CMD_SBYTESWAP_BIT); +#else + GT_WRITE(GT_PCI0_CMD_OFS, 0); +#endif } -- cgit v1.2.3