Add support for G3 Mac.
This commit is contained in:
parent
14fd96b811
commit
dc16918e07
|
@ -104,8 +104,3 @@ file arch/macppc/dev/grf_subr.c grf
|
|||
device ite: tty
|
||||
attach ite at grf
|
||||
file arch/macppc/dev/ite.c ite needs-flag
|
||||
file arch/macppc/dev/font_8x16.c ite
|
||||
|
||||
device ofcons: tty
|
||||
attach ofcons at pci
|
||||
file arch/macppc/dev/ofcons.c ofcons needs-flag
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: obio.c,v 1.2 1998/06/21 15:06:19 tsubai Exp $ */
|
||||
/* $NetBSD: obio.c,v 1.3 1998/07/13 19:37:28 tsubai Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1998 Internet Research Institute, Inc.
|
||||
|
@ -69,8 +69,9 @@ obio_match(parent, cf, aux)
|
|||
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_APPLE)
|
||||
switch (PCI_PRODUCT(pa->pa_id)) {
|
||||
|
||||
case 2: /* gc */
|
||||
case 7: /* ohare */
|
||||
case 0x02: /* gc */
|
||||
case 0x07: /* ohare */
|
||||
case 0x10: /* mac-io */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -95,14 +96,18 @@ obio_attach(parent, self, aux)
|
|||
|
||||
switch (PCI_PRODUCT(pa->pa_id)) {
|
||||
|
||||
case 2:
|
||||
case 0x02:
|
||||
node = OF_finddevice("/bandit/gc");
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 0x07:
|
||||
node = OF_finddevice("/bandit/ohare");
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
node = OF_finddevice("/pci/mac-io");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("obio_attach: unknown obio controller\n");
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs.c,v 1.3 1998/07/04 22:18:29 jonathan Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.4 1998/07/13 19:37:28 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Bill Studenmund
|
||||
|
@ -283,21 +283,10 @@ zsc_attach(parent, self, aux)
|
|||
if (zsaddr[zsc_unit] == NULL)
|
||||
panic("zs_attach: zs%d not mapped\n", zsc_unit);
|
||||
|
||||
if (zsc_unit == 0) {
|
||||
struct consdev cd;
|
||||
|
||||
cd.cn_pri = CN_DEAD;
|
||||
zscnprobe(&cd);
|
||||
if (cd.cn_pri != CN_DEAD)
|
||||
zscninit(cn_tab);
|
||||
}
|
||||
|
||||
if ((zs_hwflags[zsc_unit][0] | zs_hwflags[zsc_unit][1]) &
|
||||
ZS_HWFLAG_CONSOLE) {
|
||||
|
||||
zs_conschan = zs_get_chan_addr(zsc_unit, minor(cn_tab->cn_dev));
|
||||
cn_tab->cn_getc = zscngetc;
|
||||
cn_tab->cn_putc = zscnputc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -948,6 +937,8 @@ static void zs_putc __P((register volatile struct zschan *, int));
|
|||
static int zs_getc __P((register volatile struct zschan *));
|
||||
extern int zsopen __P(( dev_t dev, int flags, int mode, struct proc *p));
|
||||
|
||||
static int stdin, stdout;
|
||||
|
||||
/*
|
||||
* Console functions.
|
||||
*/
|
||||
|
@ -1029,8 +1020,14 @@ zscngetc(dev)
|
|||
register volatile struct zschan *zc = zs_conschan;
|
||||
register int c;
|
||||
|
||||
c = zs_getc(zc);
|
||||
return (c);
|
||||
if (zc) {
|
||||
c = zs_getc(zc);
|
||||
} else {
|
||||
char ch = 0;
|
||||
OF_read(stdin, &ch, 1);
|
||||
c = ch;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1043,7 +1040,12 @@ zscnputc(dev, c)
|
|||
{
|
||||
register volatile struct zschan *zc = zs_conschan;
|
||||
|
||||
zs_putc(zc, c);
|
||||
if (zc) {
|
||||
zs_putc(zc, c);
|
||||
} else {
|
||||
char ch = c;
|
||||
OF_write(stdout, &ch, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1082,55 +1084,65 @@ extern void ofccnputc __P((dev_t, int));
|
|||
struct consdev consdev_zs = {
|
||||
zscnprobe,
|
||||
zscninit,
|
||||
ofccngetc,
|
||||
ofccnputc,
|
||||
zscngetc,
|
||||
zscnputc,
|
||||
zscnpollc,
|
||||
};
|
||||
|
||||
void
|
||||
zscnprobe(struct consdev * cp)
|
||||
zscnprobe(cp)
|
||||
struct consdev *cp;
|
||||
{
|
||||
int l;
|
||||
char type[32];
|
||||
extern int console_node;
|
||||
|
||||
if (console_node == -1)
|
||||
return;
|
||||
|
||||
bzero(type, sizeof(type));
|
||||
l = OF_getprop(console_node, "device_type", type, sizeof(type));
|
||||
if (l == -1 || l >= sizeof(type) - 1)
|
||||
return;
|
||||
|
||||
if (strcmp(type, "serial") == 0)
|
||||
cp->cn_pri = CN_REMOTE;
|
||||
}
|
||||
|
||||
void
|
||||
zscninit(cd)
|
||||
struct consdev *cd;
|
||||
{
|
||||
int chosen;
|
||||
int sz;
|
||||
int chosen, pkg;
|
||||
int unit = 0;
|
||||
int stdout;
|
||||
char name[32];
|
||||
|
||||
chosen = OF_finddevice("/chosen");
|
||||
if (chosen == -1)
|
||||
char name[16];
|
||||
|
||||
if ((chosen = OF_finddevice("/chosen")) == -1)
|
||||
return;
|
||||
|
||||
sz = OF_getprop(chosen, "stdout", &stdout, sizeof(stdout));
|
||||
if (sz != sizeof(stdout))
|
||||
if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) == -1)
|
||||
return;
|
||||
if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1)
|
||||
return;
|
||||
|
||||
if ((pkg = OF_instance_to_package(stdin)) == -1)
|
||||
return;
|
||||
|
||||
bzero(name, sizeof(name));
|
||||
OF_getprop(stdout, "name", name, sizeof(name));
|
||||
if (OF_getprop(pkg, "device_type", name, sizeof(name)) == -1)
|
||||
return;
|
||||
|
||||
if (strcmp(name, "serial") != 0)
|
||||
return;
|
||||
|
||||
bzero(name, sizeof(name));
|
||||
if (OF_getprop(pkg, "name", name, sizeof(name)) == -1)
|
||||
return;
|
||||
|
||||
if (strcmp(name, "ch-b") == 0)
|
||||
unit = 1;
|
||||
|
||||
cp->cn_dev = makedev(zs_major, unit);
|
||||
cp->cn_pri = CN_REMOTE;
|
||||
}
|
||||
|
||||
void
|
||||
zscninit(cp)
|
||||
struct consdev *cp;
|
||||
{
|
||||
int pkg;
|
||||
int unit = 0;
|
||||
char name[16];
|
||||
|
||||
if ((pkg = OF_instance_to_package(stdin)) == -1)
|
||||
return;
|
||||
|
||||
bzero(name, sizeof(name));
|
||||
if (OF_getprop(pkg, "name", name, sizeof(name)) == -1)
|
||||
return;
|
||||
|
||||
if (strcmp(name, "ch-b") == 0)
|
||||
unit = 1;
|
||||
|
||||
zs_hwflags[0][unit] = ZS_HWFLAG_CONSOLE;
|
||||
|
||||
cd->cn_dev = makedev(zs_major, unit);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: autoconf.c,v 1.3 1998/06/24 15:13:43 tsubai Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.4 1998/07/13 19:37:28 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -58,6 +58,7 @@ struct devnametobdevmaj powermac_nam2blk[] = {
|
|||
{ "ofdisk", 0 },
|
||||
{ "sd", 4 },
|
||||
{ "md", 9 },
|
||||
{ "wd", 10 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
|
@ -139,3 +140,48 @@ findroot()
|
|||
out:
|
||||
dk_cleanup();
|
||||
}
|
||||
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
int
|
||||
#ifdef __STDC__
|
||||
OF_interpret(char *cmd, int nreturns, ...)
|
||||
#else
|
||||
OF_interpret(cmd, nreturns, va_alist)
|
||||
char *cmd;
|
||||
int nreturns;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int i;
|
||||
static struct {
|
||||
char *name;
|
||||
int nargs;
|
||||
int nreturns;
|
||||
char *cmd;
|
||||
int status;
|
||||
int results[8];
|
||||
} args = {
|
||||
"interpret",
|
||||
1,
|
||||
2,
|
||||
};
|
||||
|
||||
ofw_stack();
|
||||
if (nreturns > 8)
|
||||
return -1;
|
||||
if ((i = strlen(cmd)) >= NBPG)
|
||||
return -1;
|
||||
ofbcopy(cmd, OF_buf, i + 1);
|
||||
args.cmd = OF_buf;
|
||||
args.nargs = 1;
|
||||
args.nreturns = nreturns + 1;
|
||||
if (openfirmware(&args) == -1)
|
||||
return -1;
|
||||
va_start(ap, nreturns);
|
||||
for (i = 0; i < nreturns; i++)
|
||||
*va_arg(ap, int *) = args.results[i];
|
||||
va_end(ap);
|
||||
return args.status;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clock.c,v 1.1 1998/05/15 10:15:57 tsubai Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.2 1998/07/13 19:37:28 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -35,6 +35,11 @@
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#if defined(UVM)
|
||||
#include <vm/vm.h>
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
|
@ -127,7 +132,9 @@ decr_intr(frame)
|
|||
*/
|
||||
lasttb = tb + tick - ticks_per_intr;
|
||||
|
||||
/*clock_return(frame, nticks);*/
|
||||
#if defined(UVM)
|
||||
uvmexp.intrs++;
|
||||
#endif
|
||||
/*intrcnt[CNT_CLOCK]++;*/
|
||||
{
|
||||
int pri;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: conf.c,v 1.5 1998/07/03 11:50:32 tsubai Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.6 1998/07/13 19:37:28 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -119,7 +119,7 @@ struct cdevsw cdevsw[] = {
|
|||
cdev_ptc_init(NPTY,ptc), /* 4: pseudo tty master */
|
||||
cdev_log_init(1,log), /* 5: /dev/klog */
|
||||
cdev_swap_init(1,sw), /* 6: /dev/drum pseudo device */
|
||||
cdev_tty_init(1,ofc), /* 7: Openfirmware console */
|
||||
cdev_notdef(), /* 7: Openfirmware console */
|
||||
cdev_notdef(), /* 8: Openfirmware disk */
|
||||
cdev_notdef(), /* 9: Openfirmware RTC */
|
||||
cdev_bpftun_init(NBPFILTER,bpf),/* 10: Berkeley packet filter */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extintr.c,v 1.1 1998/05/15 10:15:58 tsubai Exp $ */
|
||||
/* $NetBSD: extintr.c,v 1.2 1998/07/13 19:37:28 tsubai Exp $ */
|
||||
/* $OpenBSD: isabus.c,v 1.1 1997/10/11 11:53:00 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -138,7 +138,6 @@ intr_calculatemasks()
|
|||
* IPL_HIGH must block everything that can manipulate a run queue.
|
||||
*/
|
||||
imask[IPL_HIGH] |= imask[IPL_CLOCK];
|
||||
imask[IPL_HIGH] |= 0xffffffff;
|
||||
|
||||
/*
|
||||
* We need serial drivers to run at the absolute highest priority to
|
||||
|
@ -348,6 +347,9 @@ start:
|
|||
|
||||
/*out32rb(INT_ENABLE_REG, ~imen);*/
|
||||
|
||||
#if defined(UVM)
|
||||
uvmexp.intrs++;
|
||||
#endif
|
||||
intrcnt[irq]++;
|
||||
}
|
||||
int_state &= ~r_imen;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.14 1998/07/05 22:48:06 jonathan Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.15 1998/07/13 19:37:29 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -135,7 +135,7 @@ caddr_t allocsys __P((caddr_t));
|
|||
void install_extint __P((void (*)(void)));
|
||||
|
||||
extern u_int openfirmware_entry;
|
||||
static u_int ofw_va, ofw_pa, ofw_len;
|
||||
static u_int ofw_pa;
|
||||
|
||||
int cold = 1;
|
||||
|
||||
|
@ -163,35 +163,15 @@ initppc(startkernel, endkernel, args)
|
|||
extern void ext_intr __P((void));
|
||||
int exc, scratch;
|
||||
|
||||
int node, i;
|
||||
u_int trans[80];
|
||||
char type[8];
|
||||
int chosen, mmu, mode, exists;
|
||||
|
||||
/*
|
||||
* Read translations for Openfirmware call.
|
||||
*/
|
||||
node = OF_peer(0);
|
||||
node = OF_child(node);
|
||||
while (node) {
|
||||
bzero(type, 8);
|
||||
OF_getprop(node, "device_type", type, sizeof(type));
|
||||
if (strcmp(type, "cpu") == 0)
|
||||
break;
|
||||
node = OF_peer(node);
|
||||
}
|
||||
|
||||
bzero(trans, sizeof(trans));
|
||||
OF_getprop(node, "translations", trans, sizeof(trans));
|
||||
|
||||
for (i = 0; i < 80; i += 4) {
|
||||
if (trans[i] <= openfirmware_entry &&
|
||||
trans[i] + trans[i+1] > openfirmware_entry) {
|
||||
ofw_va = trans[i];
|
||||
ofw_len = trans[i + 1];
|
||||
ofw_pa = trans[i + 2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
chosen = OF_finddevice("/chosen");
|
||||
OF_getprop(chosen, "mmu", &mmu, 4);
|
||||
OF_call_method("translate", mmu, 1, 3,
|
||||
0xff800000, &ofw_pa, &mode, &exists);
|
||||
|
||||
proc0.p_addr = proc0paddr;
|
||||
bzero(proc0.p_addr, sizeof *proc0.p_addr);
|
||||
|
@ -1101,17 +1081,6 @@ cninit()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (1) {
|
||||
extern struct consdev consdev_ofcons;
|
||||
|
||||
cp = &consdev_ofcons;
|
||||
(*cp->cn_probe)(cp);
|
||||
(*cp->cn_init)(cp);
|
||||
cn_tab = cp;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#if NZSTTY > 0
|
||||
if (strcmp(type, "serial") == 0) {
|
||||
extern struct consdev consdev_zs;
|
||||
|
|
Loading…
Reference in New Issue