From owner-svn-src-user@FreeBSD.ORG Wed Nov 3 15:22:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D931106564A; Wed, 3 Nov 2010 15:22:10 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC6E08FC1B; Wed, 3 Nov 2010 15:22:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA3FM92p024715; Wed, 3 Nov 2010 15:22:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FM9b6024680; Wed, 3 Nov 2010 15:22:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201011031522.oA3FM9b6024680@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 3 Nov 2010 15:22:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214740 - in user/nwhitehorn/ps3: amd64/acpica amd64/amd64 amd64/include arm/arm boot/ofw/common boot/ofw/libofw boot/sparc64/loader cddl/contrib/opensolaris/uts/common/fs/zfs conf dev/... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2010 15:22:10 -0000 Author: nwhitehorn Date: Wed Nov 3 15:22:09 2010 New Revision: 214740 URL: http://svn.freebsd.org/changeset/base/214740 Log: IFC @ r214739 Added: user/nwhitehorn/ps3/dev/agp/agp_apple.c - copied unchanged from r214739, head/sys/dev/agp/agp_apple.c user/nwhitehorn/ps3/x86/include/ - copied from r214739, head/sys/x86/include/ user/nwhitehorn/ps3/x86/x86/dump_machdep.c - copied unchanged from r214739, head/sys/x86/x86/dump_machdep.c user/nwhitehorn/ps3/x86/x86/mptable.c - copied unchanged from r214739, head/sys/x86/x86/mptable.c user/nwhitehorn/ps3/x86/x86/mptable_pci.c - copied unchanged from r214739, head/sys/x86/x86/mptable_pci.c user/nwhitehorn/ps3/x86/x86/nexus.c - copied unchanged from r214739, head/sys/x86/x86/nexus.c Deleted: user/nwhitehorn/ps3/amd64/amd64/dump_machdep.c user/nwhitehorn/ps3/amd64/amd64/mptable.c user/nwhitehorn/ps3/amd64/amd64/mptable_pci.c user/nwhitehorn/ps3/amd64/amd64/nexus.c user/nwhitehorn/ps3/amd64/include/apicreg.h user/nwhitehorn/ps3/amd64/include/mca.h user/nwhitehorn/ps3/i386/i386/dump_machdep.c user/nwhitehorn/ps3/i386/i386/mptable.c user/nwhitehorn/ps3/i386/i386/mptable_pci.c user/nwhitehorn/ps3/i386/i386/nexus.c user/nwhitehorn/ps3/i386/include/apicreg.h user/nwhitehorn/ps3/i386/include/mca.h user/nwhitehorn/ps3/pc98/include/apicreg.h user/nwhitehorn/ps3/pc98/include/mca.h Modified: user/nwhitehorn/ps3/amd64/acpica/acpi_wakeup.c user/nwhitehorn/ps3/amd64/acpica/madt.c user/nwhitehorn/ps3/amd64/amd64/amd64_mem.c user/nwhitehorn/ps3/amd64/amd64/apic_vector.S user/nwhitehorn/ps3/amd64/amd64/genassym.c user/nwhitehorn/ps3/amd64/amd64/intr_machdep.c user/nwhitehorn/ps3/amd64/amd64/machdep.c user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c user/nwhitehorn/ps3/amd64/amd64/mp_watchdog.c user/nwhitehorn/ps3/amd64/amd64/pmap.c user/nwhitehorn/ps3/amd64/amd64/trap.c user/nwhitehorn/ps3/amd64/include/pmap.h user/nwhitehorn/ps3/arm/arm/elf_trampoline.c user/nwhitehorn/ps3/boot/ofw/common/main.c user/nwhitehorn/ps3/boot/ofw/libofw/ofw_memory.c user/nwhitehorn/ps3/boot/ofw/libofw/ofw_net.c user/nwhitehorn/ps3/boot/ofw/libofw/openfirm.c user/nwhitehorn/ps3/boot/sparc64/loader/main.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c user/nwhitehorn/ps3/conf/files user/nwhitehorn/ps3/conf/files.amd64 user/nwhitehorn/ps3/conf/files.i386 user/nwhitehorn/ps3/conf/files.pc98 user/nwhitehorn/ps3/conf/files.powerpc user/nwhitehorn/ps3/conf/kern.post.mk user/nwhitehorn/ps3/conf/kmod.mk user/nwhitehorn/ps3/conf/options.amd64 user/nwhitehorn/ps3/conf/options.powerpc user/nwhitehorn/ps3/dev/acpica/acpi.c user/nwhitehorn/ps3/dev/agp/agp.c user/nwhitehorn/ps3/dev/alc/if_alc.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-intel.c user/nwhitehorn/ps3/dev/bge/if_bge.c user/nwhitehorn/ps3/dev/bge/if_bgereg.h user/nwhitehorn/ps3/dev/e1000/e1000_82571.c user/nwhitehorn/ps3/dev/e1000/if_em.c user/nwhitehorn/ps3/dev/e1000/if_em.h user/nwhitehorn/ps3/dev/e1000/if_lem.c user/nwhitehorn/ps3/dev/e1000/if_lem.h user/nwhitehorn/ps3/dev/mii/brgphy.c user/nwhitehorn/ps3/dev/mii/e1000phy.c user/nwhitehorn/ps3/dev/mii/mii_physubr.c user/nwhitehorn/ps3/dev/mii/miidevs user/nwhitehorn/ps3/dev/mii/miivar.h user/nwhitehorn/ps3/dev/usb/usb_device.c user/nwhitehorn/ps3/dev/usb/usb_hub.c user/nwhitehorn/ps3/dev/usb/usbdevs user/nwhitehorn/ps3/dev/usb/usbdi.h user/nwhitehorn/ps3/dev/xen/blkback/blkback.c user/nwhitehorn/ps3/fs/nfs/nfsclstate.h user/nwhitehorn/ps3/fs/nfsclient/nfs_clnode.c user/nwhitehorn/ps3/fs/nfsclient/nfs_clstate.c user/nwhitehorn/ps3/fs/nfsclient/nfs_clvnops.c user/nwhitehorn/ps3/geom/part/g_part.c user/nwhitehorn/ps3/geom/part/g_part.h user/nwhitehorn/ps3/geom/part/g_part_gpt.c user/nwhitehorn/ps3/geom/part/g_part_if.m user/nwhitehorn/ps3/i386/acpica/acpi_wakeup.c user/nwhitehorn/ps3/i386/acpica/madt.c user/nwhitehorn/ps3/i386/i386/apic_vector.s user/nwhitehorn/ps3/i386/i386/genassym.c user/nwhitehorn/ps3/i386/i386/intr_machdep.c user/nwhitehorn/ps3/i386/i386/machdep.c user/nwhitehorn/ps3/i386/i386/mp_machdep.c user/nwhitehorn/ps3/i386/i386/mp_watchdog.c user/nwhitehorn/ps3/i386/i386/mpboot.s user/nwhitehorn/ps3/i386/i386/trap.c user/nwhitehorn/ps3/i386/xen/mp_machdep.c user/nwhitehorn/ps3/i386/xen/mptable.c user/nwhitehorn/ps3/kern/init_main.c user/nwhitehorn/ps3/kern/kern_clock.c user/nwhitehorn/ps3/kern/kern_cpuset.c user/nwhitehorn/ps3/kern/kern_timeout.c user/nwhitehorn/ps3/kern/sched_ule.c user/nwhitehorn/ps3/kern/subr_acl_nfs4.c user/nwhitehorn/ps3/kern/vfs_cache.c user/nwhitehorn/ps3/mips/cavium/octeon_ebt3000_cf.c user/nwhitehorn/ps3/modules/Makefile user/nwhitehorn/ps3/modules/agp/Makefile user/nwhitehorn/ps3/net/bpf.h user/nwhitehorn/ps3/netinet/if_ether.c user/nwhitehorn/ps3/netipsec/ipsec.c user/nwhitehorn/ps3/netipsec/ipsec_input.c user/nwhitehorn/ps3/nfsclient/nfs_vfsops.c user/nwhitehorn/ps3/pc98/include/bus.h user/nwhitehorn/ps3/pc98/pc98/busiosubr.c user/nwhitehorn/ps3/pc98/pc98/machdep.c user/nwhitehorn/ps3/powerpc/aim/copyinout.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c user/nwhitehorn/ps3/powerpc/aim/slb.c user/nwhitehorn/ps3/powerpc/aim/swtch32.S user/nwhitehorn/ps3/powerpc/aim/swtch64.S user/nwhitehorn/ps3/powerpc/aim/trap.c user/nwhitehorn/ps3/powerpc/aim/trap_subr32.S user/nwhitehorn/ps3/powerpc/aim/trap_subr64.S user/nwhitehorn/ps3/powerpc/aim/vm_machdep.c user/nwhitehorn/ps3/powerpc/conf/GENERIC user/nwhitehorn/ps3/powerpc/conf/GENERIC64 user/nwhitehorn/ps3/powerpc/conf/NOTES user/nwhitehorn/ps3/powerpc/include/pcb.h user/nwhitehorn/ps3/powerpc/include/slb.h user/nwhitehorn/ps3/powerpc/include/sr.h user/nwhitehorn/ps3/powerpc/powermac/cpcht.c user/nwhitehorn/ps3/powerpc/powerpc/exec_machdep.c user/nwhitehorn/ps3/powerpc/powerpc/genassym.c user/nwhitehorn/ps3/sparc64/sparc64/pmap.c user/nwhitehorn/ps3/sparc64/sparc64/tick.c user/nwhitehorn/ps3/ufs/ufs/ufs_dirhash.c user/nwhitehorn/ps3/vm/vm_phys.c user/nwhitehorn/ps3/vm/vm_reserv.c user/nwhitehorn/ps3/x86/x86/io_apic.c user/nwhitehorn/ps3/x86/x86/local_apic.c user/nwhitehorn/ps3/x86/x86/mca.c user/nwhitehorn/ps3/x86/x86/msi.c Directory Properties: user/nwhitehorn/ps3/ (props changed) user/nwhitehorn/ps3/amd64/include/xen/ (props changed) user/nwhitehorn/ps3/boot/powerpc/ps3/ (props changed) user/nwhitehorn/ps3/cddl/contrib/opensolaris/ (props changed) user/nwhitehorn/ps3/contrib/dev/acpica/ (props changed) user/nwhitehorn/ps3/contrib/pf/ (props changed) user/nwhitehorn/ps3/contrib/x86emu/ (props changed) user/nwhitehorn/ps3/dev/xen/xenpci/ (props changed) user/nwhitehorn/ps3/powerpc/ps3/ (props changed) Modified: user/nwhitehorn/ps3/amd64/acpica/acpi_wakeup.c ============================================================================== --- user/nwhitehorn/ps3/amd64/acpica/acpi_wakeup.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/acpica/acpi_wakeup.c Wed Nov 3 15:22:09 2010 (r214740) @@ -41,13 +41,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include #ifdef SMP -#include +#include #include #include #endif Modified: user/nwhitehorn/ps3/amd64/acpica/madt.c ============================================================================== --- user/nwhitehorn/ps3/amd64/acpica/madt.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/acpica/madt.c Wed Nov 3 15:22:09 2010 (r214740) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: user/nwhitehorn/ps3/amd64/amd64/amd64_mem.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/amd64_mem.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/amd64_mem.c Wed Nov 3 15:22:09 2010 (r214740) @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -527,9 +531,9 @@ static int amd64_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg) { struct mem_range_desc *targ; - int error = 0; + int error, i; - switch(*arg) { + switch (*arg) { case MEMRANGE_SET_UPDATE: /* * Make sure that what's being asked for is even @@ -568,6 +572,21 @@ amd64_mrset(struct mem_range_softc *sc, return (EOPNOTSUPP); } + /* + * Ensure that the direct map region does not contain any mappings + * that span MTRRs of different types. However, the fixed MTRRs can + * be ignored, because a large page mapping the first 1 MB of physical + * memory is a special case that the processor handles. The entire + * TLB will be invalidated by amd64_mrstore(), so pmap_demote_DMAP() + * needn't do it. + */ + i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; + mrd = sc->mr_desc + i; + for (; i < sc->mr_ndesc; i++, mrd++) { + if (mrd->mr_flags & MDF_ACTIVE) + pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, FALSE); + } + /* Update the hardware. */ amd64_mrstore(sc); @@ -657,6 +676,21 @@ amd64_mrinit(struct mem_range_softc *sc) if (mrd->mr_flags & MDF_ACTIVE) mrd->mr_flags |= MDF_FIRMWARE; } + + /* + * Ensure that the direct map region does not contain any mappings + * that span MTRRs of different types. However, the fixed MTRRs can + * be ignored, because a large page mapping the first 1 MB of physical + * memory is a special case that the processor handles. Invalidate + * any old TLB entries that might hold inconsistent memory type + * information. + */ + i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; + mrd = sc->mr_desc + i; + for (; i < sc->mr_ndesc; i++, mrd++) { + if (mrd->mr_flags & MDF_ACTIVE) + pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, TRUE); + } } /* Modified: user/nwhitehorn/ps3/amd64/amd64/apic_vector.S ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/apic_vector.S Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/apic_vector.S Wed Nov 3 15:22:09 2010 (r214740) @@ -39,7 +39,7 @@ #include "opt_smp.h" #include -#include +#include #include "assym.s" Modified: user/nwhitehorn/ps3/amd64/amd64/genassym.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/genassym.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/genassym.c Wed Nov 3 15:22:09 2010 (r214740) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: user/nwhitehorn/ps3/amd64/amd64/intr_machdep.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/intr_machdep.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/intr_machdep.c Wed Nov 3 15:22:09 2010 (r214740) @@ -458,7 +458,7 @@ intr_next_cpu(void) /* Leave all interrupts on the BSP during boot. */ if (!assign_cpu) - return (cpu_apic_ids[0]); + return (PCPU_GET(apic_id)); mtx_lock_spin(&icu_lock); apic_id = cpu_apic_ids[current_cpu]; Modified: user/nwhitehorn/ps3/amd64/amd64/machdep.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/machdep.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/machdep.c Wed Nov 3 15:22:09 2010 (r214740) @@ -112,7 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c Wed Nov 3 15:22:09 2010 (r214740) @@ -57,11 +57,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include -#include +#include #include #include #include Modified: user/nwhitehorn/ps3/amd64/amd64/mp_watchdog.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/mp_watchdog.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/mp_watchdog.c Wed Nov 3 15:22:09 2010 (r214740) @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include Modified: user/nwhitehorn/ps3/amd64/amd64/pmap.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/pmap.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/pmap.c Wed Nov 3 15:22:09 2010 (r214740) @@ -462,7 +462,7 @@ create_pagetables(vm_paddr_t *firstaddr) if (ndmpdp < 4) /* Minimum 4GB of dirmap */ ndmpdp = 4; DMPDPphys = allocpages(firstaddr, NDMPML4E); - if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) + if ((amd_feature & AMDID_PAGE1GB) == 0) DMPDphys = allocpages(firstaddr, ndmpdp); dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT; @@ -494,11 +494,16 @@ create_pagetables(vm_paddr_t *firstaddr) ((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U; } - /* Now set up the direct map space using either 2MB or 1GB pages */ - /* Preset PG_M and PG_A because demotion expects it */ - if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) { + /* + * Now, set up the direct map region using either 2MB or 1GB pages. + * Later, if pmap_mapdev{_attr}() uses the direct map for non-write- + * back memory, pmap_change_attr() will demote any 2MB or 1GB page + * mappings that are partially used. + */ + if ((amd_feature & AMDID_PAGE1GB) == 0) { for (i = 0; i < NPDEPG * ndmpdp; i++) { ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | PG_M | PG_A; } @@ -512,6 +517,7 @@ create_pagetables(vm_paddr_t *firstaddr) for (i = 0; i < ndmpdp; i++) { ((pdp_entry_t *)DMPDPphys)[i] = (vm_paddr_t)i << PDPSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | PG_M | PG_A; } @@ -4948,6 +4954,54 @@ pmap_change_attr_locked(vm_offset_t va, } /* + * Demotes any mapping within the direct map region that covers more than the + * specified range of physical addresses. This range's size must be a power + * of two and its starting address must be a multiple of its size. Since the + * demotion does not change any attributes of the mapping, a TLB invalidation + * is not mandatory. The caller may, however, request a TLB invalidation. + */ +void +pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate) +{ + pdp_entry_t *pdpe; + pd_entry_t *pde; + vm_offset_t va; + boolean_t changed; + + if (len == 0) + return; + KASSERT(powerof2(len), ("pmap_demote_DMAP: len is not a power of 2")); + KASSERT((base & (len - 1)) == 0, + ("pmap_demote_DMAP: base is not a multiple of len")); + if (len < NBPDP && base < dmaplimit) { + va = PHYS_TO_DMAP(base); + changed = FALSE; + PMAP_LOCK(kernel_pmap); + pdpe = pmap_pdpe(kernel_pmap, va); + if ((*pdpe & PG_V) == 0) + panic("pmap_demote_DMAP: invalid PDPE"); + if ((*pdpe & PG_PS) != 0) { + if (!pmap_demote_pdpe(kernel_pmap, pdpe, va)) + panic("pmap_demote_DMAP: PDPE failed"); + changed = TRUE; + } + if (len < NBPDR) { + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & PG_V) == 0) + panic("pmap_demote_DMAP: invalid PDE"); + if ((*pde & PG_PS) != 0) { + if (!pmap_demote_pde(kernel_pmap, pde, va)) + panic("pmap_demote_DMAP: PDE failed"); + changed = TRUE; + } + } + if (changed && invalidate) + pmap_invalidate_page(kernel_pmap, va); + PMAP_UNLOCK(kernel_pmap); + } +} + +/* * perform the pmap work for mincore */ int Modified: user/nwhitehorn/ps3/amd64/amd64/trap.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/trap.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/amd64/trap.c Wed Nov 3 15:22:09 2010 (r214740) @@ -83,7 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #ifdef SMP Modified: user/nwhitehorn/ps3/amd64/include/pmap.h ============================================================================== --- user/nwhitehorn/ps3/amd64/include/pmap.h Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/amd64/include/pmap.h Wed Nov 3 15:22:09 2010 (r214740) @@ -307,6 +307,7 @@ extern vm_offset_t virtual_end; void pmap_bootstrap(vm_paddr_t *); int pmap_change_attr(vm_offset_t, vm_size_t, int); +void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); void pmap_init_pat(void); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void *pmap_kenter_temporary(vm_paddr_t pa, int i); Modified: user/nwhitehorn/ps3/arm/arm/elf_trampoline.c ============================================================================== --- user/nwhitehorn/ps3/arm/arm/elf_trampoline.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/arm/arm/elf_trampoline.c Wed Nov 3 15:22:09 2010 (r214740) @@ -159,7 +159,7 @@ _startC(void) #if defined(FLASHADDR) && defined(LOADERRAMADDR) unsigned int pc; - __asm __volatile("adr %0, _start\n" + __asm __volatile("mov %0, pc\n" : "=r" (pc)); if ((FLASHADDR > LOADERRAMADDR && pc >= FLASHADDR) || (FLASHADDR < LOADERRAMADDR && pc < LOADERRAMADDR)) { @@ -173,11 +173,13 @@ _startC(void) */ unsigned int target_addr; unsigned int tmp_sp; + uint32_t src_addr = (uint32_t)&_start - PHYSADDR + FLASHADDR + + (pc - FLASHADDR - ((uint32_t)&_startC - PHYSADDR)) & 0xfffff000; target_addr = (unsigned int)&_start - PHYSADDR + LOADERRAMADDR; tmp_sp = target_addr + 0x100000 + (unsigned int)&_end - (unsigned int)&_start; - memcpy((char *)target_addr, (char *)pc, + memcpy((char *)target_addr, (char *)src_addr, (unsigned int)&_end - (unsigned int)&_start); /* Temporary set the sp and jump to the new location. */ __asm __volatile( Modified: user/nwhitehorn/ps3/boot/ofw/common/main.c ============================================================================== --- user/nwhitehorn/ps3/boot/ofw/common/main.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/boot/ofw/common/main.c Wed Nov 3 15:22:09 2010 (r214740) @@ -41,19 +41,23 @@ extern char bootprog_rev[]; extern char bootprog_date[]; extern char bootprog_maker[]; -u_int32_t acells; +u_int32_t acells, scells; static char bootargs[128]; #define HEAP_SIZE 0x80000 +#define OF_puts(fd, text) OF_write(fd, text, strlen(text)) + void init_heap(void) { void *base; + ihandle_t stdout; if ((base = ofw_alloc_heap(HEAP_SIZE)) == (void *)0xffffffff) { - printf("Heap memory claim failed!\n"); + OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); + OF_puts(stdout, "Heap memory claim failed!\n"); OF_enter(); } @@ -64,25 +68,20 @@ uint64_t memsize(void) { phandle_t memoryp; - struct ofw_reg reg[4]; - struct ofw_reg2 reg2[8]; - int i; - u_int64_t sz, memsz; + cell_t reg[24]; + int i, sz; + u_int64_t memsz; + memsz = 0; memoryp = OF_instance_to_package(memory); - if (acells == 1) { - sz = OF_getprop(memoryp, "reg", ®, sizeof(reg)); - sz /= sizeof(struct ofw_reg); - - for (i = 0, memsz = 0; i < sz; i++) - memsz += reg[i].size; - } else if (acells == 2) { - sz = OF_getprop(memoryp, "reg", ®2, sizeof(reg2)); - sz /= sizeof(struct ofw_reg2); + sz = OF_getprop(memoryp, "reg", ®, sizeof(reg)); + sz /= sizeof(reg[0]); - for (i = 0, memsz = 0; i < sz; i++) - memsz += reg2[i].size; + for (i = 0; i < sz; i += (acells + scells)) { + if (scells > 1) + memsz += (uint64_t)reg[i + acells] << 32; + memsz += reg[i + acells + scells - 1]; } return (memsz); @@ -105,13 +104,9 @@ main(int (*openfirm)(void *)) root = OF_finddevice("/"); - acells = 1; + scells = acells = 1; OF_getprop(root, "#address-cells", &acells, sizeof(acells)); - - /* - * Set up console. - */ - cons_probe(); + OF_getprop(root, "#size-cells", &scells, sizeof(scells)); /* * Initialise the heap as early as possible. Once this is done, @@ -121,6 +116,11 @@ main(int (*openfirm)(void *)) init_heap(); /* + * Set up console. + */ + cons_probe(); + + /* * March through the device switch probing for things. */ for (i = 0; devsw[i] != NULL; i++) Modified: user/nwhitehorn/ps3/boot/ofw/libofw/ofw_memory.c ============================================================================== --- user/nwhitehorn/ps3/boot/ofw/libofw/ofw_memory.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/boot/ofw/libofw/ofw_memory.c Wed Nov 3 15:22:09 2010 (r214740) @@ -118,13 +118,19 @@ ofw_memmap(int acells) void * ofw_alloc_heap(unsigned int size) { - phandle_t memoryp; - struct ofw_reg available; + phandle_t memoryp, root; + cell_t available[4]; + cell_t acells; + + root = OF_finddevice("/"); + acells = 1; + OF_getprop(root, "#address-cells", &acells, sizeof(acells)); memoryp = OF_instance_to_package(memory); - OF_getprop(memoryp, "available", &available, sizeof(available)); + OF_getprop(memoryp, "available", available, sizeof(available)); - heap_base = OF_claim((void *)available.base, size, sizeof(register_t)); + heap_base = OF_claim((void *)available[acells-1], size, + sizeof(register_t)); if (heap_base != (void *)-1) { heap_size = size; Modified: user/nwhitehorn/ps3/boot/ofw/libofw/ofw_net.c ============================================================================== --- user/nwhitehorn/ps3/boot/ofw/libofw/ofw_net.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/boot/ofw/libofw/ofw_net.c Wed Nov 3 15:22:09 2010 (r214740) @@ -230,7 +230,10 @@ punt: static void ofwn_end(struct netif *nif) { +#ifdef BROKEN + /* dma-free freezes at least some Apple ethernet controllers */ OF_call_method("dma-free", netinstance, 2, 0, dmabuf, MAXPHYS); +#endif OF_close(netinstance); } Modified: user/nwhitehorn/ps3/boot/ofw/libofw/openfirm.c ============================================================================== --- user/nwhitehorn/ps3/boot/ofw/libofw/openfirm.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/boot/ofw/libofw/openfirm.c Wed Nov 3 15:22:09 2010 (r214740) @@ -80,8 +80,13 @@ OF_init(int (*openfirm)(void *)) if ((chosen = OF_finddevice("/chosen")) == -1) OF_exit(); - if (OF_getprop(chosen, "memory", &memory, sizeof(memory)) == -1) - OF_exit(); + if (OF_getprop(chosen, "memory", &memory, sizeof(memory)) == -1) { + memory = OF_open("/memory"); + if (memory == -1) + memory = OF_open("/memory@0"); + if (memory == -1) + OF_exit(); + } if (OF_getprop(chosen, "mmu", &mmu, sizeof(mmu)) == -1) OF_exit(); } Modified: user/nwhitehorn/ps3/boot/sparc64/loader/main.c ============================================================================== --- user/nwhitehorn/ps3/boot/sparc64/loader/main.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/boot/sparc64/loader/main.c Wed Nov 3 15:22:09 2010 (r214740) @@ -811,15 +811,15 @@ main(int (*openfirm)(void *)) archsw.arch_autoload = sparc64_autoload; archsw.arch_maphint = sparc64_maphint; + if (init_heap() == (vm_offset_t)-1) + OF_exit(); + setheap((void *)heapva, (void *)(heapva + HEAPSZ)); + /* * Probe for a console. */ cons_probe(); - if (init_heap() == (vm_offset_t)-1) - panic("%s: can't claim heap", __func__); - setheap((void *)heapva, (void *)(heapva + HEAPSZ)); - if ((root = OF_peer(0)) == -1) panic("%s: can't get root phandle", __func__); OF_getprop(root, "compatible", compatible, sizeof(compatible)); Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Nov 3 15:22:09 2010 (r214740) @@ -192,7 +192,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, ASSERT(length <= DMU_MAX_ACCESS); - dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT; + dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT | DB_RF_HAVESTRUCT; if (flags & DMU_READ_NO_PREFETCH || length > zfetch_array_rd_sz) dbuf_flags |= DB_RF_NOPREFETCH; @@ -209,6 +209,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, os_dsl_dataset->ds_object, (longlong_t)dn->dn_object, dn->dn_datablksz, (longlong_t)offset, (longlong_t)length); + rw_exit(&dn->dn_struct_rwlock); return (EIO); } nblks = 1; @@ -231,9 +232,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, } /* initiate async i/o */ if (read) { - rw_exit(&dn->dn_struct_rwlock); (void) dbuf_read(db, zio, dbuf_flags); - rw_enter(&dn->dn_struct_rwlock, RW_READER); } dbp[i] = &db->db; } @@ -540,7 +539,7 @@ dmu_read(objset_t *os, uint64_t object, { dnode_t *dn; dmu_buf_t **dbp; - int numbufs, i, err; + int numbufs, err; err = dnode_hold(os->os, object, FTAG, &dn); if (err) @@ -551,7 +550,7 @@ dmu_read(objset_t *os, uint64_t object, * block. If we ever do the tail block optimization, we will need to * handle that here as well. */ - if (dn->dn_datablkshift == 0) { + if (dn->dn_maxblkid == 0) { int newsz = offset > dn->dn_datablksz ? 0 : MIN(size, dn->dn_datablksz - offset); bzero((char *)buf + newsz, size - newsz); @@ -560,6 +559,7 @@ dmu_read(objset_t *os, uint64_t object, while (size > 0) { uint64_t mylen = MIN(size, DMU_MAX_ACCESS / 2); + int i; /* * NB: we could do this block-at-a-time, but it's nice Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Nov 3 15:22:09 2010 (r214740) @@ -1031,6 +1031,10 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) VFS_UNLOCK_GIANT(vfslocked); } +#ifdef DEBUG +static int zil_fault_io = 0; +#endif + /* * Get data to generate a TX_WRITE intent log record. */ @@ -1112,7 +1116,21 @@ zfs_get_data(void *arg, lr_write_t *lr, zgd->zgd_rl = rl; zgd->zgd_zilog = zfsvfs->z_log; zgd->zgd_bp = &lr->lr_blkptr; - VERIFY(0 == dmu_buf_hold(os, lr->lr_foid, boff, zgd, &db)); +#ifdef DEBUG + if (zil_fault_io) { + error = EIO; + zil_fault_io = 0; + } else { + error = dmu_buf_hold(os, lr->lr_foid, boff, zgd, &db); + } +#else + error = dmu_buf_hold(os, lr->lr_foid, boff, zgd, &db); +#endif + if (error != 0) { + kmem_free(zgd, sizeof (zgd_t)); + goto out; + } + ASSERT(boff == db->db_offset); lr->lr_blkoff = off - boff; error = dmu_sync(zio, db, &lr->lr_blkptr, Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Wed Nov 3 15:22:09 2010 (r214740) @@ -933,6 +933,10 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it } error = zilog->zl_get_data( itx->itx_private, lr, dbuf, lwb->lwb_zio); + if (error == EIO) { + txg_wait_synced(zilog->zl_dmu_pool, txg); + return (lwb); + } if (error) { ASSERT(error == ENOENT || error == EEXIST || error == EALREADY); Modified: user/nwhitehorn/ps3/conf/files ============================================================================== --- user/nwhitehorn/ps3/conf/files Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/files Wed Nov 3 15:22:09 2010 (r214740) @@ -67,12 +67,12 @@ fdt_static_dtb.h optional fdt fdt_dtb_s compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \ no-obj no-implicit-rule before-depend \ clean "fdt_static_dtb.h" -p16v-alsa%diked.h optional snd_emu10kx pci \ +p16v-alsa%diked.h optional snd_emu10kx pci \ dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \ compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \ no-obj no-implicit-rule before-depend \ clean "p16v-alsa%diked.h" -p17v-alsa%diked.h optional snd_emu10kx pci \ +p17v-alsa%diked.h optional snd_emu10kx pci \ dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h" \ compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h p17v-alsa%diked.h" \ no-obj no-implicit-rule before-depend \ @@ -83,12 +83,12 @@ feeder_eq_gen.h optional sound \ no-obj no-implicit-rule before-depend \ clean "feeder_eq_gen.h" feeder_rate_gen.h optional sound \ - dependency "$S/tools/sound/feeder_rate_mkfilter.awk" \ + dependency "$S/tools/sound/feeder_rate_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_rate_mkfilter.awk -- ${FEEDER_RATE_PRESETS} > feeder_rate_gen.h" \ no-obj no-implicit-rule before-depend \ clean "feeder_rate_gen.h" snd_fxdiv_gen.h optional sound \ - dependency "$S/tools/sound/snd_fxdiv_gen.awk" \ + dependency "$S/tools/sound/snd_fxdiv_gen.awk" \ compile-with "${AWK} -f $S/tools/sound/snd_fxdiv_gen.awk -- > snd_fxdiv_gen.h" \ no-obj no-implicit-rule before-depend \ clean "snd_fxdiv_gen.h" Modified: user/nwhitehorn/ps3/conf/files.amd64 ============================================================================== --- user/nwhitehorn/ps3/conf/files.amd64 Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/files.amd64 Wed Nov 3 15:22:09 2010 (r214740) @@ -104,7 +104,6 @@ amd64/amd64/cpu_switch.S standard amd64/amd64/db_disasm.c optional ddb amd64/amd64/db_interface.c optional ddb amd64/amd64/db_trace.c optional ddb -amd64/amd64/dump_machdep.c standard amd64/amd64/elf_machdep.c standard amd64/amd64/exception.S standard amd64/amd64/fpu.c standard @@ -122,9 +121,6 @@ amd64/amd64/minidump_machdep.c standard amd64/amd64/mp_machdep.c optional smp amd64/amd64/mp_watchdog.c optional mp_watchdog smp amd64/amd64/mpboot.S optional smp -amd64/amd64/mptable.c optional mptable -amd64/amd64/mptable_pci.c optional mptable pci -amd64/amd64/nexus.c standard amd64/amd64/pmap.c standard amd64/amd64/prof_machdep.c optional profiling-routine amd64/amd64/sigtramp.S standard @@ -321,7 +317,11 @@ x86/isa/isa_dma.c standard x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/qpi.c standard +x86/x86/dump_machdep.c standard x86/x86/io_apic.c standard x86/x86/local_apic.c standard x86/x86/mca.c standard +x86/x86/mptable.c optional mptable +x86/x86/mptable_pci.c optional mptable pci x86/x86/msi.c optional pci +x86/x86/nexus.c standard Modified: user/nwhitehorn/ps3/conf/files.i386 ============================================================================== --- user/nwhitehorn/ps3/conf/files.i386 Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/files.i386 Wed Nov 3 15:22:09 2010 (r214740) @@ -263,7 +263,6 @@ i386/i386/busdma_machdep.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb -i386/i386/dump_machdep.c standard i386/i386/elan-mmcr.c optional cpu_elan | cpu_soekris i386/i386/elf_machdep.c standard i386/i386/exception.s optional native @@ -290,10 +289,7 @@ i386/i386/mp_machdep.c optional native i386/xen/mp_machdep.c optional xen smp i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp native -i386/i386/mptable.c optional apic native i386/xen/mptable.c optional apic xen -i386/i386/mptable_pci.c optional apic pci -i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c optional native i386/xen/pmap.c optional xen @@ -395,7 +391,11 @@ x86/isa/isa_dma.c optional isa x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/qpi.c standard +x86/x86/dump_machdep.c standard x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mca.c standard +x86/x86/mptable.c optional apic native +x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci +x86/x86/nexus.c standard Modified: user/nwhitehorn/ps3/conf/files.pc98 ============================================================================== --- user/nwhitehorn/ps3/conf/files.pc98 Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/files.pc98 Wed Nov 3 15:22:09 2010 (r214740) @@ -138,7 +138,6 @@ i386/i386/busdma_machdep.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb -i386/i386/dump_machdep.c standard i386/i386/elf_machdep.c standard i386/i386/exception.s standard i386/i386/gdb_machdep.c optional gdb @@ -157,9 +156,6 @@ i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp -i386/i386/mptable.c optional apic -i386/i386/mptable_pci.c optional apic pci -i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/ptrace_machdep.c standard @@ -255,7 +251,11 @@ pc98/pc98/pc98_machdep.c standard x86/isa/atpic.c optional atpic x86/isa/clock.c standard x86/isa/isa.c optional isa +x86/x86/dump_machdep.c standard x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mca.c standard +x86/x86/mptable.c optional apic +x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci +x86/x86/nexus.c standard Modified: user/nwhitehorn/ps3/conf/files.powerpc ============================================================================== --- user/nwhitehorn/ps3/conf/files.powerpc Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/files.powerpc Wed Nov 3 15:22:09 2010 (r214740) @@ -22,6 +22,7 @@ dev/adb/adb_kbd.c optional adb dev/adb/adb_mouse.c optional adb dev/adb/adb_hb_if.m optional adb dev/adb/adb_if.m optional adb +dev/agp/agp_apple.c optional agp powermac dev/cfi/cfi_bus_fdt.c optional cfi fdt dev/fb/fb.c optional sc dev/fdt/fdt_powerpc.c optional fdt Modified: user/nwhitehorn/ps3/conf/kern.post.mk ============================================================================== --- user/nwhitehorn/ps3/conf/kern.post.mk Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/kern.post.mk Wed Nov 3 15:22:09 2010 (r214740) @@ -169,6 +169,9 @@ _ILINKS= machine .if ${MACHINE} != ${MACHINE_CPUARCH} _ILINKS+= ${MACHINE_CPUARCH} .endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_ILINKS+= x86 +.endif # Ensure that the link exists without depending on it when it exists. .for _link in ${_ILINKS} @@ -181,8 +184,8 @@ ${_ILINKS}: @case ${.TARGET} in \ machine) \ path=${S}/${MACHINE}/include ;; \ - ${MACHINE_CPUARCH}) \ - path=${S}/${MACHINE_CPUARCH}/include ;; \ + *) \ + path=${S}/${.TARGET}/include ;; \ esac ; \ ${ECHO} ${.TARGET} "->" $$path ; \ ln -s $$path ${.TARGET} Modified: user/nwhitehorn/ps3/conf/kmod.mk ============================================================================== --- user/nwhitehorn/ps3/conf/kmod.mk Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/kmod.mk Wed Nov 3 15:22:09 2010 (r214740) @@ -238,6 +238,9 @@ _ILINKS=@ machine .if ${MACHINE} != ${MACHINE_CPUARCH} _ILINKS+=${MACHINE_CPUARCH} .endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_ILINKS+=x86 +.endif all: objwarn ${PROG} @@ -263,12 +266,12 @@ SYSDIR= ${_dir} ${_ILINKS}: @case ${.TARGET} in \ - ${MACHINE_CPUARCH}) \ - path=${SYSDIR}/${MACHINE_CPUARCH}/include ;; \ machine) \ path=${SYSDIR}/${MACHINE}/include ;; \ @) \ path=${SYSDIR} ;; \ + *) \ + path=${SYSDIR}/${.TARGET}/include ;; \ esac ; \ path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET} "->" $$path ; \ Modified: user/nwhitehorn/ps3/conf/options.amd64 ============================================================================== --- user/nwhitehorn/ps3/conf/options.amd64 Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/options.amd64 Wed Nov 3 15:22:09 2010 (r214740) @@ -8,6 +8,7 @@ COUNT_IPIS opt_smp.h MAXMEM PERFMON PMAP_SHPGPERPROC opt_pmap.h +MPTABLE_FORCE_HTT MP_WATCHDOG # Options for emulators. These should only be used at config time, so Modified: user/nwhitehorn/ps3/conf/options.powerpc ============================================================================== --- user/nwhitehorn/ps3/conf/options.powerpc Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/conf/options.powerpc Wed Nov 3 15:22:09 2010 (r214740) @@ -25,3 +25,7 @@ PSIM SC_OFWFB opt_ofwfb.h OFWCONS_POLL_HZ opt_ofw.h + +# AGP debugging support +AGP_DEBUG opt_agp.h + Modified: user/nwhitehorn/ps3/dev/acpica/acpi.c ============================================================================== --- user/nwhitehorn/ps3/dev/acpica/acpi.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/dev/acpica/acpi.c Wed Nov 3 15:22:09 2010 (r214740) @@ -86,6 +86,11 @@ static struct cdevsw acpi_cdevsw = { .d_name = "acpi", }; +struct acpi_interface { + ACPI_STRING *data; + int num; +}; + /* Global mutex for locking access to the ACPI subsystem. */ struct mtx acpi_mutex; @@ -163,6 +168,7 @@ static void acpi_enable_pcie(void); #endif static void acpi_hint_device_unit(device_t acdev, device_t child, const char *name, int *unitp); +static void acpi_reset_interfaces(device_t dev); static device_method_t acpi_methods[] = { /* Device interface */ @@ -232,6 +238,16 @@ SYSCTL_STRING(_debug_acpi, OID_AUTO, acp acpi_ca_version, 0, "Version of Intel ACPI-CA"); /* + * Allow overriding _OSI methods. + */ +static char acpi_install_interface[256]; +TUNABLE_STR("hw.acpi.install_interface", acpi_install_interface, + sizeof(acpi_install_interface)); +static char acpi_remove_interface[256]; +TUNABLE_STR("hw.acpi.remove_interface", acpi_remove_interface, + sizeof(acpi_remove_interface)); + +/* * Allow override of whether methods execute in parallel or not. * Enable this for serial behavior, which fixes "AE_ALREADY_EXISTS" * errors for AML that really can't handle parallel method execution. @@ -467,6 +483,9 @@ acpi_attach(device_t dev) goto out; } + /* Override OS interfaces if the user requested. */ + acpi_reset_interfaces(dev); + /* Load ACPI name space. */ status = AcpiLoadTables(); if (ACPI_FAILURE(status)) { @@ -3473,6 +3492,93 @@ acpi_debug_objects_sysctl(SYSCTL_HANDLER } static int +acpi_parse_interfaces(char *str, struct acpi_interface *iface) +{ + char *p; + size_t len; + int i, j; + + p = str; + while (isspace(*p) || *p == ',') + p++; + len = strlen(p); + if (len == 0) + return (0); + p = strdup(p, M_TEMP); + for (i = 0; i < len; i++) + if (p[i] == ',') + p[i] = '\0'; + i = j = 0; + while (i < len) + if (isspace(p[i]) || p[i] == '\0') + i++; + else { + i += strlen(p + i) + 1; + j++; + } + if (j == 0) { + free(p, M_TEMP); + return (0); + } + iface->data = malloc(sizeof(*iface->data) * j, M_TEMP, M_WAITOK); + iface->num = j; + i = j = 0; + while (i < len) + if (isspace(p[i]) || p[i] == '\0') + i++; + else { + iface->data[j] = p + i; + i += strlen(p + i) + 1; + j++; + } + + return (j); +} + +static void +acpi_free_interfaces(struct acpi_interface *iface) +{ + + free(iface->data[0], M_TEMP); + free(iface->data, M_TEMP); +} + +static void +acpi_reset_interfaces(device_t dev) +{ + struct acpi_interface list; + ACPI_STATUS status; + int i; + + if (acpi_parse_interfaces(acpi_install_interface, &list) > 0) { + for (i = 0; i < list.num; i++) { + status = AcpiInstallInterface(list.data[i]); + if (ACPI_FAILURE(status)) + device_printf(dev, + "failed to install _OSI(\"%s\"): %s\n", + list.data[i], AcpiFormatException(status)); + else if (bootverbose) + device_printf(dev, "installed _OSI(\"%s\")\n", + list.data[i]); + } + acpi_free_interfaces(&list); + } + if (acpi_parse_interfaces(acpi_remove_interface, &list) > 0) { + for (i = 0; i < list.num; i++) { + status = AcpiRemoveInterface(list.data[i]); + if (ACPI_FAILURE(status)) + device_printf(dev, + "failed to remove _OSI(\"%s\"): %s\n", + list.data[i], AcpiFormatException(status)); + else if (bootverbose) + device_printf(dev, "removed _OSI(\"%s\")\n", + list.data[i]); + } + acpi_free_interfaces(&list); + } +} + +static int acpi_pm_func(u_long cmd, void *arg, ...) { int state, acpi_state; Modified: user/nwhitehorn/ps3/dev/agp/agp.c ============================================================================== --- user/nwhitehorn/ps3/dev/agp/agp.c Wed Nov 3 15:15:48 2010 (r214739) +++ user/nwhitehorn/ps3/dev/agp/agp.c Wed Nov 3 15:22:09 2010 (r214740) @@ -219,13 +219,16 @@ agp_generic_attach(device_t dev) * Find and map the aperture, RF_SHAREABLE for DRM but not RF_ACTIVE * because the kernel doesn't need to map it. */ - if (sc->as_aperture_rid == 0) - sc->as_aperture_rid = AGP_APBASE; - sc->as_aperture = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->as_aperture_rid, RF_SHAREABLE); - if (!sc->as_aperture) - return ENOMEM; + if (sc->as_aperture_rid != -1) { + if (sc->as_aperture_rid == 0) + sc->as_aperture_rid = AGP_APBASE; + + sc->as_aperture = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->as_aperture_rid, RF_SHAREABLE); + if (!sc->as_aperture) + return ENOMEM; + } /* * Work out an upper bound for agp memory allocation. This @@ -272,8 +275,9 @@ agp_free_res(device_t dev) { struct agp_softc *sc = device_get_softc(dev); - bus_release_resource(dev, SYS_RES_MEMORY, sc->as_aperture_rid, - sc->as_aperture); + if (sc->as_aperture != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->as_aperture_rid, + sc->as_aperture); mtx_destroy(&sc->as_lock); agp_flush_cache(); } @@ -729,7 +733,10 @@ agp_info_user(device_t dev, agp_info *in info->bridge_id = pci_get_devid(dev); info->agp_mode = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4); - info->aper_base = rman_get_start(sc->as_aperture); + if (sc->as_aperture) + info->aper_base = rman_get_start(sc->as_aperture); + else + info->aper_base = 0; info->aper_size = AGP_GET_APERTURE(dev) >> 20; info->pg_total = info->pg_system = sc->as_maxmem >> AGP_PAGE_SHIFT; info->pg_used = sc->as_allocated >> AGP_PAGE_SHIFT; @@ -876,6 +883,8 @@ agp_mmap(struct cdev *kdev, vm_ooffset_t if (offset > AGP_GET_APERTURE(dev)) return -1; + if (sc->as_aperture == NULL) + return -1; *paddr = rman_get_start(sc->as_aperture) + offset; return 0; } @@ -917,8 +926,11 @@ agp_get_info(device_t dev, struct agp_in info->ai_mode = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4); - info->ai_aperture_base = rman_get_start(sc->as_aperture); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***