Merge from projects/mips to head by hand:

r201881 | imp | 2010-01-08 20:08:22 -0700 (Fri, 08 Jan 2010) | 3 lines
Rename mips_pcpu_init to mips_pcpu0_init since it applies only to the
BSP.  Provide a missing prototype.

r201845 | imp | 2010-01-08 15:48:21 -0700 (Fri, 08 Jan 2010) | 2 lines
Centralize initialization of pcpu, and set curthread early...

r198669 | rrs | 2009-10-30 02:53:11 -0600 (Fri, 30 Oct 2009) | 5 lines
With this commit our friend RMI will now compile. I have
not tested it and the chances of it running yet are about
ZERO.. but it will now compile. The hard part now begins,
 making it run ;-)

r198154 | rrs | 2009-10-15 15:03:32 -0600 (Thu, 15 Oct 2009) | 10 lines
Does 4 things:
1) Adds future RMI directories
2) Places intr_machdep.c in specfic files.arch pointing to the generic
   intr_machdep.c.  This allows us to have an architecture dependant intr_machdep.c
   (which we will need for RMI) in the machine specific directory
3) removes intr_machdep.c from files.mips
4) Adds some TARGET_XLR_XLS ifdef's for the machine specific intra_machdep.h. We
   may need to look at finding a better place to put this. But first I want to
   get this thing compiling.

r194213 | gonzo | 2009-06-14 15:04:54 -0600 (Sun, 14 Jun 2009) | 2 lines
- Fix prototype and implementation of admsw_shutdown

r192790 | gonzo | 2009-05-25 23:52:24 -0600 (Mon, 25 May 2009) | 2 lines
- Provide proper pre_ithread/post_ithread functions

r191282 | gonzo | 2009-04-19 16:02:14 -0600 (Sun, 19 Apr 2009) | 3 lines
- Make mips_bus_space_generic be of type bus_space_tag_t instead of
    struct bus_space and update all relevant places.

r191084 | gonzo | 2009-04-14 20:28:26 -0600 (Tue, 14 Apr 2009) | 6 lines
Use FreeBSD/arm approach for handling bus space access: space tag is a pointer
to bus_space structure that defines access methods and hence every bus can
define own accessors. Default space is mips_bus_space_generic. It's a simple
interface to physical memory, values are read with regard to host system
byte order.
This commit is contained in:
Warner Losh 2010-01-10 20:11:10 +00:00
parent 7bc99c9303
commit 49fc4743e4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202037
5 changed files with 63 additions and 9 deletions

View File

