-/* $OpenBSD: machdep.c,v 1.8 1996/09/02 21:33:29 imp Exp $ */
+/* $OpenBSD: machdep.c,v 1.9 1996/09/04 21:18:19 pefo Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
* SUCH DAMAGE.
*
* from: @(#)machdep.c 8.3 (Berkeley) 1/12/94
- * $Id: machdep.c,v 1.8 1996/09/02 21:33:29 imp Exp $
+ * $Id: machdep.c,v 1.9 1996/09/04 21:18:19 pefo Exp $
*/
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
#include <dev/cons.h>
-#include <arc/pica/pica.h>
#include <arc/arc/arctype.h>
+#include <arc/pica/pica.h>
+#include <arc/desktech/desktech.h>
#include <asc.h>
int (*Mach_splclock)() = splhigh;
int (*Mach_splstatclock)() = splhigh;
+static void tlb_init_pica();
+static void tlb_init_tyne();
+
void vid_print_string(const char *str);
void vid_putchar(dev_t dev, char c);
cputype = ACER_PICA_61; /* FIXME find systemtype */
+ cputype = DESKSTATION_TYNE; /* FIXME find systemtype */
+
/*
* Get config register now as mapped from BIOS since we are
* going to demap these addresses later. We want as may TLB
*/
switch (cputype) {
- case ACER_PICA_61: /* ALI PICA 61 */
- memcfg = in32(PICA_MEMORY_SIZE_REG);
- brdcfg = in32(PICA_CONFIG_REG);
- picacommon:
+ 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;
isa_mem_base = PICA_V_ISA_MEM;
- strcpy(cpu_model, "ACER PICA-61");
+
/*
* Set up interrupt handling and I/O addresses.
*/
mem_layout[2].mem_start = 0x0;
break;
- case MAGNUM:
- strcpy(cpu_model, "MIPS MAGNUM");
-
- /* XXX this is likely broken */
- memcfg = in32(R4030_SYS_CONFIG);
- goto picacommon;
- break;
-
case DESKSTATION_RPC44:
strcpy(cpu_model, "Deskstation rPC44");
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 * 32;
+ 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;
break;
default:
+/*XXX printf doesn't work here .... use bios?? */
printf("kernel not configured for systype 0x%x\n", i);
boot(RB_HALT | RB_NOSYNC);
}
physmem = btoc(physmem);
- /* look at argv[0] and compute bootdev */
+ /* look at argv[0] and compute bootdev for autoconfig setup */
makebootdev(argv[0]);
/*
R4K_SetWIRED(0);
R4K_TLBFlush();
R4K_SetWIRED(VMWIRED_ENTRIES);
+
+ switch (cputype) {
+ case ACER_PICA_61:
+ case MAGNUM:
+ tlb_init_pica();
+ break;
- /*
- * Set up mapping for hardware the way we want it!
- */
-
- tlb.tlb_mask = PG_SIZE_256K;
- tlb.tlb_hi = vad_to_vpn(R4030_V_LOCAL_IO_BASE);
- tlb.tlb_lo0 = vad_to_pfn(R4030_P_LOCAL_IO_BASE) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_INT_SOURCE) | PG_IOPAGE;
- R4K_TLBWriteIndexed(1, &tlb);
+ case DESKSTATION_TYNE:
+ tlb_init_tyne();
+ break;
+ }
- tlb.tlb_mask = PG_SIZE_1M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_LOCAL_VIDEO_CTRL);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_LOCAL_VIDEO_CTRL) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL/2) | PG_IOPAGE;
- R4K_TLBWriteIndexed(2, &tlb);
-
- tlb.tlb_mask = PG_SIZE_1M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_EXTND_VIDEO_CTRL);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_EXTND_VIDEO_CTRL) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL/2) | PG_IOPAGE;
- R4K_TLBWriteIndexed(3, &tlb);
-
- tlb.tlb_mask = PG_SIZE_4M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_LOCAL_VIDEO);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_LOCAL_VIDEO) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO/2) | PG_IOPAGE;
- R4K_TLBWriteIndexed(4, &tlb);
-
- tlb.tlb_mask = PG_SIZE_16M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_ISA_IO);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_ISA_IO) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_ISA_MEM) | PG_IOPAGE;
- R4K_TLBWriteIndexed(5, &tlb);
-
/*
* Init mapping for u page(s) for proc[0], pm_tlbpid 1.
*/
pmap_bootstrap((vm_offset_t)v);
}
+void
+tlb_init_pica()
+{
+ struct tlb tlb;
+
+ tlb.tlb_mask = PG_SIZE_256K;
+ tlb.tlb_hi = vad_to_vpn(R4030_V_LOCAL_IO_BASE);
+ tlb.tlb_lo0 = vad_to_pfn(R4030_P_LOCAL_IO_BASE) | PG_IOPAGE;
+ tlb.tlb_lo1 = vad_to_pfn(PICA_P_INT_SOURCE) | PG_IOPAGE;
+ R4K_TLBWriteIndexed(1, &tlb);
+
+ tlb.tlb_mask = PG_SIZE_1M;
+ tlb.tlb_hi = vad_to_vpn(PICA_V_LOCAL_VIDEO_CTRL);
+ tlb.tlb_lo0 = vad_to_pfn(PICA_P_LOCAL_VIDEO_CTRL) | PG_IOPAGE;
+ tlb.tlb_lo1 = vad_to_pfn(PICA_P_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL/2) | PG_IOPAGE;
+ R4K_TLBWriteIndexed(2, &tlb);
+
+ tlb.tlb_mask = PG_SIZE_1M;
+ tlb.tlb_hi = vad_to_vpn(PICA_V_EXTND_VIDEO_CTRL);
+ tlb.tlb_lo0 = vad_to_pfn(PICA_P_EXTND_VIDEO_CTRL) | PG_IOPAGE;
+ tlb.tlb_lo1 = vad_to_pfn(PICA_P_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL/2) | PG_IOPAGE;
+ R4K_TLBWriteIndexed(3, &tlb);
+
+ tlb.tlb_mask = PG_SIZE_4M;
+ tlb.tlb_hi = vad_to_vpn(PICA_V_LOCAL_VIDEO);
+ tlb.tlb_lo0 = vad_to_pfn(PICA_P_LOCAL_VIDEO) | PG_IOPAGE;
+ tlb.tlb_lo1 = vad_to_pfn(PICA_P_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO/2) | PG_IOPAGE;
+ R4K_TLBWriteIndexed(4, &tlb);
+
+ tlb.tlb_mask = PG_SIZE_16M;
+ tlb.tlb_hi = vad_to_vpn(PICA_V_ISA_IO);
+ tlb.tlb_lo0 = vad_to_pfn(PICA_P_ISA_IO) | PG_IOPAGE;
+ tlb.tlb_lo1 = vad_to_pfn(PICA_P_ISA_MEM) | PG_IOPAGE;
+ R4K_TLBWriteIndexed(5, &tlb);
+}
+
+void
+tlb_init_tyne()
+{
+ struct tlb tlb;
+
+ tlb.tlb_mask = PG_SIZE_64K;
+ 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;
+ R4K_TLBWriteIndexed(1, &tlb);
+
+ tlb.tlb_mask = PG_SIZE_1M;
+ tlb.tlb_hi = vad_to_vpn(TYNE_V_ISA_IO);
+ tlb.tlb_lo0 = vad_to_pfn64(TYNE_P_ISA_IO) | PG_IOPAGE;
+ tlb.tlb_lo1 = PG_G;
+ R4K_TLBWriteIndexed(2, &tlb);
+
+ tlb.tlb_mask = PG_SIZE_1M;
+ tlb.tlb_hi = vad_to_vpn(TYNE_V_ISA_MEM);
+ tlb.tlb_lo0 = vad_to_pfn64(TYNE_P_ISA_MEM) | PG_IOPAGE;
+ tlb.tlb_lo1 = PG_G;
+ R4K_TLBWriteIndexed(3, &tlb);
+}
+
/*
* Console initialization: called early on from main,
* before vm init or startup. Do enough configuration
-/* $OpenBSD: pccons.c,v 1.4 1996/09/01 19:41:16 deraadt Exp $ */
+/* $OpenBSD: pccons.c,v 1.5 1996/09/04 21:18:22 pefo Exp $ */
/* $NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp $ */
/*-
#include <machine/autoconf.h>
#include <machine/display.h>
#include <machine/pccons.h>
+#include <arc/arc/arctype.h>
#include <arc/pica/pica.h>
+#include <arc/desktech/desktech.h>
#include <dev/isa/isavar.h>
#include <machine/kbdreg.h>
+extern int cputype;
+
#define XFREE86_BUG_COMPAT
#ifndef BEEP_FREQ
#define ROW 25
#define CHR 2
-static unsigned int addr_6845 = MONO_BASE;
+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;
char *sget __P((void));
void sput __P((u_char *, int));
u_int i;
for (i = 100000; i; i--)
- if ((inb(KBSTATP) & KBS_IBF) == 0) {
+ if ((inb(kbd_base + KBSTATP) & KBS_IBF) == 0) {
KBD_DELAY;
return 1;
}
u_int i;
for (i = 100000; i; i--)
- if ((inb(KBSTATP) & KBS_DIB) != 0) {
+ if ((inb(kbd_base + KBSTATP) & KBS_DIB) != 0) {
KBD_DELAY;
return 1;
}
{
u_char c;
- while (c = inb(KBSTATP) & 0x03)
+ while (c = inb(kbd_base + KBSTATP) & 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(KBDATAP);
+ (void) inb(kbd_base + KBDATAP);
}
}
if (!kbd_wait_output())
return -1;
- outb(KBCMDP, K_RDCMDBYTE);
+ outb(kbd_base + KBCMDP, K_RDCMDBYTE);
if (!kbd_wait_input())
return -1;
- return inb(KBDATAP);
+ return inb(kbd_base + KBDATAP);
}
#endif
if (!kbd_wait_output())
return 0;
- outb(KBCMDP, K_LDCMDBYTE);
+ outb(kbd_base + KBCMDP, K_LDCMDBYTE);
if (!kbd_wait_output())
return 0;
- outb(KBOUTP, val);
+ outb(kbd_base + KBOUTP, val);
return 1;
}
if(!polling) {
i = spltty();
if(kb_oq_get == kb_oq_put) {
- outb(KBOUTP, val);
+ outb(kbd_base + KBOUTP, val);
}
kb_oq[kb_oq_put] = val;
kb_oq_put = (kb_oq_put + 1) & 7;
else do {
if (!kbd_wait_output())
return 0;
- outb(KBOUTP, val);
+ outb(kbd_base + KBOUTP, val);
for (i = 100000; i; i--) {
- if (inb(KBSTATP) & KBS_DIB) {
+ if (inb(kbd_base + KBSTATP) & KBS_DIB) {
register u_char c;
KBD_DELAY;
- c = inb(KBDATAP);
+ c = inb(kbd_base + KBDATAP);
if (c == KBR_ACK || c == KBR_ECHO) {
return 1;
}
goto lose;
}
for (i = 600000; i; i--)
- if ((inb(KBSTATP) & KBS_DIB) != 0) {
+ if ((inb(kbd_base + KBSTATP) & KBS_DIB) != 0) {
KBD_DELAY;
break;
}
- if (i == 0 || inb(KBDATAP) != KBR_RSTDONE) {
+ if (i == 0 || inb(kbd_base + KBDATAP) != KBR_RSTDONE) {
printf("pcprobe: reset error %d\n", 2);
goto lose;
}
register struct tty *tp = sc->sc_tty;
u_char *cp;
- if ((inb(KBSTATP) & KBS_DIB) == 0)
+ if ((inb(kbd_base + KBSTATP) & KBS_DIB) == 0)
return 0;
if (polling)
return 1;
do
(*linesw[tp->t_line].l_rint)(*cp++, tp);
while (*cp);
- } while (inb(KBSTATP) & KBS_DIB);
+ } while (inb(kbd_base + KBSTATP) & KBS_DIB);
return 1;
}
* For now, don't screw with it.
*/
/* crtat = 0; */
+ 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;
+ 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;
+ outb(TYNE_V_ISA_IO + 0x3ce, 6); /* Correct video mode */
+ outb(TYNE_V_ISA_IO + 0x3cf, 0xe);
+ break;
+ }
}
/* ARGSUSED */
do {
/* wait for byte */
- while ((inb(KBSTATP) & KBS_DIB) == 0);
+ while ((inb(kbd_base + KBSTATP) & KBS_DIB) == 0);
/* see if it's worthwhile */
cp = sget();
} while (!cp);
u_short was;
unsigned cursorat;
- cp = (u_short *)CGA_BUF;
+ cp = (u_short *)cga_buf;
was = *cp;
*cp = (u_short) 0xA55A;
if (*cp != 0xA55A) {
- cp = (u_short *)MONO_BUF;
- addr_6845 = MONO_BASE;
+ cp = (u_short *)mono_buf;
+ addr_6845 = mono_base;
vs.color = 0;
} else {
*cp = was;
- addr_6845 = CGA_BASE;
+ addr_6845 = cga_base;
vs.color = 1;
}
top:
KBD_DELAY;
- dt = inb(KBDATAP);
+ dt = inb(kbd_base + KBDATAP);
switch (dt) {
case KBR_ACK: case KBR_ECHO:
kb_oq_get = (kb_oq_get + 1) & 7;
if(kb_oq_get != kb_oq_put) {
- outb(KBOUTP, kb_oq[kb_oq_get]);
+ outb(kbd_base + KBOUTP, kb_oq[kb_oq_get]);
}
goto loop;
case KBR_RESEND:
- outb(KBOUTP, kb_oq[kb_oq_get]);
+ outb(kbd_base + KBOUTP, kb_oq[kb_oq_get]);
goto loop;
}
extended = 0;
loop:
- if ((inb(KBSTATP) & KBS_DIB) == 0)
+ if ((inb(kbd_base + KBSTATP) & KBS_DIB) == 0)
return 0;
goto top;
}
u_char value;
{
kbd_flush_input();
- outb(KBCMDP, 0xd4);
+ outb(kbd_base + KBCMDP, 0xd4);
kbd_flush_input();
- outb(KBDATAP, value);
+ outb(kbd_base + KBDATAP, value);
}
static inline void
u_char value;
{
kbd_flush_input();
- outb(KBCMDP, value);
+ outb(kbd_base + KBCMDP, value);
}
static inline void
u_char value;
{
kbd_flush_input();
- outb(KBCMDP, 0x60);
+ outb(kbd_base + KBCMDP, 0x60);
kbd_flush_input();
- outb(KBDATAP, value);
+ outb(kbd_base + KBDATAP, value);
}
int
pms_dev_cmd(KBC_RESET);
pms_aux_cmd(PMS_MAGIC_1);
delay(10000);
- x = inb(KBDATAP);
+ x = inb(kbd_base + KBDATAP);
pms_pit_cmd(PMS_INT_DISABLE);
if (x & 0x04)
return 0;
switch (state) {
case 0:
- buttons = inb(KBDATAP);
+ buttons = inb(kbd_base + KBDATAP);
if ((buttons & 0xc0) == 0)
++state;
break;
case 1:
- dx = inb(KBDATAP);
+ dx = inb(kbd_base + KBDATAP);
/* Bounding at -127 avoids a bug in XFree86. */
dx = (dx == -128) ? -127 : dx;
++state;
break;
case 2:
- dy = inb(KBDATAP);
+ dy = inb(kbd_base + KBDATAP);
dy = (dy == -128) ? -127 : dy;
state = 0;
-/* $OpenBSD: kbdreg.h,v 1.2 1996/07/30 20:24:25 pefo Exp $ */
+/* $OpenBSD: kbdreg.h,v 1.3 1996/09/04 21:18:24 pefo Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
*
*/
-#define KBSTATP (PICA_SYS_KBD + 0x61) /* controller status port (I) */
+#define KBSTATP (0x61) /* controller status port (I) */
#define KBS_DIB 0x01 /* data in buffer */
#define KBS_IBF 0x02 /* input buffer low */
#define KBS_WARM 0x04 /* input buffer low */
#define KBS_RERR 0x40 /* receive error */
#define KBS_PERR 0x80 /* parity error */
-#define KBCMDP (PICA_SYS_KBD + 0x61) /* controller port (O) */
-#define KBDATAP (PICA_SYS_KBD + 0x60) /* data port (I) */
-#define KBOUTP (PICA_SYS_KBD + 0x60) /* data port (O) */
+#define KBCMDP (0x61) /* controller port (O) */
+#define KBDATAP (0x60) /* data port (I) */
+#define KBOUTP (0x60) /* data port (O) */
#define K_RDCMDBYTE 0x20
#define K_LDCMDBYTE 0x60
-/* $OpenBSD: pte.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
+/* $OpenBSD: pte.h,v 1.2 1996/09/04 21:18:24 pefo Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#define PG_FRAME 0x3fffffc0
#define PG_SHIFT 6
#define vad_to_pfn(x) (((unsigned)(x) >> PG_SHIFT) & PG_FRAME)
+#define vad_to_pfn64(x) (((quad_t)(x) >> PG_SHIFT) & PG_FRAME)
#define pfn_to_vad(x) (((x) & PG_FRAME) << PG_SHIFT)
#define vad_to_vpn(x) ((unsigned)(x) & PG_SVPN)
#define vpn_to_vad(x) ((x) & PG_SVPN)
* SUCH DAMAGE.
*
* from: @(#)pica.h 8.1 (Berkeley) 6/10/93
- * $Id: pica.h,v 1.2 1996/07/30 20:24:31 pefo Exp $
+ * $Id: pica.h,v 1.3 1996/09/04 21:18:25 pefo Exp $
*/
/*
/*
* Addresses used by various display drivers.
*/
-#define MONO_BASE (PICA_V_LOCAL_VIDEO_CTRL + 0x3B4)
-#define MONO_BUF (PICA_V_LOCAL_VIDEO + 0xB0000)
-#define CGA_BASE (PICA_V_LOCAL_VIDEO_CTRL + 0x3D4)
-#define CGA_BUF (PICA_V_LOCAL_VIDEO + 0xB8000)
+#define PICA_MONO_BASE (PICA_V_LOCAL_VIDEO_CTRL + 0x3B4)
+#define PICA_MONO_BUF (PICA_V_LOCAL_VIDEO + 0xB0000)
+#define PICA_CGA_BASE (PICA_V_LOCAL_VIDEO_CTRL + 0x3D4)
+#define PICA_CGA_BUF (PICA_V_LOCAL_VIDEO + 0xB8000)
/*
* Interrupt vector descriptor for device on pica bus.