summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/conf/OFWTST97
-rw-r--r--sys/arch/powerpc/conf/files.powerpc20
-rw-r--r--sys/arch/powerpc/include/autoconf.h5
-rw-r--r--sys/arch/powerpc/isa/isa_machdep.h4
-rw-r--r--sys/arch/powerpc/isa/isabus.c35
-rw-r--r--sys/arch/powerpc/pci/mpcpcibus.c38
-rw-r--r--sys/arch/powerpc/powerpc/autoconf.c10
-rw-r--r--sys/arch/powerpc/powerpc/locore.S12
-rw-r--r--sys/arch/powerpc/powerpc/machdep.c44
-rw-r--r--sys/arch/powerpc/powerpc/mainbus.c11
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c30
11 files changed, 276 insertions, 30 deletions
diff --git a/sys/arch/powerpc/conf/OFWTST b/sys/arch/powerpc/conf/OFWTST
new file mode 100644
index 00000000000..49d92fb9930
--- /dev/null
+++ b/sys/arch/powerpc/conf/OFWTST
@@ -0,0 +1,97 @@
+#
+# First try for PPC GENERIC config file
+#
+
+machine powerpc
+
+maxusers 32
+
+# Standard system options (should go into std.powerpc?)
+options SWAPPAGER, VNODEPAGER, DEVPAGER
+options EXEC_ELF
+options SYS_TYPE=OFWMACH
+
+# various hacks due to bugs in Openfirmware implementation
+options FIREPOWERBUGS
+
+#options IPKDBUSERHACK
+#makeoptions DEBUG="-g"
+
+options DDB
+options KTRACE
+options SYSCALL_DEBUG
+options TCP_COMPAT_42
+options COMPAT_43
+#options COMPAT_09
+#options COMPAT_10
+#options COMPAT_12
+
+options FFS
+options MFS
+
+options NFSCLIENT
+options NFSSERVER
+
+options CD9660
+options MSDOSFS
+options FDESC
+options FIFO
+options KERNFS
+options NULLFS
+options PORTAL
+options PROCFS
+options UMAPFS
+options UNION
+
+options INET
+options NMBCLUSTERS=1024
+
+# System V options
+option SYSVMSG # System V-like message queues
+option SYSVSEM # System V-like semaphores
+option SYSVSHM # System V-like memory sharing
+#option SHMMAXPGS=1024 # 1024 pages is the default
+
+#options MAXUSERS=20
+#options TARGET_ELF
+
+config bsd swap generic
+
+mainbus0 at root
+cpu* at mainbus0
+ofroot* at mainbus0
+mpcpcibr* at mainbus0 # MPC106 PCI Bridge.
+isabr* at pci? # ISA dev bridge.
+
+pci* at mpcpcibr?
+
+isa* at isabr?
+#com0 at isa? port 0x2f8 irq 3
+#com1 at isa? port 0x3f8 irq 4
+
+ncr* at pci? dev ? function ?
+#de* at pci? dev ? function ?
+
+scsibus* at ncr?
+sd* at scsibus? target ? lun ?
+st* at scsibus? target ? lun ?
+cd* at scsibus? target ? lun ?
+
+
+ofbus* at openfirm?
+
+#ofdisk* at openfirm?
+
+ofnet* at openfirm?
+#ipkdbif0 at ofnet?
+
+ofcons* at openfirm?
+
+ofrtc* at openfirm?
+
+pseudo-device loop
+pseudo-device pty 64
+pseudo-device random 1
+pseudo-device rd
+pseudo-device vnd 2
+pseudo-device bpfilter 8 # packet filter
diff --git a/sys/arch/powerpc/conf/files.powerpc b/sys/arch/powerpc/conf/files.powerpc
index 32e9cf193d6..00276b4b694 100644
--- a/sys/arch/powerpc/conf/files.powerpc
+++ b/sys/arch/powerpc/conf/files.powerpc
@@ -45,6 +45,10 @@ file arch/powerpc/powerpc/db_trace.c ddb
file arch/powerpc/powerpc/ofwreal.S
+#
+# Openfirmware support
+#
+
define mainbus {}
device mainbus
attach mainbus at root
@@ -54,34 +58,32 @@ device cpu
attach cpu at mainbus
file arch/powerpc/powerpc/cpu.c
+include "../../../dev/ofw/files.ofw"
+file arch/powerpc/powerpc/opendev.c ofcons | ofnet | ofdisk
+major { ofdisk = 4 }
+
pseudo-device rd
file dev/ramdisk.c rd needs-flag
file arch/powerpc/powerpc/rd_root.c ramdisk_hooks
major {rd = 17}
+include "../../../dev/pci/files.pci"
+
device mpcpcibr {} : pcibus
attach mpcpcibr at mainbus
file arch/powerpc/pci/mpcpcibus.c mpcpcibr
device isabr {} : isabus
-attach isabr at mainbus
+attach isabr at mainbus, pci
file arch/powerpc/isa/isabus.c isabr
include "../../../scsi/files.scsi"
major {sd = 2} # hey this was 0 but at slot 2 in bdevsw XXX
major {cd = 3}
define pcmcia {} # XXX dummy decl...
-include "../../../dev/pci/files.pci"
include "../../../dev/isa/files.isa"
major { wd = 5 } # Not even in bdevsw XXX
include "../../../dev/isa/files.isapnp"
file arch/arc/isa/isapnp_machdep.c isapnp
-#
-# Openfirmware support
-#
-
-include "../../../dev/ofw/files.ofw"
-file arch/powerpc/powerpc/opendev.c ofcons | ofnet | ofdisk
-major { ofdisk = 4 }
diff --git a/sys/arch/powerpc/include/autoconf.h b/sys/arch/powerpc/include/autoconf.h
index d11e53617c2..8502deed616 100644
--- a/sys/arch/powerpc/include/autoconf.h
+++ b/sys/arch/powerpc/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.2 1998/05/29 04:15:32 rahnds Exp $ */
+/* $OpenBSD: autoconf.h,v 1.3 1998/08/22 18:31:44 rahnds Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -41,8 +41,9 @@
/*
* System types.
*/
-#define OFWMACH 0 /* Openfirmware drivers */
+#define OFWMACH 0 /* Openfirmware drivers */
#define POWER4e 1 /* V.I Power.4e board */
+#define PWRSTK 2 /* Motorola Powerstack series */
extern int system_type;
diff --git a/sys/arch/powerpc/isa/isa_machdep.h b/sys/arch/powerpc/isa/isa_machdep.h
index 6504688de3a..6395937d1da 100644
--- a/sys/arch/powerpc/isa/isa_machdep.h
+++ b/sys/arch/powerpc/isa/isa_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.h,v 1.2 1998/06/29 05:47:40 downsj Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.3 1998/08/22 18:31:46 rahnds Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -87,7 +87,7 @@ struct intrhand {
/*
* Let com.c know where our console is!
*/
-#define CONADDR (0x2e8)
+#define CONADDR (0x2f8)
#define COM_FREQ (1843200 / 3) /* Clocked with 8Mhz instead of 24! */
extern void * isabr_intr_establish(isa_chipset_tag_t, int, int, int, int (*ih_fun) __P((void *)), void *, char *);
diff --git a/sys/arch/powerpc/isa/isabus.c b/sys/arch/powerpc/isa/isabus.c
index f45d31e16f2..06b0d80ac40 100644
--- a/sys/arch/powerpc/isa/isabus.c
+++ b/sys/arch/powerpc/isa/isabus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isabus.c,v 1.2 1998/05/29 04:15:35 rahnds Exp $ */
+/* $OpenBSD: isabus.c,v 1.3 1998/08/22 18:31:48 rahnds Exp $ */
/* $NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp $ */
/*-
@@ -102,6 +102,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <machine/autoconf.h>
#include <machine/intr.h>
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pcivar.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@@ -151,16 +153,25 @@ isabrmatch(parent, cfdata, aux)
struct confargs *ca = aux;
/* Make sure that we're looking for a ISABR. */
- if (strcmp(ca->ca_name, isabr_cd.cd_name) != 0)
- return (0);
+ if (strcmp(ca->ca_name, isabr_cd.cd_name) == 0)
+ return (1);
+ {
+ struct pci_attach_args *pa = aux;
+
+ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL &&
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_SIO)
+ return (1);
+
+ }
- return (1);
+ return (0);
}
typedef void (void_f) (void);
extern void_f *pending_int_f;
void isa_do_pending_int();
+struct evcnt evirq[ICU_LEN];
void
isabrattach(parent, self, aux)
struct device *parent;
@@ -170,6 +181,9 @@ isabrattach(parent, self, aux)
struct isabr_softc *sc = (struct isabr_softc *)self;
struct isabus_attach_args iba;
+ /* notyet -dsr
+ ppc_intr_setup( isabr_intr_establish, isabr_intr_disestablish);
+ */
pending_int_f = isa_do_pending_int;
printf("\n");
@@ -190,6 +204,12 @@ isabrattach(parent, self, aux)
iba.iba_iot = (bus_space_tag_t)&p4e_isa_io;
iba.iba_memt = (bus_space_tag_t)&p4e_isa_mem;
iba.iba_ic = &sc->p4e_isa_cs;
+ {
+ int i;
+ for (i = 0; i < ICU_LEN; i++) {
+ evcnt_attach(self,"intr",&evirq[i]);
+ }
+ }
config_found(self, &iba, isabrprint);
}
@@ -402,23 +422,24 @@ static int processing;
vector = ffs(hwpend) - 1;
hwpend &= ~(1L << vector);
ih = intrhand[vector];
+ evirq[vector].ev_count++;
while(ih) {
(*ih->ih_fun)(ih->ih_arg);
ih = ih->ih_next;
}
}
- if(ipending & SINT_CLOCK) {
+ if((ipending & SINT_CLOCK)& ~pcpl) {
ipending &= ~SINT_CLOCK;
softclock();
}
- if(ipending & SINT_NET) {
+ if((ipending & SINT_NET)& ~pcpl){
extern int netisr;
int pisr = netisr;
netisr = 0;
ipending &= ~SINT_NET;
softnet(pisr);
}
- ipending &= pcpl;
+ ipending &= ~hwpend;
cpl = pcpl; /* Don't use splx... we are here already! */
__asm__ volatile("mtmsr %0" :: "r"(emsr));
processing = 0;
diff --git a/sys/arch/powerpc/pci/mpcpcibus.c b/sys/arch/powerpc/pci/mpcpcibus.c
index 6e263c607c7..ae58a8c1f98 100644
--- a/sys/arch/powerpc/pci/mpcpcibus.c
+++ b/sys/arch/powerpc/pci/mpcpcibus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpcpcibus.c,v 1.5 1998/08/06 15:04:00 pefo Exp $ */
+/* $OpenBSD: mpcpcibus.c,v 1.6 1998/08/22 18:31:50 rahnds Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -45,6 +45,7 @@
#include <vm/vm.h>
#include <machine/autoconf.h>
+#include <machine/bat.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@@ -156,6 +157,41 @@ mpcpcibrattach(parent, self, aux)
mpc_cfg_read_1(MPC106_PCI_REVID));
mpc_cfg_write_2(MPC106_PCI_STAT, 0xff80); /* Reset status */
break;
+ case OFWMACH:
+ case PWRSTK:
+ lcp = sc->sc_pcibr = &mpc_config;
+
+ addbatmap(0x80000000, 0x80000000, BAT_I);
+ addbatmap(MPC106_P_PCI_MEM_SPACE,
+ MPC106_P_PCI_MEM_SPACE, BAT_I);
+
+ sc->sc_membus_space.bus_base = MPC106_V_PCI_MEM_SPACE;
+ sc->sc_membus_space.bus_reverse = 1;
+ sc->sc_iobus_space.bus_base = MPC106_PCI_IO_SPACE;
+ sc->sc_iobus_space.bus_reverse = 1;
+
+ lcp->lc_pc.pc_conf_v = lcp;
+ lcp->lc_pc.pc_attach_hook = mpc_attach_hook;
+ lcp->lc_pc.pc_bus_maxdevs = mpc_bus_maxdevs;
+ lcp->lc_pc.pc_make_tag = mpc_make_tag;
+ lcp->lc_pc.pc_decompose_tag = mpc_decompose_tag;
+ lcp->lc_pc.pc_conf_read = mpc_conf_read;
+ lcp->lc_pc.pc_conf_write = mpc_conf_write;
+ lcp->lc_pc.pc_ether_hw_addr = mpc_ether_hw_addr;
+
+ lcp->lc_pc.pc_intr_v = lcp;
+ lcp->lc_pc.pc_intr_map = mpc_intr_map;
+ lcp->lc_pc.pc_intr_string = mpc_intr_string;
+ lcp->lc_pc.pc_intr_establish = mpc_intr_establish;
+ lcp->lc_pc.pc_intr_disestablish = mpc_intr_disestablish;
+
+ printf(": MPC106, Revision %x.\n",
+ mpc_cfg_read_1(MPC106_PCI_REVID));
+ mpc_cfg_write_2(MPC106_PCI_STAT, 0xff80); /* Reset status */
+ break;
+ default:
+ printf("unknown system_type %d\n",system_type);
+ return;
}
pba.pba_busname = "pci";
diff --git a/sys/arch/powerpc/powerpc/autoconf.c b/sys/arch/powerpc/powerpc/autoconf.c
index 1e47d7a851e..97fc7b4b99f 100644
--- a/sys/arch/powerpc/powerpc/autoconf.c
+++ b/sys/arch/powerpc/powerpc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.6 1998/08/06 15:04:05 pefo Exp $ */
+/* $OpenBSD: autoconf.c,v 1.7 1998/08/22 18:31:52 rahnds Exp $ */
/*
* Copyright (c) 1996, 1997 Per Fogelstrom
* Copyright (c) 1995 Theo de Raadt
@@ -41,7 +41,7 @@
* from: Utah Hdr: autoconf.c 1.31 91/01/21
*
* from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- * $Id: autoconf.c,v 1.6 1998/08/06 15:04:05 pefo Exp $
+ * $Id: autoconf.c,v 1.7 1998/08/22 18:31:52 rahnds Exp $
*/
/*
@@ -91,11 +91,13 @@ void
configure()
{
(void)splhigh(); /* To be really sure.. */
- if(config_rootfound("mainbus", "mainbus") == 0)
- panic("no mainbus found");
+ /*
if(system_type == OFWMACH) {
ofrootfound();
}
+ */
+ if(config_rootfound("mainbus", "mainbus") == 0)
+ panic("no mainbus found");
(void)spl0();
setroot();
diff --git a/sys/arch/powerpc/powerpc/locore.S b/sys/arch/powerpc/powerpc/locore.S
index b77e0fc749a..52c611505d2 100644
--- a/sys/arch/powerpc/powerpc/locore.S
+++ b/sys/arch/powerpc/powerpc/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.5 1997/10/13 13:42:58 pefo Exp $ */
+/* $OpenBSD: locore.S,v 1.6 1998/08/22 18:31:55 rahnds Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
@@ -1255,3 +1255,13 @@ _C_LABEL(sigcode):
li 0,SYS_exit
sc /* exit(errno) */
_C_LABEL(esigcode):
+
+
+
+_C_LABEL(intrnames):
+ .string "none"
+_C_LABEL(eintrnames):
+ .align 4
+_C_LABEL(intrcnt):
+ .long 0
+_C_LABEL(eintrcnt):
diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c
index aa029c8630e..daa7f35d5a0 100644
--- a/sys/arch/powerpc/powerpc/machdep.c
+++ b/sys/arch/powerpc/powerpc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.13 1998/05/29 04:15:39 rahnds Exp $ */
+/* $OpenBSD: machdep.c,v 1.14 1998/08/22 18:31:57 rahnds Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -824,3 +824,45 @@ do_pending_int()
(*pending_int_f)();
}
}
+
+/*
+ * set system type from string
+ */
+void
+systype(char *name)
+{
+ if (strncmp (name, "MOT,", 4) == 0) {
+ system_type = PWRSTK;
+ printf("recognized system type of %s as PWRSTK\n", name);
+ }
+}
+/*
+ * one attempt at interrupt stuff..
+ *
+ */
+#include <dev/pci/pcivar.h>
+typedef void *(intr_establish_t) __P((void *, pci_intr_handle_t,
+ int, int (*func)(void *), void *, char *));
+typedef void (intr_disestablish_t) __P((void *, void *));
+
+void *
+ppc_intr_establish(lcv, ih, level, func, arg, name)
+ void *lcv;
+ pci_intr_handle_t ih;
+ int level;
+ int (*func) __P((void *));
+ void *arg;
+ char *name;
+{
+ panic("ppc_intr_establish called before interrupt controller configured: driver %s\n", name);
+}
+
+intr_establish_t *intr_establish_func = ppc_intr_establish;;
+intr_disestablish_t *intr_disestablish_func;
+
+void
+ppc_intr_setup(intr_establish_t *establish, intr_disestablish_t *disestablish)
+{
+ intr_establish_func = establish;
+ intr_disestablish_func = disestablish;
+}
diff --git a/sys/arch/powerpc/powerpc/mainbus.c b/sys/arch/powerpc/powerpc/mainbus.c
index d38616b3a82..711720be72c 100644
--- a/sys/arch/powerpc/powerpc/mainbus.c
+++ b/sys/arch/powerpc/powerpc/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.1 1997/10/13 13:42:59 pefo Exp $ */
+/* $OpenBSD: mainbus.c,v 1.2 1998/08/22 18:31:59 rahnds Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -97,6 +97,13 @@ mbattach(parent, self, aux)
nca.ca_bus = &sc->sc_bus;
config_found(self, &nca, mbprint);
+ /* Set up Openfirmware.*/
+ if (system_type != POWER4e) { /* for now */
+ nca.ca_name = "ofroot";
+ nca.ca_bus = &sc->sc_bus;
+ config_found(self, &nca, mbprint);
+ }
+
/* The following machines have an ISA bus */
/* Do ISA first so the interrupt controller is set up! */
@@ -107,7 +114,7 @@ mbattach(parent, self, aux)
}
/* The following machines have a PCI bus */
- if (system_type == POWER4e) {
+ if (system_type != OFWMACH) {
nca.ca_name = "mpcpcibr";
nca.ca_bus = &sc->sc_bus;
config_found(self, &nca, mbprint);
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index a3fb386b855..cc1f532e2a6 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.6 1998/03/04 10:58:16 niklas Exp $ */
+/* $OpenBSD: pmap.c,v 1.7 1998/08/22 18:32:00 rahnds Exp $ */
/* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */
/*
@@ -1318,3 +1318,31 @@ pmap_page_protect(pa, prot)
}
splx(s);
}
+/*
+ * this code to manipulate the BAT tables was added here
+ * because it is closely related to the vm system.
+ * --dsr
+ */
+
+#include <machine/bat.h>
+
+/* one major problem of mapping IO with bats, is that it
+ * is not possible to use caching on any level of granularity
+ * that is reasonable.
+ * This is just enhancing an existing design (that should be
+ * replaced in my opinion).
+ *
+ * Current design only allow mapping of 256 MB block. (normally 1-1)
+ * but not necessarily (in the case of PCI io at 0xf0000000 where
+ * it might be desireable to map it elsewhere because that is
+ * where the stack is?)
+ */
+void
+addbatmap(u_int32_t vaddr, u_int32_t raddr, u_int32_t wimg)
+{
+ u_int32_t segment;
+ segment = vaddr >> (32 - 4);
+ battable[segment].batu = BATU(vaddr);
+ battable[segment].batl = BATL(raddr, wimg);
+}
+