summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-01 20:42:40 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-01 20:42:40 +0000
commit460628dca858056a6128b963d940a4804897b9dc (patch)
tree6d2f471efc0ba8482aee1bcd1f1af0e9add67ab1
parentc23355c3c24bd2208ba93faf001f65b227fdfb41 (diff)
Remove the almost unused abstraction around "struct firmware" and use
instead a single function ppc_mem_regions() required by the ppc pmap. ok kettenis@
-rw-r--r--sys/arch/powerpc/include/powerpc.h (renamed from sys/arch/socppc/include/powerpc.h)53
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c9
-rw-r--r--sys/arch/socppc/include/intr.h4
-rw-r--r--sys/arch/socppc/socppc/autoconf.c7
-rw-r--r--sys/arch/socppc/socppc/machdep.c29
5 files changed, 19 insertions, 83 deletions
diff --git a/sys/arch/socppc/include/powerpc.h b/sys/arch/powerpc/include/powerpc.h
index 378d9259b93..a94979ef4d6 100644
--- a/sys/arch/socppc/include/powerpc.h
+++ b/sys/arch/powerpc/include/powerpc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: powerpc.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */
+/* $OpenBSD: powerpc.h,v 1.8 2014/04/01 20:42:39 mpi Exp $ */
/* $NetBSD: powerpc.h,v 1.1 1996/09/30 16:34:30 ws Exp $ */
/*
@@ -32,63 +32,22 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _MACHINE_POWERPC_H_
-#define _MACHINE_POWERPC_H_
+#ifndef _POWERPC_POWERPC_H_
+#define _POWERPC_POWERPC_H_
struct mem_region {
vaddr_t start;
vsize_t size;
};
-void mem_regions(struct mem_region **, struct mem_region **);
-
-/*
- * These two functions get used solely in boot() in machdep.c.
- *
- * Not sure whether boot itself should be implementation dependent instead. XXX
- */
-typedef void (exit_f)(void) /*__attribute__((__noreturn__))*/ ;
-typedef void (boot_f)(char *bootspec) /* __attribute__((__noreturn__))*/ ;
-typedef void (vmon_f)(void);
-
-/* firmware interface.
- * regardless of type of firmware used several items
- * are need from firmware to boot up.
- * these include:
- * memory information
- * vmsetup for firmware calls.
- * default character print mechanism ???
- * firmware exit (return)
- * firmware boot (reset)
- * vmon - tell firmware the bsd vm is active.
- */
-
-typedef void (mem_regions_f)(struct mem_region **memp,
- struct mem_region **availp);
-
-struct firmware {
- mem_regions_f *mem_regions;
- exit_f *exit;
- boot_f *boot;
- vmon_f *vmon;
-
-#ifdef FW_HAS_PUTC
- boot_f *putc;
-#endif
-};
-extern struct firmware *fw;
-int ppc_open_pci_bridge(void);
-void ppc_close_pci_bridge(int);
-void install_extint(void (*handler) (void));
-void ppc_intr_enable(int enable);
-int ppc_intr_disable(void);
+void ppc_mem_regions(struct mem_region **, struct mem_region **);
struct dumpmem {
vaddr_t start;
vsize_t end;
};
+
extern struct dumpmem dumpmem[VM_PHYSSEG_MAX];
extern u_int ndumpmem;
-extern vaddr_t dumpspace;
-#endif /* _MACHINE_POWERPC_H_ */
+#endif /* _POWERPC_POWERPC_H_ */
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index 0ca34dc7599..c9f1f19adec 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.126 2014/03/31 18:58:41 mpi Exp $ */
+/* $OpenBSD: pmap.c,v 1.127 2014/04/01 20:42:39 mpi Exp $ */
/*
* Copyright (c) 2001, 2002, 2007 Dale Rahn.
@@ -84,7 +84,7 @@
#include <uvm/uvm_extern.h>
#include <machine/pcb.h>
-#include <machine/powerpc.h>
+#include <powerpc/powerpc.h>
#include <machine/pmap.h>
#include <machine/db_machdep.h>
@@ -93,6 +93,9 @@
#include <powerpc/lock.h>
+struct dumpmem dumpmem[VM_PHYSSEG_MAX];
+u_int ndumpmem;
+
struct pmap kernel_pmap_;
static struct mem_region *pmap_mem, *pmap_avail;
struct mem_region pmap_allocated[10];
@@ -1398,7 +1401,7 @@ pmap_avail_setup(void)
struct mem_region *mp;
int pmap_physmem;
- (fw->mem_regions) (&pmap_mem, &pmap_avail);
+ ppc_mem_regions(&pmap_mem, &pmap_avail);
pmap_cnt_avail = 0;
pmap_physmem = 0;
diff --git a/sys/arch/socppc/include/intr.h b/sys/arch/socppc/include/intr.h
index f79a4c6d006..81d1d57b556 100644
--- a/sys/arch/socppc/include/intr.h
+++ b/sys/arch/socppc/include/intr.h
@@ -1,11 +1,9 @@
-/* $OpenBSD: intr.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */
+/* $OpenBSD: intr.h,v 1.2 2014/04/01 20:42:39 mpi Exp $ */
#include <powerpc/intr.h>
#ifndef _LOCORE
-void softtty(void);
-
void *intr_establish(int, int, int, int (*)(void *), void *, const char *);
#endif
diff --git a/sys/arch/socppc/socppc/autoconf.c b/sys/arch/socppc/socppc/autoconf.c
index bd0c90758e1..f7447d4e184 100644
--- a/sys/arch/socppc/socppc/autoconf.c
+++ b/sys/arch/socppc/socppc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.4 2009/10/01 20:19:19 kettenis Exp $ */
+/* $OpenBSD: autoconf.c,v 1.5 2014/04/01 20:42:39 mpi Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
@@ -22,15 +22,10 @@
#include <uvm/uvm_extern.h>
-#include <machine/powerpc.h>
-
void dumpconf(void);
int cold = 1;
-struct dumpmem dumpmem[VM_PHYSSEG_MAX];
-u_int ndumpmem;
-
void
cpu_configure(void)
{
diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c
index e8c8dfa0772..87f0deda4fc 100644
--- a/sys/arch/socppc/socppc/machdep.c
+++ b/sys/arch/socppc/socppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.44 2014/03/31 18:58:41 mpi Exp $ */
+/* $OpenBSD: machdep.c,v 1.45 2014/04/01 20:42:39 mpi Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -55,7 +55,7 @@
#include <machine/bus.h>
#include <machine/fdt.h>
#include <machine/pio.h>
-#include <machine/powerpc.h>
+#include <powerpc/powerpc.h>
#include <machine/trap.h>
#include <dev/cons.h>
@@ -109,18 +109,6 @@ struct bd_info {
extern struct bd_info **fwargsave;
extern struct fdt_head *fwfdtsave;
-void uboot_mem_regions(struct mem_region **, struct mem_region **);
-void uboot_vmon(void);
-
-struct firmware uboot_firmware = {
- uboot_mem_regions,
- NULL,
- NULL,
- uboot_vmon
-};
-
-struct firmware *fw = &uboot_firmware;
-
#ifdef APERTURE
#ifdef INSECURE
int allowaperture = 1;
@@ -372,8 +360,6 @@ initppc(u_int startkernel, u_int endkernel, char *args)
/*
* Now enable translation (and machine checks/recoverable interrupts).
*/
- (fw->vmon)();
-
__asm__ volatile ("eieio; mfmsr %0; ori %0,%0,%1; mtmsr %0; sync;isync"
: "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI));
@@ -1030,7 +1016,7 @@ dumpconf(void)
}
#define BYTES_PER_DUMP (PAGE_SIZE) /* must be a multiple of pagesize */
-vaddr_t dumpspace;
+static vaddr_t dumpspace;
int
reserve_dumppages(caddr_t p)
@@ -1094,7 +1080,7 @@ haltsys:
}
printf("halted\n\n");
- (fw->exit)();
+ for (;;);
}
printf("rebooting\n\n");
@@ -1179,7 +1165,7 @@ kcopy(const void *from, void *to, size_t size)
struct mem_region uboot_mem[2], uboot_avail[4];
void
-uboot_mem_regions(struct mem_region **memp, struct mem_region **availp)
+ppc_mem_regions(struct mem_region **memp, struct mem_region **availp)
{
uboot_mem[0].start = bootinfo.bi_memstart;
uboot_mem[0].size = bootinfo.bi_memsize;
@@ -1196,11 +1182,6 @@ uboot_mem_regions(struct mem_region **memp, struct mem_region **availp)
}
void
-uboot_vmon(void)
-{
-}
-
-void
myetheraddr(u_char *cp)
{
bcopy(bootinfo.bi_enetaddr, cp, sizeof bootinfo.bi_enetaddr);