2004-11-10 Richard Campbell <richard.campbell@oarcorp.com>

* Makefile.am, bootloader/misc.c, bootloader/pci.c, bootloader/pci.h,
	console/console.c, console/inch.c, console/reboot.c, console/uart.c,
	console/uart.h, irq/irq.c, irq/irq.h, irq/irq_init.c,
	motorola/motorola.c, motorola/motorola.h, openpic/openpic.c,
	openpic/openpic.h, pci/detect_raven_bridge.c, pci/pci.c,
	start/start.S, startup/bspstart.c, vectors/vectors_init.c,
	vme/vmeconfig.c: Add MVME2100 BSP and MPC8240 support. There was also
	a significant amount of spelling and whitespace cleanup.
	* tod/todcfg.c: New file.
This commit is contained in:
Joel Sherrill
2004-11-10 23:51:17 +00:00
parent f9877d2577
commit e79a194755
24 changed files with 578 additions and 207 deletions

View File

@@ -1,3 +1,15 @@
2004-11-10 Richard Campbell <richard.campbell@oarcorp.com>
* Makefile.am, bootloader/misc.c, bootloader/pci.c, bootloader/pci.h,
console/console.c, console/inch.c, console/reboot.c, console/uart.c,
console/uart.h, irq/irq.c, irq/irq.h, irq/irq_init.c,
motorola/motorola.c, motorola/motorola.h, openpic/openpic.c,
openpic/openpic.h, pci/detect_raven_bridge.c, pci/pci.c,
start/start.S, startup/bspstart.c, vectors/vectors_init.c,
vme/vmeconfig.c: Add MVME2100 BSP and MPC8240 support. There was also
a significant amount of spelling and whitespace cleanup.
* tod/todcfg.c: New file.
2003-11-01 Greg Menke <gregory.menke@gsfc.nasa.gov> 2003-11-01 Greg Menke <gregory.menke@gsfc.nasa.gov>
PR 606/bsps PR 606/bsps

View File

@@ -44,6 +44,9 @@ EXTRA_DIST += start/start.S start/rtems_crti.S
EXTRA_DIST += startup/bspstart.c startup/pgtbl_setup.c \ EXTRA_DIST += startup/bspstart.c startup/pgtbl_setup.c \
startup/pgtbl_activate.c startup/pgtbl_activate.c
## tod
EXTRA_DIST += tod/todcfg.c
## vectors ## vectors
EXTRA_DIST += vectors/vectors_init.c vectors/vectors.S EXTRA_DIST += vectors/vectors_init.c vectors/vectors.S

View File

@@ -24,6 +24,7 @@
#include <libcpu/page.h> #include <libcpu/page.h>
#include <libcpu/byteorder.h> #include <libcpu/byteorder.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <bsp.h>
SPR_RW(DEC) SPR_RW(DEC)
SPR_RO(PVR) SPR_RO(PVR)
@@ -275,8 +276,13 @@ setup_hw(void)
/* We check that the keyboard is present and immediately /* We check that the keyboard is present and immediately
* select the serial console if not. * select the serial console if not.
*/ */
#if defined(BSP_KBD_IOBASE)
err = kbdreset(); err = kbdreset();
if (err) select_console(CONSOLE_SERIAL); if (err) select_console(CONSOLE_SERIAL);
#else
err = 1;
select_console(CONSOLE_SERIAL);
#endif
printk("\nModel: %s\nSerial: %s\n" printk("\nModel: %s\nSerial: %s\n"
"Processor/Bus frequencies (Hz): %ld/%ld\n" "Processor/Bus frequencies (Hz): %ld/%ld\n"
@@ -288,8 +294,6 @@ setup_hw(void)
vpd.ProcessorBusHz, vpd.ProcessorBusHz,
(vpd.TimeBaseDivisor ? vpd.TimeBaseDivisor : 4000), (vpd.TimeBaseDivisor ? vpd.TimeBaseDivisor : 4000),
res->TotalMemory); res->TotalMemory);
printk("Original MSR: %lx\nOriginal HID0: %lx\nOriginal R31: %lx\n",
bd->o_msr, bd->o_hid0, bd->o_r31);
/* This reconfigures all the PCI subsystem */ /* This reconfigures all the PCI subsystem */
pci_init(); pci_init();

View File

@@ -23,6 +23,7 @@
#include <libcpu/io.h> #include <libcpu/io.h>
#include <libcpu/page.h> #include <libcpu/page.h>
#include <bsp/consoleIo.h> #include <bsp/consoleIo.h>
#include <string.h>
#include <string.h> #include <string.h>

View File

@@ -497,6 +497,7 @@
#define PCI_VENDOR_ID_MOTOROLA 0x1057 #define PCI_VENDOR_ID_MOTOROLA 0x1057
#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001 #define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001
#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002 #define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002
#define PCI_DEVICE_ID_MOTOROLA_MPC8240 0x0003
#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801 #define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801
#define PCI_VENDOR_ID_PROMISE 0x105a #define PCI_VENDOR_ID_PROMISE 0x105a

View File

@@ -132,8 +132,8 @@ console_initialize(rtems_device_major_number major,
printk("Error registering %s!\n",nm); printk("Error registering %s!\n",nm);
rtems_fatal_error_occurred (status); rtems_fatal_error_occurred (status);
} }
} }
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
} /* console_initialize */ } /* console_initialize */
@@ -172,6 +172,18 @@ console_open(rtems_device_major_number major,
{ {
rtems_status_code status; rtems_status_code status;
static rtems_termios_callbacks cb = static rtems_termios_callbacks cb =
#if defined(USE_POLLED_IO)
{
NULL, /* firstOpen */
NULL, /* lastClose */
NULL, /* pollRead */
BSP_uart_termios_write_polled, /* write */
conSetAttr, /* setAttributes */
NULL, /* stopRemoteTx */
NULL, /* startRemoteTx */
0 /* outputUsesInterrupts */
};
#else
{ {
console_first_open, /* firstOpen */ console_first_open, /* firstOpen */
console_last_close, /* lastClose */ console_last_close, /* lastClose */
@@ -182,12 +194,13 @@ console_open(rtems_device_major_number major,
NULL, /* startRemoteTx */ NULL, /* startRemoteTx */
1 /* outputUsesInterrupts */ 1 /* outputUsesInterrupts */
}; };
#endif
status = rtems_termios_open (major, minor, arg, &cb); status = rtems_termios_open (major, minor, arg, &cb);
if(status != RTEMS_SUCCESSFUL) if(status != RTEMS_SUCCESSFUL)
{ {
printk("Error openning console device\n"); printk("Error opening console device\n");
return status; return status;
} }

View File

@@ -20,6 +20,7 @@
*/ */
#include <bsp.h> #include <bsp.h>
#ifdef BSP_KBD_IOBASE
#include <bsp/irq.h> #include <bsp/irq.h>
#include "console.inl" #include "console.inl"
@@ -296,3 +297,4 @@ _IBMPC_inch_sleep(void)
return c; return c;
} /* _IBMPC_inch */ } /* _IBMPC_inch */
#endif

View File

@@ -16,5 +16,7 @@ void rtemsReboot(void)
printk("Printing a stack trace for your convenience :-)\n"); printk("Printing a stack trace for your convenience :-)\n");
CPU_print_stack(); CPU_print_stack();
/* shutdown and reboot */ /* shutdown and reboot */
#if defined(BSP_KBD_IOBASE)
kbd_outb(0x4, 0xFE); /* use keyboard controler to do the job... */ kbd_outb(0x4, 0xFE); /* use keyboard controler to do the job... */
#endif
} /* rtemsReboot */ } /* rtemsReboot */

View File

