From owner-svn-src-projects@FreeBSD.ORG Mon Sep 27 21:28:40 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28B08106564A; Mon, 27 Sep 2010 21:28:40 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 144148FC16; Mon, 27 Sep 2010 21:28:40 +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 o8RLSeEk050379; Mon, 27 Sep 2010 21:28:40 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RLSdWX050334; Mon, 27 Sep 2010 21:28:39 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201009272128.o8RLSdWX050334@svn.freebsd.org> From: Attilio Rao Date: Mon, 27 Sep 2010 21:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213232 - in projects/sv: contrib/top etc/rc.d share/mk sys/arm/at91 sys/conf sys/dev/dc sys/dev/mii sys/fs/devfs sys/i386/i386 sys/mips/cavium sys/netinet sys/netinet6 tools/regression... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 21:28:40 -0000 Author: attilio Date: Mon Sep 27 21:28:39 2010 New Revision: 213232 URL: http://svn.freebsd.org/changeset/base/213232 Log: MFC @ 213231 Added: projects/sv/sys/fs/devfs/devfs_dir.c - copied unchanged from r213231, head/sys/fs/devfs/devfs_dir.c projects/sv/usr.bin/clang/clang/clang.1 - copied unchanged from r213231, head/usr.bin/clang/clang/clang.1 projects/sv/usr.bin/clang/tblgen/tblgen.1 - copied unchanged from r213231, head/usr.bin/clang/tblgen/tblgen.1 Modified: projects/sv/etc/rc.d/nsswitch projects/sv/sys/arm/at91/at91_twi.c projects/sv/sys/conf/files projects/sv/sys/conf/ldscript.mips.octeon1.64 projects/sv/sys/dev/dc/dcphy.c projects/sv/sys/dev/dc/pnphy.c projects/sv/sys/dev/mii/acphy.c projects/sv/sys/dev/mii/amphy.c projects/sv/sys/dev/mii/atphy.c projects/sv/sys/dev/mii/axphy.c projects/sv/sys/dev/mii/bmtphy.c projects/sv/sys/dev/mii/brgphy.c projects/sv/sys/dev/mii/ciphy.c projects/sv/sys/dev/mii/e1000phy.c projects/sv/sys/dev/mii/exphy.c projects/sv/sys/dev/mii/gentbi.c projects/sv/sys/dev/mii/icsphy.c projects/sv/sys/dev/mii/inphy.c projects/sv/sys/dev/mii/ip1000phy.c projects/sv/sys/dev/mii/jmphy.c projects/sv/sys/dev/mii/lxtphy.c projects/sv/sys/dev/mii/mii_physubr.c projects/sv/sys/dev/mii/mlphy.c projects/sv/sys/dev/mii/nsgphy.c projects/sv/sys/dev/mii/nsphy.c projects/sv/sys/dev/mii/nsphyter.c projects/sv/sys/dev/mii/pnaphy.c projects/sv/sys/dev/mii/qsphy.c projects/sv/sys/dev/mii/rgephy.c projects/sv/sys/dev/mii/rlphy.c projects/sv/sys/dev/mii/rlswitch.c projects/sv/sys/dev/mii/ruephy.c projects/sv/sys/dev/mii/smcphy.c projects/sv/sys/dev/mii/tdkphy.c projects/sv/sys/dev/mii/truephy.c projects/sv/sys/dev/mii/ukphy.c projects/sv/sys/dev/mii/xmphy.c projects/sv/sys/fs/devfs/devfs.h projects/sv/sys/fs/devfs/devfs_devs.c projects/sv/sys/fs/devfs/devfs_int.h projects/sv/sys/fs/devfs/devfs_vnops.c projects/sv/sys/i386/i386/machdep.c projects/sv/sys/mips/cavium/octopci.c projects/sv/sys/netinet/in_rmx.c projects/sv/sys/netinet/netdump_client.c projects/sv/sys/netinet6/in6_rmx.c projects/sv/tools/regression/geom_eli/resize.t projects/sv/usr.bin/clang/clang/Makefile projects/sv/usr.bin/clang/tblgen/Makefile Directory Properties: projects/sv/ (props changed) projects/sv/cddl/contrib/opensolaris/ (props changed) projects/sv/contrib/bind9/ (props changed) projects/sv/contrib/ee/ (props changed) projects/sv/contrib/expat/ (props changed) projects/sv/contrib/file/ (props changed) projects/sv/contrib/gdb/ (props changed) projects/sv/contrib/gdtoa/ (props changed) projects/sv/contrib/gnu-sort/ (props changed) projects/sv/contrib/groff/ (props changed) projects/sv/contrib/less/ (props changed) projects/sv/contrib/libpcap/ (props changed) projects/sv/contrib/llvm/ (props changed) projects/sv/contrib/llvm/tools/clang/ (props changed) projects/sv/contrib/ncurses/ (props changed) projects/sv/contrib/netcat/ (props changed) projects/sv/contrib/ntp/ (props changed) projects/sv/contrib/one-true-awk/ (props changed) projects/sv/contrib/openbsm/ (props changed) projects/sv/contrib/openpam/ (props changed) projects/sv/contrib/pf/ (props changed) projects/sv/contrib/sendmail/ (props changed) projects/sv/contrib/tcpdump/ (props changed) projects/sv/contrib/tcsh/ (props changed) projects/sv/contrib/top/ (props changed) projects/sv/contrib/top/install-sh (props changed) projects/sv/contrib/tzcode/stdtime/ (props changed) projects/sv/contrib/tzcode/zic/ (props changed) projects/sv/contrib/tzdata/ (props changed) projects/sv/contrib/wpa/ (props changed) projects/sv/crypto/openssh/ (props changed) projects/sv/crypto/openssl/ (props changed) projects/sv/lib/libc/ (props changed) projects/sv/lib/libc/stdtime/ (props changed) projects/sv/lib/libutil/ (props changed) projects/sv/lib/libz/ (props changed) projects/sv/sbin/ (props changed) projects/sv/sbin/ipfw/ (props changed) projects/sv/share/mk/bsd.arch.inc.mk (props changed) projects/sv/share/zoneinfo/ (props changed) projects/sv/sys/ (props changed) projects/sv/sys/amd64/include/xen/ (props changed) projects/sv/sys/cddl/contrib/opensolaris/ (props changed) projects/sv/sys/contrib/dev/acpica/ (props changed) projects/sv/sys/contrib/pf/ (props changed) projects/sv/sys/contrib/x86emu/ (props changed) projects/sv/sys/dev/xen/xenpci/ (props changed) projects/sv/usr.bin/calendar/ (props changed) projects/sv/usr.bin/csup/ (props changed) projects/sv/usr.bin/procstat/ (props changed) projects/sv/usr.sbin/zic/ (props changed) Modified: projects/sv/etc/rc.d/nsswitch ============================================================================== --- projects/sv/etc/rc.d/nsswitch Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/etc/rc.d/nsswitch Mon Sep 27 21:28:39 2010 (r213232) @@ -80,7 +80,7 @@ generate_host_conf() cache | *=*) ;; *) - printf "Warning: unrecognized source [%s]\n" $_s >&2 + echo "Warning: unrecognized source [$_s]" >&2 ;; esac done Modified: projects/sv/sys/arm/at91/at91_twi.c ============================================================================== --- projects/sv/sys/arm/at91/at91_twi.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/arm/at91/at91_twi.c Mon Sep 27 21:28:39 2010 (r213232) @@ -338,7 +338,7 @@ at91_twi_transfer(device_t dev, struct i err = EINVAL; goto out; } - if (len == 1) + if (len == 1 && msgs[i].flags & IIC_M_RD) WR4(sc, TWI_CR, TWI_CR_START | TWI_CR_STOP); else WR4(sc, TWI_CR, TWI_CR_START); @@ -348,7 +348,7 @@ at91_twi_transfer(device_t dev, struct i if ((sr = RD4(sc, TWI_SR)) & TWI_SR_RXRDY) { len--; *buf++ = RD4(sc, TWI_RHR) & 0xff; - if (len == 0 && msgs[i].len != 1) + if (len == 1) WR4(sc, TWI_CR, TWI_CR_STOP); } } @@ -358,8 +358,6 @@ at91_twi_transfer(device_t dev, struct i } } else { while (len--) { - if (len == 0 && msgs[i].len != 1) - WR4(sc, TWI_CR, TWI_CR_STOP); if ((err = at91_twi_wait(sc, TWI_SR_TXRDY))) goto out; WR4(sc, TWI_THR, *buf++); Modified: projects/sv/sys/conf/files ============================================================================== --- projects/sv/sys/conf/files Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/conf/files Mon Sep 27 21:28:39 2010 (r213232) @@ -1890,6 +1890,7 @@ fs/coda/coda_vfsops.c optional vcoda fs/coda/coda_vnops.c optional vcoda fs/deadfs/dead_vnops.c standard fs/devfs/devfs_devs.c standard +fs/devfs/devfs_dir.c standard fs/devfs/devfs_rule.c standard fs/devfs/devfs_vfsops.c standard fs/devfs/devfs_vnops.c standard Modified: projects/sv/sys/conf/ldscript.mips.octeon1.64 ============================================================================== --- projects/sv/sys/conf/ldscript.mips.octeon1.64 Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/conf/ldscript.mips.octeon1.64 Mon Sep 27 21:28:39 2010 (r213232) @@ -7,24 +7,29 @@ ENTRY(_start) __DYNAMIC = 0; PROVIDE (_DYNAMIC = 0); +PHDRS { + text PT_LOAD FLAGS(0x7); +} + SECTIONS { . = KERNLOADADDR + SIZEOF_HEADERS; - .text . : { + .text : { *(.text) *(.dynamic) etext = .; _etext = .; . = ALIGN(0x2000); - } + } : text - .rodata ALIGN(0x2000) : { + . = ALIGN(0x2000); + .rodata : { _fdata = .; *(.rodata) . = ALIGN(32); } - .data . : { + .data : { _rwdata = .; *(.data) . = ALIGN(32); @@ -33,15 +38,15 @@ SECTIONS { _gp = (. + 0x8000); - .sdata . : { + .sdata : { _small_start = .; *(.sdata) . = ALIGN(32); edata = .; _edata = .; - } + } : text - .sbss . : { + .sbss : { __bss_start = .; _fbss = .; *(.sbss) *(.scommon) @@ -49,7 +54,7 @@ SECTIONS { . = ALIGN(32); } - .bss . : { + .bss : { *(.bss) *(COMMON) . = ALIGN(32); Modified: projects/sv/sys/dev/dc/dcphy.c ============================================================================== --- projects/sv/sys/dev/dc/dcphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/dc/dcphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -146,7 +146,7 @@ dcphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/dc/pnphy.c ============================================================================== --- projects/sv/sys/dev/dc/pnphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/dc/pnphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -129,7 +129,7 @@ pnphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/acphy.c ============================================================================== --- projects/sv/sys/dev/mii/acphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/acphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -129,7 +129,7 @@ acphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/amphy.c ============================================================================== --- projects/sv/sys/dev/mii/amphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/amphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -106,7 +106,7 @@ amphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/atphy.c ============================================================================== --- projects/sv/sys/dev/mii/atphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/atphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -110,7 +110,7 @@ atphy_attach(device_t dev) sc = &asc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/axphy.c ============================================================================== --- projects/sv/sys/dev/mii/axphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/axphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -96,7 +96,7 @@ axphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/bmtphy.c ============================================================================== --- projects/sv/sys/dev/mii/bmtphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/bmtphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -144,7 +144,7 @@ bmtphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/brgphy.c ============================================================================== --- projects/sv/sys/dev/mii/brgphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/brgphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -187,7 +187,7 @@ brgphy_attach(device_t dev) sc = &bsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); /* Initialize mii_softc structure */ Modified: projects/sv/sys/dev/mii/ciphy.c ============================================================================== --- projects/sv/sys/dev/mii/ciphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/ciphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -115,7 +115,7 @@ ciphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/e1000phy.c ============================================================================== --- projects/sv/sys/dev/mii/e1000phy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/e1000phy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -141,7 +141,7 @@ e1000phy_attach(device_t dev) sc = &esc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/exphy.c ============================================================================== --- projects/sv/sys/dev/mii/exphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/exphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -135,7 +135,7 @@ exphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * The 3Com PHY can never be isolated, so never allow non-zero Modified: projects/sv/sys/dev/mii/gentbi.c ============================================================================== --- projects/sv/sys/dev/mii/gentbi.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/gentbi.c Mon Sep 27 21:28:39 2010 (r213232) @@ -158,7 +158,7 @@ gentbi_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); if (bootverbose) Modified: projects/sv/sys/dev/mii/icsphy.c ============================================================================== --- projects/sv/sys/dev/mii/icsphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/icsphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -138,7 +138,7 @@ icsphy_attach(device_t dev) sc = &isc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/inphy.c ============================================================================== --- projects/sv/sys/dev/mii/inphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/inphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -104,7 +104,7 @@ inphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/ip1000phy.c ============================================================================== --- projects/sv/sys/dev/mii/ip1000phy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/ip1000phy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -111,7 +111,7 @@ ip1000phy_attach(device_t dev) sc = &isc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/jmphy.c ============================================================================== --- projects/sv/sys/dev/mii/jmphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/jmphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -109,7 +109,7 @@ jmphy_attach(device_t dev) sc = &jsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/lxtphy.c ============================================================================== --- projects/sv/sys/dev/mii/lxtphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/lxtphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -132,7 +132,7 @@ lxtphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/mii_physubr.c ============================================================================== --- projects/sv/sys/dev/mii/mii_physubr.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/mii_physubr.c Mon Sep 27 21:28:39 2010 (r213232) @@ -326,10 +326,9 @@ mii_anar(int media) void mii_add_media(struct mii_softc *sc) { + struct mii_data *mii = sc->mii_pdata; const char *sep = ""; - struct mii_data *mii; - mii = device_get_softc(sc->mii_dev); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) { printf("no media present"); return; Modified: projects/sv/sys/dev/mii/mlphy.c ============================================================================== --- projects/sv/sys/dev/mii/mlphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/mlphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -143,7 +143,7 @@ mlphy_attach(dev) sc = &msc->ml_mii; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/nsgphy.c ============================================================================== --- projects/sv/sys/dev/mii/nsgphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/nsgphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -126,7 +126,7 @@ nsgphy_attach(device_t dev) device_printf(dev, "\n", MII_REV(ma->mii_id2)); device_printf(dev, " "); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/nsphy.c ============================================================================== --- projects/sv/sys/dev/mii/nsphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/nsphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -130,7 +130,7 @@ nsphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/nsphyter.c ============================================================================== --- projects/sv/sys/dev/mii/nsphyter.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/nsphyter.c Mon Sep 27 21:28:39 2010 (r213232) @@ -135,7 +135,7 @@ nsphyter_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/pnaphy.c ============================================================================== --- projects/sv/sys/dev/mii/pnaphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/pnaphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -107,7 +107,7 @@ pnaphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/qsphy.c ============================================================================== --- projects/sv/sys/dev/mii/qsphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/qsphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -130,7 +130,7 @@ qsphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/rgephy.c ============================================================================== --- projects/sv/sys/dev/mii/rgephy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/rgephy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -119,7 +119,7 @@ rgephy_attach(device_t dev) sc = &rsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/rlphy.c ============================================================================== --- projects/sv/sys/dev/mii/rlphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/rlphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -129,7 +129,7 @@ rlphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * Check whether we're the RTL8201L PHY and remember so the status Modified: projects/sv/sys/dev/mii/rlswitch.c ============================================================================== --- projects/sv/sys/dev/mii/rlswitch.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/rlswitch.c Mon Sep 27 21:28:39 2010 (r213232) @@ -117,7 +117,7 @@ rlswitch_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * We handle all pseudo PHY in a single instance, so never allow Modified: projects/sv/sys/dev/mii/ruephy.c ============================================================================== --- projects/sv/sys/dev/mii/ruephy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/ruephy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -108,7 +108,7 @@ ruephy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * The RealTek PHY can never be isolated, so never allow non-zero Modified: projects/sv/sys/dev/mii/smcphy.c ============================================================================== --- projects/sv/sys/dev/mii/smcphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/smcphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -102,7 +102,7 @@ smcphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/tdkphy.c ============================================================================== --- projects/sv/sys/dev/mii/tdkphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/tdkphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -108,7 +108,7 @@ tdkphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); if (bootverbose) Modified: projects/sv/sys/dev/mii/truephy.c ============================================================================== --- projects/sv/sys/dev/mii/truephy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/truephy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -150,7 +150,7 @@ truephy_attach(device_t dev) if (sc->mii_anegticks == 0) sc->mii_anegticks = MII_ANEGTICKS; sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/dev/mii/ukphy.c ============================================================================== --- projects/sv/sys/dev/mii/ukphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/ukphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -122,7 +122,7 @@ ukphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); if (bootverbose) Modified: projects/sv/sys/dev/mii/xmphy.c ============================================================================== --- projects/sv/sys/dev/mii/xmphy.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/dev/mii/xmphy.c Mon Sep 27 21:28:39 2010 (r213232) @@ -107,7 +107,7 @@ xmphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: projects/sv/sys/fs/devfs/devfs.h ============================================================================== --- projects/sv/sys/fs/devfs/devfs.h Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/fs/devfs/devfs.h Mon Sep 27 21:28:39 2010 (r213232) @@ -124,6 +124,8 @@ MALLOC_DECLARE(M_DEVFS); struct componentname; +TAILQ_HEAD(devfs_dlist_head, devfs_dirent); + struct devfs_dirent { struct cdev_priv *de_cdp; int de_inode; @@ -133,10 +135,11 @@ struct devfs_dirent { #define DE_DOTDOT 0x04 #define DE_DOOMED 0x08 #define DE_COVERED 0x10 +#define DE_USER 0x20 int de_holdcnt; struct dirent *de_dirent; TAILQ_ENTRY(devfs_dirent) de_list; - TAILQ_HEAD(, devfs_dirent) de_dlist; + struct devfs_dlist_head de_dlist; struct devfs_dirent *de_dir; int de_links; mode_t de_mode; Modified: projects/sv/sys/fs/devfs/devfs_devs.c ============================================================================== --- projects/sv/sys/fs/devfs/devfs_devs.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/fs/devfs/devfs_devs.c Mon Sep 27 21:28:39 2010 (r213232) @@ -142,6 +142,27 @@ devfs_alloc(int flags) return (cdev); } +int +devfs_dev_exists(const char *name) +{ + struct cdev_priv *cdp; + + mtx_assert(&devmtx, MA_OWNED); + + TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) { + if ((cdp->cdp_flags & CDP_ACTIVE) == 0) + continue; + if (devfs_pathpath(cdp->cdp_c.si_name, name) != 0) + return (1); + if (devfs_pathpath(name, cdp->cdp_c.si_name) != 0) + return (1); + } + if (devfs_dir_find(name) != 0) + return (1); + + return (0); +} + void devfs_free(struct cdev *cdev) { @@ -338,6 +359,10 @@ devfs_delete(struct devfs_mount *dm, str dd = devfs_parent_dirent(de); if (dd != NULL) DEVFS_DE_HOLD(dd); + if (de->de_flags & DE_USER) { + KASSERT(dd != NULL, ("devfs_delete: NULL dd")); + devfs_dir_unref_de(dm, dd); + } } else dd = NULL; @@ -396,10 +421,17 @@ devfs_purge(struct devfs_mount *dm, stru DEVFS_DE_HOLD(dd); for (;;) { - de = TAILQ_FIRST(&dd->de_dlist); + /* + * Use TAILQ_LAST() to remove "." and ".." last. + * We might need ".." to resolve a path in + * devfs_dir_unref_de(). + */ + de = TAILQ_LAST(&dd->de_dlist, devfs_dlist_head); if (de == NULL) break; TAILQ_REMOVE(&dd->de_dlist, de, de_list); + if (de->de_flags & DE_USER) + devfs_dir_unref_de(dm, dd); if (de->de_flags & (DE_DOT | DE_DOTDOT)) devfs_delete(dm, de, DEVFS_DEL_NORECURSE); else if (de->de_dirent->d_type == DT_DIR) Copied: projects/sv/sys/fs/devfs/devfs_dir.c (from r213231, head/sys/fs/devfs/devfs_dir.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/sv/sys/fs/devfs/devfs_dir.c Mon Sep 27 21:28:39 2010 (r213232, copy of r213231, head/sys/fs/devfs/devfs_dir.c) @@ -0,0 +1,175 @@ +/*- + * Copyright (c) 2010 Jaakko Heinonen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +struct dirlistent { + char *dir; + int refcnt; + LIST_ENTRY(dirlistent) link; +}; + +static LIST_HEAD(, dirlistent) devfs_dirlist = + LIST_HEAD_INITIALIZER(devfs_dirlist); + +static MALLOC_DEFINE(M_DEVFS4, "DEVFS4", "DEVFS directory list"); + +static struct mtx dirlist_mtx; +MTX_SYSINIT(dirlist_mtx, &dirlist_mtx, "devfs dirlist lock", MTX_DEF); + +/* Returns 1 if the path is in the directory list. */ +int +devfs_dir_find(const char *path) +{ + struct dirlistent *dle; + + mtx_lock(&dirlist_mtx); + LIST_FOREACH(dle, &devfs_dirlist, link) { + if (devfs_pathpath(dle->dir, path) != 0) { + mtx_unlock(&dirlist_mtx); + return (1); + } + } + mtx_unlock(&dirlist_mtx); + + return (0); +} + +static struct dirlistent * +devfs_dir_findent_locked(const char *dir) +{ + struct dirlistent *dle; + + mtx_assert(&dirlist_mtx, MA_OWNED); + + LIST_FOREACH(dle, &devfs_dirlist, link) { + if (strcmp(dir, dle->dir) == 0) + return (dle); + } + + return (NULL); +} + +static void +devfs_dir_ref(const char *dir) +{ + struct dirlistent *dle, *dle_new; + + if (*dir == '\0') + return; + + dle_new = malloc(sizeof(*dle), M_DEVFS4, M_WAITOK); + dle_new->dir = strdup(dir, M_DEVFS4); + dle_new->refcnt = 1; + + mtx_lock(&dirlist_mtx); + dle = devfs_dir_findent_locked(dir); + if (dle != NULL) { + dle->refcnt++; + mtx_unlock(&dirlist_mtx); + free(dle_new->dir, M_DEVFS4); + free(dle_new, M_DEVFS4); + return; + } + LIST_INSERT_HEAD(&devfs_dirlist, dle_new, link); + mtx_unlock(&dirlist_mtx); +} + +void +devfs_dir_ref_de(struct devfs_mount *dm, struct devfs_dirent *de) +{ + char dirname[SPECNAMELEN + 1], *namep; + + namep = devfs_fqpn(dirname, dm, de, NULL); + KASSERT(namep != NULL, ("devfs_ref_dir_de: NULL namep")); + + devfs_dir_ref(namep); +} + +static void +devfs_dir_unref(const char *dir) +{ + struct dirlistent *dle; + + if (*dir == '\0') + return; + + mtx_lock(&dirlist_mtx); + dle = devfs_dir_findent_locked(dir); + KASSERT(dle != NULL, ("devfs_dir_unref: dir %s not referenced", dir)); + dle->refcnt--; + KASSERT(dle->refcnt >= 0, ("devfs_dir_unref: negative refcnt")); + if (dle->refcnt == 0) { + LIST_REMOVE(dle, link); + mtx_unlock(&dirlist_mtx); + free(dle->dir, M_DEVFS4); + free(dle, M_DEVFS4); + } else + mtx_unlock(&dirlist_mtx); +} + +void +devfs_dir_unref_de(struct devfs_mount *dm, struct devfs_dirent *de) +{ + char dirname[SPECNAMELEN + 1], *namep; + + namep = devfs_fqpn(dirname, dm, de, NULL); + KASSERT(namep != NULL, ("devfs_unref_dir_de: NULL namep")); + + devfs_dir_unref(namep); +} + +/* Returns 1 if the path p1 contains the path p2. */ +int +devfs_pathpath(const char *p1, const char *p2) +{ + + for (;;p1++, p2++) { + if (*p1 != *p2) { + if (*p1 == '/' && *p2 == '\0') + return (1); + else + return (0); + } else if (*p1 == '\0') + return (1); + } + /* NOTREACHED */ +} Modified: projects/sv/sys/fs/devfs/devfs_int.h ============================================================================== --- projects/sv/sys/fs/devfs/devfs_int.h Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/fs/devfs/devfs_int.h Mon Sep 27 21:28:39 2010 (r213232) @@ -38,6 +38,7 @@ #ifdef _KERNEL struct devfs_dirent; +struct devfs_mount; struct cdev_privdata { struct file *cdpd_fp; @@ -71,11 +72,17 @@ struct cdev_priv { #define cdev2priv(c) member2struct(cdev_priv, cdp_c, c) struct cdev *devfs_alloc(int); +int devfs_dev_exists(const char *); void devfs_free(struct cdev *); void devfs_create(struct cdev *dev); void devfs_destroy(struct cdev *dev); void devfs_destroy_cdevpriv(struct cdev_privdata *p); +int devfs_dir_find(const char *); +void devfs_dir_ref_de(struct devfs_mount *, struct devfs_dirent *); +void devfs_dir_unref_de(struct devfs_mount *, struct devfs_dirent *); +int devfs_pathpath(const char *, const char *); + extern struct unrhdr *devfs_inos; extern struct mtx devmtx; extern struct mtx devfs_de_interlock; Modified: projects/sv/sys/fs/devfs/devfs_vnops.c ============================================================================== --- projects/sv/sys/fs/devfs/devfs_vnops.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/fs/devfs/devfs_vnops.c Mon Sep 27 21:28:39 2010 (r213232) @@ -1564,6 +1564,7 @@ devfs_symlink(struct vop_symlink_args *a dd = ap->a_dvp->v_data; de = devfs_newdirent(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen); + de->de_flags = DE_USER; de->de_uid = 0; de->de_gid = 0; de->de_mode = 0755; @@ -1587,6 +1588,7 @@ devfs_symlink(struct vop_symlink_args *a de_dotdot = TAILQ_FIRST(&dd->de_dlist); /* "." */ de_dotdot = TAILQ_NEXT(de_dotdot, de_list); /* ".." */ TAILQ_INSERT_AFTER(&dd->de_dlist, de_dotdot, de, de_list); + devfs_dir_ref_de(dmp, dd); return (devfs_allocv(de, ap->a_dvp->v_mount, LK_EXCLUSIVE, ap->a_vpp)); } Modified: projects/sv/sys/i386/i386/machdep.c ============================================================================== --- projects/sv/sys/i386/i386/machdep.c Mon Sep 27 21:10:37 2010 (r213231) +++ projects/sv/sys/i386/i386/machdep.c Mon Sep 27 21:28:39 2010 (r213232) @@ -1950,6 +1950,7 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } +#ifndef XEN static int add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp) { @@ -2029,78 +2030,13 @@ add_smap_entry(struct bios_smap *smap, v return (1); } -/* - * Populate the (physmap) array with base/bound pairs describing the - * available physical memory in the system, then test this memory and - * build the phys_avail array describing the actually-available memory. - * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * - * Total memory size may be set by the kernel environment variable - * hw.physmem or the compile-time define MAXMEM. - * - * XXX first should be vm_paddr_t. - */ static void -getmemsize(int first) +basemem_setup(void) { - int i, off, physmap_idx, pa_indx, da_indx; - int hasbrokenint12, has_smap; - u_long physmem_tunable; - u_int extmem; - struct vm86frame vmf; - struct vm86context vmc; - vm_paddr_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa; pt_entry_t *pte; - struct bios_smap *smap, *smapbase, *smapend; - u_int32_t smapsize; - quad_t dcons_addr, dcons_size; - caddr_t kmdp; - - has_smap = 0; -#ifdef XBOX - if (arch_i386_is_xbox) { - /* - * We queried the memory size before, so chop off 4MB for - * the framebuffer and inform the OS of this. - */ - physmap[0] = 0; - physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE; - physmap_idx = 0; - goto physmap_done; - } -#endif -#if defined(XEN) - has_smap = 0; - Maxmem = xen_start_info->nr_pages - init_first; - physmem = Maxmem; - basemem = 0; - physmap[0] = init_first << PAGE_SHIFT; - physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE); - physmap_idx = 0; - goto physmap_done; -#endif - hasbrokenint12 = 0; - TUNABLE_INT_FETCH("hw.hasbrokenint12", &hasbrokenint12); - bzero(&vmf, sizeof(vmf)); - bzero(physmap, sizeof(physmap)); - basemem = 0; - - /* - * Some newer BIOSes has broken INT 12H implementation which cause - * kernel panic immediately. In this case, we need to scan SMAP - * with INT 15:E820 first, then determine base memory size. - */ - if (hasbrokenint12) { - goto int15e820; - } + int i; - /* - * Perform "base memory" related probes & setup - */ - vm86_intcall(0x12, &vmf); - basemem = vmf.vmf_ax; if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", basemem); @@ -2140,12 +2076,69 @@ getmemsize(int first) pte = (pt_entry_t *)vm86paddr; for (i = basemem / 4; i < 160; i++) pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; +} +#endif + +/* + * Populate the (physmap) array with base/bound pairs describing the + * available physical memory in the system, then test this memory and + * build the phys_avail array describing the actually-available memory. + * + * If we cannot accurately determine the physical memory map, then use + * value from the 0xE801 call, and failing that, the RTC. + * + * Total memory size may be set by the kernel environment variable + * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. + */ +static void +getmemsize(int first) +{ + int has_smap, off, physmap_idx, pa_indx, da_indx; + u_long physmem_tunable; + vm_paddr_t physmap[PHYSMAP_SIZE]; + pt_entry_t *pte; + quad_t dcons_addr, dcons_size; +#ifndef XEN + int hasbrokenint12, i; + u_int extmem; + struct vm86frame vmf; + struct vm86context vmc; + vm_paddr_t pa; + struct bios_smap *smap, *smapbase, *smapend; + u_int32_t smapsize; + caddr_t kmdp; +#endif + + has_smap = 0; +#if defined(XEN) + Maxmem = xen_start_info->nr_pages - init_first; + physmem = Maxmem; + basemem = 0; + physmap[0] = init_first << PAGE_SHIFT; + physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE); + physmap_idx = 0; +#else +#ifdef XBOX + if (arch_i386_is_xbox) { + /* + * We queried the memory size before, so chop off 4MB for + * the framebuffer and inform the OS of this. + */ + physmap[0] = 0; + physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE; + physmap_idx = 0; + goto physmap_done; + } +#endif + bzero(&vmf, sizeof(vmf)); + bzero(physmap, sizeof(physmap)); + basemem = 0; -int15e820: /* - * Fetch the memory map with INT 15:E820. First, check to see - * if the loader supplied it and use that if so. Otherwise, - * use vm86 to invoke the BIOS call directly. + * Check if the loader supplied an SMAP memory map. If so, + * use that and do not make any VM86 calls. */ physmap_idx = 0; smapbase = NULL; @@ -2156,9 +2149,10 @@ int15e820: smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase != NULL) { - /* subr_module.c says: + /* + * subr_module.c says: * "Consumer may safely assume that size value precedes data." - * ie: an int32_t immediately precedes smap. + * ie: an int32_t immediately precedes SMAP. */ smapsize = *((u_int32_t *)smapbase - 1); smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); @@ -2167,33 +2161,50 @@ int15e820: for (smap = smapbase; smap < smapend; smap++) if (!add_smap_entry(smap, physmap, &physmap_idx)) break; - } else { - /* - * map page 1 R/W into the kernel page table so we can use it - * as a buffer. The kernel will unmap this page later. - */ - pmap_kenter(KERNBASE + (1 << PAGE_SHIFT), 1 << PAGE_SHIFT); - vmc.npages = 0; - smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + - (1 << PAGE_SHIFT)); - vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di); - - vmf.vmf_ebx = 0; - do { - vmf.vmf_eax = 0xE820; - vmf.vmf_edx = SMAP_SIG; - vmf.vmf_ecx = sizeof(struct bios_smap); - i = vm86_datacall(0x15, &vmf, &vmc); - if (i || vmf.vmf_eax != SMAP_SIG) - break; - has_smap = 1; - if (!add_smap_entry(smap, physmap, &physmap_idx)) - break; - } while (vmf.vmf_ebx != 0); + goto have_smap; } /* - * Perform "base memory" related probes & setup based on SMAP + * Some newer BIOSes have a broken INT 12H implementation *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***