Date: Fri, 28 May 2010 20:10:10 +0000 (UTC) From: Juli Mallett <jmallett@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r208627 - in user/jmallett/octeon: contrib/nvi/docs contrib/nvi/ex contrib/nvi/vi contrib/opie/libopie contrib/top crypto/openssh lib/libc/sys lib/libpmc lib/msun/man release/amd64 rele... Message-ID: <201005282010.o4SKAAnK095764@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmallett Date: Fri May 28 20:10:10 2010 New Revision: 208627 URL: http://svn.freebsd.org/changeset/base/208627 Log: o) Reset svn:mergeinfo. Somehow I got mergeinfo from head that was leading to endless tree conflicts on directories that I had nothing to do with. o) Merge from head. Added: user/jmallett/octeon/share/doc/legal/intel_iwn/ - copied from r208626, head/share/doc/legal/intel_iwn/ user/jmallett/octeon/sys/dev/ofw/ofw_fdt.c - copied unchanged from r208626, head/sys/dev/ofw/ofw_fdt.c Modified: user/jmallett/octeon/contrib/nvi/docs/help user/jmallett/octeon/contrib/nvi/ex/ex_cmd.c user/jmallett/octeon/contrib/nvi/vi/v_ex.c user/jmallett/octeon/contrib/nvi/vi/v_txt.c user/jmallett/octeon/contrib/opie/libopie/readrec.c user/jmallett/octeon/crypto/openssh/ssh-pkcs11-helper.8 user/jmallett/octeon/lib/libc/sys/mount.2 user/jmallett/octeon/lib/libpmc/pmc.core.3 user/jmallett/octeon/lib/msun/man/math.3 user/jmallett/octeon/release/amd64/boot_crunch.conf user/jmallett/octeon/release/i386/boot_crunch.conf user/jmallett/octeon/release/ia64/boot_crunch.conf user/jmallett/octeon/release/ia64/mkisoimages.sh user/jmallett/octeon/release/pc98/boot_crunch.conf user/jmallett/octeon/release/powerpc/boot_crunch.conf user/jmallett/octeon/release/sparc64/boot_crunch.conf user/jmallett/octeon/release/sun4v/boot_crunch.conf user/jmallett/octeon/sbin/fsck_msdosfs/fsck_msdosfs.8 user/jmallett/octeon/share/doc/legal/Makefile user/jmallett/octeon/share/man/man4/dcons.4 user/jmallett/octeon/share/man/man4/ddb.4 user/jmallett/octeon/share/man/man4/sbp_targ.4 user/jmallett/octeon/share/man/man9/atomic.9 user/jmallett/octeon/sys/amd64/amd64/machdep.c user/jmallett/octeon/sys/amd64/amd64/mca.c user/jmallett/octeon/sys/amd64/amd64/pmap.c user/jmallett/octeon/sys/boot/zfs/zfsimpl.c user/jmallett/octeon/sys/cam/ata/ata_xpt.c user/jmallett/octeon/sys/cam/cam_ccb.h user/jmallett/octeon/sys/cam/cam_xpt.c user/jmallett/octeon/sys/cam/scsi/scsi_xpt.c user/jmallett/octeon/sys/conf/options user/jmallett/octeon/sys/dev/isp/isp_freebsd.c user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.c user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.h user/jmallett/octeon/sys/dev/ofw/ofw_if.m user/jmallett/octeon/sys/dev/ofw/ofw_standard.c user/jmallett/octeon/sys/dev/ofw/openfirm.c user/jmallett/octeon/sys/dev/ofw/openfirm.h user/jmallett/octeon/sys/i386/i386/machdep.c user/jmallett/octeon/sys/i386/i386/mca.c user/jmallett/octeon/sys/i386/i386/pmap.c user/jmallett/octeon/sys/kern/kern_proc.c user/jmallett/octeon/sys/kern/subr_taskqueue.c user/jmallett/octeon/sys/kern/uipc_socket.c user/jmallett/octeon/sys/mips/mips/pmap.c user/jmallett/octeon/sys/mips/mips/tick.c user/jmallett/octeon/sys/mips/mips/uio_machdep.c user/jmallett/octeon/sys/modules/iwnfw/Makefile.inc user/jmallett/octeon/sys/nfsclient/nfs_vfsops.c user/jmallett/octeon/sys/nfsclient/nfs_vnops.c user/jmallett/octeon/sys/powerpc/ofw/ofw_real.c user/jmallett/octeon/sys/sys/_task.h user/jmallett/octeon/sys/sys/taskqueue.h user/jmallett/octeon/sys/sys/user.h user/jmallett/octeon/tools/regression/sockets/unix_close_race/unix_close_race.c user/jmallett/octeon/usr.bin/mail/util.c user/jmallett/octeon/usr.sbin/dconschat/dconschat.8 user/jmallett/octeon/usr.sbin/fdcontrol/fdcontrol.8 user/jmallett/octeon/usr.sbin/i2c/i2c.8 user/jmallett/octeon/usr.sbin/jail/jail.c user/jmallett/octeon/usr.sbin/nfsd/nfsv4.4 user/jmallett/octeon/usr.sbin/nfsd/stablerestart.5 user/jmallett/octeon/usr.sbin/pkg_install/updating/pkg_updating.1 user/jmallett/octeon/usr.sbin/smbmsg/smbmsg.8 Directory Properties: user/jmallett/octeon/ (props changed) user/jmallett/octeon/cddl/contrib/opensolaris/ (props changed) user/jmallett/octeon/contrib/bind9/ (props changed) user/jmallett/octeon/contrib/ee/ (props changed) user/jmallett/octeon/contrib/expat/ (props changed) user/jmallett/octeon/contrib/file/ (props changed) user/jmallett/octeon/contrib/gdb/ (props changed) user/jmallett/octeon/contrib/gdtoa/ (props changed) user/jmallett/octeon/contrib/gnu-sort/ (props changed) user/jmallett/octeon/contrib/groff/ (props changed) user/jmallett/octeon/contrib/less/ (props changed) user/jmallett/octeon/contrib/libpcap/ (props changed) user/jmallett/octeon/contrib/ncurses/ (props changed) user/jmallett/octeon/contrib/netcat/ (props changed) user/jmallett/octeon/contrib/ntp/ (props changed) user/jmallett/octeon/contrib/one-true-awk/ (props changed) user/jmallett/octeon/contrib/openbsm/ (props changed) user/jmallett/octeon/contrib/openpam/ (props changed) user/jmallett/octeon/contrib/pf/ (props changed) user/jmallett/octeon/contrib/sendmail/ (props changed) user/jmallett/octeon/contrib/tcpdump/ (props changed) user/jmallett/octeon/contrib/tcsh/ (props changed) user/jmallett/octeon/contrib/top/ (props changed) user/jmallett/octeon/contrib/top/install-sh (props changed) user/jmallett/octeon/contrib/tzcode/stdtime/ (props changed) user/jmallett/octeon/contrib/tzcode/zic/ (props changed) user/jmallett/octeon/contrib/tzdata/ (props changed) user/jmallett/octeon/contrib/wpa/ (props changed) user/jmallett/octeon/crypto/openssh/ (props changed) user/jmallett/octeon/crypto/openssl/ (props changed) user/jmallett/octeon/lib/libc/ (props changed) user/jmallett/octeon/lib/libc/stdtime/ (props changed) user/jmallett/octeon/lib/libutil/ (props changed) user/jmallett/octeon/lib/libz/ (props changed) user/jmallett/octeon/sbin/ (props changed) user/jmallett/octeon/sbin/ipfw/ (props changed) user/jmallett/octeon/share/zoneinfo/ (props changed) user/jmallett/octeon/sys/ (props changed) user/jmallett/octeon/sys/amd64/include/xen/ (props changed) user/jmallett/octeon/sys/cddl/contrib/opensolaris/ (props changed) user/jmallett/octeon/sys/contrib/dev/acpica/ (props changed) user/jmallett/octeon/sys/contrib/pf/ (props changed) user/jmallett/octeon/sys/contrib/x86emu/ (props changed) user/jmallett/octeon/sys/dev/xen/xenpci/ (props changed) user/jmallett/octeon/usr.bin/csup/ (props changed) user/jmallett/octeon/usr.bin/procstat/ (props changed) user/jmallett/octeon/usr.sbin/zic/ (props changed) Modified: user/jmallett/octeon/contrib/nvi/docs/help ============================================================================== --- user/jmallett/octeon/contrib/nvi/docs/help Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/contrib/nvi/docs/help Fri May 28 20:10:10 2010 (r208627) @@ -129,7 +129,7 @@ EX COMMANDS: ^D: scroll lines !: filter lines through commands or run commands #: display numbered lines - &: repeat the last subsitution + &: repeat the last substitution *: execute a buffer <: shift lines left =: display line number Modified: user/jmallett/octeon/contrib/nvi/ex/ex_cmd.c ============================================================================== --- user/jmallett/octeon/contrib/nvi/ex/ex_cmd.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/contrib/nvi/ex/ex_cmd.c Fri May 28 20:10:10 2010 (r208627) @@ -68,7 +68,7 @@ EXCMDLIST const cmds[] = { {"&", ex_subagain, E_ADDR2, "s", "[line [,line]] & [cgr] [count] [#lp]", - "repeat the last subsitution"}, + "repeat the last substitution"}, /* C_STAR */ {"*", ex_at, 0, "b", Modified: user/jmallett/octeon/contrib/nvi/vi/v_ex.c ============================================================================== --- user/jmallett/octeon/contrib/nvi/vi/v_ex.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/contrib/nvi/vi/v_ex.c Fri May 28 20:10:10 2010 (r208627) @@ -428,6 +428,10 @@ v_ex(sp, vp) if (tp->term == TERM_BS) break; + /* If the user changed their mind, return. */ + if (tp->term != TERM_OK) + break; + /* Log the command. */ if (O_STR(sp, O_CEDIT) != NULL && v_ecl_log(sp, tp)) return (1); Modified: user/jmallett/octeon/contrib/nvi/vi/v_txt.c ============================================================================== --- user/jmallett/octeon/contrib/nvi/vi/v_txt.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/contrib/nvi/vi/v_txt.c Fri May 28 20:10:10 2010 (r208627) @@ -510,15 +510,6 @@ next: if (v_event_get(sp, evp, 0, ec_fla case E_EOF: F_SET(sp, SC_EXIT_FORCE); return (1); - case E_INTERRUPT: - /* - * !!! - * Historically, <interrupt> exited the user from text input - * mode or cancelled a colon command, and returned to command - * mode. It also beeped the terminal, but that seems a bit - * excessive. - */ - goto k_escape; case E_REPAINT: if (vs_repaint(sp, &ev)) return (1); @@ -526,10 +517,37 @@ next: if (v_event_get(sp, evp, 0, ec_fla case E_WRESIZE: /* <resize> interrupts the input mode. */ v_emsg(sp, NULL, VIM_WRESIZE); - goto k_escape; + /* FALLTHROUGH */ default: - v_event_err(sp, evp); - goto k_escape; + if (evp->e_event != E_INTERRUPT && evp->e_event != E_WRESIZE) + v_event_err(sp, evp); + /* + * !!! + * Historically, <interrupt> exited the user from text input + * mode or cancelled a colon command, and returned to command + * mode. It also beeped the terminal, but that seems a bit + * excessive. + */ + /* + * If we are recording, morph into <escape> key so that + * we can repeat the command safely: there is no way to + * invalidate the repetition of an instance of a command, + * which would be the alternative possibility. + * If we are not recording (most likely on the command line), + * simply discard the input and return to command mode + * so that an INTERRUPT doesn't become for example a file + * completion request. -aymeric + */ + if (LF_ISSET(TXT_RECORD)) { + evp->e_event = E_CHARACTER; + evp->e_c = 033; + evp->e_flags = 0; + evp->e_value = K_ESCAPE; + break; + } else { + tp->term = TERM_ESC; + goto k_escape; + } } /* @@ -539,7 +557,7 @@ next: if (v_event_get(sp, evp, 0, ec_fla * This was not documented as far as I know, and is a great test of vi * clones. */ - if (rcol == 0 && !LF_ISSET(TXT_REPLAY) && evp->e_c == '\0') { + if (LF_ISSET(TXT_RECORD) && rcol == 0 && evp->e_c == '\0') { if (vip->rep == NULL) goto done; @@ -1456,6 +1474,7 @@ done: /* Leave input mode. */ err: alloc_err: + F_CLR(sp, SC_TINPUT); txt_err(sp, &sp->tiq); return (1); } @@ -2216,8 +2235,8 @@ txt_fc_col(sp, argc, argv) /* If the largest file name is too large, just print them. */ if (colwidth > sp->cols) { - p = msg_print(sp, av[0]->bp + prefix, &nf); for (ac = argc, av = argv; ac > 0; --ac, ++av) { + p = msg_print(sp, av[0]->bp + prefix, &nf); (void)ex_printf(sp, "%s\n", p); if (F_ISSET(gp, G_INTERRUPTED)) break; Modified: user/jmallett/octeon/contrib/opie/libopie/readrec.c ============================================================================== --- user/jmallett/octeon/contrib/opie/libopie/readrec.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/contrib/opie/libopie/readrec.c Fri May 28 20:10:10 2010 (r208627) @@ -141,10 +141,8 @@ int __opiereadrec FUNCTION((opie), struc if (c = strchr(opie->opie_principal, ':')) *c = 0; - if (strlen(opie->opie_principal) > OPIE_PRINCIPAL_MAX) - (opie->opie_principal)[OPIE_PRINCIPAL_MAX] = 0; - strcpy(principal, opie->opie_principal); + strlcpy(principal, opie->opie_principal, sizeof(principal)); do { if ((opie->opie_recstart = ftell(f)) < 0) Modified: user/jmallett/octeon/crypto/openssh/ssh-pkcs11-helper.8 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh-pkcs11-helper.8 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/crypto/openssh/ssh-pkcs11-helper.8 Fri May 28 20:10:10 2010 (r208627) @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: February 10 2010 $ +.Dd February 10, 2010 .Dt SSH-PKCS11-HELPER 8 .Os .Sh NAME Modified: user/jmallett/octeon/lib/libc/sys/mount.2 ============================================================================== --- user/jmallett/octeon/lib/libc/sys/mount.2 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/lib/libc/sys/mount.2 Fri May 28 20:10:10 2010 (r208627) @@ -107,7 +107,7 @@ This restriction can be removed by setti .Va vfs.usermount .Xr sysctl 8 variable -to a non-zero value. +to a non-zero value; see the BUGS section for more information. .Pp The following .Fa flags @@ -374,3 +374,10 @@ system call first appeared in .Fx 5.0 . .Sh BUGS Some of the error codes need translation to more obvious messages. +.Pp +Allowing untrusted users to mount arbitrary media, e.g. by enabling +.Va vfs.usermount , +should not be considered safe. +Most file systems in +.Fx +were not built to safeguard against malicious devices. Modified: user/jmallett/octeon/lib/libpmc/pmc.core.3 ============================================================================== --- user/jmallett/octeon/lib/libpmc/pmc.core.3 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/lib/libpmc/pmc.core.3 Fri May 28 20:10:10 2010 (r208627) @@ -49,11 +49,11 @@ performance measurement architecture. .Pp These PMCs are documented in .Rs -.%B "IA-32 Intel(R) Architecture Software Developer's Manual" -.%T "Volume 3: System Programming Guide" -.%N "Order Number 253669-027US" +.%B IA-32 Intel\(rg Architecture Software Developer's Manual +.%T Volume 3: System Programming Guide +.%N Order Number 253669-027US .%D July 2008 -.%Q "Intel Corporation" +.%Q Intel Corporation .Re .Ss PMC Features CPUs conforming to version 1 of the @@ -735,11 +735,11 @@ The following errata affect performance processors. These errata are documented in .Rs -.%T "Intel® CoreTM Duo Processor and Intel® CoreTM Solo Processor on 65 nm Process" -.%B "Specification Update" -.%N "Order Number 309222-017" +.%B Specification Update +.%T Intel\(rg CoreTM Duo Processor and Intel\(rg CoreTM Solo Processor on 65 nm Process +.%N Order Number 309222-017 .%D July 2008 -.%Q "Intel Corporation" +.%Q Intel Corporation .Re .Bl -tag -width indent -compact .It AE19 Modified: user/jmallett/octeon/lib/msun/man/math.3 ============================================================================== --- user/jmallett/octeon/lib/msun/man/math.3 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/lib/msun/man/math.3 Fri May 28 20:10:10 2010 (r208627) @@ -31,9 +31,6 @@ .Dd December 16, 2007 .Dt MATH 3 .Os -.if n \{\ -.char \[sr] "sqrt -.\} .Sh NAME .Nm math .Nd "floating-point mathematical library" Modified: user/jmallett/octeon/release/amd64/boot_crunch.conf ============================================================================== --- user/jmallett/octeon/release/amd64/boot_crunch.conf Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/amd64/boot_crunch.conf Fri May 28 20:10:10 2010 (r208627) @@ -39,6 +39,6 @@ progs ppp progs sysinstall progs usbconfig -libs -ll -ledit -lutil -lmd -lcrypt -lcrypto -lftpio -lz -lnetgraph +libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 -llzma -lusb -ljail +libs -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail Modified: user/jmallett/octeon/release/i386/boot_crunch.conf ============================================================================== --- user/jmallett/octeon/release/i386/boot_crunch.conf Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/i386/boot_crunch.conf Fri May 28 20:10:10 2010 (r208627) @@ -39,6 +39,6 @@ progs ppp progs sysinstall progs usbconfig -libs -ll -ledit -lutil -lmd -lcrypt -lcrypto -lftpio -lz -lnetgraph +libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 -llzma -lusb -ljail +libs -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail Modified: user/jmallett/octeon/release/ia64/boot_crunch.conf ============================================================================== --- user/jmallett/octeon/release/ia64/boot_crunch.conf Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/ia64/boot_crunch.conf Fri May 28 20:10:10 2010 (r208627) @@ -44,6 +44,6 @@ progs ppp progs sysinstall progs usbconfig -libs -ll -ledit -lutil -lmd -lcrypt -lcrypto -lftpio -lz -lnetgraph +libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -ldevinfo -libs -lgeom -lbsdxml -larchive -lbz2 -llzma -lusb -ljail +libs -lgeom -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail Modified: user/jmallett/octeon/release/ia64/mkisoimages.sh ============================================================================== --- user/jmallett/octeon/release/ia64/mkisoimages.sh Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/ia64/mkisoimages.sh Fri May 28 20:10:10 2010 (r208627) @@ -67,7 +67,7 @@ EFIPART=efipart.sys # To create a bootable CD under EFI, the boot image should be an EFI # system partition. if [ $bootable = yes ]; then - EFISZ=40960 + EFISZ=65536 MNT=/mnt dd if=/dev/zero of=$BASE/$EFIPART count=$EFISZ md=`mdconfig -a -t vnode -f $BASE/$EFIPART` Modified: user/jmallett/octeon/release/pc98/boot_crunch.conf ============================================================================== --- user/jmallett/octeon/release/pc98/boot_crunch.conf Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/pc98/boot_crunch.conf Fri May 28 20:10:10 2010 (r208627) @@ -38,6 +38,6 @@ progs arp progs ppp progs sysinstall -libs -ll -ledit -lutil -lmd -lcrypt -lcrypto -lftpio -lz -lnetgraph +libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 -llzma -ljail +libs -larchive -lcrypto -lbz2 -llzma -ljail Modified: user/jmallett/octeon/release/powerpc/boot_crunch.conf ============================================================================== --- user/jmallett/octeon/release/powerpc/boot_crunch.conf Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/powerpc/boot_crunch.conf Fri May 28 20:10:10 2010 (r208627) @@ -44,6 +44,6 @@ progs ppp progs sysinstall progs usbconfig -libs -ll -ledit -lutil -lmd -lcrypt -lcrypto -lftpio -lz -lnetgraph +libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -libs -lgeom -lbsdxml -larchive -lbz2 -llzma -lusb -ljail +libs -lgeom -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail Modified: user/jmallett/octeon/release/sparc64/boot_crunch.conf ============================================================================== --- user/jmallett/octeon/release/sparc64/boot_crunch.conf Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/sparc64/boot_crunch.conf Fri May 28 20:10:10 2010 (r208627) @@ -39,6 +39,6 @@ progs ppp progs sysinstall progs usbconfig -libs -ll -ledit -lutil -lmd -lcrypt -lcrypto -lftpio -lz -lnetgraph +libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 -llzma -lusb -ljail +libs -larchive -lcrypto -lbz2 -llzma -lusb -ljail Modified: user/jmallett/octeon/release/sun4v/boot_crunch.conf ============================================================================== --- user/jmallett/octeon/release/sun4v/boot_crunch.conf Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/release/sun4v/boot_crunch.conf Fri May 28 20:10:10 2010 (r208627) @@ -39,6 +39,6 @@ progs ppp progs sysinstall progs usbconfig -libs -ll -ledit -lutil -lmd -lcrypt -lcrypto -lftpio -lz -lnetgraph +libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 -llzma -lusb -ljail +libs -larchive -lcrypto -lbz2 -llzma -lusb -ljail Modified: user/jmallett/octeon/sbin/fsck_msdosfs/fsck_msdosfs.8 ============================================================================== --- user/jmallett/octeon/sbin/fsck_msdosfs/fsck_msdosfs.8 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sbin/fsck_msdosfs/fsck_msdosfs.8 Fri May 28 20:10:10 2010 (r208627) @@ -120,4 +120,4 @@ utility first appeared in The .Nm utility is -.Ud . +.Ud Modified: user/jmallett/octeon/share/doc/legal/Makefile ============================================================================== --- user/jmallett/octeon/share/doc/legal/Makefile Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/share/doc/legal/Makefile Fri May 28 20:10:10 2010 (r208627) @@ -2,6 +2,7 @@ SUBDIR= intel_ipw \ intel_iwi \ + intel_iwn \ intel_wpi .include <bsd.subdir.mk> Modified: user/jmallett/octeon/share/man/man4/dcons.4 ============================================================================== --- user/jmallett/octeon/share/man/man4/dcons.4 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/share/man/man4/dcons.4 Fri May 28 20:10:10 2010 (r208627) @@ -122,4 +122,4 @@ dcons_gdb="1" .An Hidetoshi Shimokawa Aq simokawa@FreeBSD.org .Sh BUGS This driver is -.Ud . +.Ud Modified: user/jmallett/octeon/share/man/man4/ddb.4 ============================================================================== --- user/jmallett/octeon/share/man/man4/ddb.4 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/share/man/man4/ddb.4 Fri May 28 20:10:10 2010 (r208627) @@ -964,7 +964,7 @@ is printed. Show all threads within the system. Output format is as follows: .Pp -.Bl -tag -width "PPID" -compact -offset indent -width "Second column" +.Bl -tag -compact -offset indent -width "Second column" .It Ic First column Thread identifier (TID) .It Ic Second column Modified: user/jmallett/octeon/share/man/man4/sbp_targ.4 ============================================================================== --- user/jmallett/octeon/share/man/man4/sbp_targ.4 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/share/man/man4/sbp_targ.4 Fri May 28 20:10:10 2010 (r208627) @@ -93,6 +93,6 @@ driver was written by .An Hidetoshi Shimokawa . .Sh BUGS This driver is -.Ud . +.Ud It does not work correctly in multi-initiator environments or after the bus topology has been changed. Modified: user/jmallett/octeon/share/man/man9/atomic.9 ============================================================================== --- user/jmallett/octeon/share/man/man9/atomic.9 Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/share/man/man9/atomic.9 Fri May 28 20:10:10 2010 (r208627) @@ -62,7 +62,6 @@ .Fn atomic_subtract_[acq_|rel_]<type> "volatile <type> *p" "<type> v" .Ft void .Fn atomic_store_rel_<type> "volatile <type> *p" "<type> v" -.rm LB RB La Ra .Sh DESCRIPTION Each of the atomic operations is guaranteed to be atomic in the presence of interrupts. Modified: user/jmallett/octeon/sys/amd64/amd64/machdep.c ============================================================================== --- user/jmallett/octeon/sys/amd64/amd64/machdep.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/amd64/amd64/machdep.c Fri May 28 20:10:10 2010 (r208627) @@ -285,7 +285,6 @@ cpu_startup(dummy) vm_pager_bufferinit(); cpu_setregs(); - mca_init(); } /* Modified: user/jmallett/octeon/sys/amd64/amd64/mca.c ============================================================================== --- user/jmallett/octeon/sys/amd64/amd64/mca.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/amd64/amd64/mca.c Fri May 28 20:10:10 2010 (r208627) @@ -789,6 +789,19 @@ mca_init(void) load_cr4(rcr4() | CR4_MCE); } +/* + * The machine check registers for the BSP cannot be initialized until + * the local APIC is initialized. This happens at SI_SUB_CPU, + * SI_ORDER_SECOND. + */ +static void +mca_init_bsp(void *arg __unused) +{ + + mca_init(); +} +SYSINIT(mca_init_bsp, SI_SUB_CPU, SI_ORDER_ANY, mca_init_bsp, NULL); + /* Called when a machine check exception fires. */ int mca_intr(void) Modified: user/jmallett/octeon/sys/amd64/amd64/pmap.c ============================================================================== --- user/jmallett/octeon/sys/amd64/amd64/pmap.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/amd64/amd64/pmap.c Fri May 28 20:10:10 2010 (r208627) @@ -2796,6 +2796,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_remove_all: page %p is fictitious", m)); + free = NULL; vm_page_lock_queues(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); while ((pv = TAILQ_FIRST(&pvh->pv_list)) != NULL) { @@ -2825,16 +2826,15 @@ pmap_remove_all(vm_page_t m) */ if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - free = NULL; pmap_unuse_pt(pmap, pv->pv_va, *pde, &free); pmap_invalidate_page(pmap, pv->pv_va); - pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); vm_page_unlock_queues(); + pmap_free_zero_pages(free); } /* Modified: user/jmallett/octeon/sys/boot/zfs/zfsimpl.c ============================================================================== --- user/jmallett/octeon/sys/boot/zfs/zfsimpl.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/boot/zfs/zfsimpl.c Fri May 28 20:10:10 2010 (r208627) @@ -958,12 +958,17 @@ zio_read_gang(spa_t *spa, const blkptr_t break; if (!vdev || !vdev->v_read) return (EIO); - if (vdev->v_read(vdev, bp, &zio_gb, offset, SPA_GANGBLOCKSIZE)) + if (vdev->v_read(vdev, NULL, &zio_gb, offset, SPA_GANGBLOCKSIZE)) return (EIO); for (i = 0; i < SPA_GBH_NBLKPTRS; i++) { - if (zio_read(spa, &zio_gb.zg_blkptr[i], buf)) + blkptr_t *gbp = &zio_gb.zg_blkptr[i]; + + if (BP_IS_HOLE(gbp)) + continue; + if (zio_read(spa, gbp, buf)) return (EIO); + buf = (char*)buf + BP_GET_PSIZE(gbp); } return (0); @@ -994,9 +999,8 @@ zio_read(spa_t *spa, const blkptr_t *bp, continue; if (DVA_GET_GANG(dva)) { - printf("ZFS: gang block detected!\n"); if (zio_read_gang(spa, bp, dva, buf)) - return (EIO); + continue; } else { vdevid = DVA_GET_VDEV(dva); offset = DVA_GET_OFFSET(dva); Modified: user/jmallett/octeon/sys/cam/ata/ata_xpt.c ============================================================================== --- user/jmallett/octeon/sys/cam/ata/ata_xpt.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/cam/ata/ata_xpt.c Fri May 28 20:10:10 2010 (r208627) @@ -1185,6 +1185,7 @@ ata_scan_bus(struct cam_periph *periph, ("xpt_scan_bus\n")); switch (request_ccb->ccb_h.func_code) { case XPT_SCAN_BUS: + case XPT_SCAN_TGT: /* Find out the characteristics of the bus */ work_ccb = xpt_alloc_ccb_nowait(); if (work_ccb == NULL) { @@ -1526,6 +1527,7 @@ ata_action(union ccb *start_ccb) break; } case XPT_SCAN_BUS: + case XPT_SCAN_TGT: ata_scan_bus(start_ccb->ccb_h.path->periph, start_ccb); break; case XPT_SCAN_LUN: Modified: user/jmallett/octeon/sys/cam/cam_ccb.h ============================================================================== --- user/jmallett/octeon/sys/cam/cam_ccb.h Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/cam/cam_ccb.h Fri May 28 20:10:10 2010 (r208627) @@ -184,6 +184,11 @@ typedef enum { /* * Set SIM specific knob values. */ + + XPT_SCAN_TGT = 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB + | XPT_FC_XPT_ONLY, + /* Scan Target */ + /* HBA engine commands 0x20->0x2F */ XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY, /* HBA engine feature inquiry */ Modified: user/jmallett/octeon/sys/cam/cam_xpt.c ============================================================================== --- user/jmallett/octeon/sys/cam/cam_xpt.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/cam/cam_xpt.c Fri May 28 20:10:10 2010 (r208627) @@ -446,23 +446,36 @@ xptioctl(struct cdev *dev, u_long cmd, c inccb = (union ccb *)addr; bus = xpt_find_bus(inccb->ccb_h.path_id); - if (bus == NULL) { - error = EINVAL; + if (bus == NULL) + return (EINVAL); + + switch (inccb->ccb_h.func_code) { + case XPT_SCAN_BUS: + case XPT_RESET_BUS: + if (inccb->ccb_h.target_id != CAM_TARGET_WILDCARD || + inccb->ccb_h.target_lun != CAM_LUN_WILDCARD) { + xpt_release_bus(bus); + return (EINVAL); + } + break; + case XPT_SCAN_TGT: + if (inccb->ccb_h.target_id == CAM_TARGET_WILDCARD || + inccb->ccb_h.target_lun != CAM_LUN_WILDCARD) { + xpt_release_bus(bus); + return (EINVAL); + } + break; + default: break; } switch(inccb->ccb_h.func_code) { case XPT_SCAN_BUS: case XPT_RESET_BUS: - if ((inccb->ccb_h.target_id != CAM_TARGET_WILDCARD) - || (inccb->ccb_h.target_lun != CAM_LUN_WILDCARD)) { - error = EINVAL; - break; - } - /* FALLTHROUGH */ case XPT_PATH_INQ: case XPT_ENG_INQ: case XPT_SCAN_LUN: + case XPT_SCAN_TGT: ccb = xpt_alloc_ccb(); @@ -839,11 +852,21 @@ xpt_rescan(union ccb *ccb) struct ccb_hdr *hdr; /* Prepare request */ - if (ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD || + if (ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD && ccb->ccb_h.path->device->lun_id == CAM_LUN_WILDCARD) ccb->ccb_h.func_code = XPT_SCAN_BUS; - else + else if (ccb->ccb_h.path->target->target_id != CAM_TARGET_WILDCARD && + ccb->ccb_h.path->device->lun_id == CAM_LUN_WILDCARD) + ccb->ccb_h.func_code = XPT_SCAN_TGT; + else if (ccb->ccb_h.path->target->target_id != CAM_TARGET_WILDCARD && + ccb->ccb_h.path->device->lun_id != CAM_LUN_WILDCARD) ccb->ccb_h.func_code = XPT_SCAN_LUN; + else { + xpt_print(ccb->ccb_h.path, "illegal scan path\n"); + xpt_free_path(ccb->ccb_h.path); + xpt_free_ccb(ccb); + return; + } ccb->ccb_h.ppriv_ptr1 = ccb->ccb_h.cbfcnp; ccb->ccb_h.cbfcnp = xpt_rescan_done; xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, CAM_PRIORITY_XPT); Modified: user/jmallett/octeon/sys/cam/scsi/scsi_xpt.c ============================================================================== --- user/jmallett/octeon/sys/cam/scsi/scsi_xpt.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/cam/scsi/scsi_xpt.c Fri May 28 20:10:10 2010 (r208627) @@ -1494,12 +1494,13 @@ scsi_scan_bus(struct cam_periph *periph, ("scsi_scan_bus\n")); switch (request_ccb->ccb_h.func_code) { case XPT_SCAN_BUS: + case XPT_SCAN_TGT: { scsi_scan_bus_info *scan_info; union ccb *work_ccb, *reset_ccb; struct cam_path *path; u_int i; - u_int max_target; + u_int low_target, max_target; u_int initiator_id; /* Find out the characteristics of the bus */ @@ -1564,13 +1565,18 @@ scsi_scan_bus(struct cam_periph *periph, /* Cache on our stack so we can work asynchronously */ max_target = scan_info->cpi->max_target; + low_target = 0; initiator_id = scan_info->cpi->initiator_id; /* * We can scan all targets in parallel, or do it sequentially. */ - if (scan_info->cpi->hba_misc & PIM_SEQSCAN) { + + if (request_ccb->ccb_h.func_code == XPT_SCAN_TGT) { + max_target = low_target = request_ccb->ccb_h.target_id; + scan_info->counter = 0; + } else if (scan_info->cpi->hba_misc & PIM_SEQSCAN) { max_target = 0; scan_info->counter = 0; } else { @@ -1580,7 +1586,7 @@ scsi_scan_bus(struct cam_periph *periph, } } - for (i = 0; i <= max_target; i++) { + for (i = low_target; i <= max_target; i++) { cam_status status; if (i == initiator_id) continue; @@ -1695,7 +1701,9 @@ scsi_scan_bus(struct cam_periph *periph, hop_again: done = 0; - if (scan_info->cpi->hba_misc & PIM_SEQSCAN) { + if (scan_info->request_ccb->ccb_h.func_code == XPT_SCAN_TGT) { + done = 1; + } else if (scan_info->cpi->hba_misc & PIM_SEQSCAN) { scan_info->counter++; if (scan_info->counter == scan_info->cpi->initiator_id) { @@ -2016,6 +2024,7 @@ scsi_action(union ccb *start_ccb) break; } case XPT_SCAN_BUS: + case XPT_SCAN_TGT: scsi_scan_bus(start_ccb->ccb_h.path->periph, start_ccb); break; case XPT_SCAN_LUN: Modified: user/jmallett/octeon/sys/conf/options ============================================================================== --- user/jmallett/octeon/sys/conf/options Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/conf/options Fri May 28 20:10:10 2010 (r208627) @@ -848,3 +848,7 @@ SND_PCM_64 opt_snd.h SND_OLDSTEREO opt_snd.h X86BIOS + +# Flattened device tree options +FDT opt_platform.h +FDT_DTB_STATIC opt_platform.h Modified: user/jmallett/octeon/sys/dev/isp/isp_freebsd.c ============================================================================== --- user/jmallett/octeon/sys/dev/isp/isp_freebsd.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/dev/isp/isp_freebsd.c Fri May 28 20:10:10 2010 (r208627) @@ -3893,19 +3893,14 @@ isp_make_here(ispsoftc_t *isp, int chan, } /* - * Allocate a CCB, create a wildcard path for this bus/target and schedule a rescan. + * Allocate a CCB, create a wildcard path for this target and schedule a rescan. */ ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { isp_prt(isp, ISP_LOGWARN, "Chan %d unable to alloc CCB for rescan", chan); return; } - /* - * xpt_rescan only honors wildcard in the target field. - * Scan the whole bus instead of target, which will then - * force a scan of all luns. - */ - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(fc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(fc->sim), tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { isp_prt(isp, ISP_LOGWARN, "unable to create path for rescan"); xpt_free_ccb(ccb); return; Modified: user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.c Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.c Fri May 28 20:10:10 2010 (r208627) @@ -30,6 +30,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_platform.h" #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> @@ -146,6 +147,53 @@ ofw_bus_gen_get_type(device_t bus, devic return (obd->obd_type); } +int +ofw_bus_is_compatible(device_t dev, const char *onecompat) +{ + phandle_t node; + const char *compat; + int len, onelen, l; + + if ((compat = ofw_bus_get_compat(dev)) == NULL) + return (0); + + if ((node = ofw_bus_get_node(dev)) == 0) + return (0); + + /* Get total 'compatible' prop len */ + if ((len = OF_getproplen(node, "compatible")) <= 0) + return (0); + + onelen = strlen(onecompat); + + while (len > 0) { + if (strncasecmp(compat, onecompat, onelen) == 0) + /* Found it. */ + return (1); + + /* Slide to the next sub-string. */ + l = strlen(compat) + 1; + compat += l; + len -= l; + } + return (0); +} + +int +ofw_bus_is_compatible_strict(device_t dev, const char *compatible) +{ + const char *compat; + + if ((compat = ofw_bus_get_compat(dev)) == NULL) + return (0); + + if (strncasecmp(compat, compatible, strlen(compatible)) == 0) + return (1); + + return (0); +} + +#ifndef FDT void ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iinfo *ii, int intrsz) { @@ -262,3 +310,4 @@ ofw_bus_search_intrmap(void *intr, int i } return (0); } +#endif /* !FDT */ Modified: user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.h Fri May 28 18:47:56 2010 (r208626) +++ user/jmallett/octeon/sys/dev/ofw/ofw_bus_subr.h Fri May 28 20:10:10 2010 (r208627) @@ -67,4 +67,8 @@ int ofw_bus_lookup_imap(phandle_t, struc int ofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *, void *, void *, int); +/* Helper routine for checking compat prop */ +int ofw_bus_is_compatible(device_t, const char *); +int ofw_bus_is_compatible_strict(device_t, const char *); + #endif /* !_DEV_OFW_OFW_BUS_SUBR_H_ */ Copied: user/jmallett/octeon/sys/dev/ofw/ofw_fdt.c (from r208626, head/sys/dev/ofw/ofw_fdt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/sys/dev/ofw/ofw_fdt.c Fri May 28 20:10:10 2010 (r208627, copy of r208626, head/sys/dev/ofw/ofw_fdt.c) @@ -0,0 +1,458 @@ +/*- + * Copyright (c) 2009-2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * 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. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/kernel.h> +#include <sys/malloc.h> +#include <sys/systm.h> + +#include <contrib/libfdt/libfdt.h> + +#include <machine/stdarg.h> + +#include <dev/fdt/fdt_common.h> +#include <dev/ofw/ofwvar.h> +#include <dev/ofw/openfirm.h> + +#include "ofw_if.h" + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +static int ofw_fdt_init(ofw_t, void *); +static phandle_t ofw_fdt_peer(ofw_t, phandle_t); +static phandle_t ofw_fdt_child(ofw_t, phandle_t); +static phandle_t ofw_fdt_parent(ofw_t, phandle_t); +static phandle_t ofw_fdt_instance_to_package(ofw_t, ihandle_t); +static ssize_t ofw_fdt_getproplen(ofw_t, phandle_t, const char *); +static ssize_t ofw_fdt_getprop(ofw_t, phandle_t, const char *, void *, size_t); +static int ofw_fdt_nextprop(ofw_t, phandle_t, const char *, char *, size_t); +static int ofw_fdt_setprop(ofw_t, phandle_t, const char *, const void *, + size_t); +static ssize_t ofw_fdt_canon(ofw_t, const char *, char *, size_t); +static phandle_t ofw_fdt_finddevice(ofw_t, const char *); +static ssize_t ofw_fdt_instance_to_path(ofw_t, ihandle_t, char *, size_t); +static ssize_t ofw_fdt_package_to_path(ofw_t, phandle_t, char *, size_t); +static int ofw_fdt_interpret(ofw_t, const char *, int, unsigned long *); + +static ofw_method_t ofw_fdt_methods[] = { + OFWMETHOD(ofw_init, ofw_fdt_init), + OFWMETHOD(ofw_peer, ofw_fdt_peer), + OFWMETHOD(ofw_child, ofw_fdt_child), + OFWMETHOD(ofw_parent, ofw_fdt_parent), + OFWMETHOD(ofw_instance_to_package, ofw_fdt_instance_to_package), + OFWMETHOD(ofw_getproplen, ofw_fdt_getproplen), + OFWMETHOD(ofw_getprop, ofw_fdt_getprop), + OFWMETHOD(ofw_nextprop, ofw_fdt_nextprop), + OFWMETHOD(ofw_setprop, ofw_fdt_setprop), + OFWMETHOD(ofw_canon, ofw_fdt_canon), + OFWMETHOD(ofw_finddevice, ofw_fdt_finddevice), + OFWMETHOD(ofw_instance_to_path, ofw_fdt_instance_to_path), + OFWMETHOD(ofw_package_to_path, ofw_fdt_package_to_path), + OFWMETHOD(ofw_interpret, ofw_fdt_interpret), + { 0, 0 } +}; + +static ofw_def_t ofw_fdt = { + OFW_FDT, + ofw_fdt_methods, + 0 +}; +OFW_DEF(ofw_fdt); + +static void *fdtp = NULL; + +static int +ofw_fdt_init(ofw_t ofw, void *data) +{ + int err; + + /* Check FDT blob integrity */ + if ((err = fdt_check_header(data)) != 0) + return (err); + + fdtp = data; + return (0); +} + +/* + * Device tree functions + */ + +static int +fdt_phandle_offset(phandle_t p) +{ + const char *dt_struct; + int offset; + + dt_struct = (const char *)fdtp + fdt_off_dt_struct(fdtp); + + if (((const char *)p < dt_struct) || + (const char *)p > (dt_struct + fdt_size_dt_struct(fdtp))) + return (-1); + + offset = (const char *)p - dt_struct; + if (offset < 0) + return (-1); + + return (offset); +} + +/* Return the next sibling of this node or 0. */ +static phandle_t +ofw_fdt_peer(ofw_t ofw, phandle_t node) +{ + phandle_t p; + int depth, offset; + + if (node == 0) { + /* Find root node */ + offset = fdt_path_offset(fdtp, "/"); + p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + + return (p); + } + + offset = fdt_phandle_offset(node); + if (offset < 0) + return (0); + + for (depth = 1, offset = fdt_next_node(fdtp, offset, &depth); + offset >= 0; + offset = fdt_next_node(fdtp, offset, &depth)) { + if (depth < 0) + return (0); + if (depth == 1) { + p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + return (p); + } + } + + return (0); +} + +/* Return the first child of this node or 0. */ +static phandle_t +ofw_fdt_child(ofw_t ofw, phandle_t node) +{ + phandle_t p; + int depth, offset; + + offset = fdt_phandle_offset(node); + if (offset < 0) + return (0); + + for (depth = 0, offset = fdt_next_node(fdtp, offset, &depth); + (offset >= 0) && (depth > 0); + offset = fdt_next_node(fdtp, offset, &depth)) { + if (depth < 0) + return (0); + if (depth == 1) { + p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + return (p); + } + } + + return (0); +} + +/* Return the parent of this node or 0. */ +static phandle_t +ofw_fdt_parent(ofw_t ofw, phandle_t node) +{ + phandle_t p; + int offset, paroffset; + + offset = fdt_phandle_offset(node); + if (offset < 0) + return (0); + + paroffset = fdt_parent_offset(fdtp, offset); + p = (phandle_t)fdt_offset_ptr(fdtp, paroffset, sizeof(phandle_t)); + return (p); +} + +/* Return the package handle that corresponds to an instance handle. */ +static phandle_t +ofw_fdt_instance_to_package(ofw_t ofw, ihandle_t instance) +{ + phandle_t p; + int offset; + + /* + * Note: FDT does not have the notion of instances, but we somewhat + * abuse the semantics and let treat as 'instance' the internal + * 'phandle' prop, so that ofw I/F consumers have a uniform way of + * translation between internal representation (which appear in some + * contexts as property values) and effective phandles. + */ + offset = fdt_node_offset_by_phandle(fdtp, instance); + if (offset < 0) + return (0); + + p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(phandle_t)); + return (p); +} + +/* Get the length of a property of a package. */ +static ssize_t +ofw_fdt_getproplen(ofw_t ofw, phandle_t package, const char *propname) +{ + const struct fdt_property *prop; + int offset, len; + + offset = fdt_phandle_offset(package); + if (offset < 0) + return (0); + + if (strcmp(propname, "name") == 0) { + /* Emulate the 'name' property */ + fdt_get_name(fdtp, offset, &len); + return (len + 1); + } + + len = 0; + prop = fdt_get_property(fdtp, offset, propname, &len); + + return (len); +} + +/* Get the value of a property of a package. */ +static ssize_t +ofw_fdt_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf, + size_t buflen) +{ + const void *prop; + const char *name; + int len, offset; + + offset = fdt_phandle_offset(package); + if (offset < 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005282010.o4SKAAnK095764>