summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authormatt <matt@NetBSD.org>2001-06-06 17:50:14 +0000
committermatt <matt@NetBSD.org>2001-06-06 17:50:14 +0000
commit695e5e7ab54a06ae10a2fdf84a30caf63e4aa3f2 (patch)
tree1180dc1eb4d7afbb32522e27d478b1015aac4658 /sys
parentf294982771784a3eb3a40acd4d4645132156b612 (diff)
Changes new pmap, common param.h, vmparam.h, and moved includes.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/conf/std.macppc3
-rw-r--r--sys/arch/macppc/dev/ofb.c6
-rw-r--r--sys/arch/macppc/include/param.h88
-rw-r--r--sys/arch/macppc/include/pmap.h4
-rw-r--r--sys/arch/macppc/include/pte.h4
-rw-r--r--sys/arch/macppc/include/vmparam.h78
-rw-r--r--sys/arch/macppc/macppc/bus_dma.c18
-rw-r--r--sys/arch/macppc/macppc/cpu.c6
-rw-r--r--sys/arch/macppc/macppc/locore.S3
-rw-r--r--sys/arch/macppc/macppc/machdep.c25
-rw-r--r--sys/arch/macppc/macppc/rbus_machdep.c4
-rw-r--r--sys/arch/macppc/pci/pci_machdep.c4
12 files changed, 48 insertions, 195 deletions
diff --git a/sys/arch/macppc/conf/std.macppc b/sys/arch/macppc/conf/std.macppc
index 2ef41c4f23d..6895b7e142f 100644
--- a/sys/arch/macppc/conf/std.macppc
+++ b/sys/arch/macppc/conf/std.macppc
@@ -1,10 +1,11 @@
-# $NetBSD: std.macppc,v 1.10 2001/02/04 17:33:42 briggs Exp $
+# $NetBSD: std.macppc,v 1.11 2001/06/06 17:50:14 matt Exp $
#
# Standard/required options for NetBSD/macppc.
machine macppc powerpc
# standard ("mandatory") kernel options.
+options PPC_MPC6XX # Motorola STD PPC chips
# Executable support:
options EXEC_ELF32 # (native) ELF32 binary support
diff --git a/sys/arch/macppc/dev/ofb.c b/sys/arch/macppc/dev/ofb.c
index 500cf25758a..46d28a59739 100644
--- a/sys/arch/macppc/dev/ofb.c
+++ b/sys/arch/macppc/dev/ofb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ofb.c,v 1.18 2001/03/15 19:48:04 tsubai Exp $ */
+/* $NetBSD: ofb.c,v 1.19 2001/06/06 17:50:15 matt Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -48,8 +48,8 @@
#include <dev/ofw/ofw_pci.h>
-#include <machine/bat.h>
#include <machine/bus.h>
+#include <powerpc/mpc6xx/bat.h>
#include <machine/grfioctl.h>
#include <macppc/dev/ofbvar.h>
@@ -553,10 +553,12 @@ ofb_putcmap(sc, cm)
g = &sc->sc_cmap_green[index];
b = &sc->sc_cmap_blue[index];
+#if 0
for (i = 0; i < count; i++) {
OF_call_method_1("color!", dc->dc_ih, 4, *r, *g, *b, index);
r++, g++, b++, index++;
}
+#endif
return 0;
}
diff --git a/sys/arch/macppc/include/param.h b/sys/arch/macppc/include/param.h
index 6d6c323b804..2cca21fd55a 100644
--- a/sys/arch/macppc/include/param.h
+++ b/sys/arch/macppc/include/param.h
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.11 2001/05/30 12:28:46 mrg Exp $ */
+/* $NetBSD: param.h,v 1.12 2001/06/06 17:50:15 matt Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -41,97 +41,13 @@
* Machine dependent constants for PowerPC (32-bit only currently)
*/
#define MACHINE "macppc"
-#define MACHINE_ARCH "powerpc"
-#define MID_MACHINE MID_POWERPC
-
-#define ALIGNBYTES (sizeof(double) - 1)
-#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
-
-#define PGSHIFT 12
-#define NBPG (1 << PGSHIFT) /* Page size */
-#define PGOFSET (NBPG - 1)
-
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE NBPG
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define UPAGES 4
-#define USPACE (UPAGES * NBPG)
-
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE NBPG /* default message buffer size */
-#endif
-
#define KERNBASE 0x100000
/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than NBPG (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#define MSIZE 256 /* size of an mbuf */
-#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
-#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
-
-#ifndef NMBCLUSTERS
-
-#if defined(_KERNEL_OPT)
-#include "opt_gateway.h"
-#endif
-
-#ifdef GATEWAY
-#define NMBCLUSTERS 512 /* map size, max cluster allocation */
-#else
-#define NMBCLUSTERS 256 /* map size, max cluster allocation */
-#endif
-#endif
-
-/*
* Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((48 * 1024 * 1024) >> PAGE_SHIFT)
-/*
- * pages ("clicks") to disk blocks
- */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-/*
- * bytes to pages
- */
-#define ctob(x) ((x) << PGSHIFT)
-#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
-
-/*
- * bytes to disk blocks
- */
-#define dbtob(x) ((x) << DEV_BSHIFT)
-#define btodb(x) ((x) >> DEV_BSHIFT)
-
-/*
- * Segment handling stuff
- */
-#define SEGMENT_LENGTH 0x10000000
-#define SEGMENT_MASK 0xf0000000
-
-/*
- * Fixed segments
- */
-#define USER_SR 13
-#define KERNEL_SR 14
-#define KERNEL_SEGMENT (0xf00000 + KERNEL_SR)
-#define EMPTY_SEGMENT 0xfffff0
-#define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT))
-
-/*
- * Some system constants
- */
-#ifndef NPMAPS
-#define NPMAPS 32768 /* Number of pmaps in system */
-#endif
+#include <powerpc/param.h>
diff --git a/sys/arch/macppc/include/pmap.h b/sys/arch/macppc/include/pmap.h
index 79bba537efd..d7dd1ba34ee 100644
--- a/sys/arch/macppc/include/pmap.h
+++ b/sys/arch/macppc/include/pmap.h
@@ -1,3 +1,3 @@
-/* $NetBSD: pmap.h,v 1.2 1998/05/29 10:32:53 tsubai Exp $ */
+/* $NetBSD: pmap.h,v 1.3 2001/06/06 17:50:15 matt Exp $ */
-#include <powerpc/pmap.h>
+#include <powerpc/mpc6xx/pmap.h>
diff --git a/sys/arch/macppc/include/pte.h b/sys/arch/macppc/include/pte.h
index 7b50cc6135f..38d89485138 100644
--- a/sys/arch/macppc/include/pte.h
+++ b/sys/arch/macppc/include/pte.h
@@ -1,3 +1,3 @@
-/* $NetBSD: pte.h,v 1.2 1998/05/29 10:32:54 tsubai Exp $ */
+/* $NetBSD: pte.h,v 1.3 2001/06/06 17:50:15 matt Exp $ */
-#include <powerpc/pte.h>
+#include <powerpc/mpc6xx/pte.h>
diff --git a/sys/arch/macppc/include/vmparam.h b/sys/arch/macppc/include/vmparam.h
index 00e78cca436..5b47c092022 100644
--- a/sys/arch/macppc/include/vmparam.h
+++ b/sys/arch/macppc/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.16 2001/05/01 02:19:17 thorpej Exp $ */
+/* $NetBSD: vmparam.h,v 1.17 2001/06/06 17:50:16 matt Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,80 +34,6 @@
#ifndef _MACHINE_VMPARAM_H_
#define _MACHINE_VMPARAM_H_
-#define USRTEXT NBPG
-#define USRSTACK VM_MAXUSER_ADDRESS
-
-#ifndef MAXTSIZ
-#define MAXTSIZ (64*1024*1024) /* max text size */
-#endif
-
-#ifndef DFLDSIZ
-#define DFLDSIZ (128*1024*1024) /* default data size */
-#endif
-
-#ifndef MAXDSIZ
-#define MAXDSIZ (1*1024*1024*1024) /* max data size */
-#endif
-
-#ifndef DFLSSIZ
-#define DFLSSIZ (2*1024*1024) /* default stack size */
-#endif
-
-#ifndef MAXSSIZ
-#define MAXSSIZ (32*1024*1024) /* max stack size */
-#endif
-
-/*
- * Size of shared memory map
- */
-#ifndef SHMMAXPGS
-#define SHMMAXPGS 1024
-#endif
-
-/*
- * Size of User Raw I/O map
- */
-#define USRIOSIZE 1024
-
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a ``long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
-
-/*
- * Would like to have MAX addresses = 0, but this doesn't (currently) work
- */
-#define VM_MIN_ADDRESS ((vaddr_t)0)
-#define VM_MAXUSER_ADDRESS ((vaddr_t)0x7ffff000)
-#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
-#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)(KERNEL_SR << ADDR_SR_SHFT))
-#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + SEGMENT_LENGTH - 1)
-
-/* XXX max. amount of KVM to be used by buffers. */
-#ifndef VM_MAX_KERNEL_BUF
-#define VM_MAX_KERNEL_BUF (SEGMENT_LENGTH / 2)
-#endif
-
-#define VM_PHYS_SIZE (USRIOSIZE * NBPG)
-
-#define __HAVE_PMAP_PHYSSEG
-
-struct pmap_physseg {
- struct pv_entry *pvent;
- char *attrs;
-};
-
-#define VM_PHYSSEG_MAX 16 /* 1? */
-#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
-#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */
-
-#define VM_NFREELIST 1
-#define VM_FREELIST_DEFAULT 0
+#include <powerpc/mpc6xx/vmparam.h>
#endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/macppc/macppc/bus_dma.c b/sys/arch/macppc/macppc/bus_dma.c
index 371fb73d442..e0147f8051f 100644
--- a/sys/arch/macppc/macppc/bus_dma.c
+++ b/sys/arch/macppc/macppc/bus_dma.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.19 2001/05/26 21:27:09 chs Exp $ */
+/* $NetBSD: bus_dma.c,v 1.20 2001/06/06 17:50:16 matt Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -418,14 +418,18 @@ _bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
int *rsegs;
int flags;
{
- paddr_t avail_start, avail_end;
+ paddr_t avail_start = 0xffffffff, avail_end = 0;
paddr_t curaddr, lastaddr, high;
struct vm_page *m;
struct pglist mlist;
- int curseg, error;
+ int curseg, error, bank;
- avail_start = vm_physmem[0].avail_start << PGSHIFT;
- avail_end = vm_physmem[vm_nphysseg - 1].avail_end << PGSHIFT;
+ for (bank = 0; bank < vm_nphysseg; bank++) {
+ if (avail_start > vm_physmem[bank].avail_start << PGSHIFT)
+ avail_start = vm_physmem[bank].avail_start << PGSHIFT;
+ if (avail_end < vm_physmem[bank].avail_end << PGSHIFT)
+ avail_end = vm_physmem[bank].avail_end << PGSHIFT;
+ }
/* Always round the size. */
size = round_page(size);
@@ -538,9 +542,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
addr += NBPG, va += NBPG, size -= NBPG) {
if (size == 0)
panic("_bus_dmamem_map: size botch");
- pmap_enter(pmap_kernel(), va, addr,
- VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED);
+ pmap_kenter_pa(va, addr, VM_PROT_READ | VM_PROT_WRITE);
}
}
pmap_update();
diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c
index 6dc33825282..00b6bd090b1 100644
--- a/sys/arch/macppc/macppc/cpu.c
+++ b/sys/arch/macppc/macppc/cpu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.19 2001/03/22 04:11:46 tsubai Exp $ */
+/* $NetBSD: cpu.c,v 1.20 2001/06/06 17:50:16 matt Exp $ */
/*-
* Copyright (c) 2001 Tsubai Masanari.
@@ -41,11 +41,11 @@
#include <uvm/uvm_extern.h>
#include <dev/ofw/openfirm.h>
-#include <powerpc/hid.h>
+#include <powerpc/mpc6xx/hid.h>
#include <powerpc/openpic.h>
#include <machine/autoconf.h>
-#include <machine/bat.h>
+#include <powerpc/mpc6xx/bat.h>
#include <machine/pcb.h>
#include <machine/pio.h>
diff --git a/sys/arch/macppc/macppc/locore.S b/sys/arch/macppc/macppc/locore.S
index f992ed5099f..c10831b0239 100644
--- a/sys/arch/macppc/macppc/locore.S
+++ b/sys/arch/macppc/macppc/locore.S
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.38 2001/03/22 04:11:46 tsubai Exp $ */
+/* $NetBSD: locore.S,v 1.39 2001/06/06 17:50:16 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -44,6 +44,7 @@
#include <machine/psl.h>
#include <machine/trap.h>
#include <machine/asm.h>
+#include <machine/vmparam.h>
/*
* Some instructions gas doesn't understand (yet?)
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index 1d504ed06dc..184bf57a70b 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.96 2001/06/02 18:09:15 chs Exp $ */
+/* $NetBSD: machdep.c,v 1.97 2001/06/06 17:50:16 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -58,10 +58,10 @@
#include <net/netisr.h>
-#include <machine/bat.h>
#include <machine/powerpc.h>
#include <machine/trap.h>
#include <machine/bus.h>
+#include <powerpc/mpc6xx/bat.h>
#include <dev/cons.h>
#include <dev/ofw/openfirm.h>
@@ -163,8 +163,8 @@ initppc(startkernel, endkernel, args)
/*
* Set up BAT0 to only map the lowest 256 MB area
*/
- battable[0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
- battable[0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
+ battable[0x0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
+ battable[0x0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
/*
* Map PCI memory space.
@@ -178,6 +178,9 @@ initppc(startkernel, endkernel, args)
battable[0xa].batl = BATL(0xa0000000, BAT_I, BAT_PP_RW);
battable[0xa].batu = BATU(0xa0000000, BAT_BL_256M, BAT_Vs);
+ battable[0xb].batl = BATL(0xb0000000, BAT_I, BAT_PP_RW);
+ battable[0xb].batu = BATU(0xb0000000, BAT_BL_256M, BAT_Vs);
+
/*
* Map obio devices.
*/
@@ -445,7 +448,7 @@ cpu_startup()
printf("%s", version);
identifycpu(cpu_model);
- format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
+ format_bytes(pbuf, sizeof(pbuf), ctob((u_int)physmem));
printf("total memory = %s\n", pbuf);
/*
@@ -490,9 +493,8 @@ cpu_startup()
if (pg == NULL)
panic("cpu_startup: not enough memory for "
"buffer cache");
- pmap_enter(kernel_map->pmap, curbuf,
- VM_PAGE_TO_PHYS(pg), VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
+ pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
+ VM_PROT_READ|VM_PROT_WRITE);
curbuf += PAGE_SIZE;
curbufsize -= PAGE_SIZE;
}
@@ -512,11 +514,15 @@ cpu_startup()
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
+#ifndef PMAP_MAP_POOLPAGE
/*
* No need to allocate an mbuf cluster submap. Mbuf clusters
* are allocated via the pool allocator, and we use direct-mapped
* pool pages.
*/
+ mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
+ mclbytes*nmbclusters, VM_MAP_INTRSAFE, FALSE, NULL);
+#endif
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
@@ -744,8 +750,7 @@ mapiodev(pa, len)
return NULL;
for (; len > 0; len -= NBPG) {
- pmap_enter(pmap_kernel(), taddr, faddr,
- VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
+ pmap_kenter_pa(taddr, faddr, VM_PROT_READ | VM_PROT_WRITE);
faddr += NBPG;
taddr += NBPG;
}
diff --git a/sys/arch/macppc/macppc/rbus_machdep.c b/sys/arch/macppc/macppc/rbus_machdep.c
index 629df905832..20cbd948d7c 100644
--- a/sys/arch/macppc/macppc/rbus_machdep.c
+++ b/sys/arch/macppc/macppc/rbus_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rbus_machdep.c,v 1.7 2000/08/02 09:02:46 tsubai Exp $ */
+/* $NetBSD: rbus_machdep.c,v 1.8 2001/06/06 17:50:17 matt Exp $ */
/*
* Copyright (c) 1999
@@ -33,8 +33,8 @@
#include <uvm/uvm_extern.h>
-#include <machine/bat.h>
#include <machine/bus.h>
+#include <powerpc/mpc6xx/bat.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
diff --git a/sys/arch/macppc/pci/pci_machdep.c b/sys/arch/macppc/pci/pci_machdep.c
index 9095d073e0a..d266238d059 100644
--- a/sys/arch/macppc/pci/pci_machdep.c
+++ b/sys/arch/macppc/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.15 2001/01/09 08:04:53 tsubai Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.16 2001/06/06 17:50:17 matt Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -356,7 +356,7 @@ find_node_intr(node, addr, intr)
{
int parent, len, mlen, iparent;
int match, i;
- u_int32_t map[64], *mp;
+ u_int32_t map[160], *mp;
u_int32_t imask[8], maskedaddr[8];
u_int32_t icells;
char name[32];