* Apply updates from Shimizu-san received after the initial commit.
* G/C unused. * Many cosmetic changes. * etc...
This commit is contained in:
parent
98a2a24647
commit
9909053174
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apbus.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $ */
|
||||
/* $NetBSD: apbus.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
@ -62,8 +62,9 @@ struct ap_intrhand {
|
||||
|
||||
#define NLEVEL 2
|
||||
#define NBIT 16
|
||||
#define LEVELxBIT(l,b) (((l)*NBIT)+(b))
|
||||
|
||||
static struct ap_intrhand apintr[NLEVEL][NBIT];
|
||||
static struct ap_intrhand apintr[NLEVEL*NBIT];
|
||||
|
||||
static int
|
||||
apbusmatch(parent, cfdata, aux)
|
||||
@ -87,20 +88,13 @@ apbusattach(parent, self, aux)
|
||||
void *aux;
|
||||
{
|
||||
struct apbus_attach_args child;
|
||||
struct apbus_device *apdev;
|
||||
struct apbus_dev *apdev;
|
||||
struct apbus_ctl *apctl;
|
||||
|
||||
*(volatile u_int*)(NEWS5000_APBUS_INTSTAT) = 0xffffffff;
|
||||
*(volatile u_int*)(NEWS5000_APBUS_INTMASK) = NEWS5000_INTAPBUS_ALL;
|
||||
|
||||
*(volatile u_int*)(NEWS5000_APBUS_CONFIG) = 0x04;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_DUMCOH) =
|
||||
NEWS5000_APBUS_DEVICE_DMAC3 |
|
||||
NEWS5000_APBUS_DEVICE_SONIC |
|
||||
NEWS5000_APBUS_DEVICE_ALLSLOT;
|
||||
|
||||
*(volatile u_int*)NEWS5000_INTMASK0 = NEWS5000_INT0_ALL;
|
||||
*(volatile u_int*)NEWS5000_INTMASK1 = NEWS5000_INT1_ALL;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_INTST) = 0xffffffff;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_INTMSK) = 0xffffffff;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_CTRL) = 0x00000004;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_DMA) = 0xffffffff;
|
||||
|
||||
printf("\n");
|
||||
|
||||
@ -130,13 +124,6 @@ apbusattach(parent, self, aux)
|
||||
child.apa_slotno = apctl->apbc_sl;
|
||||
child.apa_hwbase = apctl->apbc_hwbase;
|
||||
|
||||
#if 0
|
||||
printf("config_found: name = %s\n", child.apa_name);
|
||||
printf(" : unit = %d\n", child.apa_ctlnum);
|
||||
printf(" : slot = %d\n", child.apa_slotno);
|
||||
printf(" : unit = 0x%08lx\n", child.apa_hwbase);
|
||||
#endif
|
||||
|
||||
config_found(self, &child, apbusprint);
|
||||
|
||||
apctl = apctl->apbc_link;
|
||||
@ -181,17 +168,11 @@ aptokseg0(va)
|
||||
void
|
||||
apbus_wbflush()
|
||||
{
|
||||
volatile int *wbflush = (int *)NEWS5000_WB;
|
||||
volatile int *wbflush = (int *)NEWS5000_WBFLUSH;
|
||||
|
||||
(void)*wbflush;
|
||||
}
|
||||
|
||||
void
|
||||
apbus_intr_init()
|
||||
{
|
||||
bzero(&apintr[0][0],sizeof(apintr));
|
||||
}
|
||||
|
||||
/*
|
||||
* called by hardware interrupt routine
|
||||
*/
|
||||
@ -202,7 +183,7 @@ apbus_intr_call(level, stat)
|
||||
{
|
||||
int i;
|
||||
int nintr = 0;
|
||||
struct ap_intrhand *aip = &apintr[level][0];
|
||||
struct ap_intrhand *aip = &apintr[LEVELxBIT(level,0)];
|
||||
|
||||
for(i = 0; i < NBIT; i++) {
|
||||
if (aip->ai_mask & stat) {
|
||||
@ -241,7 +222,7 @@ apbus_intr_establish(level, mask, priority, func, aux, name, ctlno)
|
||||
if (nbit == -1)
|
||||
panic("apbus_intr_establish");
|
||||
|
||||
aip = &apintr[level][nbit];
|
||||
aip = &apintr[LEVELxBIT(level,nbit)];
|
||||
aip->ai_mask = 1 << nbit;
|
||||
aip->ai_priority = priority;
|
||||
aip->ai_func = func;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apbus_subr.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $ */
|
||||
/* $NetBSD: apbus_subr.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
@ -33,31 +33,31 @@
|
||||
|
||||
void *
|
||||
apbus_device_to_hwaddr(apbus_dev)
|
||||
struct apbus_device *apbus_dev;
|
||||
struct apbus_dev *apbus_dev;
|
||||
{
|
||||
struct apbus_ctl *ctl;
|
||||
|
||||
if (!apbus_dev)
|
||||
return (void *)0;
|
||||
if (apbus_dev == NULL)
|
||||
return NULL;
|
||||
|
||||
ctl = apbus_dev->apbd_ctl;
|
||||
if (!ctl)
|
||||
return (void *)0;
|
||||
if (ctl == NULL)
|
||||
return NULL;
|
||||
|
||||
return (void *)ctl->apbc_hwbase;
|
||||
}
|
||||
|
||||
struct apbus_device *
|
||||
struct apbus_dev *
|
||||
apbus_lookupdev(devname)
|
||||
char *devname;
|
||||
{
|
||||
struct apbus_device *dp;
|
||||
struct apbus_dev *dp;
|
||||
|
||||
dp = _sip->apbsi_dev;
|
||||
if (!devname || *devname == '\0')
|
||||
if (devname == NULL || *devname == '\0')
|
||||
return dp;
|
||||
|
||||
/* search apbus_device named 'devname' */
|
||||
/* search apbus_dev named 'devname' */
|
||||
while (dp) {
|
||||
if (strcmp(devname,dp->apbd_name) == 0)
|
||||
return dp;
|
||||
@ -65,7 +65,7 @@ apbus_lookupdev(devname)
|
||||
dp = dp->apbd_link;
|
||||
}
|
||||
|
||||
return (struct apbus_device *)0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -77,7 +77,7 @@ apctl_dump(apctl)
|
||||
if (!apctl)
|
||||
return;
|
||||
|
||||
printf(" apbus_ctl dump (0x%08x)\n", (unsigned int)apctl);
|
||||
printf(" apbus_ctl dump (%p)\n", apctl);
|
||||
|
||||
p = (void *)apctl;
|
||||
|
||||
@ -93,21 +93,21 @@ apctl_dump(apctl)
|
||||
|
||||
void
|
||||
apdevice_dump(apdev)
|
||||
struct apbus_device *apdev;
|
||||
struct apbus_dev *apdev;
|
||||
{
|
||||
struct apbus_ctl *apctl;
|
||||
|
||||
if (!apdev)
|
||||
if (apdev == NULL)
|
||||
return;
|
||||
|
||||
/* only no pseudo device */
|
||||
apctl = apdev->apbd_ctl;
|
||||
if (!(int)apctl || !(int)apctl->apbc_hwbase)
|
||||
if (apctl == NULL || apctl->apbc_hwbase == 0)
|
||||
return;
|
||||
|
||||
printf("apbus_device dump (%p)\n", apdev);
|
||||
printf("name: %s\n", (char *)apdev->apbd_name);
|
||||
printf("vendor: %s\n", (char *)apdev->apbd_vendor);
|
||||
printf("apbus_dev dump (%p)\n", apdev);
|
||||
printf("name: %s\n", apdev->apbd_name);
|
||||
printf("vendor: %s\n", apdev->apbd_vendor);
|
||||
printf("atr: %08x\n", apdev->apbd_atr);
|
||||
printf("rev: %d\n", apdev->apbd_rev);
|
||||
printf("driver: 0x%08x\n", (unsigned int)apdev->apbd_driver);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apbusvar.h,v 1.1 1999/12/22 05:55:24 tsubai Exp $ */
|
||||
/* $NetBSD: apbusvar.h,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
@ -39,9 +39,9 @@ struct apbus_attach_args {
|
||||
u_long apa_hwbase; /* hardware I/O address */
|
||||
};
|
||||
|
||||
void *apbus_device_to_hwaddr __P((struct apbus_device *));
|
||||
struct apbus_device *apbus_lookupdev __P((char *));
|
||||
void apdevice_dump __P((struct apbus_device *));
|
||||
void *apbus_device_to_hwaddr __P((struct apbus_dev *));
|
||||
struct apbus_dev *apbus_lookupdev __P((char *));
|
||||
void apdevice_dump __P((struct apbus_dev *));
|
||||
void apbus_intr_init __P((void));
|
||||
int apbus_intr_call __P((int, int));
|
||||
void *apbus_intr_establish __P((int, int, int, void (*)(void *), void *,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: clock_ap.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $ */
|
||||
/* $NetBSD: clock_ap.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
|
||||
@ -93,14 +93,7 @@ void
|
||||
clockinit(dev)
|
||||
struct device *dev;
|
||||
{
|
||||
#if 1
|
||||
/* use timer0 */
|
||||
*(volatile u_int *)NEWS5000_INTMASK2 = NEWS5000_INT2_TIMER0;
|
||||
#else
|
||||
/* use timer1 */
|
||||
*(volatile u_int *)NEWS5000_TIMER1_PERIOD = 5000 / CLOCK_RATE - 1;
|
||||
*(volatile u_int *)NEWS5000_INTMASK2 = NEWS5000_INT2_TIMER1;
|
||||
#endif
|
||||
*(volatile u_int *)NEWS5000_INTEN2 = NEWS5000_INT2_TIMER0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_sn_ap.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $ */
|
||||
/* $NetBSD: if_sn_ap.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Allen Briggs
|
||||
@ -139,34 +139,7 @@ sn_ap_getaddr(sc, lladdr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define APSONIC_REG 0x00
|
||||
#define APSONIC_NREGS 0x10
|
||||
|
||||
#define APSONIC_ENDIAN 0x80000000 /* Endian Display bit */
|
||||
#define APSONIC_RDERR 0x00020000 /* DMA Error occur in RDMAC */
|
||||
#define APSONIC_TDERR 0x00010000 /* DMA Error occur in TDMAC */
|
||||
#define APSONIC_RDMACEN 0x00004000 /* RDMAC done Interrupt enable */
|
||||
#define APSONIC_TDMACEN 0x00002000 /* TDMAC done Interrupt enable */
|
||||
#define APSONIC_DERREN 0x00001000 /* DMA Error Interrupt enable */
|
||||
#define APSONIC_CH3_INTEN 0x00000800 /* Channel 3 Interrupt enable */
|
||||
#define APSONIC_CH2_INTEN 0x00000400 /* Channel 2 Interrupt enable */
|
||||
#define APSONIC_CH1_INTEN 0x00000200 /* Channel 1 Interrupt enable */
|
||||
#define APSONIC_CH0_INTEN 0x00000100 /* Channel 0 Interrupt enable */
|
||||
#define APSONIC_RDMAC 0x00000040 /* RDMAC done Interrupt */
|
||||
#define APSONIC_TDMAC 0x00000020 /* TDMAC done Interrupt */
|
||||
#define APSONIC_DERR 0x00000010 /* DMA Error Interrupt */
|
||||
#define APSONIC_CH3_INT 0x00000008 /* Channel 3 Interrupt */
|
||||
#define APSONIC_CH2_INT 0x00000004 /* Channel 2 Interrupt */
|
||||
#define APSONIC_CH1_INT 0x00000002 /* Channel 1 Interrupt */
|
||||
#define APSONIC_CH0_INT 0x00000001 /* Channel 0 Interrupt */
|
||||
|
||||
#define APSONIC_INT_MASK (APSONIC_CH0_INTEN | \
|
||||
APSONIC_CH1_INTEN | \
|
||||
APSONIC_CH2_INTEN | \
|
||||
APSONIC_CH3_INTEN | \
|
||||
APSONIC_RDMACEN | \
|
||||
APSONIC_TDMACEN | \
|
||||
APSONIC_DERREN)
|
||||
#define APSONIC_INT_MASK 0x00007f00 /* XXX */
|
||||
|
||||
void
|
||||
sn_md_init(sc)
|
||||
@ -174,7 +147,7 @@ sn_md_init(sc)
|
||||
{
|
||||
u_int *reg = (u_int *)(sc->sc_hwbase - 0x00100000);
|
||||
|
||||
reg[APSONIC_REG] = APSONIC_INT_MASK;
|
||||
*reg = APSONIC_INT_MASK;
|
||||
wbflush();
|
||||
apbus_wbflush();
|
||||
delay(10000);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: zs_ap.c,v 1.1 1999/12/22 05:55:25 tsubai Exp $ */
|
||||
/* $NetBSD: zs_ap.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -67,22 +67,29 @@
|
||||
#define NZS 2
|
||||
#endif
|
||||
|
||||
#define MODE_REGISTER (-0x00080000)
|
||||
#define FIFO_CH0 0x00000000
|
||||
#define FIFO_CH1 0x00010000
|
||||
#define FIFO_CH2 0x00020000
|
||||
#define FIFO_CH3 0x00030000
|
||||
#define FIFO_DEVWIN0 0x00040000
|
||||
#define FIFO_DEVWIN1 0x00050000
|
||||
#define FIFO_DEVWIN2 0x00060000
|
||||
#define FIFO_DEVWIN3 0x00070000
|
||||
|
||||
#define PORTB_XPORT FIFO_CH0
|
||||
#define PORTB_RPORT FIFO_CH1
|
||||
#define PORTA_XPORT FIFO_CH2
|
||||
#define PORTA_RPORT FIFO_CH3
|
||||
#define PORTB_OFFSET FIFO_DEVWIN0
|
||||
#define PORTA_OFFSET FIFO_DEVWIN1
|
||||
#define PORTB_XPORT 0x00000000
|
||||
#define PORTB_RPORT 0x00010000
|
||||
#define PORTA_XPORT 0x00020000
|
||||
#define PORTA_RPORT 0x00030000
|
||||
#define DMA_MODE_REG 3
|
||||
#define DMA_ENABLE 0x01 /* DMA enable */
|
||||
#define DMA_DIR_DM 0x00 /* device to memory */
|
||||
#define DMA_DIR_MD 0x02 /* memory to device */
|
||||
#define DMA_EXTRDY 0x08 /* DMA external ready */
|
||||
#define PORTB_OFFSET 0x00040000
|
||||
#define PORTA_OFFSET 0x00050000
|
||||
#define PORT_CTL 2
|
||||
#define PORTCTL_RI 0x01
|
||||
#define PORTCTL_DSR 0x02
|
||||
#define PORTCTL_DTR 0x04
|
||||
#define PORT_SEL 3
|
||||
#define PORTSEL_LOCALTALK 0x01
|
||||
#define PORTSEL_RS232C 0x02
|
||||
#define ESCC_REG 0x00060000
|
||||
#define ESCCREG_INTSTAT 0
|
||||
#define INTSTAT_SCC 0x01
|
||||
#define ESCCREG_INTMASK 1
|
||||
#define INTMASK_SCC 0x01
|
||||
|
||||
extern int zs_def_cflag;
|
||||
extern void (*zs_delay) __P((void));
|
||||
@ -213,13 +220,13 @@ zs_ap_attach(parent, self, aux)
|
||||
volatile struct zschan *zc;
|
||||
struct zs_chanstate *cs;
|
||||
int s, zs_unit, channel;
|
||||
volatile u_int *txBfifo = (void *)(apa->apa_hwbase + FIFO_CH0);
|
||||
volatile u_int *rxBfifo = (void *)(apa->apa_hwbase + FIFO_CH1);
|
||||
volatile u_int *txAfifo = (void *)(apa->apa_hwbase + FIFO_CH2);
|
||||
volatile u_int *rxAfifo = (void *)(apa->apa_hwbase + FIFO_CH3);
|
||||
volatile u_int *devwin0 = (void *)(apa->apa_hwbase + FIFO_DEVWIN0);
|
||||
volatile u_int *devwin1 = (void *)(apa->apa_hwbase + FIFO_DEVWIN1);
|
||||
volatile u_int *devwin2 = (void *)(apa->apa_hwbase + FIFO_DEVWIN2);
|
||||
volatile u_int *txBfifo = (void *)(apa->apa_hwbase + PORTB_XPORT);
|
||||
volatile u_int *rxBfifo = (void *)(apa->apa_hwbase + PORTB_RPORT);
|
||||
volatile u_int *txAfifo = (void *)(apa->apa_hwbase + PORTA_XPORT);
|
||||
volatile u_int *rxAfifo = (void *)(apa->apa_hwbase + PORTA_RPORT);
|
||||
volatile u_int *portBctl = (void *)(apa->apa_hwbase + PORTB_OFFSET);
|
||||
volatile u_int *portActl = (void *)(apa->apa_hwbase + PORTA_OFFSET);
|
||||
volatile u_int *esccregs = (void *)(apa->apa_hwbase + ESCC_REG);
|
||||
static int didintr;
|
||||
|
||||
zs_unit = zsc->zsc_dev.dv_unit;
|
||||
@ -227,18 +234,17 @@ zs_ap_attach(parent, self, aux)
|
||||
|
||||
printf(" slot%d addr 0x%lx\n", apa->apa_slotno, apa->apa_hwbase);
|
||||
|
||||
/* enable DMA external ready */
|
||||
txAfifo[3] = rxAfifo[3] = 8;
|
||||
txBfifo[3] = rxBfifo[3] = 8;
|
||||
txAfifo[DMA_MODE_REG] = rxAfifo[DMA_MODE_REG] = DMA_EXTRDY;
|
||||
txBfifo[DMA_MODE_REG] = rxBfifo[DMA_MODE_REG] = DMA_EXTRDY;
|
||||
|
||||
/* assert DTR */ /* XXX */
|
||||
devwin0[2] = devwin1[2] = 0x04;
|
||||
portBctl[PORT_CTL] = portActl[PORT_CTL] = PORTCTL_DTR;
|
||||
|
||||
/* select RS-232C (ch1 only) */
|
||||
devwin1[3] = 0x02;
|
||||
portActl[PORT_SEL] = PORTSEL_RS232C;
|
||||
|
||||
/* enable SCC interrupts */
|
||||
devwin2[1] = 0x01;
|
||||
esccregs[ESCCREG_INTMASK] = INTMASK_SCC;
|
||||
|
||||
zs_delay = zs_ap_delay;
|
||||
|
||||
@ -309,7 +315,7 @@ zs_ap_attach(parent, self, aux)
|
||||
didintr = 1;
|
||||
|
||||
apbus_intr_establish(1, /* interrupt level ( 0 or 1 ) */
|
||||
NEWS5000_INT1_SERIAL,
|
||||
NEWS5000_INT1_SCC,
|
||||
0, /* priority */
|
||||
zshard, zsc,
|
||||
apa->apa_name, apa->apa_ctlnum);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adrsmap.h,v 1.3 1999/12/22 05:55:26 tsubai Exp $ */
|
||||
/* $NetBSD: adrsmap.h,v 1.4 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -221,13 +221,9 @@
|
||||
#define NEWS5000_IDROM 0xbf3c0000
|
||||
|
||||
#define NEWS5000_TIMER0 0xbf800000
|
||||
#define NEWS5000_TIMER1 0xbf800004
|
||||
#define NEWS5000_TIMER1_PERIOD 0xbf80000c
|
||||
#define NEWS5000_TIMER_COUNTER 0xbf840000
|
||||
#define NEWS5000_TIMER_LOAD 0xbf840004
|
||||
#define NEWS5000_NVRAM 0xbf880000
|
||||
#define NEWS5000_NVRAM_SIZE 0x07f8
|
||||
#define NEWS5000_RTC_ADDR 0xbf881fe0
|
||||
#define NEWS5000_RTC_PORT 0xbf881fe0
|
||||
|
||||
#define NEWS5000_INTCLR0 0xbf4e0000
|
||||
#define NEWS5000_INTCLR1 0xbf4e0004
|
||||
@ -235,137 +231,58 @@
|
||||
#define NEWS5000_INTCLR3 0xbf4e000c
|
||||
#define NEWS5000_INTCLR4 0xbf4e0010
|
||||
#define NEWS5000_INTCLR5 0xbf4e0014
|
||||
#define NEWS5000_INTCLRNMI 0xbf4e0018
|
||||
|
||||
#define NEWS5000_INTMASK0 0xbfa00000
|
||||
#define NEWS5000_INTMASK1 0xbfa00004
|
||||
#define NEWS5000_INTMASK2 0xbfa00008
|
||||
#define NEWS5000_INTMASK3 0xbfa0000c
|
||||
#define NEWS5000_INTMASK4 0xbfa00010
|
||||
#define NEWS5000_INTMASK5 0xbfa00014
|
||||
#define NEWS5000_INTMASKNMI 0xbfa00018
|
||||
|
||||
#define NEWS5000_INTSTAT0 0xbfa00020
|
||||
#define NEWS5000_INTSTAT1 0xbfa00024
|
||||
#define NEWS5000_INTSTAT2 0xbfa00028
|
||||
#define NEWS5000_INTSTAT3 0xbfa0002c
|
||||
#define NEWS5000_INTSTAT4 0xbfa00030
|
||||
#define NEWS5000_INTSTAT5 0xbfa00034
|
||||
#define NEWS5000_INTSTATNMI 0xbfa00038
|
||||
|
||||
#define NEWS5000_INTSLOT0 0x00000100
|
||||
#define NEWS5000_INTSLOT1 0x00000200
|
||||
#define NEWS5000_INTSLOT2 0x00000400
|
||||
#define NEWS5000_INTSLOT3 0x00000800
|
||||
#define NEWS5000_INTSLOT4 0x00001000
|
||||
#define NEWS5000_INTSLOT5 0x00002000
|
||||
#define NEWS5000_INTSLOT_ALL 0x00003f00
|
||||
#define NEWS5000_INTEN0 0xbfa00000
|
||||
#define NEWS5000_INTEN1 0xbfa00004
|
||||
#define NEWS5000_INTEN2 0xbfa00008
|
||||
#define NEWS5000_INTEN3 0xbfa0000c
|
||||
#define NEWS5000_INTEN4 0xbfa00010
|
||||
#define NEWS5000_INTEN5 0xbfa00014
|
||||
|
||||
#define NEWS5000_INTST0 0xbfa00020
|
||||
#define NEWS5000_INTST1 0xbfa00024
|
||||
#define NEWS5000_INTST2 0xbfa00028
|
||||
#define NEWS5000_INTST3 0xbfa0002c
|
||||
#define NEWS5000_INTST4 0xbfa00030
|
||||
#define NEWS5000_INTST5 0xbfa00034
|
||||
|
||||
/*
|
||||
* level0 intr (INTMASK0/INTSTAT0)
|
||||
*/
|
||||
#define NEWS5000_INT0_DMAC 0x0001
|
||||
#define NEWS5000_INT0_SONIC 0x0002
|
||||
#define NEWS5000_INT0_FIFO0 0x0004
|
||||
#define NEWS5000_INT0_FIFO1 0x0008
|
||||
#define NEWS5000_INT0_FDC 0x0010
|
||||
#define NEWS5000_INT0_ALL (NEWS5000_INT0_DMAC|NEWS5000_INT0_SONIC|NEWS5000_INT0_FIFO0|NEWS5000_INT0_FIFO1|NEWS5000_INT0_FDC)
|
||||
#define NEWS5000_INT0_DMAC 0x01
|
||||
#define NEWS5000_INT0_SONIC 0x02
|
||||
#define NEWS5000_INT0_FDC 0x10
|
||||
|
||||
/*
|
||||
* level1 intr (INTMASK1/INTSTAT1)
|
||||
*/
|
||||
#define NEWS5000_INT1_KBD 0x0001
|
||||
#define NEWS5000_INT1_SERIAL 0x0002
|
||||
#define NEWS5000_INT1_AUDIO0 0x0004
|
||||
#define NEWS5000_INT1_AUDIO1 0x0008
|
||||
#define NEWS5000_INT1_PARALLEL 0x0020
|
||||
#define NEWS5000_INT1_FB 0x0080
|
||||
#define NEWS5000_INT1_ALL (NEWS5000_INT1_KBD|NEWS5000_INT1_SERIAL|NEWS5000_INT1_AUDIO0|NEWS5000_INT1_AUDIO1|NEWS5000_INT1_PARALLEL|NEWS5000_INT1_FB)
|
||||
#define NEWS5000_INT1_KBD 0x01
|
||||
#define NEWS5000_INT1_SCC 0x02
|
||||
#define NEWS5000_INT1_AUDIO0 0x04
|
||||
#define NEWS5000_INT1_AUDIO1 0x08
|
||||
#define NEWS5000_INT1_PARALLEL 0x20
|
||||
#define NEWS5000_INT1_FB 0x80
|
||||
|
||||
/*
|
||||
* level2 intr (INTMASK2/INTSTAT2)
|
||||
*/
|
||||
#define NEWS5000_INT2_TIMER0 0x0001
|
||||
#define NEWS5000_INT2_TIMER1 0x0002
|
||||
#define NEWS5000_INT2_ALL (NEWS5000_INT2_TIMER0|NEWS5000_INT2_TIMER1)
|
||||
#define NEWS5000_INT2_TIMER0 0x01
|
||||
#define NEWS5000_INT2_TIMER1 0x02
|
||||
|
||||
/*
|
||||
* level4 intr (INTMASK4/INTSTAT4)
|
||||
*/
|
||||
#define NEWS5000_INT4_ABIF 0x0001
|
||||
#define NEWS5000_INT4_WBERR NEWS5000_INT4_ABIF
|
||||
#define NEWS5000_INT4_MFBIF 0x0002
|
||||
#define NEWS5000_INT4_SBIF 0x0004
|
||||
#define NEWS5000_INT4_ALL (NEWS5000_INT4_ABIF|NEWS5000_INT4_MFBIF|NEWS5000_INT4_SBIF)
|
||||
#define NEWS5000_WBFLUSH 0xbf520004
|
||||
|
||||
/*
|
||||
* level5 intr (INTMASK5/INTSTAT5)
|
||||
*/
|
||||
#define NEWS5000_INT5_ABIF 0x0001
|
||||
#define NEWS5000_INT5_MBIF 0x0002
|
||||
#define NEWS5000_INT5_SBIF 0x0004
|
||||
#define NEWS5000_INT5_POWER 0x0008
|
||||
#define NEWS5000_INT5_TEMP 0x0010
|
||||
#define NEWS5000_INT5_ABORT 0x0020
|
||||
#define NEWS5000_INT5_EXTSENSE NEWS5000_INT5_ABORT
|
||||
#define NEWS5000_INT5_ALL (NEWS5000_INT5_ABIF|NEWS5000_INT5_MBIF|NEWS5000_INT5_SBIF|NEWS5000_INT5_POWER|NEWS5000_INT5_TEMP|NEWS5000_INT5_ABORT)
|
||||
#define NEWS5000_LED_POWER 0xbf3f0000
|
||||
#define NEWS5000_LED_DISK 0xbf3f0004
|
||||
#define NEWS5000_LED_FLOPPY 0xbf3f0008
|
||||
#define NEWS5000_LED_SEC 0xbf3f000c
|
||||
#define NEWS5000_LED_NET 0xbf3f0010
|
||||
#define NEWS5000_LED_CD 0xbf3f0014
|
||||
|
||||
/*
|
||||
* NMI intr (INTMASKNMI/INTSTATNMI)
|
||||
*/
|
||||
#define NEWS5000_INTNMI_ABORT 0x0001
|
||||
#define NEWS5000_INTNMI_ALL (NEWS5000_INTNMI_ABORT)
|
||||
#define NEWS5000_APBUS_INTMSK 0xb4c0000c
|
||||
#define NEWS5000_APBUS_INTST 0xb4c00014
|
||||
#define NEWS5000_APBUS_CTRL 0xb4c00034
|
||||
#define NEWS5000_APBUS_DMA 0xb4c00084
|
||||
|
||||
|
||||
#define NEWS5000_WB 0xbf520004 /* I/O write buffer control */
|
||||
|
||||
|
||||
|
||||
#define NEWS5000_LED0 0xbf3f0000 /* POWER LED */
|
||||
#define NEWS5000_LED1 0xbf3f0004 /* DISK LED */
|
||||
#define NEWS5000_LED2 0xbf3f0008 /* FLOPPY LED */
|
||||
#define NEWS5000_LED3 0xbf3f000c /* SECURITY LED */
|
||||
#define NEWS5000_LED4 0xbf3f0010 /* NETWORK LED */
|
||||
#define NEWS5000_LED5 0xbf3f0014 /* CDROM LED */
|
||||
|
||||
|
||||
|
||||
#define NEWS5000_APBUS_INTMASK 0xb4c0000c
|
||||
#define NEWS5000_APBUS_INTSTAT 0xb4c00014
|
||||
#define NEWS5000_APBUS_CONFIG 0xb4c00034
|
||||
#define NEWS5000_APBUS_DUMCOH 0xb4c00084
|
||||
#define NEWS5000_APBUS_DEVICE_DMAC3 0x80000000 /* DMAC3 */
|
||||
#define NEWS5000_APBUS_DEVICE_SONIC 0x40000000 /* SONIC */
|
||||
#define NEWS5000_APBUS_DEVICE_SLOT6 0x00000020 /* slot #6 */
|
||||
#define NEWS5000_APBUS_DEVICE_SLOT5 0x00000010 /* slot #5 */
|
||||
#define NEWS5000_APBUS_DEVICE_SLOT4 0x00000008 /* slot #4 */
|
||||
#define NEWS5000_APBUS_DEVICE_SLOT3 0x00000004 /* slot #3 */
|
||||
#define NEWS5000_APBUS_DEVICE_SLOT2 0x00000002 /* slot #2 */
|
||||
#define NEWS5000_APBUS_DEVICE_SLOT1 0x00000001 /* slot #1 */
|
||||
#define NEWS5000_APBUS_DEVICE_ALLSLOT 0x0000003f /* slot #1-#6 */
|
||||
|
||||
|
||||
|
||||
#define NEWS5000_INTAPBUS_DMADOUBLE 0x8000 /* DMA double error */
|
||||
#define NEWS5000_INTAPBUS_DMAPARITY 0x0200 /* DMA parity error */
|
||||
#define NEWS5000_INTAPBUS_DMAADDRESS 0x0100 /* DMA address error */
|
||||
#define NEWS5000_INTAPBUS_IODOUBLE 0x0080 /* I/O access double bus error */
|
||||
#define NEWS5000_INTAPBUS_IOPARITY 0x0010 /* I/O read parity error */
|
||||
#define NEWS5000_INTAPBUS_RDIOERR 0x0008 /* I/O read ioerr */
|
||||
#define NEWS5000_INTAPBUS_RDTIMEO 0x0004 /* I/O read time-out error */
|
||||
#define NEWS5000_INTAPBUS_WRIOERR 0x0002 /* I/O write ioerr */
|
||||
#define NEWS5000_INTAPBUS_WRTIMEO 0x0001 /* I/O write time-out error */
|
||||
#define NEWS5000_INTAPBUS_ALL (NEWS5000_INTAPBUS_DMADOUBLE|\
|
||||
NEWS5000_INTAPBUS_DMAPARITY|\
|
||||
NEWS5000_INTAPBUS_DMAADDRESS|\
|
||||
NEWS5000_INTAPBUS_IODOUBLE|\
|
||||
NEWS5000_INTAPBUS_IOPARITY|\
|
||||
NEWS5000_INTAPBUS_RDIOERR|\
|
||||
NEWS5000_INTAPBUS_RDTIMEO|\
|
||||
NEWS5000_INTAPBUS_WRIOERR|\
|
||||
NEWS5000_INTAPBUS_WRTIMEO)
|
||||
|
||||
#define NEWS5000_SCCPORT0A 0xbe950000
|
||||
#define NEWS5000_SCCPORT0A 0xbe950000
|
||||
|
||||
#endif /* !__MACHINE_ADRSMAP__ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apbus.h,v 1.1 1999/12/22 05:53:21 tsubai Exp $ */
|
||||
/* $NetBSD: apbus.h,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
@ -30,124 +30,60 @@
|
||||
#define __MACHINE_APBUS__
|
||||
|
||||
struct apbus_ctl {
|
||||
int apbc_ctlno;
|
||||
int apbc_mu;
|
||||
int apbc_unknown2;
|
||||
void *apbc_sladdr;
|
||||
u_int apbc_ctlno;
|
||||
u_int apbc_mu;
|
||||
u_int apbc_unknown2;
|
||||
void *apbc_sladdr;
|
||||
|
||||
int apbc_unknown4;
|
||||
int apbc_hwbase;
|
||||
char *apbc_softc;
|
||||
void *apbc_ent7;
|
||||
u_int apbc_unknown4;
|
||||
u_int apbc_hwbase;
|
||||
char *apbc_softc;
|
||||
u_int *apbc_ent7;
|
||||
|
||||
int apbc_unknown8;
|
||||
int apbc_sl;
|
||||
u_int apbc_unknown8;
|
||||
u_int apbc_sl;
|
||||
|
||||
struct apbus_ctl *apbc_slave0;
|
||||
int apbc_slave0no;
|
||||
int apbc_unknown12;
|
||||
int apbc_unknown13;
|
||||
struct apbus_ctl *apbc_child0;
|
||||
u_int apbc_child0no[3];
|
||||
|
||||
struct apbus_ctl *apbc_slave1;
|
||||
int apbc_slave1no;
|
||||
int apbc_unknown16;
|
||||
int apbc_unknown17;
|
||||
struct apbus_ctl *apbc_child1;
|
||||
u_int apbc_child1no[3];
|
||||
|
||||
struct apbus_ctl *apbc_slave2;
|
||||
int apbc_slave2no;
|
||||
int apbc_unknown20;
|
||||
int apbc_unknown21;
|
||||
struct apbus_ctl *apbc_child2;
|
||||
u_int apbc_child2no[3];
|
||||
|
||||
struct apbus_ctl *apbc_parent;
|
||||
int apbc_parentno;
|
||||
int apbc_unknown24;
|
||||
int apbc_unknown25;
|
||||
struct apbus_ctl *apbc_parent;
|
||||
u_int apbc_parentno[3];
|
||||
|
||||
struct apbus_ctl *apbc_link;
|
||||
int apbc_unknown27;
|
||||
int apbc_unknown28;
|
||||
int apbc_unknown29;
|
||||
int apbc_unknown30;
|
||||
int apbc_unknown31;
|
||||
struct apbus_ctl *apbc_link;
|
||||
};
|
||||
|
||||
struct apbus_device {
|
||||
char *apbd_name;
|
||||
char *apbd_vendor;
|
||||
unsigned int apbd_atr;
|
||||
#define APBD_CHAR 0x00000001
|
||||
#define APBD_STDIN 0x00000002
|
||||
#define APBD_STDOUT 0x00000004
|
||||
unsigned int apbd_rev;
|
||||
void* apbd_driver;
|
||||
struct {
|
||||
int (*func0)();
|
||||
int (*func1)();
|
||||
int (*func2)();
|
||||
int (*func3)();
|
||||
int (*func4)();
|
||||
int (*func5)();
|
||||
int (*func6)();
|
||||
int (*func7)();
|
||||
int (*func8)();
|
||||
int (*func9)();
|
||||
int (*func10)();
|
||||
int (*func11)();
|
||||
int (*func12)();
|
||||
int (*func13)();
|
||||
int (*func14)();
|
||||
int (*func15)();
|
||||
} apbd_call;
|
||||
struct apbus_ctl *apbd_ctl;
|
||||
struct apbus_device *apbd_link;
|
||||
unsigned int apbd_unknwon;
|
||||
};
|
||||
|
||||
struct apbus_bus {
|
||||
unsigned int apbb_no;
|
||||
void *apbb_unknown1;
|
||||
void *apbb_unknown2;
|
||||
void *apbb_unknown3;
|
||||
struct apbus_bus *apbb_link;
|
||||
unsigned int apbb_unknown5;
|
||||
unsigned int apbb_unknown6;
|
||||
unsigned int apbb_unknown7;
|
||||
unsigned int apbb_unknown8;
|
||||
};
|
||||
|
||||
struct apbus_vector {
|
||||
unsigned short state;
|
||||
unsigned short mask;
|
||||
unsigned int (*handler)();
|
||||
struct apbus_dev {
|
||||
char *apbd_name;
|
||||
char *apbd_vendor;
|
||||
u_int apbd_atr;
|
||||
u_int apbd_rev;
|
||||
void *apbd_driver;
|
||||
void *table[16];
|
||||
struct apbus_ctl *apbd_ctl;
|
||||
struct apbus_dev *apbd_link;
|
||||
};
|
||||
|
||||
struct apbus_sysinfo {
|
||||
int apbsi_revision;
|
||||
int (*apbsi_call)();
|
||||
unsigned int apbsi_error1;
|
||||
void * apbsi_progstart;
|
||||
int apbsi_revision;
|
||||
int (*apbsi_call)(); /* apcall entry */
|
||||
int apbsi_errno; /* errno from apcall? */
|
||||
void *apbsi_bootstart; /* entry of primary boot */
|
||||
void *apbsi_bootend;
|
||||
struct apbus_dev *apbsi_dev;
|
||||
struct apbus_bus *apbsi_bus;
|
||||
int apbsi_exterr; /* ? */
|
||||
|
||||
void * apbsi_progend;
|
||||
struct apbus_device *apbsi_dev;
|
||||
struct apbus_bus *apbsi_bus;
|
||||
unsigned int apbsi_error2;
|
||||
|
||||
unsigned int apbsi_basel;
|
||||
unsigned int apbsi_baseh;
|
||||
unsigned int apbsi_memsize;
|
||||
unsigned int apbsi_tmpsize;
|
||||
|
||||
unsigned int apbsi_freesize;
|
||||
unsigned char *apbsi_sram;
|
||||
void *apbsi_io;
|
||||
void *apbsi_alloc;
|
||||
|
||||
void *apbsi_cmdtable;
|
||||
unsigned int apbsi_none0;
|
||||
struct apbus_vector apbsi_vector[8];
|
||||
void (*apbsi_trap)();
|
||||
unsigned int apbsi_romversion;
|
||||
unsigned char apbsi_none1[112];
|
||||
int apbsi_pad1[2];
|
||||
int apbsi_memsize; /* memory size */
|
||||
int apbsi_pad2[24];
|
||||
int apbsi_romversion;
|
||||
int apbsi_pad3[28];
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apcall.h,v 1.1 1999/12/22 05:53:21 tsubai Exp $ */
|
||||
/* $NetBSD: apcall.h,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <machine/apbus.h>
|
||||
|
||||
#define APCALL (*(_sip->apbsi_call))
|
||||
#define APCALL (*(_sip->apbsi_call))
|
||||
|
||||
#define APCALL_EXIT 1
|
||||
#define APCALL_READ 3
|
||||
@ -40,45 +40,9 @@
|
||||
#define APCALL_CLOSE 6
|
||||
#define APCALL_LSEEK 19
|
||||
#define APCALL_IOCTL 54
|
||||
|
||||
#define APCALL_GETBASE 1001
|
||||
#define APCALL_BOOT 1002
|
||||
#define APCALL_BADADDR 1003
|
||||
#define APCALL_GETENV 1004
|
||||
#define APCALL_SETENV 1005
|
||||
#define APCALL_FLCACHE 1006
|
||||
#define APCALL_SLEEP 1007
|
||||
#define APCALL_USLEEP 1008
|
||||
#define APCALL_PHYSADDR 1009
|
||||
#define APCALL_MALLOC 1010
|
||||
#define APCALL_FREE 1011
|
||||
#define APCALL_NSECTIME 1012
|
||||
#define APCALL_IOMAP 1013
|
||||
#define APCALL_DMAMAP 1014
|
||||
#define APCALL_OPENBFS 1015
|
||||
#define APCALL_READBFS 1016
|
||||
#define APCALL_CLOSEBFS 1017
|
||||
|
||||
#define APCALL_PRINTF 1101
|
||||
#define APCALL_FPRINTF 1103
|
||||
#define APCALL_SPRINTF 1104
|
||||
#define APCALL_BCOPY 1105
|
||||
#define APCALL_BCMP 1106
|
||||
#define APCALL_BZERO 1107
|
||||
|
||||
#define APCALL_PANIC 2001
|
||||
#define APCALL_READDIPSW 2002
|
||||
#define APCALL_STRCPY 2003
|
||||
#define APCALL_STRCAT 2004
|
||||
#define APCALL_STRCMP 2005
|
||||
#define APCALL_STRLEN 2006
|
||||
#define APCALL_STRNCPY 2007
|
||||
#define APCALL_STRNCAT 2008
|
||||
#define APCALL_STRNCMP 2009
|
||||
#define APCALL_STRTOL 2010
|
||||
#define APCALL_LTOSTR 2011
|
||||
#define APCALL_EPRINTF 2012
|
||||
#define APCALL_FONTADDR 2013
|
||||
#define APCALL_FLUSHCACHE 1006
|
||||
#define APCALL_GETTIMEOFDAY 1012
|
||||
|
||||
#define APIOCGIFHWADDR 9200 /* get hardware address */
|
||||
|
||||
@ -89,41 +53,8 @@
|
||||
#define apcall_close(a) APCALL(APCALL_CLOSE,(a))
|
||||
#define apcall_lseek(a,b,c) APCALL(APCALL_LSEEK,(a),(b),(c))
|
||||
#define apcall_ioctl(a,b,c) APCALL(APCALL_IOCTL,(a),(b),(c))
|
||||
|
||||
#define apcall_getbase(a,b,c) APCALL(APCALL_GETBASE,(a),(b),(c))
|
||||
#define apcall_boot(a) APCALL(APCALL_BOOT,(a))
|
||||
#define apcall_badaddr(a,b) APCALL(APCALL_BADADDR,(a),(b))
|
||||
#define apcall_getenv(a) APCALL(APCALL_GETENV,(a))
|
||||
#define apcall_setenv(a,b) APCALL(APCALL_SETENV,(a),(b))
|
||||
#define apcall_flush_cache() APCALL(APCALL_FLCACHE)
|
||||
#define apcall_sleep(a) APCALL(APCALL_SLEEP,(a))
|
||||
#define apcall_usleep(a) APCALL(APCALL_USLEEP,(a))
|
||||
#define apcall_physaddr(a,b,c) APCALL(APCALL_PHYSADDR,(a),(b),(c))
|
||||
#define apcall_malloc(a) APCALL(APCALL_MALLOC,(a))
|
||||
#define apcall_free(a) APCALL(APCALL_FREE,(a))
|
||||
#define apcall_nsectime(a) APCALL(APCALL_NSECTIME,(a))
|
||||
#define apcall_iomap(a,b) APCALL(APCALL_IOMAP,(a),(b))
|
||||
#define apcall_dmamap(a,b) APCALL(APCALL_DMAMAP,(a),(b))
|
||||
#define apcall_openbfs(a,b) APCALL(APCALL_OPENBFS,(a),(b))
|
||||
#define apcall_readbfs(a,b) APCALL(APCALL_READBFS,(a),(b))
|
||||
#define apcall_closebfs() APCALL(APCALL_CLOSEBFS)
|
||||
|
||||
#define apcall_bcopy(a,b,c) APCALL(APCALL_BCOPY,(a),(b),(c))
|
||||
#define apcall_bcmp(a,b,c) APCALL(APCALL_BCMP,(a),(b),(c))
|
||||
#define apcall_bzero(a,b) APCALL(APCALL_BZERO,(a),(b))
|
||||
|
||||
#define apcall_panic(a,b) APCALL(APCALL_PANIC,(a),(b))
|
||||
#define apcall_readdipsw() APCALL(APCALL_READDIPSW)
|
||||
#define apcall_strcpy(a,b) APCALL(APCALL_STRCPY,(a),(b))
|
||||
#define apcall_strcat(a,b) APCALL(APCALL_STRCAT,(a),(b))
|
||||
#define apcall_strcmp(a,b) APCALL(APCALL_STRCMP,(a),(b))
|
||||
#define apcall_strlen(a) APCALL(APCALL_STRLEN,(a))
|
||||
#define apcall_strncpy(a,b,c) APCALL(APCALL_STRNCPY,(a),(b),(c))
|
||||
#define apcall_strncat(a,b,c) APCALL(APCALL_STRNCAT,(a),(b),(c))
|
||||
#define apcall_strncmp(a,b,c) APCALL(APCALL_STRNCMP,(a),(b),(c))
|
||||
#define apcall_getsx(a,b) APCALL(APCALL_GETSX,(a),(b))
|
||||
#define apcall_strtol(a,b,c) APCALL(APCALL_STRTOL,(a),(b),(c))
|
||||
#define apcall_ltostr(a,b,c) APCALL(APCALL_LTOSTR,(a),(b),(c))
|
||||
#define apcall_fontaddr(a,b) APCALL(APCALL_FONTADDR,(a),(b))
|
||||
#define apcall_flushcache() APCALL(APCALL_FLUSHCACHE)
|
||||
#define apcall_gettimeofday(a) APCALL(APCALL_GETTIMEOFDAY,(a))
|
||||
|
||||
#endif /* !__MACHINE_APCALL_H__ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: news5000.c,v 1.1 1999/12/22 05:53:21 tsubai Exp $ */
|
||||
/* $NetBSD: news5000.c,v 1.2 1999/12/23 06:52:31 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
@ -37,243 +37,155 @@
|
||||
#include <newsmips/apbus/apbusvar.h>
|
||||
#include <newsmips/newsmips/machid.h>
|
||||
|
||||
static void level5_interrupt __P((void));
|
||||
static void level4_interrupt __P((void));
|
||||
static void level3_interrupt __P((void));
|
||||
static void level2_interrupt __P((unsigned int, unsigned int));
|
||||
static void level1_interrupt __P((void));
|
||||
static void level0_interrupt __P((void));
|
||||
|
||||
static void abif_error4 __P((void));
|
||||
static void level1_intr __P((void));
|
||||
static void level0_intr __P((void));
|
||||
|
||||
/*
|
||||
* Handle news5000 interrupts.
|
||||
*/
|
||||
int
|
||||
news5000_intr(mask, pc, statusReg, causeReg)
|
||||
news5000_intr(mask, pc, status, cause)
|
||||
u_int mask;
|
||||
u_int pc; /* program counter where to continue */
|
||||
u_int statusReg; /* status register at time of the exception */
|
||||
u_int causeReg; /* cause register at time of exception */
|
||||
u_int pc; /* program counter where to continue */
|
||||
u_int status; /* status register at time of the exception */
|
||||
u_int cause; /* cause register at time of exception */
|
||||
{
|
||||
if (mask & MIPS_INT_MASK_2) {
|
||||
level2_interrupt(pc,statusReg);
|
||||
#ifdef DEBUG
|
||||
static int l2cnt = 0;
|
||||
#endif
|
||||
u_int int2stat;
|
||||
struct clockframe cf;
|
||||
|
||||
int2stat = *(volatile u_int *)NEWS5000_INTST2;
|
||||
|
||||
#ifdef DEBUG
|
||||
l2cnt++;
|
||||
if (l2cnt == 50) {
|
||||
*(volatile u_int *)NEWS5000_LED_SEC = 1;
|
||||
}
|
||||
if (l2cnt == 100) {
|
||||
*(volatile u_int *)NEWS5000_LED_SEC = 0;
|
||||
l2cnt = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (int2stat & NEWS5000_INT2_TIMER0) {
|
||||
*(volatile u_int *)NEWS5000_TIMER0 = 1;
|
||||
|
||||
cf.pc = pc;
|
||||
cf.sr = status;
|
||||
|
||||
hardclock(&cf);
|
||||
intrcnt[HARDCLOCK_INTR]++;
|
||||
}
|
||||
|
||||
apbus_wbflush();
|
||||
causeReg &= ~MIPS_INT_MASK_2;
|
||||
cause &= ~MIPS_INT_MASK_2;
|
||||
}
|
||||
/* If clock interrupts were enabled, re-enable them ASAP. */
|
||||
splx(MIPS_SR_INT_IE | (statusReg & MIPS_INT_MASK_2));
|
||||
splx(MIPS_SR_INT_IE | (status & MIPS_INT_MASK_2));
|
||||
|
||||
if (mask & MIPS_INT_MASK_5) {
|
||||
level5_interrupt();
|
||||
u_int int5stat = *(volatile u_int *)NEWS5000_INTST5;
|
||||
printf("level5 interrupt (%08x)\n", int5stat);
|
||||
|
||||
apbus_wbflush();
|
||||
causeReg &= ~MIPS_INT_MASK_5;
|
||||
cause &= ~MIPS_INT_MASK_5;
|
||||
}
|
||||
|
||||
if (mask & MIPS_INT_MASK_4) {
|
||||
level4_interrupt();
|
||||
u_int int4stat = *(volatile u_int *)NEWS5000_INTST4;
|
||||
printf("level4 interrupt (%08x)\n", int4stat);
|
||||
|
||||
apbus_wbflush();
|
||||
causeReg &= ~MIPS_INT_MASK_4;
|
||||
cause &= ~MIPS_INT_MASK_4;
|
||||
}
|
||||
|
||||
if (mask & MIPS_INT_MASK_3) {
|
||||
level3_interrupt();
|
||||
u_int int3stat = *(volatile u_int *)NEWS5000_INTST3;
|
||||
printf("level3 interrupt (%08x)\n", int3stat);
|
||||
|
||||
apbus_wbflush();
|
||||
causeReg &= ~MIPS_INT_MASK_3;
|
||||
cause &= ~MIPS_INT_MASK_3;
|
||||
}
|
||||
|
||||
if (mask & MIPS_INT_MASK_1) {
|
||||
level1_interrupt();
|
||||
level1_intr();
|
||||
apbus_wbflush();
|
||||
causeReg &= ~MIPS_INT_MASK_1;
|
||||
cause &= ~MIPS_INT_MASK_1;
|
||||
}
|
||||
|
||||
if (mask & MIPS_INT_MASK_0) {
|
||||
level0_interrupt();
|
||||
level0_intr();
|
||||
apbus_wbflush();
|
||||
causeReg &= ~MIPS_INT_MASK_0;
|
||||
cause &= ~MIPS_INT_MASK_0;
|
||||
}
|
||||
|
||||
return ((statusReg & ~causeReg & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
|
||||
return (status & ~cause & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
level5_interrupt()
|
||||
level1_intr()
|
||||
{
|
||||
printf("level5 interrupt\n");
|
||||
}
|
||||
u_int int1stat;
|
||||
|
||||
void
|
||||
level4_interrupt()
|
||||
{
|
||||
volatile int *intenp = (volatile int *)NEWS5000_INTMASK4;
|
||||
int int4stat, saved_inten;
|
||||
|
||||
int4stat = *(volatile int *)NEWS5000_INTSTAT4;
|
||||
saved_inten = *intenp;
|
||||
*intenp = 0;
|
||||
if (int4stat & NEWS5000_INT4_SBIF) {
|
||||
printf("SBIF ERROR\n");
|
||||
/* sbif_error4(); */
|
||||
} else if (int4stat & NEWS5000_INT4_MFBIF) {
|
||||
printf("MBIF ERROR\n");
|
||||
/*
|
||||
mbif_error4();
|
||||
if (fxif_error4)
|
||||
fxif_error4();
|
||||
*/
|
||||
} else if (int4stat & NEWS5000_INT4_ABIF) {
|
||||
/* printf("ABIF ERROR\n"); */
|
||||
abif_error4();
|
||||
}
|
||||
*intenp = saved_inten;
|
||||
}
|
||||
|
||||
static void
|
||||
abif_error4()
|
||||
{
|
||||
#define AB_BERRADR 0xb4c00018
|
||||
#define AB_BERRDATA 0xb4c00020
|
||||
#define AB_BERRPARITY 0xb4c00028
|
||||
|
||||
int stat;
|
||||
|
||||
printf("abif_error4\n");
|
||||
|
||||
stat = *(volatile u_int *)NEWS5000_APBUS_INTSTAT &
|
||||
*(volatile u_int *)NEWS5000_APBUS_INTMASK;
|
||||
|
||||
if (stat & NEWS5000_INTAPBUS_DMAADDRESS) {
|
||||
printf("AB I/F: DMA address error\n");
|
||||
}
|
||||
if (stat & (NEWS5000_INTAPBUS_RDTIMEO|NEWS5000_INTAPBUS_WRTIMEO)) {
|
||||
if (stat & NEWS5000_INTAPBUS_RDTIMEO)
|
||||
printf("AB I/F: read timeout\n");
|
||||
if (stat & NEWS5000_INTAPBUS_WRTIMEO)
|
||||
printf("AB I/F: write timeout\n");
|
||||
|
||||
printf(" address = %x:%x\n",
|
||||
*(volatile u_int *)AB_BERRADR, *(volatile u_int *)(AB_BERRADR + 4));
|
||||
}
|
||||
*(volatile u_int *)NEWS5000_APBUS_INTSTAT = stat;
|
||||
}
|
||||
|
||||
void
|
||||
level3_interrupt()
|
||||
{
|
||||
printf("level3 interrupt\n");
|
||||
}
|
||||
|
||||
void
|
||||
level2_interrupt(pc, statusReg)
|
||||
unsigned int pc;
|
||||
unsigned int statusReg;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
static int l2cnt = 0;
|
||||
#endif
|
||||
unsigned int int2stat;
|
||||
struct clockframe cf;
|
||||
|
||||
int2stat = *(volatile unsigned int *)NEWS5000_INTSTAT2;
|
||||
|
||||
#ifdef DEBUG
|
||||
l2cnt++;
|
||||
if (l2cnt == 50) {
|
||||
*(volatile unsigned int *)NEWS5000_LED3 = 1;
|
||||
}
|
||||
if (l2cnt == 100) {
|
||||
*(volatile unsigned int *)NEWS5000_LED3 = 0;
|
||||
l2cnt = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (int2stat & NEWS5000_INT2_TIMER0) {
|
||||
*(volatile unsigned int *)NEWS5000_TIMER0 = 1;
|
||||
|
||||
cf.pc = pc;
|
||||
cf.sr = statusReg;
|
||||
|
||||
hardclock(&cf);
|
||||
intrcnt[HARDCLOCK_INTR]++;
|
||||
}
|
||||
|
||||
if (int2stat & NEWS5000_INT2_TIMER1) {
|
||||
*(volatile unsigned int *)NEWS5000_TIMER1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
level1_interrupt()
|
||||
{
|
||||
unsigned int int1stat;
|
||||
int nintcall;
|
||||
|
||||
int1stat = *(volatile unsigned int *)NEWS5000_INTSTAT1;
|
||||
int1stat = *(volatile u_int *)NEWS5000_INTST1;
|
||||
|
||||
if (int1stat) {
|
||||
/* printf("level1 interrupt (%08x)\n", int1stat); */
|
||||
nintcall = apbus_intr_call(1,int1stat);
|
||||
|
||||
if (!nintcall) {
|
||||
printf("level1_interrupt: no match interrupt mask! %04x\n",int1stat);
|
||||
}
|
||||
} else {
|
||||
if (apbus_intr_call(1, int1stat) == 0)
|
||||
printf("level1_intr: no andler (mask 0x%04x)\n",
|
||||
int1stat);
|
||||
} else
|
||||
printf("level1 stray interrupt?\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
level0_interrupt()
|
||||
level0_intr()
|
||||
{
|
||||
unsigned int int0stat;
|
||||
int nintcall;
|
||||
u_int int0stat;
|
||||
|
||||
int0stat = *(volatile unsigned int *)NEWS5000_INTSTAT0;
|
||||
int0stat = *(volatile u_int *)NEWS5000_INTST0;
|
||||
|
||||
if (int0stat) {
|
||||
/* printf("level0 interrupt (%08x)\n", int0stat); */
|
||||
nintcall = apbus_intr_call(0, int0stat);
|
||||
|
||||
if (!nintcall) {
|
||||
printf("level0_interrupt: no match interrupt mask! %04x\n",int0stat);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (apbus_intr_call(0, int0stat) == 0)
|
||||
printf("level0_intr: no handler (mask 0x%04x)\n",
|
||||
int0stat);
|
||||
} else
|
||||
printf("level0 stray interrupt?\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
enable_intr_5000()
|
||||
{
|
||||
/* APbus Interrupt (DMAC, SONIC, FIFO*, FDC) */
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK0 =
|
||||
NEWS5000_INTSLOT_ALL|NEWS5000_INT0_ALL;
|
||||
volatile u_int *inten0 = (void *)NEWS5000_INTEN0;
|
||||
volatile u_int *inten1 = (void *)NEWS5000_INTEN1;
|
||||
|
||||
/* APbus Interrupt (KBD, SERIAL, AUDIO*, PARALLEL, FB */
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK1 =
|
||||
NEWS5000_INTSLOT_ALL|NEWS5000_INT1_ALL;
|
||||
*inten0 = NEWS5000_INT0_DMAC | NEWS5000_INT0_SONIC |
|
||||
NEWS5000_INT0_FDC;
|
||||
*inten1 = NEWS5000_INT1_KBD | NEWS5000_INT1_SCC |
|
||||
NEWS5000_INT1_AUDIO0 | NEWS5000_INT1_AUDIO1 |
|
||||
NEWS5000_INT1_PARALLEL | NEWS5000_INT1_FB;
|
||||
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK4 =
|
||||
NEWS5000_INT4_ALL;
|
||||
/* It's not a time to enable timer yet. */
|
||||
/* *(volatile u_int *)NEWS5000_INTEN2 = 0; */
|
||||
|
||||
*(volatile unsigned int *)NEWS5000_INTCLR5 = 0xffffffff;
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK5 =
|
||||
NEWS5000_INT5_ABIF|NEWS5000_INT5_MBIF|NEWS5000_INT5_SBIF;
|
||||
/* currently INT3-INT5 are not used */
|
||||
*(volatile u_int *)NEWS5000_INTEN3 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN4 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN5 = 0;
|
||||
}
|
||||
|
||||
void
|
||||
disable_intr_5000()
|
||||
{
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK0 = 0;
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK1 = 0;
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK2 = 0;
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK3 = 0;
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK4 = 0;
|
||||
*(volatile unsigned int *)NEWS5000_INTMASK5 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN0 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN1 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN2 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN3 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN4 = 0;
|
||||
*(volatile u_int *)NEWS5000_INTEN5 = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: boot.c,v 1.3 1999/12/22 05:54:41 tsubai Exp $ */
|
||||
/* $NetBSD: boot.c,v 1.4 1999/12/23 06:52:31 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
|
||||
@ -188,7 +188,7 @@ boot(a0, a1, a2, a3, a4, a5)
|
||||
entry = (void *)marks[MARK_ENTRY];
|
||||
|
||||
if (apbus)
|
||||
apcall_flush_cache();
|
||||
apcall_flushcache();
|
||||
else
|
||||
mips1_flushicache(entry, marks[MARK_SYM] - marks[MARK_ENTRY]);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netif_news.c,v 1.1 1999/12/22 05:54:41 tsubai Exp $ */
|
||||
/* $NetBSD: netif_news.c,v 1.2 1999/12/23 06:52:31 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon W. Ross
|
||||
@ -236,6 +236,6 @@ getsecs()
|
||||
{
|
||||
u_int t[2];
|
||||
|
||||
apcall_nsectime(t); /* time = t[0](s) + t[1](ns) */
|
||||
apcall_gettimeofday(t); /* time = t[0](s) + t[1](ns) */
|
||||
return t[0];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user