svn commit: r317888 - head/contrib/libc++/include
Author: dim Date: Sat May 6 21:43:55 2017 New Revision: 317888 URL: https://svnweb.freebsd.org/changeset/base/317888 Log: Pull in r302362 from upstream libc++ trunk (by me): Ensure showbase does not overflow do_put buffers Summary: In https://bugs.freebsd.org/207918, Daniel McRobb describes how using std::showbase with ostreams can cause truncation of unsigned long long when output format is octal. In fact, this can even happen with unsigned int and unsigned long. To ensure this does not happen, add one additional character to the do_put buffers if std::showbase is on. Also add a test case. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D32670 PR: 207918 MFC after:3 days Modified: head/contrib/libc++/include/locale Modified: head/contrib/libc++/include/locale == --- head/contrib/libc++/include/locale Sat May 6 20:32:27 2017 (r317887) +++ head/contrib/libc++/include/locale Sat May 6 21:43:55 2017 (r317888) @@ -1399,6 +1399,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1425,6 +1426,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1451,6 +1453,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1477,6 +1480,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317887 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/ofw/libofw sys/boot/uboot/lib
Author: tsoome Date: Sat May 6 20:32:27 2017 New Revision: 317887 URL: https://svnweb.freebsd.org/changeset/base/317887 Log: loader: network read rework The current read from network is working from up to down - we have some protocol needing the data from the network, so we build the buffer space for that protocol, add the extra space for headers and pass this buffer down to be filled by nif get call in hope, we have guessed the incoming packet size right. Amazingly enough this approach mostly does work, but not always... So, this update does work from down to up - we allocate buffer (based on MTU or frame size info), fill it up, and pass on for upper layers. The obvious problem is that when we should free the buffer - if at all. In the current implementation the upper layer will free the packet on error or when the packet is no longer needed. While working on the issue, the additional issue did pop up - the bios implementation does not have generic get/put interface but is using pxe udpsend/udpreceive instead. So the udp calls are gone and undi interface is implemented instead. Which in turn means slight other changes as we do not need to have duplicated pxe implementation and can just use dev_net. To align packet content, the actual read from nic is using shifted buffer by ETHER_ALIGN (2). Reviewed by: bapt Differential Revision:https://reviews.freebsd.org/D10232 Modified: head/lib/libstand/arp.c head/lib/libstand/bootp.c head/lib/libstand/bootp.h head/lib/libstand/bootparam.c head/lib/libstand/ether.c head/lib/libstand/net.c head/lib/libstand/net.h head/lib/libstand/netif.c head/lib/libstand/netif.h head/lib/libstand/nfs.c head/lib/libstand/rarp.c head/lib/libstand/rpc.c head/lib/libstand/rpc.h head/lib/libstand/tftp.c head/lib/libstand/udp.c head/sys/boot/common/dev_net.c head/sys/boot/efi/libefi/efinet.c head/sys/boot/efi/libefi/time.c head/sys/boot/efi/loader/Makefile head/sys/boot/i386/libi386/pxe.c head/sys/boot/i386/libi386/pxe.h head/sys/boot/i386/loader/Makefile head/sys/boot/ofw/libofw/ofw_net.c head/sys/boot/uboot/lib/net.c Modified: head/lib/libstand/arp.c == --- head/lib/libstand/arp.c Sat May 6 19:23:58 2017(r317886) +++ head/lib/libstand/arp.c Sat May 6 20:32:27 2017(r317887) @@ -65,17 +65,16 @@ int arp_num = 1; /* Local forwards */ static ssize_t arpsend(struct iodesc *, void *, size_t); -static ssize_t arprecv(struct iodesc *, void *, size_t, time_t); +static ssize_t arprecv(struct iodesc *, void **, void **, time_t); /* Broadcast an ARP packet, asking who has addr on interface d */ u_char * -arpwhohas(d, addr) - struct iodesc *d; - struct in_addr addr; +arpwhohas(struct iodesc *d, struct in_addr addr) { int i; struct ether_arp *ah; struct arp_list *al; + void *pkt; struct { struct ether_header eh; struct { @@ -83,13 +82,6 @@ arpwhohas(d, addr) u_char pad[18]; /* 60 - sizeof(...) */ } data; } wbuf; - struct { - struct ether_header eh; - struct { - struct ether_arp arp; - u_char pad[24]; /* extra space */ - } data; - } rbuf; /* Try for cached answer first */ for (i = 0, al = arp_list; i < arp_num; ++i, ++al) @@ -122,20 +114,24 @@ arpwhohas(d, addr) /* Store ip address in cache (incomplete entry). */ al->addr = addr; + pkt = NULL; + ah = NULL; i = sendrecv(d, arpsend, , sizeof(wbuf.data), - arprecv, , sizeof(rbuf.data)); + arprecv, , (void **)); if (i == -1) { panic("arp: no response for %s\n", inet_ntoa(addr)); } /* Store ethernet address in cache */ - ah = #ifdef ARP_DEBUG if (debug) { + struct ether_header *eh; + + eh = (struct ether_header *)((uintptr_t)pkt + ETHER_ALIGN); printf("arp: response from %s\n", - ether_sprintf(rbuf.eh.ether_shost)); + ether_sprintf(eh->ether_shost)); printf("arp: cacheing %s --> %s\n", inet_ntoa(addr), ether_sprintf(ah->arp_sha)); } @@ -143,14 +139,12 @@ arpwhohas(d, addr) MACPY(ah->arp_sha, al->ea); ++arp_num; + free(pkt); return (al->ea); } static ssize_t -arpsend(d, pkt, len) - struct iodesc *d; - void *pkt; - size_t len; +arpsend(struct iodesc *d, void *pkt, size_t len) { #ifdef ARP_DEBUG @@ -166,28 +160,27 @@ arpsend(d, pkt, len) * else -1 (and errno == 0) */ static ssize_t -arprecv(d, pkt, len, tleft) - struct iodesc *d; -
Re: svn commit: r317884 - head/sys/compat/linprocfs
Also I think it worths saying, I've tested this running on a X86. It was not panic'd and printed data as expected. So you mean it's possible to panic on "some" cases because of CPUID support? -- Best regards, MMokhi. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r317886 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386
On Sat, May 06, 2017 at 07:23:58PM +, Baptiste Daroussin wrote: > Author: bapt > Date: Sat May 6 19:23:58 2017 > New Revision: 317886 > URL: https://svnweb.freebsd.org/changeset/base/317886 > > Log: > distinguish NFS versus TFTP boot by rootpath > > Don't use DHCP 150 option to decide which protocol use to netboot. When > root-path includes ip address - go thru NFS, if ip address not exists in > root-path - go thru TFTP from server which ip address is in next-server. > But > there is one limitation - only one tftp server in network to provide loader > and > everything else. Does enybody use more than only one? > > Submitted by: kczekirda > Sponsored by: Oktawave > MFC after: 3 weeks > Relnote:Yes > Differential Revision: https://reviews.freebsd.org/D8740 Also reviewed and approved by: tsoome and bapt Best regards, Bapt signature.asc Description: PGP signature
Re: svn commit: r317886 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386
On Sat, May 06, 2017 at 07:23:58PM +, Baptiste Daroussin wrote: > Author: bapt > Date: Sat May 6 19:23:58 2017 > New Revision: 317886 > URL: https://svnweb.freebsd.org/changeset/base/317886 > > Log: > distinguish NFS versus TFTP boot by rootpath > > Don't use DHCP 150 option to decide which protocol use to netboot. When > root-path includes ip address - go thru NFS, if ip address not exists in > root-path - go thru TFTP from server which ip address is in next-server. > But > there is one limitation - only one tftp server in network to provide loader > and > everything else. Does enybody use more than only one? > > Submitted by: kczekirda > Sponsored by: Oktawave > MFC after: 3 weeks > Relnote:Yes > Differential Revision: https://reviews.freebsd.org/D8740 Sorry I meant: https://reviews.freebsd.org/D10603 Best regards, Bapt signature.asc Description: PGP signature
svn commit: r317886 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386
Author: bapt Date: Sat May 6 19:23:58 2017 New Revision: 317886 URL: https://svnweb.freebsd.org/changeset/base/317886 Log: distinguish NFS versus TFTP boot by rootpath Don't use DHCP 150 option to decide which protocol use to netboot. When root-path includes ip address - go thru NFS, if ip address not exists in root-path - go thru TFTP from server which ip address is in next-server. But there is one limitation - only one tftp server in network to provide loader and everything else. Does enybody use more than only one? Submitted by: kczekirda Sponsored by: Oktawave MFC after:3 weeks Relnote: Yes Differential Revision:https://reviews.freebsd.org/D8740 Modified: head/lib/libstand/bootp.c head/lib/libstand/bootp.h head/lib/libstand/globals.c head/lib/libstand/net.h head/sys/boot/common/dev_net.c head/sys/boot/i386/libi386/pxe.c Modified: head/lib/libstand/bootp.c == --- head/lib/libstand/bootp.c Sat May 6 18:35:01 2017(r317885) +++ head/lib/libstand/bootp.c Sat May 6 19:23:58 2017(r317886) @@ -148,16 +148,15 @@ bootp(sock, flag) bp->bp_vend[8] = 9; bcopy("PXEClient", >bp_vend[9], 9); bp->bp_vend[18] = TAG_PARAM_REQ; - bp->bp_vend[19] = 8; + bp->bp_vend[19] = 7; bp->bp_vend[20] = TAG_ROOTPATH; - bp->bp_vend[21] = TAG_TFTP_SERVER; - bp->bp_vend[22] = TAG_HOSTNAME; - bp->bp_vend[23] = TAG_SWAPSERVER; - bp->bp_vend[24] = TAG_GATEWAY; - bp->bp_vend[25] = TAG_SUBNET_MASK; - bp->bp_vend[26] = TAG_INTF_MTU; - bp->bp_vend[27] = TAG_SERVERID; - bp->bp_vend[28] = TAG_END; + bp->bp_vend[21] = TAG_HOSTNAME; + bp->bp_vend[22] = TAG_SWAPSERVER; + bp->bp_vend[23] = TAG_GATEWAY; + bp->bp_vend[24] = TAG_SUBNET_MASK; + bp->bp_vend[25] = TAG_INTF_MTU; + bp->bp_vend[26] = TAG_SERVERID; + bp->bp_vend[27] = TAG_END; } else bp->bp_vend[7] = TAG_END; #else @@ -438,10 +437,6 @@ vend_rfc1048(cp, len) bcopy(cp, _serverip.s_addr, sizeof(dhcp_serverip.s_addr)); } - if (tag == TAG_TFTP_SERVER) { - bcopy(cp, _addr, - sizeof(tftpip.s_addr)); - } #endif cp += size; } Modified: head/lib/libstand/bootp.h == --- head/lib/libstand/bootp.h Sat May 6 18:35:01 2017(r317885) +++ head/lib/libstand/bootp.h Sat May 6 19:23:58 2017(r317886) @@ -108,7 +108,6 @@ struct bootp { #define TAG_T2 ((unsigned char) 59) #define TAG_CLASSID((unsigned char) 60) #define TAG_CLIENTID ((unsigned char) 61) -#define TAG_TFTP_SERVER((unsigned char) 150) #endif #define TAG_END((unsigned char) 255) Modified: head/lib/libstand/globals.c == --- head/lib/libstand/globals.c Sat May 6 18:35:01 2017(r317885) +++ head/lib/libstand/globals.c Sat May 6 19:23:58 2017(r317886) @@ -32,7 +32,6 @@ structin_addr nameip; /* DNS server i struct in_addr rootip; /* root ip address */ struct in_addr swapip; /* swap ip address */ struct in_addr gateip; /* gateway ip address */ -struct in_addr tftpip; /* TFTP ip address */ n_long netmask = 0xff00; /* subnet or net mask */ u_int intf_mtu; /* interface mtu from bootp/dhcp */ interrno; /* our old friend */ Modified: head/lib/libstand/net.h == --- head/lib/libstand/net.h Sat May 6 18:35:01 2017(r317885) +++ head/lib/libstand/net.h Sat May 6 19:23:58 2017(r317886) @@ -91,7 +91,6 @@ externstruct in_addr rootip; extern struct in_addr swapip; extern struct in_addr gateip; extern struct in_addr nameip; -extern struct in_addr tftpip; extern n_long netmask; extern u_int intf_mtu; Modified: head/sys/boot/common/dev_net.c == --- head/sys/boot/common/dev_net.c Sat May 6 18:35:01 2017 (r317885) +++ head/sys/boot/common/dev_net.c Sat May 6 19:23:58 2017 (r317886) @@ -312,8 +312,11 @@ net_getparams(int sock) return (EIO); } exit: - if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) + netproto = NET_TFTP; + if
svn commit: r317885 - head/rescue/rescue
Author: bapt Date: Sat May 6 18:35:01 2017 New Revision: 317885 URL: https://svnweb.freebsd.org/changeset/base/317885 Log: Add zstd to the rescue binary Having zstd might be useful in rescue to be able to access to log files compressed by zstandard Suggested by: ian Modified: head/rescue/rescue/Makefile Modified: head/rescue/rescue/Makefile == --- head/rescue/rescue/Makefile Sat May 6 17:37:01 2017(r317884) +++ head/rescue/rescue/Makefile Sat May 6 18:35:01 2017(r317885) @@ -194,6 +194,10 @@ CRUNCH_ALIAS_less= more CRUNCH_PROGS_usr.bin+= xz CRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat +CRUNCH_PROGS_usr.bin+= zstd +CRUNCH_ALIAS_zstd= unzstd zstdcat zstdmt +CRUNCH_LIBS+= -lprivatezstd + CRUNCH_PROGS_usr.bin+= tar CRUNCH_LIBS+= -larchive .if ${MK_OPENSSL} != "no" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r317884 - head/sys/compat/linprocfs
> Executing CPUID instruction on i386 without checking for CPUID support > panics the kernel. Thanks for hint. you mean I should first check if this platform supports 0x8006 CPUID command or not? -- Best regards, MMokhi. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r317884 - head/sys/compat/linprocfs
On Sat, May 06, 2017 at 05:37:01PM +, Mahdi Mokhtari wrote: > + do_cpuid(0x8006, cache_size); Executing CPUID instruction on i386 without checking for CPUID support panics the kernel. Also, it is worth ensuring that the requested leaf is supported, otherwise nonsensical data would be printed. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317884 - head/sys/compat/linprocfs
Author: mmokhi (ports committer) Date: Sat May 6 17:37:01 2017 New Revision: 317884 URL: https://svnweb.freebsd.org/changeset/base/317884 Log: Fix linprocfs_docpuinfo() output regarding to what newer Linux apps expect Reviewed by: trasz Approved by: trasz MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D10274 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sat May 6 16:06:33 2017 (r317883) +++ head/sys/compat/linprocfs/linprocfs.c Sat May 6 17:37:01 2017 (r317884) @@ -202,8 +202,9 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) char model[128]; uint64_t freq; size_t size; + u_int cache_size[4]; int fqmhz, fqkhz; - int i; + int i, j; /* * We default the flags to include all non-conflicting flags, @@ -219,27 +220,20 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "3dnowext", "3dnow" }; + static char *power_flags[] = { + "ts", "fid", "vid", + "ttp", "tm", "stc", + "100mhzsteps", "hwpstate", "", + "cpb", "eff_freq_ro", "proc_feedback", + "acc_power", + }; + hw_model[0] = CTL_HW; hw_model[1] = HW_MODEL; model[0] = '\0'; size = sizeof(model); if (kernel_sysctl(td, hw_model, 2, , , 0, 0, 0, 0) != 0) strcpy(model, "unknown"); - for (i = 0; i < mp_ncpus; ++i) { - sbuf_printf(sb, - "processor\t: %d\n" - "vendor_id\t: %.20s\n" - "cpu family\t: %u\n" - "model\t\t: %u\n" - "model name\t: %s\n" - "stepping\t: %u\n\n", - i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), - CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING); - /* XXX per-cpu vendor / class / model / id? */ - } - - sbuf_cat(sb, "flags\t\t:"); - #ifdef __i386__ switch (cpu_vendor_id) { case CPU_VENDOR_AMD: @@ -251,20 +245,70 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) break; } #endif - - for (i = 0; i < 32; i++) - if (cpu_feature & (1 << i)) - sbuf_printf(sb, " %s", flags[i]); - sbuf_cat(sb, "\n"); - freq = atomic_load_acq_64(_freq); - if (freq != 0) { - fqmhz = (freq + 4999) / 100; - fqkhz = ((freq + 4999) / 1) % 100; + do_cpuid(0x8006, cache_size); + for (i = 0; i < mp_ncpus; ++i) { + fqmhz = 0; + fqkhz = 0; + freq = atomic_load_acq_64(_freq); + if (freq != 0) { + fqmhz = (freq + 4999) / 100; + fqkhz = ((freq + 4999) / 1) % 100; + } sbuf_printf(sb, + "processor\t: %d\n" + "vendor_id\t: %.20s\n" + "cpu family\t: %u\n" + "model\t\t: %u\n" + "model name\t: %s\n" + "stepping\t: %u\n" "cpu MHz\t\t: %d.%02d\n" - "bogomips\t: %d.%02d\n", - fqmhz, fqkhz, fqmhz, fqkhz); + "cache size\t: %d KB\n" + "physical id\t: %d\n" + "siblings\t: %d\n" + "core id\t\t: %d\n" + "cpu cores\t: %d\n" + "apicid\t\t: %d\n" + "initial apicid\t: %d\n" + "fpu\t\t: %s\n" + "fpu_exception\t: %s\n" + "cpuid level\t: %d\n" + "wp\t\t: %s\n", + i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), + CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING, + fqmhz, fqkhz, + (cache_size[2] >> 16), 0, mp_ncpus, i, mp_ncpus, + i, i, /*cpu_id & CPUID_LOCAL_APIC_ID ??*/ + (cpu_feature & CPUID_FPU) ? "yes" : "no", "yes", + CPUID_TO_FAMILY(cpu_id), "yes"); + sbuf_cat(sb, "flags\t\t:"); + for (j = 0; j < nitems(flags); j++) + if (cpu_feature & (1 << j)) + sbuf_printf(sb, " %s", flags[j]); + sbuf_cat(sb, "\n"); + sbuf_printf(sb, + "bugs\t\t: %s\n" + "bogomips\t: %d.%02d\n" + "clflush size\t: %d\n" + "cache_alignment\t: %d\n" + "address sizes\t: %d bits physical, %d bits virtual\n", +#if defined(I586_CPU) && !defined(NO_F00F_HACK) + (has_f00f_bug) ? "Intel
svn commit: r317882 - head/bin/sh
Author: jilles Date: Sat May 6 13:28:42 2017 New Revision: 317882 URL: https://svnweb.freebsd.org/changeset/base/317882 Log: sh: Update TOUR and comments for some code changes, some of them old. Also, improve some terminology in TOUR and comments. Modified: head/bin/sh/TOUR head/bin/sh/eval.c head/bin/sh/exec.c head/bin/sh/expand.c head/bin/sh/options.c Modified: head/bin/sh/TOUR == --- head/bin/sh/TOURSat May 6 11:18:36 2017(r317881) +++ head/bin/sh/TOURSat May 6 13:28:42 2017(r317882) @@ -24,7 +24,7 @@ programs is: program input files generates --- --- - -mkbuiltins builtinsbuiltins.h builtins.c +mkbuiltins builtins.defbuiltins.h builtins.c mknodes nodetypes nodes.h nodes.c mksyntax- syntax.h syntax.c mktokens- token.h @@ -108,10 +108,12 @@ The text field of a NARG structure point word. The text consists of ordinary characters and a number of special codes defined in parser.h. The special codes are: -CTLVAR Variable substitution -CTLENDVAR End of variable substitution +CTLVAR Parameter expansion +CTLENDVAR End of parameter expansion CTLBACKQCommand substitution CTLBACKQ|CTLQUOTE Command substitution inside double quotes +CTLARI Arithmetic expansion +CTLENDARI End of arithmetic expansion CTLESC Escape next character A variable substitution contains the following elements: @@ -130,18 +132,31 @@ stitution. The possible types are: VSQUESTION|VSNUL${var:?text} VSASSIGN${var=text} VSASSIGN|VSNUL ${var:=text} +VSTRIMLEFT ${var#text} +VSTRIMLEFTMAX ${var##text} +VSTRIMRIGHT ${var%text} +VSTRIMRIGHTMAX ${var%%text} +VSLENGTH${#var} +VSERROR delayed error In addition, the type field will have the VSQUOTE flag set if the -variable is enclosed in double quotes. The name of the variable -comes next, terminated by an equals sign. If the type is not -VSNORMAL, then the text field in the substitution follows, ter- -minated by a CTLENDVAR byte. +variable is enclosed in double quotes and the VSLINENO flag if +LINENO is being expanded (the parameter name is the decimal line +number). The parameter's name comes next, terminated by an equals +sign. If the type is not VSNORMAL (including when it is VSLENGTH), +then the text field in the substitution follows, terminated by a +CTLENDVAR byte. + +The type VSERROR is used to allow parsing bad substitutions like +${var[7]} and generate an error when they are expanded. Commands in back quotes are parsed and stored in a linked list. The locations of these commands in the string are indicated by CTLBACKQ and CTLBACKQ+CTLQUOTE characters, depending upon whether the back quotes were enclosed in double quotes. +Arithmetic expansion starts with CTLARI and ends with CTLENDARI. + The character CTLESC escapes the next character, so that in case any of the CTL characters mentioned above appear in the input, they can be passed through transparently. CTLESC is also used to @@ -153,11 +168,11 @@ right. In the case of here documents wh variable and command substitution, the parser doesn't insert any CTLESC characters to begin with (so the contents of the text field can be written without any processing). Other here docu- -ments, and words which are not subject to splitting and file name -generation, have the CTLESC characters removed during the vari- -able and command substitution phase. Words which are subject to -splitting and file name generation have the CTLESC characters re- -moved as part of the file name phase. +ments, and words which are not subject to file name generation, +have the CTLESC characters removed during the variable and command +substitution phase. Words which are subject to file name +generation have the CTLESC characters removed as part of the file +name phase. EXECUTION: Command execution is handled by the following files: eval.c The top level routines. @@ -199,10 +214,10 @@ later.) The routine shellexec is the interface to the exec system call. -EXPAND.C: Arguments are processed in three passes. The first -(performed by the routine argstr) performs variable and command -substitution. The second (ifsbreakup) performs word splitting -and the third (expandmeta) performs file name generation. +EXPAND.C: As the routine argstr generates words by parameter +expansion, command substitution and arithmetic expansion, it +performs word splitting on the result. As each word
svn commit: r317879 - in head: lib/libzstd share/mk usr.bin/zstd
Author: bapt Date: Sat May 6 10:59:10 2017 New Revision: 317879 URL: https://svnweb.freebsd.org/changeset/base/317879 Log: Build zstandard with threading enabled Modified: head/lib/libzstd/Makefile head/share/mk/src.libnames.mk head/usr.bin/zstd/Makefile Modified: head/lib/libzstd/Makefile == --- head/lib/libzstd/Makefile Sat May 6 10:28:57 2017(r317878) +++ head/lib/libzstd/Makefile Sat May 6 10:59:10 2017(r317879) @@ -22,7 +22,9 @@ SRCS= entropy_common.c \ zdict.c WARNS= 2 INCS= zstd.h -CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ +CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ \ + -DZSTD_MULTITHREAD=1 +LIBADD=pthread PRIVATELIB=yes Modified: head/share/mk/src.libnames.mk == --- head/share/mk/src.libnames.mk Sat May 6 10:28:57 2017 (r317878) +++ head/share/mk/src.libnames.mk Sat May 6 10:59:10 2017 (r317879) @@ -209,6 +209,7 @@ _LIBRARIES+= \ # 2nd+ order consumers. Auto-generating this would be better. _DP_80211= sbuf bsdxml _DP_archive= z bz2 lzma bsdxml +_DP_zstd= pthread .if ${MK_BLACKLIST} != "no" _DP_blacklist+=pthread .endif Modified: head/usr.bin/zstd/Makefile == --- head/usr.bin/zstd/Makefile Sat May 6 10:28:57 2017(r317878) +++ head/usr.bin/zstd/Makefile Sat May 6 10:59:10 2017(r317879) @@ -13,7 +13,8 @@ CFLAGS+= -I${SRCTOP}/contrib/zstd/progra -I${SRCTOP}/contrib/zstd/lib/dictBuilder \ -I${SRCTOP}/contrib/zstd/lib \ -DXXH_NAMESPACE=ZSTD_ \ - -DHAVE_THREAD=1 + -DHAVE_THREAD=1 \ + -DZSTD_MULTITHREAD=1 SCRIPTS= zstdgrep LINKS= ${BINDIR}/zstd ${BINDIR}/unzstd \ ${BINDIR}/zstd ${BINDIR}/zstdcat \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317878 - head/usr.bin/zstd
Author: bapt Date: Sat May 6 10:28:57 2017 New Revision: 317878 URL: https://svnweb.freebsd.org/changeset/base/317878 Log: Add a zstdmt which is equivalent as running zstd -T0 Modified: head/usr.bin/zstd/Makefile Modified: head/usr.bin/zstd/Makefile == --- head/usr.bin/zstd/Makefile Sat May 6 10:26:40 2017(r317877) +++ head/usr.bin/zstd/Makefile Sat May 6 10:28:57 2017(r317878) @@ -16,9 +16,11 @@ CFLAGS+= -I${SRCTOP}/contrib/zstd/progra -DHAVE_THREAD=1 SCRIPTS= zstdgrep LINKS= ${BINDIR}/zstd ${BINDIR}/unzstd \ - ${BINDIR}/zstd ${BINDIR}/zstdcat + ${BINDIR}/zstd ${BINDIR}/zstdcat \ + ${BINDIR}/zstd ${BINDIR}/zstdmt MLINKS=zstd.1 unzstd.1 \ - zstd.1 zstdcat.1 + zstd.1 zstdcat.1 \ + zstd.1 zstdmt.1 WARNS= 2 LIBADD=zstd ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317877 - in head: contrib/zstd contrib/zstd/contrib contrib/zstd/contrib/pzstd contrib/zstd/contrib/pzstd/utils/test contrib/zstd/doc contrib/zstd/doc/educational_decoder contrib/zstd/...
Author: bapt Date: Sat May 6 10:26:40 2017 New Revision: 317877 URL: https://svnweb.freebsd.org/changeset/base/317877 Log: Import Zstandard 1.2.0 Among new things it is now threaded by default, use zstd -T# to chose the number of threads not that -T0 will automatically determine the number of threads based on the number of CPU online. Added: head/contrib/zstd/contrib/cleanTabs - copied unchanged from r317876, vendor/zstd/dist/contrib/cleanTabs head/contrib/zstd/programs/zstd.1.md - copied unchanged from r317876, vendor/zstd/dist/programs/zstd.1.md Deleted: head/contrib/zstd/.gitignore head/contrib/zstd/.travis.yml Modified: head/contrib/zstd/Makefile head/contrib/zstd/NEWS head/contrib/zstd/README.md head/contrib/zstd/appveyor.yml head/contrib/zstd/circle.yml head/contrib/zstd/contrib/pzstd/Options.cpp head/contrib/zstd/contrib/pzstd/utils/test/ThreadPoolTest.cpp head/contrib/zstd/contrib/pzstd/utils/test/WorkQueueTest.cpp head/contrib/zstd/doc/educational_decoder/zstd_decompress.c head/contrib/zstd/doc/images/Cspeed4.png head/contrib/zstd/doc/images/Dspeed4.png head/contrib/zstd/doc/images/dict-cr.png head/contrib/zstd/doc/images/dict-cs.png head/contrib/zstd/doc/images/dict-ds.png head/contrib/zstd/doc/zstd_compression_format.md head/contrib/zstd/doc/zstd_manual.html head/contrib/zstd/examples/simple_compression.c head/contrib/zstd/examples/streaming_compression.c head/contrib/zstd/examples/streaming_decompression.c head/contrib/zstd/lib/Makefile head/contrib/zstd/lib/README.md head/contrib/zstd/lib/common/bitstream.h head/contrib/zstd/lib/common/error_private.c head/contrib/zstd/lib/common/fse.h head/contrib/zstd/lib/common/huf.h head/contrib/zstd/lib/common/mem.h head/contrib/zstd/lib/common/zstd_errors.h head/contrib/zstd/lib/common/zstd_internal.h head/contrib/zstd/lib/compress/fse_compress.c head/contrib/zstd/lib/compress/zstd_compress.c head/contrib/zstd/lib/compress/zstd_opt.h head/contrib/zstd/lib/compress/zstdmt_compress.c head/contrib/zstd/lib/decompress/zstd_decompress.c head/contrib/zstd/lib/dictBuilder/cover.c head/contrib/zstd/lib/dictBuilder/zdict.c head/contrib/zstd/lib/dictBuilder/zdict.h head/contrib/zstd/lib/legacy/zstd_v01.c head/contrib/zstd/lib/legacy/zstd_v02.c head/contrib/zstd/lib/legacy/zstd_v03.c head/contrib/zstd/lib/legacy/zstd_v04.c head/contrib/zstd/lib/legacy/zstd_v05.c head/contrib/zstd/lib/legacy/zstd_v06.c head/contrib/zstd/lib/zstd.h head/contrib/zstd/programs/Makefile head/contrib/zstd/programs/README.md head/contrib/zstd/programs/bench.c head/contrib/zstd/programs/dibio.c head/contrib/zstd/programs/fileio.c head/contrib/zstd/programs/fileio.h head/contrib/zstd/programs/platform.h head/contrib/zstd/programs/util.h head/contrib/zstd/programs/zstd.1 head/contrib/zstd/programs/zstdcli.c head/contrib/zstd/tests/Makefile head/contrib/zstd/tests/decodecorpus.c head/contrib/zstd/tests/fullbench.c head/contrib/zstd/tests/fuzzer.c head/contrib/zstd/tests/paramgrill.c head/contrib/zstd/tests/playTests.sh head/contrib/zstd/tests/test-zstd-speed.py head/contrib/zstd/tests/zbufftest.c head/contrib/zstd/tests/zstreamtest.c head/contrib/zstd/zlibWrapper/examples/zwrapbench.c head/usr.bin/zstd/Makefile Directory Properties: head/contrib/zstd/ (props changed) Modified: head/contrib/zstd/Makefile == --- head/contrib/zstd/Makefile Sat May 6 10:18:45 2017(r317876) +++ head/contrib/zstd/Makefile Sat May 6 10:26:40 2017(r317877) @@ -90,6 +90,10 @@ examples: manual: $(MAKE) -C contrib/gen_html $@ +.PHONY: cleanTabs +cleanTabs: + cd contrib; ./cleanTabs + .PHONY: clean clean: @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) @@ -105,9 +109,15 @@ clean: # make install is validated only for Linux, OSX, Hurd and some BSD targets #-- ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD)) + HOST_OS = POSIX -.PHONY: install uninstall travis-install clangtest gpptest armtest usan asan uasan +CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON +.PHONY: list +list: + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs + +.PHONY: install uninstall travis-install clangtest gpptest armtest usan asan uasan install: @$(MAKE) -C $(ZSTDDIR) $@ @$(MAKE) -C $(PRGDIR) $@ @@ -152,16 +162,16 @@ ppc64build: clean CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allarch armfuzz: clean - CC=arm-linux-gnueabi-gcc
svn commit: r317870 - head/sys/dev/flash
Author: adrian Date: Sat May 6 06:08:44 2017 New Revision: 317870 URL: https://svnweb.freebsd.org/changeset/base/317870 Log: [mx25l] add new device ids. Submitted by: Hiroki MoriDifferential Revision:https://reviews.freebsd.org/D10621 Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c == --- head/sys/dev/flash/mx25l.c Sat May 6 06:07:44 2017(r317869) +++ head/sys/dev/flash/mx25l.c Sat May 6 06:08:44 2017(r317870) @@ -110,7 +110,9 @@ struct mx25l_flash_ident flash_devices[] { "en25f32",0x1c, 0x3116, 64 * 1024, 64, FL_NONE }, { "en25p32",0x1c, 0x2016, 64 * 1024, 64, FL_NONE }, { "en25p64",0x1c, 0x2017, 64 * 1024, 128, FL_NONE }, + { "en25q32",0x1c, 0x3016, 64 * 1024, 64, FL_NONE }, { "en25q64",0x1c, 0x3017, 64 * 1024, 128, FL_ERASE_4K }, + { "m25p32", 0x20, 0x2016, 64 * 1024, 64, FL_NONE }, { "m25p64", 0x20, 0x2017, 64 * 1024, 128, FL_NONE }, { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE }, { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317871 - head/sys/mips/atheros
Author: adrian Date: Sat May 6 06:09:50 2017 New Revision: 317871 URL: https://svnweb.freebsd.org/changeset/base/317871 Log: [ar934x] do an ethernet analog reset; apparently some boards don't. Tested: * on IOData WN-G300R. may be same as Sitecom WLR-2100. Submitted by: Hiroki MoriDifferential Revision:https://reviews.freebsd.org/D10621 Modified: head/sys/mips/atheros/ar934x_chip.c Modified: head/sys/mips/atheros/ar934x_chip.c == --- head/sys/mips/atheros/ar934x_chip.c Sat May 6 06:08:44 2017 (r317870) +++ head/sys/mips/atheros/ar934x_chip.c Sat May 6 06:09:50 2017 (r317871) @@ -315,6 +315,10 @@ ar934x_chip_reset_ethernet_switch(void) DELAY(100); ar71xx_device_start(AR934X_RESET_ETH_SWITCH); DELAY(100); + ar71xx_device_stop(AR934X_RESET_ETH_SWITCH_ANALOG); + DELAY(100); + ar71xx_device_start(AR934X_RESET_ETH_SWITCH_ANALOG); + DELAY(100); } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317874 - head/sys/mips/mediatek
Author: adrian Date: Sat May 6 06:22:14 2017 New Revision: 317874 URL: https://svnweb.freebsd.org/changeset/base/317874 Log: [mediatek] [gpio] add PPS / interrupt support. Submitted by: Hiroki MoriReviewed by: mizhka Differential Revision:https://reviews.freebsd.org/D9784 Modified: head/sys/mips/mediatek/mtk_gpio_v1.c Modified: head/sys/mips/mediatek/mtk_gpio_v1.c == --- head/sys/mips/mediatek/mtk_gpio_v1.cSat May 6 06:20:34 2017 (r317873) +++ head/sys/mips/mediatek/mtk_gpio_v1.cSat May 6 06:22:14 2017 (r317874) @@ -292,7 +292,8 @@ mtk_gpio_attach(device_t dev) for (i = 0; i < sc->num_pins; i++) { sc->pins[i].pin_caps |= GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | - GPIO_PIN_INVIN | GPIO_PIN_INVOUT; + GPIO_PIN_INVIN | GPIO_PIN_INVOUT | + GPIO_INTR_EDGE_RISING | GPIO_INTR_EDGE_FALLING; sc->pins[i].intr_polarity = INTR_POLARITY_HIGH; sc->pins[i].intr_trigger = INTR_TRIGGER_EDGE; @@ -500,22 +501,78 @@ out: } static int +mtk_gpio_pic_map_fdt(struct mtk_gpio_softc *sc, +struct intr_map_data_fdt *daf, u_int *irqp, uint32_t *modep) +{ + u_int irq; + + if (daf->ncells != 1) { + device_printf(sc->dev, "Invalid #interrupt-cells\n"); + return (EINVAL); + } + + irq = daf->cells[0]; + + if (irq >= sc->num_pins) { + device_printf(sc->dev, "Invalid interrupt number %u\n", irq); + return (EINVAL); + } + + *irqp = irq; + if (modep != NULL) + *modep = GPIO_INTR_EDGE_BOTH; + + return (0); +} + +static int +mtk_gpio_pic_map_gpio(struct mtk_gpio_softc *sc, +struct intr_map_data_gpio *dag, u_int *irqp, uint32_t *modep) +{ + u_int irq; + + irq = dag->gpio_pin_num; + if (irq >= sc->num_pins) { + device_printf(sc->dev, "Invalid interrupt number %u\n", irq); + return (EINVAL); + } + + *irqp = irq; + if (modep != NULL) + *modep = dag->gpio_intr_mode; + + return (0); +} + +static int mtk_gpio_pic_map_intr(device_t dev, struct intr_map_data *data, struct intr_irqsrc **isrcp) { - struct intr_map_data_fdt *daf; + int error; + u_int irq; struct mtk_gpio_softc *sc; - if (data->type != INTR_MAP_DATA_FDT) - return (ENOTSUP); - sc = device_get_softc(dev); - daf = (struct intr_map_data_fdt *)data; + switch (data->type) { + case INTR_MAP_DATA_FDT: + error = (mtk_gpio_pic_map_fdt(sc, + (struct intr_map_data_fdt *)data, , NULL)); + break; + case INTR_MAP_DATA_GPIO: + error = (mtk_gpio_pic_map_gpio(sc, + (struct intr_map_data_gpio *)data, , NULL)); + break; + default: + error = EINVAL; + break; + } - if (daf->ncells != 1 || daf->cells[0] >= sc->num_pins) - return (EINVAL); + if (error != 0) { + device_printf(dev, "Invalid map type\n"); + return (error); + } - *isrcp = PIC_INTR_ISRC(sc, daf->cells[0]); + *isrcp = PIC_INTR_ISRC(sc, irq); return (0); } @@ -600,6 +657,51 @@ mtk_gpio_pic_post_filter(device_t dev, s } static int +mtk_gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, +struct resource *res, struct intr_map_data *data) +{ + struct mtk_gpio_softc *sc; + uint32_t val; + int error; + uint32_t mode; + u_int irq; + + if (data == NULL) + return (ENOTSUP); + + sc = device_get_softc(dev); + + switch (data->type) { + case INTR_MAP_DATA_FDT: + error = mtk_gpio_pic_map_fdt(sc, + (struct intr_map_data_fdt *)data, , ); + break; + case INTR_MAP_DATA_GPIO: + error = mtk_gpio_pic_map_gpio(sc, + (struct intr_map_data_gpio *)data, , ); + break; + default: + error = ENOTSUP; + break; + } + + if (error != 0) + return (error); + + MTK_GPIO_LOCK(sc); + if (mode == GPIO_INTR_EDGE_BOTH || mode == GPIO_INTR_EDGE_RISING) { + val = MTK_READ_4(sc, GPIO_PIORENA) | (1u << irq); + MTK_WRITE_4(sc, GPIO_PIORENA, val); + } + if (mode == GPIO_INTR_EDGE_BOTH || mode == GPIO_INTR_EDGE_FALLING) { + val = MTK_READ_4(sc, GPIO_PIOFENA) | (1u << irq); + MTK_WRITE_4(sc, GPIO_PIOFENA, val); + } + MTK_GPIO_UNLOCK(sc); + return (0); +} + +static int mtk_gpio_intr(void *arg) { struct mtk_gpio_softc *sc; @@ -607,6 +709,7 @@ mtk_gpio_intr(void *arg)
svn commit: r317868 - head/sys/mips/atheros/ar531x
Author: adrian Date: Sat May 6 06:06:11 2017 New Revision: 317868 URL: https://svnweb.freebsd.org/changeset/base/317868 Log: [ar531x] [if_are] Fix if_are behaviour under high load traffic * use ifqmaxlen * handle (inefficiently for now) meeting padding and alignment requirements for transmit mbufs. * change how TX ring handling is done Submitted by: Hiroki MoriDifferential Revision:https://reviews.freebsd.org/D10557 Modified: head/sys/mips/atheros/ar531x/if_are.c head/sys/mips/atheros/ar531x/if_arereg.h Modified: head/sys/mips/atheros/ar531x/if_are.c == --- head/sys/mips/atheros/ar531x/if_are.c Sat May 6 06:01:17 2017 (r317867) +++ head/sys/mips/atheros/ar531x/if_are.c Sat May 6 06:06:11 2017 (r317868) @@ -302,9 +302,9 @@ are_attach(device_t dev) ifp->if_init = are_init; sc->are_if_flags = ifp->if_flags; - /* XXX: add real size */ - IFQ_SET_MAXLEN(>if_snd, 9); - ifp->if_snd.ifq_maxlen = 9; + /* ifqmaxlen is sysctl value in net/if.c */ + IFQ_SET_MAXLEN(>if_snd, ifqmaxlen); + ifp->if_snd.ifq_maxlen = ifqmaxlen; IFQ_SET_READY(>if_snd); /* Tell the upper layer(s) we support long frames. */ @@ -686,19 +686,92 @@ are_encap(struct are_softc *sc, struct m { struct are_txdesc *txd; struct are_desc *desc, *prev_desc; + struct mbuf *m; bus_dma_segment_t txsegs[ARE_MAXFRAGS]; uint32_tlink_addr; int error, i, nsegs, prod, si, prev_prod; int txstat; + int startcount; + int padlen; + + startcount = sc->are_cdata.are_tx_cnt; ARE_LOCK_ASSERT(sc); + /* +* Some VIA Rhine wants packet buffers to be longword +* aligned, but very often our mbufs aren't. Rather than +* waste time trying to decide when to copy and when not +* to copy, just do it all the time. +*/ + m = m_defrag(*m_head, M_NOWAIT); + if (m == NULL) { + device_printf(sc->are_dev, "are_encap m_defrag error\n"); + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + + /* +* The Rhine chip doesn't auto-pad, so we have to make +* sure to pad short frames out to the minimum frame length +* ourselves. +*/ + if ((*m_head)->m_pkthdr.len < ARE_MIN_FRAMELEN) { + m = *m_head; + padlen = ARE_MIN_FRAMELEN - m->m_pkthdr.len; + if (M_WRITABLE(m) == 0) { + /* Get a writable copy. */ + m = m_dup(*m_head, M_NOWAIT); + m_freem(*m_head); + if (m == NULL) { + device_printf(sc->are_dev, "are_encap m_dup error\n"); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + } + if (m->m_next != NULL || M_TRAILINGSPACE(m) < padlen) { + m = m_defrag(m, M_NOWAIT); + if (m == NULL) { + device_printf(sc->are_dev, "are_encap m_defrag error\n"); + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + } + /* +* Manually pad short frames, and zero the pad space +* to avoid leaking data. +*/ + bzero(mtod(m, char *) + m->m_pkthdr.len, padlen); + m->m_pkthdr.len += padlen; + m->m_len = m->m_pkthdr.len; + *m_head = m; + } + prod = sc->are_cdata.are_tx_prod; txd = >are_cdata.are_txdesc[prod]; - error = bus_dmamap_load_mbuf_sg(sc->are_cdata.are_tx_tag, txd->tx_dmamap, - *m_head, txsegs, , BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf_sg(sc->are_cdata.are_tx_tag, + txd->tx_dmamap, *m_head, txsegs, , BUS_DMA_NOWAIT); if (error == EFBIG) { - panic("EFBIG"); + device_printf(sc->are_dev, "are_encap EFBIG error\n"); + m = m_defrag(*m_head, M_NOWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + error = bus_dmamap_load_mbuf_sg(sc->are_cdata.are_tx_tag, + txd->tx_dmamap, *m_head, txsegs, , BUS_DMA_NOWAIT); + if (error != 0) { +
svn commit: r317872 - in head/sys: arm/conf arm/ralink boot/fdt/dts/arm
Author: adrian Date: Sat May 6 06:14:46 2017 New Revision: 317872 URL: https://svnweb.freebsd.org/changeset/base/317872 Log: [arm] [rt1310] add initial RT1310 SoC code. This code base on lpc code. Ralink RT1310 is oem from 5V Technologies. RT1310 is ARM926EJS(arm5t). Tested: * Buffalo WZR2-G300N Submitted by: Hiroki MoriReviewed by: mizhka Differential Revision:https://reviews.freebsd.org/D7238 Added: head/sys/arm/conf/RT1310 (contents, props changed) head/sys/arm/ralink/ head/sys/arm/ralink/files.ralink (contents, props changed) head/sys/arm/ralink/if_fv.c (contents, props changed) head/sys/arm/ralink/if_fvreg.h (contents, props changed) head/sys/arm/ralink/rt1310_gpio.c (contents, props changed) head/sys/arm/ralink/rt1310_intc.c (contents, props changed) head/sys/arm/ralink/rt1310_machdep.c (contents, props changed) head/sys/arm/ralink/rt1310_timer.c (contents, props changed) head/sys/arm/ralink/rt1310reg.h (contents, props changed) head/sys/arm/ralink/rt1310var.h (contents, props changed) head/sys/boot/fdt/dts/arm/rt1310a.dtsi (contents, props changed) head/sys/boot/fdt/dts/arm/wzr2-g300n.dts (contents, props changed) Added: head/sys/arm/conf/RT1310 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/RT1310Sat May 6 06:14:46 2017(r317872) @@ -0,0 +1,80 @@ +# +# Custom kernel for RT1310 boards. +# +# $FreeBSD$ +# + +ident RT1310 +include"std.arm" +hints "RT1310.hints" + +# Flattened Device Tree +optionsFDT +optionsFDT_DTB_STATIC +makeoptionsFDT_DTS_FILE=wzr2-g300n.dts + +makeoptionsMODULES_OVERRIDE="" + +#makeoptions DEBUG=-g# Build kernel with gdb(1) debug symbols +makeoptionsWERROR="-Werror" + +optionsSCHED_4BSD # 4BSD scheduler +optionsINET# InterNETworking +optionsFFS # Berkeley Fast Filesystem +optionsTMPFS # Efficient memory filesystem +optionsMSDOSFS + +optionsROOTDEVNAME=\"cd9660:/dev/cfid0s.rootfs.uzip\" + +optionsSYSVSHM # SYSV-style shared memory +optionsSYSVMSG # SYSV-style message queues +optionsSYSVSEM # SYSV-style semaphores +options_KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions +optionsMUTEX_NOINLINE +optionsRWLOCK_NOINLINE +optionsNO_FFS_SNAPSHOT +optionsNO_SWAPPING + +# Debugging +optionsALT_BREAK_TO_DEBUGGER +optionsDDB +#options DEADLKRES # Enable the deadlock resolver +#options DIAGNOSTIC +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +optionsKDB +optionsWITNESS # Enable checks to detect deadlocks and cycles +optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for speed +#options WITNESS_KDB + +# Pseudo devices +device loop +device md +device pty +device random + +# Serial ports +device uart +device uart_ns8250 + +# Flash +device cfi +device cfid + +# Networking +device ether +device mii +device bpf +device fv + +# etherswitch +device mdio +device etherswitch +device miiproxy +device ip17x + +# GPIO +device gpio +device gpioled +device rt1310gpio + Added: head/sys/arm/ralink/files.ralink == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ralink/files.ralinkSat May 6 06:14:46 2017 (r317872) @@ -0,0 +1,9 @@ +# $FreeBSD$ +arm/ralink/rt1310_machdep.cstandard +arm/ralink/rt1310_intc.c standard +arm/ralink/rt1310_gpio.c optionalrt1310gpio +arm/ralink/rt1310_timer.c standard +arm/ralink/if_fv.c optionalfv + +kern/kern_clocksource.cstandard + Added: head/sys/arm/ralink/if_fv.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ralink/if_fv.c Sat May 6 06:14:46 2017(r317872) @@ -0,0 +1,1873 @@ +/*- + * Copyright (c) 2016 Hiroki Mori. All rights reserved. + * Copyright (C) 2007 + * Oleksandr Tymoshenko . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following
svn commit: r317873 - in head/sys: conf dev/rt gnu/dts/mips mips/conf mips/mediatek
Author: adrian Date: Sat May 6 06:20:34 2017 New Revision: 317873 URL: https://svnweb.freebsd.org/changeset/base/317873 Log: [mips] [rt2880] Add oldest Ralink MIPS SOC RT2880 support code. * Target module have ic plus etherswitch ip175c. * Also add etherswitch support code on rt driver. Reviewed by: mizhka Differential Revision:https://reviews.freebsd.org/D10336 Added: head/sys/gnu/dts/mips/MZK-W04N-XX.dts (contents, props changed) head/sys/mips/conf/RT2880_FDT (contents, props changed) head/sys/mips/mediatek/std.rt2880 (contents, props changed) Modified: head/sys/conf/options.mips head/sys/dev/rt/if_rt.c head/sys/dev/rt/if_rtreg.h head/sys/gnu/dts/mips/rt2880.dtsi head/sys/mips/mediatek/mtk_machdep.c head/sys/mips/mediatek/mtk_soc.c head/sys/mips/mediatek/mtk_soc.h Modified: head/sys/conf/options.mips == --- head/sys/conf/options.mips Sat May 6 06:14:46 2017(r317872) +++ head/sys/conf/options.mips Sat May 6 06:20:34 2017(r317873) @@ -152,6 +152,7 @@ RT3050F opt_rt305x.h RT305X opt_rt305x.h RT305X_UBOOT opt_rt305x.h RT305X_USE_UARTopt_rt305x.h +RT_MDIOopt_rt305x.h # # Options that affect the pmap. Modified: head/sys/dev/rt/if_rt.c == --- head/sys/dev/rt/if_rt.c Sat May 6 06:14:46 2017(r317872) +++ head/sys/dev/rt/if_rt.c Sat May 6 06:20:34 2017(r317873) @@ -70,6 +70,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef RT_MDIO +#include +#include +#include "mdio_if.h" +#endif + #if 0 #include #include @@ -91,6 +97,7 @@ __FBSDID("$FreeBSD$"); #defineRT_TX_WATCHDOG_TIMEOUT 5 +#define RT_CHIPID_RT2880 0x2880 #define RT_CHIPID_RT3050 0x3050 #define RT_CHIPID_RT5350 0x5350 #define RT_CHIPID_MT7620 0x7620 @@ -99,6 +106,7 @@ __FBSDID("$FreeBSD$"); #ifdef FDT /* more specific and new models should go first */ static const struct ofw_compat_data rt_compat_data[] = { + { "ralink,rt2880-eth", RT_CHIPID_RT2880 }, { "ralink,rt3050-eth", RT_CHIPID_RT3050 }, { "ralink,rt3352-eth", RT_CHIPID_RT3050 }, { "ralink,rt3883-eth", RT_CHIPID_RT3050 }, @@ -166,6 +174,8 @@ static void rt_dma_map_addr(void *arg, b static voidrt_sysctl_attach(struct rt_softc *sc); #ifdef IF_RT_PHY_SUPPORT void rt_miibus_statchg(device_t); +#endif +#if defined(IF_RT_PHY_SUPPORT) || defined(RT_MDIO) static int rt_miibus_readreg(device_t, int, int); static int rt_miibus_writereg(device_t, int, int, int); #endif @@ -351,7 +361,7 @@ rt_attach(device_t dev) sc->mem_rid = 0; sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, >mem_rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (sc->mem == NULL) { device_printf(dev, "could not allocate memory resource\n"); error = ENXIO; @@ -467,6 +477,9 @@ rt_attach(device_t dev) GDM_DST_PORT_CPU << GDM_OFRC_P_SHIFT /* fwd Other to CPU */ )); + if (sc->rt_chipid == RT_CHIPID_RT2880) + RT_WRITE(sc, MDIO_CFG, MDIO_2880_100T_INIT); + /* allocate Tx and Rx rings */ for (i = 0; i < RT_SOFTC_TX_RING_COUNT; i++) { error = rt_alloc_tx_ring(sc, >tx_ring[i], i); @@ -2733,16 +2746,20 @@ rt_sysctl_attach(struct rt_softc *sc) "Tx collision count for GDMA ports"); } -#ifdef IF_RT_PHY_SUPPORT +#if defined(IF_RT_PHY_SUPPORT) || defined(RT_MDIO) +/* This code is only work RT2880 and same chip. */ +/* TODO: make RT3052 and later support code. But nobody need it? */ static int rt_miibus_readreg(device_t dev, int phy, int reg) { struct rt_softc *sc = device_get_softc(dev); + int dat; /* * PSEUDO_PHYAD is a special value for indicate switch attached. * No one PHY use PSEUDO_PHYAD (0x1e) address. */ +#ifndef RT_MDIO if (phy == 31) { /* Fake PHY ID for bfeswitch attach */ switch (reg) { @@ -2754,13 +2771,14 @@ rt_miibus_readreg(device_t dev, int phy, return (0x6250);/* bfeswitch */ } } +#endif /* Wait prev command done if any */ while (RT_READ(sc, MDIO_ACCESS) & MDIO_CMD_ONGO); - RT_WRITE(sc, MDIO_ACCESS, - MDIO_CMD_ONGO || - ((phy << MDIO_PHY_ADDR_SHIFT) & MDIO_PHY_ADDR_MASK) || - ((reg << MDIO_PHYREG_ADDR_SHIFT) & MDIO_PHYREG_ADDR_MASK)); + dat = ((phy << MDIO_PHY_ADDR_SHIFT) & MDIO_PHY_ADDR_MASK) | + ((reg << MDIO_PHYREG_ADDR_SHIFT) & MDIO_PHYREG_ADDR_MASK); + RT_WRITE(sc, MDIO_ACCESS, dat); + RT_WRITE(sc,
svn commit: r317869 - head/sys/dev/etherswitch/e6000sw
Author: adrian Date: Sat May 6 06:07:44 2017 New Revision: 317869 URL: https://svnweb.freebsd.org/changeset/base/317869 Log: [etherswitch] [e6000sw] fix compile issue under clang/arm Submitted by: Hiroki MoriApproved by: mizhka Differential Revision:https://reviews.freebsd.org/D10563 Modified: head/sys/dev/etherswitch/e6000sw/e6060sw.c Modified: head/sys/dev/etherswitch/e6000sw/e6060sw.c == --- head/sys/dev/etherswitch/e6000sw/e6060sw.c Sat May 6 06:06:11 2017 (r317868) +++ head/sys/dev/etherswitch/e6000sw/e6060sw.c Sat May 6 06:07:44 2017 (r317869) @@ -169,6 +169,7 @@ e6060sw_probe(device_t dev) sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); + devid = 0; for (i = 0; i < 2; ++i) { data = MDIO_READREG(device_get_parent(dev), CORE_REGISTER + i * 0x10, SWITCH_ID); @@ -184,8 +185,6 @@ e6060sw_probe(device_t dev) break; } } - if (i == 2) - return (ENXIO); if (devid == E6060) devname = "88E6060"; @@ -193,6 +192,9 @@ e6060sw_probe(device_t dev) devname = "88E6063"; else if (devid == E6065) devname = "88E6065"; + else + return (ENXIO); + sprintf(desc, "Marvell %s MDIO switch driver at 0x%02x", devname, sc->smi_offset); device_set_desc_copy(dev, desc); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317867 - head/share/man/man4
Author: adrian Date: Sat May 6 06:01:17 2017 New Revision: 317867 URL: https://svnweb.freebsd.org/changeset/base/317867 Log: [etherswitch] add manpages for etherswitch supported devices. Submitted by: Hiroki MoriReviewed by: mizhka Differential Revision:https://reviews.freebsd.org/D10278 Added: head/share/man/man4/adm6996fc.4 (contents, props changed) head/share/man/man4/e6060sw.4 (contents, props changed) head/share/man/man4/ksz8995ma.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/etherswitch.4 Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileSat May 6 05:53:42 2017 (r317866) +++ head/share/man/man4/MakefileSat May 6 06:01:17 2017 (r317867) @@ -22,6 +22,7 @@ MAN= aac.4 \ acpi_video.4 \ ${_acpi_wmi.4} \ ada.4 \ + adm6996fc.4 \ adv.4 \ adw.4 \ ae.4 \ @@ -152,6 +153,7 @@ MAN=aac.4 \ etherswitch.4 \ eventtimers.4 \ exca.4 \ + e6060sw.4 \ fd.4 \ fdc.4 \ fdt.4 \ @@ -245,6 +247,7 @@ MAN=aac.4 \ keyboard.4 \ kld.4 \ ksyms.4 \ + ksz8995ma.4 \ ktr.4 \ kue.4 \ lagg.4 \ Added: head/share/man/man4/adm6996fc.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/adm6996fc.4 Sat May 6 06:01:17 2017 (r317867) @@ -0,0 +1,68 @@ +.\"- +.\" Copyright (c) 2017 Hiroki Mori +.\" 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$ +.\" +.Dd April 5, 2017 +.Dt ADM6996FC 4 +.Os +.Sh NAME +.Nm adm6996fc +.Nd driver for Infineon ADM6996FC fast ethernet switch chip +.Sh SYNOPSIS +.Cd "device mdio" +.Cd "device etherswitch" +.Cd "device adm6996fc" +.Pp +.Cd hint.adm6996fc.0.at="mdio0" +.Sh DESCRIPTION +The +.Nm +device driver provides a management interface to Infineon ADM6996FC fast ethernet switch chip. +This driver use smi interface by ethernet interface. +.Pp +This driver support is port and dot1q vlan. +dot1q support port base tag/untag. +.Sh EXAMPLES +Configure dot1q vlan by etherswitchcfg command. +.Pp +.Dl # etherswitchcfg config vlan_mode dot1q +.Pp +Configure port 5 is tagging port. +.Pp +.Dl # etherswitchcfg port5 addtag +.Sh SEE ALSO +.Xr etherswitch 4 , +.Xr etherswitchcfg 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Hiroki Mori Added: head/share/man/man4/e6060sw.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/e6060sw.4 Sat May 6 06:01:17 2017 (r317867) @@ -0,0 +1,70 @@ +.\"- +.\" Copyright (c) 2017 Hiroki Mori +.\" 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
svn commit: r317865 - head/sys/dev/cfi
Author: adrian Date: Sat May 6 05:52:01 2017 New Revision: 317865 URL: https://svnweb.freebsd.org/changeset/base/317865 Log: [cfi] fix CFI flash reset command for MX29LV320T/B. MX flash MX29LV320T/B datasheet say reset is 0xf0. Submitted by: Hiroki MoriApproved by: mizhka Differential Revision:https://reviews.freebsd.org/D10177 Modified: head/sys/dev/cfi/cfi_core.c head/sys/dev/cfi/cfi_reg.h Modified: head/sys/dev/cfi/cfi_core.c == --- head/sys/dev/cfi/cfi_core.c Sat May 6 05:50:07 2017(r317864) +++ head/sys/dev/cfi/cfi_core.c Sat May 6 05:52:01 2017(r317865) @@ -145,6 +145,17 @@ cfi_write(struct cfi_softc *sc, u_int of } } +/* + * This is same workaound as NetBSD sys/dev/nor/cfi.c cfi_reset_default() + */ +static void +cfi_reset_default(struct cfi_softc *sc) +{ + + cfi_write(sc, 0, CFI_BCS_READ_ARRAY2); + cfi_write(sc, 0, CFI_BCS_READ_ARRAY); +} + uint8_t cfi_read_qry(struct cfi_softc *sc, u_int ofs) { @@ -152,7 +163,7 @@ cfi_read_qry(struct cfi_softc *sc, u_int cfi_write(sc, CFI_QRY_CMD_ADDR * sc->sc_width, CFI_QRY_CMD_DATA); val = cfi_read(sc, ofs * sc->sc_width); - cfi_write(sc, 0, CFI_BCS_READ_ARRAY); + cfi_reset_default(sc); return (val); } @@ -745,7 +756,7 @@ cfi_write_block(struct cfi_softc *sc) /* error is 0. */ out: - cfi_write(sc, 0, CFI_BCS_READ_ARRAY); + cfi_reset_default(sc); /* Relock Intel flash */ switch (sc->sc_cmdset) { Modified: head/sys/dev/cfi/cfi_reg.h == --- head/sys/dev/cfi/cfi_reg.h Sat May 6 05:50:07 2017(r317864) +++ head/sys/dev/cfi/cfi_reg.h Sat May 6 05:52:01 2017(r317865) @@ -113,6 +113,7 @@ struct cfi_qry { #defineCFI_BCS_CONFIRM 0xd0 #defineCFI_BCS_BUF_PROG_SETUP 0xe8 #defineCFI_BCS_READ_ARRAY 0xff +#defineCFI_BCS_READ_ARRAY2 0xf0 /* Intel commands. */ #defineCFI_INTEL_LB0x01/* Lock Block */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317864 - head/sys/dev/etherswitch/infineon
Author: adrian Date: Sat May 6 05:50:07 2017 New Revision: 317864 URL: https://svnweb.freebsd.org/changeset/base/317864 Log: [infineon] [etherswitch] no hardcode tagging port setting at amd6996fc Tagging port can set by etherswitchcfg command. Tested: * on Netgear_WGR614Cv7 Submitted by: Hiroki MoriReviewed by: mizhka Modified: head/sys/dev/etherswitch/infineon/adm6996fc.c Modified: head/sys/dev/etherswitch/infineon/adm6996fc.c == --- head/sys/dev/etherswitch/infineon/adm6996fc.c Sat May 6 05:37:36 2017(r317863) +++ head/sys/dev/etherswitch/infineon/adm6996fc.c Sat May 6 05:50:07 2017(r317864) @@ -35,6 +35,7 @@ * This code suppose ADM6996FC SDC/SDIO connect to SOC network interface * MDC/MDIO. * This code development on Netgear WGR614Cv7. + * etherswitchcfg command port option support addtag. */ #include @@ -462,8 +463,6 @@ adm6996fc_getport(device_t dev, etherswi p->es_pvid = ADM6996FC_PVIDBYDATA(data1, data2); if (((data1 >> ADM6996FC_OPTE_SHIFT) & 0x01) == 1) p->es_flags |= ETHERSWITCH_PORT_ADDTAG; - else - p->es_flags |= ETHERSWITCH_PORT_STRIPTAG; } else { p->es_pvid = 0; } @@ -517,6 +516,10 @@ adm6996fc_setport(device_t dev, etherswi data = ADM6996FC_READREG(parent, bcaddr[p->es_port]); data &= ~(0xf << 10); data |= (p->es_pvid & 0xf) << ADM6996FC_PVID_SHIFT; + if (p->es_flags & ETHERSWITCH_PORT_ADDTAG) + data |= 1 << ADM6996FC_OPTE_SHIFT; + else + data &= ~(1 << ADM6996FC_OPTE_SHIFT); ADM6996FC_WRITEREG(parent, bcaddr[p->es_port], data); data = ADM6996FC_READREG(parent, vidaddr[p->es_port]); /* only port 4 is hi bit */ @@ -670,9 +673,6 @@ adm6996fc_setconf(device_t dev, etherswi /* Private VID set 1 */ data &= ~(0xf << 10); data |= (1 << 10); - /* Output Packet Tagging Enable */ - if (i == 5) - data |= (1 << 4); ADM6996FC_WRITEREG(parent, bcaddr[i], data); } for (i = 2;i <= 15; ++i) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317866 - head/sys/dev/etherswitch/ip17x
Author: adrian Date: Sat May 6 05:53:42 2017 New Revision: 317866 URL: https://svnweb.freebsd.org/changeset/base/317866 Log: [ip17x] [etherswitch] fdt away and mii hang workaround on ip17x Add workaround mii access because of rt1310 is hang up on etherswitch mii poll. And FDT away on arm platform. Tested: * wzr2-g300n Submitted by: Hiroki MoriReviewed by: mizhka Differential Revision:https://reviews.freebsd.org/D10295 Modified: head/sys/dev/etherswitch/ip17x/ip17x.c head/sys/dev/etherswitch/ip17x/ip17x_var.h Modified: head/sys/dev/etherswitch/ip17x/ip17x.c == --- head/sys/dev/etherswitch/ip17x/ip17x.c Sat May 6 05:52:01 2017 (r317865) +++ head/sys/dev/etherswitch/ip17x/ip17x.c Sat May 6 05:53:42 2017 (r317866) @@ -28,6 +28,8 @@ * $FreeBSD$ */ +#include "opt_platform.h" + #include #include #include @@ -61,6 +63,12 @@ #include #include +#ifdef FDT +#include +#include +#include +#endif + #include "mdio_if.h" #include "miibus_if.h" #include "etherswitch_if.h" @@ -72,11 +80,28 @@ static void ip17x_tick(void *); static int ip17x_ifmedia_upd(struct ifnet *); static void ip17x_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void +ip17x_identify(driver_t *driver, device_t parent) +{ + if (device_find_child(parent, "ip17x", -1) == NULL) + BUS_ADD_CHILD(parent, 0, "ip17x", -1); +} + static int ip17x_probe(device_t dev) { struct ip17x_softc *sc; uint32_t oui, model, phy_id1, phy_id2; +#ifdef FDT + phandle_t ip17x_node; + pcell_t cell; + + ip17x_node = fdt_find_compatible(OF_finddevice("/"), + "icplus,ip17x", 0); + + if (ip17x_node == 0) + return (ENXIO); +#endif sc = device_get_softc(dev); @@ -118,6 +143,15 @@ ip17x_probe(device_t dev) sc->sc_switchtype = IP17X_SWITCH_IP178C; } + sc->miipoll = 1; +#ifdef FDT + if ((OF_getencprop(ip17x_node, "mii-poll", + , sizeof(cell))) > 0) + sc->miipoll = cell ? 1 : 0; +#else + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "mii-poll", >miipoll); +#endif device_set_desc_copy(dev, "IC+ IP17x switch driver"); return (BUS_PROBE_DEFAULT); } @@ -229,9 +263,11 @@ ip17x_attach(device_t dev) if (err != 0) return (err); - callout_init(>callout_tick, 0); + if (sc->miipoll) { + callout_init(>callout_tick, 0); - ip17x_tick(sc); + ip17x_tick(sc); + } return (0); } @@ -243,7 +279,8 @@ ip17x_detach(device_t dev) int i, port; sc = device_get_softc(dev); - callout_drain(>callout_tick); + if (sc->miipoll) + callout_drain(>callout_tick); for (i=0; i < MII_NPHY; i++) { if (((1 << i) & sc->phymask) == 0) @@ -564,6 +601,7 @@ ip17x_setconf(device_t dev, etherswitch_ static device_method_t ip17x_methods[] = { /* Device interface */ + DEVMETHOD(device_identify, ip17x_identify), DEVMETHOD(device_probe, ip17x_probe), DEVMETHOD(device_attach,ip17x_attach), DEVMETHOD(device_detach,ip17x_detach), @@ -604,8 +642,13 @@ static devclass_t ip17x_devclass; DRIVER_MODULE(ip17x, mdio, ip17x_driver, ip17x_devclass, 0, 0); DRIVER_MODULE(miibus, ip17x, miibus_driver, miibus_devclass, 0, 0); -DRIVER_MODULE(mdio, ip17x, mdio_driver, mdio_devclass, 0, 0); DRIVER_MODULE(etherswitch, ip17x, etherswitch_driver, etherswitch_devclass, 0, 0); MODULE_VERSION(ip17x, 1); + +#ifdef FDT +MODULE_DEPEND(ip17x, mdio, 1, 1, 1); /* XXX which versions? */ +#else +DRIVER_MODULE(mdio, ip17x, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(ip17x, miibus, 1, 1, 1); /* XXX which versions? */ MODULE_DEPEND(ip17x, etherswitch, 1, 1, 1); /* XXX which versions? */ +#endif Modified: head/sys/dev/etherswitch/ip17x/ip17x_var.h == --- head/sys/dev/etherswitch/ip17x/ip17x_var.h Sat May 6 05:52:01 2017 (r317865) +++ head/sys/dev/etherswitch/ip17x/ip17x_var.h Sat May 6 05:53:42 2017 (r317866) @@ -53,6 +53,7 @@ struct ip17x_softc { int numports; /* number of ports */ int *portphy; device_t**miibus; + int miipoll; etherswitch_info_t info; ip17x_switch_type sc_switchtype; struct callout callout_tick; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317863 - head/share/mk
Author: bdrewery Date: Sat May 6 05:37:36 2017 New Revision: 317863 URL: https://svnweb.freebsd.org/changeset/base/317863 Log: Fix some "don't build" optimizations from r308599 not working due to a typo. MFC after:2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.init.mk Modified: head/share/mk/bsd.init.mk == --- head/share/mk/bsd.init.mk Sat May 6 04:17:48 2017(r317862) +++ head/share/mk/bsd.init.mk Sat May 6 05:37:36 2017(r317863) @@ -29,7 +29,7 @@ : .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \ ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) _SKIP_BUILD= not building at level 0 -.elseif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ +.elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ ${.TARGETS:M*install*} == ${.TARGETS} || \ make(clean*) || make(obj) || make(analyze) || make(print-dir) || \ make(destroy*) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"