forked from Imagelibrary/rtems
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9db9661c9 |
@@ -1,4 +1,4 @@
|
||||
AC_DEFUN([RTEMS_VERSIONING],
|
||||
m4_define([_RTEMS_VERSION],[4.9.4]))
|
||||
m4_define([_RTEMS_VERSION],[4.9.1]))
|
||||
|
||||
m4_define([RTEMS_API],[4.9])
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
2009-03-12 Daniel Hellstrom <daniel@gaisler.com>
|
||||
|
||||
PR 1392/bsps
|
||||
* libchip/i2c/spi-memdrv.c: SPI Memory driver. Fix but where writes
|
||||
over multiple pages results in extra data being written.
|
||||
|
||||
2009-01-21 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libchip/i2c/spi-sd-card.c: Fixed RTEMS_BLKDEV_CAPABILITIES ioctl
|
||||
which caused invalid multiple block writes.
|
||||
|
||||
2008-11-13 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libchip/serial/ns16550.c: Transmit the character in the polled write
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AC_DEFUN([RTEMS_VERSIONING],
|
||||
m4_define([_RTEMS_VERSION],[4.9.4]))
|
||||
m4_define([_RTEMS_VERSION],[4.9.1]))
|
||||
|
||||
m4_define([RTEMS_API],[4.9])
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* shared/irq/irq_asm.S: When the type rtems_boolean was switched to the
|
||||
C99 bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2008-08-18 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* shared/irq/irq_init.c: Add missing prototypes.
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2009-01-06 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1350/bsps
|
||||
* network/lan91c11x.c: Do not write 65th element into 64 element array.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -224,6 +224,9 @@ void lan91c11x_write_phy_reg(int reg, uint16_t phydata)
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
/* Final clock bit */
|
||||
bits[clk_idx++] = 0;
|
||||
|
||||
/* Turn off all MII Interface bits */
|
||||
lan91c11x_write_reg(LAN91C11X_MGMT,
|
||||
lan91c11x_read_reg(LAN91C11X_MGMT) & 0xfff0);
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* irq/irq_asm.S: When the type rtems_boolean was switched to the C99
|
||||
bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -83,13 +83,13 @@ PUBLIC_ARM_FUNCTION(_ISR_Handler)
|
||||
|
||||
/* If a task switch is necessary, call scheduler */
|
||||
ldr r0, =_Context_Switch_necessary
|
||||
ldrb r1, [r0]
|
||||
ldr r1, [r0]
|
||||
cmp r1, #0
|
||||
|
||||
/* since bframe is going to clear _ISR_Signals_to_thread_executing, */
|
||||
/* we need to load it here */
|
||||
ldr r0, =_ISR_Signals_to_thread_executing
|
||||
ldrb r1, [r0]
|
||||
ldr r1, [r0]
|
||||
bne bframe
|
||||
|
||||
/* If a signals to be sent (_ISR_Signals_to_thread_executing != 0), */
|
||||
@@ -99,7 +99,7 @@ PUBLIC_ARM_FUNCTION(_ISR_Handler)
|
||||
|
||||
/* _ISR_Signals_to_thread_executing = FALSE */
|
||||
mov r1, #0
|
||||
strb r1, [r0]
|
||||
str r1, [r0]
|
||||
|
||||
bframe:
|
||||
/* Now we need to set up the return from this ISR to be _ISR_Dispatch */
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2009-03-02 Ray Xu <rayx.cn@gmail.com>
|
||||
|
||||
PR 1380/bsps
|
||||
* include/bsp.h: Switch to English comments.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -30,15 +30,12 @@ extern "C" {
|
||||
/* cclk=cco/(2*P) */
|
||||
/* cco = cclk*2*P */
|
||||
|
||||
/* system clk frequecy,<=60Mhz, defined in system configuration */
|
||||
#define LPC22xx_Fcclk CONFIG_ARM_CLK
|
||||
#define LPC22xx_Fcclk CONFIG_ARM_CLK /* system clk frequecy,<=60Mhz, defined in system configuration */
|
||||
|
||||
/* Fcco 156M~320Mhz*/
|
||||
/* system clk frequecy,<=60Mhz, defined in system configuration */
|
||||
#define LPC22xx_Fcclk CONFIG_ARM_CLK
|
||||
#define LPC22xx_Fcclk CONFIG_ARM_CLK /* system clk frequecy,<=60Mhz, defined in system configuration */
|
||||
#define LPC22xx_Fcco LPC22xx_Fcclk * 4
|
||||
/*VPB clk frequency,1,1/2,1/4 times of Fcclk */
|
||||
#define LPC22xx_Fpclk (LPC22xx_Fcclk /4) *1
|
||||
#define LPC22xx_Fpclk (LPC22xx_Fcclk /4) *1 /*VPB clk frequency,1,1/2,1/4 times of Fcclk */
|
||||
|
||||
|
||||
|
||||
@@ -79,15 +76,14 @@ extern "C" {
|
||||
/**
|
||||
* help file
|
||||
*/
|
||||
/* System configure, Fosc Fcclk Fcco Fpclk must be defined*/
|
||||
#define Fosc 11059200 // osc freq,10MHz~25MHz,
|
||||
// change to real one if needed
|
||||
#define Fcclk (Fosc << 2) //system freq 2^n time of Fosc(1~32) <=60MHZ
|
||||
#define Fcco (Fcclk <<2) //CCO freq 2,4,8,16 time of Fcclk 156MHz~320MHz
|
||||
#define Fpclk (Fcclk >>2) * 1 //VPB freq only(Fcclk / 4) 1~4
|
||||
#define M Fcclk / Fosc
|
||||
#define P_min Fcco_MIN / (2*Fcclk) + 1;
|
||||
#define P_max Fcco_MAX / (2*Fcclk);
|
||||
/* ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, Fosc<EFBFBD><EFBFBD>Fcclk<EFBFBD><EFBFBD>Fcco<EFBFBD><EFBFBD>Fpclk<EFBFBD><EFBFBD><EFBFBD>붨<EFBFBD><EFBFBD>*/
|
||||
#define Fosc 11059200 //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>,10MHz~25MHz<48><7A>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>һ<EFBFBD><D2BB>
|
||||
#define Fcclk (Fosc << 2) //ϵͳƵ<CDB3>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD>ΪFosc<73><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1~32)<29><><EFBFBD><EFBFBD><=60MHZ
|
||||
#define Fcco (Fcclk <<2) //CCOƵ<4F>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD>ΪFcclk<6C><6B>2<EFBFBD><32>4<EFBFBD><34>8<EFBFBD><38>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΧΪ156MHz~320MHz
|
||||
#define Fpclk (Fcclk >>2) * 1 //VPBʱ<42><CAB1>Ƶ<EFBFBD>ʣ<EFBFBD>ֻ<EFBFBD><D6BB>Ϊ(Fcclk / 4)<29><>1 ~ 4<><34>
|
||||
#define M Fcclk / Fosc;
|
||||
#define P_min Fcco_MIN / (2*Fcclk) + 1;
|
||||
#define P_max Fcco_MAX / (2*Fcclk);
|
||||
|
||||
|
||||
|
||||
@@ -110,20 +106,20 @@ extern "C" {
|
||||
#define SPI_CS_PIN_FUNC PINSEL0_bit.SPI_CS_PIN
|
||||
|
||||
// Flash definition
|
||||
//#define FLASH_SIZE (0x200000-FLASH_BOOT) // Total area of Flash region in words 8 bit
|
||||
#define FLASH_SIZE (0x80000-FLASH_BOOT) // Total area of Flash region in words 8 bit
|
||||
//#define FLASH_SIZE (0x80000-FLASH_BOOT) // Total area of Flash region in words 8 bit
|
||||
#define FLASH_BEGIN 0x80000000
|
||||
#define FLASH_BASE (FLASH_BEGIN+FLASH_BOOT) //First 0x8000 bytes reserved for boot loader etc.
|
||||
//#define FLASH_SIZE (0x200000-FLASH_BOOT) // Total area of Flash region in words 8 bit
|
||||
#define FLASH_SIZE (0x80000-FLASH_BOOT) // Total area of Flash region in words 8 bit
|
||||
//#define FLASH_SIZE (0x80000-FLASH_BOOT) // Total area of Flash region in words 8 bit
|
||||
#define FLASH_BEGIN 0x80000000
|
||||
#define FLASH_BASE (FLASH_BEGIN+FLASH_BOOT) //First 0x8000 bytes reserved for boot loader etc.
|
||||
|
||||
// SRAM definition
|
||||
#define SRAM_SIZE 0x100000 // Total area of Flash region in words 8 bit
|
||||
#define SRAM_BASE 0x81000000 //First 0x8000 bytes reserved for boot loader etc.
|
||||
#define SRAM_SIZE 0x100000 // Total area of Flash region in words 8 bit
|
||||
#define SRAM_BASE 0x81000000 //First 0x8000 bytes reserved for boot loader etc.
|
||||
|
||||
// CS8900A definition
|
||||
#define CS8900A_BASE 0x82000000
|
||||
#define CS8900A_BASE 0x82000000 //
|
||||
// RTL8019AS definition
|
||||
#define RTL8019AS_BASE 0x82000000
|
||||
#define RTL8019AS_BASE 0x82000000 //
|
||||
|
||||
struct rtems_bsdnet_ifconfig;
|
||||
int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config,
|
||||
|
||||
@@ -79,13 +79,13 @@ _ISR_Handler:
|
||||
|
||||
/* If a task switch is necessary, call scheduler */
|
||||
ldr r0, =_Context_Switch_necessary
|
||||
ldrb r1, [r0]
|
||||
ldr r1, [r0]
|
||||
cmp r1, #0
|
||||
|
||||
/* since bframe is going to clear _ISR_Signals_to_thread_executing, */
|
||||
/* we need to load it here */
|
||||
ldr r0, =_ISR_Signals_to_thread_executing
|
||||
ldrb r1, [r0]
|
||||
ldr r1, [r0]
|
||||
bne bframe
|
||||
|
||||
/* If a signals to be sent (_ISR_Signals_to_thread_executing != 0), */
|
||||
@@ -95,7 +95,7 @@ _ISR_Handler:
|
||||
|
||||
/* _ISR_Signals_to_thread_executing = FALSE */
|
||||
mov r1, #0
|
||||
strb r1, [r0]
|
||||
str r1, [r0]
|
||||
|
||||
bframe:
|
||||
|
||||
|
||||
@@ -1,17 +1,3 @@
|
||||
2009-05-18 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* shared/irq/irq.c, shared/irq/irq.h, shared/irq/irq_asm.S: Add shared
|
||||
interrupt support to i386.
|
||||
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* shared/irq/irq_asm.S: When the type rtems_boolean was switched to the
|
||||
C99 bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2008-09-07 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* shared/comm/i386-stub.c: Include stdbool.h.
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
2010-03-10 Gedare Bloom <gedare@gwu.edu>
|
||||
|
||||
PR 1495/bsp
|
||||
* clock/ckinit.c: Calling rtems_clock_get_uptime() in a tight loop
|
||||
sometimes showed time moving backwards.
|
||||
|
||||
2009-09-15 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
PR 1344/bsps:
|
||||
* clock/ckinit.c: Fix more bugs (applied PR1344/attachment 702):
|
||||
TSC handler was used when 8254 was requested and vice versa.
|
||||
Also, nanosecond handler was never installed to RTEMS clock.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -47,11 +47,6 @@ uint64_t pc586_tsc_at_tick;
|
||||
/* this driver may need to count ISRs per tick */
|
||||
#define CLOCK_DRIVER_ISRS_PER_TICK pc386_isrs_per_tick
|
||||
|
||||
/* if so, the driver may use the count in Clock_driver_support_at_tick */
|
||||
#ifdef CLOCK_DRIVER_ISRS_PER_TICK
|
||||
extern volatile uint32_t Clock_driver_isrs;
|
||||
#endif
|
||||
|
||||
#define READ_8254( _lsb, _msb ) \
|
||||
do { outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_LATCH); \
|
||||
inport_byte(TIMER_CNTR0, _lsb); \
|
||||
@@ -71,18 +66,7 @@ uint32_t (*Clock_driver_nanoseconds_since_last_tick)(void) = NULL;
|
||||
*/
|
||||
void Clock_driver_support_at_tick_tsc(void)
|
||||
{
|
||||
#ifdef CLOCK_DRIVER_ISRS_PER_TICK
|
||||
/*
|
||||
* The driver is multiple ISRs per clock tick.
|
||||
*/
|
||||
if (!Clock_driver_isrs)
|
||||
pc586_tsc_at_tick = rdtsc();
|
||||
#else
|
||||
/*
|
||||
* The driver is one ISR per clock tick.
|
||||
*/
|
||||
pc586_tsc_at_tick = rdtsc();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Clock_driver_support_at_tick_empty(void)
|
||||
@@ -301,27 +285,19 @@ void Clock_driver_support_initialize_hardware(void)
|
||||
/* printk( "Use 8254\n" ); */
|
||||
Clock_driver_support_at_tick = Clock_driver_support_at_tick_empty;
|
||||
Clock_driver_nanoseconds_since_last_tick =
|
||||
bsp_clock_nanoseconds_since_last_tick_i8254;
|
||||
bsp_clock_nanoseconds_since_last_tick_tsc;
|
||||
|
||||
} else {
|
||||
/* printk( "Use TSC\n" ); */
|
||||
Clock_driver_support_at_tick = Clock_driver_support_at_tick_tsc;
|
||||
Clock_driver_nanoseconds_since_last_tick =
|
||||
bsp_clock_nanoseconds_since_last_tick_tsc;
|
||||
bsp_clock_nanoseconds_since_last_tick_i8254;
|
||||
}
|
||||
|
||||
/* Shell installs nanosecond handler before calling
|
||||
* Clock_driver_support_initialize_hardware() :-(
|
||||
* so we do it again now that we're ready.
|
||||
*/
|
||||
rtems_clock_set_nanoseconds_extension(
|
||||
Clock_driver_nanoseconds_since_last_tick
|
||||
);
|
||||
|
||||
if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
|
||||
printk("Unable to initialize system clock\n");
|
||||
rtems_fatal_error_occurred(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* This file contains the implementation of the function described in irq.h
|
||||
*
|
||||
* Copyright (C) 1998 valette@crf.canon.fr
|
||||
* CopyRight (C) 1998 valette@crf.canon.fr
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
@@ -195,63 +195,7 @@ static int isValidInterrupt(int irq)
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------- RTEMS Shared Irq Handler Mngt Routines ------------
|
||||
*/
|
||||
int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data* irq)
|
||||
{
|
||||
rtems_interrupt_level level;
|
||||
rtems_irq_connect_data* vchain;
|
||||
|
||||
if (!isValidInterrupt(irq->name)) {
|
||||
printk("Invalid interrupt vector %d\n",irq->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
|
||||
if ( (int)rtems_hdl_tbl[irq->name].next_handler == -1 ) {
|
||||
rtems_interrupt_enable(level);
|
||||
printk(
|
||||
"IRQ vector %d already connected to an unshared handler\n",
|
||||
irq->name
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
vchain = (rtems_irq_connect_data*)malloc(sizeof(rtems_irq_connect_data));
|
||||
|
||||
/* save off topmost handler */
|
||||
vchain[0]= rtems_hdl_tbl[irq->name];
|
||||
|
||||
/*
|
||||
* store the data provided by user
|
||||
*/
|
||||
rtems_hdl_tbl[irq->name] = *irq;
|
||||
|
||||
/* link chain to new topmost handler */
|
||||
rtems_hdl_tbl[irq->name].next_handler = (void *)vchain;
|
||||
|
||||
/*
|
||||
* enable_irq_at_pic is supposed to ignore
|
||||
* requests to disable interrupts outside
|
||||
* of the range handled by the PIC
|
||||
*/
|
||||
BSP_irq_enable_at_i8259s (irq->name);
|
||||
|
||||
/*
|
||||
* Enable interrupt on device
|
||||
*/
|
||||
if (irq->on)
|
||||
irq->on(irq);
|
||||
|
||||
rtems_interrupt_enable(level);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* --------------- RTEMS Single Irq Handler Mngt Routines ---------------
|
||||
* ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
|
||||
*/
|
||||
|
||||
int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
||||
@@ -278,8 +222,6 @@ int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
||||
* store the data provided by user
|
||||
*/
|
||||
rtems_hdl_tbl[irq->name] = *irq;
|
||||
rtems_hdl_tbl[irq->name].next_handler = (void *)-1;
|
||||
|
||||
/*
|
||||
* Enable interrupt at PIC level
|
||||
*/
|
||||
@@ -287,7 +229,7 @@ int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
||||
/*
|
||||
* Enable interrupt on device
|
||||
*/
|
||||
if (irq->on)
|
||||
if (irq->on)
|
||||
irq->on(irq);
|
||||
|
||||
rtems_interrupt_enable(level);
|
||||
@@ -310,86 +252,43 @@ int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* irq)
|
||||
|
||||
int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
||||
{
|
||||
rtems_interrupt_level level;
|
||||
rtems_irq_connect_data *pchain= NULL, *vchain = NULL;
|
||||
rtems_interrupt_level level;
|
||||
|
||||
if (!isValidInterrupt(irq->name)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if default handler is actually connected. If not issue an error.
|
||||
* You must first get the current handler via i386_get_current_idt_entry
|
||||
* and then disconnect it using i386_delete_idt_entry.
|
||||
* RATIONALE : to always have the same transition by forcing the user
|
||||
* to get the previous handler before accepting to disconnect.
|
||||
*/
|
||||
rtems_interrupt_disable(level);
|
||||
if (rtems_hdl_tbl[irq->name].hdl != irq->hdl) {
|
||||
rtems_interrupt_enable(level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (int)rtems_hdl_tbl[irq->name].next_handler != -1 ) {
|
||||
int found = 0;
|
||||
|
||||
for( (pchain= NULL, vchain = &rtems_hdl_tbl[irq->name]);
|
||||
(vchain->hdl != default_rtems_entry.hdl);
|
||||
(pchain= vchain,
|
||||
vchain = (rtems_irq_connect_data*)vchain->next_handler) ) {
|
||||
if ( vchain->hdl == irq->hdl ) {
|
||||
found = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !found ) {
|
||||
rtems_interrupt_enable(level);
|
||||
if (!isValidInterrupt(irq->name)) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Check if default handler is actually connected. If not issue an error.
|
||||
* You must first get the current handler via i386_get_current_idt_entry
|
||||
* and then disconnect it using i386_delete_idt_entry.
|
||||
* RATIONALE : to always have the same transition by forcing the user
|
||||
* to get the previous handler before accepting to disconnect.
|
||||
*/
|
||||
rtems_interrupt_disable(level);
|
||||
if (rtems_hdl_tbl[irq->name].hdl != irq->hdl) {
|
||||
rtems_interrupt_enable(level);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* disable interrupt at PIC level
|
||||
*/
|
||||
BSP_irq_disable_at_i8259s (irq->name);
|
||||
/*
|
||||
* disable interrupt at PIC level
|
||||
*/
|
||||
BSP_irq_disable_at_i8259s (irq->name);
|
||||
|
||||
/*
|
||||
* Disable interrupt on device
|
||||
*/
|
||||
if (irq->off)
|
||||
irq->off(irq);
|
||||
/*
|
||||
* Disable interrupt on device
|
||||
*/
|
||||
if (irq->off)
|
||||
irq->off(irq);
|
||||
|
||||
/*
|
||||
* restore the default irq value
|
||||
*/
|
||||
if( !vchain ) {
|
||||
/* single handler vector... */
|
||||
rtems_hdl_tbl[irq->name] = default_rtems_entry;
|
||||
} else {
|
||||
if ( pchain ) {
|
||||
/* non-first handler being removed */
|
||||
pchain->next_handler = vchain->next_handler;
|
||||
} else {
|
||||
/* first handler isn't malloc'ed, so just overwrite it. Since
|
||||
* the contents of vchain are being struct copied, vchain itself
|
||||
* goes away
|
||||
*/
|
||||
vchain = vchain->next_handler;
|
||||
rtems_hdl_tbl[irq->name]= *vchain;
|
||||
}
|
||||
free(vchain);
|
||||
}
|
||||
/*
|
||||
* restore the default irq value
|
||||
*/
|
||||
rtems_hdl_tbl[irq->name] = default_rtems_entry;
|
||||
|
||||
rtems_interrupt_enable(level);
|
||||
|
||||
rtems_interrupt_enable(level);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -399,7 +298,6 @@ int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
||||
int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config)
|
||||
{
|
||||
int i;
|
||||
rtems_irq_connect_data* vchain;
|
||||
rtems_interrupt_level level;
|
||||
|
||||
/*
|
||||
@@ -416,16 +314,17 @@ int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config)
|
||||
compute_i8259_masks_from_prio ();
|
||||
|
||||
for (i=0; i < internal_config->irqNb; i++) {
|
||||
BSP_irq_disable_at_i8259s (i);
|
||||
for( vchain = &rtems_hdl_tbl[i];
|
||||
((int)vchain != -1 && vchain->hdl != default_rtems_entry.hdl);
|
||||
vchain = (rtems_irq_connect_data*)vchain->next_handler ) {
|
||||
if (rtems_hdl_tbl[i].hdl != default_rtems_entry.hdl) {
|
||||
BSP_irq_enable_at_i8259s (i);
|
||||
if (vchain->on)
|
||||
vchain->on(vchain);
|
||||
if (rtems_hdl_tbl[i].on)
|
||||
rtems_hdl_tbl[i].on(&rtems_hdl_tbl[i]);
|
||||
}
|
||||
else {
|
||||
if (rtems_hdl_tbl[i].off)
|
||||
rtems_hdl_tbl[i].off(&rtems_hdl_tbl[i]);
|
||||
BSP_irq_disable_at_i8259s (i);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* must enable slave pic anyway
|
||||
*/
|
||||
@@ -464,23 +363,3 @@ void processIrq(unsigned index)
|
||||
rtems_hdl_tbl[index].hdl(rtems_hdl_tbl[index].handle);
|
||||
}
|
||||
|
||||
static inline void
|
||||
bsp_irq_dispatch_list(
|
||||
rtems_irq_connect_data *tbl,
|
||||
unsigned irq,
|
||||
rtems_irq_hdl sentinel
|
||||
)
|
||||
{
|
||||
rtems_irq_connect_data* vchain;
|
||||
for( vchain = &tbl[irq];
|
||||
((int)vchain != -1 && vchain->hdl != sentinel);
|
||||
vchain = (rtems_irq_connect_data*)vchain->next_handler ) {
|
||||
vchain->hdl(vchain->handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void C_dispatch_isr(int irq)
|
||||
{
|
||||
bsp_irq_dispatch_list(rtems_hdl_tbl, irq, default_rtems_entry.hdl);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ extern "C" {
|
||||
|
||||
#include <bsp/irq_asm.h>
|
||||
#include <rtems.h>
|
||||
#define BSP_SHARED_HANDLER_SUPPORT 1
|
||||
#include <rtems/irq.h>
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
@@ -47,7 +46,7 @@ extern "C" {
|
||||
* Interrupt offset in comparison to BSP_ASM_IRQ_VECTOR_BASE
|
||||
* NB : 1) Interrupt vector number in IDT = offset + BSP_ASM_IRQ_VECTOR_BASE
|
||||
* 2) The same name should be defined on all architecture
|
||||
* so that handler connection can be unchanged.
|
||||
* so that handler connexion can be unchanged.
|
||||
*/
|
||||
#define BSP_PERIODIC_TIMER 0
|
||||
#define BSP_KEYBOARD 1
|
||||
|
||||
@@ -107,7 +107,11 @@ nested:
|
||||
*/
|
||||
|
||||
pushl ecx /* push vector number */
|
||||
call C_dispatch_isr
|
||||
lea (ecx,ecx,2), eax
|
||||
mov SYM (rtems_hdl_tbl), edx
|
||||
shl $0x3,eax
|
||||
pushl 0x8(edx,eax,1) /* push hdl argument */
|
||||
call *0x4(edx,eax,1) /* call hdl */
|
||||
addl $4, esp
|
||||
|
||||
/*
|
||||
@@ -139,17 +143,17 @@ nested:
|
||||
/* Is dispatch disabled */
|
||||
jne .exit /* Yes, then exit */
|
||||
|
||||
cmpb $0, SYM (_Context_Switch_necessary)
|
||||
cmpl $0, SYM (_Context_Switch_necessary)
|
||||
/* Is task switch necessary? */
|
||||
jne .schedule /* Yes, then call the scheduler */
|
||||
|
||||
cmpb $0, SYM (_ISR_Signals_to_thread_executing)
|
||||
cmpl $0, SYM (_ISR_Signals_to_thread_executing)
|
||||
/* signals sent to Run_thread */
|
||||
/* while in interrupt handler? */
|
||||
je .exit /* No, exit */
|
||||
|
||||
.bframe:
|
||||
movb $0, SYM (_ISR_Signals_to_thread_executing)
|
||||
movl $0, SYM (_ISR_Signals_to_thread_executing)
|
||||
/*
|
||||
* This code is the less critical path. In order to have a single
|
||||
* Thread Context, we take the same frame than the one pushed on
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
2009-01-21 Frank Ueberschar <frank.ueberschar@dsa-volgmann.de>
|
||||
|
||||
PR 1354/bsps
|
||||
* network/network.c: In some cases it can occur that an empty mbuf is
|
||||
put on the descriptor chain. (We found it especially then when
|
||||
transmitting fragmented IP Packets.) Since the actual buffer
|
||||
descriptor pointer will be incremented after every inserted mbuf
|
||||
(txBd = sc->txBdBase + sc->txBdHead;) even if m->m_len of the current
|
||||
mbuf was zero. This leads to the bug.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -548,10 +548,10 @@ fec_sendpacket(struct ifnet *ifp, struct mbuf *m)
|
||||
* The IP fragmentation routine in ip_output
|
||||
* can produce fragments with zero length.
|
||||
*/
|
||||
txBd = sc->txBdBase + sc->txBdHead;
|
||||
if (m->m_len){
|
||||
char *p = mtod(m, char *);
|
||||
int offset = (int) p & 0x3;
|
||||
txBd = sc->txBdBase + sc->txBdHead;
|
||||
if (offset == 0) {
|
||||
txBd->buffer = p;
|
||||
txBd->length = m->m_len;
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2009-02-27 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* Makefile.am: Remove unnecessary copy of cpu_asm.S
|
||||
* console/Modif_cpu_asm.S: Removed.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -37,8 +37,8 @@ startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
|
||||
../../shared/sbrk.c ../../m68k/shared/setvec.c \
|
||||
startup/dumpanic.c ../../shared/gnatinstallhandler.c
|
||||
clock_SOURCES = clock/ckinit.c
|
||||
console_SOURCES = console/console.c console/m340uart.c \
|
||||
../../shared/dummy_printk_support.c
|
||||
console_SOURCES = console/Modif_cpu_asm.S console/console.c \
|
||||
console/m340uart.c ../../shared/dummy_printk_support.c
|
||||
timer_SOURCES = timer/timer.c
|
||||
|
||||
noinst_LIBRARIES = libbsp.a
|
||||
|
||||
178
c/src/lib/libbsp/m68k/gen68340/console/Modif_cpu_asm.S
Normal file
178
c/src/lib/libbsp/m68k/gen68340/console/Modif_cpu_asm.S
Normal file
@@ -0,0 +1,178 @@
|
||||
/* cpu_asm.s
|
||||
*
|
||||
* This file contains all assembly code for the MC68020 implementation
|
||||
* of RTEMS.
|
||||
*
|
||||
* ATTENTION: Modified for benchmarks
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems/asm.h>
|
||||
|
||||
.text
|
||||
|
||||
/*PAGE
|
||||
* void _Debug_ISR_Handler_Console()
|
||||
*
|
||||
* This routine provides the RTEMS interrupt management.
|
||||
*
|
||||
* NOTE:
|
||||
* Upon entry, the master stack will contain an interrupt stack frame
|
||||
* back to the interrupted thread and the interrupt stack will contain
|
||||
* a throwaway interrupt stack frame. If dispatching is enabled, this
|
||||
* is the outer most interrupt, and (a context switch is necessary or
|
||||
* the current thread has signals), then set up the master stack to
|
||||
* transfer control to the interrupt dispatcher.
|
||||
* NOTE:
|
||||
* USED TO MESURE THE TIME SPENT IN THE INTERRUPT SUBROUTINE
|
||||
* CS5 - CS8 are linked to an oscilloscope so that you can mesure
|
||||
* RTEMS overhead (BTW it's very short :) )
|
||||
*/
|
||||
|
||||
/*
|
||||
* With this approach, lower priority interrupts may
|
||||
* execute twice if a higher priority interrupt is
|
||||
* acknowledged before _Thread_Dispatch_disable is
|
||||
* increamented and the higher priority interrupt
|
||||
* preforms a context switch after executing. The lower
|
||||
* priority intterrupt will execute (1) at the end of the
|
||||
* higher priority interrupt in the new context if
|
||||
* permitted by the new interrupt level mask, and (2) when
|
||||
* the original context regains the cpu.
|
||||
*/
|
||||
|
||||
#if ( M68K_HAS_VBR == 1)
|
||||
.set SR_OFFSET, 0 | Status register offset
|
||||
.set PC_OFFSET, 2 | Program Counter offset
|
||||
.set FVO_OFFSET, 6 | Format/vector offset
|
||||
#else
|
||||
.set SR_OFFSET, 2 | Status register offset
|
||||
.set PC_OFFSET, 4 | Program Counter offset
|
||||
.set FVO_OFFSET, 0 | Format/vector offset placed in the stack
|
||||
#endif /* M68K_HAS_VBR */
|
||||
|
||||
.set SAVED, 16 | space for saved registers
|
||||
|
||||
.align 4
|
||||
.global SYM (_Debug_ISR_Handler_Console)
|
||||
|
||||
SYM (_Debug_ISR_Handler_Console):
|
||||
|
||||
|
|
||||
tst.w 0x14000000 | ALLUME CS5
|
||||
|
|
||||
|
||||
addql #1,SYM (_Thread_Dispatch_disable_level) | disable multitasking
|
||||
moveml d0-d1/a0-a1,a7@- | save d0-d1,a0-a1
|
||||
movew a7@(SAVED+FVO_OFFSET),d0 | d0 = F/VO
|
||||
andl #0x0fff,d0 | d0 = vector offset in vbr
|
||||
|
||||
#if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == 1 )
|
||||
movew sr,d1 | Save status register
|
||||
oriw #0x700,sr | Disable interrupts
|
||||
tstl SYM (_ISR_Nest_level) | Interrupting an interrupt handler?
|
||||
bne 1f | Yes, just skip over stack switch code
|
||||
movel SYM(_CPU_Interrupt_stack_high),a0 | End of interrupt stack
|
||||
movel a7,a0@- | Save task stack pointer
|
||||
movel a0,a7 | Switch to interrupt stack
|
||||
1:
|
||||
addql #1,SYM(_ISR_Nest_level) | one nest level deeper
|
||||
movew d1,sr | Restore status register
|
||||
#else
|
||||
addql #1,SYM (_ISR_Nest_level) | one nest level deeper
|
||||
#endif /* CPU_HAS_SOFTWARE_INTERRUPT_STACK == 1 */
|
||||
|
||||
#if ( M68K_HAS_PREINDEXING == 1 )
|
||||
movel @( SYM (_ISR_Vector_table),d0:w:1),a0| fetch the ISR
|
||||
#else
|
||||
movel # SYM (_ISR_Vector_table),a0 | a0 = base of RTEMS table
|
||||
addal d0,a0 | a0 = address of vector
|
||||
movel (a0),a0 | a0 = address of user routine
|
||||
#endif
|
||||
|
||||
lsrl #2,d0 | d0 = vector number
|
||||
movel d0,a7@- | push vector number
|
||||
|
||||
|
|
||||
tst.w 0x18000000 | ALLUME CS6
|
||||
|
|
||||
|
||||
jbsr a0@ | invoke the user ISR
|
||||
|
||||
|
|
||||
tst.w 0x18000000 | ALLUME CS6
|
||||
|
|
||||
|
||||
addql #4,a7 | remove vector number
|
||||
|
||||
#if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == 1 )
|
||||
movew sr,d0 | Save status register
|
||||
oriw #0x700,sr | Disable interrupts
|
||||
subql #1,SYM(_ISR_Nest_level) | Reduce interrupt-nesting count
|
||||
bne 1f | Skip if return to interrupt
|
||||
movel (a7),a7 | Restore task stack pointer
|
||||
1:
|
||||
movew d0,sr | Restore status register
|
||||
#else
|
||||
subql #1,SYM (_ISR_Nest_level) | one less nest level
|
||||
#endif /* CPU_HAS_SOFTWARE_INTERRUPT_STACK == 1 */
|
||||
|
||||
subql #1,SYM (_Thread_Dispatch_disable_level)
|
||||
| unnest multitasking
|
||||
bne Debug_exit | If dispatch disabled, Debug_exit
|
||||
|
||||
#if ( M68K_HAS_SEPARATE_STACKS == 1 )
|
||||
movew #0xf000,d0 | isolate format nibble
|
||||
andw a7@(SAVED+FVO_OFFSET),d0 | get F/VO
|
||||
cmpiw #0x1000,d0 | is it a throwaway isf?
|
||||
bne Debug_exit | NOT outer level, so branch
|
||||
#endif
|
||||
|
||||
tstl SYM (_Context_Switch_necessary)
|
||||
| Is thread switch necessary?
|
||||
bne bframe | Yes, invoke dispatcher
|
||||
|
||||
tstl SYM (_ISR_Signals_to_thread_executing)
|
||||
| signals sent to Run_thread
|
||||
| while in interrupt handler?
|
||||
beq Debug_exit | No, then Debug_exit
|
||||
|
||||
bframe: clrl SYM (_ISR_Signals_to_thread_executing)
|
||||
| If sent, will be processed
|
||||
#if ( M68K_HAS_SEPARATE_STACKS == 1 )
|
||||
movec msp,a0 | a0 = master stack pointer
|
||||
movew #0,a0@- | push format word
|
||||
movel # SYM (_ISR_Dispatch),a0@- | push return addr
|
||||
| filter out the trace bit to stop single step debugging breaking
|
||||
movew a0@(6+SR_OFFSET),d0
|
||||
andw #0x7FFF,d0
|
||||
movew d0,a0@- | push thread sr
|
||||
movec a0,msp | set master stack pointer
|
||||
#else
|
||||
|
||||
| filter out the trace bit to stop single step debugging breaking
|
||||
movew a7@(16+SR_OFFSET),d0
|
||||
andw #0x7FFF,d0
|
||||
movew d0,sr
|
||||
jsr SYM (_Thread_Dispatch)
|
||||
#endif
|
||||
|
||||
Debug_exit: moveml a7@+,d0-d1/a0-a1 | restore d0-d1,a0-a1
|
||||
#if ( M68K_HAS_VBR == 0 )
|
||||
addql #2,a7 | pop format/id
|
||||
#endif /* M68K_HAS_VBR */
|
||||
|
||||
|
|
||||
tst.w 0x1C000000 | ALLUME CS7
|
||||
|
|
||||
|
||||
rte | return to thread
|
||||
| OR _Isr_dispatch
|
||||
@@ -1,14 +1,3 @@
|
||||
2009-02-17 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
PR 1371/bsps
|
||||
* network/network.c: mvme167 network driver buggy.
|
||||
|
||||
2009-02-17 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
PR 1370/bsps
|
||||
* console/console.c: mvme167 console driver BSP_output_char fails to
|
||||
convert \n -> \n\r
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -161,15 +161,6 @@ int _167Bug_pollWrite( int minor, const char *buf, int len );
|
||||
static void _BSP_output_char( char c );
|
||||
BSP_output_char_function_type BSP_output_char = _BSP_output_char;
|
||||
|
||||
/* '\r' character in memory. This used to live on
|
||||
* the stack but storing the '\r' character is
|
||||
* optimized away by gcc-4.3.2 (since it seems to
|
||||
* be unused [only referenced from inline assembly
|
||||
* code in _167Bug_pollWrite()]).
|
||||
* Hence we make it a global constant.
|
||||
*/
|
||||
static const char cr_char = '\r';
|
||||
|
||||
/* Channel info */
|
||||
/* static */ volatile struct {
|
||||
void *tty; /* Really a struct rtems_termios_tty * */
|
||||
@@ -1375,11 +1366,12 @@ rtems_status_code do_poll_write(
|
||||
{
|
||||
rtems_libio_rw_args_t *rw_args = arg;
|
||||
uint32_t i;
|
||||
char cr ='\r';
|
||||
|
||||
for( i = 0; i < rw_args->count; i++ ) {
|
||||
_167Bug_pollWrite(minor, &(rw_args->buffer[i]), 1);
|
||||
if ( rw_args->buffer[i] == '\n' )
|
||||
_167Bug_pollWrite(minor, &cr_char, 1);
|
||||
_167Bug_pollWrite(minor, &cr, 1);
|
||||
}
|
||||
rw_args->bytes_moved = i;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
@@ -1393,6 +1385,7 @@ rtems_status_code do_poll_write(
|
||||
void _BSP_output_char(char c)
|
||||
{
|
||||
rtems_device_minor_number printk_minor;
|
||||
char cr ='\r';
|
||||
|
||||
/*
|
||||
* Can't rely on console_initialize having been called before this function
|
||||
@@ -1406,7 +1399,7 @@ void _BSP_output_char(char c)
|
||||
|
||||
_167Bug_pollWrite(printk_minor, &c, 1);
|
||||
if ( c == '\n' )
|
||||
_167Bug_pollWrite(printk_minor, &cr_char, 1);
|
||||
_167Bug_pollWrite(printk_minor, &cr, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
#define DBG_PACKETS
|
||||
*/
|
||||
|
||||
#define IGNORE_SPURIOUS_IRQ
|
||||
#define IGNORE_NO_RFA
|
||||
#define IGNORE_MULTIPLE_RF
|
||||
|
||||
/*
|
||||
* Default number of buffer descriptors and buffer sizes.
|
||||
*/
|
||||
@@ -73,8 +69,8 @@
|
||||
#include "uti596.h"
|
||||
|
||||
/* If we are running interrupt driven I/O no debug output is printed */
|
||||
#if CD2401_IO_MODE == 0
|
||||
#define printk(arglist) do { printk arglist; printk("\r"); } while (0);
|
||||
#if CD2401_POLLED_IO == 1
|
||||
#define printk(arglist) printk arglist;
|
||||
#else
|
||||
#define printk(arglist)
|
||||
#endif
|
||||
@@ -910,7 +906,7 @@ static int uti596_initRFA( int num )
|
||||
} /* end for */
|
||||
|
||||
uti596_softc.pEndRFA->next = I596_NULL;
|
||||
UTI_596_ASSERT(uti596_softc.countRFD == num,"INIT:WRONG RFD COUNT\n" )
|
||||
UTI_596_ASSERT(uti596_softc.countRFD == RX_BUF_COUNT,"INIT:WRONG RFD COUNT\n" )
|
||||
|
||||
#ifdef DBG_INIT
|
||||
printk (("uti596_initRFA: Head of RFA is buffer %p \n\
|
||||
@@ -1033,7 +1029,7 @@ void uti596_initialize(
|
||||
/* write the SYSBUS: interrupt pin active high, LOCK disabled,
|
||||
* internal triggering, linear mode
|
||||
*/
|
||||
sc->pScp->sysbus = 0x44;
|
||||
sc->pScp->sysbus = 0x54;
|
||||
|
||||
/* provide the iscp to the scp, keep a pointer for our use */
|
||||
sc->pScp->iscp_pointer = word_swap((unsigned long)&sc->iscp);
|
||||
@@ -1223,7 +1219,7 @@ void uti596_reset( void )
|
||||
sc-> pLastUnkRFD = I596_NULL;
|
||||
}
|
||||
|
||||
sc->pEndRFA->next = (i596_rfd*)word_swap((uint32_t)sc->pSavedRfdQueue);
|
||||
sc->pEndRFA->next = sc->pSavedRfdQueue;
|
||||
if ( sc->pSavedRfdQueue != I596_NULL ) {
|
||||
sc->pEndRFA = sc->pEndSavedQueue;
|
||||
sc->pSavedRfdQueue = sc->pEndSavedQueue = I596_NULL;
|
||||
@@ -1850,12 +1846,6 @@ void uti596_init(
|
||||
printk(("uti596_init: After attach, status of board = 0x%x\n", sc->scb.status ))
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* In case the ISR discovers there are no resources it reclaims
|
||||
* them and restarts
|
||||
*/
|
||||
sc->started = 1;
|
||||
|
||||
/*
|
||||
* Enable receiver
|
||||
@@ -2142,15 +2132,13 @@ void uti596_resetDaemon(
|
||||
rtems_vector_number irq
|
||||
)
|
||||
{
|
||||
int fullStatus;
|
||||
|
||||
#ifdef DBG_ISR
|
||||
printk(("uti596_DynamicInterruptHandler: begins"))
|
||||
#endif
|
||||
|
||||
uti596_wait (&uti596_softc, UTI596_WAIT_FOR_CU_ACCEPT);
|
||||
|
||||
scbStatus = (fullStatus = uti596_softc.scb.status) & 0xf000;
|
||||
scbStatus = uti596_softc.scb.status & 0xf000;
|
||||
|
||||
if ( scbStatus ) {
|
||||
/* acknowledge interrupts */
|
||||
@@ -2178,10 +2166,8 @@ int fullStatus;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifndef IGNORE_SPURIOUS_IRQ
|
||||
printk(("\n***ERROR: Spurious interrupt (full status 0x%x). Resetting...\n", fullStatus))
|
||||
printk(("\n***ERROR: Spurious interrupt. Resetting...\n"))
|
||||
uti596_softc.nic_reset = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( (scbStatus & SCB_STAT_CX) && !(scbStatus & SCB_STAT_CNA) ) {
|
||||
@@ -2231,10 +2217,8 @@ int fullStatus;
|
||||
#endif
|
||||
if ( uti596_softc.pBeginRFA == I596_NULL ||
|
||||
!( uti596_softc.pBeginRFA -> stat & STAT_C)) {
|
||||
#ifndef IGNORE_NO_RFA
|
||||
uti596_dump_scb();
|
||||
uti596_softc.nic_reset = 1;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
while ( uti596_softc.pBeginRFA != I596_NULL &&
|
||||
@@ -2244,11 +2228,9 @@ int fullStatus;
|
||||
printk(("uti596_DynamicInterruptHandler: pBeginRFA != NULL\n"))
|
||||
#endif
|
||||
count_rx ++;
|
||||
#ifndef IGNORE_MULTIPLE_RF
|
||||
if ( count_rx > 1) {
|
||||
printk(("****WARNING: Received %i frames on 1 interrupt \n", count_rx))
|
||||
}
|
||||
#endif
|
||||
printk(("****WARNING: Received 2 frames on 1 interrupt \n"))
|
||||
}
|
||||
/* Give Received Frame to the ULCS */
|
||||
uti596_softc.countRFD--;
|
||||
|
||||
@@ -2729,7 +2711,7 @@ static void dumpQ( void )
|
||||
|
||||
for( pRfd = uti596_softc.pSavedRfdQueue;
|
||||
pRfd != I596_NULL;
|
||||
pRfd = (i596_rfd*)word_swap((uint32_t)pRfd -> next)) {
|
||||
pRfd = pRfd -> next) {
|
||||
printk(("pRfd: %p, stat: 0x%x cmd: 0x%x\n",pRfd,pRfd -> stat,pRfd -> cmd))
|
||||
}
|
||||
|
||||
@@ -2737,7 +2719,7 @@ static void dumpQ( void )
|
||||
|
||||
for( pRfd = uti596_softc.pInboundFrameQueue;
|
||||
pRfd != I596_NULL;
|
||||
pRfd = (i596_rfd*)word_swap((uint32_t)pRfd -> next)) {
|
||||
pRfd = pRfd -> next) {
|
||||
printk(("pRfd: %p, stat: 0x%x cmd: 0x%x\n",pRfd,pRfd -> stat,pRfd -> cmd))
|
||||
}
|
||||
|
||||
@@ -2746,7 +2728,7 @@ static void dumpQ( void )
|
||||
|
||||
for( pRfd = uti596_softc.pBeginRFA;
|
||||
pRfd != I596_NULL;
|
||||
pRfd = (i596_rfd*)word_swap((uint32_t)pRfd -> next)) {
|
||||
pRfd = pRfd -> next) {
|
||||
printk(("pRfd: %p, stat: 0x%x cmd: 0x%x\n",pRfd,pRfd -> stat,pRfd -> cmd))
|
||||
}
|
||||
}
|
||||
@@ -2769,7 +2751,7 @@ static void show_buffers (void)
|
||||
|
||||
for ( pRfd = uti596_softc.pBeginRFA;
|
||||
pRfd != I596_NULL;
|
||||
pRfd = (i596_rfd *)word_swap((uint32_t)pRfd->next) ) {
|
||||
pRfd = pRfd->next) {
|
||||
printk(("Frame @ %p, status: %2.2x, cmd: %2.2x\n",
|
||||
pRfd, pRfd->stat, pRfd->cmd))
|
||||
}
|
||||
@@ -2777,7 +2759,7 @@ static void show_buffers (void)
|
||||
|
||||
for ( pRfd = uti596_softc.pInboundFrameQueue;
|
||||
pRfd != I596_NULL;
|
||||
pRfd = (i596_rfd *)word_swap((uint32_t)pRfd->next) ) {
|
||||
pRfd = pRfd->next) {
|
||||
printk(("Frame @ %p, status: %2.2x, cmd: %2.2x\n",
|
||||
pRfd, pRfd->stat, pRfd->cmd))
|
||||
}
|
||||
@@ -2786,7 +2768,7 @@ static void show_buffers (void)
|
||||
|
||||
for ( pRfd = uti596_softc.pSavedRfdQueue;
|
||||
pRfd != I596_NULL;
|
||||
pRfd = (i596_rfd *)word_swap((uint32_t)pRfd->next) ) {
|
||||
pRfd = pRfd->next) {
|
||||
printk(("Frame @ %p, status: %2.2x, cmd: %2.2x\n",
|
||||
pRfd, pRfd->stat, pRfd->cmd))
|
||||
}
|
||||
@@ -2811,7 +2793,7 @@ static void show_queues(void)
|
||||
for ( pRfd = uti596_softc.pSavedRfdQueue;
|
||||
pRfd != I596_NULL &&
|
||||
pRfd != NULL;
|
||||
pRfd = (i596_rfd *)word_swap((uint32_t)pRfd->next) ) {
|
||||
pRfd = pRfd->next) {
|
||||
printk(("0x%p\n", pRfd))
|
||||
}
|
||||
|
||||
@@ -2822,7 +2804,7 @@ static void show_queues(void)
|
||||
for ( pRfd = uti596_softc.pBeginRFA;
|
||||
pRfd != I596_NULL &&
|
||||
pRfd != NULL;
|
||||
pRfd = (i596_rfd *)word_swap((uint32_t)pRfd->next) ) {
|
||||
pRfd = pRfd->next) {
|
||||
printk(("0x%p\n", pRfd))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +1,3 @@
|
||||
2009-09-09 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* startup/bspstart.c: Added dummy implementation of firmware
|
||||
syscalls for use with QEMU. Dummy handler is installed if no
|
||||
pre-existing firmware handler is found.
|
||||
|
||||
2009-07-30 Eric Norum <norume@aps.anl.gov>
|
||||
|
||||
* include/bsp.h, network/network.c, startup/bspstart.c: Try enabling
|
||||
the data cache.
|
||||
|
||||
2009-07-28 Eric Norum <norume@aps.anl.gov>
|
||||
|
||||
PR 1420/bsps
|
||||
* startup/bspstart.c: Turn on buffered writes to DRAM. As Device Errata
|
||||
SECF124 notes this may cause double writes, but that's not really a big
|
||||
problem and benchmarking tests have shown that buffered writes do gain
|
||||
some performance.
|
||||
|
||||
2009-06-02 Eric Norum <norume@aps.anl.gov>
|
||||
|
||||
PR 1420/bsps
|
||||
* startup/bspstart.c: Turn off buffered writes.
|
||||
|
||||
2009-03-02 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
PR 1375/bsps
|
||||
* clock/clock.c: Correct implementation of nanoseconds since last tick
|
||||
handler.
|
||||
|
||||
2009-01-21 Eric Norum <norume@aps.anl.gov>
|
||||
|
||||
PR 1358/bsps
|
||||
* clock/clock.c: Fix time-access bug in uc5282 BSP.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -30,15 +30,15 @@ extern int __SRAMBASE[];
|
||||
#define IDLE_COUNTER __SRAMBASE[0]
|
||||
#define FILTERED_IDLE __SRAMBASE[1]
|
||||
#define MAX_IDLE_COUNT __SRAMBASE[2]
|
||||
#define USEC_PER_TICK __SRAMBASE[3]
|
||||
#define PCNTR_AT_TICK (*(uint16 *)&__SRAMBASE[3])
|
||||
#define FILTER_SHIFT 6
|
||||
|
||||
uint32_t bsp_clock_nanoseconds_since_last_tick(void)
|
||||
{
|
||||
int i = MCF5282_PIT3_PCNTR;
|
||||
if (MCF5282_PIT3_PCSR & MCF5282_PIT_PCSR_PIF)
|
||||
i = MCF5282_PIT3_PCNTR - USEC_PER_TICK;
|
||||
return (USEC_PER_TICK - i) * 1000;
|
||||
i = MCF5282_PIT3_PCNTR + MCF5282_PIT3_PMR;
|
||||
return (i - PCNTR_AT_TICK) * 1000;
|
||||
}
|
||||
|
||||
#define Clock_driver_nanoseconds_since_last_tick bsp_clock_nanoseconds_since_last_tick
|
||||
@@ -53,6 +53,7 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(void)
|
||||
if (idle > MAX_IDLE_COUNT) \
|
||||
MAX_IDLE_COUNT = idle; \
|
||||
FILTERED_IDLE = idle + FILTERED_IDLE - (FILTERED_IDLE>>FILTER_SHIFT);\
|
||||
PCNTR_AT_TICK = MCF5282_PIT3_PCNTR; \
|
||||
MCF5282_PIT3_PCSR |= MCF5282_PIT_PCSR_PIF; \
|
||||
} while (0)
|
||||
|
||||
@@ -101,12 +102,12 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(void)
|
||||
MCF5282_PIT_PCSR_OVW | \
|
||||
MCF5282_PIT_PCSR_PIE | \
|
||||
MCF5282_PIT_PCSR_RLD; \
|
||||
USEC_PER_TICK = rtems_configuration_get_microseconds_per_tick(); \
|
||||
MCF5282_PIT3_PMR = USEC_PER_TICK - 1; \
|
||||
MCF5282_PIT3_PMR = rtems_configuration_get_microseconds_per_tick() - 1; \
|
||||
MCF5282_PIT3_PCSR = MCF5282_PIT_PCSR_PRE(preScaleCode) | \
|
||||
MCF5282_PIT_PCSR_PIE | \
|
||||
MCF5282_PIT_PCSR_RLD | \
|
||||
MCF5282_PIT_PCSR_EN; \
|
||||
PCNTR_AT_TICK = MCF5282_PIT3_PCNTR; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
* Uncomment to use instruction/data cache
|
||||
* Leave commented to use instruction-only cache
|
||||
*/
|
||||
#define RTEMS_MCF5282_BSP_ENABLE_DATA_CACHE
|
||||
/* #define RTEMS_MCF5282_BSP_ENABLE_DATA_CACHE */
|
||||
|
||||
/***************************************************************************/
|
||||
/** Hardware data structure headers **/
|
||||
|
||||
@@ -492,9 +492,13 @@ fec_rxDaemon (void *arg)
|
||||
#ifdef RTEMS_MCF5282_BSP_ENABLE_DATA_CACHE
|
||||
/*
|
||||
* Invalidate the cache. The cache is so small that it's
|
||||
* reasonable to simply invalidate the whole thing.
|
||||
* more efficient to just invalidate the whole thing unless
|
||||
* the packet is very small.
|
||||
*/
|
||||
rtems_cache_invalidate_entire_data();
|
||||
if (len < 128)
|
||||
rtems_cache_invalidate_multiple_data_lines(m->m_data, len);
|
||||
else
|
||||
rtems_cache_invalidate_entire_data();
|
||||
#endif
|
||||
m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header);
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
@@ -57,20 +57,6 @@
|
||||
* should be followed immediately by a NOP instruction. This avoids the cache
|
||||
* corruption problem.
|
||||
* DATECODES AFFECTED: All
|
||||
*
|
||||
*
|
||||
* Buffered writes must be disabled as described in "MCF5282 Chip Errata",
|
||||
* MCF5282DE, Rev. 6, 5/2009:
|
||||
* SECF124: Buffered Write May Be Executed Twice
|
||||
* Errata type: Silicon
|
||||
* Affected component: Cache
|
||||
* Description: If buffered writes are enabled using the CACR or ACR
|
||||
* registers, the imprecise write transaction generated
|
||||
* by a buffered write may be executed twice.
|
||||
* Workaround: Do not enable buffered writes in the CACR or ACR registers:
|
||||
* CACR[8] = DBWE (default buffered write enable) must be 0
|
||||
* ACRn[5] = BUFW (buffered write enable) must be 0
|
||||
* Fix plan: Currently, there are no plans to fix this.
|
||||
*/
|
||||
#define m68k_set_cacr_nop(_cacr) asm volatile ("movec %0,%%cacr\n\tnop" : : "d" (_cacr))
|
||||
#define m68k_set_cacr(_cacr) asm volatile ("movec %0,%%cacr" : : "d" (_cacr))
|
||||
@@ -81,7 +67,7 @@
|
||||
* Read/write copy of cache registers
|
||||
* Split instruction/data or instruction-only
|
||||
* Allow CPUSHL to invalidate a cache line
|
||||
* Disable buffered writes
|
||||
* Enable buffered writes
|
||||
* No burst transfers on non-cacheable accesses
|
||||
* Default cache mode is *disabled* (cache only ACRx areas)
|
||||
*/
|
||||
@@ -89,6 +75,7 @@ uint32_t mcf5282_cacr_mode = MCF5XXX_CACR_CENB |
|
||||
#ifndef RTEMS_MCF5282_BSP_ENABLE_DATA_CACHE
|
||||
MCF5XXX_CACR_DISD |
|
||||
#endif
|
||||
MCF5XXX_CACR_DBWE |
|
||||
MCF5XXX_CACR_DCM;
|
||||
uint32_t mcf5282_acr0_mode = 0;
|
||||
uint32_t mcf5282_acr1_mode = 0;
|
||||
@@ -112,7 +99,7 @@ void _CPU_cache_enable_instruction(void)
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
mcf5282_cacr_mode &= ~MCF5XXX_CACR_DIDI;
|
||||
m68k_set_cacr_nop(mcf5282_cacr_mode | MCF5XXX_CACR_CINV | MCF5XXX_CACR_INVI);
|
||||
m68k_set_cacr(mcf5282_cacr_mode);
|
||||
rtems_interrupt_enable(level);
|
||||
}
|
||||
|
||||
@@ -146,8 +133,8 @@ void _CPU_cache_enable_data(void)
|
||||
rtems_interrupt_level level;
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
mcf5282_cacr_mode &= ~MCF5XXX_CACR_DISD;
|
||||
m68k_set_cacr_nop(mcf5282_cacr_mode | MCF5XXX_CACR_CINV | MCF5XXX_CACR_INVD);
|
||||
mcf5282_cacr_mode &= ~MCF5XXX_CACR_CENB;
|
||||
m68k_set_cacr(mcf5282_cacr_mode);
|
||||
rtems_interrupt_enable(level);
|
||||
#endif
|
||||
}
|
||||
@@ -158,7 +145,8 @@ void _CPU_cache_disable_data(void)
|
||||
rtems_interrupt_level level;
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
mcf5282_cacr_mode |= MCF5XXX_CACR_DISD;
|
||||
rtems_interrupt_disable(level);
|
||||
mcf5282_cacr_mode |= MCF5XXX_CACR_CENB;
|
||||
m68k_set_cacr(mcf5282_cacr_mode);
|
||||
rtems_interrupt_enable(level);
|
||||
#endif
|
||||
@@ -188,8 +176,6 @@ void _CPU_cache_invalidate_1_data_line(const void *addr)
|
||||
void bsp_libc_init( void *, uint32_t, int );
|
||||
void bsp_pretasking_hook(void); /* m68k version */
|
||||
|
||||
extern void bsp_fake_syscall();
|
||||
|
||||
/*
|
||||
* The Arcturus boot ROM prints exception information improperly
|
||||
* so use this default exception handler instead. This one also
|
||||
@@ -262,13 +248,6 @@ void bsp_start( void )
|
||||
if (i != (32+2)) /* Catch all but bootrom system calls */
|
||||
*((void (**)(int))(i * 4)) = handler;
|
||||
|
||||
/*
|
||||
* Qemu has no trap handler; install our fake syscall
|
||||
* implementation if there is no existing handler.
|
||||
*/
|
||||
if ( 0 == *((void (**)(int))((32+2) * 4)) )
|
||||
*((void (**)(int))((32+2) * 4)) = bsp_fake_syscall;
|
||||
|
||||
/*
|
||||
* Need to "allocate" the memory for the RTEMS Workspace and
|
||||
* tell the RTEMS configuration where it is. This memory is
|
||||
@@ -286,16 +265,12 @@ void bsp_start( void )
|
||||
|
||||
/*
|
||||
* Cache SDRAM
|
||||
* Enable buffered writes
|
||||
* As Device Errata SECF124 notes this may cause double writes,
|
||||
* but that's not really a big problem and benchmarking tests have
|
||||
* shown that buffered writes do gain some performance.
|
||||
*/
|
||||
mcf5282_acr0_mode = MCF5XXX_ACR_AB((uint32_t)_RamBase) |
|
||||
MCF5XXX_ACR_AM((uint32_t)_RamSize-1) |
|
||||
MCF5XXX_ACR_EN |
|
||||
MCF5XXX_ACR_SM_IGNORE |
|
||||
MCF5XXX_ACR_BWE;
|
||||
MCF5XXX_ACR_BWE |
|
||||
MCF5XXX_ACR_SM_IGNORE;
|
||||
m68k_set_acr0(mcf5282_acr0_mode);
|
||||
|
||||
/*
|
||||
@@ -428,37 +403,6 @@ syscall_2(int, program, bsp_mnode_t *, chain, int, flags)
|
||||
syscall_3(int, flash_erase_range, volatile unsigned short *, flashptr, int, start, int, end);
|
||||
syscall_3(int, flash_write_range, volatile unsigned short *, flashptr, bsp_mnode_t *, chain, int, offset);
|
||||
|
||||
/* Provide a dummy-implementation of these syscalls
|
||||
* for qemu (which lacks the firmware).
|
||||
*/
|
||||
|
||||
#define __STR(x) #x
|
||||
#define __STRSTR(x) __STR(x)
|
||||
#define ERRVAL __STRSTR(EACCES)
|
||||
|
||||
/* reset-control register */
|
||||
#define RCR "__IPSBAR + 0x110000"
|
||||
|
||||
asm(
|
||||
"bsp_fake_syscall: \n"
|
||||
" cmpl #0, %d0 \n" /* sysreset */
|
||||
" bne 1f \n"
|
||||
" moveb #0x80, %d0 \n"
|
||||
" moveb %d0, "RCR" \n" /* reset-controller */
|
||||
/* should never get here - but we'd return -EACCESS if we do */
|
||||
"1: \n"
|
||||
" cmpl #12, %d0 \n" /* gethwaddr */
|
||||
" beq 2f \n"
|
||||
" cmpl #14, %d0 \n" /* getbenv */
|
||||
" beq 2f \n"
|
||||
" movel #-"ERRVAL", %d0 \n" /* return -EACCESS */
|
||||
" rte \n"
|
||||
"2: \n"
|
||||
" movel #0, %d0 \n" /* return NULL */
|
||||
" rte \n"
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* 'Extended BSP' routines
|
||||
* Should move to cpukit/score/cpu/m68k/cpu.c someday.
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* startup/exception.S: When the type rtems_boolean was switched to the
|
||||
C99 bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -97,8 +97,8 @@ name:; \
|
||||
|
||||
EXTERN(_ISR_Nest_level, 4)
|
||||
EXTERN(_Thread_Dispatch_disable_level,4)
|
||||
EXTERN(_Context_Switch_necessary,1)
|
||||
EXTERN(_ISR_Signals_to_thread_executing,1)
|
||||
EXTERN(_Context_Switch_necessary,4)
|
||||
EXTERN(_ISR_Signals_to_thread_executing,4)
|
||||
.extern _Thread_Dispatch
|
||||
.extern _ISR_Vector_table
|
||||
|
||||
@@ -281,10 +281,10 @@ _ISR_Handler_cleanup:
|
||||
* if ( !_Context_Switch_necessary && !_ISR_Signals_to_thread_executing )
|
||||
* goto the label "exit interrupt (simple case)"
|
||||
*/
|
||||
lb t0,_Context_Switch_necessary
|
||||
lb t1,_ISR_Signals_to_thread_executing
|
||||
lw t0,_Context_Switch_necessary
|
||||
lw t1,_ISR_Signals_to_thread_executing
|
||||
NOP
|
||||
or t0,t0,t1
|
||||
or t0,t0,t1
|
||||
beq t0,zero,_ISR_Handler_exit
|
||||
NOP
|
||||
|
||||
@@ -416,7 +416,6 @@ USC_isr:
|
||||
sll k0,(31-21) /* test bit 21 (HBI) */
|
||||
|
||||
bgez k0,USC_isr2 /* branch if not a heartbeat interrupt */
|
||||
NOP
|
||||
|
||||
/* clear the heartbeat interrupt */
|
||||
la k0,INT_STAT
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* startup/exception.S: When the type rtems_boolean was switched to the
|
||||
C99 bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -96,8 +96,8 @@ name:; \
|
||||
|
||||
EXTERN(_ISR_Nest_level, 4)
|
||||
EXTERN(_Thread_Dispatch_disable_level,4)
|
||||
EXTERN(_Context_Switch_necessary,1)
|
||||
EXTERN(_ISR_Signals_to_thread_executing,1)
|
||||
EXTERN(_Context_Switch_necessary,4)
|
||||
EXTERN(_ISR_Signals_to_thread_executing,4)
|
||||
.extern _Thread_Dispatch
|
||||
.extern _ISR_Vector_table
|
||||
|
||||
@@ -321,10 +321,10 @@ _ISR_Handler_cleanup:
|
||||
* if ( !_Context_Switch_necessary && !_ISR_Signals_to_thread_executing )
|
||||
* goto the label "exit interrupt (simple case)"
|
||||
*/
|
||||
lb t0,_Context_Switch_necessary
|
||||
lb t1,_ISR_Signals_to_thread_executing
|
||||
lw t0,_Context_Switch_necessary
|
||||
lw t1,_ISR_Signals_to_thread_executing
|
||||
NOP
|
||||
or t0,t0,t1
|
||||
or t0,t0,t1
|
||||
beq t0,zero,_ISR_Handler_exit
|
||||
NOP
|
||||
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* startup/exception.S: When the type rtems_boolean was switched to the
|
||||
C99 bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -96,8 +96,8 @@ name:; \
|
||||
|
||||
EXTERN(_ISR_Nest_level, 4)
|
||||
EXTERN(_Thread_Dispatch_disable_level,4)
|
||||
EXTERN(_Context_Switch_necessary,1)
|
||||
EXTERN(_ISR_Signals_to_thread_executing,1)
|
||||
EXTERN(_Context_Switch_necessary,4)
|
||||
EXTERN(_ISR_Signals_to_thread_executing,4)
|
||||
.extern _Thread_Dispatch
|
||||
.extern _ISR_Vector_table
|
||||
|
||||
@@ -321,10 +321,10 @@ _ISR_Handler_cleanup:
|
||||
* if ( !_Context_Switch_necessary && !_ISR_Signals_to_thread_executing )
|
||||
* goto the label "exit interrupt (simple case)"
|
||||
*/
|
||||
lb t0,_Context_Switch_necessary
|
||||
lb t1,_ISR_Signals_to_thread_executing
|
||||
lw t0,_Context_Switch_necessary
|
||||
lw t1,_ISR_Signals_to_thread_executing
|
||||
NOP
|
||||
or t0,t0,t1
|
||||
or t0,t0,t1
|
||||
beq t0,zero,_ISR_Handler_exit
|
||||
NOP
|
||||
|
||||
|
||||
@@ -1,30 +1,3 @@
|
||||
2010-02-01 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
PR 1492/bsps
|
||||
* shared/startup/sbrk.c: When BSP_sbrk_policy had the value (-1)
|
||||
(-> give all memory to the heap initially) then the computation
|
||||
of the remaining heap size was wrong.
|
||||
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* shared/irq/irq_asm.S: When the type rtems_boolean was switched to the
|
||||
C99 bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2009-03-05 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* shared/clock/clock.c: Standard decrementer exception is now more
|
||||
robust against erroneous external exception disable times.
|
||||
|
||||
2009-02-11 Matt Rippa <mrippa@gemini.edu>
|
||||
|
||||
PR 1352/bsps
|
||||
* shared/console/reboot.c, shared/motorola/motorola.c: Include support
|
||||
for mvme2600/mvme2700.
|
||||
|
||||
2008-11-03 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
PR 1332: call BSP_uart_termios_set()/BSP_uart_intr_ctrl()
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
2009-10-16 Jennifer Averett <jennifer@OARcorp.com>
|
||||
|
||||
* Makefile.am, configure.ac, preinstall.am, console/alloc360.c,
|
||||
console/config.c, console/console.c, console/m68360.h,
|
||||
console/mc68360_scc.c, console/rsPMCQ1.c, console/rsPMCQ1.h,
|
||||
include/bsp.h, irq/irq_init.c, irq/openpic_xxx_irq.c, start/start.S,
|
||||
startup/bspstart.c, startup/linkcmds, vme/VMEConfig.h:
|
||||
Updated and tested against RTEMS 4.9. Updated README file to latest
|
||||
source status. Modified to use the shared irq source code. Turned off
|
||||
debugging, cleaned up warnings, removed unused code. Tested with two
|
||||
PMCQ1 serial cards. Tested MC68360 serial ports and VME using
|
||||
external tests.
|
||||
* README, irq/irq.h, vme/vmeconfig.c: New files.
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -22,38 +22,37 @@ include_bspdir = $(includedir)/bsp
|
||||
dist_project_lib_DATA += startup/linkcmds
|
||||
|
||||
startup_SOURCES = startup/bspstart.c ../../shared/bootcard.c \
|
||||
../../shared/bspclean.c ../../shared/bsplibc.c \
|
||||
../../shared/sbrk.c \
|
||||
../../shared/gnatinstallhandler.c \
|
||||
../../powerpc/shared/showbats.c \
|
||||
../../shared/bsppost.c ../../shared/bsppredriverhook.c
|
||||
|
||||
../../shared/bsppost.c ../../shared/bsppredriverhook.c \
|
||||
../../shared/bsplibc.c ../../powerpc/shared/startup/sbrk.c \
|
||||
../../shared/bspclean.c ../../shared/gnatinstallhandler.c \
|
||||
../../powerpc/shared/startup/pgtbl_setup.c \
|
||||
../../powerpc/shared/startup/pgtbl_activate.c \
|
||||
../../powerpc/shared/showbats.c
|
||||
|
||||
pclock_SOURCES = ../../powerpc/shared/clock/p_clock.c
|
||||
|
||||
include_bsp_HEADERS = ../../powerpc/shared/console/uart.h \
|
||||
../../powerpc/shared/motorola/motorola.h \
|
||||
../../powerpc/shared/residual/residual.h \
|
||||
../../powerpc/shared/residual/pnp.h \
|
||||
../../powerpc/shared/console/consoleIo.h console/rsPMCQ1.h
|
||||
console_SOURCES = console/console.c console/ns16550cfg.c \
|
||||
console/mc68360_scc.c console/rsPMCQ1.c console/alloc360.c \
|
||||
console/init68360.c
|
||||
|
||||
include_bsp_HEADERS = ../../powerpc/shared/pci/pci.h \
|
||||
../../powerpc/shared/motorola/motorola.h \
|
||||
../../powerpc/shared/residual/residual.h \
|
||||
../../powerpc/shared/residual/pnp.h \
|
||||
../../powerpc/shared/console/consoleIo.h console/rsPMCQ1.h
|
||||
include_bsp_HEADERS += ../../powerpc/shared/openpic/openpic.h
|
||||
openpic_SOURCES = ../../powerpc/shared/openpic/openpic.h \
|
||||
../../powerpc/shared/openpic/openpic.c
|
||||
|
||||
include_bsp_HEADERS += ../../powerpc/shared/pci/pci.h
|
||||
pci_SOURCES = pci/no_host_bridge.c ../../powerpc/shared/pci/pci.c \
|
||||
../../powerpc/shared/pci/pcifinddevice.c
|
||||
../../powerpc/shared/pci/pcifinddevice.c
|
||||
|
||||
include_bsp_HEADERS += irq/irq.h \
|
||||
include_bsp_HEADERS += ../../powerpc/shared/irq/irq.h \
|
||||
../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/ppc_exc_bspsupp.h \
|
||||
../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/vectors.h \
|
||||
../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/irq_supp.h
|
||||
|
||||
irq_SOURCES = irq/irq.h irq/irq_init.c irq/openpic_xxx_irq.c \
|
||||
../../powerpc/shared/irq/i8259.c
|
||||
|
||||
include_bsp_HEADERS += ../../powerpc/shared/openpic/openpic.h
|
||||
|
||||
openpic_SOURCES = ../../powerpc/shared/openpic/openpic.c
|
||||
irq_SOURCES = irq/irq_init.c irq/openpic_xxx_irq.c ../../powerpc/shared/irq/i8259.c
|
||||
|
||||
include_bsp_HEADERS += ../../shared/vmeUniverse/vmeUniverse.h \
|
||||
vme/VMEConfig.h \
|
||||
@@ -65,7 +64,7 @@ include_bsp_HEADERS += ../../shared/vmeUniverse/vmeUniverse.h \
|
||||
|
||||
vme_SOURCES = ../../shared/vmeUniverse/vmeUniverse.c \
|
||||
../../shared/vmeUniverse/bspVmeDmaList.c \
|
||||
vme/vmeconfig.c \
|
||||
../shared/vme/vmeconfig.c \
|
||||
../shared/vme/vme_universe.c \
|
||||
../../shared/vmeUniverse/vme_am_defs.h
|
||||
|
||||
@@ -79,12 +78,9 @@ rtems_crti.$(OBJEXT): ../../powerpc/shared/start/rtems_crti.S
|
||||
$(CPPASCOMPILE) -o $@ -c $<
|
||||
project_lib_DATA += rtems_crti.$(OBJEXT)
|
||||
|
||||
EXTRA_DIST += README
|
||||
|
||||
noinst_LIBRARIES = libbsp.a
|
||||
libbsp_a_SOURCES = $(pclock_SOURCES) $(console_SOURCES) $(irq_SOURCES) \
|
||||
$(pci_SOURCES) $(vectors_SOURCES) $(startup_SOURCES) \
|
||||
$(openpic_SOURCES) $(vme_SOURCES)
|
||||
libbsp_a_SOURCES = $(startup_SOURCES) $(pclock_SOURCES) $(console_SOURCES) \
|
||||
$(openpic_SOURCES) $(pci_SOURCES) $(irq_SOURCES) $(vme_SOURCES)
|
||||
|
||||
libbsp_a_LIBADD = \
|
||||
../../../libcpu/@RTEMS_CPU@/shared/cpuIdent.rel \
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
BSP NAME: ep1a
|
||||
BOARD: RADSTONE EP1A
|
||||
BUS: N/A
|
||||
CPU FAMILY: ppc
|
||||
CPU: PowerPC 8245
|
||||
COPROCESSORS: N/A
|
||||
MODE: 32 bit mode
|
||||
|
||||
DEBUG MONITOR: see note.
|
||||
|
||||
PERIPHERALS
|
||||
===========
|
||||
TIMERS: PPC internal Timebase register
|
||||
RESOLUTION:
|
||||
SERIAL PORTS: 1 onboard QUIC, optional 2 mezannes with QUIC chips
|
||||
REAL-TIME CLOCK: xxx
|
||||
DMA: none
|
||||
VIDEO: none
|
||||
SCSI: none
|
||||
NETWORKING: none
|
||||
|
||||
DRIVER INFORMATION
|
||||
==================
|
||||
CLOCK DRIVER: PPC internal
|
||||
IOSUPP DRIVER: N/A
|
||||
SHMSUPP: N/A
|
||||
TIMER DRIVER: PPC internal
|
||||
TTY DRIVER: PPC internal
|
||||
|
||||
STDIO
|
||||
=====
|
||||
PORT: Console port 0
|
||||
ELECTRICAL: na
|
||||
BAUD: 9600
|
||||
BITS PER CHARACTER: 8
|
||||
PARITY: n
|
||||
STOP BITS: 1
|
||||
|
||||
Notes
|
||||
=====
|
||||
This bsp has been tested with an custom ep1a, which had two
|
||||
PMCQ1 Daughter cards attached.
|
||||
@@ -15,21 +15,6 @@ RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_PROG_CCAS
|
||||
|
||||
RTEMS_BSPOPTS_SET([CONSOLE_USE_INTERRUPTS],[*],[1])
|
||||
RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS],
|
||||
[whether using console interrupts])
|
||||
|
||||
RTEMS_BSPOPTS_SET([INITIALIZE_COM_PORTS],[*],[0])
|
||||
RTEMS_BSPOPTS_HELP([INITIALIZE_COM_PORTS],
|
||||
[FIXME: Missing explanation])
|
||||
|
||||
RTEMS_BSPOPTS_SET([PPC_USE_SPRG],[*],[0])
|
||||
RTEMS_BSPOPTS_HELP([PPC_USE_SPRG],
|
||||
[If defined, then the PowerPC specific code in RTEMS will use some
|
||||
of the special purpose registers to slightly optimize interrupt
|
||||
response time. The use of these registers can conflict with
|
||||
other tools like debuggers.])
|
||||
|
||||
RTEMS_BSPOPTS_SET([PPC_USE_DATA_CACHE],[*],[0])
|
||||
RTEMS_BSPOPTS_HELP([PPC_USE_DATA_CACHE],
|
||||
[If defined, then the PowerPC specific code in RTEMS will use
|
||||
@@ -39,10 +24,14 @@ RTEMS_BSPOPTS_HELP([PPC_USE_DATA_CACHE],
|
||||
of PowerPC 603e revisions and emulator versions.
|
||||
The BSP actually contains the call that enables this.])
|
||||
|
||||
RTEMS_BSPOPTS_SET([PPC_VECTOR_FILE_BASE],[*],[0x0100])
|
||||
RTEMS_BSPOPTS_HELP([PPC_VECTOR_FILE_BASE],
|
||||
[This defines the base address of the exception table.
|
||||
NOTE: Vectors are actually at 0xFFF00000 but file starts at offset.])
|
||||
RTEMS_BSPOPTS_SET([INSTRUCTION_CACHE_ENABLE],[*],[0])
|
||||
RTEMS_BSPOPTS_HELP([INSTRUCTION_CACHE_ENABLE],
|
||||
[If defined, the instruction cache will be enabled after address translation
|
||||
is turned on.])
|
||||
|
||||
RTEMS_BSPOPTS_SET([CONSOLE_USE_INTERRUPTS],[*],[0])
|
||||
RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS],
|
||||
[whether using console interrupts])
|
||||
|
||||
RTEMS_CHECK_NETWORKING
|
||||
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||
|
||||
@@ -34,40 +34,23 @@ void M360SetupMemory( M68360_t ptr ){
|
||||
|
||||
#if DEBUG_PRINT
|
||||
printk("m360->mcr:0x%08x Q1_360_SIM_MCR:0x%08x\n",
|
||||
(uint32_t)&(m360->mcr), ((uint32_t)m360+Q1_360_SIM_MCR));
|
||||
(unsigned int)&(m360->mcr), ((unsigned int)m360+Q1_360_SIM_MCR));
|
||||
#endif
|
||||
ptr->bdregions[0].base = (uint8_t *)&m360->dpram1[0];
|
||||
ptr->bdregions[0].base = (char *)&m360->dpram1[0];
|
||||
ptr->bdregions[0].size = sizeof m360->dpram1;
|
||||
ptr->bdregions[0].used = 0;
|
||||
#if DEBUG_PRINT
|
||||
printk("%d) base 0x%x size %d used %d\n", 0,
|
||||
(uint32_t)ptr->bdregions[0].base, ptr->bdregions[0].size, ptr->bdregions[0].used );
|
||||
#endif
|
||||
|
||||
ptr->bdregions[1].base = (uint8_t *)&m360->dpram3[0];
|
||||
ptr->bdregions[1].base = (char *)&m360->dpram3[0];
|
||||
ptr->bdregions[1].size = sizeof m360->dpram3;
|
||||
ptr->bdregions[1].used = 0;
|
||||
#if DEBUG_PRINT
|
||||
printk("%d) base 0x%x size %d used %d\n", 1,
|
||||
(uint32_t)ptr->bdregions[1].base, ptr->bdregions[1].size, ptr->bdregions[1].used );
|
||||
#endif
|
||||
|
||||
ptr->bdregions[2].base = (uint8_t *)&m360->dpram0[0];
|
||||
ptr->bdregions[2].base = (char *)&m360->dpram0[0];
|
||||
ptr->bdregions[2].size = sizeof m360->dpram0;
|
||||
ptr->bdregions[2].used = 0;
|
||||
#if DEBUG_PRINT
|
||||
printk("%d) base 0x%x size %d used %d\n", 2,
|
||||
(uint32_t)ptr->bdregions[2].base, ptr->bdregions[2].size, ptr->bdregions[2].used );
|
||||
#endif
|
||||
|
||||
ptr->bdregions[3].base = (uint8_t *)&m360->dpram2[0];
|
||||
ptr->bdregions[3].base = (char *)&m360->dpram2[0];
|
||||
ptr->bdregions[3].size = sizeof m360->dpram2;
|
||||
ptr->bdregions[3].used = 0;
|
||||
#if DEBUG_PRINT
|
||||
printk("%d) base 0x%x size %d used %d\n", 3,
|
||||
(uint32_t)ptr->bdregions[3].base, ptr->bdregions[3].size, ptr->bdregions[3].used );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -77,11 +60,11 @@ printk("%d) base 0x%x size %d used %d\n", 3,
|
||||
void *
|
||||
M360AllocateBufferDescriptors (M68360_t ptr, int count)
|
||||
{
|
||||
uint32_t i;
|
||||
unsigned int i;
|
||||
ISR_Level level;
|
||||
void *bdp = NULL;
|
||||
uint32_t want = count * sizeof(m360BufferDescriptor_t);
|
||||
uint32_t have;
|
||||
unsigned int want = count * sizeof(m360BufferDescriptor_t);
|
||||
int have;
|
||||
|
||||
/*
|
||||
* Running with interrupts disabled is usually considered bad
|
||||
@@ -98,27 +81,15 @@ M360AllocateBufferDescriptors (M68360_t ptr, int count)
|
||||
* less dual-port RAM.
|
||||
*/
|
||||
if (ptr->bdregions[i].used == 0) {
|
||||
volatile uint8_t *cp = ptr->bdregions[i].base;
|
||||
uint8_t data;
|
||||
|
||||
volatile unsigned char *cp = ptr->bdregions[i].base;
|
||||
*cp = 0xAA;
|
||||
data = *cp;
|
||||
if (data != 0xAA) {
|
||||
if (*cp != 0xAA) {
|
||||
ptr->bdregions[i].used = ptr->bdregions[i].size;
|
||||
#if DEBUG_PRINT
|
||||
printk("%d) base 0x%x used %d expected 0xAA read 0x%x\n",i,
|
||||
(uint32_t)ptr->bdregions[i].base, ptr->bdregions[0].used, data );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
*cp = 0x55;
|
||||
data = *cp;
|
||||
if (data != 0x55) {
|
||||
if (*cp != 0x55) {
|
||||
ptr->bdregions[i].used = ptr->bdregions[i].size;
|
||||
#if DEBUG_PRINT
|
||||
printk("%d) base 0x%x used %d expected 0x55 read 0x%x\n",i,
|
||||
(uint32_t)ptr->bdregions[i].base, ptr->bdregions[0].used, data );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
*cp = 0x0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file contains the TTY driver table for the EP1A
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -21,12 +21,7 @@
|
||||
* or interrupt driven IO.
|
||||
*/
|
||||
|
||||
#if 1
|
||||
#define NS16550_FUNCTIONS &ns16550_fns_polled
|
||||
#else
|
||||
#define NS16550_FUNCTIONS &ns16550_fns
|
||||
#endif
|
||||
|
||||
#define MC68360_SCC_FUNCTIONS &mc68360_scc_fns
|
||||
|
||||
/*
|
||||
@@ -127,7 +122,6 @@ console_tbl Console_Port_Tbl[] = {
|
||||
7372800, /* ulClock */
|
||||
0 /* ulIntVector */
|
||||
},
|
||||
|
||||
/*
|
||||
* Up to 12 serial ports are provided by MC68360 SCC ports.
|
||||
* EP1A may have one MC68360 providing 4 ports (A,B,C,D).
|
||||
@@ -437,8 +431,3 @@ static bool config_68360_scc_base_probe_12( int minor ) {
|
||||
return config_68360_scc_base_probe( minor, 0, 15, 4);
|
||||
}
|
||||
|
||||
|
||||
void Force_mc8360_interrupt( int d ) {
|
||||
mc68360_sccInterruptHandler( M68360_chips->next );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*XXX
|
||||
* This file contains the TTY driver for the ep1a
|
||||
*
|
||||
* This driver uses the termios pseudo driver.
|
||||
@@ -212,11 +212,6 @@ rtems_device_driver console_initialize(
|
||||
Console_Port_Tbl[minor].pDeviceFns->deviceInitialize(
|
||||
Console_Port_Minor);
|
||||
|
||||
/*
|
||||
* NOTE: We must probe ALL possible devices, which initializes
|
||||
* the address information in the config.c tables.
|
||||
*/
|
||||
|
||||
for(minor++;minor<Console_Port_Count;minor++)
|
||||
{
|
||||
/*
|
||||
@@ -246,6 +241,83 @@ rtems_device_driver console_initialize(
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
#if 0
|
||||
/* PAGE
|
||||
*
|
||||
* DEBUG_puts
|
||||
*
|
||||
* This should be safe in the event of an error. It attempts to ensure
|
||||
* that no TX empty interrupts occur while it is doing polled IO. Then
|
||||
* it restores the state of that external interrupt.
|
||||
*
|
||||
* Input parameters:
|
||||
* string - pointer to debug output string
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values: NONE
|
||||
*/
|
||||
|
||||
void DEBUG_puts(
|
||||
char *string
|
||||
)
|
||||
{
|
||||
char *s;
|
||||
unsigned32 Irql;
|
||||
|
||||
rtems_interrupt_disable(Irql);
|
||||
|
||||
for ( s = string ; *s ; s++ )
|
||||
{
|
||||
Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
|
||||
deviceWritePolled(Console_Port_Minor, *s);
|
||||
}
|
||||
|
||||
rtems_interrupt_enable(Irql);
|
||||
}
|
||||
|
||||
/* PAGE
|
||||
*
|
||||
* DEBUG_puth
|
||||
*
|
||||
* This should be safe in the event of an error. It attempts to ensure
|
||||
* that no TX empty interrupts occur while it is doing polled IO. Then
|
||||
* it restores the state of that external interrupt.
|
||||
*
|
||||
* Input parameters:
|
||||
* ulHexNum - value to display
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values: NONE
|
||||
*/
|
||||
void
|
||||
DEBUG_puth(
|
||||
unsigned32 ulHexNum
|
||||
)
|
||||
{
|
||||
unsigned long i,d;
|
||||
unsigned32 Irql;
|
||||
|
||||
rtems_interrupt_disable(Irql);
|
||||
|
||||
Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
|
||||
deviceWritePolled(Console_Port_Minor, '0');
|
||||
Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
|
||||
deviceWritePolled(Console_Port_Minor, 'x');
|
||||
|
||||
for(i=32;i;)
|
||||
{
|
||||
i-=4;
|
||||
d=(ulHexNum>>i)&0xf;
|
||||
Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
|
||||
deviceWritePolled(Console_Port_Minor,
|
||||
(d<=9) ? d+'0' : d+'a'-0xa);
|
||||
}
|
||||
|
||||
rtems_interrupt_enable(Irql);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* const char arg to be compatible with BSP_output_char decl. */
|
||||
void
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* eric@skatter.usask.ca
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -935,9 +935,9 @@ typedef struct m360_ {
|
||||
} m360_t;
|
||||
|
||||
struct bdregions_t {
|
||||
uint8_t *base;
|
||||
uint32_t size;
|
||||
uint32_t used;
|
||||
char *base;
|
||||
unsigned int size;
|
||||
unsigned int used;
|
||||
};
|
||||
|
||||
#define M68360_RX_BUF_SIZE 1
|
||||
@@ -977,8 +977,6 @@ void *M360AllocateBufferDescriptors (M68360_t ptr, int count);
|
||||
void M360ExecuteRISC( volatile m360_t *m360, uint16_t command);
|
||||
int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector );
|
||||
|
||||
void mc68360_sccInterruptHandler( void *ptr);
|
||||
|
||||
#if 0
|
||||
extern volatile m360_t *m360;
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* This file contains the termios TTY driver for the
|
||||
* Motorola MC68360 SCC ports.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* COPYRIGHT (c) 1989-2008.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/bspIo.h>
|
||||
#include <string.h>
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
#define DEBUG_360
|
||||
#endif
|
||||
|
||||
@@ -77,10 +77,10 @@ void scc_write8(
|
||||
uint8_t value
|
||||
)
|
||||
{
|
||||
*address = value;
|
||||
#ifdef DEBUG_360
|
||||
printk( "WR8 %s 0x%08x 0x%02x\n", name, address, value );
|
||||
#endif
|
||||
*address = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,10 +108,10 @@ void scc_write16(
|
||||
uint16_t value
|
||||
)
|
||||
{
|
||||
*address = value;
|
||||
#ifdef DEBUG_360
|
||||
printk( "WR16 %s 0x%08x 0x%04x\n", name, address, value );
|
||||
#endif
|
||||
*address = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,11 +139,10 @@ void scc_write32(
|
||||
uint32_t value
|
||||
)
|
||||
{
|
||||
*address = value;
|
||||
Processor_Synchronize();
|
||||
#ifdef DEBUG_360
|
||||
printk( "WR32 %s 0x%08x 0x%08x\n", name, address, value );
|
||||
#endif
|
||||
*address = value;
|
||||
}
|
||||
|
||||
void mc68360_sccShow_Regs(int minor){
|
||||
@@ -156,9 +155,9 @@ void mc68360_sccShow_Regs(int minor){
|
||||
}
|
||||
|
||||
#define TX_BUFFER_ADDRESS( _ptr ) \
|
||||
((uint8_t *)ptr->txBuf - (uint8_t *)ptr->chip->board_data->baseaddr)
|
||||
((char *)ptr->txBuf - (char *)ptr->chip->board_data->baseaddr)
|
||||
#define RX_BUFFER_ADDRESS( _ptr ) \
|
||||
((uint8_t *)ptr->rxBuf - (uint8_t *)ptr->chip->board_data->baseaddr)
|
||||
((char *)ptr->rxBuf - (char *)ptr->chip->board_data->baseaddr)
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
@@ -240,9 +239,8 @@ mc68360_sccBRGC(int baud, int m360_clock_rate)
|
||||
* none *
|
||||
* *
|
||||
**************************************************************************/
|
||||
void mc68360_sccInterruptHandler( void *ptr)
|
||||
void mc68360_sccInterruptHandler( M68360_t chip )
|
||||
{
|
||||
M68360_t chip = ptr;
|
||||
volatile m360_t *m360;
|
||||
int port;
|
||||
uint16_t status;
|
||||
@@ -252,8 +250,8 @@ void mc68360_sccInterruptHandler( void *ptr)
|
||||
int clear_isr;
|
||||
|
||||
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_sccInterruptHandler with 0x%x \n", ptr);
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_sccInterruptHandler\n");
|
||||
#endif
|
||||
for (port=0; port<4; port++) {
|
||||
|
||||
@@ -277,8 +275,8 @@ void mc68360_sccInterruptHandler( void *ptr)
|
||||
while ((status & M360_BD_EMPTY) == 0)
|
||||
{
|
||||
length= scc_read16("sccRxBd->length",&chip->port[port].sccRxBd->length);
|
||||
if (length > 1)
|
||||
EP1A_READ_LENGTH_GREATER_THAN_1 = length;
|
||||
if (length > 1)
|
||||
EP1A_READ_LENGTH_GREATER_THAN_1 = length;
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
data= chip->port[port].rxBuf[i];
|
||||
@@ -304,19 +302,21 @@ void mc68360_sccInterruptHandler( void *ptr)
|
||||
if ((status & M360_BD_EMPTY) == 0)
|
||||
{
|
||||
scc_write16("sccTxBd->status",&chip->port[port].sccTxBd->status,0);
|
||||
#if 1
|
||||
rtems_termios_dequeue_characters(
|
||||
Console_Port_Data[chip->port[port].minor].termios_data,
|
||||
chip->port[port].sccTxBd->length
|
||||
);
|
||||
chip->port[port].sccTxBd->length);
|
||||
#else
|
||||
mc68360_scc_write_support_int(chip->port[port].minor,"*****", 5);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear SCC interrupt-in-service bit.
|
||||
*/
|
||||
if ( clear_isr ) {
|
||||
if ( clear_isr )
|
||||
scc_write32( "cisr", &m360->cisr, (0x80000000 >> chip->port[port].channel) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,9 +339,10 @@ int mc68360_scc_open(
|
||||
uint32_t data;
|
||||
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_scc_open %s (%d)\n", Console_Port_Tbl[minor].sDeviceName, minor);
|
||||
printk("mc68360_scc_open %d\n", minor);
|
||||
#endif
|
||||
|
||||
|
||||
ptr = Console_Port_Tbl[minor].pDeviceParams;
|
||||
m360 = ptr->chip->m360;
|
||||
|
||||
@@ -367,8 +368,8 @@ int mc68360_scc_open(
|
||||
|
||||
uint32_t mc68360_scc_calculate_pbdat( M68360_t chip )
|
||||
{
|
||||
int i;
|
||||
uint32_t pbdat_data = 0x03;
|
||||
uint32_t i;
|
||||
uint32_t pbdat_data;
|
||||
int minor;
|
||||
uint32_t type422data[4] = {
|
||||
0x00440, 0x00880, 0x10100, 0x20200
|
||||
@@ -377,15 +378,13 @@ uint32_t mc68360_scc_calculate_pbdat( M68360_t chip )
|
||||
pbdat_data = 0x3;
|
||||
for (i=0; i<4; i++) {
|
||||
minor = chip->port[i].minor;
|
||||
if mc68360_scc_Is_422( minor ){
|
||||
if mc68360_scc_Is_422( minor )
|
||||
pbdat_data |= type422data[i];
|
||||
}
|
||||
}
|
||||
|
||||
return pbdat_data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* mc68360_scc_initialize_interrupts
|
||||
*
|
||||
@@ -401,7 +400,7 @@ void mc68360_scc_initialize_interrupts(int minor)
|
||||
uint32_t buffers_start;
|
||||
uint32_t tmp_u32;
|
||||
|
||||
#ifdef DEBUG_360
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_scc_initialize_interrupts: minor %d\n", minor );
|
||||
printk("Console_Port_Tbl[minor].pDeviceParams 0x%08x\n",
|
||||
Console_Port_Tbl[minor].pDeviceParams );
|
||||
@@ -410,7 +409,7 @@ void mc68360_scc_initialize_interrupts(int minor)
|
||||
ptr = Console_Port_Tbl[minor].pDeviceParams;
|
||||
m360 = ptr->chip->m360;
|
||||
|
||||
#ifdef DEBUG_360
|
||||
#ifdef DEBUG_360
|
||||
printk("m360 0x%08x baseaddr 0x%08x\n",
|
||||
m360, ptr->chip->board_data->baseaddr);
|
||||
#endif
|
||||
@@ -465,7 +464,6 @@ void mc68360_scc_initialize_interrupts(int minor)
|
||||
/*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
scc_write16( "papar", &m360->papar, 0xffff );
|
||||
scc_write16( "padir", &m360->padir, 0x5500 ); /* From Memo */
|
||||
scc_write16( "paodr", &m360->paodr, 0x0000 );
|
||||
@@ -666,11 +664,6 @@ int mc68360_scc_write_support_int(
|
||||
rtems_interrupt_level Irql;
|
||||
M68360_serial_ports_t ptr;
|
||||
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_scc_write_support_int: char 0x%x length %d\n",
|
||||
(unsigned int)*buf, len );
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
mc68360_length_array[ mc68360_length_count ] = len;
|
||||
mc68360_length_count++;
|
||||
@@ -688,13 +681,18 @@ int mc68360_scc_write_support_int(
|
||||
if ( !len )
|
||||
return 0;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_scc_write_support_int: char 0x%x length %d\n",
|
||||
(unsigned int)*buf, len );
|
||||
#endif
|
||||
/*
|
||||
* We must copy the data from the global memory space to MC68360 space
|
||||
*/
|
||||
|
||||
rtems_interrupt_disable(Irql);
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_scc_write_support_int: disable irq 0x%x\n", Irql );
|
||||
#endif
|
||||
|
||||
scc_write16( "sccTxBd->status", &ptr->sccTxBd->status, 0 );
|
||||
memcpy((void *) ptr->txBuf, buf, len);
|
||||
@@ -704,9 +702,6 @@ int mc68360_scc_write_support_int(
|
||||
scc_write16( "sccTxBd->status", &ptr->sccTxBd->status,
|
||||
(M360_BD_READY | M360_BD_WRAP | M360_BD_INTERRUPT) );
|
||||
|
||||
#ifdef DEBUG_360
|
||||
printk("mc68360_scc_write_support_int: enable irq 0x%x\n", Irql );
|
||||
#endif
|
||||
rtems_interrupt_enable(Irql);
|
||||
|
||||
return len;
|
||||
@@ -902,14 +897,12 @@ int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector )
|
||||
* XXX - Note Does this need to be moved up to if a QUICC is fitted
|
||||
* section?
|
||||
*/
|
||||
|
||||
if ((chip = calloc( 1, sizeof(struct _m68360_per_chip))) == NULL)
|
||||
if ((chip = malloc(sizeof(struct _m68360_per_chip))) == NULL)
|
||||
{
|
||||
printk("Error Unable to allocate memory for _m68360_per_chip\n");
|
||||
return RTEMS_IO_ERROR;
|
||||
} else {
|
||||
printk("Allocate memory for _m68360_per_chip at 0x%x\n", chip );
|
||||
}
|
||||
|
||||
chip->next = M68360_chips;
|
||||
chip->m360 = (void *)BoardData->baseaddr;
|
||||
chip->m360_interrupt = int_vector;
|
||||
@@ -952,6 +945,7 @@ int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector )
|
||||
/*
|
||||
* Allocate buffer descriptors.
|
||||
*/
|
||||
|
||||
chip->port[i-1].sccRxBd = M360AllocateBufferDescriptors(chip, 1);
|
||||
chip->port[i-1].sccTxBd = M360AllocateBufferDescriptors(chip, 1);
|
||||
}
|
||||
@@ -963,6 +957,7 @@ int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector )
|
||||
&mc68360_sccInterruptHandler,
|
||||
chip
|
||||
);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ These functions are responsible for scanning for PMCQ1's and setting up
|
||||
the Motorola MC68360's if present.
|
||||
|
||||
USAGE
|
||||
call rsPMCQ1Init() to perform basic initialisation of the PMCQ1's.
|
||||
call rsPMCQ1Init() to perform ba sic initialisation of the PMCQ1's.
|
||||
*/
|
||||
|
||||
/* includes */
|
||||
@@ -41,8 +41,8 @@ call rsPMCQ1Init() to perform basic initialisation of the PMCQ1's.
|
||||
#include "m68360.h"
|
||||
|
||||
/* defines */
|
||||
#if 0
|
||||
#define DEBUG_360 TRUE
|
||||
#if 1
|
||||
#define DEBUG_360
|
||||
#endif
|
||||
|
||||
/* Local data */
|
||||
@@ -82,61 +82,27 @@ static unsigned char rsPMCQ1eeprom[] =
|
||||
|
||||
void MsDelay(void)
|
||||
{
|
||||
printk("..");
|
||||
printk(".");
|
||||
}
|
||||
|
||||
void write8( int addr, int data ){
|
||||
out_8((volatile void *)addr, (unsigned char)data);
|
||||
Processor_Synchronize();
|
||||
out_8((void *)addr, (unsigned char)data);
|
||||
}
|
||||
|
||||
void write16( int addr, int data ) {
|
||||
out_be16((volatile void *)addr, (short)data );
|
||||
Processor_Synchronize();
|
||||
out_be16((void *)addr, (short)data );
|
||||
}
|
||||
|
||||
void write32( int addr, int data ) {
|
||||
out_be32((volatile unsigned int *)addr, data );
|
||||
Processor_Synchronize();
|
||||
out_be32((unsigned int *)addr, data );
|
||||
}
|
||||
|
||||
int read32( int addr){
|
||||
int value = in_be32((volatile unsigned int *)addr);
|
||||
Processor_Synchronize();
|
||||
return value;
|
||||
}
|
||||
|
||||
void rsPMCQ1_scc_On(const struct __rtems_irq_connect_data__ *ptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void rsPMCQ1_scc_Off(const struct __rtems_irq_connect_data__ *ptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int rsPMCQ1_scc_except_always_enabled(const struct __rtems_irq_connect_data__ *ptr)
|
||||
{
|
||||
return TRUE;
|
||||
return in_be32((unsigned int *)addr);
|
||||
}
|
||||
|
||||
|
||||
void rsPMCQ1ShowIntrStatus(void )
|
||||
{
|
||||
unsigned long status;
|
||||
unsigned long mask;
|
||||
PPMCQ1BoardData boardData;
|
||||
|
||||
for (boardData = pmcq1BoardData; boardData; boardData = boardData->pNext)
|
||||
{
|
||||
|
||||
status = PMCQ1_Read_EPLD(boardData->baseaddr, PMCQ1_INT_STATUS );
|
||||
mask = PMCQ1_Read_EPLD(boardData->baseaddr, PMCQ1_INT_MASK );
|
||||
printk("rsPMCQ1ShowIntrStatus: interrupt status 0x%x) 0x%x with mask: 0x%x\n", boardData->quiccInt, status, mask);
|
||||
}
|
||||
}
|
||||
|
||||
void rsPMCQ1_scc_nullFunc(void) {}
|
||||
|
||||
/*******************************************************************************
|
||||
* rsPMCQ1Int - handle a PMCQ1 interrupt
|
||||
@@ -150,57 +116,48 @@ void rsPMCQ1ShowIntrStatus(void )
|
||||
void rsPMCQ1Int( void *ptr )
|
||||
{
|
||||
unsigned long status;
|
||||
static unsigned long status1;
|
||||
unsigned long status1;
|
||||
unsigned long mask;
|
||||
uint32_t data;
|
||||
PPMCQ1BoardData boardData = ptr;
|
||||
volatile unsigned long *hrdwr;
|
||||
unsigned long value;
|
||||
|
||||
status = PMCQ1_Read_EPLD(boardData->baseaddr, PMCQ1_INT_STATUS );
|
||||
mask = PMCQ1_Read_EPLD(boardData->baseaddr, PMCQ1_INT_MASK );
|
||||
|
||||
|
||||
if (((mask & PMCQ1_INT_MASK_QUICC) == 0) && ((status & PMCQ1_INT_STATUS_QUICC) != 0 ))
|
||||
if (((mask & PMCQ1_INT_MASK_QUICC) == 0) && (status & PMCQ1_INT_STATUS_QUICC))
|
||||
{
|
||||
/* If there is a handler call it otherwise mask the interrupt */
|
||||
if (boardData->quiccInt) {
|
||||
boardData->quiccInt(boardData->quiccArg);
|
||||
} else {
|
||||
printk("No handler - Masking interrupt\n");
|
||||
hrdwr = (volatile unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK);
|
||||
value = (*hrdwr) | PMCQ1_INT_MASK_QUICC;
|
||||
*hrdwr = value;
|
||||
*(volatile unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_QUICC;
|
||||
}
|
||||
}
|
||||
|
||||
if (((mask & PMCQ1_INT_MASK_MA) == 0) && (status & PMCQ1_INT_STATUS_MA))
|
||||
{
|
||||
|
||||
/* If there is a handler call it otherwise mask the interrupt */
|
||||
if (boardData->maInt) {
|
||||
boardData->maInt(boardData->maArg);
|
||||
|
||||
data = PMCQ1_Read_EPLD(boardData->baseaddr, PMCQ1_INT_STATUS );
|
||||
data = data & (~PMCQ1_INT_STATUS_MA);
|
||||
data &= (~PMCQ1_INT_STATUS_MA);
|
||||
PMCQ1_Write_EPLD(boardData->baseaddr, PMCQ1_INT_STATUS, data );
|
||||
} else {
|
||||
printk("No handler - Masking interrupt\n");
|
||||
hrdwr = (volatile unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK);
|
||||
value = (*hrdwr) | PMCQ1_INT_MASK_MA;
|
||||
*hrdwr = value;
|
||||
|
||||
} else {
|
||||
*(volatile unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_MA;
|
||||
}
|
||||
}
|
||||
|
||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||
|
||||
/* Clear Interrupt on QSPAN */
|
||||
hrdwr = (volatile unsigned long *)(boardData->bridgeaddr + 0x600);
|
||||
*hrdwr = 0x00001000;
|
||||
*(volatile unsigned long *)(boardData->bridgeaddr + 0x600) = 0x00001000;
|
||||
|
||||
/* read back the status register to ensure that the pci write has completed */
|
||||
status1 = *hrdwr;
|
||||
|
||||
status1 = *(volatile unsigned long *)(boardData->bridgeaddr + 0x600);
|
||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -218,8 +175,8 @@ unsigned int rsPMCQ1MaIntConnect (
|
||||
unsigned long busNo, /* Pci Bus number of PMCQ1 */
|
||||
unsigned long slotNo, /* Pci Slot number of PMCQ1 */
|
||||
unsigned long funcNo, /* Pci Function number of PMCQ1 */
|
||||
PMCQ1_FUNCTION_PTR routine,/* interrupt routine */
|
||||
void * arg /* argument to pass to interrupt routine */
|
||||
FUNCION_PTR routine,/* interrupt routine */
|
||||
int arg /* argument to pass to interrupt routine */
|
||||
)
|
||||
{
|
||||
PPMCQ1BoardData boardData;
|
||||
@@ -274,7 +231,7 @@ unsigned int rsPMCQ1MaIntDisconnect(
|
||||
(boardData->funcNo == funcNo))
|
||||
{
|
||||
boardData->maInt = NULL;
|
||||
*(volatile unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_MA;
|
||||
*(unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_MA;
|
||||
status = RTEMS_SUCCESSFUL;
|
||||
break;
|
||||
}
|
||||
@@ -294,11 +251,11 @@ unsigned int rsPMCQ1MaIntDisconnect(
|
||||
*/
|
||||
|
||||
unsigned int rsPMCQ1QuiccIntConnect(
|
||||
unsigned long busNo, /* Pci Bus number of PMCQ1 */
|
||||
unsigned long slotNo, /* Pci Slot number of PMCQ1 */
|
||||
unsigned long funcNo, /* Pci Function number of PMCQ1 */
|
||||
PMCQ1_FUNCTION_PTR routine, /* interrupt routine */
|
||||
void * arg /* argument to pass to interrupt routine */
|
||||
unsigned long busNo, /* Pci Bus number of PMCQ1 */
|
||||
unsigned long slotNo, /* Pci Slot number of PMCQ1 */
|
||||
unsigned long funcNo, /* Pci Function number of PMCQ1 */
|
||||
FUNCION_PTR routine,/* interrupt routine */
|
||||
int arg /* argument to pass to interrupt routine */
|
||||
)
|
||||
{
|
||||
PPMCQ1BoardData boardData;
|
||||
@@ -343,7 +300,7 @@ unsigned int rsPMCQ1QuiccIntDisconnect(
|
||||
(boardData->funcNo == funcNo))
|
||||
{
|
||||
boardData->quiccInt = NULL;
|
||||
*(volatile unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_QUICC;
|
||||
*(unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_QUICC;
|
||||
status = RTEMS_SUCCESSFUL;
|
||||
break;
|
||||
}
|
||||
@@ -366,22 +323,25 @@ unsigned int rsPMCQ1Init(void)
|
||||
{
|
||||
int busNo;
|
||||
int slotNo;
|
||||
uint32_t baseaddr = 0;
|
||||
uint32_t bridgeaddr = 0;
|
||||
unsigned int baseaddr = 0;
|
||||
unsigned int bridgeaddr = 0;
|
||||
unsigned long pbti0_ctl;
|
||||
int i;
|
||||
unsigned char int_vector;
|
||||
int fun;
|
||||
uint32_t temp;
|
||||
int temp;
|
||||
PPMCQ1BoardData boardData;
|
||||
rtems_irq_connect_data *IrqData = NULL;
|
||||
rtems_irq_connect_data IrqData = {0,
|
||||
rsPMCQ1Int,
|
||||
rsPMCQ1_scc_nullFunc,
|
||||
rsPMCQ1_scc_nullFunc,
|
||||
rsPMCQ1_scc_nullFunc,
|
||||
NULL};
|
||||
|
||||
if (rsPMCQ1Initialized)
|
||||
{
|
||||
printk("rsPMCQ1Init: Already Initialized\n");
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
}
|
||||
for (i=0;;i++){
|
||||
if ( pci_find_device(PCI_VEN_ID_RADSTONE, PCI_DEV_ID_PMCQ1, i, &busNo, &slotNo, &fun) != 0 )
|
||||
break;
|
||||
@@ -389,17 +349,17 @@ unsigned int rsPMCQ1Init(void)
|
||||
pci_read_config_dword(busNo, slotNo, 0, PCI_BASE_ADDRESS_2, &baseaddr);
|
||||
pci_read_config_dword(busNo, slotNo, 0, PCI_BASE_ADDRESS_0, &bridgeaddr);
|
||||
#ifdef DEBUG_360
|
||||
printk("rsPMCQ1Init: PMCQ1 baseaddr 0x%08x bridgeaddr 0x%08x\n", baseaddr, bridgeaddr );
|
||||
printk("PMCQ1 baseaddr 0x%08x bridgeaddr 0x%08x\n", baseaddr, bridgeaddr );
|
||||
#endif
|
||||
|
||||
/* Set function code to normal mode and enable window */
|
||||
pbti0_ctl = (*(unsigned long *)(bridgeaddr + 0x100)) & 0xff0fffff;
|
||||
pbti0_ctl = *(unsigned long *)(bridgeaddr + 0x100) & 0xff0fffff;
|
||||
eieio();
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x100) = pbti0_ctl | 0x00500080;
|
||||
*(unsigned long *)(bridgeaddr + 0x100) = pbti0_ctl | 0x00500080;
|
||||
eieio();
|
||||
|
||||
/* Assert QBUS reset */
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x800) |= 0x00000080;
|
||||
*(unsigned long *)(bridgeaddr + 0x800) |= 0x00000080;
|
||||
eieio();
|
||||
|
||||
/*
|
||||
@@ -408,7 +368,7 @@ unsigned int rsPMCQ1Init(void)
|
||||
MsDelay();
|
||||
|
||||
/* Take QBUS out of reset */
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x800) &= ~0x00000080;
|
||||
*(unsigned long *)(bridgeaddr + 0x800) &= ~0x00000080;
|
||||
eieio();
|
||||
|
||||
MsDelay();
|
||||
@@ -417,19 +377,19 @@ unsigned int rsPMCQ1Init(void)
|
||||
if (PMCQ1_Read_EPLD(baseaddr, PMCQ1_BUILD_OPTION) & PMCQ1_QUICC_FITTED)
|
||||
{
|
||||
#ifdef DEBUG_360
|
||||
printk("rsPMCQ1Init: Found QUICC busNo %d slotNo %d\n", busNo, slotNo);
|
||||
printk(" Found QUICC busNo %d slotNo %d\n", busNo, slotNo);
|
||||
#endif
|
||||
|
||||
/* Initialise MBAR (must use function code of 7) */
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x100) = pbti0_ctl | 0x00700080;
|
||||
*(unsigned long *)(bridgeaddr + 0x100) = pbti0_ctl | 0x00700080;
|
||||
eieio();
|
||||
|
||||
/* place internal 8K SRAM and registers at address 0x0 */
|
||||
*(volatile unsigned long *)(baseaddr + Q1_360_MBAR) = 0x1;
|
||||
*(unsigned long *)(baseaddr + Q1_360_MBAR) = 0x1;
|
||||
eieio();
|
||||
|
||||
/* Set function code to normal mode */
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x100) = pbti0_ctl | 0x00500080;
|
||||
*(unsigned long *)(bridgeaddr + 0x100) = pbti0_ctl | 0x00500080;
|
||||
eieio();
|
||||
|
||||
/* Disable the SWT and perform basic initialisation */
|
||||
@@ -465,15 +425,15 @@ unsigned int rsPMCQ1Init(void)
|
||||
*/
|
||||
pci_read_config_dword(busNo, slotNo, 0, PCI_BASE_ADDRESS_3, &temp);
|
||||
if (temp) {
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x110) |= 0x00500880;
|
||||
*(unsigned long *)(bridgeaddr + 0x110) |= 0x00500880;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create descriptor structure for this card
|
||||
*/
|
||||
if ((boardData = calloc(1, sizeof(struct _PMCQ1BoardData))) == NULL)
|
||||
if ((boardData = malloc(sizeof(struct _PMCQ1BoardData))) == NULL)
|
||||
{
|
||||
printk("rsPMCQ1Init: Error Unable to allocate memory for _PMCQ1BoardData\n");
|
||||
printk("Error Unable to allocate memory for _PMCQ1BoardData\n");
|
||||
return(RTEMS_IO_ERROR);
|
||||
}
|
||||
|
||||
@@ -486,7 +446,6 @@ unsigned int rsPMCQ1Init(void)
|
||||
boardData->quiccInt = NULL;
|
||||
boardData->maInt = NULL;
|
||||
pmcq1BoardData = boardData;
|
||||
|
||||
mc68360_scc_create_chip( boardData, int_vector );
|
||||
|
||||
/*
|
||||
@@ -494,22 +453,11 @@ unsigned int rsPMCQ1Init(void)
|
||||
*/
|
||||
pci_read_config_byte(busNo, slotNo, 0, 0x3c, &int_vector);
|
||||
#ifdef DEBUG_360
|
||||
printk("rsPMCQ1Init: PMCQ1 int_vector %d\n", int_vector);
|
||||
printk("PMCQ1 int_vector %d\n", int_vector);
|
||||
#endif
|
||||
|
||||
if ((IrqData = calloc( 1, sizeof(rtems_irq_connect_data) )) == NULL )
|
||||
{
|
||||
printk("rsPMCQ1Init: Error Unable to allocate memory for rtems_irq_connect_data\n");
|
||||
return(RTEMS_IO_ERROR);
|
||||
}
|
||||
IrqData->name = ((unsigned int)BSP_PCI_IRQ0 + int_vector);
|
||||
IrqData->hdl = rsPMCQ1Int;
|
||||
IrqData->handle = boardData;
|
||||
IrqData->on = rsPMCQ1_scc_On;
|
||||
IrqData->off = rsPMCQ1_scc_Off;
|
||||
IrqData->isOn = rsPMCQ1_scc_except_always_enabled;
|
||||
|
||||
if (!BSP_install_rtems_shared_irq_handler (IrqData)) {
|
||||
IrqData.name = ((unsigned int)BSP_PCI_IRQ0 + int_vector);
|
||||
IrqData.handle = boardData;
|
||||
if (!BSP_install_rtems_shared_irq_handler (&IrqData)) {
|
||||
printk("Error installing interrupt handler!\n");
|
||||
rtems_fatal_error_occurred(1);
|
||||
}
|
||||
@@ -517,10 +465,11 @@ unsigned int rsPMCQ1Init(void)
|
||||
/*
|
||||
* Enable PMCQ1 Interrupts from QSPAN-II
|
||||
*/
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x600) = 0x00001000;
|
||||
|
||||
*(unsigned long *)(bridgeaddr + 0x600) = 0x00001000;
|
||||
eieio();
|
||||
Processor_Synchronize();
|
||||
*(volatile unsigned long *)(bridgeaddr + 0x604) |= 0x00001000;
|
||||
*(unsigned long *)(bridgeaddr + 0x604) |= 0x00001000;
|
||||
|
||||
eieio();
|
||||
}
|
||||
|
||||
@@ -563,9 +512,9 @@ unsigned int rsPMCQ1Commission( unsigned long busNo, unsigned long slotNo )
|
||||
* A real PMCQ1 also has the sub vendor ID set up.
|
||||
*/
|
||||
if ((busNo == 0) && (slotNo == 1)) {
|
||||
*(volatile unsigned long *)rsPMCQ1eeprom = 0;
|
||||
*(unsigned long *)rsPMCQ1eeprom = 0;
|
||||
} else {
|
||||
*(volatile unsigned long *)rsPMCQ1eeprom = PCI_ID(PCI_VEN_ID_RADSTONE, PCI_DEV_ID_PMCQ1);
|
||||
*(unsigned long *)rsPMCQ1eeprom = PCI_ID(PCI_VEN_ID_RADSTONE, PCI_DEV_ID_PMCQ1);
|
||||
}
|
||||
|
||||
for (i = 0; i < 23; i++) {
|
||||
@@ -609,27 +558,20 @@ unsigned int rsPMCQ1Commission( unsigned long busNo, unsigned long slotNo )
|
||||
|
||||
uint32_t PMCQ1_Read_EPLD( uint32_t base, uint32_t reg )
|
||||
{
|
||||
uint32_t data;
|
||||
volatile uint32_t *ptr;
|
||||
uint32_t data;
|
||||
|
||||
Processor_Synchronize();
|
||||
ptr = (volatile uint32_t *)(base + reg);
|
||||
data = *ptr ;
|
||||
data = ( *((unsigned long *) (base + reg)) );
|
||||
#ifdef DEBUG_360
|
||||
printk("EPLD Read 0x%x: 0x%08x\n", ptr, data );
|
||||
printk("EPLD Read 0x%x: 0x%08x\n", reg + base, data );
|
||||
#endif
|
||||
return data;
|
||||
}
|
||||
|
||||
void PMCQ1_Write_EPLD( uint32_t base, uint32_t reg, uint32_t data )
|
||||
{
|
||||
volatile uint32_t *ptr;
|
||||
|
||||
ptr = (volatile uint32_t *) (base + reg);
|
||||
*ptr = data;
|
||||
Processor_Synchronize();
|
||||
*((unsigned long *) (base + reg)) = data;
|
||||
#ifdef DEBUG_360
|
||||
printk("EPLD Write 0x%x: 0x%08x\n", ptr, data );
|
||||
printk("EPLD Write 0x%x: 0x%08x\n", reg+base, data );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
01a,20Dec00,jpb created
|
||||
*/
|
||||
|
||||
#ifndef __RSPMCQ1_H
|
||||
#define __RSPMCQ1_H
|
||||
#ifndef __INCPMCQ1H
|
||||
#define __INCPMCQ1H
|
||||
|
||||
/*
|
||||
* PMCQ1 definitions
|
||||
@@ -95,6 +95,10 @@
|
||||
#define PMCQ1_MINIACE_MEM 0x00100000
|
||||
#define PMCQ1_RAM 0x00200000
|
||||
|
||||
/*
|
||||
#define PMCQ1_Read_EPLD( _base, _reg ) ( *((unsigned long *) ((unsigned32)_base + _reg)) )
|
||||
#define PMCQ1_Write_EPLD( _base, _reg, _data ) *((unsigned long *) ((unsigned32)_base + _reg)) = _data
|
||||
*/
|
||||
uint32_t PMCQ1_Read_EPLD( uint32_t base, uint32_t reg );
|
||||
void PMCQ1_Write_EPLD( uint32_t base, uint32_t reg, uint32_t data );
|
||||
|
||||
@@ -104,7 +108,7 @@ void PMCQ1_Write_EPLD( uint32_t base, uint32_t reg, uint32_t data );
|
||||
|
||||
#define QSPAN2_INT_STATUS 0x00000600
|
||||
|
||||
typedef void (*PMCQ1_FUNCTION_PTR) (void *);
|
||||
typedef void (*FUNCION_PTR) (int);
|
||||
|
||||
#define PCI_ID(v, d) ((d << 16) | v)
|
||||
|
||||
@@ -121,16 +125,16 @@ typedef void (*PMCQ1_FUNCTION_PTR) (void *);
|
||||
|
||||
typedef struct _PMCQ1BoardData
|
||||
{
|
||||
struct _PMCQ1BoardData *pNext;
|
||||
unsigned long busNo;
|
||||
unsigned long slotNo;
|
||||
unsigned long funcNo;
|
||||
unsigned long baseaddr;
|
||||
unsigned long bridgeaddr;
|
||||
PMCQ1_FUNCTION_PTR quiccInt;
|
||||
void * quiccArg;
|
||||
PMCQ1_FUNCTION_PTR maInt;
|
||||
void * maArg;
|
||||
struct _PMCQ1BoardData *pNext;
|
||||
unsigned long busNo;
|
||||
unsigned long slotNo;
|
||||
unsigned long funcNo;
|
||||
unsigned long baseaddr;
|
||||
unsigned long bridgeaddr;
|
||||
FUNCION_PTR quiccInt;
|
||||
int quiccArg;
|
||||
FUNCION_PTR maInt;
|
||||
int maArg;
|
||||
} PMCQ1BoardData, *PPMCQ1BoardData;
|
||||
|
||||
extern PPMCQ1BoardData pmcq1BoardData;
|
||||
@@ -142,18 +146,16 @@ extern unsigned int rsPMCQ1QuiccIntConnect(
|
||||
unsigned long busNo,
|
||||
unsigned long slotNo,
|
||||
unsigned long funcNo,
|
||||
PMCQ1_FUNCTION_PTR routine,
|
||||
void * arg
|
||||
FUNCION_PTR routine,
|
||||
int arg
|
||||
);
|
||||
unsigned int rsPMCQ1Init();
|
||||
unsigned int rsPMCQ1MaIntConnect (
|
||||
unsigned long busNo, /* Pci Bus number of PMCQ1 */
|
||||
unsigned long slotNo, /* Pci Slot number of PMCQ1 */
|
||||
unsigned long funcNo, /* Pci Function number of PMCQ1 */
|
||||
PMCQ1_FUNCTION_PTR routine,/* interrupt routine */
|
||||
void * arg /* argument to pass to interrupt routine */
|
||||
FUNCION_PTR routine,/* interrupt routine */
|
||||
int arg /* argument to pass to interrupt routine */
|
||||
);
|
||||
|
||||
void rsPMCQ1ShowIntrStatus(void );
|
||||
|
||||
#endif /* __RSPMCQ1_H */
|
||||
#endif /* __INCPMCQ1H */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -13,9 +13,6 @@
|
||||
#ifndef _BSP_H
|
||||
#define _BSP_H
|
||||
|
||||
|
||||
#define BSP_ZERO_WORKSPACE_AUTOMATICALLY TRUE
|
||||
|
||||
#include <bspopts.h>
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* This include file describe the data structure and the functions implemented
|
||||
* by RTEMS to write interrupt handlers.
|
||||
*
|
||||
* Copyright (C) 1999 valette@crf.canon.fr
|
||||
*
|
||||
* This code is heavilly inspired by the public specification of STREAM V2
|
||||
* that can be found at :
|
||||
*
|
||||
* <http://www.chorus.com/Documentation/index.html> by following
|
||||
* the STREAM API Specification Document link.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef BSP_POWERPC_IRQ_H
|
||||
#define BSP_POWERPC_IRQ_H
|
||||
|
||||
#define BSP_SHARED_HANDLER_SUPPORT 1
|
||||
#include <rtems/irq.h>
|
||||
|
||||
/* PIC's command and mask registers */
|
||||
#define PIC_MASTER_COMMAND_IO_PORT 0x20 /* Master PIC command register */
|
||||
#define PIC_SLAVE_COMMAND_IO_PORT 0xa0 /* Slave PIC command register */
|
||||
#define PIC_MASTER_IMR_IO_PORT 0x21 /* Master PIC Interrupt Mask Register */
|
||||
#define PIC_SLAVE_IMR_IO_PORT 0xa1 /* Slave PIC Interrupt Mask Register */
|
||||
|
||||
/* Command for specific EOI (End Of Interrupt): Interrupt acknowledge */
|
||||
#define PIC_EOSI 0x60 /* End of Specific Interrupt (EOSI) */
|
||||
#define SLAVE_PIC_EOSI 0x62 /* End of Specific Interrupt (EOSI) for cascade */
|
||||
#define PIC_EOI 0x20 /* Generic End of Interrupt (EOI) */
|
||||
|
||||
#ifndef ASM
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rtems_irq_number Definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* ISA IRQ handler related definitions
|
||||
*/
|
||||
#define BSP_ISA_IRQ_NUMBER (16)
|
||||
#define BSP_ISA_IRQ_LOWEST_OFFSET (0)
|
||||
#define BSP_ISA_IRQ_MAX_OFFSET \
|
||||
(BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER - 1)
|
||||
/*
|
||||
* PCI IRQ handlers related definitions
|
||||
* CAUTION : BSP_PCI_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE
|
||||
*/
|
||||
#define BSP_PCI_IRQ_NUMBER (26)
|
||||
#define BSP_PCI_IRQ_LOWEST_OFFSET (BSP_ISA_IRQ_NUMBER)
|
||||
#define BSP_PCI_IRQ_MAX_OFFSET \
|
||||
(BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1)
|
||||
|
||||
/*
|
||||
* PowerPC exceptions handled as interrupt where an RTEMS managed interrupt
|
||||
* handler might be connected
|
||||
*/
|
||||
#define BSP_PROCESSOR_IRQ_NUMBER (1)
|
||||
#define BSP_PROCESSOR_IRQ_LOWEST_OFFSET (BSP_PCI_IRQ_MAX_OFFSET + 1)
|
||||
#define BSP_PROCESSOR_IRQ_MAX_OFFSET \
|
||||
(BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1)
|
||||
/*
|
||||
* Misc vectors for OPENPIC irqs (IPI, timers)
|
||||
*/
|
||||
#define BSP_MISC_IRQ_NUMBER (8)
|
||||
#define BSP_MISC_IRQ_LOWEST_OFFSET (BSP_PROCESSOR_IRQ_LOWEST_OFFSET + 1)
|
||||
#define BSP_MISC_IRQ_MAX_OFFSET \
|
||||
(BSP_MISC_IRQ_LOWEST_OFFSET + BSP_MISC_IRQ_NUMBER - 1)
|
||||
/*
|
||||
* Summary
|
||||
*/
|
||||
#define BSP_IRQ_NUMBER (BSP_MISC_IRQ_MAX_OFFSET + 1)
|
||||
#define BSP_LOWEST_OFFSET (BSP_ISA_IRQ_LOWEST_OFFSET)
|
||||
#define BSP_MAX_OFFSET (BSP_MISC_IRQ_MAX_OFFSET)
|
||||
|
||||
|
||||
/*
|
||||
* Some PCI IRQ symbolic name definition
|
||||
*/
|
||||
#define BSP_PCI_IRQ0 (BSP_PCI_IRQ_LOWEST_OFFSET)
|
||||
|
||||
/*
|
||||
* Some Processor execption handled as RTEMS IRQ symbolic name definition
|
||||
*/
|
||||
#define BSP_DECREMENTER (BSP_PROCESSOR_IRQ_LOWEST_OFFSET)
|
||||
|
||||
/*
|
||||
* Type definition for RTEMS managed interrupts
|
||||
*/
|
||||
typedef unsigned short rtems_i8259_masks;
|
||||
extern volatile rtems_i8259_masks i8259s_cache;
|
||||
|
||||
/* Stuff in irq_supp.h should eventually go into <rtems/irq.h> */
|
||||
#include <bsp/irq_supp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -5,13 +5,13 @@
|
||||
*
|
||||
* CopyRight (C) 1999 valette@crf.canon.fr
|
||||
*
|
||||
* Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
|
||||
* to make it valid for MVME2300 Motorola boards.
|
||||
* Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
|
||||
* to make it valid for MVME2300 Motorola boards.
|
||||
*
|
||||
* Till Straumann <strauman@slac.stanford.edu>, 12/20/2001:
|
||||
* Use the new interface to openpic_init
|
||||
* Till Straumann <strauman@slac.stanford.edu>, 12/20/2001:
|
||||
* Use the new interface to openpic_init
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -32,91 +32,74 @@
|
||||
#include <bsp/motorola.h>
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
#if 0
|
||||
#define TRACE_IRQ_INIT 1 /* XXX */
|
||||
#endif
|
||||
/*
|
||||
#define SHOW_ISA_PCI_BRIDGE_SETTINGS
|
||||
*/
|
||||
#define TRACE_IRQ_INIT
|
||||
|
||||
typedef struct {
|
||||
unsigned char bus; /* few chance the PCI/ISA bridge is not on first bus but ... */
|
||||
unsigned char device;
|
||||
unsigned char function;
|
||||
} pci_isa_bridge_device;
|
||||
/*
|
||||
* default on/off function
|
||||
*/
|
||||
static void nop_func(void){}
|
||||
/*
|
||||
* default isOn function
|
||||
*/
|
||||
static int not_connected(void) {return 0;}
|
||||
/*
|
||||
* default possible isOn function
|
||||
*/
|
||||
static int connected(void) {return 1;}
|
||||
|
||||
pci_isa_bridge_device* via_82c586 = 0;
|
||||
#if 0
|
||||
static pci_isa_bridge_device bridge;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
extern unsigned int external_exception_vector_prolog_code_size[];
|
||||
extern void external_exception_vector_prolog_code();
|
||||
extern unsigned int decrementer_exception_vector_prolog_code_size[];
|
||||
extern void decrementer_exception_vector_prolog_code();
|
||||
|
||||
|
||||
static void IRQ_Default_rtems_irq_hdl( rtems_irq_hdl_param ptr ) { printk("IRQ_Default_rtems_irq_hdl\n"); }
|
||||
static void IRQ_Default_rtems_irq_enable (const struct __rtems_irq_connect_data__ *ptr) {}
|
||||
static void IRQ_Default_rtems_irq_disable(const struct __rtems_irq_connect_data__ *ptr) {}
|
||||
static int IRQ_Default_rtems_irq_is_enabled(const struct __rtems_irq_connect_data__ *ptr){ return 1; }
|
||||
static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER];
|
||||
static rtems_irq_global_settings initial_config;
|
||||
static rtems_irq_connect_data defaultIrq = {
|
||||
/*name, hdl handle on off isOn */
|
||||
0, IRQ_Default_rtems_irq_hdl, NULL, IRQ_Default_rtems_irq_enable, IRQ_Default_rtems_irq_disable, IRQ_Default_rtems_irq_is_enabled
|
||||
/* vectorIdex, hdl , handle , on , off , isOn */
|
||||
0, nop_func , NULL , nop_func , nop_func , not_connected
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* If the BSP_IRQ_NUMBER changes the following if will force the tables to be corrected.
|
||||
*/
|
||||
#if ( (BSP_ISA_IRQ_NUMBER == 16) && \
|
||||
(BSP_PCI_IRQ_NUMBER == 26) && \
|
||||
(BSP_PROCESSOR_IRQ_NUMBER == 1) && \
|
||||
(BSP_MISC_IRQ_NUMBER == 8) )
|
||||
|
||||
|
||||
static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
|
||||
/*
|
||||
* ISA interrupts.
|
||||
* actual rpiorities for interrupt :
|
||||
* 0 means that only current interrupt is masked
|
||||
* 255 means all other interrupts are masked
|
||||
*/
|
||||
0, 0,
|
||||
(OPENPIC_NUM_PRI-1),
|
||||
/*
|
||||
* ISA interrupts.
|
||||
* The second entry has a priority of 255 because
|
||||
* it is the slave pic entry and is should always remain
|
||||
* unmasked.
|
||||
*/
|
||||
0,0,
|
||||
255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
/*
|
||||
* PCI Interrupts
|
||||
*/
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* for raven prio 0 means unactive... */
|
||||
/*
|
||||
* Processor exceptions handled as interrupts
|
||||
*/
|
||||
8,
|
||||
|
||||
8, 8, 8, 8, 8, 8, 8, 8
|
||||
0
|
||||
};
|
||||
|
||||
static unsigned char mpc8245_openpic_initpolarities[] = {
|
||||
static unsigned char mcp750_openpic_initpolarities[] = {
|
||||
1, /* 0 8259 cascade */
|
||||
0, /* 1 */
|
||||
0, /* 2 */
|
||||
0, /* 3 */
|
||||
0, /* 4 */
|
||||
0, /* 5 */
|
||||
0, /* 6 */
|
||||
0, /* 7 */
|
||||
0, /* 8 */
|
||||
0, /* 9 */
|
||||
0, /* 10 */
|
||||
0, /* 11 */
|
||||
0, /* 12 */
|
||||
0, /* 13 */
|
||||
0, /* 14 */
|
||||
0, /* 15 */
|
||||
0, /* 16 */
|
||||
0, /* 17 */
|
||||
0, /* 1 all the rest of them */
|
||||
0, /* 2 all the rest of them */
|
||||
0, /* 3 all the rest of them */
|
||||
0, /* 4 all the rest of them */
|
||||
0, /* 5 all the rest of them */
|
||||
0, /* 6 all the rest of them */
|
||||
0, /* 7 all the rest of them */
|
||||
0, /* 8 all the rest of them */
|
||||
0, /* 9 all the rest of them */
|
||||
0, /* 10 all the rest of them */
|
||||
0, /* 11 all the rest of them */
|
||||
0, /* 12 all the rest of them */
|
||||
0, /* 13 all the rest of them */
|
||||
0, /* 14 all the rest of them */
|
||||
0, /* 15 all the rest of them */
|
||||
0, /* 16 all the rest of them */
|
||||
0, /* 17 all the rest of them */
|
||||
1, /* 18 all the rest of them */
|
||||
1, /* 19 all the rest of them */
|
||||
1, /* 20 all the rest of them */
|
||||
@@ -125,78 +108,25 @@ static unsigned char mpc8245_openpic_initpolarities[] = {
|
||||
1, /* 23 all the rest of them */
|
||||
1, /* 24 all the rest of them */
|
||||
1, /* 25 all the rest of them */
|
||||
1, /* 26 all the rest of them */
|
||||
1, /* 27 all the rest of them */
|
||||
1, /* 28 all the rest of them */
|
||||
1, /* 29 all the rest of them */
|
||||
1, /* 30 all the rest of them */
|
||||
1, /* 31 all the rest of them */
|
||||
1, /* 32 all the rest of them */
|
||||
1, /* 33 all the rest of them */
|
||||
1, /* 34 all the rest of them */
|
||||
1, /* 35 all the rest of them */
|
||||
1, /* 36 all the rest of them */
|
||||
1, /* 37 all the rest of them */
|
||||
1, /* 38 all the rest of them */
|
||||
1, /* 39 all the rest of them */
|
||||
1, /* 40 all the rest of them */
|
||||
1, /* 41 all the rest of them */
|
||||
1, /* 42 all the rest of them */
|
||||
1, /* 43 all the rest of them */
|
||||
1, /* 44 all the rest of them */
|
||||
1, /* 45 all the rest of them */
|
||||
1, /* 46 all the rest of them */
|
||||
1, /* 47 all the rest of them */
|
||||
1, /* 48 all the rest of them */
|
||||
1, /* 49 all the rest of them */
|
||||
1, /* 50 all the rest of them */
|
||||
1, /* 51 all the rest of them */
|
||||
|
||||
};
|
||||
|
||||
static unsigned char mpc8245_openpic_initsenses[] = {
|
||||
1, /* 0 */
|
||||
0, /* 1 */
|
||||
1, /* 2 */
|
||||
1, /* 3 */
|
||||
1, /* 4 */
|
||||
1, /* 5 */
|
||||
1, /* 6 */
|
||||
1, /* 7 */
|
||||
1, /* 8 */
|
||||
1, /* 9 */
|
||||
1, /*10 */
|
||||
1, /*11 */
|
||||
1, /*12 */
|
||||
1, /*13 */
|
||||
1, /*14 */
|
||||
1, /*15 */
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
static unsigned char mcp750_openpic_initsenses[] = {
|
||||
1, /* 0 MCP750_INT_PCB(8259) */
|
||||
0, /* 1 MCP750_INT_FALCON_ECC_ERR */
|
||||
1, /* 2 MCP750_INT_PCI_ETHERNET */
|
||||
1, /* 3 MCP750_INT_PCI_PMC */
|
||||
1, /* 4 MCP750_INT_PCI_WATCHDOG_TIMER1 */
|
||||
1, /* 5 MCP750_INT_PCI_PRST_SIGNAL */
|
||||
1, /* 6 MCP750_INT_PCI_FALL_SIGNAL */
|
||||
1, /* 7 MCP750_INT_PCI_DEG_SIGNAL */
|
||||
1, /* 8 MCP750_INT_PCI_BUS1_INTA */
|
||||
1, /* 9 MCP750_INT_PCI_BUS1_INTB */
|
||||
1, /*10 MCP750_INT_PCI_BUS1_INTC */
|
||||
1, /*11 MCP750_INT_PCI_BUS1_INTD */
|
||||
1, /*12 MCP750_INT_PCI_BUS2_INTA */
|
||||
1, /*13 MCP750_INT_PCI_BUS2_INTB */
|
||||
1, /*14 MCP750_INT_PCI_BUS2_INTC */
|
||||
1, /*15 MCP750_INT_PCI_BUS2_INTD */
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
@@ -208,7 +138,6 @@ static unsigned char mpc8245_openpic_initsenses[] = {
|
||||
1,
|
||||
1
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This code assumes the exceptions management setup has already
|
||||
@@ -218,41 +147,24 @@ static unsigned char mpc8245_openpic_initsenses[] = {
|
||||
*/
|
||||
void BSP_rtems_irq_mng_init(unsigned cpuId)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* First initialize the Interrupt management hardware
|
||||
*/
|
||||
#ifdef TRACE_IRQ_INIT
|
||||
uint32_t msr;
|
||||
|
||||
_CPU_MSR_GET( msr );
|
||||
printk("BSP_rtems_irq_mng_init: Initialize openpic compliant device with MSR %x \n", msr);
|
||||
printk(" BSP_ISA_IRQ_NUMBER %d\n",BSP_ISA_IRQ_NUMBER );
|
||||
printk(" BSP_ISA_IRQ_LOWEST_OFFSET %d\n",BSP_ISA_IRQ_LOWEST_OFFSET );
|
||||
printk(" BSP_ISA_IRQ_MAX_OFFSET %d\n", BSP_ISA_IRQ_MAX_OFFSET);
|
||||
printk(" BSP_PCI_IRQ_NUMBER %d\n",BSP_PCI_IRQ_NUMBER );
|
||||
printk(" BSP_PCI_IRQ_LOWEST_OFFSET %d\n",BSP_PCI_IRQ_LOWEST_OFFSET );
|
||||
printk(" BSP_PCI_IRQ_MAX_OFFSET %d\n",BSP_PCI_IRQ_MAX_OFFSET );
|
||||
printk(" BSP_PROCESSOR_IRQ_NUMBER %d\n",BSP_PROCESSOR_IRQ_NUMBER );
|
||||
printk(" BSP_PROCESSOR_IRQ_LOWEST_OFFSET %d\n",BSP_PROCESSOR_IRQ_LOWEST_OFFSET );
|
||||
printk(" BSP_PROCESSOR_IRQ_MAX_OFFSET %d\n", BSP_PROCESSOR_IRQ_MAX_OFFSET);
|
||||
printk(" BSP_MISC_IRQ_NUMBER %d\n", BSP_MISC_IRQ_NUMBER);
|
||||
printk(" BSP_MISC_IRQ_LOWEST_OFFSET %d\n", BSP_MISC_IRQ_LOWEST_OFFSET);
|
||||
printk(" BSP_MISC_IRQ_MAX_OFFSET %d\n",BSP_MISC_IRQ_MAX_OFFSET );
|
||||
printk(" BSP_IRQ_NUMBER %d\n",BSP_IRQ_NUMBER );
|
||||
printk(" BSP_LOWEST_OFFSET %d\n",BSP_LOWEST_OFFSET );
|
||||
printk(" BSP_MAX_OFFSET %d\n",BSP_MAX_OFFSET );
|
||||
#endif
|
||||
|
||||
printk("Going to initialize openpic compliant device\n");
|
||||
#endif
|
||||
/* FIXME (t.s.): we should probably setup the EOI delay by
|
||||
* passing a non-zero 'epic_freq' argument (frequency of the
|
||||
* EPIC serial interface) but I don't know the value on this
|
||||
* board (8245 SDRAM freq, IIRC)...
|
||||
*
|
||||
* When tested this appears to work correctly.
|
||||
*/
|
||||
openpic_init(1, mpc8245_openpic_initpolarities, mpc8245_openpic_initsenses, 0, 0, 0);
|
||||
openpic_init(1, mcp750_openpic_initpolarities, mcp750_openpic_initsenses, 0, 16, 0 /* epic_freq */);
|
||||
|
||||
#ifdef TRACE_IRQ_INIT
|
||||
printk("Going to initialize the PCI/ISA bridge IRQ related setting (VIA 82C586)\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize Rtems management interrupt table
|
||||
@@ -263,11 +175,7 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
|
||||
for (i = 0; i < BSP_IRQ_NUMBER; i++) {
|
||||
rtemsIrq[i] = defaultIrq;
|
||||
rtemsIrq[i].name = i;
|
||||
#ifdef BSP_SHARED_HANDLER_SUPPORT
|
||||
rtemsIrq[i].next_handler = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Init initial Interrupt management config
|
||||
*/
|
||||
@@ -277,20 +185,14 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
|
||||
initial_config.irqBase = BSP_LOWEST_OFFSET;
|
||||
initial_config.irqPrioTbl = irqPrioTable;
|
||||
|
||||
|
||||
#ifdef TRACE_IRQ_INIT
|
||||
_CPU_MSR_GET( msr );
|
||||
printk("BSP_rtems_irq_mng_init: Set initial configuration with MSR %x\n", msr);
|
||||
#endif
|
||||
printk("Call BSP_rtems_irq_mngt_set\n");
|
||||
if (!BSP_rtems_irq_mngt_set(&initial_config)) {
|
||||
/*
|
||||
* put something here that will show the failure...
|
||||
*/
|
||||
BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
|
||||
} else {
|
||||
printk(" Initialized RTEMS Interrupt Manager\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef TRACE_IRQ_INIT
|
||||
printk("RTEMS IRQ management is now operationnal\n");
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <bsp/vectors.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rtems/bspIo.h>
|
||||
#include <rtems/bspIo.h> /* for printk */
|
||||
#define RAVEN_INTR_ACK_REG 0xfeff0030
|
||||
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
@@ -41,31 +41,28 @@ rtems_i8259_masks irq_mask_or_tbl[BSP_IRQ_NUMBER];
|
||||
/*
|
||||
* default handler connected on each irq after bsp initialization
|
||||
*/
|
||||
static rtems_irq_connect_data default_rtems_entry;
|
||||
static rtems_irq_connect_data* rtems_hdl_tbl;
|
||||
static rtems_irq_connect_data default_rtems_entry;
|
||||
|
||||
static rtems_irq_connect_data* rtems_hdl_tbl;
|
||||
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
/*
|
||||
* Check if IRQ is an ISA IRQ
|
||||
*/
|
||||
static inline int is_isa_irq(const rtems_irq_number irqLine)
|
||||
{
|
||||
if ( BSP_ISA_IRQ_NUMBER == 0 )
|
||||
return FALSE;
|
||||
|
||||
return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) &&
|
||||
return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) &
|
||||
((int) irqLine >= BSP_ISA_IRQ_LOWEST_OFFSET)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check if IRQ is an OPENPIC IRQ
|
||||
*/
|
||||
static inline int is_pci_irq(const rtems_irq_number irqLine)
|
||||
{
|
||||
if ( BSP_PCI_IRQ_NUMBER == 0 )
|
||||
return FALSE;
|
||||
|
||||
return (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) &&
|
||||
return (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) &
|
||||
((int) irqLine >= BSP_PCI_IRQ_LOWEST_OFFSET)
|
||||
);
|
||||
}
|
||||
@@ -101,34 +98,46 @@ static void compute_i8259_masks_from_prio (rtems_irq_global_settings* config)
|
||||
}
|
||||
#endif
|
||||
|
||||
void BSP_enable_irq_at_pic(const rtems_irq_number name)
|
||||
void
|
||||
BSP_enable_irq_at_pic(const rtems_irq_number name)
|
||||
{
|
||||
if (is_isa_irq(name)) {
|
||||
printk("BSP_enable_irq_at_pic: called with isa irq\n");
|
||||
}
|
||||
if (is_pci_irq(name)) {
|
||||
/*
|
||||
* enable interrupt at OPENPIC level.
|
||||
*/
|
||||
openpic_enable_irq ( ((int)name - BSP_PCI_IRQ_LOWEST_OFFSET) + 16 );
|
||||
}
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
if (is_isa_irq(name)) {
|
||||
/*
|
||||
* Enable interrupt at PIC level
|
||||
*/
|
||||
printk("ERROR BSP_irq_enable_at_i8259s Being Called for %d\n", (int)name);
|
||||
BSP_irq_enable_at_i8259s ((int) name);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (is_pci_irq(name)) {
|
||||
/*
|
||||
* Enable interrupt at OPENPIC level
|
||||
*/
|
||||
printk(" openpic_enable_irq %d\n", (int)name );
|
||||
openpic_enable_irq ((int) name);
|
||||
}
|
||||
}
|
||||
|
||||
int BSP_disable_irq_at_pic(const rtems_irq_number name)
|
||||
int
|
||||
BSP_disable_irq_at_pic(const rtems_irq_number name)
|
||||
{
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
if (is_isa_irq(name)) {
|
||||
/*
|
||||
* disable interrupt at PIC level
|
||||
*/
|
||||
printk("BSP_disable_irq_at_pic: called with isa irq\n");
|
||||
return BSP_irq_disable_at_i8259s ((int) name);
|
||||
}
|
||||
#endif
|
||||
if (is_pci_irq(name)) {
|
||||
/*
|
||||
* disable interrupt at OPENPIC level
|
||||
*/
|
||||
return openpic_disable_irq (((int) name - BSP_PCI_IRQ_LOWEST_OFFSET) + 16 );
|
||||
return openpic_disable_irq ((int) name );
|
||||
}
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -137,23 +146,23 @@ int BSP_disable_irq_at_pic(const rtems_irq_number name)
|
||||
int BSP_setup_the_pic(rtems_irq_global_settings* config)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Store various code accelerators
|
||||
*/
|
||||
default_rtems_entry = config->defaultEntry;
|
||||
rtems_hdl_tbl = config->irqHdlTbl;
|
||||
|
||||
rtems_hdl_tbl = config->irqHdlTbl;
|
||||
|
||||
/*
|
||||
* set up internal tables used by rtems interrupt prologue
|
||||
*/
|
||||
#if 0
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
/*
|
||||
* start with ISA IRQ
|
||||
*/
|
||||
compute_i8259_masks_from_prio (config);
|
||||
|
||||
for (i=BSP_ISA_IRQ_LOWEST_OFFSET; (i < (BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER)); i++) {
|
||||
for (i=BSP_ISA_IRQ_LOWEST_OFFSET; i < BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER; i++) {
|
||||
if (rtems_hdl_tbl[i].hdl != default_rtems_entry.hdl) {
|
||||
BSP_irq_enable_at_i8259s (i);
|
||||
}
|
||||
@@ -168,6 +177,7 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
|
||||
*/
|
||||
BSP_irq_enable_at_i8259s (2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -180,26 +190,27 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
|
||||
openpic_set_source_priority(i - BSP_PCI_IRQ_LOWEST_OFFSET,
|
||||
config->irqPrioTbl[i]);
|
||||
if (rtems_hdl_tbl[i].hdl != default_rtems_entry.hdl) {
|
||||
openpic_enable_irq ((int) i - BSP_PCI_IRQ_LOWEST_OFFSET);
|
||||
openpic_enable_irq ((int) i );
|
||||
}
|
||||
else {
|
||||
openpic_disable_irq ((int) i - BSP_PCI_IRQ_LOWEST_OFFSET);
|
||||
openpic_disable_irq ((int) i );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
if ( BSP_ISA_IRQ_NUMBER > 0 ) {
|
||||
/*
|
||||
* Must enable PCI/ISA bridge IRQ
|
||||
*/
|
||||
openpic_enable_irq (0);
|
||||
/*
|
||||
* Must enable PCI/ISA bridge IRQ
|
||||
*/
|
||||
openpic_enable_irq (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _BSP_vme_bridge_irq = -1;
|
||||
|
||||
unsigned BSP_spuriousIntr = 0;
|
||||
|
||||
/*
|
||||
@@ -213,24 +224,29 @@ int C_dispatch_irq_handler (BSP_Exception_frame *frame, unsigned int excNum)
|
||||
register unsigned oldMask = 0; /* old isa pic masks */
|
||||
register unsigned newMask; /* new isa pic masks */
|
||||
#endif
|
||||
|
||||
if (excNum == ASM_DEC_VECTOR) {
|
||||
bsp_irq_dispatch_list_base(rtems_hdl_tbl, BSP_DECREMENTER, default_rtems_entry.hdl);
|
||||
/* printk("ASM_DEC_VECTOR\n"); */
|
||||
bsp_irq_dispatch_list(rtems_hdl_tbl, BSP_DECREMENTER, default_rtems_entry.hdl);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
irq = openpic_irq(0);
|
||||
if (irq == OPENPIC_VEC_SPURIOUS) {
|
||||
printk("OPENPIC_VEC_SPURIOUS interrupt %d\n", OPENPIC_VEC_SPURIOUS );
|
||||
++BSP_spuriousIntr;
|
||||
/* printk("OPENPIC_VEC_SPURIOUS interrupt %d\n", OPENPIC_VEC_SPURIOUS ); */
|
||||
++BSP_spuriousIntr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* some BSPs might want to use a different numbering... */
|
||||
irq = irq - OPENPIC_VEC_SOURCE ;
|
||||
irq = irq - OPENPIC_VEC_SOURCE + BSP_PCI_IRQ_LOWEST_OFFSET;
|
||||
/* printk("OpenPic Irq: %d\n", irq); */
|
||||
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
isaIntr = (irq == BSP_PCI_ISA_BRIDGE_IRQ);
|
||||
if (isaIntr) {
|
||||
/* printk("BSP_PCI_ISA_BRIDGE_IRQ\n"); */
|
||||
/*
|
||||
* Acknowledge and read 8259 vector
|
||||
*/
|
||||
@@ -248,28 +264,30 @@ int C_dispatch_irq_handler (BSP_Exception_frame *frame, unsigned int excNum)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* dispatch handlers */
|
||||
bsp_irq_dispatch_list_base(rtems_hdl_tbl, irq, default_rtems_entry.hdl);
|
||||
/* printk("dispatch\n"); */
|
||||
irq -=16;
|
||||
bsp_irq_dispatch_list(rtems_hdl_tbl, irq, default_rtems_entry.hdl);
|
||||
/* printk("Back from dispatch\n"); */
|
||||
|
||||
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
|
||||
if (isaIntr) {
|
||||
if (isaIntr) {\
|
||||
i8259s_cache = oldMask;
|
||||
outport_byte(PIC_MASTER_IMR_IO_PORT, i8259s_cache & 0xff);
|
||||
outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
{
|
||||
#ifdef BSP_PCI_VME_DRIVER_DOES_EOI
|
||||
/* leave it to the VME bridge driver to do EOI, so
|
||||
/* leave it to the VME bridge driver to do EOI, so
|
||||
* it can re-enable the openpic while handling
|
||||
* VME interrupts (-> VME priorities in software)
|
||||
*/
|
||||
if (_BSP_vme_bridge_irq != irq)
|
||||
*/
|
||||
if (_BSP_vme_bridge_irq != irq)
|
||||
#endif
|
||||
openpic_eoi(0);
|
||||
openpic_eoi(0);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ $(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/pci.h: ../../powerpc/shared/pci/pci.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/pci.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/pci.h
|
||||
$(PROJECT_INCLUDE)/bsp/uart.h: ../../powerpc/shared/console/uart.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/uart.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/uart.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/motorola.h: ../../powerpc/shared/motorola/motorola.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/motorola.h
|
||||
@@ -81,7 +81,15 @@ $(PROJECT_INCLUDE)/bsp/rsPMCQ1.h: console/rsPMCQ1.h $(PROJECT_INCLUDE)/bsp/$(dir
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/rsPMCQ1.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/rsPMCQ1.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(PROJECT_INCLUDE)/bsp/openpic.h: ../../powerpc/shared/openpic/openpic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/openpic.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/openpic.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/pci.h: ../../powerpc/shared/pci/pci.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/pci.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/pci.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/irq.h: ../../powerpc/shared/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
|
||||
|
||||
@@ -97,10 +105,6 @@ $(PROJECT_INCLUDE)/bsp/irq_supp.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bsps
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq_supp.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq_supp.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/openpic.h: ../../powerpc/shared/openpic/openpic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/openpic.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/openpic.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/vmeUniverse.h: ../../shared/vmeUniverse/vmeUniverse.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/vmeUniverse.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/vmeUniverse.h
|
||||
|
||||
@@ -114,10 +114,6 @@ __rtems_entry_point:
|
||||
lis sp,__stack@h
|
||||
ori sp,sp,__stack@l
|
||||
|
||||
lis r13,_SDA_BASE_@ha
|
||||
la r13,_SDA_BASE_@l(r13) /* Read-write small data */
|
||||
|
||||
|
||||
/* set up initial stack frame */
|
||||
addi sp,sp,-4 /* make sure we don't overwrite debug mem */
|
||||
lis r0,0
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* The generic CPU dependent initialization has been performed
|
||||
* before this routine is invoked.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -14,7 +14,7 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define SHOW_MORE_INIT_SETTINGS
|
||||
#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <libcpu/cpuIdent.h>
|
||||
#include <bsp/vectors.h>
|
||||
#include <rtems/powerpc/powerpc.h>
|
||||
#include <bsp/ppc_exc_bspsupp.h>
|
||||
|
||||
extern unsigned long __rtems_end[];
|
||||
extern void L1_caches_enables(void);
|
||||
@@ -94,13 +93,6 @@ uint32_t VME_Slot1 = FALSE;
|
||||
extern int RAM_END;
|
||||
unsigned int BSP_mem_size = (unsigned int)&RAM_END;
|
||||
|
||||
/*
|
||||
* Where the heap starts; is used by bsp_pretasking_hook;
|
||||
*/
|
||||
unsigned int BSP_heap_start;
|
||||
uint32_t BSP_intrStackStart;
|
||||
uint32_t BSP_intrStackSize;
|
||||
|
||||
/*
|
||||
* PCI Bus Frequency
|
||||
*/
|
||||
@@ -113,15 +105,13 @@ unsigned int BSP_processor_frequency;
|
||||
|
||||
/*
|
||||
* Time base divisior (how many tick for 1 second).
|
||||
* Calibrated by outputing a 20 ms pulse.
|
||||
*/
|
||||
unsigned int BSP_time_base_divisor = 1320;
|
||||
unsigned int BSP_time_base_divisor = 1000; /* XXX - Just a guess */
|
||||
|
||||
/*
|
||||
* system init stack
|
||||
*/
|
||||
#define INIT_STACK_SIZE 0x2000
|
||||
#define INTR_STACK_SIZE rtems_configuration_get_interrupt_stack_size()
|
||||
#define INIT_STACK_SIZE 0x1000
|
||||
|
||||
void BSP_panic(char *s)
|
||||
{
|
||||
@@ -180,38 +170,6 @@ void BSP_FLASH_set_page(
|
||||
|
||||
void bsp_libc_init( void *, uint32_t, int );
|
||||
|
||||
|
||||
void ShowMemoryLayout(){
|
||||
extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
|
||||
extern unsigned long __SBSS2_START__[], __SBSS2_END__[];
|
||||
extern unsigned long __bss_start[];
|
||||
extern unsigned long __bss_end[];
|
||||
extern unsigned long __stack[];
|
||||
extern unsigned long __stackLow[];
|
||||
extern uint32_t end;
|
||||
/* extern uint32_t BSP_intrStackStart; */
|
||||
/* extern uint32_t BSP_intrStackSize; */
|
||||
/* Configuration.work_space_start */
|
||||
/* rtems_configuration_get_work_space_size() */
|
||||
printk(" bss start: 0x%x\n", __bss_start);
|
||||
printk(" bss end: 0x%x\n", __bss_end);
|
||||
printk(" rtems end: 0x%x\n", __rtems_end);
|
||||
printk(" stack : 0x%x\n", __stack);
|
||||
printk(" stack Low: 0x%x\n", __stackLow);
|
||||
printk(" end : 0x%x\n", &end);
|
||||
printk(" Intr Stack: 0x%x\n", BSP_intrStackStart);
|
||||
printk(" Intr Stack Size: 0x%x\n", BSP_intrStackSize);
|
||||
printk(" Heap start: %x\n", BSP_heap_start);
|
||||
|
||||
printk(" workspace start: 0x%x\n", Configuration.work_space_start);
|
||||
printk(" workspace size: 0x%x\n", rtems_configuration_get_work_space_size() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Function: bsp_pretasking_hook
|
||||
* Created: 95/03/10
|
||||
@@ -228,30 +186,28 @@ void ShowMemoryLayout(){
|
||||
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
uint32_t heap_start = BSP_heap_start;
|
||||
uint32_t heap_start;
|
||||
uint32_t heap_size;
|
||||
uint32_t heap_sbrk_spared;
|
||||
|
||||
extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*);
|
||||
extern uint32_t end;
|
||||
|
||||
heap_start = ((uint32_t) __rtems_end) +
|
||||
INIT_STACK_SIZE + rtems_configuration_get_interrupt_stack_size();
|
||||
if (heap_start & (CPU_ALIGNMENT-1))
|
||||
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
|
||||
heap_start = (BSP_heap_start + CPU_ALIGNMENT - 1) & ~(CPU_ALIGNMENT-1);
|
||||
heap_size = (uint32_t) &RAM_END;
|
||||
heap_size = heap_size - heap_start - Configuration.work_space_size;
|
||||
heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */
|
||||
heap_size = (BSP_mem_size - heap_start) - rtems_configuration_get_work_space_size();
|
||||
|
||||
#if 0 /*XXXXXXX */
|
||||
heap_size = Configuration.work_space_start - (void *)&end;
|
||||
heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */
|
||||
#endif
|
||||
heap_sbrk_spared=_bsp_sbrk_init(heap_start, &heap_size);
|
||||
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk(" HEAP start 0x%x size %x \n",
|
||||
heap_start, heap_size, 0 );
|
||||
printk(" HEAP start %x size %x (%x bytes spared for sbrk)\n",
|
||||
heap_start, heap_size, heap_sbrk_spared);
|
||||
#endif
|
||||
|
||||
bsp_libc_init((void *)heap_start, heap_size, 0);
|
||||
bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared);
|
||||
rsPMCQ1Init();
|
||||
ShowMemoryLayout();
|
||||
}
|
||||
|
||||
void zero_bss()
|
||||
@@ -276,8 +232,21 @@ void save_boot_params(RESIDUAL* r3, void *r4, void* r5, char *additional_boot_op
|
||||
unsigned int EUMBBAR;
|
||||
|
||||
unsigned int get_eumbbar() {
|
||||
out_le32( (uint32_t*)0xfec00000, 0x80000078 );
|
||||
return in_le32( (uint32_t*)0xfee00000 );
|
||||
register int a, e;
|
||||
|
||||
asm volatile( "lis %0,0xfec0; ori %0,%0,0x0000": "=r" (a) );
|
||||
asm volatile("sync");
|
||||
|
||||
asm volatile("lis %0,0x8000; ori %0,%0,0x0078": "=r"(e) );
|
||||
asm volatile("stwbrx %0,0x0,%1": "=r"(e): "r"(a));
|
||||
asm volatile("sync");
|
||||
|
||||
asm volatile("lis %0,0xfee0; ori %0,%0,0x0000": "=r" (a) );
|
||||
asm volatile("sync");
|
||||
|
||||
asm volatile("lwbrx %0,0x0,%1": "=r" (e): "r" (a));
|
||||
asm volatile("isync");
|
||||
return e;
|
||||
}
|
||||
|
||||
void Read_ep1a_config_registers( ppc_cpu_id_t myCpu ) {
|
||||
@@ -348,7 +317,6 @@ void Read_ep1a_config_registers( ppc_cpu_id_t myCpu ) {
|
||||
BSP_bus_frequency = 33000000;
|
||||
break;
|
||||
}
|
||||
printk("Processor Frequency %d Bus Frequency: %d\n", BSP_processor_frequency, BSP_bus_frequency );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -360,6 +328,8 @@ void Read_ep1a_config_registers( ppc_cpu_id_t myCpu ) {
|
||||
void bsp_start( void )
|
||||
{
|
||||
unsigned char *stack;
|
||||
uint32_t intrStackStart;
|
||||
uint32_t intrStackSize;
|
||||
unsigned char *work_space_start;
|
||||
ppc_cpu_id_t myCpu;
|
||||
ppc_cpu_revision_t myCpuRevision;
|
||||
@@ -376,22 +346,15 @@ void bsp_start( void )
|
||||
EUMBBAR = get_eumbbar();
|
||||
printk("EUMBBAR 0x%08x\n", EUMBBAR );
|
||||
|
||||
/*
|
||||
* Init MMU block address translation to enable hardware
|
||||
* access
|
||||
*/
|
||||
setdbat(1, 0xf0000000, 0xf0000000, 0x10000000, IO_PAGE);
|
||||
setdbat(2, 0x80000000, 0x80000000, 0x10000000, IO_PAGE);
|
||||
setdbat(3, 0x90000000, 0x90000000, 0x10000000, IO_PAGE);
|
||||
ShowBATS();
|
||||
|
||||
/*
|
||||
* Note this sets BSP_processor_frequency based upon register settings.
|
||||
* It must be done prior to setting up hooks.
|
||||
*/
|
||||
Read_ep1a_config_registers( myCpu );
|
||||
|
||||
bsp_clicks_per_usec = BSP_processor_frequency/(BSP_time_base_divisor * 1000);
|
||||
|
||||
ShowBATS();
|
||||
#if 0 /* XXX - Add back in cache enable when we get this up and running!! */
|
||||
/*
|
||||
* enables L1 Cache. Note that the L1_caches_enables() codes checks for
|
||||
@@ -400,35 +363,41 @@ ShowBATS();
|
||||
L1_caches_enables();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* the initial stack has aready been set to this value in start.S
|
||||
* so there is no need to set it in r1 again... It is just for info
|
||||
* so that It can be printed without accessing R1.
|
||||
*/
|
||||
stack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE - PPC_MINIMUM_STACK_FRAME_SIZE;
|
||||
|
||||
/* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
|
||||
*((uint32_t *)stack) = 0;
|
||||
|
||||
/*
|
||||
* Initialize the interrupt related settings.
|
||||
*/
|
||||
BSP_intrStackStart = (uint32_t) __rtems_end + INIT_STACK_SIZE;
|
||||
BSP_intrStackSize = rtems_configuration_get_interrupt_stack_size();
|
||||
BSP_heap_start = BSP_intrStackStart + BSP_intrStackSize;
|
||||
printk("Interrupt Stack Start: 0x%x Size: 0x%x Heap Start: 0x%x\n",
|
||||
BSP_intrStackStart, BSP_intrStackSize, BSP_heap_start
|
||||
);
|
||||
|
||||
/* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
|
||||
*((uint32_t *)BSP_intrStackStart) = 0;
|
||||
intrStackStart = (uint32_t) __rtems_end + INIT_STACK_SIZE;
|
||||
intrStackSize = rtems_configuration_get_interrupt_stack_size();
|
||||
|
||||
/*
|
||||
* Initialize default raw exception hanlders.
|
||||
*/
|
||||
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("bsp_start: Initialize Exceptions\n");
|
||||
#endif
|
||||
ppc_exc_cache_wb_check = 0;
|
||||
ppc_exc_initialize(
|
||||
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
|
||||
BSP_intrStackStart,
|
||||
BSP_intrStackSize
|
||||
intrStackStart,
|
||||
intrStackSize
|
||||
);
|
||||
|
||||
/*
|
||||
* Init MMU block address translation to enable hardware
|
||||
* access
|
||||
*/
|
||||
setdbat(1, 0xf0000000, 0xf0000000, 0x10000000, IO_PAGE);
|
||||
setdbat(3, 0x90000000, 0x90000000, 0x10000000, IO_PAGE);
|
||||
|
||||
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("bsp_start: Going to start PCI buses scanning and initialization\n");
|
||||
printk("Going to start PCI buses scanning and initialization\n");
|
||||
#endif
|
||||
pci_initialize();
|
||||
|
||||
@@ -436,7 +405,7 @@ ShowBATS();
|
||||
printk("Number of PCI buses found is : %d\n", pci_bus_count());
|
||||
#endif
|
||||
#ifdef TEST_RAW_EXCEPTION_CODE
|
||||
printk("bsp_start: Testing exception handling Part 1\n");
|
||||
printk("Testing exception handling Part 1\n");
|
||||
|
||||
/*
|
||||
* Cause a software exception
|
||||
@@ -446,45 +415,28 @@ ShowBATS();
|
||||
/*
|
||||
* Check we can still catch exceptions and returned coorectly.
|
||||
*/
|
||||
printk("bsp_start: Testing exception handling Part 2\n");
|
||||
printk("Testing exception handling Part 2\n");
|
||||
__asm__ __volatile ("sc");
|
||||
#endif
|
||||
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("bsp_start: rtems_configuration_get_work_space_size() = %x\n",
|
||||
printk("rtems_configuration_get_work_space_size() = %x\n",
|
||||
rtems_configuration_get_work_space_size());
|
||||
#endif
|
||||
work_space_start =
|
||||
(unsigned char *)&RAM_END - rtems_configuration_get_work_space_size();
|
||||
(unsigned char *)BSP_mem_size - rtems_configuration_get_work_space_size();
|
||||
|
||||
if ( work_space_start <= ((unsigned char *)__rtems_end) +
|
||||
INIT_STACK_SIZE + rtems_configuration_get_interrupt_stack_size()) {
|
||||
printk( "bspstart: Not enough RAM!!!\n" );
|
||||
bsp_cleanup();
|
||||
}
|
||||
|
||||
Configuration.work_space_start = work_space_start;
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("bsp_start: workspace_start = 0x%x\n",
|
||||
work_space_start);
|
||||
#endif
|
||||
|
||||
#if ( PPC_USE_DATA_CACHE )
|
||||
#if DEBUG
|
||||
printk("bsp_start: cache_enable\n");
|
||||
#endif
|
||||
instruction_cache_enable ();
|
||||
data_cache_enable ();
|
||||
#if DEBUG
|
||||
printk("bsp_start: END PPC_USE_DATA_CACHE\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Initalize RTEMS IRQ system
|
||||
*/
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("bspstart: Call BSP_rtems_irq_mng_init\n");
|
||||
#endif
|
||||
BSP_rtems_irq_mng_init(0);
|
||||
|
||||
/* Activate the page table mappings only after
|
||||
@@ -493,7 +445,7 @@ ShowBATS();
|
||||
*/
|
||||
if (pt) {
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("bspstart: Page table setup finished; will activate it NOW...\n");
|
||||
printk("Page table setup finished; will activate it NOW...\n");
|
||||
#endif
|
||||
BSP_pgtbl_activate(pt);
|
||||
}
|
||||
@@ -503,7 +455,7 @@ ShowBATS();
|
||||
* and IRQ subsystems...
|
||||
*/
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("bspstart: Going to initialize VME bridge\n");
|
||||
printk("Going to initialize VME bridge\n");
|
||||
#endif
|
||||
/* VME initialization is in a separate file so apps which don't use
|
||||
* VME or want a different configuration may link against a customized
|
||||
|
||||
@@ -152,9 +152,7 @@ SECTIONS
|
||||
*(COMMON)
|
||||
PROVIDE (__bss_end = .);
|
||||
}
|
||||
. = ALIGN(0x100);
|
||||
PROVIDE (__stackLow = .);
|
||||
. += 0x8000;
|
||||
. = ALIGN(8) + 0x8000;
|
||||
PROVIDE (__stack = .);
|
||||
_end = . ;
|
||||
__rtems_end = . ;
|
||||
|
||||
@@ -77,8 +77,7 @@
|
||||
* at _VME_DRAM_OFFSET
|
||||
*/
|
||||
#undef _VME_DRAM_OFFSET
|
||||
/* #define _VME_DRAM_OFFSET 0xc0000000 */
|
||||
|
||||
#define _VME_DRAM_OFFSET 0xc0000000
|
||||
#define _VME_DRAM_32_OFFSET1 0x20000000
|
||||
#define _VME_DRAM_32_OFFSET2 0x20b00000
|
||||
#define _VME_DRAM_24_OFFSET1 0x00000000
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Default VME bridge configuration - note that this file
|
||||
* is independent of the bridge driver/chip
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authorship
|
||||
* ----------
|
||||
* This software was created by
|
||||
* Till Straumann <strauman@slac.stanford.edu>, 3/2002,
|
||||
* Stanford Linear Accelerator Center, Stanford University.
|
||||
*
|
||||
* Acknowledgement of sponsorship
|
||||
* ------------------------------
|
||||
* This software was produced by
|
||||
* the Stanford Linear Accelerator Center, Stanford University,
|
||||
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
||||
*
|
||||
* Government disclaimer of liability
|
||||
* ----------------------------------
|
||||
* Neither the United States nor the United States Department of Energy,
|
||||
* nor any of their employees, makes any warranty, express or implied, or
|
||||
* assumes any legal liability or responsibility for the accuracy,
|
||||
* completeness, or usefulness of any data, apparatus, product, or process
|
||||
* disclosed, or represents that its use would not infringe privately owned
|
||||
* rights.
|
||||
*
|
||||
* Stanford disclaimer of liability
|
||||
* --------------------------------
|
||||
* Stanford University makes no representations or warranties, express or
|
||||
* implied, nor assumes any liability for the use of this software.
|
||||
*
|
||||
* Stanford disclaimer of copyright
|
||||
* --------------------------------
|
||||
* Stanford University, owner of the copyright, hereby disclaims its
|
||||
* copyright and all other rights in this software. Hence, anyone may
|
||||
* freely use it for any purpose without restriction.
|
||||
*
|
||||
* Maintenance of notices
|
||||
* ----------------------
|
||||
* In the interest of clarity regarding the origin and status of this
|
||||
* SLAC software, this and all the preceding Stanford University notices
|
||||
* are to remain affixed to any copy or derivative of this software made
|
||||
* or distributed by the recipient and are to be affixed to any copy of
|
||||
* software made or distributed by the recipient that contains a copy or
|
||||
* derivative of this software.
|
||||
*
|
||||
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/VME.h>
|
||||
#include <bsp/VMEConfig.h>
|
||||
#ifdef BSP_VME_BAT_IDX
|
||||
#include <libcpu/bat.h>
|
||||
#endif
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
extern int BSP_VMEInit(void);
|
||||
extern int BSP_VMEIrqMgrInstall(void);
|
||||
|
||||
/* Use a weak alias for the VME configuration.
|
||||
* This permits individual applications to override
|
||||
* this routine.
|
||||
* They may even create an 'empty'
|
||||
*
|
||||
* void BSP_vme_config(void) {}
|
||||
*
|
||||
* which will avoid linking in the Universe driver
|
||||
* at all :-).
|
||||
*/
|
||||
|
||||
void BSP_vme_config(void)
|
||||
__attribute__ (( weak, alias("__BSP_EP1A_vme_config") ));
|
||||
|
||||
void __BSP_EP1A_vme_config(void)
|
||||
{
|
||||
if ( BSP_VMEInit() ) {
|
||||
printk("Skipping VME initialization...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef BSP_VME_BAT_IDX
|
||||
printk("BSP_VME_BAT_IDX\n");
|
||||
/* setup a PCI area to map the VME bus */
|
||||
setdbat(BSP_VME_BAT_IDX,
|
||||
PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
|
||||
PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
|
||||
0x10000000,
|
||||
IO_PAGE);
|
||||
#endif
|
||||
|
||||
/* map VME address ranges */
|
||||
BSP_VMEOutboundPortCfg(
|
||||
0,
|
||||
VME_AM_EXT_SUP_DATA,
|
||||
_VME_A32_WIN0_ON_VME,
|
||||
_VME_A32_WIN0_ON_PCI,
|
||||
0x0f000000);
|
||||
BSP_VMEOutboundPortCfg(
|
||||
1,
|
||||
VME_AM_STD_SUP_DATA,
|
||||
0x00000000,
|
||||
_VME_A24_ON_PCI,
|
||||
0x00ff0000);
|
||||
BSP_VMEOutboundPortCfg(
|
||||
2,
|
||||
VME_AM_SUP_SHORT_IO,
|
||||
0x00000000,
|
||||
_VME_A16_ON_PCI,
|
||||
0x00010000);
|
||||
|
||||
#ifdef _VME_CSR_ON_PCI
|
||||
/* Map VME64 CSR */
|
||||
printk("_VME_CSR_ON_PCI\n");
|
||||
BSP_VMEOutboundPortCfg(
|
||||
7,
|
||||
VME_AM_CSR,
|
||||
0,
|
||||
_VME_CSR_ON_PCI,
|
||||
0x01000000);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _VME_DRAM_OFFSET
|
||||
printk("_VME_DRAM_OFFSET");
|
||||
/* map our memory to VME giving the driver a hint that it's ordinary memory
|
||||
* so they can enable decoupled cycles which should give better performance...
|
||||
*/
|
||||
BSP_VMEInboundPortCfg(
|
||||
0,
|
||||
VME_AM_EXT_SUP_DATA | VME_AM_IS_MEMORY,
|
||||
_VME_DRAM_OFFSET,
|
||||
PCI_DRAM_OFFSET,
|
||||
BSP_mem_size);
|
||||
#endif
|
||||
|
||||
/* stdio is not yet initialized; the driver will revert to printk */
|
||||
BSP_VMEOutboundPortsShow(0);
|
||||
BSP_VMEInboundPortsShow(0);
|
||||
|
||||
BSP_VMEIrqMgrInstall();
|
||||
}
|
||||
@@ -1,9 +1,3 @@
|
||||
2010-03-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
PR 1497/bsps
|
||||
* startup/bspclean.c: Do not enable interrupts while waiting for board
|
||||
to reset.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -466,12 +466,12 @@ int mpc5200_eth_mii_read(struct mpc5200_enet_struct *sc, unsigned char phyAddr,
|
||||
* 18-wire ethernet tranceiver (PHY). Please see your PHY
|
||||
* documentation for the register map.
|
||||
*
|
||||
* Returns: Success (bool)
|
||||
* Returns: Success (boolean)
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*/
|
||||
static bool mpc5200_eth_mii_write(struct mpc5200_enet_struct *sc, unsigned char phyAddr, unsigned char regAddr, unsigned short data)
|
||||
static int mpc5200_eth_mii_write(struct mpc5200_enet_struct *sc, unsigned char phyAddr, unsigned char regAddr, unsigned short data)
|
||||
{
|
||||
unsigned long reg; /* convenient holder for the PHY register */
|
||||
unsigned long phy; /* convenient holder for the PHY */
|
||||
@@ -514,12 +514,12 @@ static bool mpc5200_eth_mii_write(struct mpc5200_enet_struct *sc, unsigned char
|
||||
* Description: Reset a running ethernet driver including the hardware
|
||||
* FIFOs and the FEC.
|
||||
*
|
||||
* Returns: Success (bool)
|
||||
* Returns: Success (boolean)
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*/
|
||||
static bool mpc5200_fec_reset(struct mpc5200_enet_struct *sc) {
|
||||
static int mpc5200_fec_reset(struct mpc5200_enet_struct *sc) {
|
||||
volatile int delay;
|
||||
/*
|
||||
* Clear FIFO status registers
|
||||
|
||||
@@ -45,9 +45,9 @@ void bsp_cleanup( void )
|
||||
/*
|
||||
* Now reset the CPU
|
||||
*/
|
||||
_ISR_Set_level( 0 );
|
||||
|
||||
mpc5200.gpt[0].count_in = 0xf;
|
||||
mpc5200.gpt[0].emsel = 0x9004;
|
||||
|
||||
while(1) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2009-03-18 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||
|
||||
* start/start.S, include/hwreg_vals.h, startup/cpuinit.c:
|
||||
correct some init values for HSC_CM01 boards
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -207,26 +207,26 @@
|
||||
#define LBLAWBAR0_VAL bsp_rom_start
|
||||
#define LBLAWAR0_VAL 0x80000018
|
||||
#define LBLAWBAR1_VAL (FPGA_CONFIG_START)
|
||||
#define LBLAWAR1_VAL 0x80000018
|
||||
#define LBLAWAR1_VAL 0x80000015
|
||||
#define DDRLAWBAR0_VAL bsp_ram_start
|
||||
#define DDRLAWAR0_VAL 0x8000001B
|
||||
/*
|
||||
* Local Bus (Memory) Controller
|
||||
* FIXME: decode bit settings
|
||||
*/
|
||||
#define BR0_VAL (0xFE000000 | 0x01001)
|
||||
#define BR0_VAL 0xFE001001
|
||||
#define OR0_VAL 0xFE000E54
|
||||
// fpga config access range (UPM_A) (32 kByte)
|
||||
#define BR2_VAL (FPGA_CONFIG_START | 0x01881)
|
||||
#define OR2_VAL 0xFFFF9100
|
||||
#define OR2_VAL 0xFFF80100
|
||||
|
||||
// fpga register access range (UPM_B) (8 MByte)
|
||||
#define BR3_VAL (FPGA_REGISTER_START | 0x018A1)
|
||||
#define OR3_VAL 0xFF801100
|
||||
#define OR3_VAL 0xFF800100
|
||||
|
||||
// fpga fifo access range (UPM_C) (8 MByte)
|
||||
#define BR4_VAL (FPGA_FIFO_START | 0x018C1)
|
||||
#define OR4_VAL 0xFF801100
|
||||
// fpga fifo access range (UPM_B) (8 MByte)
|
||||
#define BR4_VAL (FPGA_FIFO_START | 0x018A1)
|
||||
#define OR4_VAL 0xFF800100
|
||||
|
||||
/*
|
||||
* SDRAM registers
|
||||
|
||||
@@ -199,18 +199,7 @@ start_code_in_rom:
|
||||
#ifdef OR3_VAL
|
||||
SET_IMM_REGW r31,r30,OR3_OFF,OR3_VAL
|
||||
#endif
|
||||
#ifdef BR4_VAL
|
||||
SET_IMM_REGW r31,r30,BR4_OFF,BR4_VAL
|
||||
#endif
|
||||
#ifdef OR4_VAL
|
||||
SET_IMM_REGW r31,r30,OR4_OFF,OR4_VAL
|
||||
#endif
|
||||
#ifdef BR5_VAL
|
||||
SET_IMM_REGW r31,r30,BR5_OFF,BR5_VAL
|
||||
#endif
|
||||
#ifdef OR5_VAL
|
||||
SET_IMM_REGW r31,r30,OR5_OFF,OR5_VAL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ROM startup: init SDRAM access window
|
||||
*/
|
||||
|
||||
@@ -235,7 +235,7 @@ void cpu_init( void)
|
||||
(uint32_t) bsp_rom_start,
|
||||
(uint32_t) bsp_rom_size,
|
||||
#endif /* HAS_UBOOT */
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2008-12-18 Michael Hamel <nigel@adi.co.nz>
|
||||
|
||||
PR 1349/bsps
|
||||
* startup/bspstart.c: Add missing volatile on UART access pointer.
|
||||
|
||||
2008-09-29 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* Makefile.am: Remove noinst_PROGRAMS (Unused).
|
||||
|
||||
@@ -143,7 +143,7 @@ void bsp_pretasking_hook(void)
|
||||
static void
|
||||
EarlyUARTInit(int baudRate)
|
||||
{
|
||||
volatile uint8_t* up = (uint8_t*)(BSP_UART_IOBASE_COM1);
|
||||
uint8_t* up = (uint8_t*)(BSP_UART_IOBASE_COM1);
|
||||
int divider = BSP_UART_BAUD_BASE / baudRate;
|
||||
up[LCR] = DLAB; /* Access DLM/DLL */
|
||||
up[DLL] = divider & 0x0FF;
|
||||
@@ -206,7 +206,7 @@ void Init_FPGA(void)
|
||||
static void
|
||||
DirectUARTWrite(const char c)
|
||||
{
|
||||
volatile uint8_t* up = (uint8_t*)(BSP_UART_IOBASE_COM1);
|
||||
uint8_t* up = (uint8_t*)(BSP_UART_IOBASE_COM1);
|
||||
while ((up[LSR] & THRE) == 0) { ; }
|
||||
up[THR] = c;
|
||||
if (c=='\n')
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* irq/irq_asm.S: When the type rtems_boolean was switched to the C99
|
||||
bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -268,16 +268,16 @@ nested:
|
||||
* do something with the current thread...
|
||||
*/
|
||||
addis r4, 0, _Context_Switch_necessary@ha
|
||||
lbz r5, _Context_Switch_necessary@l(r4)
|
||||
lwz r5, _Context_Switch_necessary@l(r4)
|
||||
cmpwi r5, 0
|
||||
bne switch
|
||||
|
||||
addis r6, 0, _ISR_Signals_to_thread_executing@ha
|
||||
lbz r7, _ISR_Signals_to_thread_executing@l(r6)
|
||||
lwz r7, _ISR_Signals_to_thread_executing@l(r6)
|
||||
cmpwi r7, 0
|
||||
li r8, 0
|
||||
beq easy_exit
|
||||
stb r8, _ISR_Signals_to_thread_executing@l(r6)
|
||||
stw r8, _ISR_Signals_to_thread_executing@l(r6)
|
||||
/*
|
||||
* going to call _ThreadProcessSignalsFromIrq
|
||||
* Push a complete exception like frame...
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
2009-03-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1385/cpukit
|
||||
* irq/irq_asm.S: When the type rtems_boolean was switched to the C99
|
||||
bool, the size changed from 4 bytes to 1 byte. The interrupt
|
||||
dispatching code accesses two boolean variables for scheduling
|
||||
purposes and the assembly implementations of this code did not get
|
||||
updated.
|
||||
|
||||
2009-03-09 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* include/tm27.h: Add include rtems/powerpc/powerpc.h
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#ifndef __tm27_h
|
||||
#define __tm27_h
|
||||
|
||||
#include <rtems/powerpc/powerpc.h>
|
||||
|
||||
/*
|
||||
* Stuff for Time Test 27
|
||||
*/
|
||||
|
||||
@@ -226,16 +226,16 @@ nested:
|
||||
* do something with the current thread...
|
||||
*/
|
||||
addis r4, 0, _Context_Switch_necessary@ha
|
||||
lbz r5, _Context_Switch_necessary@l(r4)
|
||||
lwz r5, _Context_Switch_necessary@l(r4)
|
||||
cmpwi r5, 0
|
||||
bne switch
|
||||
|
||||
addis r6, 0, _ISR_Signals_to_thread_executing@ha
|
||||
lbz r7, _ISR_Signals_to_thread_executing@l(r6)
|
||||
lwz r7, _ISR_Signals_to_thread_executing@l(r6)
|
||||
cmpwi r7, 0
|
||||
li r8, 0
|
||||
beq easy_exit
|
||||
stb r8, _ISR_Signals_to_thread_executing@l(r6)
|
||||
stw r8, _ISR_Signals_to_thread_executing@l(r6)
|
||||
/*
|
||||
* going to call _ThreadProcessSignalsFromIrq
|
||||
* Push a complete exception like frame...
|
||||
|
||||
@@ -1,42 +1,3 @@
|
||||
2009-10-20 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* network/tsec.c: Bugfix. Broadcast address was declared
|
||||
uint8_t instead of uint8_t [8].
|
||||
|
||||
2009-10-13 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
PR 1451/bsps
|
||||
* network/tsec.c: Fix mbuf leak when watchdog expires. The
|
||||
re-initialization algorithm failed to release mbuf chains
|
||||
held in the TX ring.
|
||||
Also, during initialization the initial link status is determined
|
||||
and IFF_OACTIVE set if no active link was detected.
|
||||
|
||||
2009-08-17 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* network/tsec.c, network/if_tsec_pub.h:
|
||||
Fixed bugs in multicast support; added reference-count
|
||||
for hash-table entries which allows for the implementation
|
||||
of a 'deletion' routine.
|
||||
NOTE: mcast support largely untested.
|
||||
|
||||
2009-06-05 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* irq/irq_init.c: silenced compiler warning.
|
||||
|
||||
2009-06-05 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* network/tsec.c, network/if_tsec_pub.h:
|
||||
implemented multicast support.
|
||||
|
||||
2009-03-05 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* startup/bspstart.c: removed legacy code (inherited
|
||||
from old mvme2307 BSP) -- for testing trapping into
|
||||
PPCBug -- which is irrelevant on this BSP.
|
||||
Removed warning about SPRG0 having been reassigned
|
||||
-- this BSP is OK.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <libcpu/raw_exception.h>
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
static void nop_func(void *arg)
|
||||
static void nop_func(void)
|
||||
{
|
||||
printk("Unhandled IRQ\n");
|
||||
}
|
||||
|
||||
@@ -173,60 +173,10 @@ BSP_tsec_reset_stats(struct tsec_private *mp);
|
||||
* 'promisc' whether to set promiscuous flag.
|
||||
* 'enaddr' pointer to six bytes with MAC address. Read
|
||||
* from the device if NULL.
|
||||
* NOTE: multicast filter is cleared by this routine.
|
||||
*/
|
||||
void
|
||||
BSP_tsec_init_hw(struct tsec_private *mp, int promisc, unsigned char *enaddr);
|
||||
|
||||
/*
|
||||
* Clear multicast hash filter. No multicast frames are accepted
|
||||
* after executing this routine (unless the hardware was initialized
|
||||
* in 'promiscuous' mode).
|
||||
*
|
||||
* Reset reference count for all hash-table entries
|
||||
* to zero (see BSP_tsec_mcast_filter_accept_del()).
|
||||
*/
|
||||
void
|
||||
BSP_tsec_mcast_filter_clear(struct tsec_private *mp);
|
||||
|
||||
/*
|
||||
* Program multicast filter to accept all multicast frames.
|
||||
*
|
||||
* Increment reference count for all hash-table entries
|
||||
* by one (see BSP_tsec_mcast_filter_accept_del()).
|
||||
*/
|
||||
void
|
||||
BSP_tsec_mcast_filter_accept_all(struct tsec_private *mp);
|
||||
|
||||
/*
|
||||
* Add a MAC address to the multicast filter and increment
|
||||
* the reference count for the matching hash-table entry
|
||||
* (see BSP_tsec_mcast_filter_accept_del()).
|
||||
*
|
||||
* Existing entries are not changed but note that
|
||||
* the filter is imperfect, i.e., multiple MAC addresses
|
||||
* may alias to a single filter entry. Hence software
|
||||
* filtering must still be performed.
|
||||
*
|
||||
*/
|
||||
void
|
||||
BSP_tsec_mcast_filter_accept_add(struct tsec_private *mp, unsigned char *enaddr);
|
||||
|
||||
/*
|
||||
* Remove a MAC address from the (imperfec) multicast
|
||||
* filter.
|
||||
* Note that the driver maintains an internal reference
|
||||
* counter for each multicast hash. The hash-table
|
||||
* entry is only cleared when the reference count
|
||||
* reaches zero ('del' has been called the same
|
||||
* amount of times as 'add' for an address (or
|
||||
* any alias) that matches a given table entry.
|
||||
* BSP_tsec_mcast_filter_clear() resets all reference
|
||||
* counters to zero.
|
||||
*/
|
||||
void
|
||||
BSP_tsec_mcast_filter_accept_del(struct tsec_private *mp, unsigned char *enaddr);
|
||||
|
||||
/*
|
||||
* Dump statistics to FILE 'f'. If NULL, stdout is used.
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include <libcpu/byteorder.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <bsp.h>
|
||||
|
||||
@@ -114,9 +113,6 @@ phy_irq_pending(struct tsec_private *mp);
|
||||
static uint32_t
|
||||
phy_ack_irq(struct tsec_private *mp);
|
||||
|
||||
static void
|
||||
tsec_update_mcast(struct ifnet *ifp);
|
||||
|
||||
#if defined(PARANOIA) || defined(DEBUG)
|
||||
void tsec_dump_tring(struct tsec_private *mp);
|
||||
void tsec_dump_rring(struct tsec_private *mp);
|
||||
@@ -640,8 +636,6 @@ static inline void bd_wrbuf(TSEC_BD *bd, uint32_t addr)
|
||||
|
||||
/* Driver 'private' data */
|
||||
|
||||
#define NUM_MC_HASHES 256
|
||||
|
||||
struct tsec_private {
|
||||
FEC_Enet_Base base; /* Controller base address */
|
||||
FEC_Enet_Base phy_base; /* Phy base address (not necessarily identical
|
||||
@@ -686,7 +680,6 @@ struct tsec_private {
|
||||
unsigned odrops;
|
||||
unsigned repack;
|
||||
} stats;
|
||||
uint16_t mc_refcnt[NUM_MC_HASHES];
|
||||
};
|
||||
|
||||
#define NEXT_TXI(mp, i) (((i)+1) < (mp)->tx_ring_size ? (i)+1 : 0 )
|
||||
@@ -1219,7 +1212,7 @@ int i;
|
||||
static int
|
||||
mac_set_duplex(struct tsec_private *mp)
|
||||
{
|
||||
int media = IFM_MAKEWORD(0, 0, 0, 0);
|
||||
int media = 0;
|
||||
|
||||
if ( 0 == BSP_tsec_media_ioctl(mp, SIOCGIFMEDIA, &media)) {
|
||||
if ( IFM_LINK_OK & media ) {
|
||||
@@ -1346,10 +1339,9 @@ rtems_interrupt_level l;
|
||||
|
||||
for ( i=0; i<8*4; i+=4 ) {
|
||||
fec_wr( b, TSEC_IADDR0 + i, 0 );
|
||||
fec_wr( b, TSEC_GADDR0 + i, 0 );
|
||||
}
|
||||
|
||||
BSP_tsec_mcast_filter_clear(mp);
|
||||
|
||||
BSP_tsec_reset_stats(mp);
|
||||
|
||||
fec_wr( b, TSEC_ATTR, (TSEC_ATTR_RDSEN | TSEC_ATTR_RBDSEN) );
|
||||
@@ -1404,80 +1396,6 @@ rtems_interrupt_level l;
|
||||
rtems_interrupt_enable( l );
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
hash_prog(struct tsec_private *mp, uint32_t tble, const uint8_t *enaddr, int accept)
|
||||
{
|
||||
uint8_t s;
|
||||
uint32_t reg, bit;
|
||||
|
||||
s = ether_crc32_le(enaddr, ETHER_ADDR_LEN);
|
||||
|
||||
/* bit-reverse */
|
||||
s = ((s&0x0f) << 4) | ((s&0xf0) >> 4);
|
||||
s = ((s&0x33) << 2) | ((s&0xcc) >> 2);
|
||||
s = ((s&0x55) << 1) | ((s&0xaa) >> 1);
|
||||
|
||||
reg = tble + ((s >> (5-2)) & ~3);
|
||||
bit = 1 << (31 - (s & 31));
|
||||
|
||||
if ( accept ) {
|
||||
if ( 0 == mp->mc_refcnt[s]++ )
|
||||
fec_set( mp->base, reg, bit );
|
||||
} else {
|
||||
if ( mp->mc_refcnt[s] > 0 && 0 == --mp->mc_refcnt[s] )
|
||||
fec_clr( mp->base, reg, bit );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BSP_tsec_mcast_filter_clear(struct tsec_private *mp)
|
||||
{
|
||||
int i;
|
||||
for ( i=0; i<8*4; i+=4 ) {
|
||||
fec_wr( mp->base, TSEC_GADDR0 + i, 0 );
|
||||
}
|
||||
for ( i=0; i<NUM_MC_HASHES; i++ )
|
||||
mp->mc_refcnt[i] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
BSP_tsec_mcast_filter_accept_all(struct tsec_private *mp)
|
||||
{
|
||||
int i;
|
||||
for ( i=0; i<8*4; i+=4 ) {
|
||||
fec_wr( mp->base, TSEC_GADDR0 + i, 0xffffffff );
|
||||
}
|
||||
for ( i=0; i<NUM_MC_HASHES; i++ )
|
||||
mp->mc_refcnt[i]++;
|
||||
}
|
||||
|
||||
static void
|
||||
mcast_filter_prog(struct tsec_private *mp, uint8_t *enaddr, int accept)
|
||||
{
|
||||
static const uint8_t bcst[6]={0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
if ( ! (enaddr[0] & 0x01) ) {
|
||||
/* not a multicast address; ignore */
|
||||
return;
|
||||
}
|
||||
if ( 0 == memcmp( enaddr, bcst, sizeof(bcst) ) ) {
|
||||
/* broadcast; ignore */
|
||||
return;
|
||||
}
|
||||
hash_prog(mp, TSEC_GADDR0, enaddr, accept);
|
||||
}
|
||||
|
||||
void
|
||||
BSP_tsec_mcast_filter_accept_add(struct tsec_private *mp, uint8_t *enaddr)
|
||||
{
|
||||
mcast_filter_prog(mp, enaddr, 1 /* accept */);
|
||||
}
|
||||
|
||||
void
|
||||
BSP_tsec_mcast_filter_accept_del(struct tsec_private *mp, uint8_t *enaddr)
|
||||
{
|
||||
mcast_filter_prog(mp, enaddr, 0 /* delete */);
|
||||
}
|
||||
|
||||
void
|
||||
BSP_tsec_dump_stats(struct tsec_private *mp, FILE *f)
|
||||
{
|
||||
@@ -2329,17 +2247,15 @@ unsigned long l,o;
|
||||
static void consume_rx_mbuf(void *buf, void *arg, int len)
|
||||
{
|
||||
struct ifnet *ifp = arg;
|
||||
struct mbuf *m = buf;
|
||||
|
||||
if ( len <= 0 ) {
|
||||
ifp->if_iqdrops++;
|
||||
if ( len < 0 ) {
|
||||
ifp->if_ierrors++;
|
||||
}
|
||||
if ( m )
|
||||
m_freem(m);
|
||||
/* caller recycles mbuf */
|
||||
} else {
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m = buf;
|
||||
|
||||
eh = (struct ether_header *)(mtod(m, unsigned long) + ETH_RX_OFFSET);
|
||||
m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header) - ETH_RX_OFFSET - ETH_CRC_LEN;
|
||||
@@ -2393,21 +2309,7 @@ tsec_init(void *arg)
|
||||
{
|
||||
struct tsec_softc *sc = arg;
|
||||
struct ifnet *ifp = &sc->arpcom.ac_if;
|
||||
int media;
|
||||
|
||||
BSP_tsec_init_hw(&sc->pvt, ifp->if_flags & IFF_PROMISC, sc->arpcom.ac_enaddr);
|
||||
|
||||
/* Determine initial link status and block sender if there is no link */
|
||||
media = IFM_MAKEWORD(0, 0, 0, 0);
|
||||
if ( 0 == BSP_tsec_media_ioctl(&sc->pvt, SIOCGIFMEDIA, &media) ) {
|
||||
if ( (IFM_LINK_OK & media) ) {
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
} else {
|
||||
ifp->if_flags |= IFF_OACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
tsec_update_mcast(ifp);
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
sc->arpcom.ac_if.if_timer = 0;
|
||||
}
|
||||
@@ -2446,31 +2348,6 @@ struct tsec_softc *sc = ifp->if_softc;
|
||||
tsec_start(ifp);
|
||||
}
|
||||
|
||||
static void
|
||||
tsec_update_mcast(struct ifnet *ifp)
|
||||
{
|
||||
struct tsec_softc *sc = ifp->if_softc;
|
||||
struct ether_multi *enm;
|
||||
struct ether_multistep step;
|
||||
|
||||
if ( IFF_ALLMULTI & ifp->if_flags ) {
|
||||
BSP_tsec_mcast_filter_accept_all( &sc->pvt );
|
||||
} else {
|
||||
BSP_tsec_mcast_filter_clear( &sc->pvt );
|
||||
|
||||
ETHER_FIRST_MULTI(step, (struct arpcom *)ifp, enm);
|
||||
|
||||
while ( enm ) {
|
||||
if ( memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN) )
|
||||
assert( !"Should never get here; IFF_ALLMULTI should be set!" );
|
||||
|
||||
BSP_tsec_mcast_filter_accept_add(&sc->pvt, enm->enm_addrlo);
|
||||
|
||||
ETHER_NEXT_MULTI(step, enm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* bsdnet driver ioctl entry */
|
||||
static int
|
||||
tsec_ioctl(struct ifnet *ifp, ioctl_command_t cmd, caddr_t data)
|
||||
@@ -2518,19 +2395,15 @@ int f;
|
||||
error = BSP_tsec_media_ioctl(&sc->pvt, cmd, &ifr->ifr_media);
|
||||
break;
|
||||
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
error = (cmd == SIOCADDMULTI)
|
||||
? ether_addmulti(ifr, &sc->arpcom)
|
||||
: ether_delmulti(ifr, &sc->arpcom);
|
||||
/*
|
||||
* TODO
|
||||
*
|
||||
* case SIOCADDMULTI:
|
||||
* case SIOCDELMULTI:
|
||||
*
|
||||
* break;
|
||||
*/
|
||||
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
tsec_update_mcast(ifp);
|
||||
}
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIO_RTEMS_SHOW_STATS:
|
||||
BSP_tsec_dump_stats( &sc->pvt, stdout );
|
||||
@@ -2697,7 +2570,7 @@ struct ifnet *ifp;
|
||||
ifp->if_timer = 0;
|
||||
|
||||
sc->bsd.oif_flags = /* ... */
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
|
||||
|
||||
/*
|
||||
* if unset, this set to 10Mbps by ether_ifattach; seems to be unused by bsdnet stack;
|
||||
|
||||
@@ -55,6 +55,8 @@ void bsp_cleanup(void)
|
||||
bsp_reset();
|
||||
}
|
||||
|
||||
SPR_RW(SPRG1)
|
||||
|
||||
/*
|
||||
* Copy Additional boot param passed by boot loader
|
||||
*/
|
||||
@@ -393,6 +395,29 @@ VpdBufRec vpdData [] = {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEST_RAW_EXCEPTION_CODE
|
||||
printk("Testing exception handling Part 1\n");
|
||||
/*
|
||||
* Cause a software exception
|
||||
*/
|
||||
__asm__ __volatile ("sc");
|
||||
/*
|
||||
* Check we can still catch exceptions and return coorectly.
|
||||
*/
|
||||
printk("Testing exception handling Part 2\n");
|
||||
__asm__ __volatile ("sc");
|
||||
|
||||
/*
|
||||
* Somehow doing the above seems to clobber SPRG0 on the mvme2100. The
|
||||
* interrupt disable mask is stored in SPRG0. Is this a problem?
|
||||
*/
|
||||
ppc_interrupt_set_disable_mask( PPC_INTERRUPT_DISABLE_MASK_DEFAULT);
|
||||
|
||||
#endif
|
||||
|
||||
/* See above */
|
||||
#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
|
||||
|
||||
if ( (chpt = strstr(BSP_commandline_string,"MEMSZ=")) ) {
|
||||
char *endp;
|
||||
uint32_t sz;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
2009-05-08 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* irq/irq.c, network/if_1GHz/POSSIBLEBUG: Removed.
|
||||
|
||||
2009-05-08 Kate Feng <feng1@bnl.gov>
|
||||
|
||||
PR1395/bsps
|
||||
* Updated the changes from RTEMS-4.8.0, which were made since Oct. 2007.
|
||||
* network/if_1GHz/if_wm.c: fixed some bugs in the 1GHz driver.
|
||||
* pci/pci_interface.c:
|
||||
+ Enabled PCI "Read", "Read Line", and "Read Multiple"
|
||||
+ Agressive Prefetch to improve the performance of the PCI based
|
||||
applications (e.g. 1GHz NIC).
|
||||
* irq/BSP_irq.c : Replaced the irq/irq.c, and used GT_GPP_Value
|
||||
register to monitor the cause of the level sensitive interrupts.
|
||||
This unique solution solves various bugs in the 1GHz network drivers
|
||||
Fixed bugs in compute_pic_masks_from_prio()
|
||||
* pci/pci.c : Updated it to be consistent with the original pci.c
|
||||
* written by Eric Valette. There is no change in its function.
|
||||
* irq/irq_init.c : set defaultIrq->next_handler to be 0
|
||||
* for BSP_SHARED_HANDLER_SUPPORT.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -5,5 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
extern unsigned char ConfVPD_buff[200];
|
||||
|
||||
#define VPD_ENET0_OFFSET 0x3c
|
||||
#define VPD_ENET1_OFFSET 0x45
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
#define GT_MPP_Control2 0xf008
|
||||
#define GT_MPP_Control3 0xf00c
|
||||
|
||||
/* <skf> added for GT64260 */
|
||||
/* <skf> added */
|
||||
#define GT_MPP_SerialPortMultiplex 0xf010
|
||||
|
||||
#define GT_GPP_IO_Control 0xf100
|
||||
@@ -789,13 +789,14 @@
|
||||
#define TWSI_BAUDE_RATE 0xc00c
|
||||
#define TWSI_SFT_RST 0xc01c
|
||||
|
||||
/* Interrupt Controller - Interrupt Controller Registers */
|
||||
/* Section 25.2 : Table 734 <skf> */
|
||||
|
||||
#define GT64260_MAIN_INT_CAUSE_LO 0xc18 /* read Only */
|
||||
#define GT64260_MAIN_INT_CAUSE_HI 0xc68 /* read Only */
|
||||
#define GT64260_CPU_INT_MASK_LO 0xc1c
|
||||
#define GT64260_CPU_INT_MASK_HI 0xc6c
|
||||
#define GT64260_CPU_SEL_CAUSE 0xc70 /* read Only */
|
||||
#define GT_MAIN_INT_CAUSE_LO 0xc18 /* read Only */
|
||||
#define GT_MAIN_INT_CAUSE_HI 0xc68 /* read Only */
|
||||
#define GT_CPU_INT_MASK_LO 0xc1c
|
||||
#define GT_CPU_INT_MASK_HI 0xc6c
|
||||
#define GT_CPU_SEL_CAUSE 0xc70 /* read Only */
|
||||
#define GT_PCI0_INT_MASK_LO 0xc24
|
||||
#define GT_PCI0_INT_MASK_HI 0xc64
|
||||
#define GT_PCI0_SEL_CAUSE 0xc74 /* read Only */
|
||||
|
||||
@@ -32,9 +32,7 @@ startup_SOURCES = startup/bspstart.c \
|
||||
../../powerpc/shared/startup/sbrk.c ../../shared/bootcard.c \
|
||||
../../shared/bsppredriverhook.c startup/bspclean.c \
|
||||
../../shared/bsplibc.c ../../shared/bsppost.c \
|
||||
../../shared/gnatinstallhandler.c startup/reboot.c \
|
||||
../../powerpc/shared/startup/probeMemEnd.c
|
||||
|
||||
../../shared/gnatinstallhandler.c startup/reboot.c
|
||||
pclock_SOURCES = ../../powerpc/shared/clock/p_clock.c
|
||||
|
||||
include_bsp_HEADERS = ../../powerpc/shared/console/uart.h
|
||||
@@ -47,7 +45,7 @@ pci_SOURCES = pci/pci.c pci/pci_interface.c pci/detect_host_bridge.c \
|
||||
pci/pcifinddevice.c
|
||||
|
||||
include_bsp_HEADERS += irq/irq.h
|
||||
irq_SOURCES = irq/irq_init.c irq/BSP_irq.c
|
||||
irq_SOURCES = irq/irq_init.c irq/irq.c
|
||||
|
||||
nodist_include_HEADERS += ../../shared/tod.h
|
||||
tod_SOURCES = ../../shared/tod.c tod/todcfg.c
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: README,v 1.4.1 Shuchen Kate Feng, NSLS, BNL (03/16/2009)
|
||||
# $Id: README,v 1.3.1 Shuchen Kate Feng, NSLS, BNL (08/27/07)
|
||||
#
|
||||
|
||||
Please reference README.booting for the boot/load process.
|
||||
@@ -7,10 +7,7 @@ Please reference README.booting for the boot/load process.
|
||||
For the priority setting of the Interrupt Requests (IRQs), please
|
||||
reference README.irq
|
||||
|
||||
The BSP is built and tested on the RTEMS 4.9.1 release. The
|
||||
PR1385 patch for c/src/lib/libbsp/powerpc/shared/irq/irq_asm.S
|
||||
is not needed for the mvme5500 BSP because the PowerPC BSPs
|
||||
use the shared exception framework in the RTEMS 4.9 release.
|
||||
The BSP is built and tested on the 4.7.1 and 4.7.99.2 CVS RTEMS release.
|
||||
|
||||
I believe in valuable real-time programming, where technical neatness,
|
||||
performance and truth are. I hope I still believe. Any suggestion,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
README.booting: written by S. Kate Feng <feng1@bnl.gov>, March 16, 2009
|
||||
README.booting: written by S. Kate Feng <feng1@bnl.gov>, Aug. 28, 2007
|
||||
|
||||
The BSP is built and tested on the RTEMS 4.9.1 release. The
|
||||
PR1385 patch for c/src/lib/libbsp/powerpc/shared/irq/irq_asm.S
|
||||
is not needed for the mvme5500 BSP because the PowerPC BSPs
|
||||
use the shared exception framework in the RTEMS 4.9 release.
|
||||
The bootloader is adapted from Till Straumann's Generic Mini-loader,
|
||||
which he wrote originally for the SVGM powerpc board.
|
||||
The BSP is built and tested on the 4.7 CVS RTEMS release.
|
||||
|
||||
Booting requirement :
|
||||
-------------------------
|
||||
@@ -12,7 +11,12 @@ Booting requirement :
|
||||
or /etc/dhcpd.conf (DHCP) properly to boot the system.
|
||||
(Note : EPICS needs a NTP server).
|
||||
|
||||
2) Example of the boot script setup carried out on the MOTLoad
|
||||
2) Please copy the prebuilt RTEMS binary (e.g. misc/rtems5500-cexp.bin)
|
||||
and perhaps others (e.g. misc/st.sys) to the /tftpboot/epics/hostname/bin/
|
||||
directory or the TFTPBOOT one you specified in the 'tftpGet'
|
||||
command of the boot script (as shown in the following example).
|
||||
|
||||
3) Example of the boot script setup carried out on the MOTLoad
|
||||
command line :
|
||||
|
||||
MVME5500> gevEdit mot-script-boot
|
||||
@@ -28,14 +32,23 @@ MVME5500>
|
||||
Note : (cxx.xx.xx.xx is the client IP address and
|
||||
sxx.xx.xx.xx is the server IP address)
|
||||
|
||||
3) Other reference web sites for mvme5500 BSP:
|
||||
4) Other reference web sites for mvme5500 BSP:
|
||||
http://lansce.lanl.gov/EPICS/presentations/KateFeng%20RTEMS-mvme55001.ppt
|
||||
http://www.nsls.bnl.gov/facility/expsys/software/EPICS/
|
||||
http://www.nsls.bnl.gov/facility/expsys/software/EPICS/FAQ.txt
|
||||
|
||||
5) When generating code (especially C++) for this system, one should
|
||||
use at least gcc-3.2 (preferrably a copy downloaded from the RTEMS
|
||||
site [snapshot area] )
|
||||
|
||||
4) To reboot the RTEMS-MVME5500 (board reset), one can invoke the
|
||||
6) To reboot the RTEMS-MVME5500 (board reset), one can invoke the
|
||||
rtemsReboot() command at Cexp> prompt.
|
||||
|
||||
5) To get started with RTEMS/EPICS and to build development
|
||||
7) Please reference http://www.slac.stanford.edu/~strauman/rtems
|
||||
for the source code and installation guidance of cexp, GeSys and
|
||||
other useful utilities such as telnet, nfs, and so on.
|
||||
|
||||
8) To get started with RTEMS/EPICS and to build development
|
||||
tools and BSP, I would recommend one to reference
|
||||
http://www.aps.anl.gov/epics/base/RTEMS/tutorial/
|
||||
in additional to the RTEMS document.
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* (C) S. Kate Feng 2003-2007 : Modified it to support the mvme5500 BSP.
|
||||
*
|
||||
* S. Kate Feng 2003-2007 : Modified it to support the mvme5500 BSP.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -23,57 +22,10 @@
|
||||
#include <libcpu/io.h>
|
||||
#include <bsp/vectors.h>
|
||||
|
||||
/* Board type */
|
||||
typedef enum {
|
||||
undefined = 0,
|
||||
MVME5500,
|
||||
MVME6100
|
||||
} BSP_BoardTypes;
|
||||
|
||||
BSP_BoardTypes BSP_getBoardType();
|
||||
|
||||
/* Board type */
|
||||
typedef enum {
|
||||
Undefined,
|
||||
UNIVERSE2,
|
||||
TSI148,
|
||||
} BSP_VMEchipTypes;
|
||||
|
||||
BSP_VMEchipTypes BSP_getVMEchipType();
|
||||
|
||||
/* The version of Discovery system controller */
|
||||
|
||||
typedef enum {
|
||||
notdefined,
|
||||
GT64260A,
|
||||
GT64260B,
|
||||
MV64360,
|
||||
} DiscoveryChipVersion;
|
||||
|
||||
DiscoveryChipVersion BSP_getDiscoveryChipVersion();
|
||||
|
||||
#define _256M 0x10000000
|
||||
#define _512M 0x20000000
|
||||
|
||||
#define GT64x60_REG_BASE 0xf1000000 /* Base of GT64260 Reg Space */
|
||||
#define GT64x60_REG_SPACE_SIZE 0x10000 /* 64Kb Internal Reg Space */
|
||||
|
||||
#define GT64x60_DEV1_BASE 0xf1100000 /* Device bank1(chip select 1) base
|
||||
*/
|
||||
#define GT64260_DEV1_SIZE 0x00100000 /* Device bank size */
|
||||
#include <bsp/bspMvme5500.h>
|
||||
|
||||
/* fundamental addresses for this BSP (PREPxxx are from libcpu/io.h) */
|
||||
#define _IO_BASE GT64x60_REG_BASE
|
||||
|
||||
#define BSP_NVRAM_BASE_ADDR 0xf1110000
|
||||
|
||||
#define BSP_RTC_INTA_REG 0x7ff0
|
||||
#define BSP_RTC_SECOND 0x7ff2
|
||||
#define BSP_RTC_MINUTE 0x7ff3
|
||||
#define BSP_RTC_HOUR 0x7ff4
|
||||
#define BSP_RTC_DATE 0x7ff5
|
||||
#define BSP_RTC_INTERRUPTS 0x7ff6
|
||||
#define BSP_RTC_WATCHDOG 0x7ff7
|
||||
#define _IO_BASE GT64260_REG_BASE
|
||||
|
||||
/* PCI0 Domain I/O space */
|
||||
#define PCI0_IO_BASE 0xf0000000
|
||||
@@ -117,15 +69,17 @@ DiscoveryChipVersion BSP_getDiscoveryChipVersion();
|
||||
*/
|
||||
|
||||
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
|
||||
#define BSP_INTERRUPT_STACK_SIZE (16 * 1024) /* <skf> 2/09 wants it to be adjustable by BSP */
|
||||
|
||||
/* uart.c uses out_8 instead of outb */
|
||||
#define BSP_UART_IOBASE_COM1 GT64x60_DEV1_BASE + 0x20000
|
||||
#define BSP_UART_IOBASE_COM2 GT64x60_DEV1_BASE + 0x21000
|
||||
#define BSP_UART_IOBASE_COM1 GT64260_DEV1_BASE + 0x20000
|
||||
#define BSP_UART_IOBASE_COM2 GT64260_DEV1_BASE + 0x21000
|
||||
|
||||
#define BSP_CONSOLE_PORT BSP_UART_COM1 /* console */
|
||||
#define BSP_UART_BAUD_BASE 115200
|
||||
|
||||
/*
|
||||
* Vital Board data Start using DATA RESIDUAL
|
||||
*/
|
||||
/*
|
||||
* Total memory using RESIDUAL DATA
|
||||
*/
|
||||
@@ -146,7 +100,6 @@ 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);
|
||||
extern void bsp_reset(void);
|
||||
/* extern int printk(const char *, ...) __attribute__((format(printf, 1, 2))); */
|
||||
@@ -165,31 +118,24 @@ extern unsigned int BSP_heap_start;
|
||||
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_i82544EI_driver_attach
|
||||
#endif
|
||||
|
||||
extern int RTEMS_BSP_NETWORK_DRIVER_ATTACH();
|
||||
extern int
|
||||
RTEMS_BSP_NETWORK_DRIVER_ATTACH(/* struct rtems_bsdnet_ifconfig * */);
|
||||
|
||||
/*
|
||||
* BSP Configuration Default Overrides
|
||||
*/
|
||||
#define BSP_ZERO_WORKSPACE_AUTOMATICALLY TRUE
|
||||
|
||||
#define gccMemBar() RTEMS_COMPILER_MEMORY_BARRIER()
|
||||
/* As per Linux, This should be in the ppc/system.h */
|
||||
|
||||
static inline void lwmemBar()
|
||||
{
|
||||
asm volatile("lwsync":::"memory");
|
||||
}
|
||||
|
||||
static inline void io_flush()
|
||||
{
|
||||
asm volatile("isync":::"memory");
|
||||
}
|
||||
static inline void memBar()
|
||||
{
|
||||
asm volatile("sync":::"memory");
|
||||
}
|
||||
|
||||
static inline void ioBar()
|
||||
{
|
||||
asm volatile("eieio":::"memory");
|
||||
asm volatile("eieio");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* BSP_irq.c
|
||||
/* irq.c
|
||||
*
|
||||
* This file contains the implementation of the function described in irq.h
|
||||
*
|
||||
@@ -8,25 +8,21 @@
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* Acknowledgement May 2004, to Till Straumann <strauman@slac.stanford.edu>
|
||||
* Acknowledgement May 2004 : to Till Straumann <strauman@slac.stanford.edu>
|
||||
* for some inputs.
|
||||
*
|
||||
* Copyright 2003, 2004, 2005, 2007 Shuchen Kate Feng <feng1@bnl.gov>,
|
||||
* NSLS, Brookhaven National Laboratory. All rights reserved.
|
||||
*
|
||||
* 1) Used GT_GPP_Value register instead of the GT_GPP_Interrupt_Cause
|
||||
* register to monitor the cause of the level sensitive interrupts.
|
||||
* (Copyright : NDA item)
|
||||
* 2) The implementation of picPrioTable[] is an original work by the
|
||||
* NSLS,Brookhaven National Laboratory
|
||||
* 1) Modified and added support for the MVME5500 board.
|
||||
* 2) The implementation of picIsrTable[] is an original work by the
|
||||
* author to optimize the software IRQ priority scheduling because
|
||||
* Discovery controller does not provide H/W IRQ priority schedule.
|
||||
* It ensures the fastest/faster interrupt service to the
|
||||
* highest/higher priority IRQ, if pendig.
|
||||
* 3) _CPU_MSR_SET() needs RTEMS_COMPILER_MEMORY_BARRIER()
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <bsp.h>
|
||||
#include <bsp/irq.h>
|
||||
@@ -43,7 +39,9 @@
|
||||
|
||||
#define HI_INT_CAUSE 0x40000000
|
||||
|
||||
#define MAX_IRQ_LOOP 20
|
||||
#define MAX_IRQ_LOOP 30
|
||||
|
||||
#define EDGE_TRIGGER
|
||||
|
||||
/* #define DEBUG_IRQ*/
|
||||
|
||||
@@ -59,11 +57,11 @@ static unsigned int BSP_irq_prio_mask_tbl[3][BSP_PIC_IRQ_NUMBER];
|
||||
|
||||
/*
|
||||
* location used to store initial tables used for interrupt
|
||||
* management.BSP copy of the configuration
|
||||
* management.
|
||||
*/
|
||||
static rtems_irq_global_settings BSP_config;
|
||||
static rtems_irq_global_settings* internal_config;
|
||||
/* handler table (cached copy ) */
|
||||
static rtems_irq_connect_data* rtems_hdl_tbl;
|
||||
|
||||
/*
|
||||
* default handler connected on each irq after bsp initialization
|
||||
* (locally cached copy)
|
||||
@@ -75,33 +73,32 @@ static volatile unsigned *BSP_irqMask_reg[3];
|
||||
static volatile unsigned *BSP_irqCause_reg[3];
|
||||
static volatile unsigned BSP_irqMask_cache[3]={0,0,0};
|
||||
|
||||
static int picPrioTblPtr=0;
|
||||
|
||||
static int picIsrTblPtr=0;
|
||||
static unsigned int GPPIrqInTbl=0;
|
||||
static unsigned long long MainIrqInTbl=0;
|
||||
|
||||
/*
|
||||
* The software developers are forbidden to setup picPrioTable[],
|
||||
* The software developers are forbidden to setup picIsrTable[],
|
||||
* as it is a powerful engine for the BSP to find the pending
|
||||
* highest priority IRQ at run time. It ensures the fastest/faster
|
||||
* interrupt service to the highest/higher priority IRQ, if pendig.
|
||||
*
|
||||
* The picPrioTable[96] is updated dynamically at run time
|
||||
* The picIsrTable[96] is updated dynamically at run time
|
||||
* based on the priority levels set at BSPirqPrioTable[96],
|
||||
* while the BSP_enable_irq_at_pic(), and BSP_disable_irq_at_pic()
|
||||
* while the BSP_enable_pic_irq(), and BSP_disable_pic_irq()
|
||||
* commands are invoked.
|
||||
*
|
||||
* The picPrioTable[96] lists the enabled CPU main and GPP external interrupt
|
||||
* The picIsrTable[96] lists the enabled CPU main and GPP external interrupt
|
||||
* numbers [0 (lowest)- 95 (highest)] starting from the highest priority
|
||||
* one to the lowest priority one. The highest priority interrupt is
|
||||
* located at picPrioTable[0], and the lowest priority interrupt is located
|
||||
* at picPrioTable[picPrioTblPtr-1].
|
||||
* located at picIsrTable[0], and the lowest priority interrupt is located
|
||||
* at picIsrTable[picIsrTblPtr-1].
|
||||
*
|
||||
*
|
||||
*/
|
||||
#define DynamicIsrTable
|
||||
#ifdef DynamicIsrTable
|
||||
/* BitNums for Main Interrupt Lo/High Cause, -1 means invalid bit */
|
||||
static unsigned int picPrioTable[BSP_PIC_IRQ_NUMBER]={
|
||||
/* BitNums for Main Interrupt Lo/High Cause and GPP, -1 means invalid bit */
|
||||
static unsigned int picIsrTable[BSP_PIC_IRQ_NUMBER]={
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
@@ -112,19 +109,7 @@ static unsigned int picPrioTable[BSP_PIC_IRQ_NUMBER]={
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1 };
|
||||
#else
|
||||
static unsigned int picPrioTable[BSP_PIC_IRQ_NUMBER]={
|
||||
80, 84, 76, 77, 32, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1 };
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Check if IRQ is a MAIN CPU internal IRQ or GPP external IRQ
|
||||
@@ -146,18 +131,28 @@ static inline int is_processor_irq(const rtems_irq_number irqLine)
|
||||
);
|
||||
}
|
||||
|
||||
static inline unsigned int divIrq32(unsigned irq)
|
||||
{
|
||||
return(irq/32);
|
||||
}
|
||||
|
||||
static inline unsigned int modIrq32(unsigned irq)
|
||||
{
|
||||
return(irq%32);
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------ RTEMS Irq helper functions ----------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Caution : this function assumes the variable "BSP_config"
|
||||
* Caution : this function assumes the variable "internal_config"
|
||||
* is already set and that the tables it contains are still valid
|
||||
* and accessible.
|
||||
*/
|
||||
static void compute_pic_masks_from_prio(void)
|
||||
static void compute_pic_masks_from_prio(rtems_irq_global_settings *config)
|
||||
{
|
||||
int i,j, k, isGppMain;
|
||||
int i,j, k;
|
||||
unsigned long long irq_prio_mask=0;
|
||||
|
||||
/*
|
||||
@@ -173,27 +168,26 @@ static void compute_pic_masks_from_prio(void)
|
||||
BSP_irq_prio_mask_tbl[k][i]=0;
|
||||
|
||||
irq_prio_mask =0;
|
||||
isGppMain =1;
|
||||
break;
|
||||
default :
|
||||
isGppMain =0;
|
||||
irq_prio_mask = (unsigned long long) (1LLU << i);
|
||||
break;
|
||||
}
|
||||
if ( isGppMain) continue;
|
||||
|
||||
if (irq_prio_mask) {
|
||||
for (j = 0; j <BSP_MAIN_IRQ_NUMBER; j++) {
|
||||
/*
|
||||
* Mask interrupts at PIC level that have a lower priority
|
||||
* or <Till Straumann> a equal priority.
|
||||
*/
|
||||
if (BSP_config.irqPrioTbl [i] >= BSP_config.irqPrioTbl [j])
|
||||
if (config->irqPrioTbl [i] >= config->irqPrioTbl [j])
|
||||
irq_prio_mask |= (unsigned long long)(1LLU << j);
|
||||
}
|
||||
|
||||
|
||||
BSP_irq_prio_mask_tbl[0][i] = irq_prio_mask & 0xffffffff;
|
||||
BSP_irq_prio_mask_tbl[1][i] = (irq_prio_mask>>32) & 0xffffffff;
|
||||
#if 0
|
||||
#ifdef DEBUG
|
||||
printk("irq_mask_prio_tbl[%d]:0x%8x%8x\n",i,BSP_irq_prio_mask_tbl[1][i],
|
||||
BSP_irq_prio_mask_tbl[0][i]);
|
||||
#endif
|
||||
@@ -201,15 +195,14 @@ static void compute_pic_masks_from_prio(void)
|
||||
BSP_irq_prio_mask_tbl[2][i] = 1<<i;
|
||||
/* Compute for the GPP priority interrupt mask */
|
||||
for (j=BSP_GPP_IRQ_LOWEST_OFFSET; j <BSP_PROCESSOR_IRQ_LOWEST_OFFSET; j++) {
|
||||
if (BSP_config.irqPrioTbl [i] >= BSP_config.irqPrioTbl [j])
|
||||
if (config->irqPrioTbl [i] >= config->irqPrioTbl [j])
|
||||
BSP_irq_prio_mask_tbl[2][i] |= 1 << (j-BSP_GPP_IRQ_LOWEST_OFFSET);
|
||||
}
|
||||
#if 0
|
||||
printk("GPPirq_mask_prio_tbl[%d]:0x%8x\n",i,BSP_irq_prio_mask_tbl[2][i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void UpdateMainIrqTbl(int irqNum)
|
||||
{
|
||||
int i=0, j, shifted=0;
|
||||
@@ -232,25 +225,23 @@ static void UpdateMainIrqTbl(int irqNum)
|
||||
((irqNum>BSP_MICH_IRQ_MAX_OFFSET) &&
|
||||
(!(( 1 << (irqNum-BSP_GPP_IRQ_LOWEST_OFFSET)) & GPPIrqInTbl))))
|
||||
{
|
||||
while ( picPrioTable[i]!=-1) {
|
||||
if (BSP_config.irqPrioTbl[irqNum]>BSP_config.irqPrioTbl[picPrioTable[i]]) {
|
||||
while ( picIsrTable[i]!=-1) {
|
||||
if (internal_config->irqPrioTbl[irqNum]>internal_config->irqPrioTbl[picIsrTable[i]]) {
|
||||
/* all other lower priority entries shifted right */
|
||||
for (j=picPrioTblPtr;j>i; j--) {
|
||||
picPrioTable[j]=picPrioTable[j-1];
|
||||
}
|
||||
picPrioTable[i]=irqNum;
|
||||
for (j=picIsrTblPtr;j>i; j--)
|
||||
picIsrTable[j]=picIsrTable[j-1];
|
||||
picIsrTable[i]=irqNum;
|
||||
shifted=1;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!shifted) picPrioTable[picPrioTblPtr] =irqNum;
|
||||
|
||||
if (!shifted) picIsrTable[picIsrTblPtr]=irqNum;
|
||||
if (irqNum >BSP_MICH_IRQ_MAX_OFFSET)
|
||||
GPPIrqInTbl |= (1<< (irqNum-BSP_GPP_IRQ_LOWEST_OFFSET));
|
||||
else
|
||||
MainIrqInTbl |= (unsigned long long)(1LLU << irqNum);
|
||||
picPrioTblPtr++;
|
||||
picIsrTblPtr++;
|
||||
}
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
val2 = (MainIrqInTbl>>32) & 0xffffffff;
|
||||
@@ -280,23 +271,22 @@ static void CleanMainIrqTbl(int irqNum)
|
||||
(( 1 << (irqNum-BSP_GPP_IRQ_LOWEST_OFFSET)) & GPPIrqInTbl)))
|
||||
{ /* If entry in table*/
|
||||
for (i=0; i<64; i++) {
|
||||
if (picPrioTable[i]==irqNum) {/*remove it from the entry */
|
||||
if (picIsrTable[i]==irqNum) {/*remove it from the entry */
|
||||
/* all other lower priority entries shifted left */
|
||||
for (j=i;j<picPrioTblPtr; j++) {
|
||||
picPrioTable[j]=picPrioTable[j+1];
|
||||
}
|
||||
for (j=i;j<picIsrTblPtr; j++)
|
||||
picIsrTable[j]=picIsrTable[j+1];
|
||||
if (irqNum >BSP_MICH_IRQ_MAX_OFFSET)
|
||||
GPPIrqInTbl &= ~(1<< (irqNum-BSP_GPP_IRQ_LOWEST_OFFSET));
|
||||
else
|
||||
MainIrqInTbl &= ~(1LLU << irqNum);
|
||||
picPrioTblPtr--;
|
||||
picIsrTblPtr--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BSP_enable_irq_at_pic(const rtems_irq_number irqNum)
|
||||
void BSP_enable_pic_irq(const rtems_irq_number irqNum)
|
||||
{
|
||||
unsigned bitNum, regNum;
|
||||
unsigned int level;
|
||||
@@ -304,14 +294,12 @@ void BSP_enable_irq_at_pic(const rtems_irq_number irqNum)
|
||||
if ( !is_pic_irq(irqNum) )
|
||||
return;
|
||||
|
||||
bitNum = (((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET)%32;
|
||||
regNum = (((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET)>>5;
|
||||
bitNum = modIrq32(((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET);
|
||||
regNum = divIrq32(((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET);
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
|
||||
#ifdef DynamicIsrTable
|
||||
UpdateMainIrqTbl((int) irqNum);
|
||||
#endif
|
||||
BSP_irqMask_cache[regNum] |= (1 << bitNum);
|
||||
|
||||
out_le32(BSP_irqMask_reg[regNum], BSP_irqMask_cache[regNum]);
|
||||
@@ -320,9 +308,9 @@ void BSP_enable_irq_at_pic(const rtems_irq_number irqNum)
|
||||
rtems_interrupt_enable(level);
|
||||
}
|
||||
|
||||
void BSP_enable_pic_irq(const rtems_irq_number irqNum)
|
||||
void BSP_enable_irq_at_pic(const rtems_irq_number irqNum)
|
||||
{
|
||||
BSP_enable_irq_at_pic(irqNum);
|
||||
BSP_enable_pic_irq(irqNum);
|
||||
}
|
||||
|
||||
int BSP_disable_irq_at_pic(const rtems_irq_number irqNum)
|
||||
@@ -334,14 +322,12 @@ int BSP_disable_irq_at_pic(const rtems_irq_number irqNum)
|
||||
if ( ! is_pic_irq(irqNum) )
|
||||
return -1;
|
||||
|
||||
bitNum = (((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET)%32;
|
||||
regNum = (((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET)>>5;
|
||||
bitNum = modIrq32(((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET);
|
||||
regNum = divIrq32(((unsigned int)irqNum) - BSP_MICL_IRQ_LOWEST_OFFSET);
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
|
||||
#ifdef DynamicIsrTable
|
||||
CleanMainIrqTbl((int) irqNum);
|
||||
#endif
|
||||
|
||||
rval = BSP_irqMask_cache[regNum] & (1<<bitNum);
|
||||
|
||||
@@ -360,29 +346,35 @@ void BSP_disable_pic_irq(const rtems_irq_number irqNum)
|
||||
(void)BSP_disable_irq_at_pic(irqNum);
|
||||
}
|
||||
|
||||
/* Use shared/irq : 2008 */
|
||||
int BSP_setup_the_pic(rtems_irq_global_settings* config)
|
||||
int BSP_setup_the_pic(rtems_irq_global_settings *config) /* adapt the same name as shared/irq */
|
||||
{
|
||||
int i;
|
||||
|
||||
BSP_config = *config;
|
||||
default_rtems_hdl = config->defaultEntry.hdl;
|
||||
rtems_hdl_tbl = config->irqHdlTbl;
|
||||
internal_config = config;
|
||||
default_rtems_hdl = config->defaultEntry.hdl;
|
||||
rtems_hdl_tbl = config->irqHdlTbl;
|
||||
|
||||
/* Get ready for discovery BSP */
|
||||
BSP_irqMask_reg[0]= (volatile unsigned int *) (GT64x60_REG_BASE + GT64260_CPU_INT_MASK_LO);
|
||||
BSP_irqMask_reg[1]= (volatile unsigned int *) (GT64x60_REG_BASE + GT64260_CPU_INT_MASK_HI);
|
||||
BSP_irqCause_reg[0]= (volatile unsigned int *) (GT64x60_REG_BASE + GT64260_MAIN_INT_CAUSE_LO);
|
||||
BSP_irqCause_reg[1]= (volatile unsigned int *) (GT64x60_REG_BASE + GT64260_MAIN_INT_CAUSE_HI);
|
||||
BSP_irqMask_reg[2]= (volatile unsigned int *) (GT64x60_REG_BASE + GT_GPP_Interrupt_Mask);
|
||||
BSP_irqCause_reg[2]= (volatile unsigned int *) (GT64x60_REG_BASE + GT_GPP_Value);
|
||||
BSP_irqMask_reg[0]= (volatile unsigned int *) (GT64260_REG_BASE + GT_CPU_INT_MASK_LO);
|
||||
BSP_irqMask_reg[1]= (volatile unsigned int *) (GT64260_REG_BASE + GT_CPU_INT_MASK_HI);
|
||||
BSP_irqMask_reg[2]= (volatile unsigned int *) (GT64260_REG_BASE + GT_GPP_Interrupt_Mask);
|
||||
|
||||
BSP_irqCause_reg[0]= (volatile unsigned int *) (GT64260_REG_BASE + GT_MAIN_INT_CAUSE_LO);
|
||||
BSP_irqCause_reg[1]= (volatile unsigned int *) (GT64260_REG_BASE + GT_MAIN_INT_CAUSE_HI);
|
||||
BSP_irqCause_reg[2]= (volatile unsigned int *) (GT64260_REG_BASE + GT_GPP_Interrupt_Cause);
|
||||
|
||||
#ifdef EDGE_TRIGGER
|
||||
|
||||
/* Page 401, Table 598:
|
||||
* Comm Unit Arbiter Control register :
|
||||
* bit 10:GPP interrupts as level sensitive(1) or edge sensitive(0).
|
||||
* MOTload default is set as level sensitive(1). Set it agin to make sure.
|
||||
* We set the GPP interrupts to be edge sensitive.
|
||||
* MOTload default is set as level sensitive(1).
|
||||
*/
|
||||
out_le32(GT_CommUnitArb_Ctrl, (in_le32(GT_CommUnitArb_Ctrl)| (1<<10)));
|
||||
outl((inl(GT_CommUnitArb_Ctrl)& (~(1<<10))), GT_CommUnitArb_Ctrl);
|
||||
#else
|
||||
outl((inl(GT_CommUnitArb_Ctrl)| (1<<10)), GT_CommUnitArb_Ctrl);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
printk("BSP_irqMask_reg[0] = 0x%x, BSP_irqCause_reg[0] 0x%x\n",
|
||||
@@ -396,13 +388,13 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
|
||||
in_le32(BSP_irqCause_reg[2]));
|
||||
#endif
|
||||
|
||||
/* Initialize the interrupt related registers */
|
||||
/* Initialize the interrupt related GT64260 registers */
|
||||
for (i=0; i<3; i++) {
|
||||
out_le32(BSP_irqCause_reg[i], 0);
|
||||
out_le32(BSP_irqMask_reg[i], 0);
|
||||
}
|
||||
in_le32(BSP_irqMask_reg[2]);
|
||||
compute_pic_masks_from_prio();
|
||||
compute_pic_masks_from_prio(config);
|
||||
|
||||
#if 0
|
||||
printk("BSP_irqMask_reg[0] = 0x%x, BSP_irqCause_reg[0] 0x%x\n",
|
||||
@@ -416,65 +408,74 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
|
||||
in_le32(BSP_irqCause_reg[2]));
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
for (i=BSP_MICL_IRQ_LOWEST_OFFSET; i < BSP_PROCESSOR_IRQ_LOWEST_OFFSET ; i++) {
|
||||
if ( BSP_config.irqHdlTbl[i].hdl != BSP_config.defaultEntry.hdl) {
|
||||
BSP_enable_irq_at_pic(i);
|
||||
BSP_config.irqHdlTbl[i].on(&BSP_config.irqHdlTbl[i]);
|
||||
}
|
||||
else {
|
||||
BSP_config.irqHdlTbl[i].off(&BSP_config.irqHdlTbl[i]);
|
||||
BSP_disable_irq_at_pic(i);
|
||||
}
|
||||
}
|
||||
for (i= BSP_MAIN_GPP7_0_IRQ; i < BSP_MAIN_GPP31_24_IRQ; i++)
|
||||
BSP_enable_irq_at_pic(i);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function check that the value given for the irq line
|
||||
* is valid.
|
||||
*/
|
||||
|
||||
/*
|
||||
* High level IRQ handler called from shared_raw_irq_code_entry
|
||||
*/
|
||||
|
||||
int C_dispatch_irq_handler (BSP_Exception_frame *frame, unsigned int excNum)
|
||||
{
|
||||
unsigned long irqCause[3]={0, 0,0};
|
||||
register unsigned long selectCause;
|
||||
unsigned oldMask[3]={0,0,0};
|
||||
int loop=0, wloop=0, i=0, j;
|
||||
int irq=0, group=0;
|
||||
register unsigned i=0, j, irq=0, bitmask=0, group=0;
|
||||
|
||||
if (excNum == ASM_DEC_VECTOR) {
|
||||
bsp_irq_dispatch_list( rtems_hdl_tbl, BSP_DECREMENTER, default_rtems_hdl);
|
||||
return 0;
|
||||
|
||||
bsp_irq_dispatch_list( rtems_hdl_tbl, BSP_DECREMENTER, default_rtems_hdl);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
for (j=0; j<3; j++ ) oldMask[j] = BSP_irqMask_cache[j];
|
||||
for (j=0; j<3; j++) irqCause[j] = in_le32(BSP_irqCause_reg[j]) & in_le32(BSP_irqMask_reg[j]);
|
||||
|
||||
while (((irq = picPrioTable[i++])!=-1)&& (loop++ < MAX_IRQ_LOOP))
|
||||
{
|
||||
if (irqCause[group= irq/32] & ( 1<<(irq % 32))) {
|
||||
if ((selectCause= in_le32((volatile unsigned *)0xf1000c70)) & HI_INT_CAUSE ){
|
||||
irqCause[1] = (selectCause & BSP_irqMask_cache[1]);
|
||||
irqCause[2] = in_le32(BSP_irqCause_reg[2]) & BSP_irqMask_cache[2];
|
||||
}
|
||||
else {
|
||||
irqCause[0] = (selectCause & BSP_irqMask_cache[0]);
|
||||
if ((irqCause[1] =(in_le32((volatile unsigned *)0xf1000c68)&BSP_irqMask_cache[1])))
|
||||
irqCause[2] = in_le32(BSP_irqCause_reg[2]) & BSP_irqMask_cache[2];
|
||||
}
|
||||
|
||||
while ((irq = picIsrTable[i++])!=-1)
|
||||
{
|
||||
if (irqCause[group=(irq/32)] && (irqCause[group]&(bitmask=(1<<(irq % 32))))) {
|
||||
for (j=0; j<3; j++)
|
||||
BSP_irqMask_cache[j] &= (~ BSP_irq_prio_mask_tbl[j][irq]);
|
||||
|
||||
out_le32(BSP_irqMask_reg[0], BSP_irqMask_cache[0]);
|
||||
out_le32(BSP_irqMask_reg[1], BSP_irqMask_cache[1]);
|
||||
out_le32(BSP_irqMask_reg[2], BSP_irqMask_cache[2]);
|
||||
in_le32(BSP_irqMask_reg[2]);
|
||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||
out_le32((volatile unsigned *)0xf1000c1c, BSP_irqMask_cache[0]);
|
||||
out_le32((volatile unsigned *)0xf1000c6c, BSP_irqMask_cache[1]);
|
||||
out_le32((volatile unsigned *)0xf100f10c, BSP_irqMask_cache[2]);
|
||||
in_le32((volatile unsigned *)0xf100f10c);
|
||||
|
||||
bsp_irq_dispatch_list( rtems_hdl_tbl, irq, default_rtems_hdl);
|
||||
#ifdef EDGE_TRIGGER
|
||||
if (irq > BSP_MICH_IRQ_MAX_OFFSET)
|
||||
out_le32(BSP_irqCause_reg[2], ~bitmask);/* Till Straumann: Ack the edge triggered GPP IRQ */
|
||||
#endif
|
||||
|
||||
bsp_irq_dispatch_list( rtems_hdl_tbl, irq, default_rtems_hdl);
|
||||
|
||||
for (j=0; j<3; j++ ) BSP_irqMask_cache[j] = oldMask[j];
|
||||
|
||||
out_le32(BSP_irqMask_reg[0], oldMask[0]);
|
||||
out_le32(BSP_irqMask_reg[1], oldMask[1]);
|
||||
out_le32(BSP_irqMask_reg[2], oldMask[2]);
|
||||
in_le32(BSP_irqMask_reg[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out_le32((volatile unsigned *)0xf1000c1c, oldMask[0]);
|
||||
out_le32((volatile unsigned *)0xf1000c6c, oldMask[1]);
|
||||
out_le32((volatile unsigned *)0xf100f10c, oldMask[2]);
|
||||
in_le32((volatile unsigned *)0xf100f10c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -483,10 +484,10 @@ void BSP_printPicIsrTbl()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("picPrioTable[12]={ {irq# : ");
|
||||
printk("picIsrTable[12]={");
|
||||
for (i=0; i<12; i++)
|
||||
printf("%d,", picPrioTable[i]);
|
||||
printf("}\n");
|
||||
printk("%d,", picIsrTable[i]);
|
||||
printk("}\n");
|
||||
|
||||
printf("GPPIrqInTbl: 0x%x :\n", GPPIrqInTbl);
|
||||
printk("GPPIrqInTbl: 0x%x :\n", GPPIrqInTbl);
|
||||
}
|
||||
@@ -36,18 +36,10 @@ static int connected(void) {return 1;}
|
||||
|
||||
static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER];
|
||||
static rtems_irq_global_settings initial_config;
|
||||
|
||||
#ifdef BSP_SHARED_HANDLER_SUPPORT
|
||||
static rtems_irq_connect_data defaultIrq = {
|
||||
/* vectorIdex, hdl ,handle , on , off , isOn ,next_handler, */
|
||||
0, nop_func , NULL , nop_func , nop_func , not_connected, 0
|
||||
};
|
||||
#else
|
||||
static rtems_irq_connect_data defaultIrq = {
|
||||
/* vectorIdex, hdl , handle , on , off , isOn */
|
||||
0, nop_func , NULL , nop_func , nop_func , not_connected
|
||||
};
|
||||
#endif
|
||||
|
||||
rtems_irq_prio BSPirqPrioTable[BSP_PIC_IRQ_NUMBER]={
|
||||
/*
|
||||
@@ -143,6 +135,12 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
|
||||
#ifdef TRACE_IRQ_INIT
|
||||
printk("Done setup irq mngt configuration\n");
|
||||
#endif
|
||||
|
||||
/* I don't really understand why all sources are enable here... (T.S) */
|
||||
for (i= BSP_MAIN_GPP7_0_IRQ; i <= BSP_MAIN_GPP31_24_IRQ; i++)
|
||||
BSP_enable_pic_irq(i);
|
||||
|
||||
rtems_interrupt_enable(l);
|
||||
|
||||
#ifdef TRACE_IRQ_INIT
|
||||
printk("RTEMS IRQ management is now operationnal\n");
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
* Acknowledgements:
|
||||
* netBSD : Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
|
||||
* Marvell : NDA document for the discovery system controller
|
||||
* The author referenced two RTEMS network drivers of other NICs.
|
||||
* rtems : 1) dec21140.c, a network driver for for TULIP based Ethernet Controller
|
||||
* (C) 1999 Emmanuel Raguet. raguet@crf.canon.fr
|
||||
*
|
||||
* 2) yellowfin.c, a network driver for the SVGM5 BSP.
|
||||
* Stanford Linear Accelerator Center, Till Straumann
|
||||
*
|
||||
* Some notes from the author, S. Kate Feng :
|
||||
*
|
||||
@@ -360,7 +366,8 @@ int rtems_GT64260eth_driver_attach(struct rtems_bsdnet_ifconfig *config, int att
|
||||
if (unit < 0) return 0;
|
||||
|
||||
printk("\nEthernet driver name %s unit %d \n",name, unit);
|
||||
printk("RTEMS-mvme5500 BSP Copyright (c) 2004, Brookhaven National Lab., Shuchen Kate Feng \n");
|
||||
printk("(c) 2004, Brookhaven National Lab. <feng1@bnl.gov> (RTEMS/mvme5500 port)\n");
|
||||
|
||||
/* Make certain elements e.g. descriptor lists are aligned. */
|
||||
softc_mem = rtems_bsdnet_malloc(sizeof(*sc) + SOFTC_ALIGN, M_FREE, M_NOWAIT);
|
||||
|
||||
@@ -386,7 +393,7 @@ int rtems_GT64260eth_driver_attach(struct rtems_bsdnet_ifconfig *config, int att
|
||||
} else {
|
||||
printk("Read EEPROM ");
|
||||
for (i = 0; i < 6; i++)
|
||||
hwaddr[i] = ReadConfVPD_buff(VPD_ENET0_OFFSET+i);
|
||||
hwaddr[i] = ConfVPD_buff[VPD_ENET0_OFFSET+i];
|
||||
}
|
||||
|
||||
#ifdef GT_DEBUG
|
||||
@@ -1130,6 +1137,7 @@ static void GTeth_tx_stop(struct GTeth_softc *sc)
|
||||
sc->arpcom.ac_if.if_timer = 0;
|
||||
}
|
||||
|
||||
/* TOCHECK : Should it be about rx or tx ? */
|
||||
static void GTeth_ifchange(struct GTeth_softc *sc)
|
||||
{
|
||||
if (GTeth_debug>0) printk("GTeth_ifchange(");
|
||||
@@ -1437,7 +1445,6 @@ static void GTeth_hash_init(struct GTeth_softc *sc)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef GT64260eth_DEBUG
|
||||
static void GT64260eth_error(struct GTeth_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp = &sc->arpcom.ac_if;
|
||||
@@ -1467,7 +1474,7 @@ static void GT64260eth_error(struct GTeth_softc *sc)
|
||||
sc->intr_errsts[sc->intr_err_ptr1++]=0;
|
||||
sc->intr_err_ptr1 %= INTR_ERR_SIZE; /* Till Straumann */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* The daemon does all of the work; RX, TX and cleaning up buffers/descriptors */
|
||||
static void GT64260eth_daemon(void *arg)
|
||||
@@ -1541,9 +1548,7 @@ static void GT64260eth_daemon(void *arg)
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
/* Log errors and other uncommon events. */
|
||||
#ifdef GT64260eth_DEBUG
|
||||
if (events & ERR_EVENT) GT64260eth_error(sc);
|
||||
#endif
|
||||
} /* end for(;;) { rtems_bsdnet_event_receive() .....*/
|
||||
|
||||
ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
S. Kate Feng <feng1@bnl.gov>, Sept. 06, 2007
|
||||
|
||||
This driver boots smoothly with the 1GHZ media.
|
||||
It might not boot with the 10/100MHZ media.
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004,2005 RTEMS/Mvme5500 port by S. Kate Feng <feng1@bnl.gov>
|
||||
* under the Deaprtment of Energy contract DE-AC02-98CH10886
|
||||
* Brookhaven National Laboratory, All rights reserved
|
||||
*
|
||||
* Acknowledgements:
|
||||
@@ -26,7 +25,8 @@
|
||||
* hardware auto-neg. state machine disabled. PCI control "snoop
|
||||
* to WB region", MII mode (PHY) instead of TBI mode.
|
||||
* 6) We currently only use 32-bit (instead of 64-bit) DMA addressing.
|
||||
* 7) Implementation for Jumbo Frame and TCP checksum is not completed yet.
|
||||
* 7) Support for checksum offloading and TCP segmentation offload will
|
||||
* be available for releasing in 2008, upon request, if I still believe.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -34,11 +34,8 @@
|
||||
|
||||
#define INET
|
||||
|
||||
/*#define RTEMS_ETHERMTU_JUMBO*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/bspIo.h> /* printk */
|
||||
|
||||
#include <stdio.h> /* printf for statistics */
|
||||
#include <string.h>
|
||||
|
||||
@@ -67,7 +64,6 @@
|
||||
#include <net/if_dl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#ifdef INET
|
||||
#include <netinet/in_var.h>
|
||||
@@ -79,12 +75,14 @@
|
||||
#include <bsp/if_wmreg.h>
|
||||
#define WMREG_RADV 0x282c /* Receive Interrupt Absolute Delay Timer */
|
||||
|
||||
/*#define CKSUM_OFFLOAD*/
|
||||
|
||||
#define ETHERTYPE_FLOWCONTROL 0x8808 /* 802.3x flow control packet */
|
||||
|
||||
#define i82544EI_TASK_NAME "IGHz"
|
||||
#define i82544EI_TASK_NAME "IGHZ"
|
||||
#define SOFTC_ALIGN 4095
|
||||
|
||||
#define IF_ERR_BUFSZE 16
|
||||
#define INTR_ERR_SIZE 16
|
||||
|
||||
/*#define WM_DEBUG*/
|
||||
#ifdef WM_DEBUG
|
||||
@@ -92,7 +90,7 @@
|
||||
#define WM_DEBUG_TX 0x02
|
||||
#define WM_DEBUG_RX 0x04
|
||||
#define WM_DEBUG_GMII 0x08
|
||||
static int wm_debug = WM_DEBUG_TX|WM_DEBUG_RX|WM_DEBUG_LINK; /* May 7, 2009 */
|
||||
int wm_debug = WM_DEBUG_TX|WM_DEBUG_RX|WM_DEBUG_LINK;
|
||||
|
||||
#define DPRINTF(x, y) if (wm_debug & (x)) printk y
|
||||
#else
|
||||
@@ -111,12 +109,12 @@ static int wm_debug = WM_DEBUG_TX|WM_DEBUG_RX|WM_DEBUG_LINK; /* May 7, 2009 */
|
||||
|
||||
#define ALL_EVENTS (KILL_EVENT|START_TRANSMIT_EVENT|RX_EVENT|TX_EVENT|ERR_EVENT|INIT_EVENT)
|
||||
|
||||
/* <skf> used 64 in 4.8.0, TOD; try 4096 */
|
||||
#define NTXDESC 256
|
||||
|
||||
#define NTXDESC 128
|
||||
#define NTXDESC_MASK (NTXDESC - 1)
|
||||
#define WM_NEXTTX(x) (((x) + 1) & NTXDESC_MASK)
|
||||
|
||||
#define NRXDESC 256
|
||||
#define NRXDESC 64
|
||||
#define NRXDESC_MASK (NRXDESC - 1)
|
||||
#define WM_NEXTRX(x) (((x) + 1) & NRXDESC_MASK)
|
||||
#define WM_PREVRX(x) (((x) - 1) & NRXDESC_MASK)
|
||||
@@ -125,10 +123,9 @@ static int wm_debug = WM_DEBUG_TX|WM_DEBUG_RX|WM_DEBUG_LINK; /* May 7, 2009 */
|
||||
#define WM_CDTXOFF(x) WM_CDOFF(sc_txdescs[(x)])
|
||||
#define WM_CDRXOFF(x) WM_CDOFF(sc_rxdescs[(x)])
|
||||
|
||||
#define TXQ_HiLmt_OFF 32
|
||||
#define TXQ_HiLmt_OFF 64
|
||||
|
||||
static uint32_t TxDescCmd;
|
||||
static unsigned BSP_1GHz_membase;
|
||||
|
||||
/*
|
||||
* Software state per device.
|
||||
@@ -139,9 +136,9 @@ struct wm_softc {
|
||||
struct mbuf *txs_mbuf[NTXDESC]; /* transmit buffer memory */
|
||||
struct mbuf *rxs_mbuf[NRXDESC]; /* receive buffer memory */
|
||||
struct wm_softc *next_module;
|
||||
volatile unsigned int if_errsts[IF_ERR_BUFSZE]; /* intr_status */
|
||||
unsigned int if_err_ptr1; /* ptr used in i82544EI_error() */
|
||||
unsigned int if_err_ptr2; /* ptr used in ISR */
|
||||
volatile unsigned int intr_errsts[INTR_ERR_SIZE]; /* intr_status */
|
||||
unsigned int intr_err_ptr1; /* ptr used in i82544EI_error() */
|
||||
unsigned int intr_err_ptr2; /* ptr used in ISR */
|
||||
int txs_firstdesc; /* first descriptor in packet */
|
||||
int txs_lastdesc; /* last descriptor in packet */
|
||||
int txs_ndesc; /* # of descriptors used */
|
||||
@@ -171,16 +168,15 @@ struct wm_softc {
|
||||
int sc_rxptr; /* next ready Rx descriptor/queue ent */
|
||||
int sc_rxdiscard;
|
||||
int sc_rxlen;
|
||||
|
||||
uint32_t sc_ctrl; /* prototype CTRL register */
|
||||
#if 0
|
||||
uint32_t sc_ctrl_ext; /* prototype CTRL_EXT register */
|
||||
|
||||
#endif
|
||||
uint32_t sc_icr; /* prototype interrupt bits */
|
||||
uint32_t sc_tctl; /* prototype TCTL register */
|
||||
uint32_t sc_rctl; /* prototype RCTL register */
|
||||
uint32_t sc_tipg; /* prototype TIPG register */
|
||||
uint32_t sc_fcrtl; /* prototype FCRTL register */
|
||||
uint32_t sc_pba; /* prototype PBA register */
|
||||
|
||||
int sc_mchash_type; /* multicast filter offset */
|
||||
|
||||
@@ -188,6 +184,11 @@ struct wm_softc {
|
||||
struct {
|
||||
volatile unsigned long rxInterrupts;
|
||||
volatile unsigned long txInterrupts;
|
||||
unsigned long txMultiBuffPacket;
|
||||
unsigned long txMultiMaxLen;
|
||||
unsigned long txSinglMaxLen;
|
||||
unsigned long txMultiMaxLoop;
|
||||
unsigned long txBuffMaxLen;
|
||||
unsigned long linkInterrupts;
|
||||
unsigned long length_errors;
|
||||
unsigned long frame_errors;
|
||||
@@ -223,20 +224,22 @@ struct wm_softc {
|
||||
static struct wm_softc *root_i82544EI_dev = NULL;
|
||||
|
||||
static void i82544EI_ifstart(struct ifnet *ifp);
|
||||
static int wm_ioctl(struct ifnet *ifp, ioctl_command_t cmd,caddr_t data);
|
||||
static int wm_ioctl(struct ifnet *ifp, u_long cmd,uint32_t data);
|
||||
static void i82544EI_ifinit(void *arg);
|
||||
static void wm_stop(struct ifnet *ifp, int disable);
|
||||
static void wm_gmii_mediainit(struct wm_softc *sc);
|
||||
|
||||
static void wm_rxdrain(struct wm_softc *sc);
|
||||
static int wm_add_rxbuf(struct wm_softc *sc, int idx);
|
||||
static int wm_read_eeprom(struct wm_softc *sc,int word,int wordcnt, uint16_t *data);
|
||||
static void i82544EI_daemon(void *arg);
|
||||
static void wm_set_filter(struct wm_softc *sc);
|
||||
static void i82544EI_rx(struct wm_softc *sc);
|
||||
static void i82544EI_isr(rtems_irq_hdl_param handle);
|
||||
|
||||
static void i82544EI_isr(void);
|
||||
static void i82544EI_sendpacket(struct wm_softc *sc, struct mbuf *m);
|
||||
extern int pci_mem_find(), pci_io_find(), pci_get_capability();
|
||||
extern int pci_mem_find(int b, int d, int f, int reg, unsigned *basep,unsigned *sizep);
|
||||
extern int pci_io_find(int b, int d, int f, int reg,unsigned *basep,unsigned *sizep);
|
||||
extern int pci_get_capability(int b, int d, int f, int capid,int *offset,uint32_t *value);
|
||||
extern char * ether_sprintf1(void);
|
||||
|
||||
static void i82544EI_irq_on(const rtems_irq_connect_data *irq)
|
||||
{
|
||||
@@ -268,7 +271,6 @@ static int i82544EI_irq_is_on(const rtems_irq_connect_data *irq)
|
||||
static rtems_irq_connect_data i82544IrqData={
|
||||
BSP_GPP_82544_IRQ,
|
||||
(rtems_irq_hdl) i82544EI_isr,
|
||||
(rtems_irq_hdl_param) NULL,
|
||||
(rtems_irq_enable) i82544EI_irq_on,
|
||||
(rtems_irq_disable) i82544EI_irq_off,
|
||||
(rtems_irq_is_enabled) i82544EI_irq_is_on,
|
||||
@@ -288,12 +290,9 @@ int rtems_i82544EI_driver_attach(struct rtems_bsdnet_ifconfig *config, int attac
|
||||
|
||||
unit = rtems_bsdnet_parse_driver_name(config, &name);
|
||||
if (unit < 0) return 0;
|
||||
|
||||
if ( !strncmp((const char *)name,"autoz",5))
|
||||
memcpy(name,"gtGHz",5);
|
||||
|
||||
printk("\nAttaching MVME5500 1GHz NIC%d\n", unit);
|
||||
printk("RTEMS-mvme5500 BSP Copyright (c) 2004,2005,2008, Brookhaven National Lab., Shuchen Kate Feng \n");
|
||||
|
||||
printk("\nEthernet driver name %s unit %d \n",name, unit);
|
||||
printk("Copyright (c) 2004,2005 S. Kate Feng <feng1@bnl.gov> (RTEMS/mvme5500 port)\n");
|
||||
|
||||
/* Make sure certain elements e.g. descriptor lists are aligned.*/
|
||||
softc_mem = rtems_bsdnet_malloc(sizeof(*sc) + SOFTC_ALIGN, M_FREE, M_NOWAIT);
|
||||
@@ -311,7 +310,7 @@ int rtems_i82544EI_driver_attach(struct rtems_bsdnet_ifconfig *config, int attac
|
||||
unit-1,&b, &d, &f))
|
||||
rtems_panic("i82544EI device ID not found\n");
|
||||
|
||||
#ifdef WM_DEBUG
|
||||
#if WM_DEBUG
|
||||
printk("82544EI:b%d, d%d, f%d\n", b, d,f);
|
||||
#endif
|
||||
|
||||
@@ -319,18 +318,13 @@ int rtems_i82544EI_driver_attach(struct rtems_bsdnet_ifconfig *config, int attac
|
||||
if ( pci_mem_find(b,d,f,PCI_MAPREG_START, &sc->sc_membase, &sc->sc_memsize))
|
||||
rtems_panic("i82544EI: unable to map memory space\n");
|
||||
|
||||
#ifdef WM_DEBUG
|
||||
printk("Memory base addr 0x%x\n", sc->sc_membase);
|
||||
#endif
|
||||
BSP_1GHz_membase= sc->sc_membase;
|
||||
|
||||
#ifdef WM_DEBUG
|
||||
printk("Memory base addr 0x%x\n", sc->sc_membase);
|
||||
printk("txdesc[0] addr:0x%x, rxdesc[0] addr:0x%x, sizeof sc %d\n",&sc->sc_txdescs[0], &sc->sc_rxdescs[0], sizeof(*sc));
|
||||
#endif
|
||||
|
||||
|
||||
sc->sc_ctrl=CSR_READ(sc,WMREG_CTRL);
|
||||
sc->sc_ctrl |=CSR_READ(sc,WMREG_CTRL);
|
||||
/*
|
||||
* Determine a few things about the bus we're connected to.
|
||||
*/
|
||||
@@ -368,10 +362,11 @@ int rtems_i82544EI_driver_attach(struct rtems_bsdnet_ifconfig *config, int attac
|
||||
enaddr[4] = myea[2] & 0xff;
|
||||
enaddr[5] = myea[2] >> 8;
|
||||
|
||||
|
||||
memcpy(sc->arpcom.ac_enaddr, enaddr, ETHER_ADDR_LEN);
|
||||
#ifdef WM_DEBUG
|
||||
printk("%s: Ethernet address %s\n", sc->dv_xname,
|
||||
ether_sprintf(enaddr));
|
||||
ether_sprintf1(enaddr));
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -402,39 +397,13 @@ int rtems_i82544EI_driver_attach(struct rtems_bsdnet_ifconfig *config, int attac
|
||||
CSR_WRITE(sc,WMREG_CTRL_EXT, sc->sc_ctrl_ext);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine if we're TBI or GMII mode, and initialize the
|
||||
* media structures accordingly.
|
||||
*/
|
||||
if ((CSR_READ(sc, WMREG_STATUS) & STATUS_TBIMODE) != 0) {
|
||||
/* 1000BASE-X : fiber (TBI mode)
|
||||
wm_tbi_mediainit(sc); */
|
||||
} else { /* 1000BASE-T : copper (internal PHY mode), for the mvme5500 */
|
||||
wm_gmii_mediainit(sc);
|
||||
}
|
||||
|
||||
ifp = &sc->arpcom.ac_if;
|
||||
/* set this interface's name and unit */
|
||||
ifp->if_unit = unit;
|
||||
ifp->if_name = name;
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
#ifdef RTEMS_ETHERMTU_JUMBO
|
||||
sc->arpcom.ec_capabilities |= ETHERCAP_JUMBO_MTU;
|
||||
ifp->if_mtu = config->mtu ? config->mtu : ETHERMTU_JUMBO;
|
||||
#else
|
||||
ifp->if_mtu = config->mtu ? config->mtu : ETHERMTU;
|
||||
#endif
|
||||
#ifdef RTEMS_CKSUM_OFFLOAD
|
||||
/* < skf> The following is really not related to jumbo frame
|
||||
sc->arpcom.ec_capabilities |= ETHERCAP_VLAN_MTU;*/
|
||||
ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
|
||||
IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
|
||||
IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx |
|
||||
IFCAP_CSUM_TCPv6_Tx | IFCAP_CSUM_UDPv6_Tx |
|
||||
IFCAP_TSOv4; /* TCP segmentation offload. */
|
||||
#endif
|
||||
|
||||
ifp->if_ioctl = wm_ioctl;
|
||||
ifp->if_start = i82544EI_ifstart;
|
||||
/* ifp->if_watchdog = wm_watchdog;*/
|
||||
@@ -449,8 +418,7 @@ int rtems_i82544EI_driver_attach(struct rtems_bsdnet_ifconfig *config, int attac
|
||||
rtems_build_name('I','G','H','Z'),0,0,0,&sc->daemonSync))
|
||||
rtems_panic("i82544EI: semaphore creation failed");
|
||||
|
||||
i82544IrqData.handle= (rtems_irq_hdl_param) sc;
|
||||
/* sc->next_module = root_i82544EI_dev;*/
|
||||
sc->next_module = root_i82544EI_dev;
|
||||
root_i82544EI_dev = sc;
|
||||
|
||||
/* Attach the interface. */
|
||||
@@ -463,47 +431,6 @@ int rtems_i82544EI_driver_attach(struct rtems_bsdnet_ifconfig *config, int attac
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* wm_reset:
|
||||
*
|
||||
* Reset the i82544 chip.
|
||||
*/
|
||||
static void wm_reset(struct wm_softc *sc)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Packet Buffer Allocation (PBA)
|
||||
* Writing PBA sets the receive portion of the buffer.
|
||||
* the remainder is used for the transmit buffer.
|
||||
*
|
||||
* 82544 has a Packet Buffer of 64K.
|
||||
* Default allocation : PBA=40K for Rx, leaving 24K for Tx.
|
||||
* Default for jumbo: PBA=48K for Rx, leaving 16K for Tx.
|
||||
*/
|
||||
sc->sc_pba = sc->arpcom.ac_if.if_mtu > 8192 ? PBA_40K : PBA_48K;
|
||||
CSR_WRITE(sc, WMREG_PBA, sc->sc_pba);
|
||||
|
||||
/* device reset */
|
||||
CSR_WRITE(sc, WMREG_CTRL, CTRL_RST);
|
||||
rtems_bsp_delay(10000);
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
if ((CSR_READ(sc, WMREG_CTRL) & CTRL_RST) == 0)
|
||||
break;
|
||||
rtems_bsp_delay(20);
|
||||
}
|
||||
if (CSR_READ(sc, WMREG_CTRL) & CTRL_RST)
|
||||
printk("Intel 82544 1GHz reset failed to complete\n");
|
||||
|
||||
sc->sc_ctrl_ext = CSR_READ(sc,WMREG_CTRL_EXT);
|
||||
sc->sc_ctrl_ext |= CTRL_EXT_EE_RST;
|
||||
CSR_WRITE(sc, WMREG_CTRL_EXT, sc->sc_ctrl_ext);
|
||||
CSR_READ(sc, WMREG_STATUS);
|
||||
/* Wait for EEPROM reload */
|
||||
rtems_bsp_delay(2000);
|
||||
sc->sc_ctrl= CSR_READ(sc, WMREG_CTRL);
|
||||
}
|
||||
|
||||
/*
|
||||
* i82544EI_ifstart: [ifnet interface function]
|
||||
*
|
||||
@@ -536,21 +463,27 @@ static void i82544EI_stats(struct wm_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp = &sc->arpcom.ac_if;
|
||||
|
||||
printf(" Ghost Interrupts:%-8lu\n", sc->stats.ghostInterrupts);
|
||||
printf(" Rx Interrupts:%-8lu\n", sc->stats.rxInterrupts);
|
||||
printf(" Rx Interrupts:%-8u\n", sc->stats.rxInterrupts);
|
||||
printf(" Receive Packets:%-8u\n", CSR_READ(sc,WMREG_GPRC));
|
||||
printf(" Receive Overrun:%-8lu\n", sc->stats.rxOvrRunInterrupts);
|
||||
printf(" Receive Overrun:%-8u\n", sc->stats.rxOvrRunInterrupts);
|
||||
printf(" Receive errors:%-8u\n", CSR_READ(sc,WMREG_RXERRC));
|
||||
printf(" Rx sequence error:%-8lu\n", sc->stats.rxSeqErr);
|
||||
printf(" Rx /C/ ordered:%-8lu\n", sc->stats.rxC_ordered);
|
||||
printf(" Rx sequence error:%-8u\n", sc->stats.rxSeqErr);
|
||||
printf(" Rx /C/ ordered:%-8u\n", sc->stats.rxC_ordered);
|
||||
printf(" Rx Length Errors:%-8u\n", CSR_READ(sc,WMREG_RLEC));
|
||||
printf(" Tx Interrupts:%-8lu\n", sc->stats.txInterrupts);
|
||||
printf(" Tx Interrupts:%-8u\n", sc->stats.txInterrupts);
|
||||
#if 0
|
||||
printf("Multi-BuffTx Packets:%-8u\n", sc->stats.txMultiBuffPacket);
|
||||
printf("Multi-BuffTx max len:%-8u\n", sc->stats.txMultiMaxLen);
|
||||
printf("SingleBuffTx max len:%-8u\n", sc->stats.txSinglMaxLen);
|
||||
printf("Multi-BuffTx maxloop:%-8u\n", sc->stats.txMultiMaxLoop);
|
||||
printf("Tx buffer max len :%-8u\n", sc->stats.txBuffMaxLen);
|
||||
#endif
|
||||
printf(" Transmitt Packets:%-8u\n", CSR_READ(sc,WMREG_GPTC));
|
||||
printf(" Transmitt errors:%-8lu\n", ifp->if_oerrors);
|
||||
printf(" Active Txqs:%-8lu\n", sc->txq_nactive);
|
||||
printf(" Transmitt errors:%-8u\n", ifp->if_oerrors);
|
||||
printf(" Active Txqs:%-8u\n", sc->txq_nactive);
|
||||
printf(" collisions:%-8u\n", CSR_READ(sc,WMREG_COLC));
|
||||
printf(" Crc Errors:%-8u\n", CSR_READ(sc,WMREG_CRCERRS));
|
||||
printf(" Link Status Change:%-8lu\n", sc->stats.linkStatusChng);
|
||||
printf(" Link Status Change:%-8u\n", sc->stats.linkStatusChng);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -558,7 +491,7 @@ static void i82544EI_stats(struct wm_softc *sc)
|
||||
*
|
||||
* Handle control requests from the operator.
|
||||
*/
|
||||
static int wm_ioctl(struct ifnet *ifp, ioctl_command_t cmd,caddr_t data)
|
||||
static int wm_ioctl(struct ifnet *ifp, u_long cmd,uint32_t data)
|
||||
{
|
||||
struct wm_softc *sc = ifp->if_softc;
|
||||
int error=0;
|
||||
@@ -590,9 +523,9 @@ static int wm_ioctl(struct ifnet *ifp, ioctl_command_t cmd,caddr_t data)
|
||||
*
|
||||
* Interrupt service routine.
|
||||
*/
|
||||
static void i82544EI_isr(rtems_irq_hdl_param handle)
|
||||
static void i82544EI_isr()
|
||||
{
|
||||
volatile struct wm_softc *sc = (struct wm_softc *) handle;
|
||||
volatile struct wm_softc *sc = root_i82544EI_dev;
|
||||
uint32_t icr;
|
||||
rtems_event_set events=0;
|
||||
|
||||
@@ -616,8 +549,8 @@ static void i82544EI_isr(rtems_irq_hdl_param handle)
|
||||
events |= INIT_EVENT;
|
||||
}
|
||||
if (icr & ICR_RXSEQ) /* framing error */ {
|
||||
sc->if_errsts[sc->if_err_ptr2++]=icr;
|
||||
if ( sc->if_err_ptr2 ==IF_ERR_BUFSZE) sc->if_err_ptr2=0;
|
||||
sc->intr_errsts[sc->intr_err_ptr2++]=icr;
|
||||
sc->intr_err_ptr2 %=INTR_ERR_SIZE; /* Till Straumann */
|
||||
events |= ERR_EVENT;
|
||||
sc->stats.rxSeqErr++;
|
||||
}
|
||||
@@ -675,12 +608,15 @@ static void i82544EI_sendpacket(struct wm_softc *sc, struct mbuf *m)
|
||||
* The other way is effective for packets < 2K
|
||||
*/
|
||||
if ( ((y=(len+mtp->m_len)) > sizeof(union mcluster))) {
|
||||
printk(" >%d, use next descriptor\n", sizeof(union mcluster));
|
||||
printk(">2048, use next descriptor\n");
|
||||
break;
|
||||
}
|
||||
memcpy((void *)pt,(char *)mtp->m_data, mtp->m_len);
|
||||
pt += mtp->m_len;
|
||||
len += mtp->m_len;
|
||||
#if 0
|
||||
sc->stats.txSinglMaxLen= MAX(mtp->m_len, sc->stats.txSinglMaxLen);
|
||||
#endif
|
||||
} /* end for loop */
|
||||
mdest->m_len=len;
|
||||
sc->txs_mbuf[sc->txq_next] = mdest;
|
||||
@@ -694,8 +630,15 @@ static void i82544EI_sendpacket(struct wm_softc *sc, struct mbuf *m)
|
||||
sc->txq_free--;
|
||||
else
|
||||
rtems_panic("i8254EI : no more free descriptors");
|
||||
#if 0
|
||||
sc->stats.txMultiMaxLen= MAX(mdest->m_len, sc->stats.txMultiMaxLen);
|
||||
sc->stats.txMultiBuffPacket++;
|
||||
#endif
|
||||
} /* end for while */
|
||||
/* free old mbuf chain */
|
||||
#if 0
|
||||
sc->stats.txMultiMaxLoop=MAX(loop, sc->stats.txMultiMaxLoop);
|
||||
#endif
|
||||
m_freem(m);
|
||||
m=0;
|
||||
} /* end multiple mbufs */
|
||||
@@ -801,11 +744,12 @@ static void i82544EI_rx(struct wm_softc *sc)
|
||||
sc->dv_xname, i));
|
||||
|
||||
status = sc->sc_rxdescs[i].wrx_status;
|
||||
if ((status & WRX_ST_DD) == 0) break; /* descriptor not done */
|
||||
|
||||
errors = sc->sc_rxdescs[i].wrx_errors;
|
||||
len = le16toh(sc->sc_rxdescs[i].wrx_len);
|
||||
m = sc->rxs_mbuf[i];
|
||||
|
||||
if ((status & WRX_ST_DD) == 0) break; /* descriptor not done */
|
||||
|
||||
if (sc->sc_rxdiscard) {
|
||||
printk("RX: discarding contents of descriptor %d\n", i);
|
||||
wm_init_rxdesc(sc, i);
|
||||
@@ -877,46 +821,16 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
int i,error;
|
||||
uint8_t cksumfields;
|
||||
|
||||
#if 0
|
||||
/* KATETODO : sc_align_tweak */
|
||||
/*
|
||||
* *_HDR_ALIGNED_P is constant 1 if __NO_STRICT_ALIGMENT is set.
|
||||
* There is a small but measurable benefit to avoiding the adjusment
|
||||
* of the descriptor so that the headers are aligned, for normal mtu,
|
||||
* on such platforms. One possibility is that the DMA itself is
|
||||
* slightly more efficient if the front of the entire packet (instead
|
||||
* of the front of the headers) is aligned.
|
||||
*
|
||||
* Note we must always set align_tweak to 0 if we are using
|
||||
* jumbo frames.
|
||||
*/
|
||||
#ifdef __NO_STRICT_ALIGNMENT
|
||||
sc->sc_align_tweak = 0;
|
||||
#else
|
||||
if ((ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN) > (MCLBYTES - 2))
|
||||
sc->sc_align_tweak = 0;
|
||||
else
|
||||
sc->sc_align_tweak = 2;
|
||||
#endif /* __NO_STRICT_ALIGNMENT */
|
||||
#endif
|
||||
|
||||
/* Cancel any pending I/O. */
|
||||
wm_stop(ifp, 0);
|
||||
|
||||
/* update statistics before reset */
|
||||
ifp->if_collisions += CSR_READ(sc, WMREG_COLC);
|
||||
ifp->if_ierrors += CSR_READ(sc, WMREG_RXERRC);
|
||||
|
||||
/* Reset the chip to a known state. */
|
||||
wm_reset(sc);
|
||||
|
||||
/* Initialize the error buffer ring */
|
||||
sc->if_err_ptr1=0;
|
||||
sc->if_err_ptr2=0;
|
||||
for (i=0; i< IF_ERR_BUFSZE; i++) sc->if_errsts[i]=0;
|
||||
sc->intr_err_ptr1=0;
|
||||
sc->intr_err_ptr2=0;
|
||||
for (i=0; i< INTR_ERR_SIZE; i++) sc->intr_errsts[i]=0;
|
||||
|
||||
/* Initialize the transmit descriptor ring. */
|
||||
memset( (void *) sc->sc_txdescs, 0, sizeof(sc->sc_txdescs));
|
||||
memset(sc->sc_txdescs, 0, sizeof(sc->sc_txdescs));
|
||||
sc->txq_free = NTXDESC;
|
||||
sc->txq_next = 0;
|
||||
sc->txs_lastdesc = 0;
|
||||
@@ -935,8 +849,8 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
CSR_WRITE(sc,WMREG_TDLEN, sizeof(sc->sc_txdescs));
|
||||
CSR_WRITE(sc,WMREG_TDH, 0);
|
||||
CSR_WRITE(sc,WMREG_TDT, 0);
|
||||
CSR_WRITE(sc,WMREG_TIDV, 0 );
|
||||
/* CSR_WRITE(sc,WMREG_TADV, 128); not for 82544 */
|
||||
CSR_WRITE(sc,WMREG_TIDV, 64 );
|
||||
CSR_WRITE(sc,WMREG_TADV, 128);
|
||||
|
||||
CSR_WRITE(sc,WMREG_TXDCTL, TXDCTL_PTHRESH(0) |
|
||||
TXDCTL_HTHRESH(0) | TXDCTL_WTHRESH(0));
|
||||
@@ -950,11 +864,10 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
* Set up checksum offload parameters for
|
||||
* this packet.
|
||||
*/
|
||||
#ifdef RTEMS_CKSUM_OFFLOAD
|
||||
if (m0->m_pkthdr.csum_flags & (M_CSUM_TSOv4|M_CSUM_TSOv6|
|
||||
M_CSUM_IPv4|M_CSUM_TCPv4|M_CSUM_UDPv4|
|
||||
M_CSUM_TCPv6|M_CSUM_UDPv6)) {
|
||||
if (wm_tx_offload(sc, txs, &TxDescCmd,&cksumfields) != 0) {
|
||||
#ifdef CKSUM_OFFLOAD
|
||||
if (m0->m_pkthdr.csum_flags &
|
||||
(M_CSUM_IPv4|M_CSUM_TCPv4|M_CSUM_UDPv4)) {
|
||||
if (wm_tx_cksum(sc, txs, &TxDescCmd,&cksumfields) != 0) {
|
||||
/* Error message already displayed. */
|
||||
continue;
|
||||
}
|
||||
@@ -962,7 +875,7 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
#endif
|
||||
TxDescCmd = 0;
|
||||
cksumfields = 0;
|
||||
#ifdef RTEMS_CKSUM_OFFLOAD
|
||||
#ifdef CKSUM_OFFLOAD
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -981,14 +894,14 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
* Initialize the receive descriptor and receive job
|
||||
* descriptor rings.
|
||||
*/
|
||||
memset( (void *) sc->sc_rxdescs, 0, sizeof(sc->sc_rxdescs));
|
||||
memset(sc->sc_rxdescs, 0, sizeof(sc->sc_rxdescs));
|
||||
CSR_WRITE(sc,WMREG_RDBAH, 0);
|
||||
CSR_WRITE(sc,WMREG_RDBAL, WM_CDRXADDR(sc));
|
||||
CSR_WRITE(sc,WMREG_RDLEN, sizeof(sc->sc_rxdescs));
|
||||
CSR_WRITE(sc,WMREG_RDH, 0);
|
||||
CSR_WRITE(sc,WMREG_RDT, 0);
|
||||
CSR_WRITE(sc,WMREG_RDTR, 0 |RDTR_FPD);
|
||||
/* CSR_WRITE(sc, WMREG_RADV, 256); not for 82544. */
|
||||
CSR_WRITE(sc, WMREG_RADV, 256);
|
||||
|
||||
for (i = 0; i < NRXDESC; i++) {
|
||||
if (sc->rxs_mbuf[i] == NULL) {
|
||||
@@ -1017,14 +930,14 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
for (i = 0; i < WM_VLAN_TABSIZE; i++)
|
||||
CSR_WRITE(sc,WMREG_VFTA + (i << 2), 0);
|
||||
|
||||
#if 0
|
||||
/* Use MOTLoad default
|
||||
/*
|
||||
* Set up flow-control parameters.
|
||||
*
|
||||
* XXX Values could probably stand some tuning.
|
||||
*/
|
||||
CSR_WRITE(sc,WMREG_FCAL, FCAL_CONST);/* same as MOTLOAD 0x00c28001 */
|
||||
CSR_WRITE(sc,WMREG_FCAH, FCAH_CONST);/* same as MOTLOAD 0x00000100 */
|
||||
CSR_WRITE(sc,WMREG_FCT, ETHERTYPE_FLOWCONTROL);/* same as MOTLoad 0x8808 */
|
||||
CSR_WRITE(sc,WMREG_FCAL, FCAL_CONST);/*safe,even though MOTLOAD 0x00c28001 */
|
||||
CSR_WRITE(sc,WMREG_FCAH, FCAH_CONST);/*safe,even though MOTLOAD 0x00000100 */
|
||||
CSR_WRITE(sc,WMREG_FCT, ETHERTYPE_FLOWCONTROL);/*safe,even though MOTLoad 0x8808 */
|
||||
|
||||
|
||||
/* safe,even though MOTLoad default all 0 */
|
||||
@@ -1032,14 +945,12 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
|
||||
CSR_WRITE(sc,WMREG_FCRTH, FCRTH_DFLT);
|
||||
CSR_WRITE(sc,WMREG_FCRTL, sc->sc_fcrtl);
|
||||
/*KATETO CSR_WRITE(sc,WMREG_FCTTV, FCTTV_DFLT);*/
|
||||
CSR_WRITE(sc,WMREG_FCTTV, 0x100);
|
||||
#endif
|
||||
CSR_WRITE(sc,WMREG_FCTTV, FCTTV_DFLT);
|
||||
|
||||
sc->sc_ctrl &= ~CTRL_VME;
|
||||
/* TODO : not here.
|
||||
Configures flow control settings after link is established
|
||||
sc->sc_ctrl |= CTRL_TFCE | CTRL_RFCE; */
|
||||
/*sc->sc_ctrl |= CTRL_TFCE | CTRL_RFCE;*/
|
||||
/* enable Big Endian Mode for the powerPC
|
||||
sc->sc_ctrl |= CTRL_BEM;*/
|
||||
|
||||
/* Write the control registers. */
|
||||
CSR_WRITE(sc,WMREG_CTRL, sc->sc_ctrl);
|
||||
@@ -1047,27 +958,12 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
CSR_WRITE(sc,WMREG_CTRL_EXT, sc->sc_ctrl_ext);
|
||||
#endif
|
||||
|
||||
/* MOTLoad : WMREG_RXCSUM (0x5000)= 0, no Rx checksum offloading */
|
||||
#ifdef RTEMS_CKSUM_OFFLOAD
|
||||
/*
|
||||
* Set up checksum offload parameters.
|
||||
*/
|
||||
reg = CSR_READ(sc, WMREG_RXCSUM);
|
||||
reg &= ~(RXCSUM_IPOFL | RXCSUM_IPV6OFL | RXCSUM_TUOFL);
|
||||
if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
|
||||
reg |= RXCSUM_IPOFL;
|
||||
if (ifp->if_capenable & (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx))
|
||||
reg |= RXCSUM_IPOFL | RXCSUM_TUOFL;
|
||||
if (ifp->if_capenable & (IFCAP_CSUM_TCPv6_Rx | IFCAP_CSUM_UDPv6_Rx))
|
||||
reg |= RXCSUM_IPV6OFL | RXCSUM_TUOFL;
|
||||
CSR_WRITE(sc, WMREG_RXCSUM, reg);
|
||||
#endif
|
||||
/* MOTLoad : WMREG_RXCSUM (0x5000)= 0, no Rx checksum offloading */
|
||||
|
||||
/*
|
||||
* Set up the interrupt registers.
|
||||
*/
|
||||
CSR_WRITE(sc,WMREG_IMC, 0xffffffffU);
|
||||
|
||||
/* Reading the WMREG_ICR clears the interrupt bits */
|
||||
CSR_READ(sc,WMREG_ICR);
|
||||
|
||||
@@ -1091,8 +987,7 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
* we resolve the media type.
|
||||
*/
|
||||
sc->sc_tctl = TCTL_EN | TCTL_PSP | TCTL_CT(TX_COLLISION_THRESHOLD) |
|
||||
TCTL_COLD(TX_COLLISION_DISTANCE_FDX) |
|
||||
TCTL_RTLC /* retransmit on late collision */;
|
||||
TCTL_COLD(TX_COLLISION_DISTANCE_FDX) | TCTL_RTLC; /*transmitter enable*/
|
||||
|
||||
/*
|
||||
* Set up the receive control register; we actually program
|
||||
@@ -1100,31 +995,14 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
* address offset type 0.
|
||||
*
|
||||
* Only the i82544 has the ability to strip the incoming
|
||||
* CRC (RCTL_SECRC).
|
||||
* CRC, so we don't enable that feature. (TODO)
|
||||
*/
|
||||
sc->sc_mchash_type = 0;
|
||||
sc->sc_rctl = RCTL_EN | RCTL_LBM_NONE | RCTL_RDMTS_1_2 | RCTL_LPE |
|
||||
RCTL_DPF | RCTL_MO(sc->sc_mchash_type)|RCTL_SECRC;
|
||||
RCTL_DPF | RCTL_MO(sc->sc_mchash_type);
|
||||
|
||||
if (MCLBYTES == 2048) {
|
||||
sc->sc_rctl |= RCTL_2k;
|
||||
} else {
|
||||
switch(MCLBYTES) {
|
||||
case 4096:
|
||||
sc->sc_rctl |= RCTL_BSEX | RCTL_BSEX_4k;
|
||||
break;
|
||||
case 8192:
|
||||
sc->sc_rctl |= RCTL_BSEX | RCTL_BSEX_8k;
|
||||
break;
|
||||
case 16384:
|
||||
sc->sc_rctl |= RCTL_BSEX | RCTL_BSEX_16k;
|
||||
break;
|
||||
default:
|
||||
rtems_panic("wm_init: MCLBYTES %d unsupported",
|
||||
MCLBYTES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* (MCLBYTES == 2048) */
|
||||
sc->sc_rctl |= RCTL_2k;
|
||||
|
||||
#ifdef WM_DEBUG
|
||||
printk("RDBAL 0x%x,RDLEN %d, RDT %d\n",CSR_READ(sc,WMREG_RDBAL),CSR_READ(sc,WMREG_RDLEN), CSR_READ(sc,WMREG_RDT));
|
||||
@@ -1142,24 +1020,6 @@ static int i82544EI_init_hw(struct wm_softc *sc)
|
||||
return(0);
|
||||
}
|
||||
|
||||
void BSP_rdTIDV()
|
||||
{
|
||||
printf("Reg TIDV: 0x%x\n", in_le32((volatile unsigned *) (BSP_1GHz_membase+WMREG_TIDV)));
|
||||
}
|
||||
void BSP_rdRDTR()
|
||||
{
|
||||
printf("Reg RDTR: 0x%x\n", in_le32((volatile unsigned *) (BSP_1GHz_membase+WMREG_RDTR)));
|
||||
}
|
||||
|
||||
void BSP_setTIDV(int val)
|
||||
{
|
||||
out_le32((volatile unsigned *) (BSP_1GHz_membase+WMREG_TIDV), val);
|
||||
}
|
||||
|
||||
void BSP_setRDTR(int val)
|
||||
{
|
||||
out_le32((volatile unsigned *) (BSP_1GHz_membase+WMREG_RDTR), val);
|
||||
}
|
||||
/*
|
||||
* i82544EI_ifinit: [ifnet interface function]
|
||||
*
|
||||
@@ -1375,7 +1235,6 @@ static int wm_read_eeprom_uwire(struct wm_softc *sc, int word, int wordcnt, uint
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* wm_acquire_eeprom:
|
||||
*
|
||||
@@ -1407,7 +1266,6 @@ static int wm_acquire_eeprom(struct wm_softc *sc)
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wm_read_eeprom:
|
||||
@@ -1512,7 +1370,7 @@ static void wm_set_filter(struct wm_softc *sc)
|
||||
mta_reg = WMREG_CORDOVA_MTA;
|
||||
sc->sc_rctl &= ~(RCTL_BAM | RCTL_UPE | RCTL_MPE);
|
||||
|
||||
if (ifp->if_flags & IFF_BROADCAST)
|
||||
/* if (ifp->if_flags & IFF_BROADCAST)*/
|
||||
sc->sc_rctl |= RCTL_BAM;
|
||||
if (ifp->if_flags & IFF_PROMISC) {
|
||||
sc->sc_rctl |= RCTL_UPE;
|
||||
@@ -1582,11 +1440,12 @@ static void wm_set_filter(struct wm_softc *sc)
|
||||
static void i82544EI_error(struct wm_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp = &sc->arpcom.ac_if;
|
||||
unsigned long intr_status= sc->if_errsts[sc->if_err_ptr1];
|
||||
unsigned long intr_status= sc->intr_errsts[sc->intr_err_ptr1++];
|
||||
|
||||
/* read and reset the status; because this is written
|
||||
* by the ISR, we must disable interrupts here
|
||||
*/
|
||||
sc->intr_err_ptr1 %=INTR_ERR_SIZE; /* Till Straumann */
|
||||
if (intr_status) {
|
||||
printk("Error %s%d:", ifp->if_name, ifp->if_unit);
|
||||
if (intr_status & ICR_RXSEQ) {
|
||||
@@ -1596,8 +1455,6 @@ static void i82544EI_error(struct wm_softc *sc)
|
||||
}
|
||||
else
|
||||
printk("%s%d: Ghost interrupt ?\n",ifp->if_name,ifp->if_unit);
|
||||
sc->if_errsts[sc->if_err_ptr1]=0;
|
||||
if ((++sc->if_err_ptr1)==IF_ERR_BUFSZE) sc->if_err_ptr1=0; /* Till Straumann */
|
||||
}
|
||||
|
||||
void i82544EI_printStats()
|
||||
@@ -1638,7 +1495,7 @@ static void i82544EI_daemon(void *arg)
|
||||
&events);
|
||||
if (KILL_EVENT & events) break;
|
||||
|
||||
if (events & RX_EVENT) i82544EI_rx(sc); /* in ISR instead */
|
||||
if (events & RX_EVENT) i82544EI_rx(sc);
|
||||
|
||||
/* clean up and try sending packets */
|
||||
do {
|
||||
@@ -1646,7 +1503,6 @@ static void i82544EI_daemon(void *arg)
|
||||
|
||||
while (sc->txq_free>0) {
|
||||
if (sc->txq_free>TXQ_HiLmt_OFF) {
|
||||
m=0;
|
||||
IF_DEQUEUE(&ifp->if_snd,m);
|
||||
if (m==0) break;
|
||||
i82544EI_sendpacket(sc, m);
|
||||
@@ -1655,6 +1511,7 @@ static void i82544EI_daemon(void *arg)
|
||||
i82544EI_txq_done(sc);
|
||||
break;
|
||||
}
|
||||
if (events & RX_EVENT) i82544EI_rx(sc);
|
||||
}
|
||||
/* we leave this loop
|
||||
* - either because there's no free buffer
|
||||
@@ -1662,7 +1519,7 @@ static void i82544EI_daemon(void *arg)
|
||||
* - or there's nothing to send (IF_DEQUEUE
|
||||
* returned 0
|
||||
*/
|
||||
} while (m);
|
||||
} while (m && sc->txq_free);
|
||||
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
@@ -1699,70 +1556,3 @@ static void i82544EI_daemon(void *arg)
|
||||
*/
|
||||
rtems_task_delete(RTEMS_SELF);
|
||||
}
|
||||
|
||||
/*
|
||||
* wm_gmii_reset:
|
||||
*
|
||||
* Reset the PHY.
|
||||
*/
|
||||
static void wm_gmii_reset(struct wm_softc *sc)
|
||||
{
|
||||
|
||||
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl | CTRL_PHY_RESET);
|
||||
rtems_bsp_delay(20000);
|
||||
|
||||
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
|
||||
rtems_bsp_delay(20000);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* wm_gmii_mediainit:
|
||||
*
|
||||
* Initialize media for use on 1000BASE-T devices.
|
||||
*/
|
||||
static void wm_gmii_mediainit(struct wm_softc *sc)
|
||||
{
|
||||
/* struct ifnet *ifp = &sc->arpcom.ac_if;*/
|
||||
|
||||
/* We have MII. */
|
||||
sc->sc_flags |= WM_F_HAS_MII;
|
||||
|
||||
#if 1
|
||||
/* <skf> May 2009 : The value that should be programmed into IPGT is 10 */
|
||||
sc->sc_tipg = TIPG_IPGT(10)+TIPG_IPGR1(8)+TIPG_IPGR2(6);
|
||||
#else
|
||||
sc->sc_tipg = TIPG_1000T_DFLT; /* 0x602008 */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Let the chip set speed/duplex on its own based on
|
||||
* signals from the PHY.
|
||||
* XXXbouyer - I'm not sure this is right for the 80003,
|
||||
* the em driver only sets CTRL_SLU here - but it seems to work.
|
||||
*/
|
||||
sc->sc_ctrl |= CTRL_SLU;
|
||||
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
|
||||
|
||||
wm_gmii_reset(sc);
|
||||
|
||||
#if 0
|
||||
/* Initialize our media structures and probe the GMII. */
|
||||
sc->sc_mii.mii_ifp = ifp;
|
||||
|
||||
sc->sc_mii.mii_readreg = wm_gmii_i82544_readreg;
|
||||
sc->sc_mii.mii_writereg = wm_gmii_i82544_writereg;
|
||||
sc->sc_mii.mii_statchg = wm_gmii_statchg;
|
||||
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, wm_gmii_mediachange,
|
||||
wm_gmii_mediastatus);
|
||||
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, MIIF_DOPAUSE);
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
|
||||
ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE);
|
||||
} else
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
|
||||
* Some are added by Shuchen Kate Feng <feng1@bnl.gov>,
|
||||
* NSLS, Brookhaven National Laboratory. All rights reserved.
|
||||
* under the Deaprtment of Energy contract DE-AC02-98CH10886
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -59,7 +56,7 @@ typedef struct wiseman_addr {
|
||||
* The receive descriptor ring must be aligned to a 4K boundary,
|
||||
* and there must be an even multiple of 8 descriptors in the ring.
|
||||
*/
|
||||
typedef volatile struct wiseman_rxdesc {
|
||||
typedef struct wiseman_rxdesc {
|
||||
wiseman_addr_t wrx_addr; /* buffer address */
|
||||
|
||||
uint16_t wrx_len; /* buffer length */
|
||||
@@ -106,7 +103,7 @@ typedef struct wiseman_tx_fields {
|
||||
uint8_t wtxu_options; /* options */
|
||||
uint16_t wtxu_vlan; /* VLAN info */
|
||||
} __attribute__((__packed__)) wiseman_txfields_t;
|
||||
typedef volatile struct wiseman_txdesc {
|
||||
typedef struct wiseman_txdesc {
|
||||
wiseman_addr_t wtx_addr; /* buffer address */
|
||||
uint32_t wtx_cmdlen; /* command and length */
|
||||
wiseman_txfields_t wtx_fields; /* fields; see below */
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* Copyright (c) 1995, 1996, 1999, 2000
|
||||
* Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved.
|
||||
* Copyright (C) 2007 Brookhaven National Laboratory, Shuchen Kate Feng
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -31,7 +30,6 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <bsp.h>
|
||||
|
||||
/*
|
||||
* PCI Class and Revision Register; defines type and revision of device.
|
||||
@@ -307,7 +305,7 @@
|
||||
#define PCI_MAPREG_MEM64_ADDR_MASK 0xfffffffffffffff0ULL
|
||||
|
||||
#define PCI_MAPREG_IO_ADDR(mr) \
|
||||
((mr+PCI0_IO_BASE) & PCI_MAPREG_IO_ADDR_MASK)
|
||||
((mr) & PCI_MAPREG_IO_ADDR_MASK)
|
||||
#define PCI_MAPREG_IO_SIZE(mr) \
|
||||
(PCI_MAPREG_IO_ADDR(mr) & -PCI_MAPREG_IO_ADDR(mr))
|
||||
#define PCI_MAPREG_IO_ADDR_MASK 0xfffffffc
|
||||
|
||||
@@ -13,31 +13,29 @@
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/rtems/license.html.
|
||||
*
|
||||
* pci.c,v 1.2 2002/05/14 17:10:16 joel Exp
|
||||
* Copyright 2004, Brookhaven National Laboratory and
|
||||
* Shuchen K. Feng, <feng1@bnl.gov>, 2004
|
||||
* - modified and added support for MVME5500 board
|
||||
* - added 2nd PCI support for the mvme5500/GT64260 PCI bridge
|
||||
* - added bus support for the expansion of PMCSpan, thanks to
|
||||
* Peter Dufault (dufault@hda.com) for inputs.
|
||||
*
|
||||
* Copyright 2004, 2008 Brookhaven National Laboratory and
|
||||
* Shuchen K. Feng, <feng1@bnl.gov>
|
||||
*
|
||||
* - to be consistent with the original pci.c written by Eric Valette
|
||||
* - added 2nd PCI support for discovery based PCI bridge (e.g. mvme5500/mvme6100)
|
||||
* - added bus support for the expansion of PMCSpan as per request by Peter
|
||||
* $Id$
|
||||
*/
|
||||
#define PCI_MAIN
|
||||
|
||||
#include <libcpu/io.h>
|
||||
#include <rtems/bspIo.h> /* printk */
|
||||
|
||||
#include <bsp/irq.h>
|
||||
#include <bsp/pci.h>
|
||||
#include <bsp/gtreg.h>
|
||||
#include <bsp/gtpcireg.h>
|
||||
#include <bsp.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PCI_DEBUG 0
|
||||
#define PCI_PRINT 1
|
||||
#define PCI_PRINT 0
|
||||
|
||||
/* allow for overriding these definitions */
|
||||
#ifndef PCI_CONFIG_ADDR
|
||||
@@ -58,31 +56,17 @@
|
||||
#define PCI_MULTI_FUNCTION 0x80
|
||||
#define HOSTBRIDGET_ERROR 0xf0000000
|
||||
|
||||
#define GT64x60_PCI_CONFIG_ADDR GT64x60_REG_BASE + PCI_CONFIG_ADDR
|
||||
#define GT64x60_PCI_CONFIG_DATA GT64x60_REG_BASE + PCI_CONFIG_DATA
|
||||
|
||||
#define GT64x60_PCI1_CONFIG_ADDR GT64x60_REG_BASE + PCI1_CONFIG_ADDR
|
||||
#define GT64x60_PCI1_CONFIG_DATA GT64x60_REG_BASE + PCI1_CONFIG_DATA
|
||||
|
||||
static int numPCIDevs=0;
|
||||
static DiscoveryChipVersion BSP_sysControllerVersion = 0;
|
||||
static BSP_VMEchipTypes BSP_VMEinterface = 0;
|
||||
static pci_config BSP_pci[2]={
|
||||
{(volatile unsigned char*) (GT64x60_PCI_CONFIG_ADDR),
|
||||
(volatile unsigned char*) (GT64x60_PCI_CONFIG_DATA),
|
||||
0 /* defined at BSP_pci_configuration */},
|
||||
{(volatile unsigned char*) (GT64x60_PCI1_CONFIG_ADDR),
|
||||
(volatile unsigned char*) (GT64x60_PCI1_CONFIG_DATA),
|
||||
0 /* defined at BSP_pci_configuration */}
|
||||
};
|
||||
/* define a shortcut */
|
||||
#define pci BSP_pci_configuration
|
||||
|
||||
static int numPCIDevs=0;
|
||||
extern void pci_interface(void);
|
||||
|
||||
/* Pack RegNum,FuncNum,DevNum,BusNum,and ConfigEnable for
|
||||
* PCI Configuration Address Register
|
||||
*/
|
||||
#define pciConfigPack(bus,dev,func,offset)\
|
||||
((offset&~3)<<24)|(PCI_DEVFN(dev,func)<<16)|(bus<<8)|0x80
|
||||
(((func&7)<<8)|((dev&0x1f )<<11)|(( bus&0xff)<<16)|(offset&0xfc))|0x80000000
|
||||
|
||||
/*
|
||||
* Bit encode for PCI_CONFIG_HEADER_TYPE register
|
||||
@@ -91,36 +75,44 @@ unsigned char ucMaxPCIBus=0;
|
||||
|
||||
/* Please note that PCI0 and PCI1 does not correlate with the busNum 0 and 1.
|
||||
*/
|
||||
static int indirect_pci_read_config_byte(unsigned char bus,unsigned char dev,unsigned char func,
|
||||
static int direct_pci_read_config_byte(unsigned char bus,unsigned char dev,unsigned char func,
|
||||
unsigned char offset,unsigned char *val)
|
||||
{
|
||||
int n=0;
|
||||
volatile unsigned char *config_addr, *config_data;
|
||||
|
||||
if (bus>= BSP_MAX_PCI_BUS_ON_PCI0) {
|
||||
bus-=BSP_MAX_PCI_BUS_ON_PCI0;
|
||||
n=1;
|
||||
config_addr = (volatile unsigned char*) PCI1_CONFIG_ADDR;
|
||||
config_data = (volatile unsigned char*) PCI1_CONFIG_DATA;
|
||||
}
|
||||
else {
|
||||
config_addr = pci.pci_config_addr;
|
||||
config_data = pci.pci_config_data;
|
||||
}
|
||||
|
||||
*val = 0xff;
|
||||
if (offset & ~0xff) return PCIBIOS_BAD_REGISTER_NUMBER;
|
||||
#if 0
|
||||
printk("addr %x, data %x, pack %x \n", BSP_pci[n].pci_config_addr),
|
||||
BSP_pci[n].config_data,pciConfigPack(bus,dev,func,offset));
|
||||
printk("addr %x, data %x, pack %x \n", config_addr,
|
||||
config_data,pciConfigPack(bus,dev,func,offset));
|
||||
#endif
|
||||
|
||||
out_be32(BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset));
|
||||
*val = in_8(BSP_pci[n].pci_config_data + (offset&3));
|
||||
outl(pciConfigPack(bus,dev,func,offset),config_addr);
|
||||
*val = inb(config_data + (offset&3));
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int indirect_pci_read_config_word(unsigned char bus, unsigned char dev,
|
||||
static int direct_pci_read_config_word(unsigned char bus, unsigned char dev,
|
||||
unsigned char func, unsigned char offset, unsigned short *val)
|
||||
{
|
||||
int n=0;
|
||||
volatile unsigned char *config_addr, *config_data;
|
||||
|
||||
if (bus>= BSP_MAX_PCI_BUS_ON_PCI0) {
|
||||
bus-=BSP_MAX_PCI_BUS_ON_PCI0;
|
||||
n=1;
|
||||
config_addr = (volatile unsigned char*) PCI1_CONFIG_ADDR;
|
||||
config_data = (volatile unsigned char*) PCI1_CONFIG_DATA;
|
||||
}
|
||||
else {
|
||||
config_addr = (volatile unsigned char*) pci.pci_config_addr;
|
||||
config_data = (volatile unsigned char*) pci.pci_config_data;
|
||||
}
|
||||
|
||||
*val = 0xffff;
|
||||
@@ -129,101 +121,123 @@ unsigned char func, unsigned char offset, unsigned short *val)
|
||||
printk("addr %x, data %x, pack %x \n", config_addr,
|
||||
config_data,pciConfigPack(bus,dev,func,offset));
|
||||
#endif
|
||||
out_be32(BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset));
|
||||
*val = in_le16(BSP_pci[n].pci_config_data + (offset&2));
|
||||
outl(pciConfigPack(bus,dev,func,offset),config_addr);
|
||||
*val = inw(config_data + (offset&2));
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int indirect_pci_read_config_dword(unsigned char bus, unsigned char dev,
|
||||
static int direct_pci_read_config_dword(unsigned char bus, unsigned char dev,
|
||||
unsigned char func, unsigned char offset, unsigned int *val)
|
||||
{
|
||||
int n=0;
|
||||
volatile unsigned char *config_addr, *config_data;
|
||||
|
||||
if (bus>= BSP_MAX_PCI_BUS_ON_PCI0) {
|
||||
bus-=BSP_MAX_PCI_BUS_ON_PCI0;
|
||||
n=1;
|
||||
config_addr = (volatile unsigned char*) PCI1_CONFIG_ADDR;
|
||||
config_data = (volatile unsigned char*) PCI1_CONFIG_DATA;
|
||||
}
|
||||
else {
|
||||
config_addr = (volatile unsigned char*) pci.pci_config_addr;
|
||||
config_data = (volatile unsigned char*) pci.pci_config_data;
|
||||
}
|
||||
|
||||
*val = 0xffffffff;
|
||||
if ((offset&3)|| (offset & ~0xff)) return PCIBIOS_BAD_REGISTER_NUMBER;
|
||||
|
||||
out_be32(BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset));
|
||||
*val = in_le32(BSP_pci[n].pci_config_data);
|
||||
#if 0
|
||||
printk("addr %x, data %x, pack %x \n", config_addr,
|
||||
pci.pci_config_data,pciConfigPack(bus,dev,func,offset));
|
||||
#endif
|
||||
outl(pciConfigPack(bus,dev,func,offset),config_addr);
|
||||
*val = inl(config_data);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int indirect_pci_write_config_byte(unsigned char bus, unsigned char dev,unsigned char func, unsigned char offset, unsigned char val)
|
||||
static int direct_pci_write_config_byte(unsigned char bus, unsigned char dev,unsigned char func, unsigned char offset, unsigned char val)
|
||||
{
|
||||
int n=0;
|
||||
volatile unsigned char *config_addr, *config_data;
|
||||
|
||||
if (bus>= BSP_MAX_PCI_BUS_ON_PCI0) {
|
||||
bus-=BSP_MAX_PCI_BUS_ON_PCI0;
|
||||
n=1;
|
||||
config_addr = (volatile unsigned char*) PCI1_CONFIG_ADDR;
|
||||
config_data = (volatile unsigned char*) PCI1_CONFIG_DATA;
|
||||
}
|
||||
else {
|
||||
config_addr = pci.pci_config_addr;
|
||||
config_data = pci.pci_config_data;
|
||||
}
|
||||
|
||||
if (offset & ~0xff) return PCIBIOS_BAD_REGISTER_NUMBER;
|
||||
#if 0
|
||||
printk("addr %x, data %x, pack %x \n", config_addr,
|
||||
config_data,pciConfigPack(bus,dev,func,offset));
|
||||
#endif
|
||||
|
||||
out_be32(BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset));
|
||||
out_8(BSP_pci[n].pci_config_data + (offset&3), val);
|
||||
outl(pciConfigPack(bus,dev,func,offset), config_addr);
|
||||
outb(val, config_data + (offset&3));
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int indirect_pci_write_config_word(unsigned char bus, unsigned char dev,unsigned char func, unsigned char offset, unsigned short val)
|
||||
static int direct_pci_write_config_word(unsigned char bus, unsigned char dev,unsigned char func, unsigned char offset, unsigned short val)
|
||||
{
|
||||
int n=0;
|
||||
volatile unsigned char *config_addr, *config_data;
|
||||
|
||||
if (bus>= BSP_MAX_PCI_BUS_ON_PCI0) {
|
||||
bus-=BSP_MAX_PCI_BUS_ON_PCI0;
|
||||
n=1;
|
||||
config_addr = (volatile unsigned char*) PCI1_CONFIG_ADDR;
|
||||
config_data = (volatile unsigned char*) PCI1_CONFIG_DATA;
|
||||
}
|
||||
else {
|
||||
config_addr = (volatile unsigned char*) pci.pci_config_addr;
|
||||
config_data = (volatile unsigned char*) pci.pci_config_data;
|
||||
}
|
||||
|
||||
if ((offset&1)|| (offset & ~0xff)) return PCIBIOS_BAD_REGISTER_NUMBER;
|
||||
|
||||
out_be32(BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset));
|
||||
out_le16(BSP_pci[n].pci_config_data + (offset&3), val);
|
||||
#if 0
|
||||
printk("addr %x, data %x, pack %x \n", config_addr,
|
||||
config_data,pciConfigPack(bus,dev,func,offset));
|
||||
#endif
|
||||
outl(pciConfigPack(bus,dev,func,offset),config_addr);
|
||||
outw(val, config_data + (offset&3));
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int indirect_pci_write_config_dword(unsigned char bus,unsigned char dev,unsigned char func, unsigned char offset, unsigned int val)
|
||||
static int direct_pci_write_config_dword(unsigned char bus,unsigned char dev,unsigned char func, unsigned char offset, unsigned int val)
|
||||
{
|
||||
int n=0;
|
||||
volatile unsigned char *config_addr, *config_data;
|
||||
|
||||
if (bus>= BSP_MAX_PCI_BUS_ON_PCI0) {
|
||||
bus-=BSP_MAX_PCI_BUS_ON_PCI0;
|
||||
n=1;
|
||||
config_addr = (volatile unsigned char *) PCI1_CONFIG_ADDR;
|
||||
config_data = (volatile unsigned char *) PCI1_CONFIG_DATA;
|
||||
}
|
||||
else {
|
||||
config_addr = (volatile unsigned char*) pci.pci_config_addr;
|
||||
config_data = (volatile unsigned char*) pci.pci_config_data;
|
||||
}
|
||||
|
||||
if ((offset&3)|| (offset & ~0xff)) return PCIBIOS_BAD_REGISTER_NUMBER;
|
||||
|
||||
out_be32(BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset));
|
||||
out_le32(BSP_pci[n].pci_config_data, val);
|
||||
#if 0
|
||||
printk("addr %x, data %x, pack %x \n", config_addr,
|
||||
config_data,pciConfigPack(bus,dev,func,offset));
|
||||
#endif
|
||||
outl(pciConfigPack(bus,dev,func,offset),config_addr);
|
||||
outl(val,config_data);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
const pci_config_access_functions pci_indirect_functions = {
|
||||
indirect_pci_read_config_byte,
|
||||
indirect_pci_read_config_word,
|
||||
indirect_pci_read_config_dword,
|
||||
indirect_pci_write_config_byte,
|
||||
indirect_pci_write_config_word,
|
||||
indirect_pci_write_config_dword
|
||||
const pci_config_access_functions pci_direct_functions = {
|
||||
direct_pci_read_config_byte,
|
||||
direct_pci_read_config_word,
|
||||
direct_pci_read_config_dword,
|
||||
direct_pci_write_config_byte,
|
||||
direct_pci_write_config_word,
|
||||
direct_pci_write_config_dword
|
||||
};
|
||||
|
||||
|
||||
pci_config BSP_pci_configuration = {
|
||||
(volatile unsigned char*) (GT64x60_PCI_CONFIG_ADDR),
|
||||
(volatile unsigned char*) (GT64x60_PCI_CONFIG_DATA),
|
||||
&pci_indirect_functions};
|
||||
|
||||
DiscoveryChipVersion BSP_getDiscoveryChipVersion(void)
|
||||
{
|
||||
return(BSP_sysControllerVersion);
|
||||
}
|
||||
|
||||
BSP_VMEchipTypes BSP_getVMEchipType(void)
|
||||
{
|
||||
return(BSP_VMEinterface);
|
||||
}
|
||||
pci_config BSP_pci_configuration = {(volatile unsigned char*) PCI_CONFIG_ADDR,
|
||||
(volatile unsigned char*)PCI_CONFIG_DATA,
|
||||
&pci_direct_functions};
|
||||
|
||||
/*
|
||||
* This routine determines the maximum bus number in the system.
|
||||
@@ -234,12 +248,12 @@ BSP_VMEchipTypes BSP_getVMEchipType(void)
|
||||
int pci_initialize(void)
|
||||
{
|
||||
int deviceFound;
|
||||
unsigned char ucBusNumber, ucSlotNumber, ucFnNumber, ucNumFuncs, data8;
|
||||
uint32_t ulHeader, ulClass, ulDeviceID;
|
||||
#if PCI_DEBUG
|
||||
uint32_t pcidata;
|
||||
#endif
|
||||
unsigned char ucBusNumber, ucSlotNumber, ucFnNumber, ucNumFuncs;
|
||||
unsigned int ulHeader;
|
||||
unsigned int pcidata, ulClass, ulDeviceID;
|
||||
|
||||
pci_interface();
|
||||
|
||||
/*
|
||||
* Scan PCI0 and PCI1 buses
|
||||
*/
|
||||
@@ -265,49 +279,38 @@ int pci_initialize(void)
|
||||
if (!deviceFound) deviceFound=1;
|
||||
switch(ulDeviceID) {
|
||||
case (PCI_VENDOR_ID_MARVELL+(PCI_DEVICE_ID_MARVELL_GT6426xAB<<16)):
|
||||
pci_read_config_byte(0,0,0,PCI_REVISION_ID, &data8);
|
||||
switch(data8) {
|
||||
case 0x10:
|
||||
BSP_sysControllerVersion = GT64260A;
|
||||
#if PCI_PRINT
|
||||
printk("Marvell GT64260A (Discovery I) hostbridge detected at bus%d slot%d\n",
|
||||
printk("Marvell GT6426xA/B hostbridge detected at bus%d slot%d\n",
|
||||
ucBusNumber,ucSlotNumber);
|
||||
#endif
|
||||
break;
|
||||
case 0x20:
|
||||
BSP_sysControllerVersion = GT64260B;
|
||||
#if PCI_PRINT
|
||||
printk("Marvell GT64260B (Discovery I) hostbridge detected at bus%d slot%d\n",
|
||||
ucBusNumber,ucSlotNumber);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printk("Undefined revsion of GT64260 chip\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case (PCI_VENDOR_ID_PLX2+(PCI_DEVICE_ID_PLX2_PCI6154_HB2<<16)):
|
||||
#if PCI_PRINT
|
||||
printk("PLX PCI6154 PCI-PCI bridge detected at bus%d slot%d\n",
|
||||
ucBusNumber,ucSlotNumber);
|
||||
#endif
|
||||
break;
|
||||
case PCI_VENDOR_ID_TUNDRA:
|
||||
#if PCI_PRINT
|
||||
printk("TUNDRA PCI-VME bridge detected at bus%d slot%d\n",
|
||||
ucBusNumber,ucSlotNumber);
|
||||
#endif
|
||||
break;
|
||||
case (PCI_VENDOR_ID_DEC+(PCI_DEVICE_ID_DEC_21150<<16)):
|
||||
case (PCI_VENDOR_ID_INTEL+(PCI_DEVICE_INTEL_82544EI_COPPER<<16)):
|
||||
#if PCI_PRINT
|
||||
printk("INTEL 82544EI COPPER network controller detected at bus%d slot%d\n",
|
||||
ucBusNumber,ucSlotNumber);
|
||||
#endif
|
||||
break;
|
||||
case (PCI_VENDOR_ID_DEC+(PCI_DEVICE_ID_DEC_21150<<16)):
|
||||
#if PCI_PRINT
|
||||
printk("DEC21150 PCI-PCI bridge detected at bus%d slot%d\n",
|
||||
ucBusNumber,ucSlotNumber);
|
||||
#endif
|
||||
break;
|
||||
default :
|
||||
#if PCI_PRINT
|
||||
printk("BSP unlisted vendor, Bus%d Slot%d DeviceID 0x%x \n",
|
||||
ucBusNumber,ucSlotNumber, ulDeviceID);
|
||||
#endif
|
||||
/* Kate Feng : device not supported by BSP needs to remap the IRQ line on mvme5500/mvme6100 */
|
||||
pci_read_config_byte(ucBusNumber,ucSlotNumber,0,PCI_INTERRUPT_LINE,&data8);
|
||||
if (data8 < BSP_GPP_IRQ_LOWEST_OFFSET) pci_write_config_byte(ucBusNumber,
|
||||
ucSlotNumber,0,PCI_INTERRUPT_LINE,BSP_GPP_IRQ_LOWEST_OFFSET+data8);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -400,6 +403,34 @@ int pci_initialize(void)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
pci_read_config_dword(ucBusNumber,
|
||||
ucSlotNumber,
|
||||
0,
|
||||
PCI_COMMAND,
|
||||
&pcidata);
|
||||
#if PCI_DEBUG
|
||||
printk("MOTLoad command staus 0x%x, ", pcidata);
|
||||
#endif
|
||||
/* Clear the error on the host bridge */
|
||||
if ( (ucBusNumber==0) && (ucSlotNumber==0))
|
||||
pcidata |= PCI_STATUS_CLRERR_MASK;
|
||||
/* Enable bus,I/O and memory master access. */
|
||||
pcidata |= (PCI_COMMAND_MASTER|PCI_COMMAND_IO|PCI_COMMAND_MEMORY);
|
||||
pci_write_config_dword(ucBusNumber,
|
||||
ucSlotNumber,
|
||||
0,
|
||||
PCI_COMMAND,
|
||||
pcidata);
|
||||
|
||||
pci_read_config_dword(ucBusNumber,
|
||||
ucSlotNumber,
|
||||
0,
|
||||
PCI_COMMAND,
|
||||
&pcidata);
|
||||
#if PCI_DEBUG
|
||||
printk("Now command/staus 0x%x\n", pcidata);
|
||||
#endif
|
||||
}
|
||||
if (deviceFound) ucMaxPCIBus++;
|
||||
} /* for (ucBusNumber=0; ucBusNumber<BSP_MAX_PCI_BUS; ... */
|
||||
@@ -407,7 +438,6 @@ int pci_initialize(void)
|
||||
printk("number of PCI buses: %d, numPCIDevs %d\n",
|
||||
pci_bus_count(), numPCIDevs);
|
||||
#endif
|
||||
pci_interface();
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,10 @@
|
||||
* found in the file LICENSE in this distribution.
|
||||
*
|
||||
* 8/17/2006 : S. Kate Feng
|
||||
* uses in_le32()/out_le32(), instead of inl()/outl() for compatibility.
|
||||
* uses in_le32()/out_le32(), instead of inl()/outl() so that
|
||||
* it is easier to be ported.
|
||||
*
|
||||
* 11/2008 : Enable "PCI Read Agressive Prefetch",
|
||||
* "PCI Read Line Agressive Prefetch", and
|
||||
* "PCI Read Multiple Agressive Prefetch" to improve the
|
||||
* performance of the PCI based applications (e.g. 1GHz NIC).
|
||||
*/
|
||||
|
||||
#include <libcpu/io.h>
|
||||
#include <rtems/bspIo.h> /* printk */
|
||||
|
||||
@@ -23,29 +19,55 @@
|
||||
#include <bsp/gtreg.h>
|
||||
#include <bsp/gtpcireg.h>
|
||||
|
||||
#define REG32_READ(reg) in_le32((volatile unsigned int *)(GT64260_REG_BASE+reg))
|
||||
#define REG32_WRITE(data, reg) out_le32((volatile unsigned int *)(GT64260_REG_BASE+reg), data)
|
||||
|
||||
#define PCI_DEBUG 0
|
||||
|
||||
#if 0
|
||||
#define CPU2PCI_ORDER
|
||||
#define PCI2CPU_ORDER
|
||||
#endif
|
||||
|
||||
/* PCI Read Agressive Prefetch Enable (1<<16 ),
|
||||
* PCI Read Line Agressive Prefetch Enable( 1<<17),
|
||||
* PCI Read Multiple Agressive Prefetch Enable (1<<18).
|
||||
/* Please reference the GT64260B datasheet, for the PCI interface,
|
||||
* Synchronization Barriers and PCI ordering.
|
||||
*
|
||||
* Some PCI devices require Synchronization Barriers or PCI ordering
|
||||
* for synchronization (only one mechanism allowed. See section 11.1.2).
|
||||
* To use the former mechanism(default), one needs to call
|
||||
* CPU0_PciEnhanceSync() or CPU1_PciEnhanceSync() to perform software
|
||||
* synchronization between the CPU and PCI activities.
|
||||
*
|
||||
* To use the PCI-ordering, one can call pciToCpuSync() to trigger
|
||||
* the PCI-to-CPU sync barrier after the out_xx(). In this mode,
|
||||
* PCI configuration reads suffer sync barrier latency. Please reference
|
||||
* the datasheet to explore other options.
|
||||
*
|
||||
* Note : If PCI_ORDERING is needed for the PCI0, while disabling the
|
||||
* deadlock for the PCI0, one should keep the CommDLEn bit enabled
|
||||
* for the deadlock mechanism so that the 10/100 MB ethernet will
|
||||
* function correctly.
|
||||
*
|
||||
*/
|
||||
#ifdef PCI2CPU_ORDER
|
||||
#define PCI_ACCCTLBASEL_VALUE 0x01079000
|
||||
#else
|
||||
#define PCI_ACCCTLBASEL_VALUE 0x01071000
|
||||
#endif
|
||||
/*#define PCI_ORDERING*/
|
||||
|
||||
#define EN_SYN_BAR /* take MOTLoad default for enhanced SYN Barrier mode */
|
||||
|
||||
/*#define PCI_DEADLOCK*/
|
||||
|
||||
#ifdef PCI_ORDERING
|
||||
#define PCI_ACCCTLBASEL_VALUE 0x01009000
|
||||
#else
|
||||
#define PCI_ACCCTLBASEL_VALUE 0x01001000
|
||||
#endif
|
||||
|
||||
#define ConfSBDis 0x10000000 /* 1: disable, 0: enable */
|
||||
#define IOSBDis 0x20000000 /* 1: disable, 0: enable */
|
||||
#define ConfIOSBDis 0x30000000
|
||||
#define CpuPipeline 0x00002000 /* optional, 1:enable, 0:disable */
|
||||
|
||||
#define CPU0_SYNC_TRIGGER 0xD0 /* CPU0 Sync Barrier trigger */
|
||||
#define CPU0_SYNC_VIRTUAL 0xC0 /* CPU0 Sync Barrier Virtual */
|
||||
|
||||
#define CPU1_SYNC_TRIGGER 0xD8 /* CPU1 Sync Barrier trigger */
|
||||
#define CPU1_SYNC_VIRTUAL 0xC8 /* CPU1 Sync Barrier Virtual */
|
||||
|
||||
|
||||
/* CPU to PCI ordering register */
|
||||
#define DLOCK_ORDER_REG 0x2D0 /* Deadlock and Ordering register */
|
||||
#define PCI0OrEn 0x00000001
|
||||
@@ -69,30 +91,69 @@ void pciAccessInit(void);
|
||||
void pci_interface(void)
|
||||
{
|
||||
|
||||
#ifdef CPU2PCI_ORDER
|
||||
/* MOTLOad deafult : 0x07ff8600 */
|
||||
out_le32((volatile unsigned int *)(GT64x60_REG_BASE+CNT_SYNC_REG), 0x07fff600);
|
||||
#ifdef PCI_DEADLOCK
|
||||
REG32_WRITE(0x07fff600, CNT_SYNC_REG);
|
||||
#endif
|
||||
#ifdef PCI_ORDERING
|
||||
/* Let's leave this to be MOTLOad deafult : 0x80070000
|
||||
REG32_WRITE(0xc0070000, DLOCK_ORDER_REG);*/
|
||||
/* Leave the CNT_SYNC_REG b/c MOTload default had the SyncBarMode set to 1 */
|
||||
#endif
|
||||
/* asserts SERR upon various detection */
|
||||
out_le32((volatile unsigned int *)(GT64x60_REG_BASE+0xc28), 0x3fffff);
|
||||
pciAccessInit();
|
||||
}
|
||||
|
||||
/* asserts SERR upon various detection */
|
||||
REG32_WRITE(0x3fffff, 0xc28);
|
||||
|
||||
pciAccessInit();
|
||||
}
|
||||
/* Use MOTLoad default for Writeback Priority and Buffer Depth
|
||||
*/
|
||||
void pciAccessInit(void)
|
||||
{
|
||||
unsigned int PciLocal, data;
|
||||
|
||||
for (PciLocal=0; PciLocal < 2; PciLocal++) {
|
||||
data = in_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)));
|
||||
#if 0
|
||||
printk("PCI%d_ACCESS_CNTL_BASE0_LOW was 0x%x\n",PciLocal,data);
|
||||
#endif
|
||||
/* MOTLoad combines the two banks of SDRAM into
|
||||
* one PCI access control because the top = 0x1ff
|
||||
*/
|
||||
data = REG32_READ(GT_SCS0_Low_Decode) & 0xfff;
|
||||
data |= PCI_ACCCTLBASEL_VALUE;
|
||||
data &= ~0x300000;
|
||||
out_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)), data);
|
||||
#if 0
|
||||
printf("PCI%d_ACCESS_CNTL_BASE0_LOW now 0x%x\n",PciLocal,in_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80))));
|
||||
REG32_WRITE(data, PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80));
|
||||
#if PCI_DEBUG
|
||||
printk("PCI%d_ACCESS_CNTL_BASE0_LOW 0x%x\n",PciLocal,REG32_READ(PCI_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)));
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Sync Barrier Trigger. A write to the CPU_SYNC_TRIGGER register triggers
|
||||
* the sync barrier process. The three bits, define which buffers should
|
||||
* be flushed.
|
||||
* Bit 0 = PCI0 slave write buffer.
|
||||
* Bit 1 = PCI1 slave write buffer.
|
||||
* Bit 2 = SDRAM snoop queue.
|
||||
*/
|
||||
void CPU0_PciEnhanceSync(unsigned int syncVal)
|
||||
{
|
||||
REG32_WRITE(syncVal,CPU0_SYNC_TRIGGER);
|
||||
while (REG32_READ(CPU0_SYNC_VIRTUAL));
|
||||
}
|
||||
|
||||
void CPU1_PciEnhanceSync(unsigned int syncVal)
|
||||
{
|
||||
REG32_WRITE(syncVal,CPU1_SYNC_TRIGGER);
|
||||
while (REG32_READ(CPU1_SYNC_VIRTUAL));
|
||||
}
|
||||
|
||||
/* Currently, if PCI_ordering is used for synchronization, configuration
|
||||
* reads is programmed to be the PCI slave "synchronization barrier"
|
||||
* cycles.
|
||||
*/
|
||||
void pciToCpuSync(int pci_num)
|
||||
{
|
||||
unsigned char data;
|
||||
unsigned char bus=0;
|
||||
|
||||
if (pci_num) bus += BSP_MAX_PCI_BUS_ON_PCI0;
|
||||
pci_read_config_byte(bus,0,0,4, &data);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/* Copyright 2003, Shuchen Kate Feng <feng1@bnl.gov>,
|
||||
* NSLS,Brookhaven National Laboratory
|
||||
*/
|
||||
#include <bsp.h>
|
||||
#include <rtems/bspIo.h>
|
||||
#include <libcpu/stackTrace.h>
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
@@ -50,12 +52,12 @@
|
||||
#undef __RTEMS_APPLICATION__
|
||||
#endif
|
||||
|
||||
|
||||
/*#define SHOW_MORE_INIT_SETTINGS
|
||||
#define CONF_VPD
|
||||
/*
|
||||
#define SHOW_MORE_INIT_SETTINGS
|
||||
#define SHOW_LCR1_REGISTER
|
||||
#define SHOW_LCR2_REGISTER
|
||||
#define SHOW_LCR3_REGISTER
|
||||
#define CONF_VPD
|
||||
*/
|
||||
|
||||
/* there is no public Workspace_Free() variant :-( */
|
||||
@@ -71,7 +73,6 @@ extern Triv121PgTbl BSP_pgtbl_setup(unsigned long);
|
||||
extern void BSP_pgtbl_activate(Triv121PgTbl);
|
||||
extern int I2Cread_eeprom(unsigned char I2cBusAddr, uint32_t devA2A1A0, uint32_t AddrBytes, unsigned char *pBuff, uint32_t numBytes);
|
||||
extern void BSP_vme_config(void);
|
||||
extern uint32_t probeMemoryEnd();
|
||||
|
||||
uint32_t bsp_clicks_per_usec;
|
||||
|
||||
@@ -266,10 +267,12 @@ void bsp_start( void )
|
||||
setdbat(2, PCI0_MEM_BASE, PCI0_MEM_BASE, 0x10000000, IO_PAGE);
|
||||
|
||||
/* Till Straumann: 2004
|
||||
* map the PCI 0, 1 Domain I/O space, GT64260B registers,
|
||||
* Flash Bank 0 and Flash Bank 2.
|
||||
* map the PCI 0, 1 Domain I/O space, GT64260B registers
|
||||
* and the reserved area so that the size is the power of 2.
|
||||
*
|
||||
*/
|
||||
setdbat(3,PCI0_IO_BASE, PCI0_IO_BASE, 0x10000000, IO_PAGE);
|
||||
setdbat(3,PCI0_IO_BASE, PCI0_IO_BASE, 0x2000000, IO_PAGE);
|
||||
|
||||
|
||||
/*
|
||||
* Get CPU identification dynamically. Note that the get_ppc_cpu_type() function
|
||||
@@ -324,7 +327,29 @@ void bsp_start( void )
|
||||
printk("Welcome to %s on MVME5500-0163\n", _RTEMS_version );
|
||||
printk("-----------------------------------------\n");
|
||||
|
||||
BSP_mem_size = probeMemoryEnd();
|
||||
#ifdef TEST_RETURN_TO_PPCBUG
|
||||
printk("Hit <Enter> to return to PPCBUG monitor\n");
|
||||
printk("When Finished hit GO. It should print <Back from monitor>\n");
|
||||
debug_getc();
|
||||
_return_to_ppcbug();
|
||||
printk("Back from monitor\n");
|
||||
_return_to_ppcbug();
|
||||
#endif /* TEST_RETURN_TO_PPCBUG */
|
||||
|
||||
#ifdef TEST_RAW_EXCEPTION_CODE
|
||||
printk("Testing exception handling Part 1\n");
|
||||
/*
|
||||
* Cause a software exception
|
||||
*/
|
||||
__asm__ __volatile ("sc");
|
||||
/*
|
||||
* Check we can still catch exceptions and returned coorectly.
|
||||
*/
|
||||
printk("Testing exception handling Part 2\n");
|
||||
__asm__ __volatile ("sc");
|
||||
#endif
|
||||
|
||||
BSP_mem_size = _512M;
|
||||
/* TODO: calculate the BSP_bus_frequency using the REF_CLK bit
|
||||
* of System Status register
|
||||
*/
|
||||
@@ -396,19 +421,6 @@ void bsp_start( void )
|
||||
#endif
|
||||
BSP_pgtbl_activate(pt);
|
||||
}
|
||||
/* Read Configuration Vital Product Data (VPD) */
|
||||
if ( I2Cread_eeprom(0xa8, 4,2, &ConfVPD_buff[0], 150))
|
||||
printk("I2Cread_eeprom() error \n");
|
||||
else {
|
||||
#ifdef CONF_VPD
|
||||
printk("\n");
|
||||
for (i=0; i<150; i++) {
|
||||
printk("%2x ", ConfVPD_buff[i]);
|
||||
if ((i % 20)==0 ) printk("\n");
|
||||
}
|
||||
printk("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* PCI 1 domain memory space
|
||||
@@ -432,14 +444,23 @@ void bsp_start( void )
|
||||
*/
|
||||
_BSP_clear_hostbridge_errors(0, 1 /*quiet*/);
|
||||
|
||||
/* Read Configuration Vital Product Data (VPD) */
|
||||
if ( I2Cread_eeprom(0xa8, 4,2, &ConfVPD_buff[0], 150))
|
||||
printk("I2Cread_eeprom() error \n");
|
||||
else {
|
||||
#ifdef CONF_VPD
|
||||
printk("\n");
|
||||
for (i=0; i<150; i++) {
|
||||
printk("%2x ", ConfVPD_buff[i]);
|
||||
if ((i % 20)==0 ) printk("\n");
|
||||
}
|
||||
printk("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||
printk("MSR %x \n", _read_MSR());
|
||||
printk("Exit from bspstart\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
unsigned char ReadConfVPD_buff(int offset)
|
||||
{
|
||||
return(ConfVPD_buff[offset]);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/* Copyright 2003, Shuchen Kate Feng <feng1@bnl.gov>,
|
||||
* NSLS,Brookhaven National Laboratory
|
||||
*
|
||||
* Ported it from powerpc/shared/console/reboot.c for mvme5500
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <rtems/bspIo.h>
|
||||
@@ -19,5 +12,5 @@ void bsp_reset()
|
||||
|
||||
printk("RTEMS terminated; Rebooting ...\n");
|
||||
/* Mvme5500 board reset : 2004 S. Kate Feng <feng1@bnl.gov> */
|
||||
out_8((volatile unsigned char*) (GT64x60_DEV1_BASE +2), 0x80);
|
||||
out_8((volatile unsigned char*) (GT64260_DEV1_BASE +2), 0x80);
|
||||
}
|
||||
|
||||
@@ -134,8 +134,6 @@ int quiet=0;
|
||||
/* register dump */
|
||||
printk("\t Next PC or Address of fault = %x, ", excPtr->EXC_SRR0);
|
||||
printk("Mvme5500 Saved MSR = %x\n", excPtr->EXC_SRR1);
|
||||
printk("The Interrupt mask (e.g. MSR_EE) stored in SPRG0= 0x%x\n",
|
||||
ppc_interrupt_get_disable_mask());
|
||||
printk("\t R0 = %08x", excPtr->GPR0);
|
||||
printk(" R1 = %08x", excPtr->GPR1);
|
||||
printk(" R2 = %08x", excPtr->GPR2);
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
2009-10-16 Jennifer Averett <jennifer.averett@OARcorp.com>
|
||||
|
||||
* startup/bspstart.c: Add bsp_clicks_per_usec.
|
||||
|
||||
2008-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* bsp_specs: Backport from CVS-HEAD.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* The generic CPU dependent initialization has been performed
|
||||
* before any of these are invoked.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-20089
|
||||
* COPYRIGHT (c) 1989-2008.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -44,11 +44,6 @@ extern int PSIM_INSTRUCTIONS_PER_MICROSECOND;
|
||||
*/
|
||||
unsigned int BSP_bus_frequency;
|
||||
|
||||
/*
|
||||
* Driver configuration parameters
|
||||
*/
|
||||
uint32_t bsp_clicks_per_usec;
|
||||
|
||||
/*
|
||||
* Time base divisior (how many tick for 1 second).
|
||||
*/
|
||||
@@ -111,7 +106,6 @@ void bsp_start( void )
|
||||
* initialize the device driver parameters
|
||||
*/
|
||||
BSP_bus_frequency = (unsigned int)&PSIM_INSTRUCTIONS_PER_MICROSECOND;
|
||||
bsp_clicks_per_usec = BSP_bus_frequency;
|
||||
BSP_time_base_divisor = 1;
|
||||
|
||||
/*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user