@ -73,6 +73,12 @@ __FBSDID("$FreeBSD$");
extern int *edata;
extern int *end;
void
platform_cpu_init()
{
/* Nothing special */
}
static void
mips_init(void)
{
@ -148,6 +154,9 @@ platform_start(__register_t a0 __unused, __register_t a1 __unused,
kernend = round_page((vm_offset_t)&end);
memset(&edata, 0, kernend - (vm_offset_t)(&edata));
/* Initialize pcpu stuff */
mips_pcpu0_init();
cninit();
mips_init();
mips_timer_init_params(platform_counter_freq, 0);

View File

@ -9,3 +9,5 @@ mips/adm5120/obio.c standard
mips/adm5120/uart_bus_adm5120.c optional uart
mips/adm5120/uart_cpu_adm5120.c optional uart
mips/adm5120/uart_dev_adm5120.c optional uart
mips/mips/intr_machdep.c standard
mips/mips/tick.c standard

View File

@ -528,7 +528,7 @@ admsw_attach(device_t dev)
ifmedia_add(&sc->sc_ifmedia[i], IFM_ETHER|IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_ifmedia[i], IFM_ETHER|IFM_AUTO);
ifp = sc->sc_ifnet[i] = if_alloc(IFT_ETHER);
ifp = sc->sc_ifnet[i] = if_alloc(IFT_ETHER);;
/* Setup interface parameters */
ifp->if_softc = sc;

View File

@ -120,6 +120,39 @@ static int obio_setup_intr(device_t, device_t, struct resource *, int,
static int obio_teardown_intr(device_t, device_t, struct resource *,
void *);
static void
obio_mask_irq(void *source)
{
int irq;
uint32_t irqmask;
uint32_t reg;
irq = (int)source;
irqmask = 1 << irq;
/* disable IRQ */
reg = REG_READ(ICU_DISABLE_REG);
REG_WRITE(ICU_DISABLE_REG, (reg | irqmask));
}
static void
obio_unmask_irq(void *source)
{
int irq;
uint32_t irqmask;
uint32_t reg;
irq = (int)source;
irqmask = 1 << irq;
/* disable IRQ */
reg = REG_READ(ICU_DISABLE_REG);
REG_WRITE(ICU_DISABLE_REG, (reg & ~irqmask));
}
static int
obio_probe(device_t dev)
{
@ -269,7 +302,7 @@ obio_activate_resource(device_t bus, device_t child, int type, int rid,
vaddr = (void *)MIPS_PHYS_TO_KSEG1((intptr_t)rman_get_start(r));
rman_set_virtual(r, vaddr);
rman_set_bustag(r, MIPS_BUS_SPACE_MEM);
rman_set_bustag(r, mips_bus_space_generic);
rman_set_bushandle(r, (bus_space_handle_t)vaddr);
}
@ -321,7 +354,7 @@ obio_setup_intr(device_t dev, device_t child, struct resource *ires,
event = sc->sc_eventstab[irq];
if (event == NULL) {
error = intr_event_create(&event, (void *)irq, 0, irq,
(mask_fn)mips_mask_irq, (mask_fn)mips_unmask_irq,
obio_mask_irq, obio_unmask_irq,
NULL, NULL, "obio intr%d:", irq);
sc->sc_eventstab[irq] = event;
@ -343,6 +376,8 @@ obio_setup_intr(device_t dev, device_t child, struct resource *ires,
/* enable */
REG_WRITE(ICU_ENABLE_REG, irqmask);
obio_unmask_irq((void*)irq);
return (0);
}
@ -351,7 +386,7 @@ obio_teardown_intr(device_t dev, device_t child, struct resource *ires,
void *cookie)
{
struct obio_softc *sc = device_get_softc(dev);
int irq, result;
int irq, result, priority;
uint32_t irqmask;
irq = rman_get_start(ires);
@ -361,10 +396,18 @@ obio_teardown_intr(device_t dev, device_t child, struct resource *ires,
if (sc->sc_eventstab[irq] == NULL)
panic("Trying to teardown unoccupied IRQ");
irqmask = 1 << irq; /* only used as a mask from here on */
irqmask = (1 << irq);
priority = irq_priorities[irq];
/* disable this irq in HW */
REG_WRITE(ICU_DISABLE_REG, irqmask);
if (priority == INTR_FIQ)
REG_WRITE(ICU_MODE_REG, REG_READ(ICU_MODE_REG) & ~irqmask);
else
REG_WRITE(ICU_MODE_REG, REG_READ(ICU_MODE_REG) | irqmask);
/* disable */
irqmask = REG_READ(ICU_ENABLE_REG);
irqmask &= ~(1 << irq);
REG_WRITE(ICU_ENABLE_REG, irqmask);
result = intr_event_remove_handler(cookie);
if (!result) {

View File

@ -67,7 +67,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->ops = uart_getops(&uart_adm5120_uart_class);
di->bas.chan = 0;
di->bas.bst = 0;
di->bas.bst = mips_bus_space_generic;
di->bas.regshft = 0;
di->bas.rclk = 0;
di->baudrate = 115200;
@ -76,7 +76,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->parity = UART_PARITY_NONE;
uart_bus_space_io = 0;
uart_bus_space_mem = MIPS_PHYS_TO_KSEG1(ADM5120_BASE_UART0);
uart_bus_space_mem = mips_bus_space_generic;
di->bas.bsh = MIPS_PHYS_TO_KSEG1(ADM5120_BASE_UART0);
return (0);