PERFORCE change 120140 for review
Marcel Moolenaar
marcel at FreeBSD.org
Mon May 21 01:59:44 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=120140
Change 120140 by marcel at marcel_cluster on 2007/05/21 01:59:00
First round of cleanups.
Affected files ...
.. //depot/projects/e500/share/sendmail/Makefile#3 edit
.. //depot/projects/e500/sys/conf/NOTES#3 edit
.. //depot/projects/e500/sys/dev/md/md.c#3 edit
.. //depot/projects/e500/sys/dev/mii/miidevs#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_bfe.h#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_bfe_ebus.c#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_bfe_macio.c#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_bfe_sbus.c#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_core.c#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_dev_sab82532.c#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_dev_z8530.c#3 edit
.. //depot/projects/e500/sys/dev/scc/scc_if.m#3 edit
.. //depot/projects/e500/sys/dev/uart/uart_cpu_alpha.c#2 delete
.. //depot/projects/e500/sys/powerpc/aim/clock.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/copyinout.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/interrupt.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/locore.S#2 edit
.. //depot/projects/e500/sys/powerpc/aim/machdep.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/mem.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/nexus.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/ofw_machdep.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/trap.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/trap_subr.S#2 edit
.. //depot/projects/e500/sys/powerpc/aim/uio_machdep.c#2 edit
.. //depot/projects/e500/sys/powerpc/aim/vm_machdep.c#2 edit
.. //depot/projects/e500/sys/powerpc/include/gdb_machdep.h#3 edit
.. //depot/projects/e500/sys/powerpc/include/vmparam.h#3 edit
Differences ...
==== //depot/projects/e500/share/sendmail/Makefile#3 (text+ko) ====
@@ -4,8 +4,8 @@
SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
CFDIR= cf
-CFDIRS!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name .svn -prune \) -o -type d -print)
-CFFILES!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name .svn -prune \) -o -type f -print)
+CFDIRS!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name CVS -prune \) -o -type d -print)
+CFFILES!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name CVS -prune \) -o -type f -print)
DDIR= ${DESTDIR}/usr/share/sendmail
==== //depot/projects/e500/sys/conf/NOTES#3 (text+ko) ====
@@ -1739,11 +1739,6 @@
# communications controllers.
device scc
-# Serial Communications Controller
-# Supports the Siemens SAB 82532 and Zilog Z8530 multi-channel
-# communications controllers.
-device scc
-
# PCI Universal Communications driver
# Supports various multi port PCI I/O cards.
device puc
==== //depot/projects/e500/sys/dev/md/md.c#3 (text+ko) ====
@@ -1179,7 +1179,7 @@
sc->start = mdstart_preload;
#ifdef MD_ROOT
if (sc->unit == 0)
- rootdevnames[0] = "cd9660:/dev/md0";
+ rootdevnames[0] = "ufs:/dev/md0";
#endif
mdinit(sc);
}
@@ -1215,7 +1215,6 @@
ptr = *(u_char **)c;
c = preload_search_info(mod, MODINFO_SIZE);
len = *(size_t *)c;
- ptr = pmap_mapdev((uintptr_t)ptr, len);
printf("%s%d: Preloaded image <%s> %d bytes at %p\n",
MD_NAME, mdunits, name, len, ptr);
sx_xlock(&md_sx);
==== //depot/projects/e500/sys/dev/mii/miidevs#3 (text+ko) ====
@@ -207,20 +207,6 @@
model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY
model MARVELL E1116 0x0021 Marvell 88E1116 Gigabit PHY
model MARVELL E1118 0x0022 Marvell 88E1118 Gigabit PHY
-model MARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY
-model xxMARVELL E1011 0x0002 Marvell 88E1011 Gigabit PHY
-model xxMARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY
-model xxMARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY
-model xxMARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY
-model MARVELL E1000S 0x0004 Marvell 88E1000S Gigabit PHY
-model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY
-model MARVELL E1000_6 0x0006 Marvell 88E1000 Gigabit PHY
-model MARVELL E3082 0x0008 Marvell 88E3082 10/100 Fast Ethernet PHY
-model MARVELL E1112 0x0009 Marvell 88E1112 Gigabit PHY
-model MARVELL E1149 0x000b Marvell 88E1149 Gigabit PHY
-model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY
-model MARVELL E1116 0x0021 Marvell 88E1116 Gigabit PHY
-model MARVELL E1118 0x0022 Marvell 88E1118 Gigabit PHY
model xxMARVELL E1000 0x0005 Marvell 88E1000 Gigabit PHY
model xxMARVELL E1011 0x0002 Marvell 88E1011 Gigabit PHY
model xxMARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY
==== //depot/projects/e500/sys/dev/scc/scc_bfe.h#3 (text) ====
@@ -76,7 +76,7 @@
int m_probed:1;
int m_sysdev:1;
- driver_intr_t *ih;
+ driver_filter_t *ih;
serdev_intr_t *ih_src[SCC_ISRCCNT];
void *ih_arg;
};
@@ -140,7 +140,7 @@
int scc_bfe_attach(device_t dev);
int scc_bfe_detach(device_t dev);
-int scc_bfe_probe(device_t dev, u_int, u_int);
+int scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid);
struct resource *scc_bus_alloc_resource(device_t, device_t, int, int *,
u_long, u_long, u_long, u_int);
@@ -148,7 +148,7 @@
int scc_bus_read_ivar(device_t, device_t, int, uintptr_t *);
int scc_bus_release_resource(device_t, device_t, int, int, struct resource *);
int scc_bus_setup_intr(device_t, device_t, struct resource *, int,
- void (*)(void *), void *, void **);
+ driver_filter_t *, void (*)(void *), void *, void **);
int scc_bus_teardown_intr(device_t, device_t, struct resource *, void *);
#endif /* _DEV_SCC_BFE_H_ */
==== //depot/projects/e500/sys/dev/scc/scc_bfe_ebus.c#3 (text) ====
@@ -59,7 +59,7 @@
if (!strcmp(nm, "se") || !strcmp(cmpt, "sab82532")) {
device_set_desc(dev, "Siemens SAB 82532 dual channel SCC");
sc->sc_class = &scc_sab82532_class;
- return (scc_bfe_probe(dev, EBUS_REGSHFT, EBUS_RCLK));
+ return (scc_bfe_probe(dev, EBUS_REGSHFT, EBUS_RCLK, 0));
}
return (ENXIO);
}
==== //depot/projects/e500/sys/dev/scc/scc_bfe_macio.c#3 (text) ====
@@ -56,7 +56,7 @@
if (!strcmp(nm, "escc")) {
device_set_desc(dev, "Zilog Z8530 dual channel SCC");
sc->sc_class = &scc_z8530_class;
- return (scc_bfe_probe(dev, MACIO_REGSHFT, MACIO_RCLK));
+ return (scc_bfe_probe(dev, MACIO_REGSHFT, MACIO_RCLK, 0));
}
return (ENXIO);
}
==== //depot/projects/e500/sys/dev/scc/scc_bfe_sbus.c#3 (text) ====
@@ -56,7 +56,7 @@
if (!strcmp(nm, "zs")) {
device_set_desc(dev, "Zilog Z8530 dual channel SCC");
sc->sc_class = &scc_z8530_class;
- return (scc_bfe_probe(dev, SBUS_REGSHFT, SBUS_RCLK));
+ return (scc_bfe_probe(dev, SBUS_REGSHFT, SBUS_RCLK, 0));
}
return (ENXIO);
}
==== //depot/projects/e500/sys/dev/scc/scc_core.c#3 (text) ====
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/dev/scc/scc_core.c,v 1.10 2007/03/28 18:05:17 marcel Exp $");
-#define __RMAN_RESOURCE_VISIBLE
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -52,7 +50,7 @@
MALLOC_DEFINE(M_SCC, "SCC", "SCC driver");
-static void
+static int
scc_bfe_intr(void *arg)
{
struct scc_softc *sc = arg;
@@ -90,7 +88,9 @@
else
SCC_ICLEAR(sc, ch);
}
+ return (FILTER_HANDLED);
}
+ return (FILTER_STRAY);
}
int
@@ -225,12 +225,12 @@
if (ch->ch_ires == NULL)
continue;
error = bus_setup_intr(dev, ch->ch_ires,
- INTR_TYPE_TTY | INTR_FAST, scc_bfe_intr, sc,
+ INTR_TYPE_TTY, scc_bfe_intr, NULL, sc,
&ch->ch_icookie);
if (error) {
error = bus_setup_intr(dev, ch->ch_ires,
- INTR_TYPE_TTY | INTR_MPSAFE, scc_bfe_intr, sc,
- &ch->ch_icookie);
+ INTR_TYPE_TTY | INTR_MPSAFE, NULL,
+ (driver_intr_t *)scc_bfe_intr, sc, &ch->ch_icookie);
} else
sc->sc_fastintr = 1;
@@ -338,7 +338,7 @@
}
int
-scc_bfe_probe(device_t dev, u_int regshft, u_int rclk)
+scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid)
{
struct scc_softc *sc;
struct scc_class *cl;
@@ -367,12 +367,12 @@
* I/O space. Any SCC that needs multiple windows will consequently
* not be supported by this driver as-is.
*/
- sc->sc_rrid = 0;
+ sc->sc_rrid = rid;
sc->sc_rtype = SYS_RES_MEMORY;
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid,
0, ~0, cl->cl_channels * size, RF_ACTIVE);
if (sc->sc_rres == NULL) {
- sc->sc_rrid = 0;
+ sc->sc_rrid = rid;
sc->sc_rtype = SYS_RES_IOPORT;
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype,
&sc->sc_rrid, 0, ~0, cl->cl_channels * size, RF_ACTIVE);
@@ -504,7 +504,7 @@
int
scc_bus_setup_intr(device_t dev, device_t child, struct resource *r, int flags,
- void (*ihand)(void *), void *arg, void **cookiep)
+ driver_filter_t *filt, void (*ihand)(void *), void *arg, void **cookiep)
{
struct scc_chan *ch;
struct scc_mode *m;
@@ -515,14 +515,14 @@
return (EINVAL);
/* Interrupt handlers must be FAST or MPSAFE. */
- if ((flags & (INTR_FAST|INTR_MPSAFE)) == 0)
+ if (filt == NULL && !(flags & INTR_MPSAFE))
return (EINVAL);
sc = device_get_softc(dev);
if (sc->sc_polled)
return (ENXIO);
- if (sc->sc_fastintr && !(flags & INTR_FAST)) {
+ if (sc->sc_fastintr && filt == NULL) {
sc->sc_fastintr = 0;
for (c = 0; c < sc->sc_class->cl_channels; c++) {
ch = &sc->sc_chan[c];
@@ -530,15 +530,15 @@
continue;
bus_teardown_intr(dev, ch->ch_ires, ch->ch_icookie);
bus_setup_intr(dev, ch->ch_ires,
- INTR_TYPE_TTY | INTR_MPSAFE, scc_bfe_intr, sc,
- &ch->ch_icookie);
+ INTR_TYPE_TTY | INTR_MPSAFE, NULL,
+ (driver_intr_t *)scc_bfe_intr, sc, &ch->ch_icookie);
}
}
m = device_get_ivars(child);
m->m_hasintr = 1;
- m->m_fastintr = (flags & INTR_FAST) ? 1 : 0;
- m->ih = ihand;
+ m->m_fastintr = (filt != NULL) ? 1 : 0;
+ m->ih = (filt != NULL) ? filt : (driver_filter_t *)ihand;
m->ih_arg = arg;
i = 0, isrc = SER_INT_OVERRUN;
==== //depot/projects/e500/sys/dev/scc/scc_dev_sab82532.c#3 (text) ====
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/dev/scc/scc_dev_sab82532.c,v 1.2 2006/04/01 04:51:56 marcel Exp $");
-#define __RMAN_RESOURCE_VISIBLE
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
==== //depot/projects/e500/sys/dev/scc/scc_dev_z8530.c#3 (text) ====
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/dev/scc/scc_dev_z8530.c,v 1.3 2006/07/26 03:10:01 marcel Exp $");
-#define __RMAN_RESOURCE_VISIBLE
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
==== //depot/projects/e500/sys/dev/scc/scc_if.m#3 (text) ====
@@ -25,10 +25,6 @@
#
# $FreeBSD: src/sys/dev/scc/scc_if.m,v 1.2 2007/03/28 18:05:17 marcel Exp $
-CODE {
-#define __RMAN_RESOURCE_VISIBLE
-}
-
#include <sys/param.h>
#include <sys/bus.h>
#include <machine/bus.h>
==== //depot/projects/e500/sys/powerpc/aim/clock.c#2 (text+ko) ====
@@ -56,13 +56,14 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/clock.c,v 1.20 2005/02/04 01:41:38 grehan Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/clock.c,v 1.27 2006/10/05 06:04:44 grehan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/bus.h>
+#include <sys/clock.h>
#include <sys/timetc.h>
#include <sys/interrupt.h>
@@ -82,17 +83,6 @@
static long ticks_per_intr;
static volatile u_long lasttb;
-static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS);
-
-int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
-SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
- CTLFLAG_RW, &wall_cmos_clock, 0, "");
-
-int adjkerntz; /* local offset from GMT in seconds */
-SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW,
- &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", "");
-
-#define SECDAY 86400
#define DIFF19041970 2082844800
static int clockinitted = 0;
@@ -107,17 +97,6 @@
"decrementer" /* name */
};
-static int
-sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS)
-{
- int error;
-
- error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
- if (!error && req->newptr)
- resettodr();
- return (error);
-}
-
void
inittodr(time_t base)
{
@@ -183,7 +162,7 @@
}
void
-decr_intr(struct clockframe *frame)
+decr_intr(struct trapframe *frame)
{
u_long tb;
long tick;
@@ -225,10 +204,10 @@
*/
#if 0
while (--nticks > 0) {
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
#endif
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
void
==== //depot/projects/e500/sys/powerpc/aim/copyinout.c#2 (text+ko) ====
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/copyinout.c,v 1.11 2005/01/07 02:29:20 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/copyinout.c,v 1.15 2006/10/18 19:56:20 grehan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -322,17 +322,23 @@
return ((int32_t)fuword(addr));
}
-intptr_t
-casuptr(intptr_t *addr, intptr_t old, intptr_t new)
+uint32_t
+casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval)
+{
+ return (casuword((volatile u_long *)base, oldval, newval));
+}
+
+u_long
+casuword(volatile u_long *addr, u_long old, u_long new)
{
struct thread *td;
pmap_t pm;
faultbuf env;
- intptr_t *p, val;
+ u_long *p, val;
td = PCPU_GET(curthread);
pm = &td->td_proc->p_vmspace->vm_pmap;
- p = (intptr_t *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK));
+ p = (u_long *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK));
set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]);
@@ -342,7 +348,7 @@
}
val = *p;
- (void) atomic_cmpset_32(p, old, new);
+ (void) atomic_cmpset_32((volatile uint32_t *)p, old, new);
td->td_pcb->pcb_onfault = NULL;
==== //depot/projects/e500/sys/powerpc/aim/interrupt.c#2 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/powerpc/powerpc/interrupt.c,v 1.4 2005/01/07 02:29:20 imp Exp $
+ * $FreeBSD: src/sys/powerpc/powerpc/interrupt.c,v 1.5 2005/12/22 22:16:08 jhb Exp $
*/
/*
@@ -72,7 +72,7 @@
powerpc_extintr_handler = new_extint;
}
-extern void decr_intr(struct clockframe *);
+extern void decr_intr(struct trapframe *);
extern void trap(struct trapframe *);
/*
@@ -84,7 +84,6 @@
powerpc_interrupt(struct trapframe *framep)
{
struct thread *td;
- struct clockframe ckframe;
td = curthread;
@@ -97,9 +96,7 @@
case EXC_DECR:
atomic_add_int(&td->td_intr_nesting_level, 1);
- ckframe.srr0 = framep->srr0;
- ckframe.srr1 = framep->srr1;
- decr_intr(&ckframe);
+ decr_intr(framep);
atomic_subtract_int(&td->td_intr_nesting_level, 1);
break;
==== //depot/projects/e500/sys/powerpc/aim/locore.S#2 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/powerpc/powerpc/locore.S,v 1.21.2.1 2005/11/11 05:21:08 grehan Exp $ */
+/* $FreeBSD: src/sys/powerpc/powerpc/locore.S,v 1.22 2005/10/30 21:29:59 grehan Exp $ */
/* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */
/*-
==== //depot/projects/e500/sys/powerpc/aim/machdep.c#2 (text+ko) ====
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/machdep.c,v 1.89.2.1 2005/08/08 07:02:12 grehan Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/machdep.c,v 1.101 2007/05/18 07:10:47 jeff Exp $");
#include "opt_compat.h"
#include "opt_ddb.h"
@@ -104,12 +104,12 @@
#include <vm/vm_pager.h>
#include <machine/bat.h>
-#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/elf.h>
#include <machine/fpu.h>
#include <machine/md_var.h>
#include <machine/metadata.h>
+#include <machine/mmuvar.h>
#include <machine/pcb.h>
#include <machine/powerpc.h>
#include <machine/reg.h>
@@ -136,9 +136,6 @@
char machine[] = "powerpc";
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
-static char model[128];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, "");
-
static int cacheline_size = CACHELINESIZE;
SYSCTL_INT(_machdep, CPU_CACHELINE, cacheline_size,
CTLFLAG_RD, &cacheline_size, 0, "");
@@ -169,6 +166,14 @@
struct kva_md_info kmi;
+void setPQL2(int *const size, int *const ways);
+
+void
+setPQL2(int *const size, int *const ways)
+{
+ return;
+}
+
static void
powerpc_ofw_shutdown(void *junk, int howto)
{
@@ -218,8 +223,8 @@
vm_ksubmap_init(&kmi);
- printf("avail memory = %ld (%ld MB)\n", ptoa(cnt.v_free_count),
- ptoa(cnt.v_free_count) / 1048576);
+ printf("avail memory = %ld (%ld MB)\n", ptoa(VMCNT_GET(free_count)),
+ ptoa(VMCNT_GET(free_count)) / 1048576);
/*
* Set up buffers, so they can be used to read disk labels.
@@ -287,7 +292,7 @@
/*
* Start initializing proc0 and thread0.
*/
- proc_linkup(&proc0, &ksegrp0, &thread0);
+ proc_linkup(&proc0, &thread0);
thread0.td_frame = &frame0;
/*
@@ -317,6 +322,8 @@
kdb_init();
+ kobj_machdep_init();
+
/*
* XXX: Initialize the interrupt tables.
* Disable translation in case the vector area
@@ -329,7 +336,7 @@
bcopy(&dsitrap, (void *)EXC_DSI, (size_t)&dsisize);
bcopy(&trapcode, (void *)EXC_ISI, (size_t)&trapsize);
bcopy(&trapcode, (void *)EXC_EXI, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_ALI, (size_t)&trapsize);
+ bcopy(&alitrap, (void *)EXC_ALI, (size_t)&alisize);
bcopy(&trapcode, (void *)EXC_PGM, (size_t)&trapsize);
bcopy(&trapcode, (void *)EXC_FPU, (size_t)&trapsize);
bcopy(&trapcode, (void *)EXC_DECR, (size_t)&trapsize);
@@ -358,6 +365,7 @@
/*
* Initialise virtual memory.
*/
+ pmap_mmu_install(MMU_TYPE_OEA, 0); /* XXX temporary */
pmap_bootstrap(startkernel, endkernel);
/*
@@ -432,7 +440,7 @@
}
void
-sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
+sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
{
struct trapframe *tf;
struct sigframe *sfp;
@@ -441,10 +449,14 @@
struct thread *td;
struct proc *p;
int oonstack, rndfsize;
+ int sig;
+ int code;
td = curthread;
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
+ sig = ksi->ksi_signo;
+ code = ksi->ksi_code;
psp = p->p_sigacts;
mtx_assert(&psp->ps_mtx, MA_OWNED);
tf = td->td_frame;
@@ -472,7 +484,7 @@
*/
if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sfp = (struct sigframe *)((caddr_t)td->td_sigstk.ss_sp +
+ sfp = (struct sigframe *)(td->td_sigstk.ss_sp +
td->td_sigstk.ss_size - rndfsize);
} else {
sfp = (struct sigframe *)(tf->fixreg[1] - rndfsize);
@@ -512,12 +524,15 @@
/*
* Fill siginfo structure.
*/
+ sf.sf_si = ksi->ksi_info;
sf.sf_si.si_signo = sig;
- sf.sf_si.si_code = code;
- sf.sf_si.si_addr = (void *)tf->srr0;
+ sf.sf_si.si_addr = (void *) ((tf->exc == EXC_DSI) ?
+ tf->dar : tf->srr0);
} else {
/* Old FreeBSD-style arguments. */
tf->fixreg[FIRSTARG+1] = code;
+ tf->fixreg[FIRSTARG+3] = (tf->exc == EXC_DSI) ?
+ tf->dar : tf->srr0;
}
mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
@@ -527,7 +542,7 @@
/*
* copy the frame out to userland.
*/
- if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) {
+ if (copyout(&sf, sfp, sizeof(*sfp)) != 0) {
/*
* Process has trashed its stack. Kill it.
*/
@@ -543,25 +558,6 @@
mtx_lock(&psp->ps_mtx);
}
-/*
- * Build siginfo_t for SA thread
- */
-void
-cpu_thread_siginfo(int sig, u_long code, siginfo_t *si)
-{
- struct proc *p;
- struct thread *td;
-
- td = curthread;
- p = td->td_proc;
- PROC_LOCK_ASSERT(p, MA_OWNED);
-
- bzero(si, sizeof(*si));
- si->si_signo = sig;
- si->si_code = code;
- /* XXXKSE fill other fields */
-}
-
int
sigreturn(struct thread *td, struct sigreturn_args *uap)
{
==== //depot/projects/e500/sys/powerpc/aim/mem.c#2 (text+ko) ====
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/mem.c,v 1.1 2004/08/16 13:07:40 ssouhlal Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/mem.c,v 1.2 2006/07/26 17:12:54 marcel Exp $");
/*
* Memory special file
@@ -59,7 +59,6 @@
#include <sys/uio.h>
#include <machine/md_var.h>
-#include <machine/ofw_machdep.h>
#include <machine/vmparam.h>
#include <vm/vm.h>
==== //depot/projects/e500/sys/powerpc/aim/nexus.c#2 (text+ko) ====
@@ -52,7 +52,7 @@
*
* from: FreeBSD: src/sys/i386/i386/nexus.c,v 1.43 2001/02/09
*
- * $FreeBSD: src/sys/powerpc/powerpc/nexus.c,v 1.12 2005/01/07 02:29:20 imp Exp $
+ * $FreeBSD: src/sys/powerpc/powerpc/nexus.c,v 1.14 2007/04/20 03:24:59 grehan Exp $
*/
#include "opt_psim.h"
@@ -74,6 +74,7 @@
#include <sys/rman.h>
+#include "ofw_bus_if.h"
#include "pic_if.h"
/*
@@ -112,7 +113,7 @@
static int nexus_read_ivar(device_t, device_t, int, uintptr_t *);
static int nexus_write_ivar(device_t, device_t, int, uintptr_t);
static int nexus_setup_intr(device_t, device_t, struct resource *, int,
- driver_intr_t *, void *, void **);
+ driver_filter_t *, driver_intr_t *, void *, void **);
static int nexus_teardown_intr(device_t, device_t, struct resource *,
void *);
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
@@ -124,6 +125,11 @@
static int nexus_release_resource(device_t, device_t, int, int,
struct resource *);
+static phandle_t nexus_ofw_get_node(device_t, device_t);
+static const char *nexus_ofw_get_name(device_t, device_t);
+static const char *nexus_ofw_get_type(device_t, device_t);
+static const char *nexus_ofw_get_compat(device_t, device_t);
+
/*
* Local routines
*/
@@ -151,6 +157,12 @@
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
DEVMETHOD(bus_release_resource, nexus_release_resource),
+ /* OFW bus interface */
+ DEVMETHOD(ofw_bus_get_node, nexus_ofw_get_node),
+ DEVMETHOD(ofw_bus_get_name, nexus_ofw_get_name),
+ DEVMETHOD(ofw_bus_get_type, nexus_ofw_get_type),
+ DEVMETHOD(ofw_bus_get_compat, nexus_ofw_get_compat),
+
{ 0, 0 }
};
@@ -290,7 +302,7 @@
static int
nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
- driver_intr_t *intr, void *arg, void **cookiep)
+ driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
{
struct nexus_softc *sc;
@@ -299,8 +311,8 @@
if (device_get_state(sc->sc_pic) != DS_ATTACHED)
panic("nexus_setup_intr: no pic attached\n");
- return (PIC_SETUP_INTR(sc->sc_pic, child, res, flags, intr, arg,
- cookiep));
+ return (PIC_SETUP_INTR(sc->sc_pic, child, res, flags, filter, intr,
+ arg, cookiep));
}
static int
@@ -416,3 +428,47 @@
return (0);
}
+
+static const char *
+nexus_ofw_get_name(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return (NULL);
+
+ return (dinfo->ndi_name);
+}
+
+static phandle_t
+nexus_ofw_get_node(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return (0);
+
+ return (dinfo->ndi_node);
+}
+
+static const char *
+nexus_ofw_get_type(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return (NULL);
+
+ return (dinfo->ndi_device_type);
+}
+
+static const char *
+nexus_ofw_get_compat(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return (NULL);
+
+ return (dinfo->ndi_compatible);
+}
==== //depot/projects/e500/sys/powerpc/aim/ofw_machdep.c#2 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/ofw_machdep.c,v 1.13.2.1 2005/11/11 05:21:08 grehan Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/ofw_machdep.c,v 1.17 2006/12/13 06:11:22 marcel Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -46,11 +46,14 @@
#include <net/ethernet.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_pci.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
+#include <machine/bus.h>
+#include <machine/md_var.h>
#include <machine/powerpc.h>
#include <machine/ofw_machdep.h>
#include <powerpc/ofw/ofw_pci.h>
@@ -62,7 +65,6 @@
extern register_t ofmsr[5];
extern struct pcpu __pcpu[MAXCPU];
extern struct pmap ofw_pmap;
-extern int pmap_bootstrapped;
static int (*ofwcall)(void *);
/*
@@ -285,6 +287,141 @@
OF_getprop(node, "local-mac-address", addr, ETHER_ADDR_LEN);
}
+/*
+ * Return a bus handle and bus tag that corresponds to the register
+ * numbered regno for the device referenced by the package handle
+ * dev. This function is intended to be used by console drivers in
+ * early boot only. It works by mapping the address of the device's
+ * register in the address space of its parent and recursively walk
+ * the device tree upward this way.
+ */
+static void
+OF_get_addr_props(phandle_t node, uint32_t *addrp, uint32_t *sizep, int *pcip)
+{
+ char name[16];
+ uint32_t addr, size;
+ int pci, res;
+
+ res = OF_getprop(node, "#address-cells", &addr, sizeof(addr));
+ if (res == -1)
+ addr = 2;
+ res = OF_getprop(node, "#size-cells", &size, sizeof(size));
+ if (res == -1)
+ size = 1;
+ pci = 0;
+ if (addr == 3 && size == 2) {
+ res = OF_getprop(node, "name", name, sizeof(name));
+ if (res != -1) {
+ name[sizeof(name) - 1] = '\0';
+ pci = (strcmp(name, "pci") == 0) ? 1 : 0;
+ }
+ }
+ if (addrp != NULL)
+ *addrp = addr;
+ if (sizep != NULL)
+ *sizep = size;
+ if (pcip != NULL)
+ *pcip = pci;
+}
+
+int
+OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag,
+ bus_space_handle_t *handle)
+{
+ uint32_t cell[32];
+ bus_addr_t addr, raddr, baddr;
+ bus_size_t size, rsize;
+ uint32_t c, nbridge, naddr, nsize;
+ phandle_t bridge, parent;
+ u_int spc, rspc;
+ int pci, pcib, res;
+
+ /* Sanity checking. */
+ if (dev == 0)
+ return (EINVAL);
+ bridge = OF_parent(dev);
+ if (bridge == 0)
+ return (EINVAL);
+ if (regno < 0)
+ return (EINVAL);
+ if (tag == NULL || handle == NULL)
+ return (EINVAL);
+
+ /* Get the requested register. */
+ OF_get_addr_props(bridge, &naddr, &nsize, &pci);
+ res = OF_getprop(dev, (pci) ? "assigned-addresses" : "reg",
+ cell, sizeof(cell));
+ if (res == -1)
+ return (ENXIO);
+ if (res % sizeof(cell[0]))
+ return (ENXIO);
+ res /= sizeof(cell[0]);
+ regno *= naddr + nsize;
+ if (regno + naddr + nsize > res)
+ return (EINVAL);
+ spc = (pci) ? cell[regno] & OFW_PCI_PHYS_HI_SPACEMASK : ~0;
+ addr = 0;
+ for (c = 0; c < naddr; c++)
+ addr = ((uint64_t)addr << 32) | cell[regno++];
+ size = 0;
+ for (c = 0; c < nsize; c++)
+ size = ((uint64_t)size << 32) | cell[regno++];
+
+ /*
+ * Map the address range in the bridge's decoding window as given
+ * by the "ranges" property. If a node doesn't have such property
+ * then no mapping is done.
+ */
+ parent = OF_parent(bridge);
+ while (parent != 0) {
+ OF_get_addr_props(parent, &nbridge, NULL, &pcib);
+ res = OF_getprop(bridge, "ranges", cell, sizeof(cell));
+ if (res == -1)
+ goto next;
+ if (res % sizeof(cell[0]))
+ return (ENXIO);
+ res /= sizeof(cell[0]);
+ regno = 0;
+ while (regno < res) {
+ rspc = (pci)
+ ? cell[regno] & OFW_PCI_PHYS_HI_SPACEMASK
+ : ~0;
+ if (rspc != spc) {
+ regno += naddr + nbridge + nsize;
+ continue;
+ }
+ raddr = 0;
+ for (c = 0; c < naddr; c++)
+ raddr = ((uint64_t)raddr << 32) | cell[regno++];
+ rspc = (pcib)
+ ? cell[regno] & OFW_PCI_PHYS_HI_SPACEMASK
+ : ~0;
+ baddr = 0;
+ for (c = 0; c < nbridge; c++)
+ baddr = ((uint64_t)baddr << 32) | cell[regno++];
+ rsize = 0;
+ for (c = 0; c < nsize; c++)
+ rsize = ((uint64_t)rsize << 32) | cell[regno++];
+ if (addr < raddr || addr >= raddr + rsize)
+ continue;
+ addr = addr - raddr + baddr;
+ if (rspc != ~0)
+ spc = rspc;
+ }
+
+ next:
+ bridge = parent;
+ parent = OF_parent(bridge);
+ OF_get_addr_props(bridge, &naddr, &nsize, &pci);
+ }
+
+ /* Default to memory mapped I/O. */
+ *tag = PPC_BUS_SPACE_MEM;
+ if (spc == OFW_PCI_PHYS_HI_SPACE_IO)
+ *tag = PPC_BUS_SPACE_IO;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list