@@ -200,8 +200,8 @@ BSP_uart_set_baud(int uart, int baud)
/* /*
* This function may be called whenever TERMIOS parameters * This function may be called whenever TERMIOS parameters
* are changed, so we have to make sire that baud change is * are changed, so we have to make sure that baud change is
* indeed required * indeed required.
*/ */
if(baud == uart_data[uart].baud) if(baud == uart_data[uart].baud)
@@ -458,8 +458,14 @@ uart_noop(const rtems_irq_connect_data *unused)
static int static int
uart_isr_is_on(const rtems_irq_connect_data *irq) uart_isr_is_on(const rtems_irq_connect_data *irq)
{ {
int uart = (irq->name == BSP_ISA_UART_COM1_IRQ) ? int uart;
#if defined(mvme2100)
uart = BSP_UART_COM1;
#else
uart = (irq->name == BSP_ISA_UART_COM1_IRQ) ?
BSP_UART_COM1 : BSP_UART_COM2; BSP_UART_COM1 : BSP_UART_COM2;
#endif
return uread(uart,IER); return uread(uart,IER);
} }
@@ -467,8 +473,12 @@ static int
doit(int uart, rtems_irq_hdl handler, int (*p)(const rtems_irq_connect_data*)) doit(int uart, rtems_irq_hdl handler, int (*p)(const rtems_irq_connect_data*))
{ {
rtems_irq_connect_data d={0}; rtems_irq_connect_data d={0};
#if defined(mvme2100)
d.name = BSP_UART_COM1_IRQ;
#else
d.name = (uart == BSP_UART_COM1) ? d.name = (uart == BSP_UART_COM1) ?
BSP_ISA_UART_COM1_IRQ : BSP_ISA_UART_COM2_IRQ; BSP_ISA_UART_COM1_IRQ : BSP_ISA_UART_COM2_IRQ;
#endif
d.off = d.on = uart_noop; d.off = d.on = uart_noop;
d.isOn = uart_isr_is_on; d.isOn = uart_isr_is_on;
d.hdl = handler; d.hdl = handler;
@@ -522,6 +532,21 @@ BSP_uart_termios_set(int uart, void *ttyp)
return; return;
} }
int
BSP_uart_termios_write_polled(int minor, const char *buf, int len)
{
int uart=minor; /* could differ, theoretically */
int nwrite;
const char *b = buf;
assert(buf != NULL);
for (nwrite=0 ; nwrite < len ; nwrite++) {
BSP_uart_polled_write(uart, *b++);
}
return nwrite;
}
int int
BSP_uart_termios_write_com(int minor, const char *buf, int len) BSP_uart_termios_write_com(int minor, const char *buf, int len)
{ {
@@ -533,7 +558,7 @@ BSP_uart_termios_write_com(int minor, const char *buf, int len)
return 0; return 0;
} }
/* If there TX buffer is busy - something is royally screwed up */ /* If the TX buffer is busy - something is royally screwed up */
/* assert((uread(BSP_UART_COM1, LSR) & THRE) != 0); */ /* assert((uread(BSP_UART_COM1, LSR) & THRE) != 0); */
if(termios_stopped_com[uart]) if(termios_stopped_com[uart])

View File

@@ -16,7 +16,7 @@
#include <rtems/libio.h> #include <rtems/libio.h>
void BSP_uart_init(int uart, int baud, int hwFlow); void BSP_uart_init(int uart, int baud, int hwFlow);
void BSP_uart_set_baud(int aurt, int baud); void BSP_uart_set_baud(int uart, int baud);
void BSP_uart_intr_ctrl(int uart, int cmd); void BSP_uart_intr_ctrl(int uart, int cmd);
void BSP_uart_throttle(int uart); void BSP_uart_throttle(int uart);
void BSP_uart_unthrottle(int uart); void BSP_uart_unthrottle(int uart);
@@ -31,6 +31,7 @@ void BSP_uart_dbgisr_com1(void);
void BSP_uart_dbgisr_com2(void); void BSP_uart_dbgisr_com2(void);
int BSP_uart_install_isr(int uart, rtems_irq_hdl handler); int BSP_uart_install_isr(int uart, rtems_irq_hdl handler);
int BSP_uart_remove_isr(int uart, rtems_irq_hdl handler); int BSP_uart_remove_isr(int uart, rtems_irq_hdl handler);
int BSP_uart_termios_write_polled(int minor, const char *buf, int len);
int BSP_uart_get_break_cb(int uart, rtems_libio_ioctl_args_t *arg); int BSP_uart_get_break_cb(int uart, rtems_libio_ioctl_args_t *arg);
int BSP_uart_set_break_cb(int uart, rtems_libio_ioctl_args_t *arg); int BSP_uart_set_break_cb(int uart, rtems_libio_ioctl_args_t *arg);

View File

@@ -21,6 +21,7 @@
#include <libcpu/raw_exception.h> #include <libcpu/raw_exception.h>
#include <libcpu/io.h> #include <libcpu/io.h>
#include <bsp/vectors.h> #include <bsp/vectors.h>
#include <stdlib.h>
#include <rtems/bspIo.h> /* for printk */ #include <rtems/bspIo.h> /* for printk */
#define RAVEN_INTR_ACK_REG 0xfeff0030 #define RAVEN_INTR_ACK_REG 0xfeff0030
@@ -28,7 +29,7 @@
/* /*
* pointer to the mask representing the additionnal irq vectors * pointer to the mask representing the additionnal irq vectors
* that must be disabled when a particular entry is activated. * that must be disabled when a particular entry is activated.
* They will be dynamically computed from teh prioruty table given * They will be dynamically computed from the priority table given
* in BSP_rtems_irq_mngt_set(); * in BSP_rtems_irq_mngt_set();
* CAUTION : this table is accessed directly by interrupt routine * CAUTION : this table is accessed directly by interrupt routine
* prologue. * prologue.
@@ -67,7 +68,7 @@ static inline int is_pci_irq(const rtems_irq_symbolic_name irqLine)
} }
/* /*
* Check if IRQ is a Porcessor IRQ * Check if IRQ is a Processor IRQ
*/ */
static inline int is_processor_irq(const rtems_irq_symbolic_name irqLine) static inline int is_processor_irq(const rtems_irq_symbolic_name irqLine)
{ {
@@ -358,7 +359,7 @@ int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq)
} }
/* /*
* ------------------------ RTEMS Global Irq Handler Mngt Routines ---------------- * RTEMS Global Interrupt Handler Management Routines
*/ */
int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config) int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config)

View File

