summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorDale S. Rahn <rahnds@cvs.openbsd.org>1998-09-20 22:11:49 +0000
committerDale S. Rahn <rahnds@cvs.openbsd.org>1998-09-20 22:11:49 +0000
commit272c238b9194d34cac9c383517eebd94f9236b96 (patch)
tree4ecbc722ea060e28f29b0fb004e4b58b82aa9ad0 /sys/arch
parent0122e03b77249539b13ea49c3ce4d2b54b01c11a (diff)
Changes to probe for address, and frequency for serial console.
This should enable the same kernel to work on VI machines as well as MCG machines. Only remaining piece is the rtc. For now an extra config file has been added to use serial for MCG machines until all issues are resolved. The various extra config files and ramdisks should go away as soon as merger is finished.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/conf/SER97
-rw-r--r--sys/arch/powerpc/isa/isa_machdep.h8
-rw-r--r--sys/arch/powerpc/powerpc/machdep.c8
-rw-r--r--sys/arch/powerpc/powerpc/ofw_machdep.c72
4 files changed, 178 insertions, 7 deletions
diff --git a/sys/arch/powerpc/conf/SER b/sys/arch/powerpc/conf/SER
new file mode 100644
index 00000000000..13b58691876
--- /dev/null
+++ b/sys/arch/powerpc/conf/SER
@@ -0,0 +1,97 @@
+#
+# First try for PPC GENERIC config file
+#
+
+machine powerpc
+
+maxusers 32
+
+options PPC_MPC106_BUG
+# Standard system options (should go into std.powerpc?)
+options SWAPPAGER, VNODEPAGER, DEVPAGER
+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 0x3f8 irq 4
+com1 at isa? port 0x2f8 irq 3
+
+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/isa/isa_machdep.h b/sys/arch/powerpc/isa/isa_machdep.h
index 288a9cea5d7..dd1d1d95436 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.4 1998/09/17 06:03:29 rahnds Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.5 1998/09/20 22:11:47 rahnds Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -87,8 +87,10 @@ struct intrhand {
/*
* Let com.c know where our console is!
*/
-#define CONADDR (0x2e8)
-#define COM_FREQ (1843200 / 3) /* Clocked with 8Mhz instead of 24! */
+extern u_int32_t ppc_console_addr;
+extern u_int32_t ppc_console_serfreq;
+#define CONADDR (ppc_console_addr)
+#define COM_FREQ (ppc_console_serfreq)
extern void * isabr_intr_establish(isa_chipset_tag_t, int, int, int, int (*ih_fun) __P((void *)), void *, char *);
#endif /* _ISA_MACHDEP_H_ */
diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c
index 2a7ac000435..90858d1feb1 100644
--- a/sys/arch/powerpc/powerpc/machdep.c
+++ b/sys/arch/powerpc/powerpc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.17 1998/09/12 19:58:56 rahnds Exp $ */
+/* $OpenBSD: machdep.c,v 1.18 1998/09/20 22:11:48 rahnds Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -96,7 +96,6 @@ char ofw_eth_addr[6]; /* Save address of first network ifc found */
char *bootpath;
char bootpathbuf[512];
-int cons_initted;
/*
* We use the page just above the interrupt vector as message buffer
@@ -231,6 +230,8 @@ initppc(startkernel, endkernel, args)
__asm__ volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0; isync"
: "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI));
+ ofwconprobe();
+
/*
* Now we can set up the console as mapping is enabled.
*/
@@ -500,7 +501,8 @@ allocsys(v)
void
consinit()
{
-
+ static int cons_initted = 0;
+
if (cons_initted)
return;
cninit();
diff --git a/sys/arch/powerpc/powerpc/ofw_machdep.c b/sys/arch/powerpc/powerpc/ofw_machdep.c
index b85972da701..11b51155233 100644
--- a/sys/arch/powerpc/powerpc/ofw_machdep.c
+++ b/sys/arch/powerpc/powerpc/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.7 1998/09/09 04:48:16 rahnds Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.8 1998/09/20 22:11:48 rahnds Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */
/*
@@ -191,3 +191,73 @@ static int processing;
__asm__ volatile("mtmsr %0" :: "r"(emsr));
processing = 0;
}
+u_int32_t ppc_console_iomem=0;
+u_int32_t ppc_console_addr=0;
+u_int32_t ppc_console_qhandle=0;
+u_int32_t ppc_console_serfreq;
+
+void
+ofwtrysercon(char *name, int qhandle)
+{
+/* for serial we want regs field */
+ int regs[4];
+ int freq;
+ int regn;
+ if ((regn = OF_getprop(qhandle, "reg", &regs[0], sizeof regs)) >= 0) {
+
+ if (regs[1] == 0x3f8) {
+ /* found preferred console */
+ ppc_console_addr = regs[1];
+ ppc_console_qhandle = qhandle;
+ ppc_console_iomem=0; /* 0 means io, 1 means mem */
+ }
+ if ((regs[1] == 0x2e8) && (ppc_console_addr == 0)) {
+ /* found nonpreferred console */
+ ppc_console_addr = regs[1];
+ ppc_console_qhandle = qhandle;
+ ppc_console_iomem=0; /* 0 means io, 1 means mem */
+ }
+ }
+ if ((OF_getprop(qhandle, "clock-frequency", &freq, sizeof regs)) >= 0) {
+ /* MCG value for this does not agree with PC value,
+ * but works correctly (while PC value does not),
+ * does VI set this correctly???
+ */
+ ppc_console_serfreq=freq;
+ }
+}
+#include <machine/bat.h>
+/* HACK */
+#include <powerpc/pci/mpc106reg.h>
+void
+ofwconprobe()
+{
+ int qhandle, phandle;
+ char name[32];
+ for (qhandle = OF_peer(0); qhandle; qhandle = phandle) {
+ if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0)
+ {
+ if (strcmp (name, "serial") == 0) {
+ ofwtrysercon (name, qhandle);
+ }
+ }
+
+ if (phandle = OF_child(qhandle))
+ continue;
+ while (qhandle) {
+ if (phandle = OF_peer(qhandle))
+ break;
+ qhandle = OF_parent(qhandle);
+ }
+ }
+ /* setup pci/isa as necessary to found map io area */
+#if 0
+ printf("found desired console address %x qhandle %x serfreq %x\n",
+ ppc_console_addr, ppc_console_qhandle,
+ ppc_console_serfreq);
+#endif
+
+ /* do this from probed values, not from constants */
+ addbatmap(MPC106_V_ISA_IO_SPACE, MPC106_P_ISA_IO_SPACE, BAT_I);
+ addbatmap(0xB0000000, 0xB0000000, BAT_I); /* map interrupt vector */
+}