svn commit: r243396 - head/sys/fs/smbfs
Author: davide Date: Thu Nov 22 08:58:29 2012 New Revision: 243396 URL: http://svnweb.freebsd.org/changeset/base/243396 Log: Until now, smbfs_fullpath() computed the full path starting from the vnode and following back the chain of n_parent pointers up to the root, without acquiring the locks of the n_parent vnodes analyzed during the computation. This is immediately wrong because if the vnode lock is not held there's no guarantee on the validity of the vnode pointer or the data. In order to fix, store the whole path in the smbnode structure so that smbfs_fullpath() can use this information. Discussed with: kib Reported and tested by: pho Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs_io.c head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_node.h head/sys/fs/smbfs/smbfs_subr.c head/sys/fs/smbfs/smbfs_vfsops.c Modified: head/sys/fs/smbfs/smbfs_io.c == --- head/sys/fs/smbfs/smbfs_io.cThu Nov 22 06:45:28 2012 (r243395) +++ head/sys/fs/smbfs/smbfs_io.cThu Nov 22 08:58:29 2012 (r243396) @@ -97,7 +97,7 @@ smbfs_readvdir(struct vnode *vp, struct bzero((caddr_t)&de, DE_SIZE); de.d_reclen = DE_SIZE; de.d_fileno = (offset == 0) ? np->n_ino : - (np->n_parent ? VTOSMB(np->n_parent)->n_ino : 2); + (np->n_parent ? np->n_parentino : 2); if (de.d_fileno == 0) de.d_fileno = 0x7ffd + offset; de.d_namlen = offset + 1; Modified: head/sys/fs/smbfs/smbfs_node.c == --- head/sys/fs/smbfs/smbfs_node.c Thu Nov 22 06:45:28 2012 (r243395) +++ head/sys/fs/smbfs/smbfs_node.c Thu Nov 22 08:58:29 2012 (r243396) @@ -98,8 +98,9 @@ smbfs_vnode_cmp(struct vnode *vp, void * } static int -smbfs_node_alloc(struct mount *mp, struct vnode *dvp, - const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp) +smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *dirnm, + int dirlen, const char *name, int nmlen, char sep, + struct smbfattr *fap, struct vnode **vpp) { struct vattr vattr; struct thread *td = curthread; /* XXX */ @@ -107,7 +108,8 @@ smbfs_node_alloc(struct mount *mp, struc struct smbnode *np, *dnp; struct vnode *vp, *vp2; struct smbcmp sc; - int error; + char *p, *rpath; + int error, rplen; sc.n_parent = dvp; sc.n_nmlen = nmlen; @@ -173,18 +175,36 @@ smbfs_node_alloc(struct mount *mp, struc return (error); vp = *vpp; np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); + rplen = dirlen; + if (sep != '\0') + rplen++; + rplen += nmlen; + rpath = malloc(rplen + 1, M_SMBNODENAME, M_WAITOK); + p = rpath; + bcopy(dirnm, p, dirlen); + p += dirlen; + if (sep != '\0') + *p++ = sep; + if (name != NULL) { + bcopy(name, p, nmlen); + p += nmlen; + } + MPASS(p == rpath + rplen); lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); /* Vnode initialization */ vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; vp->v_data = np; np->n_vnode = vp; np->n_mount = VFSTOSMBFS(mp); + np->n_rpath = rpath; + np->n_rplen = rplen; np->n_nmlen = nmlen; np->n_name = smbfs_name_alloc(name, nmlen); np->n_ino = fap->fa_ino; if (dvp) { ASSERT_VOP_LOCKED(dvp, "smbfs_node_alloc"); np->n_parent = dvp; + np->n_parentino = VTOSMB(dvp)->n_ino; if (/*vp->v_type == VDIR &&*/ (dvp->v_vflag & VV_ROOT) == 0) { vref(dvp); np->n_flag |= NREFPARENT; @@ -209,14 +229,23 @@ int smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp) { - struct smbnode *np; + struct smbnode *dnp, *np; struct vnode *vp; - int error; + int error, sep; *vpp = NULL; - error = smbfs_node_alloc(mp, dvp, name, nmlen, fap, &vp); + dnp = (dvp) ? VTOSMB(dvp) : NULL; + sep = 0; + if (dnp != NULL) { + sep = SMBFS_DNP_SEP(dnp); + error = smbfs_node_alloc(mp, dvp, dnp->n_rpath, dnp->n_rplen, + name, nmlen, sep, fap, &vp); + } else + error = smbfs_node_alloc(mp, NULL, "\\", 1, name, nmlen, + sep, fap, &vp); if (error) return error; + MPASS(vp != NULL); np = VTOSMB(vp); if (fap) smbfs_attr_cacheenter(vp, fap); @@ -256,6 +285,8 @@
svn commit: r243397 - head/sys/fs/smbfs
Author: davide Date: Thu Nov 22 09:13:45 2012 New Revision: 243397 URL: http://svnweb.freebsd.org/changeset/base/243397 Log: - Remove reset of vpp pointer in some places as long as it's not really useful and has the side effect of obfuscating the code a bit. - Remove spurious references to simple_lock. Reported by: attilio [1] Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs.h head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_vfsops.c Modified: head/sys/fs/smbfs/smbfs.h == --- head/sys/fs/smbfs/smbfs.h Thu Nov 22 08:58:29 2012(r243396) +++ head/sys/fs/smbfs/smbfs.h Thu Nov 22 09:13:45 2012(r243397) @@ -79,7 +79,6 @@ struct smbmount { uint64_tsm_flags; longsm_nextino; struct smb_share * sm_share; -/* struct simplelock sm_npslock;*/ struct smbnode *sm_npstack[SMBFS_MAXPATHCOMP]; int sm_caseopt; int sm_didrele; Modified: head/sys/fs/smbfs/smbfs_node.c == --- head/sys/fs/smbfs/smbfs_node.c Thu Nov 22 08:58:29 2012 (r243396) +++ head/sys/fs/smbfs/smbfs_node.c Thu Nov 22 09:13:45 2012 (r243397) @@ -114,7 +114,6 @@ smbfs_node_alloc(struct mount *mp, struc sc.n_parent = dvp; sc.n_nmlen = nmlen; sc.n_name = name; - *vpp = NULL; if (smp->sm_root != NULL && dvp == NULL) { SMBERROR("do not allocate root vnode twice!\n"); return EINVAL; @@ -136,7 +135,6 @@ smbfs_node_alloc(struct mount *mp, struc vprint("smbfs_node_alloc: dead parent vnode", dvp); return EINVAL; } - *vpp = NULL; error = vfs_hash_get(mp, smbfs_hash(name, nmlen), LK_EXCLUSIVE, td, vpp, smbfs_vnode_cmp, &sc); if (error) @@ -233,7 +231,6 @@ smbfs_nget(struct mount *mp, struct vnod struct vnode *vp; int error, sep; - *vpp = NULL; dnp = (dvp) ? VTOSMB(dvp) : NULL; sep = 0; if (dnp != NULL) { Modified: head/sys/fs/smbfs/smbfs_vfsops.c == --- head/sys/fs/smbfs/smbfs_vfsops.cThu Nov 22 08:58:29 2012 (r243396) +++ head/sys/fs/smbfs/smbfs_vfsops.cThu Nov 22 09:13:45 2012 (r243397) @@ -207,7 +207,6 @@ smbfs_mount(struct mount *mp) vfs_flagopt(mp->mnt_optnew, "nolong", &smp->sm_flags, SMBFS_MOUNT_NO_LONG); -/* simple_lock_init(&smp->sm_npslock);*/ pc = mp->mnt_stat.f_mntfromname; pe = pc + sizeof(mp->mnt_stat.f_mntfromname); bzero(pc, MNAMELEN); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243398 - head/share/man/man5
Author: pluknet Date: Thu Nov 22 09:56:13 2012 New Revision: 243398 URL: http://svnweb.freebsd.org/changeset/base/243398 Log: core(5) references sysctl debug.num_cores, but it is really debug.ncores. PR: docs/173831 MFC after:1 week Modified: head/share/man/man5/core.5 Modified: head/share/man/man5/core.5 == --- head/share/man/man5/core.5 Thu Nov 22 09:13:45 2012(r243397) +++ head/share/man/man5/core.5 Thu Nov 22 09:56:13 2012(r243398) @@ -32,7 +32,7 @@ .\" @(#)core.5 8.3 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 22, 2010 +.Dd November 22, 2012 .Dt CORE 5 .Os .Sh NAME @@ -78,7 +78,7 @@ name: Machine hostname. .It Em \&%I An index starting at zero until the sysctl -.Em debug.num_cores +.Em debug.ncores is reached. This can be useful for limiting the number of corefiles generated by a particular process. .It Em \&%N ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243399 - head/share/man/man5
Author: pluknet Date: Thu Nov 22 10:24:30 2012 New Revision: 243399 URL: http://svnweb.freebsd.org/changeset/base/243399 Log: [mdoc] remove hard sentence breaks. MFC after:3 days Modified: head/share/man/man5/core.5 Modified: head/share/man/man5/core.5 == --- head/share/man/man5/core.5 Thu Nov 22 09:56:13 2012(r243398) +++ head/share/man/man5/core.5 Thu Nov 22 10:24:30 2012(r243399) @@ -79,7 +79,8 @@ Machine hostname. .It Em \&%I An index starting at zero until the sysctl .Em debug.ncores -is reached. This can be useful for limiting the number of corefiles +is reached. +This can be useful for limiting the number of corefiles generated by a particular process. .It Em \&%N process name. @@ -117,9 +118,11 @@ When COMPRESS_USER_CORES is included the if core files will be compressed: .Bl -tag -width "kern.compress_user_cores_gzlevel" -compact -offset "12345" .It Em kern.compress_user_cores_gzlevel -Gzip compression level. Defaults to -1. +Gzip compression level. +Defaults to -1. .It Em kern.compress_user_cores -Actually compress user cores. Core files will have the suffix +Actually compress user cores. +Core files will have the suffix .Em .gz appended to them. .El ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243400 - head/sys/kern
Author: avg Date: Thu Nov 22 10:36:10 2012 New Revision: 243400 URL: http://svnweb.freebsd.org/changeset/base/243400 Log: remove vop_lookup_pre and vop_lookup_post Suggested by: kib MFC after:5 days Modified: head/sys/kern/vfs_subr.c head/sys/kern/vnode_if.src Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cThu Nov 22 10:24:30 2012(r243399) +++ head/sys/kern/vfs_subr.cThu Nov 22 10:36:10 2012(r243400) @@ -4095,16 +4095,6 @@ vop_strategy_pre(void *ap) } void -vop_lookup_pre(void *ap) -{ -} - -void -vop_lookup_post(void *ap, int rc) -{ -} - -void vop_lock_pre(void *ap) { #ifdef DEBUG_VFS_LOCKS Modified: head/sys/kern/vnode_if.src == --- head/sys/kern/vnode_if.src Thu Nov 22 10:24:30 2012(r243399) +++ head/sys/kern/vnode_if.src Thu Nov 22 10:36:10 2012(r243400) @@ -65,8 +65,6 @@ vop_islocked { %% lookup dvp L L L %% lookup vpp - L - -%! lookup pre vop_lookup_pre -%! lookup postvop_lookup_post # XXX - the lookup locking protocol defies simple description and depends # on the flags and operation fields in the (cnp) structure. Note ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243404 - head/sys/dev/acpica
Author: avg Date: Thu Nov 22 14:40:26 2012 New Revision: 243404 URL: http://svnweb.freebsd.org/changeset/base/243404 Log: acpi_cpu: use fixed resource ids for cx state i/o resources ... instead of the ever increasing ones. Also, do free old resources when allocating new ones when cx states change. Tested by:Tom Lislegaard Obtained from:jkim MFC after:1 week Modified: head/sys/dev/acpica/acpi_cpu.c Modified: head/sys/dev/acpica/acpi_cpu.c == --- head/sys/dev/acpica/acpi_cpu.c Thu Nov 22 13:51:58 2012 (r243403) +++ head/sys/dev/acpica/acpi_cpu.c Thu Nov 22 14:40:26 2012 (r243404) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -68,6 +69,7 @@ struct acpi_cx { uint32_ttrans_lat; /* Transition latency (usec). */ uint32_tpower; /* Power consumed (mW). */ int res_type; /* Resource type for p_lvlx. */ +int res_rid; /* Resource ID for p_lvlx. */ }; #define MAX_CX_STATES 8 @@ -91,7 +93,6 @@ struct acpi_cpu_softc { int cpu_cx_lowest; int cpu_cx_lowest_lim; charcpu_cx_supported[64]; -int cpu_rid; }; struct acpi_cpu_device { @@ -648,10 +649,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp gas.BitWidth = 8; if (AcpiGbl_FADT.C2Latency <= 100) { gas.Address = sc->cpu_p_blk + 4; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, + cx_ptr->res_rid = 0; + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { - sc->cpu_rid++; cx_ptr->type = ACPI_STATE_C2; cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency; cx_ptr++; @@ -665,10 +666,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp /* Validate and allocate resources for C3 (P_LVL3). */ if (AcpiGbl_FADT.C3Latency <= 1000 && !(cpu_quirks & CPU_QUIRK_NO_C3)) { gas.Address = sc->cpu_p_blk + 5; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, &gas, - &cx_ptr->p_lvlx, RF_SHAREABLE); + cx_ptr->res_rid = 1; + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, + &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { - sc->cpu_rid++; cx_ptr->type = ACPI_STATE_C3; cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency; cx_ptr++; @@ -770,19 +771,18 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s break; } -#ifdef notyet /* Free up any previous register. */ if (cx_ptr->p_lvlx != NULL) { - bus_release_resource(sc->cpu_dev, 0, 0, cx_ptr->p_lvlx); + bus_release_resource(sc->cpu_dev, cx_ptr->res_type, cx_ptr->res_rid, + cx_ptr->p_lvlx); cx_ptr->p_lvlx = NULL; } -#endif /* Allocate the control register for C2 or C3. */ - acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &sc->cpu_rid, + cx_ptr->res_rid = sc->cpu_cx_count; + acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &cx_ptr->res_rid, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx) { - sc->cpu_rid++; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: Got C%d - %d latency\n", device_get_unit(sc->cpu_dev), cx_ptr->type, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r243310 - head/share/mk
Jung-uk Kim writes: > Author: jkim > Date: Mon Nov 19 21:58:14 2012 > New Revision: 243310 > URL: http://svnweb.freebsd.org/changeset/base/243310 > > Log: > Add x86 CPUs supported by clang on head. > > Reviewed by:arch (silence) > X-MFC: r242624 No penryn? My core2 supports sse41. $ clang -v -march=native foo.c ... -target-cpu penryn ... $ gcc47 -v -march=native foo.c ... -march=core2 ... $ clang -march=penryn foo.c $ gcc47 -march=penryn foo.c foo.c:1:0: error: bad value (penryn) for -march= switch $ gcc47 -march=core2 -dM -E -http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243419 - in head: contrib/wpa/src/eap_server sys/compat/linux
Author: cperciva Date: Fri Nov 23 01:48:31 2012 New Revision: 243419 URL: http://svnweb.freebsd.org/changeset/base/243419 Log: MFS security patches which seem to have accidentally not reached HEAD: Fix insufficient message length validation for EAP-TLS messages. Fix Linux compatibility layer input validation error. Security: FreeBSD-SA-12:07.hostapd Security: FreeBSD-SA-12:08.linux Security: CVE-2012-4445, CVE-2012-4576 With hat: so@ Modified: head/contrib/wpa/src/eap_server/eap_server_tls_common.c head/sys/compat/linux/linux_ioctl.c Modified: head/contrib/wpa/src/eap_server/eap_server_tls_common.c == --- head/contrib/wpa/src/eap_server/eap_server_tls_common.c Thu Nov 22 23:15:38 2012(r243418) +++ head/contrib/wpa/src/eap_server/eap_server_tls_common.c Fri Nov 23 01:48:31 2012(r243419) @@ -225,6 +225,14 @@ static int eap_server_tls_process_fragme return -1; } + if (len > message_length) { + wpa_printf(MSG_INFO, "SSL: Too much data (%d bytes) in " + "first fragment of frame (TLS Message " + "Length %d bytes)", + (int) len, (int) message_length); + return -1; + } + data->tls_in = wpabuf_alloc(message_length); if (data->tls_in == NULL) { wpa_printf(MSG_DEBUG, "SSL: No memory for message"); Modified: head/sys/compat/linux/linux_ioctl.c == --- head/sys/compat/linux/linux_ioctl.c Thu Nov 22 23:15:38 2012 (r243418) +++ head/sys/compat/linux/linux_ioctl.c Fri Nov 23 01:48:31 2012 (r243419) @@ -2260,8 +2260,9 @@ again: ifc.ifc_len = valid_len; sbuf_finish(sb); - memcpy(PTRIN(ifc.ifc_buf), sbuf_data(sb), ifc.ifc_len); - error = copyout(&ifc, uifc, sizeof(ifc)); + error = copyout(sbuf_data(sb), PTRIN(ifc.ifc_buf), ifc.ifc_len); + if (error == 0) + error = copyout(&ifc, uifc, sizeof(ifc)); sbuf_delete(sb); CURVNET_RESTORE(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243420 - head/sys/boot/fdt/dts
Author: gonzo Date: Fri Nov 23 03:24:52 2012 New Revision: 243420 URL: http://svnweb.freebsd.org/changeset/base/243420 Log: Make FDT blob compatible with Raspberry Pi firmware. Rasperry Pi firmware has a set of hardcoded pathes it uses to fill FDT with system-specific information like display resolution, memory size, UART and SDHCI clocks, ethernet MAC address. Handle two of them: - Add placeholder for ethernet MAC address - Move display node out of "axi" node Modified: head/sys/boot/fdt/dts/bcm2835-rpi-b.dts Modified: head/sys/boot/fdt/dts/bcm2835-rpi-b.dts == --- head/sys/boot/fdt/dts/bcm2835-rpi-b.dts Fri Nov 23 01:48:31 2012 (r243419) +++ head/sys/boot/fdt/dts/bcm2835-rpi-b.dts Fri Nov 23 03:24:52 2012 (r243420) @@ -478,26 +478,37 @@ interrupt-parent = <&intc>; #address-cells = <1>; #size-cells = <0>; + hub { + compatible = "usb,hub", "usb,device"; + reg = <0x0001>; + #address-cells = <1>; + #size-cells = <0>; + ethernet { + compatible = "net,ethernet", "usb,device"; + reg = <0x0001>; + mac-address = [00 00 00 00 00 00]; + }; + }; }; - display { - compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb"; - - broadcom,vc-mailbox = <&vc_mbox>; - broadcom,vc-channel = <1>; - - broadcom,width = <0>; /* Set by VideoCore */ - broadcom,height = <0>; /* Set by VideoCore */ - broadcom,depth = <0>; /* Set by VideoCore */ - }; }; - memory { device_type = "memory"; reg = <0 0x0800>; /* 128MB */ }; + display { + compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb"; + + broadcom,vc-mailbox = <&vc_mbox>; + broadcom,vc-channel = <1>; + + broadcom,width = <0>; /* Set by VideoCore */ + broadcom,height = <0>; /* Set by VideoCore */ + broadcom,depth = <0>; /* Set by VideoCore */ + }; + leds { compatible = "gpio-leds"; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243421 - head/sys/dev/usb/net
Author: gonzo Date: Fri Nov 23 03:34:12 2012 New Revision: 243421 URL: http://svnweb.freebsd.org/changeset/base/243421 Log: Look for MAC address in FDT tree nodes that are usb network devices and have either "mac-address" or "local-mac-addrress" property. Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c == --- head/sys/dev/usb/net/if_smsc.c Fri Nov 23 03:24:52 2012 (r243420) +++ head/sys/dev/usb/net/if_smsc.c Fri Nov 23 03:34:12 2012 (r243421) @@ -82,6 +82,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_platform.h" + +#ifdef FDT +#include +#include +#include +#endif + #include #include #include @@ -1516,6 +1524,64 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd return (rc); } +#ifdef FDT +/** + * Get MAC address from FDT blob. Firmware or loader should fill + * mac-address or local-mac-address property Returns 0 if MAC address + * obtained, error code otherwise + */ +static int +smsc_fdt_find_mac(unsigned char *mac) +{ + phandle_t child, parent, root; + int len; + + root = OF_finddevice("/"); + len = 0; + parent = root; + + /* Traverse through entire tree to find nodes usb ethernet nodes */ + for (child = OF_child(parent); child != 0; child = OF_peer(child)) { + + /* Find a 'leaf'. Start the search from this node. */ + while (OF_child(child)) { + parent = child; + child = OF_child(child); + } + + if (fdt_is_compatible(child, "net,ethernet") && + fdt_is_compatible(child, "usb,device")) { + + /* Check if there is property */ + if ((len = OF_getproplen(child, "local-mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(child, "local-mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + + if ((len = OF_getproplen(child, "mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(child, "mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + } + + if (OF_peer(child) == 0) { + /* No more siblings. */ + child = parent; + parent = OF_parent(child); + } + } + + return (ENXIO); +} +#endif /** * smsc_attach_post - Called after the driver attached to the USB interface @@ -1563,8 +1629,11 @@ smsc_attach_post(struct usb_ether *ue) if (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr)) { err = smsc_eeprom_read(sc, 0x01, sc->sc_ue.ue_eaddr, ETHER_ADDR_LEN); +#ifdef FDT + if ((err != 0) || (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr))) + err = smsc_fdt_find_mac(sc->sc_ue.ue_eaddr); +#endif if ((err != 0) || (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr))) { - read_random(sc->sc_ue.ue_eaddr, ETHER_ADDR_LEN); sc->sc_ue.ue_eaddr[0] &= ~0x01; /* unicast */ sc->sc_ue.ue_eaddr[0] |= 0x02; /* locally administered */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243422 - head/sys/dev/gxemul/cons
Author: jmallett Date: Fri Nov 23 04:28:13 2012 New Revision: 243422 URL: http://svnweb.freebsd.org/changeset/base/243422 Log: Use MIPS_PHYS_TO_DIRECT_UNCACHED rather than a homegrown version which is not compatible with 32-bit kernels. Modified: head/sys/dev/gxemul/cons/gxemul_cons.c Modified: head/sys/dev/gxemul/cons/gxemul_cons.c == --- head/sys/dev/gxemul/cons/gxemul_cons.c Fri Nov 23 03:34:12 2012 (r243421) +++ head/sys/dev/gxemul/cons/gxemul_cons.c Fri Nov 23 04:28:13 2012 (r243422) @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #defineGC_LOCK_INIT() mtx_init(&gc_lock, "gc_lock", NULL, MTX_SPIN) #defineGC_LOCK() do { \ @@ -97,8 +99,6 @@ static void gxemul_cons_timeout(void *) * XXXRW: Should be using FreeBSD's bus routines here, but they are not * available until later in the boot. */ -#defineMIPS_XKPHYS_UNCACHED_BASE 0x9000 - typedefuint64_tpaddr_t; typedefuint64_tvaddr_t; @@ -106,7 +106,7 @@ static inline vaddr_t mips_phys_to_uncached(paddr_t phys) { - return (phys | MIPS_XKPHYS_UNCACHED_BASE); + return (MIPS_PHYS_TO_DIRECT_UNCACHED(phys)); } static inline uint8_t ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243423 - head/sys/arm/broadcom/bcm2835
Author: gonzo Date: Fri Nov 23 04:30:54 2012 New Revision: 243423 URL: http://svnweb.freebsd.org/changeset/base/243423 Log: Multiple fixes for BCM2835 framebuffer - Get resolution settings from FDT blob - Properly handle 24 and 16 bits per pixel - Add colors support for text console Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c == --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Nov 23 04:28:13 2012 (r243422) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Nov 23 04:30:54 2012 (r243423) @@ -68,8 +68,35 @@ __FBSDID("$FreeBSD$"); #defineBCMFB_FONT_HEIGHT 16 +struct argb { + uint8_t a; + uint8_t r; + uint8_t g; + uint8_t b; +}; + +static struct argb bcmfb_palette[16] = { + {0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0xaa}, + {0x00, 0x00, 0xaa, 0x00}, + {0x00, 0x00, 0xaa, 0xaa}, + {0x00, 0xaa, 0x00, 0x00}, + {0x00, 0xaa, 0x00, 0xaa}, + {0x00, 0xaa, 0x55, 0x00}, + {0x00, 0xaa, 0xaa, 0xaa}, + {0x00, 0x55, 0x55, 0x55}, + {0x00, 0x55, 0x55, 0xff}, + {0x00, 0x55, 0xff, 0x55}, + {0x00, 0x55, 0xff, 0xff}, + {0x00, 0xff, 0x55, 0x55}, + {0x00, 0xff, 0x55, 0xff}, + {0x00, 0xff, 0xff, 0x55}, + {0x00, 0xff, 0xff, 0xff} +}; + #define FB_WIDTH 640 #define FB_HEIGHT 480 +#define FB_DEPTH 24 struct bcm_fb_config { uint32_txres; @@ -107,6 +134,7 @@ struct video_adapter_softc { unsigned intheight; unsigned intwidth; + unsigned intdepth; unsigned intstride; unsigned intxmargin; @@ -126,6 +154,8 @@ static struct video_adapter_softc va_sof static int bcm_fb_probe(device_t); static int bcm_fb_attach(device_t); static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err); +static void bcmfb_update_margins(video_adapter_t *adp); +static int bcmfb_configure(int); static void bcm_fb_init(void *arg) @@ -134,15 +164,34 @@ bcm_fb_init(void *arg) struct video_adapter_softc *va_sc = &va_softc; int err; volatile struct bcm_fb_config* fb_config = sc->fb_config; + phandle_t node; + pcell_t cell; + + node = ofw_bus_get_node(sc->dev); + + fb_config->xres = 0; + fb_config->yres = 0; + fb_config->bpp = 0; + + if ((OF_getprop(node, "broadcom,width", &cell, sizeof(cell))) > 0) + fb_config->xres = (int)fdt32_to_cpu(cell); + if (fb_config->xres == 0) + fb_config->xres = FB_WIDTH; + + if ((OF_getprop(node, "broadcom,height", &cell, sizeof(cell))) > 0) + fb_config->yres = (uint32_t)fdt32_to_cpu(cell); + if (fb_config->yres == 0) + fb_config->yres = FB_HEIGHT; + + if ((OF_getprop(node, "broadcom,depth", &cell, sizeof(cell))) > 0) + fb_config->bpp = (uint32_t)fdt32_to_cpu(cell); + if (fb_config->bpp == 0) + fb_config->bpp = FB_DEPTH; - /* TODO: replace it with FDT stuff */ - fb_config->xres = FB_WIDTH; - fb_config->yres = FB_HEIGHT; fb_config->vxres = 0; fb_config->vyres = 0; fb_config->xoffset = 0; fb_config->yoffset = 0; - fb_config->bpp = 24; fb_config->base = 0; fb_config->pitch = 0; fb_config->screen_size = 0; @@ -154,7 +203,7 @@ bcm_fb_init(void *arg) bus_dmamap_sync(sc->dma_tag, sc->dma_map, BUS_DMASYNC_POSTREAD); - if (err == 0) { + if (fb_config->base != 0) { device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n", fb_config->xres, fb_config->yres, fb_config->vxres, fb_config->vyres, @@ -166,14 +215,19 @@ bcm_fb_init(void *arg) fb_config->pitch, fb_config->base, fb_config->screen_size); - if (fb_config->base) { - va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size); - va_sc->fb_size = fb_config->screen_size; - va_sc->stride = fb_config->pitch; - } + va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size); + va_sc->fb_size = fb_config->screen_size; + va_sc->depth = fb_config->bpp; + va_sc->stride = fb_config->pitch; + + va_sc->width = fb_config->xres; + va_sc->height = fb_config->yres; + bcmfb_update_margins(&va_sc->va); } - else + else { device_printf(sc->dev, "Failed to set framebuffer info\n"); + return; + } config_intrhook_disestablish(&sc-
svn commit: r243424 - in head/sys/dev/ath/ath_hal: . ar5212 ar5416
Author: adrian Date: Fri Nov 23 05:32:24 2012 New Revision: 243424 URL: http://svnweb.freebsd.org/changeset/base/243424 Log: Implement a HAL method to set a 64 bit TSF value. TODO: implement it (and test) for the AR5210/AR5211. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Modified: head/sys/dev/ath/ath_hal/ah.h == --- head/sys/dev/ath/ath_hal/ah.h Fri Nov 23 04:30:54 2012 (r243423) +++ head/sys/dev/ath/ath_hal/ah.h Fri Nov 23 05:32:24 2012 (r243424) @@ -1388,6 +1388,7 @@ struct ath_hal { void __ahdecl(*ah_gpioSetIntr)(struct ath_hal*, u_int, uint32_t); uint32_t __ahdecl(*ah_getTsf32)(struct ath_hal*); uint64_t __ahdecl(*ah_getTsf64)(struct ath_hal*); + void __ahdecl(*ah_setTsf64)(struct ath_hal *, uint64_t); void __ahdecl(*ah_resetTsf)(struct ath_hal*); HAL_BOOL __ahdecl(*ah_detectCardPresent)(struct ath_hal*); void __ahdecl(*ah_updateMibCounters)(struct ath_hal*, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c == --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Fri Nov 23 04:30:54 2012(r243423) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Fri Nov 23 05:32:24 2012(r243424) @@ -111,6 +111,7 @@ static const struct ath_hal_private ar52 .ah_gpioSetIntr = ar5212GpioSetIntr, .ah_getTsf32= ar5212GetTsf32, .ah_getTsf64= ar5212GetTsf64, + .ah_setTsf64= ar5212SetTsf64, .ah_resetTsf= ar5212ResetTsf, .ah_detectCardPresent = ar5212DetectCardPresent, .ah_updateMibCounters = ar5212UpdateMibCounters, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c == --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Nov 23 04:30:54 2012(r243423) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Nov 23 05:32:24 2012(r243424) @@ -142,6 +142,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_gpioSet = ar5416GpioSet; ah->ah_gpioSetIntr = ar5416GpioSetIntr; ah->ah_getTsf64 = ar5416GetTsf64; + ah->ah_setTsf64 = ar5416SetTsf64; ah->ah_resetTsf = ar5416ResetTsf; ah->ah_getRfGain= ar5416GetRfgain; ah->ah_setAntennaSwitch = ar5416SetAntennaSwitch; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c == --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Nov 23 04:30:54 2012(r243423) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Nov 23 05:32:24 2012(r243424) @@ -131,6 +131,21 @@ ar5416GetTsf64(struct ath_hal *ah) void ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64) { + /* XXX check if this is correct! */ +#if 0 + int i; + uint32_t v; + + for (i = 0; i < 10; i++) { + v = OS_REG_READ(ah, AR_SLP32_MODE); + if ((v & AR_SLP32_TSF_WRITE_STATUS) == 0) + break; + OS_DELAY(10); + } + if (i == 10) + ath_hal_printf(ah, "%s: couldn't slew things right!\n", __func__); +#endif + OS_REG_WRITE(ah, AR_TSF_L32, tsf64 & 0x); OS_REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0x); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243425 - head/sys/dev/ath
Author: adrian Date: Fri Nov 23 05:33:01 2012 New Revision: 243425 URL: http://svnweb.freebsd.org/changeset/base/243425 Log: Add the HAL wrapper for settsf64. Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h == --- head/sys/dev/ath/if_athvar.hFri Nov 23 05:32:24 2012 (r243424) +++ head/sys/dev/ath/if_athvar.hFri Nov 23 05:33:01 2012 (r243425) @@ -969,6 +969,8 @@ voidath_intr(void *); OS_REG_READ(_ah, AR_TSF_L32) #defineath_hal_gettsf64(_ah) \ ((*(_ah)->ah_getTsf64)((_ah))) +#defineath_hal_settsf64(_ah, _val) \ + ((*(_ah)->ah_setTsf64)((_ah), (_val))) #defineath_hal_resettsf(_ah) \ ((*(_ah)->ah_resetTsf)((_ah))) #defineath_hal_rxena(_ah) \ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243426 - head/sys/dev/ath
Author: adrian Date: Fri Nov 23 05:38:38 2012 New Revision: 243426 URL: http://svnweb.freebsd.org/changeset/base/243426 Log: Fix up the nexttbtt -> TSF delta calculation to not wrap ridiculously on the 802.11n NICs. The 802.11n NICs return a TBTT value that continues far past the 16 bit HAL_BEACON_PERIOD time (in TU.) The code would constrain nextslot to HAL_BEACON_PERIOD, but it wasn't constraining nexttbtt - the pre-11n NICs would only return TU values from 0 -> HAL_BEACON_PERIOD. Thus, when nexttbtt exceeded 64 milliseconds, it would not wrap (but nextslot did) which lead to a huge tsfdelta. So until the slot calculation is converted to work in TSF rather than a mix of TSF and TU, "make" the nexttbtt values match the TU assumptions for pre-11n NICs. This fixes the crazy deltatsf calculations but it doesn't fix the non-convergent tsfdelta issue. That'll be fixed in a subsequent commit. Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c == --- head/sys/dev/ath/if_ath_tdma.c Fri Nov 23 05:33:01 2012 (r243425) +++ head/sys/dev/ath/if_ath_tdma.c Fri Nov 23 05:38:38 2012 (r243426) @@ -336,7 +336,21 @@ ath_tdma_update(struct ieee80211_node *n * adjustments are done by pulling the TSF forward and possibly * rewriting the beacon timers. */ - nexttbtt = ath_hal_getnexttbtt(ah); + /* +* The logic here assumes the nexttbtt counter is in TSF +* but the prr-11n NICs are in TU. The HAL shifts them +* to TSF but there's two important differences: +* +* + The TU->TSF values have 0's for the low 9 bits, and +* + The counter wraps at TU_TO_TSF(HAL_BEACON_PERIOD + 1) for +* the pre-11n NICs, but not for the 11n NICs. +* +* So for now, just make sure the nexttbtt value we get +* matches the second issue or once nexttbtt exceeds this +* value, tsfdelta ends up becoming very negative and all +* of the adjustments get very messed up. +*/ + nexttbtt = ath_hal_getnexttbtt(ah) % (TU_TO_TSF(HAL_BEACON_PERIOD + 1)); tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD + 1)) - nexttbtt); DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243427 - head/sys/dev/ath
Author: adrian Date: Fri Nov 23 05:52:22 2012 New Revision: 243427 URL: http://svnweb.freebsd.org/changeset/base/243427 Log: Use a 64 bit TSF write to update the TSF adjust, rather than a 32 bit TSF write. The TSF_L32 update is fine for the AR5413 (and later, I guess) 11abg NICs however on the 11n NICs this didn't work. The TSF writes were causing a much larger time to be skipped, leading to the timing to never converge. I've tested this 64 bit TSF read, adjust and write on both the 11n NICs and the AR5413 NIC I've been using for testing. It works fine on each. This patch allows the AR5416/AR9280 to be used as a TDMA member. I don't yet know why the AR9280 is ~7uS accurate rather than ~3uS; I'll look into it soon. Tested: * AR5413, TDMA slave (~ 3us accuracy) * AR5416, TDMA slave (~ 3us accuracy) * AR9280, TDMA slave (~ 7us accuracy) Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c == --- head/sys/dev/ath/if_ath_tdma.c Fri Nov 23 05:38:38 2012 (r243426) +++ head/sys/dev/ath/if_ath_tdma.c Fri Nov 23 05:52:22 2012 (r243427) @@ -406,7 +406,11 @@ ath_tdma_update(struct ieee80211_node *n sc->sc_stats.ast_tdma_timers++; } if (tsfdelta > 0) { - ath_hal_adjusttsf(ah, tsfdelta); + uint64_t tsf; + + /* XXX should just teach ath_hal_adjusttsf() to do this */ + tsf = ath_hal_gettsf64(ah); + ath_hal_settsf64(ah, tsf + tsfdelta); sc->sc_stats.ast_tdma_tsf++; } ath_tdma_beacon_send(sc, vap); /* prepare response */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r243434 - head/sys/arm/conf
Author: gonzo Date: Fri Nov 23 07:58:12 2012 New Revision: 243434 URL: http://svnweb.freebsd.org/changeset/base/243434 Log: Now that we have working USB keyboard add ukbd to the syscons-enabling part of config Modified: head/sys/arm/conf/RPI-B Modified: head/sys/arm/conf/RPI-B == --- head/sys/arm/conf/RPI-B Fri Nov 23 07:35:50 2012(r243433) +++ head/sys/arm/conf/RPI-B Fri Nov 23 07:58:12 2012(r243434) @@ -79,6 +79,7 @@ devicepty # device kbdmux # options SC_DFLT_FONT# compile font in # makeoptions SC_DFLT_FONT=cp437 +# device ukbd device sdhci device mmc ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"