@@ -1,9 +1,9 @@
/* irq.h /* irq.h
* *
* This include file describe the data structure and the functions implemented * This include file describe the data structure and the functions implemented
* by rtems to write interrupt handlers. * by RTEMS to write interrupt handlers.
* *
* CopyRight (C) 1999 valette@crf.canon.fr * Copyright (C) 1999 valette@crf.canon.fr
* *
* This code is heavilly inspired by the public specification of STREAM V2 * This code is heavilly inspired by the public specification of STREAM V2
* that can be found at : * that can be found at :
@@ -63,7 +63,7 @@ extern "C" {
#endif #endif
/* /*
* Symblolic IRQ names and related definitions. * Symbolic IRQ names and related definitions
*/ */
typedef enum { typedef enum {
@@ -83,7 +83,7 @@ typedef enum {
BSP_PCI_IRQ_LOWEST_OFFSET = BSP_ISA_IRQ_NUMBER, BSP_PCI_IRQ_LOWEST_OFFSET = BSP_ISA_IRQ_NUMBER,
BSP_PCI_IRQ_MAX_OFFSET = BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1, BSP_PCI_IRQ_MAX_OFFSET = BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1,
/* /*
* PowerPc exceptions handled as interrupt where a rtems managed interrupt * PowerPC exceptions handled as interrupt where an RTEMS managed interrupt
* handler might be connected * handler might be connected
*/ */
BSP_PROCESSOR_IRQ_NUMBER = 1, BSP_PROCESSOR_IRQ_NUMBER = 1,
@@ -104,23 +104,34 @@ typedef enum {
* Some ISA IRQ symbolic name definition * Some ISA IRQ symbolic name definition
*/ */
BSP_ISA_PERIODIC_TIMER = 0, BSP_ISA_PERIODIC_TIMER = 0,
BSP_ISA_KEYBOARD = 1, BSP_ISA_KEYBOARD = 1,
BSP_ISA_UART_COM2_IRQ = 3, BSP_ISA_UART_COM2_IRQ = 3,
BSP_ISA_UART_COM1_IRQ = 4, BSP_ISA_UART_COM1_IRQ = 4,
BSP_ISA_RT_TIMER1 = 8, BSP_ISA_RT_TIMER1 = 8,
BSP_ISA_RT_TIMER3 = 10, BSP_ISA_RT_TIMER3 = 10,
/* /*
* Some PCI IRQ symbolic name definition * Some PCI IRQ symbolic name definition
*/ */
BSP_PCI_IRQ0 = BSP_PCI_IRQ_LOWEST_OFFSET, BSP_PCI_IRQ0 = BSP_PCI_IRQ_LOWEST_OFFSET,
BSP_PCI_ISA_BRIDGE_IRQ = BSP_PCI_IRQ0, BSP_PCI_ISA_BRIDGE_IRQ = BSP_PCI_IRQ0,
#if defined(mvme2100)
BSP_DEC21143_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 1,
BSP_PMC_PCMIP_TYPE1_SLOT0_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 2,
BSP_PCMIP_TYPE1_SLOT1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 3,
BSP_PCMIP_TYPE2_SLOT0_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 4,
BSP_PCMIP_TYPE2_SLOT1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 5,
BSP_PCI_INTA_UNIVERSE_LINT0_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 7,
BSP_PCI_INTB_UNIVERSE_LINT1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 8,
BSP_PCI_INTC_UNIVERSE_LINT2_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 9,
BSP_PCI_INTD_UNIVERSE_LINT3_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 10,
BSP_UART_COM1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 13,
BSP_FRONT_PANEL_ABORT_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 14,
BSP_RTC_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 15,
#endif
/* /*
* Some Processor execption handled as rtems IRQ symbolic name definition * Some Processor execption handled as RTEMS IRQ symbolic name definition
*/ */
BSP_DECREMENTER = BSP_PROCESSOR_IRQ_LOWEST_OFFSET BSP_DECREMENTER = BSP_PROCESSOR_IRQ_LOWEST_OFFSET
@@ -200,7 +211,7 @@ typedef struct {
rtems_irq_symbolic_name irqBase; rtems_irq_symbolic_name irqBase;
/* /*
* software priorities associated with interrupts. * software priorities associated with interrupts.
* if irqPrio [i] > intrPrio [j] it means that * if (*irqPrio [i] > intrPrio [j] it means that
* interrupt handler hdl connected for interrupt name i * interrupt handler hdl connected for interrupt name i
* will not be interrupted by the handler connected for interrupt j * will not be interrupted by the handler connected for interrupt j
* The interrupt source will be physically masked at i8259 level. * The interrupt source will be physically masked at i8259 level.
@@ -228,10 +239,10 @@ int BSP_irq_disable_at_i8259s (const rtems_irq_symbolic_name irqLine);
*/ */
int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine); int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine);
/* /*
* function to acknoledge a particular irq at 8259 level. After calling * function to acknowledge a particular irq at 8259 level. After calling
* this function, if a device asserts an enabled interrupt line it will * this function, if a device asserts an enabled interrupt line it will
* be propagated further to the processor. Mainly usefull for people * be propagated further to the processor. Mainly usefull for people
* writting raw handlers as this is automagically done for rtems managed * writing raw handlers as this is automagically done for RTEMS managed
* handlers. * handlers.
*/ */
int BSP_irq_ack_at_i8259s (const rtems_irq_symbolic_name irqLine); int BSP_irq_ack_at_i8259s (const rtems_irq_symbolic_name irqLine);
@@ -252,18 +263,18 @@ int BSP_irq_enabled_at_i8259s (const rtems_irq_symbolic_name irqLine);
* 3) store the current i8259s' interrupt masks * 3) store the current i8259s' interrupt masks
* 4) modify them to disable the current interrupt at 8259 level (and may * 4) modify them to disable the current interrupt at 8259 level (and may
* be others depending on software priorities) * be others depending on software priorities)
* 5) aknowledge the i8259s', * 5) acknowledge the i8259s',
* 6) demask the processor, * 6) demask the processor,
* 7) call the application handler * 7) call the application handler
* *
* As a result the hdl function provided * As a result the hdl function provided
* *
* a) can perfectly be written is C, * a) can perfectly be written is C,
* b) may also well directly call the part of the RTEMS API that can be used * b) may also well directly call the part of the RTEMS API that can be
* from interrupt level, * used from interrupt level,
* c) It only responsible for handling the jobs that need to be done at * c) It only responsible for handling the jobs that need to be done at
* the device level including (aknowledging/re-enabling the interrupt at device, * the device level including (aknowledging/re-enabling the interrupt
* level, getting the data,...) * at device, level, getting the data,...)
* *
* When returning from the function, the following will be performed by * When returning from the function, the following will be performed by
* the RTEMS irq epilogue: * the RTEMS irq epilogue:
@@ -274,7 +285,6 @@ int BSP_irq_enabled_at_i8259s (const rtems_irq_symbolic_name irqLine);
* 4) perform rescheduling when necessary, * 4) perform rescheduling when necessary,
* 5) restore the C scratch registers... * 5) restore the C scratch registers...
* 6) restore initial execution flow * 6) restore initial execution flow
*
*/ */
int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*);
int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data*); int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data*);
@@ -288,7 +298,8 @@ int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data*);
int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr);
/* /*
* function to get disconnect the RTEMS irq handler for ptr->name. * function to get disconnect the RTEMS irq handler for ptr->name.
* This function checks that the value given is the current one for safety reason. * This function checks that the value given is the current one for safety
* reasons.
* The user can use the previous function to get it. * The user can use the previous function to get it.
*/ */
int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*);

View File

