svn commit: r206524 - in user/imp/tbemd/sys: pc98/cbus pc98/conf
pc98/pc98 pci powerpc/aim powerpc/booke powerpc/conf
powerpc/mpc85xx powerpc/ofw powerpc/powermac powerpc/powerpc
rpc sparc64/conf s...
Warner Losh
imp at FreeBSD.org
Mon Apr 12 23:16:02 UTC 2010
Author: imp
Date: Mon Apr 12 23:16:01 2010
New Revision: 206524
URL: http://svn.freebsd.org/changeset/base/206524
Log:
merge from head, part 9 of many
Added:
user/imp/tbemd/sys/sparc64/pci/sbbc.c
- copied unchanged from r206514, head/sys/sparc64/pci/sbbc.c
Modified:
user/imp/tbemd/sys/pc98/cbus/clock.c
user/imp/tbemd/sys/pc98/conf/GENERIC
user/imp/tbemd/sys/pc98/pc98/machdep.c
user/imp/tbemd/sys/pci/if_rlreg.h
user/imp/tbemd/sys/powerpc/aim/interrupt.c
user/imp/tbemd/sys/powerpc/aim/machdep.c
user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c
user/imp/tbemd/sys/powerpc/aim/nexus.c
user/imp/tbemd/sys/powerpc/aim/ofw_machdep.c
user/imp/tbemd/sys/powerpc/booke/interrupt.c
user/imp/tbemd/sys/powerpc/booke/machdep.c
user/imp/tbemd/sys/powerpc/booke/trap_subr.S
user/imp/tbemd/sys/powerpc/conf/GENERIC
user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.c
user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.h
user/imp/tbemd/sys/powerpc/mpc85xx/pci_ocp.c
user/imp/tbemd/sys/powerpc/ofw/ofw_real.c
user/imp/tbemd/sys/powerpc/ofw/ofw_syscons.c
user/imp/tbemd/sys/powerpc/powermac/cuda.c
user/imp/tbemd/sys/powerpc/powermac/cudavar.h
user/imp/tbemd/sys/powerpc/powermac/pmu.c
user/imp/tbemd/sys/powerpc/powermac/smu.c
user/imp/tbemd/sys/powerpc/powermac/uninorth.c
user/imp/tbemd/sys/powerpc/powerpc/cpu.c
user/imp/tbemd/sys/rpc/svc.c
user/imp/tbemd/sys/sparc64/conf/GENERIC
user/imp/tbemd/sys/sparc64/conf/NOTES
user/imp/tbemd/sys/sparc64/fhc/fhc.c
user/imp/tbemd/sys/sparc64/include/dcr.h
user/imp/tbemd/sys/sparc64/include/lsu.h
user/imp/tbemd/sys/sparc64/include/tlb.h
user/imp/tbemd/sys/sparc64/include/tte.h
user/imp/tbemd/sys/sparc64/include/ver.h
user/imp/tbemd/sys/sparc64/include/wstate.h
user/imp/tbemd/sys/sparc64/pci/apb.c
user/imp/tbemd/sys/sparc64/pci/psycho.c
user/imp/tbemd/sys/sparc64/pci/schizo.c
user/imp/tbemd/sys/sparc64/pci/schizovar.h
user/imp/tbemd/sys/sparc64/sbus/sbus.c
user/imp/tbemd/sys/sparc64/sparc64/cheetah.c
user/imp/tbemd/sys/sparc64/sparc64/exception.S
user/imp/tbemd/sys/sparc64/sparc64/genassym.c
user/imp/tbemd/sys/sparc64/sparc64/locore.S
user/imp/tbemd/sys/sparc64/sparc64/machdep.c
user/imp/tbemd/sys/sparc64/sparc64/ofw_machdep.c
user/imp/tbemd/sys/sparc64/sparc64/pmap.c
user/imp/tbemd/sys/sparc64/sparc64/support.S
user/imp/tbemd/sys/sparc64/sparc64/swtch.S
user/imp/tbemd/sys/sparc64/sparc64/trap.c
user/imp/tbemd/sys/sun4v/conf/GENERIC
user/imp/tbemd/sys/sun4v/sun4v/machdep.c
user/imp/tbemd/sys/sys/_timespec.h
user/imp/tbemd/sys/sys/eventhandler.h
user/imp/tbemd/sys/sys/iconv.h
user/imp/tbemd/sys/sys/imgact.h
user/imp/tbemd/sys/sys/ioccom.h
user/imp/tbemd/sys/sys/mchain.h
user/imp/tbemd/sys/sys/param.h
user/imp/tbemd/sys/sys/pcpu.h
user/imp/tbemd/sys/sys/pioctl.h
user/imp/tbemd/sys/sys/pmc.h
user/imp/tbemd/sys/sys/proc.h
user/imp/tbemd/sys/sys/ptrace.h
user/imp/tbemd/sys/sys/stat.h
user/imp/tbemd/sys/sys/sysent.h
user/imp/tbemd/sys/sys/timeb.h
user/imp/tbemd/sys/sys/timespec.h
user/imp/tbemd/sys/sys/vnode.h
user/imp/tbemd/sys/sys/vtoc.h
user/imp/tbemd/sys/teken/teken.c
user/imp/tbemd/sys/ufs/ffs/ffs_vfsops.c
user/imp/tbemd/sys/vm/memguard.c
user/imp/tbemd/sys/vm/memguard.h
user/imp/tbemd/sys/vm/uma_int.h
user/imp/tbemd/sys/vm/vm_contig.c
user/imp/tbemd/sys/vm/vm_extern.h
user/imp/tbemd/sys/vm/vm_fault.c
user/imp/tbemd/sys/vm/vm_glue.c
user/imp/tbemd/sys/vm/vm_map.c
user/imp/tbemd/sys/vm/vm_map.h
user/imp/tbemd/sys/vm/vm_mmap.c
user/imp/tbemd/sys/vm/vm_page.c
user/imp/tbemd/sys/vm/vm_pageout.c
user/imp/tbemd/sys/x86/isa/clock.c
Modified: user/imp/tbemd/sys/pc98/cbus/clock.c
==============================================================================
--- user/imp/tbemd/sys/pc98/cbus/clock.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/pc98/cbus/clock.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -93,6 +93,9 @@ TUNABLE_INT("hw.i8254.freq", &i8254_freq
int i8254_max_count;
static int i8254_real_max_count;
+static int lapic_allclocks = 1;
+TUNABLE_INT("machdep.lapic_allclocks", &lapic_allclocks);
+
static struct mtx clock_lock;
static struct intsrc *i8254_intsrc;
static u_int32_t i8254_lastcount;
@@ -432,9 +435,11 @@ startrtclock()
void
cpu_initclocks()
{
+#if defined(DEV_APIC)
+ enum lapic_clock tlsca;
-#ifdef DEV_APIC
- using_lapic_timer = lapic_setup_clock();
+ tlsca = lapic_allclocks == 0 ? LAPIC_CLOCK_HARDCLOCK : LAPIC_CLOCK_ALL;
+ using_lapic_timer = lapic_setup_clock(tlsca);
#endif
/*
* If we aren't using the local APIC timer to drive the kernel
Modified: user/imp/tbemd/sys/pc98/conf/GENERIC
==============================================================================
--- user/imp/tbemd/sys/pc98/conf/GENERIC Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/pc98/conf/GENERIC Mon Apr 12 23:16:01 2010 (r206524)
@@ -46,7 +46,6 @@ options PROCFS # Process filesystem (
options PSEUDOFS # Pseudo-filesystem framework
options GEOM_PART_GPT # GUID Partition Tables.
options GEOM_LABEL # Provides labelization
-options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
Modified: user/imp/tbemd/sys/pc98/pc98/machdep.c
==============================================================================
--- user/imp/tbemd/sys/pc98/pc98/machdep.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/pc98/pc98/machdep.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -1172,11 +1172,7 @@ void (*cpu_idle_hook)(void) = cpu_idle_d
* Reset registers to default values on exec.
*/
void
-exec_setregs(td, entry, stack, ps_strings)
- struct thread *td;
- u_long entry;
- u_long stack;
- u_long ps_strings;
+exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
{
struct trapframe *regs = td->td_frame;
struct pcb *pcb = td->td_pcb;
@@ -1192,7 +1188,7 @@ exec_setregs(td, entry, stack, ps_string
mtx_unlock_spin(&dt_lock);
bzero((char *)regs, sizeof(struct trapframe));
- regs->tf_eip = entry;
+ regs->tf_eip = imgp->entry_addr;
regs->tf_esp = stack;
regs->tf_eflags = PSL_USER | (regs->tf_eflags & PSL_T);
regs->tf_ss = _udatasel;
@@ -1202,7 +1198,7 @@ exec_setregs(td, entry, stack, ps_string
regs->tf_cs = _ucodesel;
/* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */
- regs->tf_ebx = ps_strings;
+ regs->tf_ebx = imgp->ps_strings;
/*
* Reset the hardware debug registers if they were in use.
Modified: user/imp/tbemd/sys/pci/if_rlreg.h
==============================================================================
--- user/imp/tbemd/sys/pci/if_rlreg.h Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/pci/if_rlreg.h Mon Apr 12 23:16:01 2010 (r206524)
@@ -133,6 +133,7 @@
#define RL_GMEDIASTAT 0x006C /* 8 bits */
#define RL_MACDBG 0x006D /* 8 bits, 8168C SPIN2 only */
#define RL_GPIO 0x006E /* 8 bits, 8168C SPIN2 only */
+#define RL_PMCH 0x006F /* 8 bits */
#define RL_MAXRXPKTLEN 0x00DA /* 16 bits, chip multiplies by 8 */
#define RL_GTXSTART 0x0038 /* 8 bits */
@@ -159,9 +160,10 @@
#define RL_HWREV_8169_8110SB 0x10000000
#define RL_HWREV_8169_8110SC 0x18000000
#define RL_HWREV_8102EL 0x24800000
-#define RL_HWREV_8102EL_SPIN1 0x24c00000
+#define RL_HWREV_8102EL_SPIN1 0x24C00000
#define RL_HWREV_8168D 0x28000000
#define RL_HWREV_8168DP 0x28800000
+#define RL_HWREV_8168E 0x2C000000
#define RL_HWREV_8168_SPIN1 0x30000000
#define RL_HWREV_8100E 0x30800000
#define RL_HWREV_8101E 0x34000000
@@ -180,7 +182,7 @@
#define RL_HWREV_8139C 0x74000000
#define RL_HWREV_8139D 0x74400000
#define RL_HWREV_8139CPLUS 0x74800000
-#define RL_HWREV_8101 0x74c00000
+#define RL_HWREV_8101 0x74C00000
#define RL_HWREV_8100 0x78800000
#define RL_HWREV_8169_8110SBL 0x7CC00000
#define RL_HWREV_8169_8110SCE 0x98000000
@@ -884,6 +886,7 @@ struct rl_softc {
uint32_t rl_flags;
#define RL_FLAG_MSI 0x0001
#define RL_FLAG_AUTOPAD 0x0002
+#define RL_FLAG_PHYWAKE_PM 0x0004
#define RL_FLAG_PHYWAKE 0x0008
#define RL_FLAG_NOJUMBO 0x0010
#define RL_FLAG_PAR 0x0020
Modified: user/imp/tbemd/sys/powerpc/aim/interrupt.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/aim/interrupt.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/aim/interrupt.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -80,15 +80,17 @@ powerpc_interrupt(struct trapframe *fram
switch (framep->exc) {
case EXC_EXI:
- atomic_add_int(&td->td_intr_nesting_level, 1);
+ critical_enter();
PIC_DISPATCH(pic, framep);
- atomic_subtract_int(&td->td_intr_nesting_level, 1);
+ critical_exit();
break;
case EXC_DECR:
+ critical_enter();
atomic_add_int(&td->td_intr_nesting_level, 1);
decr_intr(framep);
atomic_subtract_int(&td->td_intr_nesting_level, 1);
+ critical_exit();
break;
default:
Modified: user/imp/tbemd/sys/powerpc/aim/machdep.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/aim/machdep.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/aim/machdep.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -951,7 +951,7 @@ cpu_idle_wakeup(int cpu)
* Set set up registers on exec.
*/
void
-exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
+exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
{
struct trapframe *tf;
struct ps_strings arginfo;
@@ -995,7 +995,7 @@ exec_setregs(struct thread *td, u_long e
tf->fixreg[7] = 0; /* termination vector */
tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */
- tf->srr0 = entry;
+ tf->srr0 = imgp->entry_addr;
tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
td->td_pcb->pcb_flags = 0;
}
Modified: user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -1507,10 +1507,10 @@ moea64_remove_write(mmu_t mmu, vm_page_t
return;
lo = moea64_attr_fetch(m);
SYNC();
- LOCK_TABLE();
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
pmap = pvo->pvo_pmap;
PMAP_LOCK(pmap);
+ LOCK_TABLE();
if ((pvo->pvo_pte.lpte.pte_lo & LPTE_PP) != LPTE_BR) {
pt = moea64_pvo_to_pte(pvo, -1);
pvo->pvo_pte.lpte.pte_lo &= ~LPTE_PP;
@@ -1523,9 +1523,9 @@ moea64_remove_write(mmu_t mmu, vm_page_t
pvo->pvo_pmap, PVO_VADDR(pvo));
}
}
+ UNLOCK_TABLE();
PMAP_UNLOCK(pmap);
}
- UNLOCK_TABLE();
if ((lo & LPTE_CHG) != 0) {
moea64_attr_clear(m, LPTE_CHG);
vm_page_dirty(m);
@@ -1604,6 +1604,13 @@ moea64_kextract(mmu_t mmu, vm_offset_t v
struct pvo_entry *pvo;
vm_paddr_t pa;
+ /*
+ * Shortcut the direct-mapped case when applicable. We never put
+ * anything but 1:1 mappings below VM_MIN_KERNEL_ADDRESS.
+ */
+ if (va < VM_MIN_KERNEL_ADDRESS)
+ return (va);
+
PMAP_LOCK(kernel_pmap);
pvo = moea64_pvo_find_va(kernel_pmap, va & ~ADDR_POFF, NULL);
KASSERT(pvo != NULL, ("moea64_kextract: no addr found"));
@@ -1661,17 +1668,15 @@ moea64_page_exists_quick(mmu_t mmu, pmap
if (!moea64_initialized || (m->flags & PG_FICTITIOUS))
return FALSE;
+ mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+
loops = 0;
- LOCK_TABLE();
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- if (pvo->pvo_pmap == pmap) {
- UNLOCK_TABLE();
+ if (pvo->pvo_pmap == pmap)
return (TRUE);
- }
if (++loops >= 16)
break;
}
- UNLOCK_TABLE();
return (FALSE);
}
@@ -1690,11 +1695,9 @@ moea64_page_wired_mappings(mmu_t mmu, vm
if (!moea64_initialized || (m->flags & PG_FICTITIOUS) != 0)
return (count);
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
- LOCK_TABLE();
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink)
if ((pvo->pvo_vaddr & PVO_WIRED) != 0)
count++;
- UNLOCK_TABLE();
return (count);
}
@@ -1913,7 +1916,6 @@ moea64_remove_all(mmu_t mmu, vm_page_t m
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
pvo_head = vm_page_to_pvoh(m);
- LOCK_TABLE();
for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
next_pvo = LIST_NEXT(pvo, pvo_vlink);
@@ -1923,7 +1925,6 @@ moea64_remove_all(mmu_t mmu, vm_page_t m
moea64_pvo_remove(pvo, -1);
PMAP_UNLOCK(pmap);
}
- UNLOCK_TABLE();
if ((m->flags & PG_WRITEABLE) && moea64_is_modified(mmu, m)) {
moea64_attr_clear(m, LPTE_CHG);
vm_page_dirty(m);
@@ -2268,7 +2269,7 @@ moea64_pvo_to_pte(const struct pvo_entry
}
if (((pt->pte_lo ^ pvo->pvo_pte.lpte.pte_lo) &
- ~(LPTE_CHG|LPTE_REF)) != 0) {
+ ~(LPTE_M|LPTE_CHG|LPTE_REF)) != 0) {
panic("moea64_pvo_to_pte: pvo %p pte does not match "
"pte %p in moea64_pteg_table difference is %#x",
pvo, pt,
@@ -2334,7 +2335,8 @@ moea64_query_bit(vm_page_t m, u_int64_t
if (moea64_attr_fetch(m) & ptebit)
return (TRUE);
- LOCK_TABLE();
+ mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
MOEA_PVO_CHECK(pvo); /* sanity check */
@@ -2344,7 +2346,6 @@ moea64_query_bit(vm_page_t m, u_int64_t
*/
if (pvo->pvo_pte.lpte.pte_lo & ptebit) {
moea64_attr_save(m, ptebit);
- UNLOCK_TABLE();
MOEA_PVO_CHECK(pvo); /* sanity check */
return (TRUE);
}
@@ -2364,6 +2365,7 @@ moea64_query_bit(vm_page_t m, u_int64_t
* REF/CHG bits from the valid PTE. If the appropriate
* ptebit is set, cache it and return success.
*/
+ LOCK_TABLE();
pt = moea64_pvo_to_pte(pvo, -1);
if (pt != NULL) {
moea64_pte_synch(pt, &pvo->pvo_pte.lpte);
@@ -2375,8 +2377,8 @@ moea64_query_bit(vm_page_t m, u_int64_t
return (TRUE);
}
}
+ UNLOCK_TABLE();
}
- UNLOCK_TABLE();
return (FALSE);
}
@@ -2389,6 +2391,8 @@ moea64_clear_bit(vm_page_t m, u_int64_t
struct lpte *pt;
uint64_t rv;
+ mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+
/*
* Clear the cached value.
*/
@@ -2409,10 +2413,10 @@ moea64_clear_bit(vm_page_t m, u_int64_t
* valid pte clear the ptebit from the valid pte.
*/
count = 0;
- LOCK_TABLE();
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
MOEA_PVO_CHECK(pvo); /* sanity check */
+ LOCK_TABLE();
pt = moea64_pvo_to_pte(pvo, -1);
if (pt != NULL) {
moea64_pte_synch(pt, &pvo->pvo_pte.lpte);
@@ -2424,8 +2428,8 @@ moea64_clear_bit(vm_page_t m, u_int64_t
rv |= pvo->pvo_pte.lpte.pte_lo;
pvo->pvo_pte.lpte.pte_lo &= ~ptebit;
MOEA_PVO_CHECK(pvo); /* sanity check */
+ UNLOCK_TABLE();
}
- UNLOCK_TABLE();
if (origbit != NULL) {
*origbit = rv;
@@ -2511,7 +2515,7 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm,
len = MIN(lim - va, sz);
pvo = moea64_pvo_find_va(pm, va & ~ADDR_POFF, NULL);
if (pvo != NULL) {
- pa = (pvo->pvo_pte.pte.pte_lo & PTE_RPGN) |
+ pa = (pvo->pvo_pte.pte.pte_lo & LPTE_RPGN) |
(va & ADDR_POFF);
moea64_syncicache(pm, va, pa, len);
}
Modified: user/imp/tbemd/sys/powerpc/aim/nexus.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/aim/nexus.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/aim/nexus.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -60,7 +60,6 @@
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/bus.h>
-#include <sys/clock.h>
#include <sys/cons.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
@@ -74,7 +73,6 @@
#include <sys/rman.h>
-#include "clock_if.h"
#include "ofw_bus_if.h"
#include "pic_if.h"
@@ -143,12 +141,6 @@ static const char *nexus_ofw_get_type(de
static const char *nexus_ofw_get_compat(device_t, device_t);
/*
- * Clock interface.
- */
-static int nexus_gettime(device_t, struct timespec *);
-static int nexus_settime(device_t, struct timespec *);
-
-/*
* Local routines
*/
static device_t nexus_device_from_node(device_t, phandle_t);
@@ -181,10 +173,6 @@ static device_method_t nexus_methods[] =
DEVMETHOD(ofw_bus_get_type, nexus_ofw_get_type),
DEVMETHOD(ofw_bus_get_compat, nexus_ofw_get_compat),
- /* Clock interface */
- DEVMETHOD(clock_gettime, nexus_gettime),
- DEVMETHOD(clock_settime, nexus_settime),
-
{ 0, 0 }
};
@@ -240,7 +228,6 @@ nexus_attach(device_t dev)
}
- clock_register(dev, 1000);
return (bus_generic_attach(dev));
}
@@ -512,50 +499,3 @@ nexus_ofw_get_compat(device_t bus, devic
return (dinfo->ndi_compatible);
}
-#define DIFF19041970 2082844800
-
-static int
-nexus_gettime(device_t dev, struct timespec *ts)
-{
- char path[128];
- ihandle_t ih;
- phandle_t ph;
- u_int rtc;
-
- ph = OF_finddevice("rtc");
- if (ph == -1)
- return (ENOENT);
-
- OF_package_to_path(ph, path, sizeof(path));
- ih = OF_open(path);
- if (ih == -1)
- return (ENXIO);
-
- if (OF_call_method("read-rtc", ih, 0, 1, &rtc))
- return (EIO);
-
- ts->tv_sec = rtc - DIFF19041970;
- ts->tv_nsec = 0;
- return (0);
-}
-
-static int
-nexus_settime(device_t dev, struct timespec *ts)
-{
- char path[128];
- ihandle_t ih;
- phandle_t ph;
- u_int rtc;
-
- ph = OF_finddevice("rtc");
- if (ph == -1)
- return (ENOENT);
-
- OF_package_to_path(ph, path, sizeof(path));
- ih = OF_open(path);
- if (ih == -1)
- return (ENXIO);
-
- rtc = ts->tv_sec + DIFF19041970;
- return ((OF_call_method("write-rtc", ih, 1, 0, rtc) != 0) ? EIO : 0);
-}
Modified: user/imp/tbemd/sys/powerpc/aim/ofw_machdep.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/aim/ofw_machdep.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/aim/ofw_machdep.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -63,6 +63,8 @@ __FBSDID("$FreeBSD$");
static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3];
static struct mem_region OFfree[OFMEM_REGIONS + 3];
+static struct mtx ofw_mutex;
+
struct mem_region64 {
vm_offset_t mr_start_hi;
vm_offset_t mr_start_lo;
@@ -281,6 +283,8 @@ OF_bootstrap()
{
boolean_t status = FALSE;
+ mtx_init(&ofw_mutex, "open firmware", NULL, MTX_DEF);
+
if (ofwcall != NULL) {
if (ofw_real_mode)
status = OF_install(OFW_STD_REAL, 0);
@@ -314,6 +318,8 @@ openfirmware(void *args)
if (pmap_bootstrapped && ofw_real_mode)
args = (void *)pmap_kextract((vm_offset_t)args);
+ mtx_lock(&ofw_mutex);
+
__asm __volatile( "\t"
"sync\n\t"
"mfmsr %0\n\t"
@@ -366,6 +372,8 @@ openfirmware(void *args)
: : "r" (oldmsr)
);
+ mtx_unlock(&ofw_mutex);
+
return (result);
}
Modified: user/imp/tbemd/sys/powerpc/booke/interrupt.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/booke/interrupt.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/booke/interrupt.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -118,9 +118,12 @@ powerpc_decr_interrupt(struct trapframe
struct thread *td;
td = PCPU_GET(curthread);
+ critical_enter();
atomic_add_int(&td->td_intr_nesting_level, 1);
decr_intr(framep);
atomic_subtract_int(&td->td_intr_nesting_level, 1);
+ critical_exit();
+ framep->srr1 &= ~PSL_WE;
}
/*
@@ -129,10 +132,9 @@ powerpc_decr_interrupt(struct trapframe
void
powerpc_extr_interrupt(struct trapframe *framep)
{
- struct thread *td;
- td = PCPU_GET(curthread);
- atomic_add_int(&td->td_intr_nesting_level, 1);
+ critical_enter();
PIC_DISPATCH(pic, framep);
- atomic_subtract_int(&td->td_intr_nesting_level, 1);
+ critical_exit();
+ framep->srr1 &= ~PSL_WE;
}
Modified: user/imp/tbemd/sys/powerpc/booke/machdep.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/booke/machdep.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/booke/machdep.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -509,7 +509,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
/* Set set up registers on exec. */
void
-exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
+exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
{
struct trapframe *tf;
struct ps_strings arginfo;
@@ -553,7 +553,7 @@ exec_setregs(struct thread *td, u_long e
tf->fixreg[7] = 0; /* termination vector */
tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */
- tf->srr0 = entry;
+ tf->srr0 = imgp->entry_addr;
tf->srr1 = PSL_USERSET;
td->td_pcb->pcb_flags = 0;
}
@@ -706,6 +706,7 @@ cpu_idle (int busy)
register_t msr;
msr = mfmsr();
+
#ifdef INVARIANTS
if ((msr & PSL_EE) != PSL_EE) {
struct thread *td = curthread;
@@ -713,19 +714,10 @@ cpu_idle (int busy)
panic("ints disabled in idleproc!");
}
#endif
-#if 0
- /*
- * Freescale E500 core RM section 6.4.1
- */
- msr = msr | PSL_WE;
- __asm__(" msync;"
- " mtmsr %0;"
- " isync;"
- "loop: b loop" :
- /* no output */ :
- "r" (msr));
-#endif
+ /* Freescale E500 core RM section 6.4.1. */
+ msr = msr | PSL_WE;
+ __asm __volatile("msync; mtmsr %0; isync" :: "r" (msr));
}
int
Modified: user/imp/tbemd/sys/powerpc/booke/trap_subr.S
==============================================================================
--- user/imp/tbemd/sys/powerpc/booke/trap_subr.S Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/booke/trap_subr.S Mon Apr 12 23:16:01 2010 (r206524)
@@ -441,6 +441,7 @@ INTERRUPT(int_instr_storage)
INTERRUPT(int_external_input)
STANDARD_PROLOG(SPR_SPRG1, PC_TEMPSAVE, SPR_SRR0, SPR_SRR1)
FRAME_SETUP(SPR_SPRG1, PC_TEMPSAVE, EXC_EXI)
+ addi %r3, %r1, 8
bl CNAME(powerpc_extr_interrupt)
b trapexit
Modified: user/imp/tbemd/sys/powerpc/conf/GENERIC
==============================================================================
--- user/imp/tbemd/sys/powerpc/conf/GENERIC Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/conf/GENERIC Mon Apr 12 23:16:01 2010 (r206524)
@@ -47,7 +47,6 @@ options PROCFS #Process filesystem (r
options PSEUDOFS #Pseudo-filesystem framework
options GEOM_PART_GPT #GUID Partition Tables.
options GEOM_LABEL #Provides labelization
-options COMPAT_43TTY #BSD 4.3 TTY compat (sgtty)
options COMPAT_FREEBSD4 #Keep this for a while
options COMPAT_FREEBSD5 #Compatible with FreeBSD5
options COMPAT_FREEBSD6 #Compatible with FreeBSD6
Modified: user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -152,6 +152,10 @@ ocpbus_write_law(int trgt, int type, u_l
addr = 0xA0000000;
size = 0x10000000;
break;
+ case OCP85XX_TGTIF_PCI3:
+ addr = 0xB0000000;
+ size = 0x10000000;
+ break;
default:
return (EINVAL);
}
@@ -170,6 +174,10 @@ ocpbus_write_law(int trgt, int type, u_l
addr = 0xfee20000;
size = 0x00010000;
break;
+ case OCP85XX_TGTIF_PCI3:
+ addr = 0xfee30000;
+ size = 0x00010000;
+ break;
default:
return (EINVAL);
}
@@ -188,7 +196,7 @@ static int
ocpbus_probe(device_t dev)
{
- device_set_desc(dev, "On-Chip Peripherals bus");
+ device_set_desc(dev, "Freescale on-chip peripherals bus");
return (BUS_PROBE_DEFAULT);
}
@@ -210,6 +218,7 @@ ocpbus_attach(device_t dev)
ocpbus_mk_child(dev, OCPBUS_DEVTYPE_PCIB, 0);
ocpbus_mk_child(dev, OCPBUS_DEVTYPE_PCIB, 1);
ocpbus_mk_child(dev, OCPBUS_DEVTYPE_PCIB, 2);
+ ocpbus_mk_child(dev, OCPBUS_DEVTYPE_PCIB, 3);
ocpbus_mk_child(dev, OCPBUS_DEVTYPE_TSEC, 0);
ocpbus_mk_child(dev, OCPBUS_DEVTYPE_TSEC, 1);
ocpbus_mk_child(dev, OCPBUS_DEVTYPE_TSEC, 2);
@@ -338,6 +347,10 @@ const struct ocp_resource mpc8555_resour
OCP85XX_PCI_SIZE},
{OCPBUS_DEVTYPE_PCIB, 2, SYS_RES_MEMORY, 1, 0, OCP85XX_TGTIF_PCI2},
{OCPBUS_DEVTYPE_PCIB, 2, SYS_RES_IOPORT, 1, 0, OCP85XX_TGTIF_PCI2},
+ {OCPBUS_DEVTYPE_PCIB, 3, SYS_RES_MEMORY, 0, OCP85XX_PCI3_OFF,
+ OCP85XX_PCI_SIZE},
+ {OCPBUS_DEVTYPE_PCIB, 3, SYS_RES_MEMORY, 1, 0, OCP85XX_TGTIF_PCI3},
+ {OCPBUS_DEVTYPE_PCIB, 3, SYS_RES_IOPORT, 1, 0, OCP85XX_TGTIF_PCI3},
{OCPBUS_DEVTYPE_LBC, 0, SYS_RES_MEMORY, 0, OCP85XX_LBC_OFF,
OCP85XX_LBC_SIZE},
Modified: user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.h
==============================================================================
--- user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.h Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/mpc85xx/ocpbus.h Mon Apr 12 23:16:01 2010 (r206524)
@@ -50,6 +50,7 @@
#define OCP85XX_TGTIF_PCI0 0
#define OCP85XX_TGTIF_PCI1 1
#define OCP85XX_TGTIF_PCI2 2
+#define OCP85XX_TGTIF_PCI3 3
#define OCP85XX_TGTIF_LBC 4
#define OCP85XX_TGTIF_RAM_INTL 11
#define OCP85XX_TGTIF_RIO 12
@@ -86,6 +87,7 @@
#define OCP85XX_PCI0_OFF 0x08000
#define OCP85XX_PCI1_OFF 0x09000
#define OCP85XX_PCI2_OFF 0x0A000
+#define OCP85XX_PCI3_OFF 0x0B000
#define OCP85XX_PCI_SIZE 0x1000
#define OCP85XX_TSEC0_OFF 0x24000
#define OCP85XX_TSEC1_OFF 0x25000
Modified: user/imp/tbemd/sys/powerpc/mpc85xx/pci_ocp.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/mpc85xx/pci_ocp.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/mpc85xx/pci_ocp.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -264,7 +264,7 @@ pci_ocp_maxslots(device_t dev)
{
struct pci_ocp_softc *sc = device_get_softc(dev);
- return ((sc->sc_pcie_cap) ? 0 : 30);
+ return ((sc->sc_pcie_cap) ? 0 : 31);
}
static uint32_t
@@ -328,6 +328,7 @@ pci_ocp_probe(device_t dev)
return (ENXIO);
sc = device_get_softc(dev);
+ sc->sc_dev = dev;
sc->sc_rid = 0;
sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rid,
@@ -492,7 +493,7 @@ pci_ocp_route_int(struct pci_ocp_softc *
}
static int
-pci_ocp_init(struct pci_ocp_softc *sc, int bus, int maxslot)
+pci_ocp_init(struct pci_ocp_softc *sc, int bus, int nslots)
{
int secbus, slot;
int func, maxfunc;
@@ -502,7 +503,7 @@ pci_ocp_init(struct pci_ocp_softc *sc, i
uint8_t intline, intpin;
secbus = bus;
- for (slot = 0; slot < maxslot; slot++) {
+ for (slot = 0; slot < nslots; slot++) {
maxfunc = 0;
for (func = 0; func <= maxfunc; func++) {
hdrtype = pci_ocp_read_config(sc->sc_dev, bus, slot,
@@ -599,7 +600,7 @@ pci_ocp_init(struct pci_ocp_softc *sc, i
PCIR_SUBBUS_1, 0xff, 1);
secbus = pci_ocp_init(sc, secbus,
- (subclass == PCIS_BRIDGE_PCI) ? 31 : 1);
+ (subclass == PCIS_BRIDGE_PCI) ? 32 : 1);
pci_ocp_write_config(sc->sc_dev, bus, slot, func,
PCIR_SUBBUS_1, secbus, 1);
@@ -721,7 +722,7 @@ pci_ocp_attach(device_t dev)
{
struct pci_ocp_softc *sc;
uint32_t cfgreg;
- int error, maxslot;
+ int error, nslots;
sc = device_get_softc(dev);
sc->sc_dev = dev;
@@ -765,8 +766,8 @@ pci_ocp_attach(device_t dev)
return (0);
}
- maxslot = (sc->sc_pcie_cap) ? 1 : 31;
- pci_ocp_init(sc, sc->sc_busnr, maxslot);
+ nslots = (sc->sc_pcie_cap) ? 1 : 32;
+ pci_ocp_init(sc, sc->sc_busnr, nslots);
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
Modified: user/imp/tbemd/sys/powerpc/ofw/ofw_real.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/ofw/ofw_real.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/ofw/ofw_real.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -273,7 +273,7 @@ ofw_real_init(ofw_t ofw, void *openfirm)
static int
ofw_real_test(ofw_t ofw, const char *name)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -304,7 +304,7 @@ ofw_real_test(ofw_t ofw, const char *nam
static phandle_t
ofw_real_peer(ofw_t ofw, phandle_t node)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -326,7 +326,7 @@ ofw_real_peer(ofw_t ofw, phandle_t node)
static phandle_t
ofw_real_child(ofw_t ofw, phandle_t node)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -348,7 +348,7 @@ ofw_real_child(ofw_t ofw, phandle_t node
static phandle_t
ofw_real_parent(ofw_t ofw, phandle_t node)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -370,7 +370,7 @@ ofw_real_parent(ofw_t ofw, phandle_t nod
static phandle_t
ofw_real_instance_to_package(ofw_t ofw, ihandle_t instance)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -392,7 +392,7 @@ ofw_real_instance_to_package(ofw_t ofw,
static ssize_t
ofw_real_getproplen(ofw_t ofw, phandle_t package, const char *propname)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -422,7 +422,7 @@ static ssize_t
ofw_real_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf,
size_t buflen)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -458,7 +458,7 @@ static int
ofw_real_nextprop(ofw_t ofw, phandle_t package, const char *previous,
char *buf, size_t size)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -493,7 +493,7 @@ static int
ofw_real_setprop(ofw_t ofw, phandle_t package, const char *propname,
const void *buf, size_t len)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -526,7 +526,7 @@ ofw_real_setprop(ofw_t ofw, phandle_t pa
static ssize_t
ofw_real_canon(ofw_t ofw, const char *device, char *buf, size_t len)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -559,7 +559,7 @@ ofw_real_canon(ofw_t ofw, const char *de
static phandle_t
ofw_real_finddevice(ofw_t ofw, const char *device)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -586,7 +586,7 @@ ofw_real_finddevice(ofw_t ofw, const cha
static ssize_t
ofw_real_instance_to_path(ofw_t ofw, ihandle_t instance, char *buf, size_t len)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -619,7 +619,7 @@ ofw_real_instance_to_path(ofw_t ofw, iha
static ssize_t
ofw_real_package_to_path(ofw_t ofw, phandle_t package, char *buf, size_t len)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -653,7 +653,7 @@ static int
ofw_real_call_method(ofw_t ofw, ihandle_t instance, const char *method,
int nargs, int nreturns, unsigned long *args_and_returns)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -701,7 +701,7 @@ ofw_real_call_method(ofw_t ofw, ihandle_
static ihandle_t
ofw_real_open(ofw_t ofw, const char *device)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -729,7 +729,7 @@ ofw_real_open(ofw_t ofw, const char *dev
static void
ofw_real_close(ofw_t ofw, ihandle_t instance)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -737,6 +737,7 @@ ofw_real_close(ofw_t ofw, ihandle_t inst
} args = {
(cell_t)"close",
1,
+ 0,
};
args.instance = instance;
@@ -747,7 +748,7 @@ ofw_real_close(ofw_t ofw, ihandle_t inst
static ssize_t
ofw_real_read(ofw_t ofw, ihandle_t instance, void *addr, size_t len)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -780,7 +781,7 @@ ofw_real_read(ofw_t ofw, ihandle_t insta
static ssize_t
ofw_real_write(ofw_t ofw, ihandle_t instance, const void *addr, size_t len)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -811,7 +812,7 @@ ofw_real_write(ofw_t ofw, ihandle_t inst
static int
ofw_real_seek(ofw_t ofw, ihandle_t instance, u_int64_t pos)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -841,7 +842,7 @@ ofw_real_seek(ofw_t ofw, ihandle_t insta
static caddr_t
ofw_real_claim(ofw_t ofw, void *virt, size_t size, u_int align)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -867,7 +868,7 @@ ofw_real_claim(ofw_t ofw, void *virt, si
static void
ofw_real_release(ofw_t ofw, void *virt, size_t size)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
@@ -876,6 +877,7 @@ ofw_real_release(ofw_t ofw, void *virt,
} args = {
(cell_t)"release",
2,
+ 0,
};
args.virt = (cell_t)virt;
@@ -891,12 +893,14 @@ ofw_real_release(ofw_t ofw, void *virt,
static void
ofw_real_enter(ofw_t ofw)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
} args = {
(cell_t)"enter",
+ 0,
+ 0,
};
openfirmware(&args);
@@ -907,12 +911,14 @@ ofw_real_enter(ofw_t ofw)
static void
ofw_real_exit(ofw_t ofw)
{
- static struct {
+ struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
} args = {
(cell_t)"exit",
+ 0,
+ 0,
};
openfirmware(&args);
Modified: user/imp/tbemd/sys/powerpc/ofw/ofw_syscons.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/ofw/ofw_syscons.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/ofw/ofw_syscons.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -55,10 +55,10 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/ofw_pci.h>
#include <powerpc/ofw/ofw_syscons.h>
-static int ofwfb_ignore_mmap_checks;
+static int ofwfb_ignore_mmap_checks = 1;
SYSCTL_NODE(_hw, OID_AUTO, ofwfb, CTLFLAG_RD, 0, "ofwfb");
SYSCTL_INT(_hw_ofwfb, OID_AUTO, relax_mmap, CTLFLAG_RW,
- &ofwfb_ignore_mmap_checks, 0, "relax mmap bounds checking");
+ &ofwfb_ignore_mmap_checks, 0, "relaxed mmap bounds checking");
extern u_char dflt_font_16[];
extern u_char dflt_font_14[];
Modified: user/imp/tbemd/sys/powerpc/powermac/cuda.c
==============================================================================
--- user/imp/tbemd/sys/powerpc/powermac/cuda.c Mon Apr 12 23:14:06 2010 (r206523)
+++ user/imp/tbemd/sys/powerpc/powermac/cuda.c Mon Apr 12 23:16:01 2010 (r206524)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kernel.h>
+#include <sys/clock.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/openfirm.h>
@@ -55,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <dev/adb/adb.h>
+#include "clock_if.h"
#include "cudavar.h"
#include "viareg.h"
@@ -72,6 +74,12 @@ static u_int cuda_poll(device_t dev);
static void cuda_send_inbound(struct cuda_softc *sc);
static void cuda_send_outbound(struct cuda_softc *sc);
+/*
+ * Clock interface
+ */
+static int cuda_gettime(device_t dev, struct timespec *ts);
+static int cuda_settime(device_t dev, struct timespec *ts);
+
static device_method_t cuda_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, cuda_probe),
@@ -90,6 +98,10 @@ static device_method_t cuda_methods[] =
DEVMETHOD(adb_hb_controller_poll, cuda_poll),
DEVMETHOD(adb_hb_set_autopoll_mask, cuda_adb_autopoll),
+ /* Clock interface */
+ DEVMETHOD(clock_gettime, cuda_gettime),
+ DEVMETHOD(clock_settime, cuda_settime),
+
{ 0, 0 },
};
@@ -173,6 +185,7 @@ cuda_attach(device_t dev)
sc->sc_polling = 0;
sc->sc_state = CUDA_NOTREADY;
sc->sc_autopoll = 0;
+ sc->sc_rtc = -1;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list