diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 1996-09-14 15:58:30 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 1996-09-14 15:58:30 +0000 |
commit | d8d4b8513b1e1e0d595368c6c1704e68a04f7e61 (patch) | |
tree | 007dfd13013543adb5336a817478aaba7e1a181a | |
parent | d451e45564fe362101eccce9e3e4d1e7ba7d5e52 (diff) |
First shot at a multivendor kernel. This version handles pica's and desk-
station tyne's. Auto detection still needs to be compleeted.
Checked in version is hardwired for pica's. Use the PICA config file.
-rw-r--r-- | sys/arch/arc/arc/arcbios.c | 191 | ||||
-rw-r--r-- | sys/arch/arc/arc/arcbios.h | 34 | ||||
-rw-r--r-- | sys/arch/arc/arc/clock.c | 53 | ||||
-rw-r--r-- | sys/arch/arc/arc/clock_mc.c | 80 | ||||
-rw-r--r-- | sys/arch/arc/arc/cpu.c | 12 | ||||
-rw-r--r-- | sys/arch/arc/arc/locore.S | 193 | ||||
-rw-r--r-- | sys/arch/arc/arc/machdep.c | 138 | ||||
-rw-r--r-- | sys/arch/arc/arc/mainbus.c | 5 | ||||
-rw-r--r-- | sys/arch/arc/arc/pmap.c | 73 | ||||
-rw-r--r-- | sys/arch/arc/arc/trap.c | 12 | ||||
-rw-r--r-- | sys/arch/arc/conf/GENERIC | 95 | ||||
-rw-r--r-- | sys/arch/arc/conf/files.arc | 45 | ||||
-rw-r--r-- | sys/arch/arc/dev/ace.c | 10 | ||||
-rw-r--r-- | sys/arch/arc/dev/lpr.c | 4 | ||||
-rw-r--r-- | sys/arch/arc/dev/pccons.c | 164 | ||||
-rw-r--r-- | sys/arch/arc/dti/desktech.h | 25 | ||||
-rw-r--r-- | sys/arch/arc/dti/desktechbus.c | 207 | ||||
-rw-r--r-- | sys/arch/arc/include/bus.h | 4 | ||||
-rw-r--r-- | sys/arch/arc/include/cpu.h | 3 | ||||
-rw-r--r-- | sys/arch/arc/include/memconf.h | 4 | ||||
-rw-r--r-- | sys/arch/arc/isa/isa_machdep.h | 14 | ||||
-rw-r--r-- | sys/arch/arc/isa/isabus.c | 55 | ||||
-rw-r--r-- | sys/arch/arc/pica/pica.h | 48 | ||||
-rw-r--r-- | sys/arch/arc/pica/picabus.c | 22 |
24 files changed, 980 insertions, 511 deletions
diff --git a/sys/arch/arc/arc/arcbios.c b/sys/arch/arc/arc/arcbios.c index d6b9f0beded..075d174dff2 100644 --- a/sys/arch/arc/arc/arcbios.c +++ b/sys/arch/arc/arc/arcbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.c,v 1.1 1996/09/06 04:57:51 imp Exp $ */ +/* $OpenBSD: arcbios.c,v 1.2 1996/09/14 15:58:11 pefo Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * @@ -38,12 +38,197 @@ arc_param_blk_t *bios_base = (arc_param_blk_t *) 0x80001000; extern int cputype; /* Mother board type */ +extern int physmem; /* Total physical memory size */ + +char buf[100]; /*XXX*/ +arc_dsp_stat_t displayinfo; /* Save area for display status info. */ + +/* + * ARC Bios trampoline code. + */ +#define ARC_Call(Name,Offset) \ +__asm__("\n" \ +" .set noreorder\n" \ +" .globl " #Name "\n" \ +#Name":\n" \ +" lw $2, 0x80001020\n"\ +" lw $2," #Offset "($2)\n"\ +" jr $2\n" \ +" nop\n" ); + +ARC_Call(Bios_Load, 0x00); +ARC_Call(Bios_Invoke, 0x04); +ARC_Call(Bios_Execute, 0x08); +ARC_Call(Bios_Halt, 0x0c); +ARC_Call(Bios_PowerDown, 0x10); +ARC_Call(Bios_Restart, 0x14); +ARC_Call(Bios_Reboot, 0x18); +ARC_Call(Bios_EnterInteractiveMode, 0x1c); +ARC_Call(Bios_Unused1, 0x20); +ARC_Call(Bios_GetPeer, 0x24); +ARC_Call(Bios_GetChild, 0x28); +ARC_Call(Bios_GetParent, 0x2c); +ARC_Call(Bios_GetConfigurationData, 0x30); +ARC_Call(Bios_AddChild, 0x34); +ARC_Call(Bios_DeleteComponent, 0x38); +ARC_Call(Bios_GetComponent, 0x3c); +ARC_Call(Bios_SaveConfiguration, 0x40); +ARC_Call(Bios_GetSystemId, 0x44); +ARC_Call(Bios_GetMemoryDescriptor, 0x48); +ARC_Call(Bios_Unused2, 0x4c); +ARC_Call(Bios_GetTime, 0x50); +ARC_Call(Bios_GetRelativeTime, 0x54); +ARC_Call(Bios_GetDirectoryEntry, 0x58); +ARC_Call(Bios_Open, 0x5c); +ARC_Call(Bios_Close, 0x60); +ARC_Call(Bios_Read, 0x64); +ARC_Call(Bios_GetReadStatus, 0x68); +ARC_Call(Bios_Write, 0x6c); +ARC_Call(Bios_Seek, 0x70); +ARC_Call(Bios_Mount, 0x74); +ARC_Call(Bios_GetEnvironmentVariable, 0x78); +ARC_Call(Bios_SetEnvironmentVariable, 0x7c); +ARC_Call(Bios_GetFileInformation, 0x80); +ARC_Call(Bios_SetFileInformation, 0x84); +ARC_Call(Bios_FlushAllCaches, 0x88); +ARC_Call(Bios_TestUnicodeCharacter, 0x8c); +ARC_Call(Bios_GetDisplayStatus, 0x90); /* - * Incomplate version of bios_ident + * Simple getchar/putchar interface. + */ + +bios_getchar() +{ + char buf[4]; + int cnt; + + if(Bios_Read(0, &buf, 1, &cnt) != 0) + return(-1); + return(buf[0] & 255); +} + +bios_putchar(c) +char c; +{ + char buf[4]; + int cnt; + + if(c == '\n') { + buf[0] = '\r'; + buf[1] = c; + cnt = 2; + if(displayinfo.CursorYPosition < displayinfo.CursorMaxYPosition) + displayinfo.CursorYPosition++; + } + else { + buf[0] = c; + cnt = 1; + } + if(Bios_Write(1, &buf, cnt, &cnt) != 0) + return(-1); + return(0); +} + +bios_putstring(s) +char *s; +{ + while(*s) { + bios_putchar(*s++); + } +} + +bios_configure_memory() +{ + arc_mem_t *descr = 0; + struct mem_descriptor *m; + vm_offset_t seg_start, seg_end; + int i; + + descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); + while(descr != 0) { + sprintf(buf, "mem %d, 0x%x, 0x%x\n", + descr->Type, + descr->BasePage * 4096, + descr->PageCount * 4096); + bios_putstring(buf); + + seg_start = descr->BasePage * 4096; + seg_end = seg_start + descr->PageCount * 4096; + + switch(descr->Type) { + case BadMemory: /* Have no use for theese */ + break; + + case ExeceptionBlock: + case SystemParameterBlock: + case FreeMemory: + case FirmwareTemporary: + case FirmwarePermanent: + case FreeContigous: + physmem += descr->PageCount * 4096; + m = 0; + for( i = 0; i < MAXMEMSEGS; i++) { + if(mem_layout[i].mem_size == 0) { + if(m == 0) + m = &mem_layout[i]; /* free */ + } + else if(seg_end == mem_layout[i].mem_start) { + m = &mem_layout[i]; + m->mem_start = seg_start; + m->mem_size += seg_end - seg_start; + } + else if(mem_layout[i].mem_start + + mem_layout[i].mem_size == seg_start) { + m = &mem_layout[i]; + m->mem_size += seg_end - seg_start; + } + } + if(m && m->mem_size == 0) { + m->mem_start = seg_start; + m->mem_size = seg_end - seg_start; + } + break; + + case LoadedProgram: /* This is the loaded kernel */ + physmem += descr->PageCount * 4096; + break; + + default: /* Unknown type, leave it alone... */ + break; + } + descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); + } + + for( i = 0; i < MAXMEMSEGS; i++) { + sprintf(buf, "MEM %d, 0x%x, 0x%x\n",i, + mem_layout[i].mem_start, + mem_layout[i].mem_size); + bios_putstring(buf); + } +} +/* + * Incomplete version of bios_ident */ void bios_ident() { - cputype = DESKSTATION_TYNE; + bios_putstring("calling bios_ident\n"); + bios_configure_memory(); + displayinfo = *(arc_dsp_stat_t *)Bios_GetDisplayStatus(1); + cputype = ACER_PICA_61; +} + + +void +bios_display_info(xpos, ypos, xsize, ysize) + int *xpos; + int *ypos; + int *xsize; + int *ysize; +{ + *xpos = displayinfo.CursorXPosition; + *ypos = displayinfo.CursorYPosition; + *xsize = displayinfo.CursorMaxXPosition; + *ysize = displayinfo.CursorMaxYPosition; } diff --git a/sys/arch/arc/arc/arcbios.h b/sys/arch/arc/arc/arcbios.h index 12be71da3f5..42134936152 100644 --- a/sys/arch/arc/arc/arcbios.h +++ b/sys/arch/arc/arc/arcbios.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.h,v 1.1 1996/09/06 04:57:51 imp Exp $ */ +/* $OpenBSD: arcbios.h,v 1.2 1996/09/14 15:58:12 pefo Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * @@ -137,9 +137,37 @@ typedef enum arc_status arc_EROFS, /* Read-only file system */ } arc_status_t; -typedef caddr_t arc_mem_t; /* XXX */ +typedef enum { + ExeceptionBlock, + SystemParameterBlock, + FreeMemory, + BadMemory, + LoadedProgram, + FirmwareTemporary, + FirmwarePermanent, + FreeContigous +} MEMORYTYPE; + +typedef struct arc_mem { + MEMORYTYPE Type; /* Memory chunk type */ + u_int32_t BasePage; /* Page no, first page */ + u_int32_t PageCount; /* Number of pages */ +} arc_mem_t; + typedef caddr_t arc_time_t; /* XXX */ -typedef caddr_t arc_dsp_stat_t; /* XXX */ + +typedef struct arc_dsp_stat { + u_int16_t CursorXPosition; + u_int16_t CursorYPosition; + u_int16_t CursorMaxXPosition; + u_int16_t CursorMaxYPosition; + u_char ForegroundColor; + u_char BackgroundColor; + u_char HighIntensity; + u_char Underscored; + u_char ReverseVideo; +} arc_dsp_stat_t; + typedef caddr_t arc_dirent_t; /* XXX */ typedef u_int32_t arc_open_mode_t; /* XXX */ typedef u_int32_t arc_seek_mode_t; /* XXX */ diff --git a/sys/arch/arc/arc/clock.c b/sys/arch/arc/arc/clock.c index b247f2ff5d5..11e5bf83de5 100644 --- a/sys/arch/arc/arc/clock.c +++ b/sys/arch/arc/arc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.1 1996/06/24 09:07:20 pefo Exp $ */ +/* $OpenBSD: clock.c,v 1.2 1996/09/14 15:58:13 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ * from: Utah Hdr: clock.c 1.18 91/01/21 * * from: @(#)clock.c 8.1 (Berkeley) 6/10/93 - * $Id: clock.c,v 1.1 1996/06/24 09:07:20 pefo Exp $ + * $Id: clock.c,v 1.2 1996/09/14 15:58:13 pefo Exp $ */ #include <sys/param.h> @@ -52,20 +52,29 @@ #include <arc/arc/clockvar.h> #include <arc/arc/arctype.h> +#include <dev/isa/isavar.h> +#include <arc/isa/isa_machdep.h> extern int cputype; /* What kind of cpu we are running on */ +int clock_started = 0; + /* Definition of the driver for autoconfig. */ static int clockmatch __P((struct device *, void *, void *)); static void clockattach __P((struct device *, struct device *, void *)); -struct cfattach clock_ca = { - sizeof(struct clock_softc), clockmatch, clockattach -}; struct cfdriver clock_cd = { NULL, "clock", DV_DULL, NULL, 0 }; +struct cfattach clock_isa_ca = { + sizeof(struct clock_softc), clockmatch, clockattach +}; + +struct cfattach clock_pica_ca = { + sizeof(struct clock_softc), clockmatch, clockattach +}; + void mcclock_attach __P((struct device *, struct device *, void *)); #define SECMIN ((unsigned)60) /* seconds per minute */ @@ -92,41 +101,56 @@ clockmatch(parent, cfdata, aux) if (!BUS_MATCHNAME(ca, "dallas_rtc")) return (0); - if (cf->cf_unit >= 1) - return (0); + break; + case DESKSTATION_TYNE: break; default: panic("unknown CPU"); } + if (cf->cf_unit >= 1) + return (0); + return (1); } +int +clockintr(cf) + void *cf; +{ + if(clock_started) + hardclock((struct clockframe *)cf); + return(1); +} + static void clockattach(parent, self, aux) struct device *parent; struct device *self; void *aux; { + struct isa_attach_args *ia = aux; + + mcclock_attach(parent, self, aux); switch (cputype) { case ACER_PICA_61: - mcclock_attach(parent, self, aux); + BUS_INTR_ESTABLISH((struct confargs *)aux, + (intr_handler_t)hardclock, self); + break; + + case DESKSTATION_TYNE: + (void)isa_intr_establish(ia->ia_ic, + 0, 1, 3, clockintr, 0, "clock"); break; default: panic("clockattach: it didn't get here. really."); } - - /* - * establish the clock interrupt; it's a special case - */ - BUS_INTR_ESTABLISH((struct confargs *)aux, (intr_handler_t)hardclock, self); - printf("\n"); } @@ -171,6 +195,7 @@ cpu_initclocks() * Start the clock. */ (*csc->sc_init)(csc); + clock_started++; } /* diff --git a/sys/arch/arc/arc/clock_mc.c b/sys/arch/arc/arc/clock_mc.c index b3012f35f84..6bde0257a2b 100644 --- a/sys/arch/arc/arc/clock_mc.c +++ b/sys/arch/arc/arc/clock_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock_mc.c,v 1.2 1996/07/30 20:24:13 pefo Exp $ */ +/* $OpenBSD: clock_mc.c,v 1.3 1996/09/14 15:58:13 pefo Exp $ */ /* $NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp $ */ /* @@ -51,17 +51,23 @@ #include <machine/autoconf.h> #include <machine/pio.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <dev/ic/mc146818reg.h> + #include <arc/arc/clockvar.h> #include <arc/arc/arctype.h> #include <arc/pica/pica.h> -#include <dev/ic/mc146818reg.h> +#include <arc/isa/isa_machdep.h> +#include <arc/isa/timerreg.h> extern u_int cputype; extern int cpu_int_mask; void mcclock_attach __P((struct device *parent, struct device *self, void *aux)); -static void mcclock_init __P((struct clock_softc *csc)); +static void mcclock_init_pica __P((struct clock_softc *csc)); +static void mcclock_init_tyne __P((struct clock_softc *csc)); static void mcclock_get __P((struct clock_softc *csc, time_t base, struct tod_time *ct)); static void mcclock_set __P((struct clock_softc *csc, @@ -79,12 +85,17 @@ struct mcclockdata { #define mc146818_read(sc, reg) \ (*((struct mcclockdata *)sc->sc_data)->mc_read)(sc, reg) -#if defined(ACER_PICA_61) -static void mc_write_arc __P((struct clock_softc *csc, u_int reg, +/* Acer pica clock read code */ +static void mc_write_pica __P((struct clock_softc *csc, u_int reg, + u_int datum)); +static u_int mc_read_pica __P((struct clock_softc *csc, u_int reg)); +static struct mcclockdata mcclockdata_pica = { mc_write_pica, mc_read_pica }; + +/* Deskstation clock read code */ +static void mc_write_tyne __P((struct clock_softc *csc, u_int reg, u_int datum)); -static u_int mc_read_arc __P((struct clock_softc *csc, u_int reg)); -static struct mcclockdata mcclockdata_arc = { mc_write_arc, mc_read_arc }; -#endif +static u_int mc_read_tyne __P((struct clock_softc *csc, u_int reg)); +static struct mcclockdata mcclockdata_tyne = { mc_write_tyne, mc_read_tyne }; void mcclock_attach(parent, self, aux) @@ -99,7 +110,6 @@ mcclock_attach(parent, self, aux) printf(": mc146818 or compatible"); - csc->sc_init = mcclock_init; csc->sc_get = mcclock_get; csc->sc_set = mcclock_set; @@ -110,8 +120,14 @@ mcclock_attach(parent, self, aux) * XXX should really allocate a new one and copy, or * something. unlikely we'll have more than one... */ - csc->sc_data = &mcclockdata_arc; - mcclockdata_arc.mc_addr = BUS_CVTADDR(ca); + csc->sc_init = mcclock_init_pica; + csc->sc_data = &mcclockdata_pica; + mcclockdata_tyne.mc_addr = BUS_CVTADDR(ca); + break; + + case DESKSTATION_TYNE: + csc->sc_init = mcclock_init_tyne; + csc->sc_data = &mcclockdata_tyne; break; default: @@ -124,7 +140,7 @@ mcclock_attach(parent, self, aux) } static void -mcclock_init(csc) +mcclock_init_pica(csc) struct clock_softc *csc; { /* XXX Does not really belong here but for the moment we don't care */ @@ -133,6 +149,15 @@ mcclock_init(csc) out32(R4030_SYS_EXT_IMASK, cpu_int_mask); } +static void +mcclock_init_tyne(csc) + struct clock_softc *csc; +{ + isa_outb(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN); + isa_outb(TIMER_CNTR0, TIMER_DIV(hz) % 256); + isa_outb(TIMER_CNTR0, TIMER_DIV(hz) / 256); +} + /* * Get the time of day, based on the clock's value and/or the base value. */ @@ -171,7 +196,6 @@ mcclock_set(csc, ct) s = splclock(); MC146818_GETTOD(csc, ®s); - splx(s); regs[MC_SEC] = ct->sec; regs[MC_MIN] = ct->min; @@ -181,16 +205,12 @@ mcclock_set(csc, ct) regs[MC_MONTH] = ct->mon; regs[MC_YEAR] = ct->year; - s = splclock(); MC146818_PUTTOD(csc, ®s); splx(s); } - -#if defined(ACER_PICA_61) - static void -mc_write_arc(csc, reg, datum) +mc_write_pica(csc, reg, datum) struct clock_softc *csc; u_int reg, datum; { @@ -202,7 +222,7 @@ mc_write_arc(csc, reg, datum) } static u_int -mc_read_arc(csc, reg) +mc_read_pica(csc, reg) struct clock_softc *csc; u_int reg; { @@ -213,4 +233,24 @@ mc_read_arc(csc, reg) i = inb(PICA_SYS_CLOCK); return(i); } -#endif /*ACER_PICA_61*/ + +static void +mc_write_tyne(csc, reg, datum) + struct clock_softc *csc; + u_int reg, datum; +{ + isa_outb(IO_RTC, reg); + isa_outb(IO_RTC+1, datum); +} + +static u_int +mc_read_tyne(csc, reg) + struct clock_softc *csc; + u_int reg; +{ + int i; + + isa_outb(IO_RTC, reg); + i = isa_inb(IO_RTC+1); + return(i); +} diff --git a/sys/arch/arc/arc/cpu.c b/sys/arch/arc/arc/cpu.c index cc24baf78d4..2b5270d27bf 100644 --- a/sys/arch/arc/arc/cpu.c +++ b/sys/arch/arc/arc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.2 1996/08/26 11:11:52 pefo Exp $ */ +/* $OpenBSD: cpu.c,v 1.3 1996/09/14 15:58:14 pefo Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -101,7 +101,7 @@ cpuattach(parent, dev, aux) printf("IDT R3000 derivate"); break; case MIPS_R10000: - printf("MIPS R10000/T5 CPU"); + printf("MIPS R10000 CPU"); break; case MIPS_R4200: printf("MIPS R4200 CPU (ICE)"); @@ -154,7 +154,7 @@ cpuattach(parent, dev, aux) printf("FPC"); break; case MIPS_R10010: - printf("MIPS R10000/T5 FPU"); + printf("MIPS R10000 FPU"); break; case MIPS_R4210: printf("MIPS R4200 FPC (ICE)"); @@ -181,12 +181,12 @@ cpuattach(parent, dev, aux) printf(" Rev. %d.%d", fpu_id.cpu.cp_majrev, fpu_id.cpu.cp_minrev); printf("\n"); - printf(" Primary cache size: %dkb Instruction, %dkb Data.", + printf("Primary cache size: %dkb Instruction, %dkb Data.", CpuPrimaryInstCacheSize / 1024, CpuPrimaryDataCacheSize / 1024); if(CpuTwoWayCache) - printf("Two way set associative.\n"); + printf(" Two way set associative.\n"); else - printf("Direct mapped.\n"); + printf(" Direct mapped.\n"); } diff --git a/sys/arch/arc/arc/locore.S b/sys/arch/arc/arc/locore.S index 60c04307fed..42ee574546f 100644 --- a/sys/arch/arc/arc/locore.S +++ b/sys/arch/arc/arc/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.3 1996/08/26 11:11:53 pefo Exp $ */ +/* $OpenBSD: locore.S,v 1.4 1996/09/14 15:58:15 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -50,7 +50,7 @@ * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL) * * from: @(#)locore.s 8.5 (Berkeley) 1/4/94 - * $Id: locore.S,v 1.3 1996/08/26 11:11:53 pefo Exp $ + * $Id: locore.S,v 1.4 1996/09/14 15:58:15 pefo Exp $ */ /* @@ -267,6 +267,95 @@ LEAF(fillw) END(fillw) /* + * Block I/O routines mainly used by I/O drivers. + * + * Args as: a0 = port + * a1 = memory address + * a2 = count + */ +LEAF(insb) + beq a2, zero, 2f + addu a2, a1 +1: + lbu v0, 0(a0) + addiu a1, 1 + bne a1, a2, 1b + sb v0, -1(a1) +2: + jr ra + nop +END(insb) + +LEAF(insw) + beq a2, zero, 2f + addu a2, a2 + addu a2, a1 +1: + lhu v0, 0(a0) + addiu a1, 2 + bne a1, a2, 1b + sh v0, -2(a1) +2: + jr ra + nop +END(insw) + +LEAF(insl) + beq a2, zero, 2f + sll a2, 2 + addu a2, a1 +1: + lw v0, 0(a0) + addiu a1, 4 + bne a1, a2, 1b + sw v0, -4(a1) +2: + jr ra + nop +END(insl) + +LEAF(outsb) + beq a2, zero, 2f + addu a2, a1 +1: + lbu v0, 0(a1) + addiu a1, 1 + bne a1, a2, 1b + sb v0, 0(a0) +2: + jr ra + nop +END(outsb) + +LEAF(outsw) + beq a2, zero, 2f + addu a2, a2 + addu a2, a1 +1: + lhu v0, 0(a1) + addiu a1, 2 + bne a1, a2, 1b + sh v0, 0(a0) +2: + jr ra + nop +END(outsw) + +LEAF(outsl) + beq a2, zero, 2f + sll a2, 2 + addu a2, a1 +1: + lw v0, 0(a1) + addiu a1, 4 + bne a1, a2, 1b + sw v0, 0(a0) +2: + jr ra + nop +END(outsl) + +/* * Copy a null terminated string from the user address space into * the kernel address space. * @@ -2489,7 +2578,7 @@ LEAF(R4K_ConfigCache) addu t2, t2, 16 sw t2, CpuPrimaryInstCacheLSize and v1, 0xff00 - li t1, (MIPS_R4600 << 4) + li t1, (MIPS_R4600 << 8) li t2, 1 bnel v1, t1, 1f li t2, 0 @@ -2527,14 +2616,25 @@ LEAF(R4K_FlushCache) addu t1, t0, t1 # End address subu t1, t1, 128 1: + bne v0, zero, 2f cache 0, 0(t0) + cache 0, 16(t0) - cache 0, 32(t0) cache 0, 48(t0) - cache 0, 64(t0) cache 0, 80(t0) - cache 0, 96(t0) + b 3f cache 0, 112(t0) + +2: + cache 0, 8192+0(t0) + cache 0, 8192+32(t0) + cache 0, 8192+64(t0) + cache 0, 8192+96(t0) + +3: + cache 0, 32(t0) + cache 0, 64(t0) + cache 0, 96(t0) bne t0, t1, 1b addu t0, t0, 128 @@ -2545,14 +2645,25 @@ LEAF(R4K_FlushCache) addu t1, t0, t2 # End address subu t1, t1, 128 1: + bne v0, zero, 2f cache 1, 0(t0) + cache 1, 16(t0) - cache 1, 32(t0) cache 1, 48(t0) - cache 1, 64(t0) cache 1, 80(t0) - cache 1, 96(t0) + b 3f cache 1, 112(t0) + +2: + cache 1, 8192+0(t0) + cache 1, 8192+32(t0) + cache 1, 8192+64(t0) + cache 1, 8192+96(t0) + +3: + cache 1, 32(t0) + cache 1, 64(t0) + cache 1, 96(t0) bne t0, t1, 1b addu t0, t0, 128 @@ -2581,18 +2692,30 @@ END(R4K_FlushCache) *---------------------------------------------------------------------------- */ LEAF(R4K_FlushICache) + lw v0, CpuTwoWayCache addu a1, 127 # Align srl a1, a1, 7 # Number of unrolled loops 1: - cache 0, 0(a0) + bne v0, zero, 2f + addu a1, -1 + cache 0, 16(a0) - cache 0, 32(a0) cache 0, 48(a0) - cache 0, 64(a0) cache 0, 80(a0) - cache 0, 96(a0) + b 3f cache 0, 112(a0) - addu a1, -1 + +2: + cache 0, 8192+0(a0) + cache 0, 8192+32(a0) + cache 0, 8192+64(a0) + cache 0, 8192+96(a0) + +3: + cache 0, 0(a0) + cache 0, 32(a0) + cache 0, 64(a0) + cache 0, 96(a0) bne a1, zero, 1b addu a0, 128 @@ -2620,6 +2743,7 @@ END(R4K_FlushICache) *---------------------------------------------------------------------------- */ LEAF(R4K_FlushDCache) + lw v0, CpuTwoWayCache lw a2, CpuPrimaryDataCacheSize addiu a2, -1 and a0, a0, a2 @@ -2631,15 +2755,26 @@ LEAF(R4K_FlushDCache) subu a1, a1, a0 srl a1, a1, 7 # Compute number of cache lines 1: - cache 1, 0(a0) + bne v0, zero, 2f + addu a1, -1 + cache 1, 16(a0) - cache 1, 32(a0) cache 1, 48(a0) - cache 1, 64(a0) cache 1, 80(a0) - cache 1, 96(a0) + b 3f cache 1, 112(a0) - addu a1, -1 + +2: + cache 1, 8192+0(a0) + cache 1, 8192+32(a0) + cache 1, 8192+64(a0) + cache 1, 8192+96(a0) + +3: + cache 1, 0(a0) + cache 1, 32(a0) + cache 1, 64(a0) + cache 1, 96(a0) bne a1, zero, 1b addu a0, 128 @@ -2669,26 +2804,31 @@ END(R4K_FlushDCache) *---------------------------------------------------------------------------- */ LEAF(R4K_HitFlushDCache) - beq a1, zero, 2f + lw v0, CpuTwoWayCache + beq a1, zero, 3f addu a1, 127 # Align addu a1, a1, a0 and a0, a0, -128 subu a1, a1, a0 srl a1, a1, 7 # Compute number of cache lines 1: - cache 0x15, 0(a0) + bne v0, zero, 2f + addu a1, -1 + cache 0x15, 16(a0) - cache 0x15, 32(a0) cache 0x15, 48(a0) - cache 0x15, 64(a0) cache 0x15, 80(a0) - cache 0x15, 96(a0) cache 0x15, 112(a0) - addu a1, -1 + +2: + cache 0x15, 0(a0) + cache 0x15, 32(a0) + cache 0x15, 64(a0) + cache 0x15, 96(a0) bne a1, zero, 1b addu a0, 128 -2: +3: j ra nop END(R4K_HitFlushDCache) @@ -2713,6 +2853,7 @@ END(R4K_HitFlushDCache) LEAF(R4K_InvalidateDCache) addu a1, a1, a0 # compute ending address 1: + cache 0x11,8194(a0) addu a0, a0, 4 bne a0, a1, 1b cache 0x11,-4(a0) diff --git a/sys/arch/arc/arc/machdep.c b/sys/arch/arc/arc/machdep.c index bc16dfda214..f20db586d2f 100644 --- a/sys/arch/arc/arc/machdep.c +++ b/sys/arch/arc/arc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.11 1996/09/06 04:57:52 imp Exp $ */ +/* $OpenBSD: machdep.c,v 1.12 1996/09/14 15:58:16 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94 - * $Id: machdep.c,v 1.11 1996/09/06 04:57:52 imp Exp $ + * $Id: machdep.c,v 1.12 1996/09/14 15:58:16 pefo Exp $ */ /* from: Utah Hdr: machdep.c 1.63 91/04/24 */ @@ -123,10 +123,7 @@ int bufpages = BUFPAGES; int bufpages = 0; #endif int msgbufmapped = 0; /* set when safe to use msgbuf */ -int maxmem; /* max memory per process */ int physmem; /* max supported memory, changes to actual */ -int memcfg; /* memory config register */ -int brdcfg; /* motherboard config register */ int cpucfg; /* Value of processor config register */ int cputype; /* Mother board type */ int ncpu = 1; /* At least one cpu in the system */ @@ -174,7 +171,7 @@ mips_init(argc, argv, code) register char *cp; register int i; register unsigned firstaddr; - register caddr_t v; + register caddr_t sysend; caddr_t start; struct tlb tlb; extern char edata[], end[]; @@ -182,11 +179,11 @@ mips_init(argc, argv, code) extern char MachException[], MachExceptionEnd[]; /* clear the BSS segment in OpenBSD code */ - v = (caddr_t)mips_round_page(end); - bzero(edata, v - edata); + sysend = (caddr_t)mips_round_page(end); + bzero(edata, sysend - edata); - /* Initialize the CPU type */ - bios_ident(); + /* Initialize the CPU type */ + bios_ident(); /* * Get config register now as mapped from BIOS since we are @@ -198,13 +195,9 @@ mips_init(argc, argv, code) case ACER_PICA_61: /* ALI PICA 61 and MAGNUM is almost the */ case MAGNUM: /* Same kind of hardware. NEC goes here too */ if(cputype == MAGNUM) { - /* XXX this is likely broken */ - memcfg = in32(R4030_SYS_CONFIG); strcpy(cpu_model, "MIPS Magnum"); } else { - memcfg = in32(PICA_MEMORY_SIZE_REG); - brdcfg = in32(PICA_CONFIG_REG); strcpy(cpu_model, "Acer Pica-61"); } isa_io_base = PICA_V_ISA_IO; @@ -220,57 +213,22 @@ mips_init(argc, argv, code) Mach_spltty = Mach_spl2; Mach_splstatclock = Mach_spl3; #endif - - /* - * Size is determined from the memory config register. - * d0-d2 = bank 0 size (sim id) - * d3-d5 = bank 1 size - * d6 = bus width. (doubels memory size) - */ - if((memcfg & 7) <= 5) - physmem = 2097152 << (memcfg & 7); - if(((memcfg >> 3) & 7) <= 5) - physmem += 2097152 << ((memcfg >> 3) & 7); - - if((memcfg & 0x40) == 0) - physmem += physmem; /* 128 bit config */ - - mem_layout[0].mem_start = 0x00100000; - mem_layout[0].mem_size = physmem - mem_layout[0].mem_start; - mem_layout[1].mem_start = 0x00020000; - mem_layout[1].mem_size = 0x00100000 - mem_layout[1].mem_start; - mem_layout[2].mem_start = 0x0; break; case DESKSTATION_RPC44: strcpy(cpu_model, "Deskstation rPC44"); - - /*XXX Need to find out how to size mem */ - physmem = 1024 * 1024 * 32; - mem_layout[0].mem_start = 0x00100000; - mem_layout[0].mem_size = physmem - mem_layout[0].mem_start; - mem_layout[1].mem_start = 0x00008000; - mem_layout[1].mem_size = 0x000a0000 - mem_layout[1].mem_start; - mem_layout[2].mem_start = 0x0; + isa_io_base = TYNE_V_ISA_IO; /*XXX*/ + isa_mem_base = TYNE_V_ISA_MEM; /*XXX*/ break; case DESKSTATION_TYNE: strcpy(cpu_model, "Deskstation Tyne"); isa_io_base = TYNE_V_ISA_IO; isa_mem_base = TYNE_V_ISA_MEM; - - /*XXX Need to find out how to size mem */ - physmem = 1024 * 1024 * 16; - mem_layout[0].mem_start = 0x00100000; - mem_layout[0].mem_size = physmem - mem_layout[0].mem_start; - mem_layout[1].mem_start = 0x00020000; - mem_layout[1].mem_size = 0x00100000 - mem_layout[1].mem_start; - mem_layout[2].mem_start = 0x0; break; default: -/*XXX printf doesn't work here .... use bios?? */ - printf("kernel not configured for systype 0x%x\n", i); + bios_putstring("kernel not configured for this system\n"); boot(RB_HALT | RB_NOSYNC); } physmem = btoc(physmem); @@ -324,7 +282,7 @@ mips_init(argc, argv, code) */ if (boothowto & RB_MINIROOT) { boothowto |= RB_DFLTROOT; - v += mfs_initminiroot(v); + sysend += mfs_initminiroot(sysend); } #endif @@ -350,11 +308,11 @@ mips_init(argc, argv, code) /* * Init mapping for u page(s) for proc[0], pm_tlbpid 1. */ - v = (caddr_t)((int)v+3 & -4); - start = v; - curproc->p_addr = proc0paddr = (struct user *)v; + sysend = (caddr_t)((int)sysend + 3 & -4); + start = sysend; + curproc->p_addr = proc0paddr = (struct user *)sysend; curproc->p_md.md_regs = proc0paddr->u_pcb.pcb_regs; - firstaddr = CACHED_TO_PHYS(v); + firstaddr = CACHED_TO_PHYS(sysend); for (i = 0; i < UPAGES; i+=2) { tlb.tlb_mask = PG_SIZE_4K; tlb.tlb_hi = vad_to_vpn((UADDR + (i << PGSHIFT))) | 1; @@ -365,8 +323,8 @@ mips_init(argc, argv, code) R4K_TLBWriteIndexed(i,&tlb); firstaddr += NBPG * 2; } - v += UPAGES * NBPG; - v = (caddr_t)((int)v+3 & -4); + sysend += UPAGES * NBPG; + sysend = (caddr_t)((int)sysend+3 & -4); R4K_SetPID(1); /* @@ -374,19 +332,19 @@ mips_init(argc, argv, code) * init mapping for u page(s), pm_tlbpid 0 * This could be used for an idle process. */ - nullproc.p_addr = (struct user *)v; + nullproc.p_addr = (struct user *)sysend; nullproc.p_md.md_regs = nullproc.p_addr->u_pcb.pcb_regs; bcopy("nullproc", nullproc.p_comm, sizeof("nullproc")); - firstaddr = CACHED_TO_PHYS(v); + firstaddr = CACHED_TO_PHYS(sysend); for (i = 0; i < UPAGES; i+=2) { nullproc.p_md.md_upte[i] = vad_to_pfn(firstaddr) | PG_V | PG_M | PG_CACHED; nullproc.p_md.md_upte[i+1] = vad_to_pfn(firstaddr + NBPG) | PG_V | PG_M | PG_CACHED; firstaddr += NBPG * 2; } - v += UPAGES * NBPG; + sysend += UPAGES * NBPG; /* clear pages for u areas */ - bzero(start, v - start); + bzero(start, sysend - start); /* * Copy down exception vector code. @@ -405,33 +363,28 @@ mips_init(argc, argv, code) R4K_FlushCache(); /* - * Find out how much memory is available. + * Initialize error message buffer. */ - /* Already know from above!!! */ - maxmem = physmem; - - /* - * Initialize error message buffer (at end of core). - */ - maxmem -= btoc(sizeof (struct msgbuf)); - msgbufp = (struct msgbuf *)(PHYS_TO_CACHED(maxmem << PGSHIFT)); + msgbufp = (struct msgbuf *)(sysend); + sysend = (caddr_t)(sysend + (sizeof(struct msgbuf))); msgbufmapped = 1; /* * Allocate space for system data structures. - * The first available kernel virtual address is in "v". - * As pages of kernel virtual memory are allocated, "v" is incremented. + * The first available kernel virtual address is in "sysend". + * As pages of kernel virtual memory are allocated, "sysend" + * is incremented. * * These data structures are allocated here instead of cpu_startup() * because physical memory is directly addressable. We don't have * to map these into virtual address space. */ - start = v; + start = sysend; #define valloc(name, type, num) \ - (name) = (type *)v; v = (caddr_t)((name)+(num)) + (name) = (type *)sysend; sysend = (caddr_t)((name)+(num)) #define valloclim(name, type, num, lim) \ - (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num))) + (name) = (type *)sysend; sysend = (caddr_t)((lim) = ((name)+(num))) #ifdef REAL_CLISTS valloc(cfree, struct cblock, nclist); #endif @@ -478,12 +431,12 @@ mips_init(argc, argv, code) /* * Clear allocated memory. */ - bzero(start, v - start); + bzero(start, sysend - start); /* * Initialize the virtual memory system. */ - pmap_bootstrap((vm_offset_t)v); + pmap_bootstrap((vm_offset_t)sysend); } void @@ -527,7 +480,7 @@ tlb_init_tyne() { struct tlb tlb; - tlb.tlb_mask = PG_SIZE_64K; + tlb.tlb_mask = PG_SIZE_256K; tlb.tlb_hi = vad_to_vpn(TYNE_V_BOUNCE); tlb.tlb_lo0 = vad_to_pfn64(TYNE_P_BOUNCE) | PG_IOPAGE; tlb.tlb_lo1 = PG_G; @@ -544,6 +497,13 @@ tlb_init_tyne() tlb.tlb_lo0 = vad_to_pfn64(TYNE_P_ISA_MEM) | PG_IOPAGE; tlb.tlb_lo1 = PG_G; R4K_TLBWriteIndexed(3, &tlb); + + tlb.tlb_mask = PG_SIZE_4K; + tlb.tlb_hi = vad_to_vpn(0xe3000000); + tlb.tlb_lo0 = 0x03ffc000 | PG_IOPAGE; + tlb.tlb_lo1 = PG_G; + R4K_TLBWriteIndexed(4, &tlb); + } /* @@ -560,6 +520,7 @@ consinit() return; initted = 1; cninit(); +mdbpanic(); } /* @@ -1073,13 +1034,16 @@ microtime(tvp) initcpu() { - /* - * Disable all interrupts. New masks will be set up - * during system configuration - */ - out16(PICA_SYS_LB_IE,0x000); - out32(R4030_SYS_EXT_IMASK, 0x00); - + switch(cputype) { + case ACER_PICA_61: + /* + * Disable all interrupts. New masks will be set up + * during system configuration + */ + out16(PICA_SYS_LB_IE,0x000); + out32(R4030_SYS_EXT_IMASK, 0x00); + break; + } } /* diff --git a/sys/arch/arc/arc/mainbus.c b/sys/arch/arc/arc/mainbus.c index 9c73222cd1e..bfce5f99e2a 100644 --- a/sys/arch/arc/arc/mainbus.c +++ b/sys/arch/arc/arc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.1 1996/06/24 09:07:21 pefo Exp $ */ +/* $OpenBSD: mainbus.c,v 1.2 1996/09/14 15:58:17 pefo Exp $ */ /* $NetBSD: mainbus.c,v 1.3 1995/06/28 02:45:10 cgd Exp $ */ /* @@ -116,7 +116,8 @@ mbattach(parent, self, aux) nca.ca_bus = &sc->sc_bus; config_found(self, &nca, mbprint); } - if (cputype == ACER_PICA_61) { + if (cputype == ACER_PICA_61 || + cputype == DESKSTATION_TYNE) { /* we have an ISA bus! */ nca.ca_name = "isabr"; nca.ca_slot = 0; diff --git a/sys/arch/arc/arc/pmap.c b/sys/arch/arc/arc/pmap.c index 04a32737908..9fcfa6bba58 100644 --- a/sys/arch/arc/arc/pmap.c +++ b/sys/arch/arc/arc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.3 1996/08/26 11:11:56 pefo Exp $ */ +/* $OpenBSD: pmap.c,v 1.4 1996/09/14 15:58:17 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 8.4 (Berkeley) 1/26/94 - * $Id: pmap.c,v 1.3 1996/08/26 11:11:56 pefo Exp $ + * $Id: pmap.c,v 1.4 1996/09/14 15:58:17 pefo Exp $ */ /* @@ -166,6 +166,8 @@ struct { #define PDB_WIRING 0x4000 #define PDB_PVDUMP 0x8000 +extern int _ftext[]; +extern int _end[]; int pmapdebug = 0x0; #endif /* DEBUG */ @@ -194,10 +196,13 @@ void pmap_bootstrap(firstaddr) vm_offset_t firstaddr; { - register int i, n; + register int i, n, nextpage; register pt_entry_t *spte; + struct physseg *pseg; vm_offset_t start = firstaddr; - extern int maxmem, physmem; + extern int physmem; + +/*XXX*/ char pbuf[100]; #define valloc(name, type, num) \ (name) = (type *)firstaddr; firstaddr = (vm_offset_t)((name)+(num)) @@ -224,13 +229,13 @@ pmap_bootstrap(firstaddr) * phys_start and phys_end but its better to use kseg0 addresses * rather than kernel virtual addresses mapped through the TLB. */ - i = maxmem - mips_btop(CACHED_TO_PHYS(firstaddr)); #ifdef MACHINE_NONCONTIG - for( n = 1; n < MAXMEMSEGS; n++) { - if(mem_layout[n].mem_start == 0) - break; + i = 0; + for( n = 0; n < MAXMEMSEGS; n++) { i += mips_btop(mem_layout[n].mem_size); } +#else + i = physmem - mips_btop(CACHED_TO_PHYS(firstaddr)); #endif /*MACHINE_NONCONTIG*/ valloc(pv_table, struct pv_entry, i); @@ -241,27 +246,47 @@ pmap_bootstrap(firstaddr) bzero((caddr_t)start, firstaddr - start); avail_start = CACHED_TO_PHYS(firstaddr); - avail_end = mips_ptob(maxmem); + avail_end = mips_ptob(physmem); #ifdef MACHINE_NONCONTIG - avail_next = avail_start; - avail_remaining = mips_btop(avail_end - avail_start); - physsegs[0].start = avail_start; - physsegs[0].end = avail_end; - physsegs[0].first_page = 0; + avail_remaining = 0; + nextpage = 0; /* - * Now reclaim the "lost" memory areas. Skip the first one - * as that is the segment where the os was loaded. + * Now set up memory areas. Be careful to remove areas used + * for the OS and for exception vector stuff. */ - for( i = 1; i < MAXMEMSEGS; i++) { - if((physsegs[i].start = mem_layout[i].mem_start) == 0) - break; - physsegs[i].end = physsegs[i].start + mem_layout[i].mem_size; - physsegs[i].first_page = physsegs[i-1].first_page + - (physsegs[i-1].end - physsegs[i-1].start) / NBPG; - avail_remaining += (physsegs[i].end - physsegs[i].start) / NBPG; + pseg = &physsegs[0]; + + for( i = 0; i < MAXMEMSEGS; i++) { + /* Adjust for the kernel exeption vectors and sys data area */ + if(mem_layout[i].mem_start < 0x8000) { + if((mem_layout[i].mem_start + mem_layout[i].mem_size) < 0x8000) + continue; /* To small skip it */ + mem_layout[i].mem_size -= 0x8000 - mem_layout[i].mem_start; + mem_layout[i].mem_start = 0x8000; /* Adjust to be above vec's */ + } + /* Adjust for the kernel expansion area (bufs etc) */ + if((mem_layout[i].mem_start + mem_layout[i].mem_size > CACHED_TO_PHYS(_ftext)) && + (mem_layout[i].mem_start < CACHED_TO_PHYS(avail_start))) { + mem_layout[i].mem_size -= CACHED_TO_PHYS(avail_start) - mem_layout[i].mem_start; + mem_layout[i].mem_start = CACHED_TO_PHYS(avail_start); + } + + if(mem_layout[i].mem_size == 0) + continue; + + pseg->start = mem_layout[i].mem_start; + pseg->end = pseg->start + mem_layout[i].mem_size; + pseg->first_page = nextpage; + nextpage += (pseg->end - pseg->start) / NBPG; + avail_remaining += (pseg->end - pseg->start) / NBPG; +/*XXX*/ sprintf(pbuf,"segment = %d start 0x%x end 0x%x avail %d page %d\n", i, pseg->start, pseg->end, avail_remaining, nextpage); bios_putstring(pbuf); + pseg++; } + + avail_next = physsegs[0].start; + #endif /* MACHINE_NONCONTIG */ virtual_avail = VM_MIN_KERNEL_ADDRESS; @@ -326,7 +351,7 @@ pmap_init(phys_start, phys_end) { #ifdef DEBUG - if (pmapdebug & (PDB_FOLLOW|PDB_INIT)) + if (1 || pmapdebug & (PDB_FOLLOW|PDB_INIT)) #ifdef MACHINE_NONCONTIG printf("pmap_init(%lx, %lx)\n", avail_start, avail_end); #else diff --git a/sys/arch/arc/arc/trap.c b/sys/arch/arc/arc/trap.c index 615004f9935..8c60becc1c7 100644 --- a/sys/arch/arc/arc/trap.c +++ b/sys/arch/arc/arc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.5 1996/09/02 11:33:24 pefo Exp $ */ +/* $OpenBSD: trap.c,v 1.6 1996/09/14 15:58:18 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ * from: Utah Hdr: trap.c 1.32 91/04/06 * * from: @(#)trap.c 8.5 (Berkeley) 1/11/94 - * $Id: trap.c,v 1.5 1996/09/02 11:33:24 pefo Exp $ + * $Id: trap.c,v 1.6 1996/09/14 15:58:18 pefo Exp $ */ #include <sys/param.h> @@ -335,8 +335,7 @@ trap(statusReg, causeReg, vadr, pc, args) } entry |= PG_M; pte->pt_entry = entry; - vadr = (vadr & ~PGOFSET) | - (pmap->pm_tlbpid << VMTLB_PID_SHIFT); + vadr = (vadr & ~PGOFSET) | (pmap->pm_tlbpid << VMTLB_PID_SHIFT); R4K_TLBUpdate(vadr, entry); pa = pfn_to_vad(entry); #ifdef ATTR @@ -840,6 +839,9 @@ interrupt(statusReg, causeReg, pc, what, args) cnt.v_intr++; mask = causeReg & statusReg; /* pending interrupts & enable mask */ + cf.pc = pc; + cf.sr = statusReg; + cf.cr = causeReg; /* * Check off all enabled interrupts. Called interrupt routine @@ -847,7 +849,7 @@ interrupt(statusReg, causeReg, pc, what, args) */ for(i = 0; i < 5; i++) { if(cpu_int_tab[i].int_mask & mask) { - causeReg &= (*cpu_int_tab[i].int_hand)(mask, pc, statusReg, causeReg); + causeReg &= (*cpu_int_tab[i].int_hand)(mask, &cf); } } /* diff --git a/sys/arch/arc/conf/GENERIC b/sys/arch/arc/conf/GENERIC index 2904f35b042..1ad298a0ee7 100644 --- a/sys/arch/arc/conf/GENERIC +++ b/sys/arch/arc/conf/GENERIC @@ -1,72 +1,78 @@ +# $OpenBSD: GENERIC,v 1.4 1996/09/14 15:58:19 pefo Exp $ # -# Generic configuration file for MIPS R4400 PICA system +# Generic configuration file for MIPS R4x00 ARC Systems # machine arc -maxusers 8 +maxusers 32 # Need to set locally -options TIMEZONE="8*60" # minutes west of GMT (for) -options DST=1 # use daylight savings rules +options TIMEZONE=0 # minutes west of GMT (for) +options DST=0 # use daylight savings rules # Standard system options options SWAPPAGER # swap pager (anonymous and swap space) options VNODEPAGER # vnode pager (mapped files) options DEVPAGER # device pager (mapped devices) + options DIAGNOSTIC # extra kernel debugging checks options DEBUG # extra kernel debugging support -options "COMPAT_43" # compatibility with 4.3BSD binaries -#options KTRACE # system call tracing support -options "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool -#options KGDB # support for kernel gdb -#options "KGDBRATE=19200" # kernel gdb port rate (default 9600) -#options "KGDBDEV=15*256+0" # device for kernel gdb +options COMPAT_43 # compatibility with 4.3BSD binaries +options KTRACE # system call tracing support # System V options options SYSVMSG # System V-like message queues options SYSVSEM # System V-like semaphores options SYSVSHM # System V-like memory sharing options SHMMAXPGS=1024 # 1024 pages is the default -options NATIVE_ELF +options NATIVE_ELF # Arc systems uses ELF as native format # Filesystem options +options CD9660 # ISO 9660 + Rock Ridge file system +options FDESC # user file descriptor filesystem (/dev/fd) options FIFO # POSIX fifo support (in all filesystems) options FFS,QUOTA # fast filesystem with user and group quotas +options KERNFS # kernel data-structure filesystem +#options LFS # Log-based filesystem (still experimental) options MFS # memory-based filesystem +options MSDOSFS # Ability to read write MS-Dos filsystem options NFSCLIENT # Sun NFS-compatible filesystem (client) options NFSSERVER # Sun NFS-compatible filesystem (server) -options KERNFS # kernel data-structure filesystem -options MSDOSFS # Ability to read write MS-Dos filsystem -options CD9660 # ISO 9660 + Rock Ridge file system -options FDESC # user file descriptor filesystem -#options UMAPFS # uid/gid remapping filesystem -#options NULLFS # null layer filesystem -#options LFS # Log-based filesystem (still experimental) -#options PORTAL # portal filesystem (still experimental) +options NULLFS # null layer filesystem +options PORTAL # portal filesystem (still experimental) +options UMAPFS # uid/gid remapping filesystem # Networking options -options INET # Internet protocols -#options "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP -options GATEWAY # IP packet forwarding -#options MULTICAST # Multicast support -#options MROUTING # Multicast routing support -#options ISO # OSI networking -#options TPIP -#options EON +options INET # Internet protocols +#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP +#options GATEWAY # IP packet forwarding +#options MULTICAST # Multicast support +#options MROUTING # Multicast routing support +#options ISO # OSI networking +#options TPIP +#options EON -config bsd swap generic +# Special options +options MACHINE_NONCONTIG # Support noncontigous memory. +# Specify storage configuration +config bsd swap generic + +# +# Definition of system +# mainbus0 at root cpu* at mainbus0 pica* at mainbus0 + clock0 at pica? pc0 at pica? pms0 at pica? ace0 at pica? ace1 at pica? -lpt0 at pica? +lpr0 at pica? sn0 at pica? fdc0 at pica? @@ -82,13 +88,34 @@ ch* at scsibus? target ? lun ? ss* at scsibus? target ? lun ? uk* at scsibus? target ? lun ? -isabr* at mainbus0 +# +# ISA Bus. +# +isabr* at mainbus0 + +isa* at isabr? + +clock0 at isa? + +pc0 at isa? port 0x60 irq 1 # generic PC console device +ace0 at isa? port 0x3f8 irq 4 +ace1 at isa? port 0x2f8 irq 3 +ace2 at isa? port 0x3e8 irq 4 +ace3 at isa? port 0x2e8 irq 3 + +lpt0 at isa? port 0x378 irq 7 +ep0 at isa? port ? irq ? # 3C509 ethernet cards +#ed0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC, 3C503, and NE[12]000 + +btl0 at isa? port 0x330 irq ? drq ? +scsibus* at btl? -isa* at isabr? pseudo-device sl 2 # serial-line IP ports pseudo-device ppp 2 # serial-line PPP ports +pseudo-device tun 2 # network tunneling over tty pseudo-device pty 64 # pseudo ptys -pseudo-device bpfilter 16 # packet filter ports -pseudo-device loop -pseudo-device vnd 4 # virtual disk +pseudo-device tb 1 # tablet line discipline +pseudo-device bpfilter 8 # packet filter ports +pseudo-device loop 1 # network loopback +pseudo-device vnd 4 # paging to files diff --git a/sys/arch/arc/conf/files.arc b/sys/arch/arc/conf/files.arc index d7b2d12754b..66d183f3b32 100644 --- a/sys/arch/arc/conf/files.arc +++ b/sys/arch/arc/conf/files.arc @@ -1,8 +1,8 @@ -# $OpenBSD: files.arc,v 1.3 1996/09/06 04:57:50 imp Exp $ +# $OpenBSD: files.arc,v 1.4 1996/09/14 15:58:20 pefo Exp $ # # maxpartitions must be first item in files.${ARCH} # -maxpartitions 8 +maxpartitions 16 maxusers 2 8 64 @@ -53,12 +53,6 @@ device pica {} attach pica at mainbus # { slot = -1, offset = -1 } file arch/arc/pica/picabus.c pica -# Real time clock, must have one.. -device clock -attach clock at pica -file arch/arc/arc/clock.c clock -file arch/arc/arc/clock_mc.c clock - # Ethernet chip device sn attach sn at pica: ifnet, ether @@ -74,13 +68,6 @@ device asc: scsi attach asc at pica file arch/arc/dev/asc.c asc needs-count -# Console driver on PC-style graphics -device pc: tty -attach pc at pica -device pms: tty -attach pms at pica -file arch/arc/dev/pccons.c pc needs-count - # Floppy disk controller device fdc {drive = -1} attach fdc at pica @@ -106,6 +93,21 @@ define pci {} # XXX dummy decl... include "../../../dev/isa/files.isa" +# Real time clock, must have one.. +device clock +attach clock at pica with clock_pica +attach clock at isa with clock_isa +file arch/arc/arc/clock.c clock & (clock_isa | clock_pica) needs-flag +file arch/arc/arc/clock_mc.c clock & (clock_isa | clock_pica) needs-flag + +# Console driver on PC-style graphics +device pc: tty +attach pc at pica with pc_pica +attach pc at isa with pc_isa +device pms: tty +attach pms at pica +file arch/arc/dev/pccons.c pc & (pc_pica | pc_isa) needs-flag + # Serial driver for both ISA and LOCAL bus. device ace: tty attach ace at isa with ace_isa @@ -119,6 +121,19 @@ attach lpr at isa with lpr_isa attach lpr at pica with lpr_pica file arch/arc/dev/lpr.c lpr & (lpr_isa | lpr_pica) needs-flag +# BusLogic BT-445C VLB SCSI Controller. Special on local bus. +device btl: scsi +attach btl at isa +file arch/arc/isa/btl.c btl needs-count + +# National Semiconductor DS8390/WD83C690-based boards +# (WD/SMC 80x3 family, SMC Ultra [8216], 3Com 3C503, NE[12]000, and clones) +# XXX conflicts with other ports; can't be in files.isa +device ed: ether, ifnet +attach ed at isa with ed_isa +attach ed at pcmcia with ed_pcmcia +file dev/isa/if_ed.c ed & (ed_isa | ed_pcmcia) needs-flag + # file dev/cons.c diff --git a/sys/arch/arc/dev/ace.c b/sys/arch/arc/dev/ace.c index b9d91d0f5be..6820a2e9b39 100644 --- a/sys/arch/arc/dev/ace.c +++ b/sys/arch/arc/dev/ace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ace.c,v 1.5 1996/09/02 09:01:49 deraadt Exp $ */ +/* $OpenBSD: ace.c,v 1.6 1996/09/14 15:58:21 pefo Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /*- @@ -57,6 +57,7 @@ #include <sys/types.h> #include <sys/device.h> +#include <arc/arc/arctype.h> #include <machine/bus.h> #include <machine/intr.h> @@ -1677,10 +1678,16 @@ acecnprobe(cp) struct consdev *cp; { /* XXX NEEDS TO BE FIXED XXX */ + extern int cputype; bus_chipset_tag_t bc = 0; bus_io_handle_t ioh; int found; + cp->cn_pri = CN_DEAD; + + if(cputype != ACER_PICA_61) + return; + if (bus_io_map(bc, CONADDR, COM_NPORTS, &ioh)) { cp->cn_pri = CN_DEAD; return; @@ -1688,7 +1695,6 @@ acecnprobe(cp) ioh = CONADDR; found = comprobe1(bc, ioh, CONADDR); if (!found) { - cp->cn_pri = CN_DEAD; return; } diff --git a/sys/arch/arc/dev/lpr.c b/sys/arch/arc/dev/lpr.c index 75f8f99f9d6..7f84a7b96b6 100644 --- a/sys/arch/arc/dev/lpr.c +++ b/sys/arch/arc/dev/lpr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpr.c,v 1.1 1996/06/24 20:10:34 pefo Exp $ */ +/* $OpenBSD: lpr.c,v 1.2 1996/09/14 15:58:21 pefo Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -118,7 +118,7 @@ int lprintr __P((void *)); #if NLPR_ISA int lpr_isa_probe __P((struct device *, void *, void *)); void lpr_isa_attach __P((struct device *, struct device *, void *)); -struct cfattach lpr_ca = { +struct cfattach lpr_isa_ca = { sizeof(struct lpr_softc), lpr_isa_probe, lpr_isa_attach }; #endif diff --git a/sys/arch/arc/dev/pccons.c b/sys/arch/arc/dev/pccons.c index 82d48e84ac6..0bd14436d4b 100644 --- a/sys/arch/arc/dev/pccons.c +++ b/sys/arch/arc/dev/pccons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pccons.c,v 1.6 1996/09/05 08:04:16 pefo Exp $ */ +/* $OpenBSD: pccons.c,v 1.7 1996/09/14 15:58:22 pefo Exp $ */ /* $NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp $ */ /*- @@ -76,6 +76,7 @@ #include <arc/dti/desktech.h> #include <dev/isa/isavar.h> +#include <arc/isa/isa_machdep.h> #include <machine/kbdreg.h> extern int cputype; @@ -147,13 +148,17 @@ int pcprobe __P((struct device *, void *, void *)); void pcattach __P((struct device *, struct device *, void *)); int pcintr __P((void *)); -struct cfattach pc_ca = { - sizeof(struct pc_softc), pcprobe, pcattach -}; struct cfdriver pc_cd = { NULL, "pc", DV_TTY, NULL, 0 }; +struct cfattach pc_pica_ca = { + sizeof(struct pc_softc), pcprobe, pcattach +}; + +struct cfattach pc_isa_ca = { + sizeof(struct pc_softc), pcprobe, pcattach +}; int pmsprobe __P((struct device *, void *, void *)); void pmsattach __P((struct device *, struct device *, void *)); int pmsintr __P((void *)); @@ -167,16 +172,15 @@ struct cfdriver pms_cd = { #define PMSUNIT(dev) (minor(dev)) -#define COL 80 -#define ROW 25 #define CHR 2 static unsigned int addr_6845; -static unsigned int mono_base; -static unsigned int mono_buf; -static unsigned int cga_base; -static unsigned int cga_buf; -static unsigned int kbd_base; +static unsigned int mono_base = 0x3b4; +static unsigned int mono_buf = 0xb0000; +static unsigned int cga_base = 0x3d4; +static unsigned int cga_buf = 0xb8000; +static unsigned int kbd_cmdp = 0x64; +static unsigned int kbd_datap = 0x60; char *sget __P((void)); void sput __P((u_char *, int)); @@ -196,7 +200,7 @@ kbd_wait_output() u_int i; for (i = 100000; i; i--) - if ((inb(kbd_base + KBSTATP) & KBS_IBF) == 0) { + if ((inb(kbd_cmdp) & KBS_IBF) == 0) { KBD_DELAY; return 1; } @@ -209,7 +213,7 @@ kbd_wait_input() u_int i; for (i = 100000; i; i--) - if ((inb(kbd_base + KBSTATP) & KBS_DIB) != 0) { + if ((inb(kbd_cmdp) & KBS_DIB) != 0) { KBD_DELAY; return 1; } @@ -221,12 +225,12 @@ kbd_flush_input() { u_char c; - while (c = inb(kbd_base + KBSTATP) & 0x03) + while (c = inb(kbd_cmdp) & 0x03) if ((c & KBS_DIB) == KBS_DIB) { /* XXX - delay is needed to prevent some keyboards from wedging when the system boots */ delay(6); - (void) inb(kbd_base + KBDATAP); + (void) inb(kbd_datap); } } @@ -241,10 +245,10 @@ kbc_get8042cmd() if (!kbd_wait_output()) return -1; - outb(kbd_base + KBCMDP, K_RDCMDBYTE); + outb(kbd_cmdp, K_RDCMDBYTE); if (!kbd_wait_input()) return -1; - return inb(kbd_base + KBDATAP); + return inb(kbd_datap); } #endif @@ -258,10 +262,10 @@ kbc_put8042cmd(val) if (!kbd_wait_output()) return 0; - outb(kbd_base + KBCMDP, K_LDCMDBYTE); + outb(kbd_cmdp, K_LDCMDBYTE); if (!kbd_wait_output()) return 0; - outb(kbd_base + KBOUTP, val); + outb(kbd_datap, val); return 1; } @@ -279,7 +283,7 @@ kbd_cmd(val, polling) if(!polling) { i = spltty(); if(kb_oq_get == kb_oq_put) { - outb(kbd_base + KBOUTP, val); + outb(kbd_datap, val); } kb_oq[kb_oq_put] = val; kb_oq_put = (kb_oq_put + 1) & 7; @@ -289,13 +293,13 @@ kbd_cmd(val, polling) else do { if (!kbd_wait_output()) return 0; - outb(kbd_base + KBOUTP, val); + outb(kbd_datap, val); for (i = 100000; i; i--) { - if (inb(kbd_base + KBSTATP) & KBS_DIB) { + if (inb(kbd_cmdp) & KBS_DIB) { register u_char c; KBD_DELAY; - c = inb(kbd_base + KBDATAP); + c = inb(kbd_datap); if (c == KBR_ACK || c == KBR_ECHO) { return 1; } @@ -416,8 +420,10 @@ pcprobe(parent, cfdata, aux) u_int i; /* Make shure we're looking for this type of device */ - if(!BUS_MATCHNAME(ca, "pc")) - return(0); + if(!strcmp((parent)->dv_cfdata->cf_driver->cd_name, "pica")) { + if(!BUS_MATCHNAME(ca, "pc")) + return(0); + } /* Enable interrupts and keyboard, etc. */ if (!kbc_put8042cmd(CMDBYTE)) { @@ -434,11 +440,11 @@ pcprobe(parent, cfdata, aux) goto lose; } for (i = 600000; i; i--) - if ((inb(kbd_base + KBSTATP) & KBS_DIB) != 0) { + if ((inb(kbd_cmdp) & KBS_DIB) != 0) { KBD_DELAY; break; } - if (i == 0 || inb(kbd_base + KBDATAP) != KBR_RSTDONE) { + if (i == 0 || inb(kbd_datap) != KBR_RSTDONE) { printf("pcprobe: reset error %d\n", 2); goto lose; } @@ -497,12 +503,21 @@ pcattach(parent, self, aux) void *aux; { struct confargs *ca = aux; + struct isa_attach_args *ia = aux; struct pc_softc *sc = (void *)self; printf(": %s\n", vs.color ? "color" : "mono"); do_async_update(1); - BUS_INTR_ESTABLISH(ca, pcintr, (void *)(long)sc); + switch(cputype) { + case ACER_PICA_61: + BUS_INTR_ESTABLISH(ca, pcintr, (void *)(long)sc); + break; + case DESKSTATION_TYNE: + isa_intr_establish(ia->ia_ic, ia->ia_irq, 1, + 2, pcintr, sc, sc->sc_dev.dv_xname); /*XXX ick */ + break; + } } int @@ -612,7 +627,7 @@ pcintr(arg) register struct tty *tp = sc->sc_tty; u_char *cp; - if ((inb(kbd_base + KBSTATP) & KBS_DIB) == 0) + if ((inb(kbd_cmdp) & KBS_DIB) == 0) return 0; if (polling) return 1; @@ -624,7 +639,7 @@ pcintr(arg) do (*linesw[tp->t_line].l_rint)(*cp++, tp); while (*cp); - } while (inb(kbd_base + KBSTATP) & KBS_DIB); + } while (inb(kbd_cmdp) & KBS_DIB); return 1; } @@ -788,21 +803,24 @@ pccninit(cp) switch(cputype) { case ACER_PICA_61: - mono_base = PICA_MONO_BASE; - mono_buf = PICA_MONO_BUF; - cga_base = PICA_CGA_BASE; - cga_buf = PICA_CGA_BUF; - kbd_base = PICA_SYS_KBD; + mono_base += PICA_V_LOCAL_VIDEO_CTRL; + mono_buf += PICA_V_LOCAL_VIDEO; + cga_base += PICA_V_LOCAL_VIDEO_CTRL; + cga_buf += PICA_V_LOCAL_VIDEO; + kbd_cmdp = PICA_SYS_KBD + 0x61; + kbd_datap = PICA_SYS_KBD + 0x60; break; case DESKSTATION_TYNE: - mono_base = PICA_MONO_BASE; - mono_buf = PICA_MONO_BUF; - cga_base = PICA_CGA_BASE; - cga_buf = PICA_CGA_BUF; - kbd_base = PICA_SYS_KBD; + mono_base += TYNE_V_ISA_IO; + mono_buf += TYNE_V_ISA_MEM; + cga_base += TYNE_V_ISA_IO; + cga_buf += TYNE_V_ISA_MEM; + kbd_cmdp = TYNE_V_ISA_IO + 0x64; + kbd_datap = TYNE_V_ISA_IO + 0x60; outb(TYNE_V_ISA_IO + 0x3ce, 6); /* Correct video mode */ - outb(TYNE_V_ISA_IO + 0x3cf, 0xe); + outb(TYNE_V_ISA_IO + 0x3cf, inb(TYNE_V_ISA_IO + 0x3cf) | 0xc); + kbc_put8042cmd(CMDBYTE); /* Want XT codes.. */ break; } } @@ -834,7 +852,7 @@ pccngetc(dev) do { /* wait for byte */ - while ((inb(kbd_base + KBSTATP) & KBS_DIB) == 0); + while ((inb(kbd_cmdp) & KBS_DIB) == 0); /* see if it's worthwhile */ cp = sget(); } while (!cp); @@ -937,15 +955,15 @@ sput(cp, n) return; if (crtat == 0) { - u_short volatile *cp; + volatile u_short *cp; u_short was; unsigned cursorat; - cp = (u_short *)cga_buf; + cp = (volatile u_short *)cga_buf; was = *cp; - *cp = (u_short) 0xA55A; + *cp = (volatile u_short) 0xA55A; if (*cp != 0xA55A) { - cp = (u_short *)mono_buf; + cp = (volatile u_short *)mono_buf; addr_6845 = mono_base; vs.color = 0; } else { @@ -954,26 +972,22 @@ sput(cp, n) vs.color = 1; } - /* Extract cursor location */ - outb(addr_6845, 14); - cursorat = inb(addr_6845+1) << 8; - outb(addr_6845, 15); - cursorat |= inb(addr_6845+1); - #ifdef FAT_CURSOR cursor_shape = 0x0012; #else get_cursor_shape(); #endif - Crtat = (u_short *)cp; - crtat = (u_short *)(cp + cursorat); - - vs.ncol = COL; - vs.nrow = ROW; - vs.nchr = COL * ROW; + bios_display_info(&vs.col, &vs.row, &vs.ncol, &vs.nrow); + vs.nchr = vs.ncol * vs.nrow; + vs.col--; + vs.row--; + cursorat = vs.ncol * vs.row + vs.col; vs.at = FG_LIGHTGREY | BG_BLACK; + Crtat = (u_short *)cp; + crtat = Crtat + cursorat; + if (vs.color == 0) vs.so_at = FG_BLACK | BG_LIGHTGREY; else @@ -1002,8 +1016,8 @@ sput(cp, n) vs.col += inccol; } maybe_scroll: - if (vs.col >= COL) { - vs.col -= COL; + if (vs.col >= vs.ncol) { + vs.col -= vs.ncol; scroll = 1; } break; @@ -1013,7 +1027,7 @@ sput(cp, n) break; --crtat; if (--vs.col < 0) - vs.col += COL; /* non-destructive backspace */ + vs.col += vs.ncol; /* non-destructive backspace */ break; case '\r': @@ -1506,17 +1520,17 @@ sget() top: KBD_DELAY; - dt = inb(kbd_base + KBDATAP); + dt = inb(kbd_datap); switch (dt) { case KBR_ACK: case KBR_ECHO: kb_oq_get = (kb_oq_get + 1) & 7; if(kb_oq_get != kb_oq_put) { - outb(kbd_base + KBOUTP, kb_oq[kb_oq_get]); + outb(kbd_datap, kb_oq[kb_oq_get]); } goto loop; case KBR_RESEND: - outb(kbd_base + KBOUTP, kb_oq[kb_oq_get]); + outb(kbd_datap, kb_oq[kb_oq_get]); goto loop; } @@ -1719,7 +1733,7 @@ printf("keycode %d\n",dt); extended = 0; loop: - if ((inb(kbd_base + KBSTATP) & KBS_DIB) == 0) + if ((inb(kbd_cmdp) & KBS_DIB) == 0) return 0; goto top; } @@ -1765,7 +1779,6 @@ pc_xmode_off() #endif async_update(); } -/* $NetBSD: pms.c,v 1.21 1995/04/18 02:25:18 mycroft Exp $ */ #include <machine/mouse.h> @@ -1802,9 +1815,9 @@ pms_dev_cmd(value) u_char value; { kbd_flush_input(); - outb(kbd_base + KBCMDP, 0xd4); + outb(kbd_cmdp, 0xd4); kbd_flush_input(); - outb(kbd_base + KBDATAP, value); + outb(kbd_datap, value); } static inline void @@ -1812,7 +1825,7 @@ pms_aux_cmd(value) u_char value; { kbd_flush_input(); - outb(kbd_base + KBCMDP, value); + outb(kbd_cmdp, value); } static inline void @@ -1820,9 +1833,9 @@ pms_pit_cmd(value) u_char value; { kbd_flush_input(); - outb(kbd_base + KBCMDP, 0x60); + outb(kbd_cmdp, 0x60); kbd_flush_input(); - outb(kbd_base + KBDATAP, value); + outb(kbd_datap, value); } int @@ -1840,7 +1853,7 @@ pmsprobe(parent, probe, aux) pms_dev_cmd(KBC_RESET); pms_aux_cmd(PMS_MAGIC_1); delay(10000); - x = inb(kbd_base + KBDATAP); + x = inb(kbd_datap); pms_pit_cmd(PMS_INT_DISABLE); if (x & 0x04) return 0; @@ -2048,20 +2061,20 @@ pmsintr(arg) switch (state) { case 0: - buttons = inb(kbd_base + KBDATAP); + buttons = inb(kbd_datap); if ((buttons & 0xc0) == 0) ++state; break; case 1: - dx = inb(kbd_base + KBDATAP); + dx = inb(kbd_datap); /* Bounding at -127 avoids a bug in XFree86. */ dx = (dx == -128) ? -127 : dx; ++state; break; case 2: - dy = inb(kbd_base + KBDATAP); + dy = inb(kbd_datap); dy = (dy == -128) ? -127 : dy; state = 0; @@ -2122,4 +2135,5 @@ pmsselect(dev, rw, p) splx(s); return ret; + } diff --git a/sys/arch/arc/dti/desktech.h b/sys/arch/arc/dti/desktech.h index 71bca68edfe..41b0f713f13 100644 --- a/sys/arch/arc/dti/desktech.h +++ b/sys/arch/arc/dti/desktech.h @@ -1,4 +1,4 @@ -/* $OpenBSD: desktech.h,v 1.1 1996/09/05 08:01:15 pefo Exp $ */ +/* $OpenBSD: desktech.h,v 1.2 1996/09/14 15:58:23 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -53,25 +53,16 @@ * I/O map */ -#define TYNE_P_BOUNCE (0x0900000000LL) /* Dma bounce buffer */ -#define TYNE_V_BOUNCE 0xe0000000 -#define TYNE_S_BOUNCE 0x00010000 - -#define TYNE_P_ISA_IO (0x0100800000LL) /* ISA I/O control */ -#define TYNE_V_ISA_IO 0xe2000000 -#define TYNE_S_ISA_IO 0x01000000 +#define TYNE_P_ISA_IO (0x0900000000LL) /* ISA I/O Control */ +#define TYNE_V_ISA_IO 0xe0000000 +#define TYNE_S_ISA_IO 0x00010000 #define TYNE_P_ISA_MEM (0x0100000000LL) /* ISA Memory control */ -#define TYNE_V_ISA_MEM 0xe3000000 +#define TYNE_V_ISA_MEM 0xe1000000 #define TYNE_S_ISA_MEM 0x01000000 -/* - * Addresses used by various display drivers. - */ -#define TYNE_MONO_BASE (TYNE_V_ISA_IO + 0x3B4) -#define TYNE_MONO_BUF (TYNE_V_ISA_MEM + 0xB0000) -#define TYNE_CGA_BASE (TYNE_V_ISA_IO + 0x3D4) -#define TYNE_CGA_BUF (TYNE_V_ISA_MEM + 0xB8000) -#define TYNE_SYS_KBD (TYNE_V_ISA_IO) +#define TYNE_P_BOUNCE (0x0100800000LL) /* Dma bounce buffer */ +#define TYNE_V_BOUNCE 0xe2000000 +#define TYNE_S_BOUNCE 0x00020000 #endif /* _DESKTECH_H_ */ diff --git a/sys/arch/arc/dti/desktechbus.c b/sys/arch/arc/dti/desktechbus.c index 8cc4ed6f259..6a7aa4dbedc 100644 --- a/sys/arch/arc/dti/desktechbus.c +++ b/sys/arch/arc/dti/desktechbus.c @@ -1,32 +1,35 @@ -/* $OpenBSD: desktechbus.c,v 1.1 1996/09/05 08:01:16 pefo Exp $ */ -/* $NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp $ */ +/* $OpenBSD: desktechbus.c,v 1.2 1996/09/14 15:58:24 pefo Exp $ */ /* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * Author: Per Fogelstrom. (Mips R4x00) - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * Copyright (c) 1996 Per Fogelstrom * - * Carnegie Mellon requests users of this software to return to + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Per Fogelstrom. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. */ #include <sys/param.h> @@ -36,107 +39,107 @@ #include <machine/pio.h> #include <machine/autoconf.h> -#include <arc/pica/pica.h> #include <arc/arc/arctype.h> +#include <arc/dti/desktech.h> -struct pica_softc { +struct dti_softc { struct device sc_dv; struct abus sc_bus; - struct pica_dev *sc_devs; + struct dti_dev *sc_devs; }; /* Definition of the driver for autoconfig. */ -int picamatch(struct device *, void *, void *); -void picaattach(struct device *, struct device *, void *); -int picaprint(void *, char *); +int dtimatch(struct device *, void *, void *); +void dtiattach(struct device *, struct device *, void *); +int dtiprint(void *, char *); -struct cfattach pica_ca = { - sizeof(struct pica_softc), picamatch, picaattach +struct cfattach dti_ca = { + sizeof(struct dti_softc), dtimatch, dtiattach }; -struct cfdriver pica_cd = { - NULL, "pica", DV_DULL, NULL, 0 +struct cfdriver dti_cd = { + NULL, "dti", DV_DULL, NULL, 0 }; -void pica_intr_establish __P((struct confargs *, int (*)(void *), void *)); -void pica_intr_disestablish __P((struct confargs *)); -caddr_t pica_cvtaddr __P((struct confargs *)); -int pica_matchname __P((struct confargs *, char *)); -int pica_iointr __P((void *)); -int pica_clkintr __P((unsigned, unsigned, unsigned, unsigned)); +void dti_intr_establish __P((struct confargs *, int (*)(void *), void *)); +void dti_intr_disestablish __P((struct confargs *)); +caddr_t dti_cvtaddr __P((struct confargs *)); +int dti_matchname __P((struct confargs *, char *)); +int dti_iointr __P((void *)); +int dti_clkintr __P((unsigned, unsigned, unsigned, unsigned)); extern int cputype; /* * Interrupt dispatch table. */ -struct pica_int_desc int_table[] = { - {0, pica_intrnull, (void *)NULL, 0 }, /* 0 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 1 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 2 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 3 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 4 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 5 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 6 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 7 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 8 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 9 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 10 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 11 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 12 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 13 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 14 */ - {0, pica_intrnull, (void *)NULL, 0 }, /* 15 */ +struct dti_int_desc int_table[] = { + {0, dti_intrnull, (void *)NULL, 0 }, /* 0 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 1 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 2 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 3 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 4 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 5 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 6 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 7 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 8 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 9 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 10 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 11 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 12 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 13 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 14 */ + {0, dti_intrnull, (void *)NULL, 0 }, /* 15 */ }; -struct pica_dev { +struct dti_dev { struct confargs ps_ca; u_int ps_mask; intr_handler_t ps_handler; void *ps_base; }; #ifdef ACER_PICA_61 -struct pica_dev acer_pica_61_cpu[] = { +struct dti_dev acer_dti_61_cpu[] = { {{ "dallas_rtc",0, 0, }, - 0, pica_intrnull, (void *)PICA_SYS_CLOCK, }, + 0, dti_intrnull, (void *)PICA_SYS_CLOCK, }, {{ "lpr", 1, 0, }, - PICA_SYS_LB_IE_PAR1, pica_intrnull, (void *)PICA_SYS_PAR1, }, + PICA_SYS_LB_IE_PAR1, dti_intrnull, (void *)PICA_SYS_PAR1, }, {{ "fdc", 2, 0, }, - PICA_SYS_LB_IE_FLOPPY,pica_intrnull, (void *)PICA_SYS_FLOPPY, }, + PICA_SYS_LB_IE_FLOPPY,dti_intrnull, (void *)PICA_SYS_FLOPPY, }, {{ NULL, 3, NULL, }, - 0, pica_intrnull, (void *)NULL, }, + 0, dti_intrnull, (void *)NULL, }, {{ NULL, 4, NULL, }, - 0, pica_intrnull, (void *)NULL, }, + 0, dti_intrnull, (void *)NULL, }, {{ "sonic", 5, 0, }, - PICA_SYS_LB_IE_SONIC, pica_intrnull, (void *)PICA_SYS_SONIC, }, + PICA_SYS_LB_IE_SONIC, dti_intrnull, (void *)PICA_SYS_SONIC, }, {{ "asc", 6, 0, }, - PICA_SYS_LB_IE_SCSI, pica_intrnull, (void *)PICA_SYS_SCSI, }, + PICA_SYS_LB_IE_SCSI, dti_intrnull, (void *)PICA_SYS_SCSI, }, {{ "pc", 7, 0, }, - PICA_SYS_LB_IE_KBD, pica_intrnull, (void *)PICA_SYS_KBD, }, + PICA_SYS_LB_IE_KBD, dti_intrnull, (void *)PICA_SYS_KBD, }, {{ "pms", 8, NULL, }, - PICA_SYS_LB_IE_MOUSE, pica_intrnull, (void *)PICA_SYS_KBD, }, + PICA_SYS_LB_IE_MOUSE, dti_intrnull, (void *)PICA_SYS_KBD, }, {{ "com", 9, 0, }, - PICA_SYS_LB_IE_COM1, pica_intrnull, (void *)PICA_SYS_COM1, }, + PICA_SYS_LB_IE_COM1, dti_intrnull, (void *)PICA_SYS_COM1, }, {{ "com", 10, 0, }, - PICA_SYS_LB_IE_COM2, pica_intrnull, (void *)PICA_SYS_COM2, }, + PICA_SYS_LB_IE_COM2, dti_intrnull, (void *)PICA_SYS_COM2, }, {{ NULL, -1, NULL, }, 0, NULL, (void *)NULL, }, }; #endif -struct pica_dev *pica_cpu_devs[] = { +struct dti_dev *dti_cpu_devs[] = { NULL, /* Unused */ #ifdef ACER_PICA_61 - acer_pica_61_cpu, /* Acer PICA */ + acer_dti_61_cpu, /* Acer PICA */ #else NULL, #endif }; -int npica_cpu_devs = sizeof pica_cpu_devs / sizeof pica_cpu_devs[0]; +int ndti_cpu_devs = sizeof dti_cpu_devs / sizeof dti_cpu_devs[0]; int local_int_mask = 0; /* Local interrupt enable mask */ int -picamatch(parent, cfdata, aux) +dtimatch(parent, cfdata, aux) struct device *parent; void *cfdata; void *aux; @@ -145,44 +148,44 @@ picamatch(parent, cfdata, aux) struct confargs *ca = aux; /* Make sure that we're looking for a PICA. */ - if (strcmp(ca->ca_name, pica_cd.cd_name) != 0) + if (strcmp(ca->ca_name, dti_cd.cd_name) != 0) return (0); /* Make sure that unit exists. */ if (cf->cf_unit != 0 || - cputype > npica_cpu_devs || pica_cpu_devs[cputype] == NULL) + cputype > ndti_cpu_devs || dti_cpu_devs[cputype] == NULL) return (0); return (1); } void -picaattach(parent, self, aux) +dtiattach(parent, self, aux) struct device *parent; struct device *self; void *aux; { - struct pica_softc *sc = (struct pica_softc *)self; + struct dti_softc *sc = (struct dti_softc *)self; struct confargs *nca; int i; printf("\n"); /* keep our CPU device description handy */ - sc->sc_devs = pica_cpu_devs[cputype]; + sc->sc_devs = dti_cpu_devs[cputype]; /* set up interrupt handlers */ - set_intr(INT_MASK_1, pica_iointr, 2); + set_intr(INT_MASK_1, dti_iointr, 2); sc->sc_bus.ab_dv = (struct device *)sc; sc->sc_bus.ab_type = BUS_PICA; - sc->sc_bus.ab_intr_establish = pica_intr_establish; - sc->sc_bus.ab_intr_disestablish = pica_intr_disestablish; - sc->sc_bus.ab_cvtaddr = pica_cvtaddr; - sc->sc_bus.ab_matchname = pica_matchname; + sc->sc_bus.ab_intr_establish = dti_intr_establish; + sc->sc_bus.ab_intr_disestablish = dti_intr_disestablish; + sc->sc_bus.ab_cvtaddr = dti_cvtaddr; + sc->sc_bus.ab_matchname = dti_matchname; /* Initialize PICA Dma */ - picaDmaInit(); + dtiDmaInit(); /* Try to configure each PICA attached device */ for (i = 0; sc->sc_devs[i].ps_ca.ca_slot >= 0; i++) { @@ -194,12 +197,12 @@ picaattach(parent, self, aux) nca->ca_bus = &sc->sc_bus; /* Tell the autoconfig machinery we've found the hardware. */ - config_found(self, nca, picaprint); + config_found(self, nca, dtiprint); } } int -picaprint(aux, pnp) +dtiprint(aux, pnp) void *aux; char *pnp; { @@ -212,32 +215,32 @@ picaprint(aux, pnp) } caddr_t -pica_cvtaddr(ca) +dti_cvtaddr(ca) struct confargs *ca; { - struct pica_softc *sc = pica_cd.cd_devs[0]; + struct dti_softc *sc = dti_cd.cd_devs[0]; return(sc->sc_devs[ca->ca_slot].ps_base + ca->ca_offset); } void -pica_intr_establish(ca, handler, val) +dti_intr_establish(ca, handler, val) struct confargs *ca; intr_handler_t handler; void *val; { - struct pica_softc *sc = pica_cd.cd_devs[0]; + struct dti_softc *sc = dti_cd.cd_devs[0]; int slot; slot = ca->ca_slot; if(slot == 0) { /* Slot 0 is special, clock */ - set_intr(INT_MASK_4, pica_clkintr, 1); + set_intr(INT_MASK_4, dti_clkintr, 1); } if(int_table[slot].int_mask != 0) { - panic("pica intr already set"); + panic("dti intr already set"); } else { int_table[slot].int_mask = sc->sc_devs[slot].ps_mask;; @@ -249,10 +252,10 @@ pica_intr_establish(ca, handler, val) } void -pica_intr_disestablish(ca) +dti_intr_disestablish(ca) struct confargs *ca; { - struct pica_softc *sc = pica_cd.cd_devs[0]; + struct dti_softc *sc = dti_cd.cd_devs[0]; int slot; @@ -262,13 +265,13 @@ pica_intr_disestablish(ca) else { local_int_mask &= ~int_table[slot].int_mask; int_table[slot].int_mask = 0; - int_table[slot].int_hand = pica_intrnull; + int_table[slot].int_hand = dti_intrnull; int_table[slot].param = (void *)NULL; } } int -pica_matchname(ca, name) +dti_matchname(ca, name) struct confargs *ca; char *name; { @@ -276,17 +279,17 @@ pica_matchname(ca, name) } int -pica_intrnull(val) +dti_intrnull(val) void *val; { panic("uncaught PICA intr for slot %d\n", val); } /* - * Handle pica i/o interrupt. + * Handle dti i/o interrupt. */ int -pica_iointr(val) +dti_iointr(val) void *val; { int vector; @@ -298,10 +301,10 @@ pica_iointr(val) } /* - * Handle pica interval clock interrupt. + * Handle dti interval clock interrupt. */ int -pica_clkintr(mask, pc, statusReg, causeReg) +dti_clkintr(mask, pc, statusReg, causeReg) unsigned mask; unsigned pc; unsigned statusReg; diff --git a/sys/arch/arc/include/bus.h b/sys/arch/arc/include/bus.h index c9ab54932a2..77db1fa692c 100644 --- a/sys/arch/arc/include/bus.h +++ b/sys/arch/arc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.3 1996/07/30 20:24:24 pefo Exp $ */ +/* $OpenBSD: bus.h,v 1.4 1996/09/14 15:58:25 pefo Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -101,7 +101,7 @@ struct arc_isa_busmap { #endif #define bus_mem_map(t, addr, size, cacheable, mhp) \ - (*mhp = (t == NULL ? port : port + (ulong)(t->isa_mem_base)), 0) + (*mhp = (bus_mem_handle_t)(t == NULL ? addr : addr + (ulong)(t->isa_mem_base)), 0) #define bus_mem_unmap(t, ioh, size) #define bus_mem_read_1(t, h, o) (*(volatile u_int8_t *)((h) + (o))) diff --git a/sys/arch/arc/include/cpu.h b/sys/arch/arc/include/cpu.h index 3330f03c8b9..033e0414373 100644 --- a/sys/arch/arc/include/cpu.h +++ b/sys/arch/arc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.3 1996/08/26 11:12:02 pefo Exp $ */ +/* $OpenBSD: cpu.h,v 1.4 1996/09/14 15:58:25 pefo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -297,6 +297,7 @@ struct clockframe { int pc; /* program counter at time of interrupt */ int sr; /* status register at time of interrupt */ + int cr; /* cause register at time of interrupt */ }; #define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER) diff --git a/sys/arch/arc/include/memconf.h b/sys/arch/arc/include/memconf.h index c4e4e760b52..3064c1a04cd 100644 --- a/sys/arch/arc/include/memconf.h +++ b/sys/arch/arc/include/memconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: memconf.h,v 1.1 1996/08/26 11:12:02 pefo Exp $ */ +/* $OpenBSD: memconf.h,v 1.2 1996/09/14 15:58:26 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -43,7 +43,7 @@ struct mem_descriptor { }; #ifdef _KERNEL -#define MAXMEMSEGS 8 +#define MAXMEMSEGS 16 extern struct mem_descriptor mem_layout[]; #endif diff --git a/sys/arch/arc/isa/isa_machdep.h b/sys/arch/arc/isa/isa_machdep.h index 24c104c3deb..060f511356a 100644 --- a/sys/arch/arc/isa/isa_machdep.h +++ b/sys/arch/arc/isa/isa_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ +/* $OpenBSD: isa_machdep.h,v 1.2 1996/09/14 15:58:26 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -34,6 +34,18 @@ typedef struct arc_isa_bus *isa_chipset_tag_t; +/* + * I/O macros to access isa bus ports/memory. + * At the first glance theese macros may seem inefficient. + * However, the cpu executes an instruction every 7.5ns + * so the bus is much slower so it doesn't matter, really. + */ +#define isa_outb(x,y) outb(isa_io_base + (x), y) +#define isa_inb(x) inb(isa_io_base + (x)) + +extern int isa_io_base; /* Base address for ISA I/O space */ +extern int isa_mem_base; /* Base address for ISA MEM space */ + struct arc_isa_bus { void *ic_data; diff --git a/sys/arch/arc/isa/isabus.c b/sys/arch/arc/isa/isabus.c index 75e5d5cb9d4..be51509192c 100644 --- a/sys/arch/arc/isa/isabus.c +++ b/sys/arch/arc/isa/isabus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isabus.c,v 1.2 1996/07/30 20:24:30 pefo Exp $ */ +/* $OpenBSD: isabus.c,v 1.3 1996/09/14 15:58:27 pefo Exp $ */ /* $NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp $ */ /*- @@ -108,20 +108,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <arc/isa/spkrreg.h> #include <arc/isa/isa_machdep.h> -extern int isa_io_base; /* Base address for ISA I/O space */ -extern int isa_mem_base; /* Base address for ISA MEM space */ - static int beeping; -/* - * I/O macros to access isa bus ports/memory. - * At the first glance theese macros may seem inefficient. - * However, the cpu executes an instruction every 7.5ns - * so the bus is much slower so it doesn't matter, really. - */ -#define isa_outb(x,y) outb(isa_io_base + (x), y) -#define isa_inb(x) inb(isa_io_base + (x)) - #define IRQ_SLAVE 2 #define ICU_LEN 16 @@ -147,7 +135,7 @@ struct cfdriver isabr_cd = { void *isabr_intr_establish __P((isa_chipset_tag_t, int, int, int, int (*)(void *), void *, char *)); void isabr_intr_disestablish __P((isa_chipset_tag_t, void*)); -int isabr_iointr __P((void *)); +int isabr_iointr __P((unsigned int, struct clockframe *)); void isabr_initicu(); extern int cputype; @@ -188,6 +176,9 @@ isabrattach(parent, self, aux) case ACER_PICA_61: set_intr(INT_MASK_2, isabr_iointr, 3); break; + case DESKSTATION_TYNE: + set_intr(INT_MASK_2, isabr_iointr, 2); + break; default: panic("isabrattach: unkown cputype!"); } @@ -216,7 +207,7 @@ isabrprint(aux, pnp) if (pnp) printf("%s at %s", ca->ca_name, pnp); - printf(" I/O base 0x%lx Mem base 0x%lx", isa_io_base, isa_mem_base); + printf(" isa_io_base 0x%lx isa_mem_base 0x%lx", isa_io_base, isa_mem_base); return (UNCONF); } @@ -231,7 +222,7 @@ int imen; int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN]; struct intrhand *intrhand[ICU_LEN]; -int fakeintr(void *arg) {return 0;} +int fakeintr(void *a) {return 0;} /* * Recalculate the interrupt masks from scratch. @@ -383,17 +374,35 @@ isabr_intr_disestablish(ic, arg) } /* - * Process an interrupt from the ISA bus ACER PICA style. + * Process an interrupt from the ISA bus. */ int -isabr_iointr(ca) - void *ca; /* XXX */ +isabr_iointr(mask, cf) + unsigned mask; + struct clockframe *cf; { struct intrhand *ih; int isa_vector; int o_imen; + char vector; - isa_vector = in32(R4030_SYS_ISA_VECTOR) & (ICU_LEN - 1); + switch(cputype) { + case ACER_PICA_61: + isa_vector = in32(R4030_SYS_ISA_VECTOR) & (ICU_LEN - 1); + break; + case DESKSTATION_TYNE: + isa_outb(IO_ICU1, 0x0f); /* Poll */ + vector = isa_inb(IO_ICU1); + if(vector > 0 || (isa_vector = vector & 7) == 2) { + isa_outb(IO_ICU2, 0x0f); + vector = isa_inb(IO_ICU2); + if(vector > 0) { + printf("isa: spurious interrupt.\n"); + return(~0); + } + isa_vector = (vector & 7) | 8; + } + } o_imen = imen; imen |= 1 << (isa_vector & (ICU_LEN - 1)); @@ -409,6 +418,10 @@ isabr_iointr(ca) isa_outb(IO_ICU1, 0x60 + isa_vector); } ih = intrhand[isa_vector]; + if(isa_vector == 0) { /* Clock */ /*XXX*/ + (*ih->ih_fun)(cf); + ih = ih->ih_next; + } while(ih) { (*ih->ih_fun)(ih->ih_arg); ih = ih->ih_next; @@ -426,7 +439,7 @@ isabr_iointr(ca) /* * Initialize the Interrupt controller logic. */ -void +void isabr_initicu() { diff --git a/sys/arch/arc/pica/pica.h b/sys/arch/arc/pica/pica.h index d1d9b7ecd6b..24f7438e71a 100644 --- a/sys/arch/arc/pica/pica.h +++ b/sys/arch/arc/pica/pica.h @@ -1,12 +1,8 @@ -/* $OpenBSD */ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * The Mach Operating System project at Carnegie-Mellon University, - * Ralph Campbell and Rick Macklem. - * +/* $OpenBSD: pica.h,v 1.4 1996/09/14 15:58:28 pefo Exp $ */ + +/* + * Copyright (c) 1994, 1995, 1996 Per Fogelstrom + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,17 +13,16 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * This product includes software developed under OpenBSD by + * Per Fogelstrom. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT @@ -35,22 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)pica.h 8.1 (Berkeley) 6/10/93 - * $Id: pica.h,v 1.3 1996/09/04 21:18:25 pefo Exp $ */ - -/* - * HISTORY - * Log: pica.h,v - * Created, from the ALI specs: - */ -/* - * File: pica.h - * Author: Per Fogelstrom - * Date: 1/95 - * - */ - #ifndef _PICA_H_ #define _PICA_H_ 1 diff --git a/sys/arch/arc/pica/picabus.c b/sys/arch/arc/pica/picabus.c index 5656c49f7ca..7b43a33e204 100644 --- a/sys/arch/arc/pica/picabus.c +++ b/sys/arch/arc/pica/picabus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: picabus.c,v 1.3 1996/07/30 20:24:32 pefo Exp $ */ +/* $OpenBSD: picabus.c,v 1.4 1996/09/14 15:58:29 pefo Exp $ */ /* $NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp $ */ /* @@ -61,8 +61,8 @@ void pica_intr_establish __P((struct confargs *, int (*)(void *), void *)); void pica_intr_disestablish __P((struct confargs *)); caddr_t pica_cvtaddr __P((struct confargs *)); int pica_matchname __P((struct confargs *, char *)); -int pica_iointr __P((void *)); -int pica_clkintr __P((unsigned, unsigned, unsigned, unsigned)); +int pica_iointr __P((unsigned int, struct clockframe *)); +int pica_clkintr __P((unsigned int, struct clockframe *)); extern int cputype; @@ -286,8 +286,9 @@ pica_intrnull(val) * Handle pica i/o interrupt. */ int -pica_iointr(val) - void *val; +pica_iointr(mask, cf) + unsigned mask; + struct clockframe *cf; { int vector; @@ -301,19 +302,14 @@ pica_iointr(val) * Handle pica interval clock interrupt. */ int -pica_clkintr(mask, pc, statusReg, causeReg) +pica_clkintr(mask, cf) unsigned mask; - unsigned pc; - unsigned statusReg; - unsigned causeReg; + struct clockframe *cf; { - struct clockframe cf; int temp; temp = inw(R4030_SYS_IT_STAT); - cf.pc = pc; - cf.sr = statusReg; - hardclock(&cf); + hardclock(cf); /* Re-enable clock interrupts */ splx(INT_MASK_4 | SR_INT_ENAB); |