@@ -29,10 +29,6 @@
#include <bsp/motorola.h> #include <bsp/motorola.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
/*
#define SHOW_ISA_PCI_BRIDGE_SETTINGS
*/
typedef struct { typedef struct {
unsigned char bus; /* few chance the PCI/ISA bridge is not on first bus but ... */ unsigned char bus; /* few chance the PCI/ISA bridge is not on first bus but ... */
unsigned char device; unsigned char device;
@@ -68,14 +64,14 @@ static rtems_irq_connect_data defaultIrq = {
}; };
static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={ static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
/* /*
* actual rpiorities for interrupt : * actual priorities for interrupt :
* 0 means that only current interrupt is masked * 0 means that only current interrupt is masked
* 255 means all other interrupts are masked * 255 means all other interrupts are masked
*/ */
/* /*
* ISA interrupts. * ISA interrupts.
* The second entry has a priority of 255 because * The second entry has a priority of 255 because
* it is the slave pic entry and is should always remain * it is the slave pic entry and should always remain
* unmasked. * unmasked.
*/ */
0,0, 0,0,
@@ -91,6 +87,45 @@ static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
0 0
}; };
#if defined(mvme2100)
static unsigned char mvme2100_openpic_initpolarities[16] = {
0, /* Not used - should be disabled */
0, /* DEC21143 Controller */
0, /* PMC/PC-MIP Type I Slot 0 */
0, /* PC-MIP Type I Slot 1 */
0, /* PC-MIP Type II Slot 0 */
0, /* PC-MIP Type II Slot 1 */
0, /* Not used - should be disabled */
0, /* PCI Expansion Interrupt A/Universe II (LINT0) */
0, /* PCI Expansion Interrupt B/Universe II (LINT1) */
0, /* PCI Expansion Interrupt C/Universe II (LINT2) */
0, /* PCI Expansion Interrupt D/Universe II (LINT3) */
0, /* Not used - should be disabled */
0, /* Not used - should be disabled */
1, /* 16550 UART */
0, /* Front panel Abort Switch */
0, /* RTC IRQ */
};
static unsigned char mvme2100_openpic_initsenses[] = {
0, /* Not used - should be disabled */
1, /* DEC21143 Controller */
1, /* PMC/PC-MIP Type I Slot 0 */
1, /* PC-MIP Type I Slot 1 */
1, /* PC-MIP Type II Slot 0 */
1, /* PC-MIP Type II Slot 1 */
0, /* Not used - should be disabled */
1, /* PCI Expansion Interrupt A/Universe II (LINT0) */
1, /* PCI Expansion Interrupt B/Universe II (LINT1) */
1, /* PCI Expansion Interrupt C/Universe II (LINT2) */
1, /* PCI Expansion Interrupt D/Universe II (LINT3) */
0, /* Not used - should be disabled */
0, /* Not used - should be disabled */
1, /* 16550 UART */
0, /* Front panel Abort Switch */
1, /* RTC IRQ */
};
#else
static unsigned char mcp750_openpic_initpolarities[16] = { static unsigned char mcp750_openpic_initpolarities[16] = {
1, /* 8259 cascade */ 1, /* 8259 cascade */
0, /* all the rest of them */ 0, /* all the rest of them */
@@ -114,6 +149,7 @@ static unsigned char mcp750_openpic_initsenses[] = {
1, /* MCP750_INT_PCI_BUS2_INTC */ 1, /* MCP750_INT_PCI_BUS2_INTC */
1, /* MCP750_INT_PCI_BUS2_INTD */ 1, /* MCP750_INT_PCI_BUS2_INTD */
}; };
#endif
void VIA_isa_bridge_interrupts_setup(void) void VIA_isa_bridge_interrupts_setup(void)
{ {
@@ -226,17 +262,28 @@ loop_exit:
*/ */
void BSP_rtems_irq_mng_init(unsigned cpuId) void BSP_rtems_irq_mng_init(unsigned cpuId)
{ {
rtems_raw_except_connect_data vectorDesc; #if !defined(mvme2100)
int known_cpi_isa_bridge = 0; int known_cpi_isa_bridge = 0;
#endif
rtems_raw_except_connect_data vectorDesc;
int i; int i;
/* /*
* First initialize the Interrupt management hardware * First initialize the Interrupt management hardware
*/ */
#if defined(mvme2100)
#ifdef TRACE_IRQ_INIT
printk("Going to initialize EPIC interrupt controller (openpic compliant)\n");
#endif
openpic_init(1, mvme2100_openpic_initpolarities, mvme2100_openpic_initsenses);
#else
#ifdef TRACE_IRQ_INIT #ifdef TRACE_IRQ_INIT
printk("Going to initialize raven interrupt controller (openpic compliant)\n"); printk("Going to initialize raven interrupt controller (openpic compliant)\n");
#endif #endif
openpic_init(1, mcp750_openpic_initpolarities, mcp750_openpic_initsenses); openpic_init(1, mcp750_openpic_initpolarities, mcp750_openpic_initsenses);
#endif
#if !defined(mvme2100)
#ifdef TRACE_IRQ_INIT #ifdef TRACE_IRQ_INIT
printk("Going to initialize the PCI/ISA bridge IRQ related setting (VIA 82C586)\n"); printk("Going to initialize the PCI/ISA bridge IRQ related setting (VIA 82C586)\n");
#endif #endif
@@ -262,8 +309,10 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
printk("Going to initialize the ISA PC legacy IRQ management hardware\n"); printk("Going to initialize the ISA PC legacy IRQ management hardware\n");
#endif #endif
BSP_i8259s_init(); BSP_i8259s_init();
#endif
/* /*
* Initialize Rtems management interrupt table * Initialize RTEMS management interrupt table
*/ */
/* /*
* re-init the rtemsIrq table * re-init the rtemsIrq table
@@ -310,6 +359,6 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
BSP_panic("Unable to initialize RTEMS external raw exception\n"); BSP_panic("Unable to initialize RTEMS external raw exception\n");
} }
#ifdef TRACE_IRQ_INIT #ifdef TRACE_IRQ_INIT
printk("RTEMS IRQ management is now operationnal\n"); printk("RTEMS IRQ management is now operational\n");
#endif #endif
} }

View File

@@ -3,7 +3,7 @@
* This include file describe the data structure and the functions implemented * This include file describe the data structure and the functions implemented
* by rtems to identify motorola boards. * by rtems to identify motorola boards.
* *
* CopyRight (C) 1999 valette@crf.canon.fr * Copyright (C) 1999 valette@crf.canon.fr
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in found in the file LICENSE in this distribution or at * found in found in the file LICENSE in this distribution or at
@@ -12,14 +12,15 @@
* $Id$ * $Id$
*/ */
#include <bsp.h>
#include <bsp/motorola.h> #include <bsp/motorola.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <libcpu/io.h> #include <libcpu/io.h>
#include <string.h> #include <string.h>
/* /*
** Board-specific table that maps interrupt names to onboard pci ** Board-specific table that maps interrupt names to onboard PCI
** peripherals as well as local pci busses. This table is used at ** peripherals as well as local PCI busses. This table is used at
** bspstart() to configure the interrupt name & pin for all devices that ** bspstart() to configure the interrupt name & pin for all devices that
** do not have it already specified. If the device is already ** do not have it already specified. If the device is already
** configured, we leave it alone but sanity check & print a warning if ** configured, we leave it alone but sanity check & print a warning if
@@ -109,6 +110,19 @@ static struct _int_map mtx603_intmap[] = {
NULL_INTMAP }; NULL_INTMAP };
static struct _int_map mvme2100_intmap[] = {
{0, 0, 0, {{1, {16,-1,-1,-1}}, /* something shows up in slot 0 and OpenPIC */
/* 0 is unused. This hushes the init code. */
NULL_PINMAP}},
{0, 13, 0, {{1, {23,24,25,26}}, /* PCI INT[A-D]/Universe Lint[0-3] */
NULL_PINMAP}},
{0, 14, 0, {{1, {17,-1,-1,-1}}, /* onboard ethernet */
NULL_PINMAP}},
NULL_INTMAP };
/* /*
* This table represents the standard PCI swizzle defined in the * This table represents the standard PCI swizzle defined in the
* PCI bus specification. Table taken from Linux 2.4.18, prep_pci.c, * PCI bus specification. Table taken from Linux 2.4.18, prep_pci.c,
@@ -162,11 +176,13 @@ static const mot_info_t mot_boards[] = {
{0x1E0, 0xFD, "MVME 3600 with MVME712M", NULL, NULL}, {0x1E0, 0xFD, "MVME 3600 with MVME712M", NULL, NULL},
{0x1E0, 0xFE, "MVME 3600 with MVME761", NULL, NULL}, {0x1E0, 0xFE, "MVME 3600 with MVME761", NULL, NULL},
{0x1E0, 0xFF, "MVME 1600-001 or 1600-011", NULL, NULL}, {0x1E0, 0xFF, "MVME 1600-001 or 1600-011", NULL, NULL},
{0x000, 0x00, ""} {0x000, 0x00, ""}, /* end of probeable values for automatic scan */
{0x000, 0x00, "MVME 2100", mvme2100_intmap, prep_pci_swizzle},
}; };
prep_t currentPrepType; prep_t currentPrepType;
motorolaBoard currentBoard; motorolaBoard currentBoard;
prep_t checkPrepBoardType(RESIDUAL *res) prep_t checkPrepBoardType(RESIDUAL *res)
{ {
prep_t PREP_type; prep_t PREP_type;
@@ -190,6 +206,15 @@ prep_t checkPrepBoardType(RESIDUAL *res)
motorolaBoard getMotorolaBoard() motorolaBoard getMotorolaBoard()
{ {
/*
* At least the MVME2100 does not have the CPU Type and Base Type Registers,
* so it cannot be probed.
*
* NOTE: Every path must set currentBoard.
*/
#if defined(mvme2100)
currentBoard = (motorolaBoard) MVME_2100;
#else
unsigned char cpu_type; unsigned char cpu_type;
unsigned char base_mod; unsigned char base_mod;
int entry; int entry;
@@ -222,6 +247,7 @@ motorolaBoard getMotorolaBoard()
return currentBoard; return currentBoard;
} }
currentBoard = (motorolaBoard) mot_entry; currentBoard = (motorolaBoard) mot_entry;
#endif
return currentBoard; return currentBoard;
} }
@@ -234,6 +260,7 @@ const char* motorolaBoardToString(motorolaBoard board)
const struct _int_map *motorolaIntMap(motorolaBoard board) const struct _int_map *motorolaIntMap(motorolaBoard board)
{ {
if (board == MOTOROLA_UNKNOWN) return NULL; if (board == MOTOROLA_UNKNOWN) return NULL;
/* printk( "IntMap board %d 0x%08x\n", board, mot_boards[board].intmap ); */
return mot_boards[board].intmap; return mot_boards[board].intmap;
} }

