Initial commit for merging A7000/NC with the RISCPC in order to get _one_

bootable GENERAL kernel for the 3 machines.

This is done by integrating the ARM7500 in a better way. In various places
the IOMD ID is checked and action is taken at runtime compared to
compiletime.

The small piece of assembler that is changed now uses the flag
`arm7500_ioc_found' that is set up by iomd.c at startup. When this chip
isnt found at startup it will skip reading the ARM7500 extended IRQ
registers and wont clear them either.

The next step will be getting the mode-definition files to the bootloader.
Currently they are compiled in.
This commit is contained in:
reinoud 2001-07-09 21:46:19 +00:00
parent 3911c122ef
commit 8ca7d6ec9c
12 changed files with 134 additions and 168 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.13 2001/06/14 22:56:56 thorpej Exp $ */
/* $NetBSD: cpu.h,v 1.14 2001/07/09 21:46:19 reinoud Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -89,15 +89,6 @@
#ifndef CPU_ARM7
#error "option CPU_ARM7 is required with CPU_ARM7500"
#endif
#ifdef CPU_ARM6
#error "CPU options CPU_ARM6 and CPU_ARM7500 are not compatible"
#endif
#ifdef CPU_ARM8
#error "CPU options CPU_ARM8 and CPU_ARM7500 are not compatible"
#endif
#ifdef CPU_SA110
#error "CPU options CPU_SA110 and CPU_ARM7500 are not compatible"
#endif
#endif /* CPU_ARM7500 */
#endif /* !_LKM */

View File

@ -1,4 +1,4 @@
/* $NetBSD: irqhandler.h,v 1.17 2001/05/30 12:28:40 mrg Exp $ */
/* $NetBSD: irqhandler.h,v 1.18 2001/07/09 21:46:19 reinoud Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -60,10 +60,10 @@
#if defined(RISCPC) || defined(CPU_ARM7500)
#ifdef CPU_ARM7500
/* Only for ARM7500 : */
/*#define IRQ_PRINTER 0x00*/
#define IRQ_RESERVED0 0x01
/*#define IRQ_RESERVED0 0x01*/
#define IRQ_BUTTON 0x02
#define IRQ_FLYBACK 0x03
#define IRQ_POR 0x04
@ -93,8 +93,9 @@
#define IRQ_ATOD 0x1A
#define IRQ_CLOCK 0x1B
#define IRQ_PANIC 0x1C
#define IRQ_RESERVED2 0x1D
#define IRQ_RESERVED3 0x1E
/*#define IRQ_RESERVED2 0x1D*/
/*#define IRQ_RESERVED3 0x1E*/
/*
* Note that Sound DMA IRQ is on the 31st vector.
@ -111,34 +112,39 @@
#else /* RC7500 */
#define IRQ_RESERVED1 0x07
/*#define IRQ_RESERVED1 0x07 */
#define IRQ_EXTENDED 0x0B
#define IRQ_PODULE 0x0D
#define IRQ_EXPCARD0 0x20
#define IRQ_EXPCARD1 0x21
#define IRQ_EXPCARD2 0x22
#define IRQ_EXPCARD3 0x23
#define IRQ_EXPCARD4 0x24
#define IRQ_EXPCARD5 0x25
#define IRQ_EXPCARD6 0x26
#define IRQ_EXPCARD7 0x27
#define ARM7500_IOC_IRQ_EXPCARD0 0x20
/*
define IRQ_EXPCARD1 0x21
define IRQ_EXPCARD2 0x22
define IRQ_EXPCARD3 0x23
define IRQ_EXPCARD4 0x24
define IRQ_EXPCARD5 0x25
define IRQ_EXPCARD6 0x26
define IRQ_EXPCARD7 0x27
*/
#endif /* RC7500 */
#else /* CPU_ARM7500 */
/* for non ARM7500 machines : */
#ifdef RISCPC
/*#define IRQ_PRINTER 0x00*/
#define IRQ_RESERVED0 0x01
/*#define IRQ_RESERVED0 0x01*/
/*#define IRQ_FLOPPYIDX 0x02*/
#define IRQ_FLYBACK 0x03
#define IRQ_POR 0x04
#define IRQ_TIMER0 0x05
#define IRQ_TIMER1 0x06
#define IRQ_RESERVED1 0x07
/*#define IRQ_RESERVED1 0x07*/
#define IRQ_RESERVED2 0x08
/*#define IRQ_RESERVED2 0x08*/
/*#define IRQ_HD 0x09*/
/*#define IRQ_SERIAL 0x0A*/
#define IRQ_EXTENDED 0x0B
@ -153,21 +159,22 @@
#define IRQ_DMACH3 0x13
#define IRQ_DMASCH0 0x14
#define IRQ_DMASCH1 0x15
#define IRQ_RESERVED3 0x16
#define IRQ_RESERVED4 0x17
/*#define IRQ_RESERVED3 0x16*/
/*#define IRQ_RESERVED4 0x17*/
#define RPC600_IOMD_IRQ_EXPCARD0 0x18
/*
define IRQ_EXPCARD1 0x19
define IRQ_EXPCARD2 0x1A
define IRQ_EXPCARD3 0x1B
define IRQ_EXPCARD4 0x1C
define IRQ_EXPCARD5 0x1D
define IRQ_EXPCARD6 0x1E
define IRQ_EXPCARD7 0x1F
*/
#define IRQ_EXPCARD0 0x18
#define IRQ_EXPCARD1 0x19
#define IRQ_EXPCARD2 0x1A
#define IRQ_EXPCARD3 0x1B
#define IRQ_EXPCARD4 0x1C
#define IRQ_EXPCARD5 0x1D
#define IRQ_EXPCARD6 0x1E
#define IRQ_EXPCARD7 0x1F
#endif /* RISCPC */
#endif /* CPU_ARM7500 */
#endif /* RISPC || CPU_ARM7500 */
#ifdef OFWGENCFG

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidc.h,v 1.12 2001/05/30 12:28:40 mrg Exp $ */
/* $NetBSD: vidc.h,v 1.13 2001/07/09 21:46:19 reinoud Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@ -201,11 +201,7 @@ struct vidc_state {
int dctl;
};
#ifdef CPU_ARM7500
#define VIDC_FREF 32000000
#else
#define VIDC_FREF 24000000
#endif /* CPU_ARM7500 */
extern int vidc_fref; /* reference frequency of detected VIDC */
#ifdef _KERNEL
extern int vidc_write __P((u_int /*reg*/, int /*value*/));

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd.c,v 1.11 2001/05/13 14:30:00 bjh21 Exp $ */
/* $NetBSD: iomd.c,v 1.12 2001/07/09 21:46:19 reinoud Exp $ */
/*
* Copyright (c) 1996-1997 Mark Brinicombe.
@ -95,6 +95,10 @@ extern struct bus_space iomd_bs_tag;
int iomd_found;
u_int32_t iomd_base = IOMD_BASE;
/* following flag is used in iomd_irq.s ... has to be cleaned up one day ! */
u_int32_t arm7500_ioc_found = 0;
/* Declare prototypes */
/*
@ -178,18 +182,22 @@ iomdattach(parent, self, aux)
case ARM7500_IOC_ID:
printf("ARM7500 IOMD ");
refresh = bus_space_read_1(iot, ioh, IOMD_REFCR) & 0x0f;
arm7500_ioc_found = 1;
break;
case ARM7500FE_IOC_ID:
printf("ARM7500FE IOMD ");
refresh = bus_space_read_1(iot, ioh, IOMD_REFCR) & 0x0f;
arm7500_ioc_found = 1;
break;
case RPC600_IOMD_ID:
printf("IOMD20 ");
refresh = bus_space_read_1(iot, ioh, IOMD_VREFCR) & 0x09;
arm7500_ioc_found = 0;
break;
default:
printf("Unknown IOMD ID=%04x ", sc->sc_id);
refresh = -1;
arm7500_ioc_found = 0; /* just in case */
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_dma.c,v 1.9 2001/02/27 20:23:11 reinoud Exp $ */
/* $NetBSD: iomd_dma.c,v 1.10 2001/07/09 21:46:20 reinoud Exp $ */
/*
* Copyright (c) 1995 Scott Stevens
@ -49,7 +49,11 @@
#include <arm32/iomd/iomdvar.h>
#include <arm32/iomd/iomd_dma.h>
#ifndef CPU_ARM7500
/*
* Only for non ARM7500 machines but the kernel could be booted on a different machine
*/
static struct dma_ctrl ctrl[6];
void dma_dumpdc __P((struct dma_ctrl *));
@ -319,81 +323,4 @@ dma_init(ch, extp, dmasize, ipl)
return(dp);
}
#else
void
dma_go(dp)
struct dma_ctrl *dp;
{
panic("dma_go\n");
}
int
dma_reset(dp)
struct dma_ctrl *dp;
{
panic("dma_reset\n");
return(0);
}
/*
* Setup dma transfer, prior to the dma_go call
*/
int
dma_setup(dp, start, len, readp)
struct dma_ctrl *dp;
int readp;
u_char *start;
int len;
{
panic("dma_setup\n");
return(0);
}
/*
* return true if DMA is active
*/
int
dma_isactive(dp)
struct dma_ctrl *dp;
{
panic("dma_isactive\n");
return(0);
}
/*
* return true if interrupt pending
*/
int
dma_isintr(dp)
struct dma_ctrl *dp;
{
panic("dma_isintr\n");
return(0);
}
int
dma_intr(dp)
struct dma_ctrl *dp;
{
panic("dma_intr\n");
return(0);
}
void
dma_dumpdc(dc)
struct dma_ctrl *dc;
{
panic("dma_dumpdc\n");
}
struct dma_ctrl *
dma_init(ch, extp, dmasize, ipl)
int ch;
int extp;
int dmasize;
int ipl;
{
panic("dma_init\n");
return(NULL);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_irq.S,v 1.23 2001/04/19 20:46:07 chris Exp $ */
/* $NetBSD: iomd_irq.S,v 1.24 2001/07/09 21:46:20 reinoud Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -111,6 +111,9 @@ Lspl_masks:
Liomd_base:
.word _C_LABEL(iomd_base)
Larm7500_ioc_found:
.word _C_LABEL(arm7500_ioc_found)
ASENTRY_NP(irq_entry)
sub lr, lr, #0x00000004 /* Adjust the lr */
@ -123,7 +126,13 @@ ASENTRY_NP(irq_entry)
ldrb r8, [r10, #(IOMD_IRQRQA << 2)] /* Get IRQ request A */
ldrb r9, [r10, #(IOMD_IRQRQB << 2)] /* Get IRQ request B */
orr r8, r8, r9, lsl #8
#ifdef CPU_ARM7500
ldr r9, Larm7500_ioc_found
ldr r9, [r9] /* get the flag */
cmp r9, #0
beq skip_extended_IRQs_reading
/* ARM 7500 only */
ldrb r9, [r10, #(IOMD_IRQRQC << 2)] /* Get IRQ request C */
orr r8, r8, r9, lsl #16
ldrb r9, [r10, #(IOMD_IRQRQD << 2)] /* Get IRQ request D */
@ -131,10 +140,13 @@ ASENTRY_NP(irq_entry)
ldrb r9, [r10, #(IOMD_DMARQ << 2)] /* Get DMA Request */
tst r9, #0x10
orrne r8, r8, r9, lsl #27
#else
b irq_entry_continue
skip_extended_IRQs_reading:
/* non ARM7500 machines */
ldrb r9, [r10, #(IOMD_DMARQ << 2)] /* Get DMA Request */
orr r8, r8, r9, lsl #16
#endif /* CPU_ARM7500 */
irq_entry_continue:
and r0, r8, #0x7d /* Clear IOMD IRQA bits */
strb r0, [r10, #(IOMD_IRQRQA << 2)]
@ -200,15 +212,17 @@ Lfind_highest_ipl:
msr cpsr_all, r0
ldr r7, [pc, #Lirqhandlers - . - 8]
/*
* take a copy of the IRQ request so that we can strip bits out of it
* note that we only use 24 bits with iomd2 chips
*/
#ifdef CPU_ARM7500
mov r11, r8
#else
bic r11, r8, #0xff000000
#endif
ldr r4, Larm7500_ioc_found
ldr r4, [r4] /* get the flag */
cmp r4, #0
movne r11, r8 /* ARM7500 -> copy all bits */
biceq r11, r8, #0xff000000 /* !ARM7500 -> only use 24 bit */
/* ffs routine to find first irq to service */
/* standard trick to isolate bottom bit in a0 or 0 if a0 = 0 on entry */
rsb r4, r11, #0
@ -405,7 +419,13 @@ ENTRY(irq_setmasks)
mov r1, r1, lsr #8
strb r1, [r0, #(IOMD_IRQMSKB << 2)] /* Set IRQ mask B */
mov r1, r1, lsr #8
#ifdef CPU_ARM7500
ldr r2, Larm7500_ioc_found
ldr r2, [r2]
cmp r2, #0
beq skip_setting_extended_DMA_mask
/* only for ARM7500's */
strb r1, [r0, #(IOMD_IRQMSKC << 2)]
mov r1, r1, lsr #8
and r2, r1, #0xef
@ -413,9 +433,13 @@ ENTRY(irq_setmasks)
mov r1, r1, lsr #3
and r2, r1, #0x10
strb r2, [r0, #(IOMD_DMAMSK << 2)] /* Set DMA mask */
#else
b continue_setting_masks
skip_setting_extended_DMA_mask:
/* non ARM7500's */
strb r1, [r0, #(IOMD_DMAMSK << 2)] /* Set DMA mask */
#endif /* CPU_ARM7500 */
continue_setting_masks:
/* Restore old cpsr and exit */
msr cpsr_all, r3

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_irqhandler.c,v 1.26 2001/02/27 20:23:11 reinoud Exp $ */
/* $NetBSD: iomd_irqhandler.c,v 1.27 2001/07/09 21:46:20 reinoud Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -72,6 +72,8 @@ extern u_int soft_interrupts; /* Only so we can initialise it */
extern char *_intrnames;
static int irq_expcard0_base;
/* Prototypes */
int podule_irqhandler __P((void));
@ -105,10 +107,19 @@ irq_init()
IOMD_WRITE_BYTE(IOMD_IRQMSKA, 0x00);
IOMD_WRITE_BYTE(IOMD_IRQMSKB, 0x00);
#ifdef CPU_ARM7500
IOMD_WRITE_BYTE(IOMD_IRQMSKC, 0x00);
IOMD_WRITE_BYTE(IOMD_IRQMSKD, 0x00);
#endif /* CPU_ARM7500 */
switch (IOMD_ID) {
case RPC600_IOMD_ID:
irq_expcard0_base = RPC600_IOMD_IRQ_EXPCARD0;
break;
case ARM7500_IOC_ID:
case ARM7500FE_IOC_ID:
irq_expcard0_base = ARM7500_IOC_IRQ_EXPCARD0;
IOMD_WRITE_BYTE(IOMD_IRQMSKC, 0x00);
IOMD_WRITE_BYTE(IOMD_IRQMSKD, 0x00);
break;
default:
printf("Unknown IOMD id (%d) found in irq_init()\n", IOMD_ID);
};
IOMD_WRITE_BYTE(IOMD_FIQMSK, 0x00);
IOMD_WRITE_BYTE(IOMD_DMAMSK, 0x00);
@ -283,7 +294,7 @@ irq_claim(irq, handler)
*
* The podule IRQ's need to be fixed ASAP
*/
if (irq >= IRQ_EXPCARD0 && irqhandlers[IRQ_PODULE] == NULL)
if (irq >= irq_expcard0_base && irqhandlers[IRQ_PODULE] == NULL)
panic("Podule IRQ %d claimed but no podulebus handler installed\n",
irq);
#endif /* NPODULEBUS */

View File

@ -1,4 +1,4 @@
/* $NetBSD: podulebus.c,v 1.46 2001/07/04 13:58:04 bjh21 Exp $ */
/* $NetBSD: podulebus.c,v 1.47 2001/07/09 21:46:20 reinoud Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -357,15 +357,11 @@ podulescan(dev)
switch (loop) {
case 0:
podule->dma_channel = 2;
#ifndef CPU_ARM7500
podule->dma_interrupt = IRQ_DMACH2;
#endif
break;
case 1:
podule->dma_channel = 3;
#ifndef CPU_ARM7500
podule->dma_interrupt = IRQ_DMACH3;
#endif
break;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_machdep.c,v 1.48 2001/06/19 13:45:54 wiz Exp $ */
/* $NetBSD: rpc_machdep.c,v 1.49 2001/07/09 21:46:20 reinoud Exp $ */
/*
* Copyright (c) 2000-2001 Reinoud Zandijk.
@ -529,11 +529,6 @@ initarm_new_bootloader(bootconf)
case ARM7500_IOC_ID:
#ifndef CPU_ARM7500
panic2(("Encountered ARM7500 IOMD but no ARM7500 kernel support"));
#endif /* CPU_ARM7500 */
break;
case RPC600_IOMD_ID:
#ifdef CPU_ARM7500
panic2(("Encountered ARM6/7 IOMD and ARM7500 kernel support"));
#endif /* CPU_ARM7500 */
break;
}
@ -1415,11 +1410,6 @@ initarm_old_bootloader(bootconf)
case ARM7500_IOC_ID:
#ifndef CPU_ARM7500
panic("Encountered ARM7500 IOMD but no ARM7500 kernel support");
#endif /* CPU_ARM7500 */
break;
case RPC600_IOMD_ID:
#ifdef CPU_ARM7500
panic("Encountered ARM6/7 IOMD and ARM7500 kernel support");
#endif /* CPU_ARM7500 */
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: beep.c,v 1.23 2001/02/27 20:23:12 reinoud Exp $ */
/* $NetBSD: beep.c,v 1.24 2001/07/09 21:46:21 reinoud Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe
@ -119,11 +119,10 @@ beepprobe(parent, cf, aux)
case ARM7500FE_IOC_ID:
sdma_channel = IRQ_SDMA;
return(1);
#else
#endif
case RPC600_IOMD_ID:
sdma_channel = IRQ_DMASCH0;
return(1);
#endif
default:
printf("beep: Unknown IOMD id=%04x\n", id);
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidc20.c,v 1.5 2001/02/25 17:17:56 reinoud Exp $ */
/* $NetBSD: vidc20.c,v 1.6 2001/07/09 21:46:21 reinoud Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
@ -50,6 +50,8 @@
#include <machine/bus.h>
#include <machine/vidc.h>
#include <machine/io.h>
#include <arm32/iomd/iomdreg.h>
#include <arm32/iomd/iomdvar.h>
#include <arm/mainbus/mainbus.h>
#include "locators.h"
@ -71,6 +73,13 @@ static int vidcsearch __P((struct device *, struct cfdata *, void *));
int *vidc_base = (int *) VIDC_BASE;
/*
* vidc_fref is the reference frequency in Mhz of the detected VIDC (dependent on IOMD/IOC)
* XXX default is RPC600 ?
*/
int vidc_fref = 24000000;
struct cfattach vidc_ca = {
sizeof (struct vidc20_softc), vidcmatch, vidcattach
};
@ -176,6 +185,17 @@ vidcattach(parent, self, aux)
printf(": vidc20\n");
switch (IOMD_ID) {
case ARM7500_IOC_ID:
case ARM7500FE_IOC_ID:
vidc_fref = 32000000;
break;
default: /* XXX default? */
case RPC600_IOMD_ID:
vidc_fref = 24000000;
break;
};
config_search(vidcsearch, self, NULL);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcaudio.c,v 1.36 2001/02/27 20:23:12 reinoud Exp $ */
/* $NetBSD: vidcaudio.c,v 1.37 2001/07/09 21:46:21 reinoud Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@ -239,16 +239,13 @@ vidcaudio_attach(parent, self, aux)
id = IOMD_ID;
switch (id) {
#ifndef CPU_ARM7500
case RPC600_IOMD_ID:
sound_dma_intr = IRQ_DMASCH0;
break;
#else
case ARM7500_IOC_ID:
case ARM7500FE_IOC_ID:
sound_dma_intr = IRQ_SDMA;
break;
#endif
}
disable_irq(sound_dma_intr);