From 95273a610ff4ed4f4cf78d20a99f6a32acec8841 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 3 Jan 2000 14:06:42 +0000 Subject: Combination of coverhd.h cleanup and MVME23xx/MCP750 patch from Eric Valette and Jay Kulpinski . --- c/src/lib/libbsp/powerpc/shared/include/bsp.h | 11 +++-- c/src/lib/libbsp/powerpc/shared/irq/irq_init.c | 9 +++- c/src/lib/libbsp/powerpc/shared/start/start.S | 52 ++++++++++++++++++++++ c/src/lib/libbsp/powerpc/shared/startup/bspstart.c | 3 +- 4 files changed, 68 insertions(+), 7 deletions(-) (limited to 'c/src/lib/libbsp') diff --git a/c/src/lib/libbsp/powerpc/shared/include/bsp.h b/c/src/lib/libbsp/powerpc/shared/include/bsp.h index 7672298231..a2be655e1e 100644 --- a/c/src/lib/libbsp/powerpc/shared/include/bsp.h +++ b/c/src/lib/libbsp/powerpc/shared/include/bsp.h @@ -32,19 +32,22 @@ /* * Total memory using RESIDUAL DATA */ -unsigned int BSP_mem_size; +extern unsigned int BSP_mem_size; /* * PCI Bus Frequency */ -unsigned int BSP_bus_frequency; +extern unsigned int BSP_bus_frequency; /* * processor clock frequency */ -unsigned int BSP_processor_frequency; +extern unsigned int BSP_processor_frequency; /* * Time base divisior (how many tick for 1 second). */ -unsigned int BSP_time_base_divisor; +extern unsigned int BSP_time_base_divisor; + +#define BSP_Convert_decrementer( _value ) \ + ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value))) extern rtems_configuration_table BSP_Configuration; extern void BSP_panic(char *s); diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c index 6253ec789e..f97f21325f 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c +++ b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c @@ -5,6 +5,9 @@ * * CopyRight (C) 1999 valette@crf.canon.fr * + * Enhanced by Jay Kulpinski + * to make it valid for MVME2300 Motorola boards. + * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.OARcorp.com/rtems/license.html. @@ -249,10 +252,14 @@ void BSP_rtems_irq_mng_init(unsigned cpuId) #ifdef TRACE_IRQ_INIT printk("Going to initialize the PCI/ISA bridge IRQ related setting (VIA 82C586)\n"); #endif - if ( (currentBoard == MESQUITE) ) { + if ( currentBoard == MESQUITE ) { VIA_isa_bridge_interrupts_setup(); known_cpi_isa_bridge = 1; } + if ( currentBoard == MVME_2300 ) { + /* nothing to do for W83C553 bridge */ + known_cpi_isa_bridge = 1; + } if (!known_cpi_isa_bridge) { printk("Please add code for PCI/ISA bridge init to libbsp/shared/irq/irq_init.c\n"); printk("If your card works correctly please add a test and set known_cpi_isa_bridge to true\n"); diff --git a/c/src/lib/libbsp/powerpc/shared/start/start.S b/c/src/lib/libbsp/powerpc/shared/start/start.S index cc2dabd2c7..ee09686659 100644 --- a/c/src/lib/libbsp/powerpc/shared/start/start.S +++ b/c/src/lib/libbsp/powerpc/shared/start/start.S @@ -49,6 +49,8 @@ __rtems_entry_point: * r6: Start of command line string * r7: End of command line string * + * The Prep boot loader insure that the MMU is currently off... + * */ mr r31,r3 /* save parameters */ @@ -56,6 +58,11 @@ __rtems_entry_point: mr r29,r5 mr r28,r6 mr r27,r7 + /* + * Make sure we have nothing in BATS and TLB + */ + bl clear_bats + bl flush_tlbs /* * Use the first pair of BAT registers to map the 1st 64MB * of RAM to KERNELBASE. @@ -63,6 +70,7 @@ __rtems_entry_point: lis r11,KERNELBASE@h ori r11,r11,0x7fe /* set up BAT registers for 604 */ li r8,2 /* R/W access */ + isync mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */ mtspr DBAT0U,r11 /* bit in upper BAT register */ mtspr IBAT0L,r8 @@ -129,3 +137,47 @@ _return_to_ppcbug: bl MMUon mtctr r30 bctr + +/* + * An undocumented "feature" of 604e requires that the v bit + * be cleared before changing BAT values. + * + * Also, newer IBM firmware does not clear bat3 and 4 so + * this makes sure it's done. + * -- Cort + */ +clear_bats: + li r20,0 + mfspr r9,PVR + rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ + cmpwi r9, 1 + SYNC + beq 1f + mtspr DBAT0U,r20 + mtspr DBAT0L,r20 + mtspr DBAT1U,r20 + mtspr DBAT1L,r20 + mtspr DBAT2U,r20 + mtspr DBAT2L,r20 + mtspr DBAT3U,r20 + mtspr DBAT3L,r20 +1: + mtspr IBAT0U,r20 + mtspr IBAT0L,r20 + mtspr IBAT1U,r20 + mtspr IBAT1L,r20 + mtspr IBAT2U,r20 + mtspr IBAT2L,r20 + mtspr IBAT3U,r20 + mtspr IBAT3L,r20 + SYNC + blr + +flush_tlbs: + lis r20, 0x1000 +1: addic. r20, r20, -0x1000 + tlbie r20 + blt 1b + sync + blr + diff --git a/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c b/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c index 63181b603d..4ca991e229 100644 --- a/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c @@ -233,8 +233,7 @@ void bsp_start( void ) * Must have acces to open pic PCI ACK registers * provided by the RAVEN */ - setdbat(3, 0xfeff0000, 0xfeff0000, 0x10000, IO_PAGE); - + setdbat(3, 0xf0000000, 0xf0000000, 0x10000000, IO_PAGE); select_console(CONSOLE_LOG); /* We check that the keyboard is present and immediately -- cgit v1.2.3