View File

@@ -45,6 +45,8 @@ typedef enum {
MVME_3600_W_MVME712M = 17, MVME_3600_W_MVME712M = 17,
MVME_3600_W_MVME761 = 18, MVME_3600_W_MVME761 = 18,
MVME_1600 = 19, MVME_1600 = 19,
/* In the table, slot 20 is the marker for end of automatic probe and scan */
MVME_2100 = 21,
MOTOROLA_UNKNOWN = 255 MOTOROLA_UNKNOWN = 255
} motorolaBoard; } motorolaBoard;

View File

@@ -20,12 +20,12 @@
*/ */
#include <rtems.h> #include <rtems.h>
#include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <bsp/openpic.h> #include <bsp/openpic.h>
#include <bsp/pci.h> #include <bsp/pci.h>
#include <libcpu/io.h> #include <libcpu/io.h>
#include <libcpu/byteorder.h> #include <libcpu/byteorder.h>
#include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#ifndef NULL #ifndef NULL
@@ -189,7 +189,9 @@ void openpic_init(int main_pic, unsigned char *polarities, unsigned char *senses
OPENPIC_VENDOR_ID_STEPPING_SHIFT; OPENPIC_VENDOR_ID_STEPPING_SHIFT;
/* Kludge for the Raven */ /* Kludge for the Raven */
/*
pci_read_config_dword(0, 0, 0, 0, &t); pci_read_config_dword(0, 0, 0, 0, &t);
*/
if (t == PCI_VENDOR_ID_MOTOROLA + (PCI_DEVICE_ID_MOTOROLA_RAVEN<<16)) { if (t == PCI_VENDOR_ID_MOTOROLA + (PCI_DEVICE_ID_MOTOROLA_RAVEN<<16)) {
vendor = "Motorola"; vendor = "Motorola";
device = "Raven"; device = "Raven";
@@ -455,6 +457,11 @@ unsigned long flags;
void openpic_initirq(unsigned int irq, unsigned int pri, unsigned int vec, int pol, int sense) void openpic_initirq(unsigned int irq, unsigned int pri, unsigned int vec, int pol, int sense)
{ {
#if 0
printk("openpic_initirq: irq=%d pri=%d vec=%d pol=%d sense=%d\n",
irq, pri, vec, pol, sense);
#endif
check_arg_irq(irq); check_arg_irq(irq);
check_arg_pri(pri); check_arg_pri(pri);
check_arg_vec(vec); check_arg_vec(vec);

View File

@@ -41,7 +41,11 @@
* OpenPIC supports up to 2048 interrupt sources and up to 32 processors * OpenPIC supports up to 2048 interrupt sources and up to 32 processors
*/ */
#if defined(mpc8240) || defined(mpc8245)
#define OPENPIC_MAX_SOURCES (2048 - 16)
#else
#define OPENPIC_MAX_SOURCES 2048 #define OPENPIC_MAX_SOURCES 2048
#endif
#define OPENPIC_MAX_PROCESSORS 32 #define OPENPIC_MAX_PROCESSORS 32
#define OPENPIC_NUM_TIMERS 4 #define OPENPIC_NUM_TIMERS 4
@@ -151,6 +155,9 @@ typedef struct _OpenPIC_Global {
OpenPIC_Reg _Timer_Frequency; /* Read/Write */ OpenPIC_Reg _Timer_Frequency; /* Read/Write */
OpenPIC_Timer Timer[OPENPIC_NUM_TIMERS]; OpenPIC_Timer Timer[OPENPIC_NUM_TIMERS];
char Pad1[0xee00]; char Pad1[0xee00];
#if defined(mpc8240) || defined(mpc8245)
char Pad2[0x0200];
#endif
} OpenPIC_Global; } OpenPIC_Global;
/* /*

View File

@@ -12,12 +12,13 @@
#include <bsp/openpic.h> #include <bsp/openpic.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <libcpu/cpuIdent.h>
#define RAVEN_MPIC_IOSPACE_ENABLE 0x1 #define RAVEN_MPIC_IOSPACE_ENABLE 0x0001
#define RAVEN_MPIC_MEMSPACE_ENABLE 0x2 #define RAVEN_MPIC_MEMSPACE_ENABLE 0x0002
#define RAVEN_MASTER_ENABLE 0x4 #define RAVEN_MASTER_ENABLE 0x0004
#define RAVEN_PARITY_CHECK_ENABLE 0x40 #define RAVEN_PARITY_CHECK_ENABLE 0x0040
#define RAVEN_SYSTEM_ERROR_ENABLE 0x100 #define RAVEN_SYSTEM_ERROR_ENABLE 0x0100
#define RAVEN_CLEAR_EVENTS_MASK 0xf9000000 #define RAVEN_CLEAR_EVENTS_MASK 0xf9000000
#define RAVEN_MPIC_MEREN ((volatile unsigned *)0xfeff0020) #define RAVEN_MPIC_MEREN ((volatile unsigned *)0xfeff0020)
@@ -26,6 +27,7 @@
#define MEREN_VAL 0x2f00 #define MEREN_VAL 0x2f00
#define pci BSP_pci_configuration #define pci BSP_pci_configuration
extern unsigned int EUMBBAR;
extern const pci_config_access_functions pci_direct_functions; extern const pci_config_access_functions pci_direct_functions;
extern const pci_config_access_functions pci_indirect_functions; extern const pci_config_access_functions pci_indirect_functions;
@@ -54,6 +56,20 @@ unsigned merst;
void detect_host_bridge() void detect_host_bridge()
{ {
#if (defined(mpc8240) || defined(mpc8245))
/*
* If the processor is an 8240 or an 8245 then the PIC is built
* in instead of being on the PCI bus. The MVME2100 is using Processor
* Address Map B (CHRP) although the Programmer's Reference Guide says
* it defaults to Map A.
*/
/* We have an EPIC Interrupt Controller */
OpenPIC = (volatile struct OpenPIC *) (EUMBBAR + BSP_OPEN_PIC_BASE_OFFSET);
pci.pci_functions = &pci_indirect_functions;
pci.pci_config_addr = (volatile unsigned char *) 0xfec00000;
pci.pci_config_data = (volatile unsigned char *) 0xfee00000;
#else
PPC_DEVICE *hostbridge; PPC_DEVICE *hostbridge;
unsigned int id0; unsigned int id0;
unsigned int tmp; unsigned int tmp;
@@ -130,10 +146,10 @@ void detect_host_bridge()
printk("Raven MPIC is accessed via memory Space Access at address : %x\n", tmp); printk("Raven MPIC is accessed via memory Space Access at address : %x\n", tmp);
#endif #endif
OpenPIC=(volatile struct OpenPIC *) (tmp + PREP_ISA_MEM_BASE); OpenPIC=(volatile struct OpenPIC *) (tmp + PREP_ISA_MEM_BASE);
printk("OpenPIC found at %x.\n", printk("OpenPIC found at %x.\n", OpenPIC);
OpenPIC);
} }
} }
#endif
if (OpenPIC == (volatile struct OpenPIC *)0) { if (OpenPIC == (volatile struct OpenPIC *)0) {
BSP_panic("OpenPic Not found\n"); BSP_panic("OpenPic Not found\n");
} }

View File

