summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2001-06-24 23:29:38 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2001-06-24 23:29:38 +0000
commit33c5e8f5cc9ee1a24f3c8307931b695b643ed023 (patch)
tree4871009c02648dac8ae2b1f8aa4cf68973898211 /sys/arch/powerpc
parent51ff31dd04b4d88a157fb57e53db8f19efd899fb (diff)
-Warn cleanups for powerpc, still not done.
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r--sys/arch/powerpc/powerpc/dma.c7
-rw-r--r--sys/arch/powerpc/powerpc/fubyte.c7
-rw-r--r--sys/arch/powerpc/powerpc/fuswintr.c5
-rw-r--r--sys/arch/powerpc/powerpc/mem.c20
-rw-r--r--sys/arch/powerpc/powerpc/ofw_machdep.c38
-rw-r--r--sys/arch/powerpc/powerpc/openfirm.c7
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c108
-rw-r--r--sys/arch/powerpc/powerpc/wscons_machdep.c3
8 files changed, 121 insertions, 74 deletions
diff --git a/sys/arch/powerpc/powerpc/dma.c b/sys/arch/powerpc/powerpc/dma.c
index ca02c114b77..1404c3ae9ed 100644
--- a/sys/arch/powerpc/powerpc/dma.c
+++ b/sys/arch/powerpc/powerpc/dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma.c,v 1.4 2001/06/08 08:09:21 art Exp $ */
+/* $OpenBSD: dma.c,v 1.5 2001/06/24 23:29:33 drahn Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -60,6 +60,9 @@
#endif
#include <machine/bus.h>
+int _dmamem_alloc_range( bus_dma_tag_t t, bus_size_t size,
+ bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs,
+ int nsegs, int *rsegs, int flags, vm_offset_t low, vm_offset_t high);
/*
* Common function for DMA map creation. May be called by bus-specific
@@ -308,8 +311,6 @@ _dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
int *rsegs;
int flags;
{
- extern int avail_end;
-
return (_dmamem_alloc_range(t, size, alignment, boundary,
segs, nsegs, rsegs, flags, 0, 0xf0000000));
}
diff --git a/sys/arch/powerpc/powerpc/fubyte.c b/sys/arch/powerpc/powerpc/fubyte.c
index 638a661a571..a8427b48ba9 100644
--- a/sys/arch/powerpc/powerpc/fubyte.c
+++ b/sys/arch/powerpc/powerpc/fubyte.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fubyte.c,v 1.2 1996/12/28 06:21:58 rahnds Exp $ */
+/* $OpenBSD: fubyte.c,v 1.3 2001/06/24 23:29:33 drahn Exp $ */
/* $NetBSD: fubyte.c,v 1.1 1996/09/30 16:34:45 ws Exp $ */
/*-
@@ -32,12 +32,15 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/types.h>
+#include <sys/systm.h>
+
/*
* Emulate fubyte.
*/
int
fubyte(addr)
-char *addr;
+ void *addr;
{
unsigned char c;
diff --git a/sys/arch/powerpc/powerpc/fuswintr.c b/sys/arch/powerpc/powerpc/fuswintr.c
index 1e72b4b209e..6fc884792b4 100644
--- a/sys/arch/powerpc/powerpc/fuswintr.c
+++ b/sys/arch/powerpc/powerpc/fuswintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuswintr.c,v 1.2 1996/12/28 06:21:59 rahnds Exp $ */
+/* $OpenBSD: fuswintr.c,v 1.3 2001/06/24 23:29:34 drahn Exp $ */
/* $NetBSD: fuswintr.c,v 1.1 1996/09/30 16:34:45 ws Exp $ */
/*-
@@ -32,6 +32,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/types.h>
+#include <sys/systm.h>
+
/*
* Emulate fuswintr
*
diff --git a/sys/arch/powerpc/powerpc/mem.c b/sys/arch/powerpc/powerpc/mem.c
index bff71b64091..846e6d16a5a 100644
--- a/sys/arch/powerpc/powerpc/mem.c
+++ b/sys/arch/powerpc/powerpc/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.7 2001/05/05 20:56:51 art Exp $ */
+/* $OpenBSD: mem.c,v 1.8 2001/06/24 23:29:35 drahn Exp $ */
/* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */
/*
@@ -46,19 +46,26 @@
*/
#include <sys/param.h>
-#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/systm.h>
+#include <sys/ioccom.h>
#include <sys/uio.h>
#include <sys/malloc.h>
+#include <sys/types.h>
+
+#include <machine/cpu.h>
#include <vm/vm.h>
+#include <uvm/uvm_extern.h>
+
+#include <machine/conf.h>
/*ARGSUSED*/
int
-mmopen(dev, flag, mode)
+mmopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
+ struct proc *p;
{
switch (minor(dev)) {
@@ -74,9 +81,10 @@ mmopen(dev, flag, mode)
/*ARGSUSED*/
int
-mmclose(dev, flag, mode)
+mmclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
+ struct proc *p;
{
return 0;
@@ -89,8 +97,8 @@ mmrw(dev, uio, flags)
struct uio *uio;
int flags;
{
- vm_offset_t o, v;
- u_int c;
+ vm_offset_t v;
+ vm_size_t c;
struct iovec *iov;
int error = 0;
static caddr_t zeropage;
diff --git a/sys/arch/powerpc/powerpc/ofw_machdep.c b/sys/arch/powerpc/powerpc/ofw_machdep.c
index 37d8934da46..8cd4e945947 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.21 2001/03/03 05:33:47 drahn Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.22 2001/06/24 23:29:35 drahn Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */
/*
@@ -49,7 +49,15 @@
#include <machine/powerpc.h>
#include <machine/autoconf.h>
+#include <dev/ofw/openfirm.h>
+
#include <ukbd.h>
+#include <dev/usb/ukbdvar.h>
+#include <powerpc/mac/akbdvar.h>
+
+/* XXX, called from asm */
+int save_ofw_mapping(void);
+int restore_ofw_mapping(void);
void OF_exit __P((void)) __attribute__((__noreturn__));
void OF_boot __P((char *bootspec)) __attribute__((__noreturn__));
@@ -80,7 +88,7 @@ void
ofw_mem_regions(memp, availp)
struct mem_region **memp, **availp;
{
- int phandle, i, j, cnt;
+ int phandle;
/*
* Get memory.
@@ -125,6 +133,7 @@ static struct {
int OF_stdout;
int OF_stdin;
+
int
save_ofw_mapping()
{
@@ -188,14 +197,12 @@ restore_ofw_mapping()
return 0;
}
-#include <dev/ofw/openfirm.h>
-
typedef void (void_f) (void);
extern void_f *pending_int_f;
-void ofw_do_pending_int();
+void ofw_do_pending_int(void);
extern int system_type;
-void ofw_intr_init();
+void ofw_intr_init(void);
void
ofrootfound()
{
@@ -253,9 +260,7 @@ ofw_intr_init()
void
ofw_do_pending_int()
{
- int vector;
int pcpl;
- int hwpend;
int emsr, dmsr;
static int processing;
@@ -269,7 +274,7 @@ static int processing;
pcpl = splhigh(); /* Turn off all */
- if((ipending & SINT_CLOCK) && (pcpl & imask[IPL_CLOCK] == 0)) {
+ if((ipending & SINT_CLOCK) && ((pcpl & imask[IPL_CLOCK]) == 0)) {
ipending &= ~SINT_CLOCK;
softclock();
}
@@ -285,6 +290,7 @@ static int processing;
__asm__ volatile("mtmsr %0" :: "r"(emsr));
processing = 0;
}
+#if 0
u_int32_t ppc_console_iomem=0;
u_int32_t ppc_console_addr=0;
u_int32_t ppc_console_qhandle=0;
@@ -320,12 +326,14 @@ ofwtrysercon(char *name, int qhandle)
ppc_console_serfreq=freq;
}
}
+#endif
#include <dev/pci/pcivar.h>
#include <arch/powerpc/pci/vgafb_pcivar.h>
+static pcitag_t ofw_make_tag( void *cpv, int bus, int dev, int fnc);
-static
-pcitag_t
+/* ARGSUSED */
+static pcitag_t
ofw_make_tag(cpv, bus, dev, fnc)
void *cpv;
int bus, dev, fnc;
@@ -333,6 +341,8 @@ ofw_make_tag(cpv, bus, dev, fnc)
return (bus << 16) | (dev << 11) | (fnc << 8);
}
+#if 0
+/* XXX */
void
ofwenablepcimemio(char *name, int qhandle)
{
@@ -341,6 +351,7 @@ ofwenablepcimemio(char *name, int qhandle)
* on MCG, VI machines.
*/
}
+#endif
#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000
#define OFW_PCI_PHYS_HI_BUSSHIFT 16
#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800
@@ -381,7 +392,6 @@ ofwconprobe()
char iname[32];
int len;
int stdout_node, stdin_node;
- int parent;
int err;
u_int32_t memtag, iotag;
struct ppc_pci_chipset pa;
@@ -425,10 +435,8 @@ ofwconprobe()
printf("console in [%s] ", iname);
/* what to do about serial console? */
if (strcmp ("keyboard", iname) == 0) {
- int node;
struct usb_kbd_ihandles *ukbds;
int akbd;
- char type[20];
/* if there is a usb keyboard, we want it, do not
* dereference the pointer that is returned
*/
@@ -484,7 +492,7 @@ kbd_found:
#endif
{
- int i,j;
+ int i;
cons_membus->bus_base = 0x80000000;
cons_membus->bus_reverse = 1;
diff --git a/sys/arch/powerpc/powerpc/openfirm.c b/sys/arch/powerpc/powerpc/openfirm.c
index e4170bb4fca..ad27988930b 100644
--- a/sys/arch/powerpc/powerpc/openfirm.c
+++ b/sys/arch/powerpc/powerpc/openfirm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openfirm.c,v 1.7 2000/09/07 03:30:10 rahnds Exp $ */
+/* $OpenBSD: openfirm.c,v 1.8 2001/06/24 23:29:36 drahn Exp $ */
/* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */
/*
@@ -32,6 +32,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <machine/psl.h>
#include <machine/stdarg.h>
@@ -205,8 +206,9 @@ OF_finddevice(name)
return -1;
return args.phandle;
}
+static void OF_rboot(char *bootspec);
-void
+static void
OF_rboot(bootspec)
char *bootspec;
{
@@ -228,7 +230,6 @@ OF_rboot(bootspec)
/* will attempt exit in OF_boot */
}
-void OF_exit();
void
OF_boot(bootspec)
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index 18a699b4447..69d991e066f 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.31 2001/06/10 15:20:16 drahn Exp $ */
+/* $OpenBSD: pmap.c,v 1.32 2001/06/24 23:29:36 drahn Exp $ */
/* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */
/*
@@ -96,32 +96,31 @@ dump_avail()
}
#endif
+int pmap_vp_valid(pmap_t pm, vaddr_t va);
+void pmap_vp_enter(pmap_t pm, vaddr_t va, paddr_t pa);
+int pmap_vp_remove(pmap_t pm, vaddr_t va);
+void pmap_vp_destroy(pmap_t pm);
/* virtual to physical map */
static inline int
-VP_SR(va)
- paddr_t va;
+VP_SR(paddr_t va)
{
return (va >> VP_SR_POS) & VP_SR_MASK;
}
static inline int
-VP_IDX1(va)
- paddr_t va;
+VP_IDX1(paddr_t va)
{
return (va >> VP_IDX1_POS) & VP_IDX1_MASK;
}
static inline int
-VP_IDX2(va)
- paddr_t va;
+VP_IDX2(paddr_t va)
{
return (va >> VP_IDX2_POS) & VP_SR_MASK;
}
int
-pmap_vp_valid(pm, va)
- pmap_t pm;
- vaddr_t va;
+pmap_vp_valid(pmap_t pm, vaddr_t va)
{
pmapv_t *vp1;
vp1 = pm->vps[VP_SR(va)];
@@ -130,10 +129,9 @@ pmap_vp_valid(pm, va)
}
return 0;
}
+
int
-pmap_vp_remove(pm, va)
- pmap_t pm;
- vaddr_t va;
+pmap_vp_remove(pmap_t pm, vaddr_t va)
{
pmapv_t *vp1;
int s;
@@ -155,10 +153,7 @@ pmap_vp_remove(pm, va)
return retcode;
}
void
-pmap_vp_enter(pm, va, pa)
- pmap_t pm;
- vaddr_t va;
- paddr_t pa;
+pmap_vp_enter(pmap_t pm, vaddr_t va, paddr_t pa)
{
pmapv_t *vp1;
pmapv_t *mem1;
@@ -205,7 +200,10 @@ pmap_vp_destroy(pm)
pmap_t pm;
{
pmapv_t *vp1;
- int sr, idx1;
+ int sr;
+#ifdef SANITY
+ int idx1;
+#endif
for (sr = 0; sr < 32; sr++) {
vp1 = pm->vps[sr];
@@ -232,6 +230,8 @@ pmap_vp_destroy(pm)
}
static int vp_page0[1024];
static int vp_page1[1024];
+void pmap_vp_preinit(void);
+
void
pmap_vp_preinit()
{
@@ -259,24 +259,49 @@ struct pv_entry {
struct pv_entry *pv_table;
struct pool pmap_pv_pool;
-static struct pv_entry *pmap_alloc_pv __P((void));
-static void pmap_free_pv __P((struct pv_entry *));
+struct pv_entry *pmap_alloc_pv __P((void));
+void pmap_free_pv __P((struct pv_entry *));
struct pool pmap_po_pool;
-static struct pte_ovfl *poalloc __P((void));
-static void pofree __P((struct pte_ovfl *, int));
+struct pte_ovfl *poalloc __P((void));
+void pofree __P((struct pte_ovfl *, int));
static u_int usedsr[NPMAPS / sizeof(u_int) / 8];
static int pmap_initialized;
+static inline void tlbie(vm_offset_t ea);
+static inline void tlbsync(void);
+static inline void tlbia(void);
+static inline int ptesr(sr_t *sr, vm_offset_t addr);
+static inline int pteidx(sr_t sr, vm_offset_t addr);
+static inline int ptematch( pte_t *ptp, sr_t sr, vm_offset_t va, int which);
+int pte_insert(int idx, pte_t *pt);
+int pte_spill(vm_offset_t addr);
+int pmap_page_index(vm_offset_t pa);
+u_int pmap_free_pages(void);
+int pmap_next_page(vm_offset_t *paddr);
+struct pv_entry *pmap_alloc_pv(void);
+void pmap_free_pv(struct pv_entry *pv);
+struct pte_ovfl *poalloc(void);
+static inline int pmap_enter_pv(struct pmap *pm, int pteidx, vm_offset_t va,
+ vm_offset_t pa);
+void pmap_remove_pv(struct pmap *pm, int pteidx, vm_offset_t va,
+ u_int32_t pte_lo);
+pte_t * pte_find(struct pmap *pm, vm_offset_t va);
+
+/* XXX */
+void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot);
+void pmap_kenter_pgs(vaddr_t va, struct vm_page **pgs, int npgs);
+void pmap_kremove(vaddr_t va, vsize_t len);
+void addbatmap(u_int32_t vaddr, u_int32_t raddr, u_int32_t wimg);
+
/*
* These small routines may have to be replaced,
* if/when we support processors other that the 604.
*/
static inline void
-tlbie(ea)
- caddr_t ea;
+tlbie(vm_offset_t ea)
{
asm volatile ("tlbie %0" :: "r"(ea));
}
@@ -290,10 +315,10 @@ tlbsync()
static void
tlbia()
{
- caddr_t i;
+ vm_offset_t i;
asm volatile ("sync");
- for (i = 0; i < (caddr_t)0x00040000; i += 0x00001000)
+ for (i = 0; i < 0x00040000; i += 0x00001000)
tlbie(i);
tlbsync();
}
@@ -336,7 +361,7 @@ ptematch(ptp, sr, va, which)
* Note: *pt mustn't have PTE_VALID set.
* This is done here as required by Book III, 4.12.
*/
-static int
+int
pte_insert(idx, pt)
int idx;
pte_t *pt;
@@ -755,7 +780,7 @@ pmap_page_index(pa)
return -1;
}
#ifdef MACHINE_NEW_NONCONTIG
-static __inline struct pv_entry *
+static inline struct pv_entry *
pmap_find_pv(paddr_t pa)
{
int bank, off;
@@ -766,7 +791,7 @@ pmap_find_pv(paddr_t pa)
}
return NULL;
}
-static __inline char *
+static inline char *
pmap_find_attr(paddr_t pa)
{
int bank, off;
@@ -992,7 +1017,7 @@ pmap_copy_page(src, dst)
bcopy((caddr_t)src, (caddr_t)dst, NBPG);
}
-static struct pv_entry *
+struct pv_entry *
pmap_alloc_pv()
{
struct pv_entry *pv;
@@ -1021,7 +1046,7 @@ pmap_alloc_pv()
return pv;
}
-static void
+void
pmap_free_pv(pv)
struct pv_entry *pv;
{
@@ -1038,7 +1063,7 @@ pmap_free_pv(pv)
* before the VM system is initialized! XXX
* XXX - see pmap_alloc_pv
*/
-static struct pte_ovfl *
+struct pte_ovfl *
poalloc()
{
struct pte_ovfl *po;
@@ -1056,7 +1081,7 @@ poalloc()
return po;
}
-static void
+void
pofree(po, freepage)
struct pte_ovfl *po;
int freepage;
@@ -1090,7 +1115,7 @@ pmap_enter_pv(pm, pteidx, va, pa)
s = splimp();
- if (first = pv->pv_idx == -1) {
+ if ((first = pv->pv_idx) == -1) {
/*
* No entries yet, use header as the first entry.
*/
@@ -1114,7 +1139,7 @@ pmap_enter_pv(pm, pteidx, va, pa)
return first;
}
-static void
+void
pmap_remove_pv(pm, pteidx, va, pte_lo)
struct pmap *pm;
int pteidx;
@@ -1158,7 +1183,7 @@ pmap_remove_pv(pm, pteidx, va, pte_lo)
pv->pv_idx = -1;
}
} else {
- for (; npv = pv->pv_next; pv = npv) {
+ for (; (npv = pv->pv_next) != NULL; pv = npv) {
if (va == npv->pv_va && pm == npv->pv_pmap)
{
break;
@@ -1193,7 +1218,7 @@ pmap_enter(pm, va, pa, prot, wired, access_type)
vm_prot_t access_type;
{
sr_t sr;
- int idx, i, s;
+ int idx, s;
pte_t pte;
struct pte_ovfl *po;
struct mem_region *mp;
@@ -1308,7 +1333,6 @@ pmap_remove(pm, va, endva)
sr_t sr;
pte_t *ptp;
struct pte_ovfl *po, *npo;
- struct pv_entry *pv;
s = splimp();
for (; va < endva; va += NBPG) {
@@ -1361,7 +1385,7 @@ pmap_remove(pm, va, endva)
splx(s);
}
-static pte_t *
+pte_t *
pte_find(pm, va)
struct pmap *pm;
vm_offset_t va;
@@ -1432,7 +1456,7 @@ pmap_protect(pm, sva, eva, prot)
if (prot & VM_PROT_READ) {
s = splimp();
while (sva < eva) {
- if (ptp = pte_find(pm, sva)) {
+ if ((ptp = pte_find(pm, sva))) {
valid = ptp->pte_hi & PTE_VALID;
ptp->pte_hi &= ~PTE_VALID;
asm volatile ("sync");
@@ -1594,9 +1618,7 @@ pmap_page_protect(pa, prot)
vm_offset_t pa = VM_PAGE_TO_PHYS(pg);
#endif
vm_offset_t va;
- pte_t *ptp;
- struct pte_ovfl *po, *npo;
- int i, s, pind, idx;
+ int s;
struct pmap *pm;
struct pv_entry *pv;
diff --git a/sys/arch/powerpc/powerpc/wscons_machdep.c b/sys/arch/powerpc/powerpc/wscons_machdep.c
index 2b7a354b4cd..4abb121f1ab 100644
--- a/sys/arch/powerpc/powerpc/wscons_machdep.c
+++ b/sys/arch/powerpc/powerpc/wscons_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wscons_machdep.c,v 1.1 2001/03/01 23:19:34 drahn Exp $ */
+/* $OpenBSD: wscons_machdep.c,v 1.2 2001/06/24 23:29:37 drahn Exp $ */
/*
* Copyright (c) 2001 Aaron Campbell
@@ -46,6 +46,7 @@
#if NWSDISPLAY > 0
#include <dev/wscons/wsdisplayvar.h>
#endif
+#include <dev/wscons/wskbdvar.h>
void wscnprobe __P((struct consdev *));
void wscninit __P((struct consdev *));