@@ -1,9 +1,9 @@
/* /*
* pci.c : this file contains basic PCI Io functions. * pci.c : this file contains basic PCI Io functions.
* *
* CopyRight (C) 1999 valette@crf.canon.fr * Copyright (C) 1999 valette@crf.canon.fr
* *
* This code is heavilly inspired by the public specification of STREAM V2 * This code is heavily inspired by the public specification of STREAM V2
* that can be found at : * that can be found at :
* *
* <http://www.chorus.com/Documentation/index.html> by following * <http://www.chorus.com/Documentation/index.html> by following
@@ -21,6 +21,7 @@
#include <libcpu/io.h> #include <libcpu/io.h>
#include <bsp/pci.h> #include <bsp/pci.h>
#include <rtems/bspIo.h>
/* allow for overriding these definitions */ /* allow for overriding these definitions */
#ifndef PCI_CONFIG_ADDR #ifndef PCI_CONFIG_ADDR
@@ -36,8 +37,6 @@
/* define a shortcut */ /* define a shortcut */
#define pci BSP_pci_configuration #define pci BSP_pci_configuration
/* /*
* Bit encode for PCI_CONFIG_HEADER_TYPE register * Bit encode for PCI_CONFIG_HEADER_TYPE register
*/ */
@@ -225,7 +224,12 @@ const pci_config_access_functions pci_direct_functions = {
** the names defined in the routing record. ** the names defined in the routing record.
*/ */
static int test_intname( static int test_intname(
const struct _int_map *row, int pbus, int pslot, int int_pin, int int_name ) const struct _int_map *row,
int pbus,
int pslot,
int int_pin,
int int_name
)
{ {
int j, k; int j, k;
int _nopin= -1, _noname= -1; int _nopin= -1, _noname= -1;

View File

@@ -14,6 +14,7 @@
#include <rtems/asm.h> #include <rtems/asm.h>
#include <rtems/score/cpu.h> #include <rtems/score/cpu.h>
#include <libcpu/io.h> #include <libcpu/io.h>
#include <bspopts.h>
#define SYNC \ #define SYNC \
sync; \ sync; \
@@ -66,13 +67,24 @@ __rtems_entry_point:
* of RAM to KERNELBASE. * of RAM to KERNELBASE.
*/ */
lis r11,KERNELBASE@h lis r11,KERNELBASE@h
ori r11,r11,0x1ffe /* set up BAT registers for 604 */ /* set up BAT registers for 604 */
ori r11,r11,0x1ffe
li r8,2 /* R/W access */ li r8,2 /* R/W access */
isync isync
#if defined(mvme2100)
/* BSP_vme_config() wants to use BAT0, this board will use the
* available BAT1 to map RAM.
*/
mtspr DBAT1L,r8 /* N.B. 6xx (not 601) have valid */
mtspr DBAT1U,r11 /* bit in upper BAT register */
mtspr IBAT1L,r8
mtspr IBAT1U,r11
#else
mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */ mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
mtspr DBAT0U,r11 /* bit in upper BAT register */ mtspr DBAT0U,r11 /* bit in upper BAT register */
mtspr IBAT0L,r8 mtspr IBAT0L,r8
mtspr IBAT0U,r11 mtspr IBAT0U,r11
#endif
isync isync
/* /*
@@ -104,7 +116,8 @@ enter_C_code:
addi r9,r9, __rtems_end+(4096-CPU_MINIMUM_STACK_FRAME_SIZE)@l addi r9,r9, __rtems_end+(4096-CPU_MINIMUM_STACK_FRAME_SIZE)@l
mr r1, r9 mr r1, r9
/* /*
* We are know in a environment that is totally independent from bootloader setup. * We are now in a environment that is totally independent from
* bootloader setup.
*/ */
lis r5,environ@ha lis r5,environ@ha
la r5,environ@l(r5) /* environp */ la r5,environ@l(r5) /* environp */
@@ -117,11 +130,14 @@ enter_C_code:
.type MMUon,@function .type MMUon,@function
MMUon: MMUon:
mfmsr r0 mfmsr r0
#if (PPC_HAS_FPU == 0)
ori r0,r0, MSR_IP | MSR_RI | MSR_IR | MSR_DR | MSR_EE | MSR_FE0 | MSR_FE1 | MSR_FP ori r0,r0, MSR_IP | MSR_RI | MSR_IR | MSR_DR | MSR_EE | MSR_FE0 | MSR_FE1 | MSR_FP
#if defined(mvme2100)
/* Data addr translation is broken for the mvme2100, disable it here */
xori r0,r0, MSR_DR
#endif
#if (PPC_HAS_FPU == 0)
xori r0, r0, MSR_EE | MSR_IP | MSR_FP xori r0, r0, MSR_EE | MSR_IP | MSR_FP
#else #else
ori r0,r0, MSR_IP | MSR_RI | MSR_IR | MSR_DR | MSR_EE | MSR_FE0 | MSR_FE1 | MSR_FP
xori r0, r0, MSR_EE | MSR_IP | MSR_FE0 | MSR_FE1 xori r0, r0, MSR_EE | MSR_IP | MSR_FE0 | MSR_FE1
#endif #endif
mflr r11 mflr r11

View File

@@ -19,6 +19,7 @@
#include <string.h> #include <string.h>
#include <bsp.h>
#include <rtems/libio.h> #include <rtems/libio.h>
#include <rtems/libcsupport.h> #include <rtems/libcsupport.h>
#include <bsp/consoleIo.h> #include <bsp/consoleIo.h>
@@ -28,7 +29,6 @@
#include <bsp/openpic.h> #include <bsp/openpic.h>
#include <bsp/irq.h> #include <bsp/irq.h>
#include <bsp/VME.h> #include <bsp/VME.h>
#include <bsp.h>
#include <libcpu/bat.h> #include <libcpu/bat.h>
#include <libcpu/pte121.h> #include <libcpu/pte121.h>
#include <libcpu/cpuIdent.h> #include <libcpu/cpuIdent.h>
@@ -48,6 +48,41 @@ extern void BSP_vme_config();
SPR_RW(SPRG0) SPR_RW(SPRG0)
SPR_RW(SPRG1) SPR_RW(SPRG1)
#if defined(DEBUG_BATS)
void printBAT( int bat, unsigned32 upper, unsigned32 lower )
{
unsigned32 lowest_addr;
unsigned32 size;
printk("BAT%d raw(upper=0x%08x, lower=0x%08x) ", bat, upper, lower );
lowest_addr = (upper & 0xFFFE0000);
size = (((upper & 0x00001FFC) >> 2) + 1) * (128 * 1024);
printk(" range(0x%08x, 0x%08x) %s%s %s%s%s%s %s\n",
lowest_addr,
lowest_addr + (size - 1),
(upper & 0x01) ? "P" : "p",
(upper & 0x02) ? "S" : "s",
(lower & 0x08) ? "G" : "g",
(lower & 0x10) ? "M" : "m",
(lower & 0x20) ? "I" : "i",
(lower & 0x40) ? "W" : "w",
(lower & 0x01) ? "Read Only" :
((lower & 0x02) ? "Read/Write" : "No Access")
);
}
void ShowBATS(){
unsigned32 lower;
unsigned32 upper;
__MFSPR(536, upper); __MFSPR(537, lower); printBAT( 0, upper, lower );
__MFSPR(538, upper); __MFSPR(539, lower); printBAT( 1, upper, lower );
__MFSPR(540, upper); __MFSPR(541, lower); printBAT( 2, upper, lower );
__MFSPR(542, upper); __MFSPR(543, lower); printBAT( 3, upper, lower );
}
#endif
/* /*
* Copy of residuals passed by firmware * Copy of residuals passed by firmware
*/ */
@@ -130,21 +165,22 @@ void bsp_libc_init( void *, uint32_t, int );
void bsp_pretasking_hook(void) void bsp_pretasking_hook(void)
{ {
uint32_t heap_start; rtems_unsigned32 heap_start;
uint32_t heap_size; rtems_unsigned32 heap_size;
uint32_t heap_sbrk_spared; rtems_unsigned32 heap_sbrk_spared;
extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*); extern rtems_unsigned32 _bsp_sbrk_init(rtems_unsigned32, rtems_unsigned32*);
heap_start = ((uint32_t) __rtems_end) +INIT_STACK_SIZE + INTR_STACK_SIZE; heap_start = ((rtems_unsigned32) __rtems_end) +
INIT_STACK_SIZE + INTR_STACK_SIZE;
if (heap_start & (CPU_ALIGNMENT-1)) if (heap_start & (CPU_ALIGNMENT-1))
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
heap_size = (BSP_mem_size - heap_start) - BSP_Configuration.work_space_size; heap_size = (BSP_mem_size - heap_start) - BSP_Configuration.work_space_size;
heap_sbrk_spared=_bsp_sbrk_init(heap_start, &heap_size); heap_sbrk_spared=_bsp_sbrk_init(heap_start, &heap_size);
#ifdef SHOW_MORE_INIT_SETTINGS #ifdef SHOW_MORE_INIT_SETTINGS
printk(" HEAP start %x size %x (%x bytes spared for sbrk)\n", heap_start, heap_size, heap_sbrk_spared); printk( "HEAP start %x size %x (%x bytes spared for sbrk)\n",
heap_start, heap_size, heap_sbrk_spared);
#endif #endif
bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared); bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared);
@@ -172,6 +208,33 @@ void save_boot_params(RESIDUAL* r3, void *r4, void* r5, char *additional_boot_op
loaderParam[MAX_LOADER_ADD_PARM - 1] ='\0'; loaderParam[MAX_LOADER_ADD_PARM - 1] ='\0';
} }
#if defined(mpc8240) || defined(mpc8245)
unsigned int EUMBBAR;
/*
* Return the current value of the Embedded Utilities Memory Block Base Address
* Register (EUMBBAR) as read from the processor configuration register using
* Processor Address Map B (CHRP).
*/
unsigned int get_eumbbar() {
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;
}
#endif
/* /*
* bsp_start * bsp_start
* *
@@ -180,9 +243,10 @@ void save_boot_params(RESIDUAL* r3, void *r4, void* r5, char *additional_boot_op
void bsp_start( void ) void bsp_start( void )
{ {
int err;
unsigned char *stack; unsigned char *stack;
#if !defined(mpc8240) && !defined(mpc8245)
unsigned l2cr; unsigned l2cr;
#endif
register unsigned char* intrStack; register unsigned char* intrStack;
unsigned char *work_space_start; unsigned char *work_space_start;
ppc_cpu_id_t myCpu; ppc_cpu_id_t myCpu;
@@ -190,17 +254,29 @@ void bsp_start( void )
prep_t boardManufacturer; prep_t boardManufacturer;
motorolaBoard myBoard; motorolaBoard myBoard;
Triv121PgTbl pt=0; Triv121PgTbl pt=0;
/* /*
* Get CPU identification dynamically. Note that the get_ppc_cpu_type() function * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
* store the result in global variables so that it can be used latter... * function store the result in global variables so that it can be used
* later...
*/ */
myCpu = get_ppc_cpu_type(); myCpu = get_ppc_cpu_type();
myCpuRevision = get_ppc_cpu_revision(); myCpuRevision = get_ppc_cpu_revision();
#if defined(mvme2100)
EUMBBAR = get_eumbbar();
Cpu_table.exceptions_in_RAM = TRUE;
{ unsigned v = 0x3000 ; _CPU_MSR_SET(v); }
#endif
#if !defined(mpc8240) && !defined(mpc8245)
/* /*
* enables L1 Cache. Note that the L1_caches_enables() codes checks for * enables L1 Cache. Note that the L1_caches_enables() codes checks for
* relevant CPU type so that the reason why there is no use of myCpu... * relevant CPU type so that the reason why there is no use of myCpu...
*/ */
L1_caches_enables(); L1_caches_enables();
/* /*
* Enable L2 Cache. Note that the set_L2CR(L2CR) codes checks for * Enable L2 Cache. Note that the set_L2CR(L2CR) codes checks for
* relevant CPU type (mpc750)... * relevant CPU type (mpc750)...
@@ -211,12 +287,15 @@ void bsp_start( void )
#endif #endif
if ( (! (l2cr & 0x80000000)) && ((int) l2cr == -1)) if ( (! (l2cr & 0x80000000)) && ((int) l2cr == -1))
set_L2CR(0xb9A14000); set_L2CR(0xb9A14000);
#endif
/* /*
* the initial stack has aready been set to this value in start.S * 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 there is no need to set it in r1 again... It is just for info
* so that It can be printed without accessing R1. * so that It can be printed without accessing R1.
*/ */
stack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE; stack = ((unsigned char*) __rtems_end) +
INIT_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
/* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */ /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
*((uint32_t*)stack) = 0; *((uint32_t*)stack) = 0;
@@ -225,10 +304,11 @@ void bsp_start( void )
* Initialize the interrupt related settings * Initialize the interrupt related settings
* SPRG1 = software managed IRQ stack * SPRG1 = software managed IRQ stack
* *
* This could be done latter (e.g in IRQ_INIT) but it helps to understand * This could be done later (e.g in IRQ_INIT) but it helps to understand
* some settings below... * some settings below...
*/ */
intrStack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE; intrStack = ((unsigned char*) __rtems_end) +
INIT_STACK_SIZE + INTR_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
/* make sure it's properly aligned */ /* make sure it's properly aligned */
(uint32_t)intrStack &= ~(CPU_STACK_ALIGNMENT-1); (uint32_t)intrStack &= ~(CPU_STACK_ALIGNMENT-1);
@@ -242,38 +322,48 @@ void bsp_start( void )
_write_SPRG0(PPC_BSP_HAS_FIXED_PR288); _write_SPRG0(PPC_BSP_HAS_FIXED_PR288);
/* /*
* Initialize default raw exception hanlders. See vectors/vectors_init.c * Initialize default raw exception handlers. See vectors/vectors_init.c
*/ */
initialize_exceptions(); initialize_exceptions();
/* /*
* Init MMU block address translation to enable hardware * Init MMU block address translation to enable hardware access
* access
*/ */
#if !defined(mvme2100)
/* /*
* PC legacy IO space used for inb/outb and all PC * PC legacy IO space used for inb/outb and all PC compatible hardware
* compatible hardware
*/ */
setdbat(1, _IO_BASE, _IO_BASE, 0x10000000, IO_PAGE); setdbat(1, _IO_BASE, _IO_BASE, 0x10000000, IO_PAGE);
#endif
/* /*
* PCI devices memory area. Needed to access OPENPIC features * PCI devices memory area. Needed to access OpenPIC features
* provided by the RAVEN * provided by the Raven
*/
/* T. Straumann: give more PCI address space */
setdbat(2, PCI_MEM_BASE, PCI_MEM_BASE, 0x10000000, IO_PAGE);
/*
* Must have acces to open pic PCI ACK registers
* provided by the RAVEN
* *
* T. Straumann: give more PCI address space
*/
setdbat(2, PCI_MEM_BASE, PCI_MEM_BASE, 0x10000000, IO_PAGE);
/*
* Must have acces to open pic PCI ACK registers provided by the RAVEN
*/ */
setdbat(3, 0xf0000000, 0xf0000000, 0x10000000, IO_PAGE); setdbat(3, 0xf0000000, 0xf0000000, 0x10000000, IO_PAGE);
select_console(CONSOLE_LOG); select_console(CONSOLE_LOG);
/* We check that the keyboard is present and immediately /*
* We check that the keyboard is present and immediately
* select the serial console if not. * select the serial console if not.
*/ */
#if defined(BSP_KBD_IOBASE)
{ int err;
err = kbdreset(); err = kbdreset();
if (err) select_console(CONSOLE_SERIAL); if (err) select_console(CONSOLE_SERIAL);
}
#else
select_console(CONSOLE_SERIAL);
#endif
boardManufacturer = checkPrepBoardType(&residualCopy); boardManufacturer = checkPrepBoardType(&residualCopy);
if (boardManufacturer != PREP_Motorola) { if (boardManufacturer != PREP_Motorola) {
@@ -283,7 +373,8 @@ void bsp_start( void )
myBoard = getMotorolaBoard(); myBoard = getMotorolaBoard();
printk("-----------------------------------------\n"); printk("-----------------------------------------\n");
printk("Welcome to %s on %s\n", _RTEMS_version, motorolaBoardToString(myBoard)); printk("Welcome to %s on %s\n", _RTEMS_version,
motorolaBoardToString(myBoard));
printk("-----------------------------------------\n"); printk("-----------------------------------------\n");
#ifdef SHOW_MORE_INIT_SETTINGS #ifdef SHOW_MORE_INIT_SETTINGS
printk("Residuals are located at %x\n", (unsigned) &residualCopy); printk("Residuals are located at %x\n", (unsigned) &residualCopy);
@@ -309,9 +400,9 @@ void bsp_start( void )
{ {
const struct _int_map *bspmap = motorolaIntMap(currentBoard); const struct _int_map *bspmap = motorolaIntMap(currentBoard);
if( bspmap ) if( bspmap ) {
{ printk("pci : Configuring interrupt routing for '%s'\n",
printk("pci : Configuring interrupt routing for '%s'\n", motorolaBoardToString(currentBoard)); motorolaBoardToString(currentBoard));
FixupPCI(bspmap, motorolaIntSwizzle(currentBoard)); FixupPCI(bspmap, motorolaIntSwizzle(currentBoard));
} }
else else
@@ -328,10 +419,18 @@ void bsp_start( void )
*/ */
__asm__ __volatile ("sc"); __asm__ __volatile ("sc");
/* /*
* Check we can still catch exceptions and returned coorectly. * Check we can still catch exceptions and return coorectly.
*/ */
printk("Testing exception handling Part 2\n"); printk("Testing exception handling Part 2\n");
__asm__ __volatile ("sc"); __asm__ __volatile ("sc");
/*
* Somehow doing the above seems to clobber SPRG0 on the mvme2100. It
* is probably a not so subtle hint that you do not want to use PPCBug
* once RTEMS is up and running. Anyway, we still needs to indicate
* that we have fixed PR288. Eventually, this should go away.
*/
_write_SPRG0(PPC_BSP_HAS_FIXED_PR288);
#endif #endif
BSP_mem_size = residualCopy.TotalMemory; BSP_mem_size = residualCopy.TotalMemory;
@@ -354,16 +453,11 @@ void bsp_start( void )
*/ */
pt = BSP_pgtbl_setup(&BSP_mem_size); pt = BSP_pgtbl_setup(&BSP_mem_size);
if (!pt || if (!pt || TRIV121_MAP_SUCCESS != triv121PgTblMap(
TRIV121_MAP_SUCCESS != triv121PgTblMap( pt, TRIV121_121_VSID, 0xfeff0000, 1,
pt, TRIV121_ATTR_IO_PAGE, TRIV121_PP_RW_PAGE)) {
TRIV121_121_VSID, printk("WARNING: unable to setup page tables VME "
0xfeff0000, "bridge must share PCI space\n");
1,
TRIV121_ATTR_IO_PAGE,
TRIV121_PP_RW_PAGE
)) {
printk("WARNING: unable to setup page tables VME bridge must share PCI space\n");
} }
/* /*
@@ -380,12 +474,15 @@ void bsp_start( void )
Cpu_table.exceptions_in_RAM = TRUE; Cpu_table.exceptions_in_RAM = TRUE;
#ifdef SHOW_MORE_INIT_SETTINGS #ifdef SHOW_MORE_INIT_SETTINGS
printk("BSP_Configuration.work_space_size = %x\n", BSP_Configuration.work_space_size); printk("BSP_Configuration.work_space_size = %x\n",
BSP_Configuration.work_space_size);
#endif #endif
work_space_start = work_space_start =
(unsigned char *)BSP_mem_size - BSP_Configuration.work_space_size; (unsigned char *)BSP_mem_size - BSP_Configuration.work_space_size;
if ( work_space_start <= ((unsigned char *)__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE) { if ( work_space_start <=
((unsigned char *)__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE) {
printk( "bspstart: Not enough RAM!!!\n" ); printk( "bspstart: Not enough RAM!!!\n" );
bsp_cleanup(); bsp_cleanup();
} }
@@ -406,23 +503,28 @@ void bsp_start( void )
printk("Page table setup finished; will activate it NOW...\n"); printk("Page table setup finished; will activate it NOW...\n");
#endif #endif
BSP_pgtbl_activate(pt); BSP_pgtbl_activate(pt);
#if !defined(mvme2100)
/* finally, switch off DBAT3 */ /* finally, switch off DBAT3 */
setdbat(3, 0, 0, 0, 0); setdbat(3, 0, 0, 0, 0);
#endif
} }
/* /*
* Initialize VME bridge - needs working PCI * Initialize VME bridge - needs working PCI and IRQ subsystems...
* and IRQ subsystems...
*/ */
#ifdef SHOW_MORE_INIT_SETTINGS #ifdef SHOW_MORE_INIT_SETTINGS
printk("Going to initialize VME bridge\n"); printk("Going to initialize VME bridge\n");
#endif #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 * VME initialization is in a separate file so apps which don't use VME or
* routine. * want a different configuration may link against a customized routine.
*/ */
BSP_vme_config(); BSP_vme_config();
#if defined(DEBUG_BATS)
ShowBATS();
#endif
#ifdef SHOW_MORE_INIT_SETTINGS #ifdef SHOW_MORE_INIT_SETTINGS
printk("Exit from bspstart\n"); printk("Exit from bspstart\n");
#endif #endif

View File

@@ -0,0 +1,69 @@
/*
* This file contains the RTC driver table for Motorola shared BSPs.
*
* 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 <bsp.h>
#include <libchip/rtc.h>
#include <libchip/m48t08.h>
/* Forward function declaration */
#if !defined(mvme2100)
unsigned32 mvmertc_get_register( unsigned32, unsigned8 );
void mvmertc_set_register( unsigned32, unsigned8, unsigned32 );
#endif
/* The following table configures the RTC drivers used in this BSP */
rtc_tbl RTC_Table[] = {
{
"/dev/rtc", /* sDeviceName */
RTC_M48T08, /* deviceType -- actually M48T59 */
&m48t08_fns, /* pDeviceFns */
rtc_probe, /* deviceProbe */
NULL, /* pDeviceParams */
#if defined(mvme2100)
0xFFE81ff8, /* ulCtrlPort1 */
0x00, /* ulDataPort */
m48t08_get_register, /* getRegister */
m48t08_set_register /* setRegister */
#else
0xFFE81ff8, /* ulCtrlPort1 */
0x00, /* ulDataPort */
mvmertc_get_register, /* getRegister */
mvmertc_set_register /* setRegister */
#endif
}
};
/* Some information used by the RTC driver */
#define NUM_RTCS (sizeof(RTC_Table)/sizeof(rtc_tbl))
unsigned long RTC_Count = NUM_RTCS;
rtems_device_minor_number RTC_Minor;
#if !defined(mvme2100)
#include <rtems/bspIo.h>
void mvmertc_set_register(
unsigned32 base,
unsigned8 reg,
unsigned32 value
)
{
printk( "RTC SUPPORT NOT IMPLEMENTED ON THIS BOARD\n");
}
unsigned32 mvmertc_get_register(
unsigned32 base,
unsigned8 reg
)
{
printk( "RTC SUPPORT NOT IMPLEMENTED ON THIS BOARD\n");
}
#endif

View File

@@ -176,7 +176,9 @@ void initialize_exceptions()
if (!mpc60x_init_exceptions(&exception_config)) { if (!mpc60x_init_exceptions(&exception_config)) {
BSP_panic("Exception handling initialization failed\n"); BSP_panic("Exception handling initialization failed\n");
} }
#ifdef RTEMS_DEBUG
else { else {
printk("Exception handling initialization done\n"); printk("Exception handling initialization done\n");
} }
#endif
} }

View File

@@ -34,23 +34,17 @@ union {
unsigned long batbits; unsigned long batbits;
} dbat0u; } dbat0u;
if (currentBoard < MVME_2300 || currentBoard >= MVME_1600) {
printk("VME bridge for this board is unknown - if it's a Tundra Universe, add the board to 'shared/vme/vmeconfig.c'\n");
printk("Skipping VME initialization...\n");
return;
}
vmeUniverseInit(); vmeUniverseInit();
vmeUniverseReset(); vmeUniverseReset();
/* setup a PCI area to map the VME bus */ /* setup a PCI area to map the VME bus */
dbat0u.batbits = _read_DBAT0U(); dbat0u.batbits = _read_DBAT0U();
/* if we have page tables, BAT0 is available */ /* if we have page tables, BAT0 is available */
if (dbat0u.bat.vs || dbat0u.bat.vp) { if (dbat0u.bat.vs || dbat0u.bat.vp) {
printk("WARNING: BAT0 is taken (no pagetables?); VME bridge must share PCI range for VME access\n"); printk("WARNING: BAT0 is taken (no pagetables?); "
printk("Skipping VME initialization...\n"); "VME bridge must share PCI range for VME access\n"
"Skipping VME initialization...\n");
return; return;
} }