Re: svn commit: r236377 - head/sys/dev/vxge/vxgehal
On Fri, 1 Jun 2012, John Baldwin wrote: On Friday, June 01, 2012 12:39:48 pm Eitan Adler wrote: On 1 June 2012 07:24, John Baldwin wrote: This is why I personally loathe assignment side effects in boolean expressions for control flow. I tend to write this sort of thing instead as: channel->dtr_arr[dtr_index].dtr = dtrh; if (dtrh != NULL) { Same here. I was told to use the assignment is style(9) by multiple people though. If it really is, I wish it would change. style(9) doesn't make a clear statement either way, but it has contradicting examples. First: while ((ch = getopt(argc, argv, "abNn:")) != -1) (and this one I use all the time myself as that is the common idiom for getopt()) Second: error = function(a1, a2); if (error != 0) exit(error); The former is the old style and is still common. We tried to change this 10-15 years ago, but in style(9) didn't change much except the second example. In Lite2 it is: /* No spaces after function names. */ if (error = function(a1, a2)) exit(error); and we successfully changed almost everything/everyone to not have/write code like that (the compiler will now warn about the test-by-assignment), but often the fix is to just add parentheses and a test on the same line since that minimises churn and some writers prefer it. Also, style(9) tends to frown on assignments that are side-effects in other places, for example: Be careful to not obfuscate the code by initializing variables in the declarations. Use this feature only thoughtfully. DO NOT use function calls in initializers. This was originally not about side effects, but about writing _any_ of the function in initializers. In Lite2, it is: * DO NOT initialize variables in the declarations. This rule is even more useful for minimising bugs without really trying than it used to be, since the initializations need to be moved after a lock in many cases, but FreeBSD weakened it as above :-(. struct foo one, *two; double three; int *four, five; char *six, seven, eight, nine, ten, eleven, twelve; I recently discussed ordering of declarations with someone and noticed that style(9) mostly violates its own rules by not sorting on either size or alphabetically here. The rule should be to sort on alignment and then alphabetically, and gives something like: struct foo one; /* structs always first */ double three; /* big FP types next */ struct foo *two;/* then pointers (sort on complexity?) */ int *four; char *six; int five; /* XXX bogus names; keep their non-alphabetical sorting below. */ char seven, eight, nine, ten, eleven, twelve; but my rules put all scalars after all pointers (so the double goes after the pointers despite it being larger and having stricter alignment requirements on i386), and there are many complications for typedefed opaque and semi-opaque types (you may or may not know anything about their size and alignment). Some newer changes added at the end do use assignment side-effects while demonstrating other rules (the !p example and err(3) and warn(3) examples, this last I find particularly obfuscated and painful to read). These are actually old. In Lite2 they are: * ... Also, test pointers * against NULL, i.e. use: * * (p = f()) == NULL * not: * !(p = f()) * ... * Use err/warn(3), don't roll your own! */ if ((four = malloc(sizeof(struct foo))) == NULL) err(1, NULL); if ((six = (int *)overflow()) == NULL) errx(1, "Number overflowed."); For !p, it just says not to use !p for pointers, and the test in the same expression as the assignment is as usual. However, I do split it out if the return value is used for more than error checking, e.g.: fd = open(...); if (fd < 0) err(1, "open"); The best way. Bruce ___ 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: r236437 - in head: sbin/camcontrol sys/cam sys/cam/ata
Author: mav Date: Sat Jun 2 08:29:07 2012 New Revision: 236437 URL: http://svn.freebsd.org/changeset/base/236437 Log: Rewrite enabling NCQ for SATA devices in a way more alike to SCSI TCQ. This allows to control it with `camcontrol negotiate adaX -T (en|dis)able` on the fly, same as for SCSI devices. Sponsored by: iXsystems, Inc. Modified: head/sbin/camcontrol/camcontrol.c head/sys/cam/ata/ata_xpt.c head/sys/cam/cam_ccb.h head/sys/cam/cam_xpt.c Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Sat Jun 2 05:46:04 2012 (r236436) +++ head/sbin/camcontrol/camcontrol.c Sat Jun 2 08:29:07 2012 (r236437) @@ -1025,11 +1025,11 @@ camxferrate(struct cam_device *device) if (sas->valid & CTS_SAS_VALID_SPEED) speed = sas->bitrate; } else if (ccb->cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &ccb->cts.xport_specific.ata; - if (ata->valid & CTS_ATA_VALID_MODE) - speed = ata_mode2speed(ata->mode); + if (pata->valid & CTS_ATA_VALID_MODE) + speed = ata_mode2speed(pata->mode); } else if (ccb->cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = &ccb->cts.xport_specific.sata; @@ -1072,16 +1072,16 @@ camxferrate(struct cam_device *device) fprintf(stdout, ")"); } } else if (ccb->cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &ccb->cts.xport_specific.ata; printf(" ("); - if (ata->valid & CTS_ATA_VALID_MODE) - printf("%s, ", ata_mode2string(ata->mode)); - if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) - printf("ATAPI %dbytes, ", ata->atapi); - if (ata->valid & CTS_ATA_VALID_BYTECOUNT) - printf("PIO %dbytes", ata->bytecount); + if (pata->valid & CTS_ATA_VALID_MODE) + printf("%s, ", ata_mode2string(pata->mode)); + if ((pata->valid & CTS_ATA_VALID_ATAPI) && pata->atapi != 0) + printf("ATAPI %dbytes, ", pata->atapi); + if (pata->valid & CTS_ATA_VALID_BYTECOUNT) + printf("PIO %dbytes", pata->bytecount); printf(")"); } else if (ccb->cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = @@ -2891,21 +2891,45 @@ cts_print(struct cam_device *device, str "enabled" : "disabled"); } } + if (cts->transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc = + &cts->xport_specific.fc; + + if (fc->valid & CTS_FC_VALID_WWNN) + fprintf(stdout, "%sWWNN: 0x%llx", pathstr, + (long long) fc->wwnn); + if (fc->valid & CTS_FC_VALID_WWPN) + fprintf(stdout, "%sWWPN: 0x%llx", pathstr, + (long long) fc->wwpn); + if (fc->valid & CTS_FC_VALID_PORT) + fprintf(stdout, "%sPortID: 0x%x", pathstr, fc->port); + if (fc->valid & CTS_FC_VALID_SPEED) + fprintf(stdout, "%stransfer speed: %d.%03dMB/s\n", + pathstr, fc->bitrate / 1000, fc->bitrate % 1000); + } + if (cts->transport == XPORT_SAS) { + struct ccb_trans_settings_sas *sas = + &cts->xport_specific.sas; + + if (sas->valid & CTS_SAS_VALID_SPEED) + fprintf(stdout, "%stransfer speed: %d.%03dMB/s\n", + pathstr, sas->bitrate / 1000, sas->bitrate % 1000); + } if (cts->transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &cts->xport_specific.ata; - if ((ata->valid & CTS_ATA_VALID_MODE) != 0) { + if ((pata->valid & CTS_ATA_VALID_MODE) != 0) { fprintf(stdout, "%sATA mode: %s\n", pathstr, - ata_mode2string(ata->mode)); + ata_mode2string(pata->mode)); } - if ((ata->valid & CTS_ATA_VALID_ATAPI) != 0) { + if ((pata->valid & CTS_ATA_VALID_ATAPI) != 0) { fprintf(stdout, "%sATAPI packet length: %d\n", pathstr, - ata->atapi); + pata->atapi); } -
svn commit: r236438 - in head/lib: libc/gen libcrypt libelf libgpib libpmc libusb
Author: joel (doc committer) Date: Sat Jun 2 08:47:26 2012 New Revision: 236438 URL: http://svn.freebsd.org/changeset/base/236438 Log: mdoc: minor Bl improvements. Modified: head/lib/libc/gen/posix_spawnattr_getflags.3 head/lib/libcrypt/crypt.3 head/lib/libelf/elf.3 head/lib/libelf/gelf.3 head/lib/libgpib/gpib.3 head/lib/libpmc/pmc.3 head/lib/libusb/libusb20.3 Modified: head/lib/libc/gen/posix_spawnattr_getflags.3 == --- head/lib/libc/gen/posix_spawnattr_getflags.3Sat Jun 2 08:29:07 2012(r236437) +++ head/lib/libc/gen/posix_spawnattr_getflags.3Sat Jun 2 08:47:26 2012(r236438) @@ -70,7 +70,7 @@ or It is the bitwise-inclusive OR of zero or more of the following flags (see .Fn posix_spawn ) : -.Bl -tag -offset indent +.Bl -tag -width "POSIX_SPAWN_SETSCHEDPARAM" -offset indent .It Dv POSIX_SPAWN_RESETIDS .It Dv POSIX_SPAWN_SETPGROUP .It Dv POSIX_SPAWN_SETSIGDEF Modified: head/lib/libcrypt/crypt.3 == --- head/lib/libcrypt/crypt.3 Sat Jun 2 08:29:07 2012(r236437) +++ head/lib/libcrypt/crypt.3 Sat Jun 2 08:47:26 2012(r236438) @@ -196,7 +196,7 @@ SHA-512 .Pp Other crypt formats may be easily added. An example salt would be: -.Bl -tag -offset indent +.Bl -tag -width 6n -offset indent .It Cm "$4$thesalt$rest" .El .Ss "Traditional" crypt: Modified: head/lib/libelf/elf.3 == --- head/lib/libelf/elf.3 Sat Jun 2 08:29:07 2012(r236437) +++ head/lib/libelf/elf.3 Sat Jun 2 08:47:26 2012(r236438) @@ -385,9 +385,9 @@ See This section contains a brief overview of the available functionality in the ELF library. Each function listed here is described further in its own manual page. -.Bl -tag -width indent +.Bl -tag -width 2n .It "Archive Access" -.Bl -tag -compact +.Bl -tag -width 17n -compact .It Fn elf_getarsym Retrieve the archive symbol table. .It Fn elf_getarhdr @@ -404,7 +404,7 @@ Random access inside an archive. .El .It "Data Structures" -.Bl -tag -compact +.Bl -tag -width 17n -compact .It Fn elf_getdata Retrieve translated data for an ELF section. .It Fn elf_getscn @@ -437,7 +437,7 @@ Allocate an Executable Header in an ELF Allocate or resize the Program Header Table in an ELF object. .El .It "Data Translation" -.Bl -tag -compact +.Bl -tag -width 17n -compact .It Fn elf32_xlatetof , Fn elf64_xlatetof Translate an ELF data structure from its native representation to its file representation. @@ -446,14 +446,14 @@ Translate an ELF data structure from its native representation. .El .It "Error Reporting" -.Bl -tag -compact +.Bl -tag -width 17n -compact .It Fn elf_errno Retrieve the current error. .It Fn elf_errmsg Retrieve a human readable description of the current error. .El .It "Initialization" -.Bl -tag -compact +.Bl -tag -width 17n -compact .It Fn elf_begin Opens an .Xr ar 1 @@ -468,7 +468,7 @@ archive or ELF object present in a memor Sets the operating version. .El .It "IO Control" -.Bl -tag -width ".Fn elf_setshstrndx" -compact +.Bl -tag -width 17n -compact .It Fn elf_cntl Manage the association between and ELF descriptor and its underlying file. .It Fn elf_flagdata @@ -492,7 +492,7 @@ Recompute ELF object layout and optional back to the underlying file. .El .It "Queries" -.Bl -tag -width ".Fn elf_getshstrndx" -compact +.Bl -tag -width 17n -compact .It Fn elf32_checksum , Fn elf64_checkum Compute checksum of an ELF object. .It Fn elf_getident Modified: head/lib/libelf/gelf.3 == --- head/lib/libelf/gelf.3 Sat Jun 2 08:29:07 2012(r236437) +++ head/lib/libelf/gelf.3 Sat Jun 2 08:47:26 2012(r236438) @@ -115,7 +115,7 @@ routines will signal an error if a GElf for the underlying ELF data type. .Ss Namespace use The GElf interface uses the following symbols: -.Bl -tag +.Bl -tag -width 8n .It GElf_* Class-independent data types. .It gelf_* @@ -125,16 +125,16 @@ For functions defined in the API set. This section provides an overview of the GElf programming APIs. Further information is provided in the manual page of each function listed here. -.Bl -tag +.Bl -tag -width 2n .It "Allocating ELF Data Structures" -.Bl -tag -compact +.Bl -tag -width 19n -compact .It Fn gelf_newehdr Allocate a new ELF Executable Header. .It Fn gelf_newphdr Allocate a new ELF Program Header Table. .El .It "Data Translation" -.Bl -tag -compact +.Bl -tag -width 19n -compact .It Fn gelf_xlatetof Translate the native representation of an ELF data structure to its file representation. @@ -143,7 +143,7 @@ Translate from the file representation o native representation. .El .It "Retrieving ELF Data" -.Bl -tag -compact +.Bl -tag -width 19n -compact
svn commit: r236439 - head/sys/dev/usb/wlan
Author: hselasky Date: Sat Jun 2 09:10:51 2012 New Revision: 236439 URL: http://svn.freebsd.org/changeset/base/236439 Log: Add appropriate checks for ic_bsschan being set to IEEE80211_CHAN_ANYC in some of the USB WLAN drivers. This fixes a panic when using monitor mode. MFC after:1 week Submitted by: PseudoCylon Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_ural.c Modified: head/sys/dev/usb/wlan/if_rum.c == --- head/sys/dev/usb/wlan/if_rum.c Sat Jun 2 08:47:26 2012 (r236438) +++ head/sys/dev/usb/wlan/if_rum.c Sat Jun 2 09:10:51 2012 (r236439) @@ -726,6 +726,12 @@ rum_newstate(struct ieee80211vap *vap, e ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + RUM_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); + return (-1); + } rum_update_slot(ic->ic_ifp); rum_enable_mrr(sc); rum_set_txpreamble(sc); @@ -2135,11 +2141,12 @@ rum_prepare_beacon(struct rum_softc *sc, if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) return; + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) + return; m0 = ieee80211_beacon_alloc(vap->iv_bss, &RUM_VAP(vap)->bo); - if (m0 == NULL) { + if (m0 == NULL) return; - } tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Sat Jun 2 08:47:26 2012 (r236438) +++ head/sys/dev/usb/wlan/if_run.c Sat Jun 2 09:10:51 2012 (r236439) @@ -1830,6 +1830,11 @@ run_newstate(struct ieee80211vap *vap, e if (vap->iv_opmode != IEEE80211_M_MONITOR) { struct ieee80211_node *ni; + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + RUN_UNLOCK(sc); + IEEE80211_LOCK(ic); + return (-1); + } run_updateslot(ic->ic_ifp); run_enable_mrr(sc); run_set_txpreamble(sc); @@ -2523,8 +2528,8 @@ run_rx_frame(struct run_softc *sc, struc struct run_rx_radiotap_header *tap = &sc->sc_rxtap; tap->wr_flags = 0; - tap->wr_chan_freq = htole16(ic->ic_bsschan->ic_freq); - tap->wr_chan_flags = htole16(ic->ic_bsschan->ic_flags); + tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); + tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); tap->wr_antsignal = rssi; tap->wr_antenna = ant; tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant); @@ -2778,8 +2783,8 @@ tr_setup: tap->wt_flags = 0; tap->wt_rate = rt2860_rates[data->ridx].rate; - tap->wt_chan_freq = htole16(vap->iv_bss->ni_chan->ic_freq); - tap->wt_chan_flags = htole16(vap->iv_bss->ni_chan->ic_flags); + tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); + tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); tap->wt_hwqueue = index; if (le16toh(txwi->phy) & RT2860_PHY_SHPRE) tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; @@ -3967,6 +3972,8 @@ run_update_beacon_cb(void *arg) if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) return; + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) + return; /* * No need to call ieee80211_beacon_update(), run_update_beacon() Modified: head/sys/dev/usb/wlan/if_ural.c == --- head/sys/dev/usb/wlan/if_ural.c Sat Jun 2 08:47:26 2012 (r236438) +++ head/sys/dev/usb/wlan/if_ural.c Sat Jun 2 09:10:51 2012 (r236439) @@ -713,6 +713,12 @@ ural_newstate(struct ieee80211vap *vap, ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + RAL_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); +
svn commit: r236441 - head/lib/libc/sys
Author: ed Date: Sat Jun 2 10:50:25 2012 New Revision: 236441 URL: http://svn.freebsd.org/changeset/base/236441 Log: Remove invalid remark about pipes. The stat structures returned on pipes seems to contain all the information required by POSIX. Especially the wording "and thus to a pipe" makes little sense, because it seems to imply a certain relationship between sockets and pipes that simply isn't there. MFC after:2 weeks Modified: head/lib/libc/sys/stat.2 Modified: head/lib/libc/sys/stat.2 == --- head/lib/libc/sys/stat.2Sat Jun 2 10:14:55 2012(r236440) +++ head/lib/libc/sys/stat.2Sat Jun 2 10:50:25 2012(r236441) @@ -28,7 +28,7 @@ .\" @(#)stat.2 8.4 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd November 17, 2011 +.Dd June 2, 2012 .Dt STAT 2 .Os .Sh NAME @@ -431,7 +431,7 @@ system call appeared in .Sh BUGS Applying .Fn fstat -to a socket (and thus to a pipe) +to a socket returns a zeroed buffer, except for the blocksize field, and a unique device and inode number. ___ 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: r236442 - in head/lib: libc++ libcxxrt
Author: dim Date: Sat Jun 2 11:00:48 2012 New Revision: 236442 URL: http://svn.freebsd.org/changeset/base/236442 Log: Tabify libcxxrt and libc++'s Makefiles. MFC after:3 days Modified: head/lib/libc++/Makefile head/lib/libcxxrt/Makefile Modified: head/lib/libc++/Makefile == --- head/lib/libc++/MakefileSat Jun 2 10:50:25 2012(r236441) +++ head/lib/libc++/MakefileSat Jun 2 11:00:48 2012(r236442) @@ -1,156 +1,156 @@ # $FreeBSD$ -LIBCXXRTDIR=${.CURDIR}/../../contrib/libcxxrt -HDRDIR= ${.CURDIR}/../../contrib/libc++/include -SRCDIR= ${.CURDIR}/../../contrib/libc++/src -CXXINCLUDEDIR= ${INCLUDEDIR}/c++/v${SHLIB_MAJOR} +LIBCXXRTDIR= ${.CURDIR}/../../contrib/libcxxrt +HDRDIR=${.CURDIR}/../../contrib/libc++/include +SRCDIR=${.CURDIR}/../../contrib/libc++/src +CXXINCLUDEDIR= ${INCLUDEDIR}/c++/v${SHLIB_MAJOR} .PATH: ${SRCDIR} -LIB=c++ -SHLIB_MAJOR=1 +LIB= c++ +SHLIB_MAJOR= 1 -SRCS+= algorithm.cpp\ -bind.cpp\ -chrono.cpp\ -condition_variable.cpp\ -debug.cpp\ -exception.cpp\ -future.cpp\ -hash.cpp\ -ios.cpp\ -iostream.cpp\ -locale.cpp\ -memory.cpp\ -mutex.cpp\ -new.cpp\ -random.cpp\ -regex.cpp\ -stdexcept.cpp\ -string.cpp\ -strstream.cpp\ -system_error.cpp\ -thread.cpp\ -typeinfo.cpp\ -utility.cpp\ -valarray.cpp - -WARNS= 0 -CXXFLAGS+= -I${HDRDIR} -I${LIBCXXRTDIR} -std=c++0x -nostdlib -DLIBCXXRT - -DPADD= ${LIBCXXRT} -LDADD= -lcxxrt -LDFLAGS+= --verbose -INCSGROUPS= STD EXT - -STD_HEADERS=__bit_reference\ -__config\ -__debug\ -__functional_03\ -__functional_base\ -__functional_base_03\ -__hash_table\ -__locale\ -__mutex_base\ -__split_buffer\ -__sso_allocator\ -__std_stream\ -__tree\ -__tuple\ -__tuple_03\ -__undef_min_max\ -algorithm\ -array\ -atomic\ -bitset\ -cassert\ -ccomplex\ -cctype\ -cerrno\ -cfenv\ -cfloat\ -chrono\ -cinttypes\ -ciso646\ -climits\ -clocale\ -cmath\ -codecvt\ -complex\ -complex.h\ -condition_variable\ -csetjmp\ -csignal\ -cstdarg\ -cstdbool\ -cstddef\ -cstdint\ -cstdio\ -cstdlib\ -cstring\ -ctgmath\ -ctime\ -cwchar\ -cwctype\ -deque\ -exception\ -forward_list\ -fstream\ -functional\ -future\ -initializer_list\ -iomanip\ -ios\ -iosfwd\ -iostream\ -istream\ -iterator\ -limits\ -list\ -locale\ -map\ -memory\ -mutex\ -new\ -numeric\ -ostream\ -queue\ -random\ -ratio\ -regex\ -scoped_allocator\ -set\ -sstream\ -stack\ -stdexcept\ -streambuf\ -string\ -strstream\ -system_error\ -tgmath.h\ -thread\ -tuple\ -type_traits\ -typeindex\ -typeinfo\ -unordered_map\ -unordered_set\ -utility\ -valarray\ -vector +SRCS+= algorithm.cpp\ + bind.cpp\ + chrono.cpp\ + condition_variable.cpp\ + debug.cpp\ + exception.cpp\ + future.cpp\ + hash.cpp\ + ios.cpp\ + iostream.cpp\ + locale.cpp\ + memory.cpp\ + mutex.cpp\ + new.cpp\ +
svn commit: r236443 - in head/share/man/man4: . man4.i386
Author: joel (doc committer) Date: Sat Jun 2 11:03:14 2012 New Revision: 236443 URL: http://svn.freebsd.org/changeset/base/236443 Log: mdoc: minor Bl improvements. Modified: head/share/man/man4/acpi_panasonic.4 head/share/man/man4/ahci.4 head/share/man/man4/ata.4 head/share/man/man4/firewire.4 head/share/man/man4/man4.i386/sbni.4 head/share/man/man4/mps.4 head/share/man/man4/mvs.4 head/share/man/man4/siis.4 head/share/man/man4/snd_hda.4 head/share/man/man4/usb.4 Modified: head/share/man/man4/acpi_panasonic.4 == --- head/share/man/man4/acpi_panasonic.4Sat Jun 2 11:00:48 2012 (r236442) +++ head/share/man/man4/acpi_panasonic.4Sat Jun 2 11:03:14 2012 (r236443) @@ -68,7 +68,7 @@ sound mute state via .Ss Hotkeys There are 9 hotkeys available on the supported hardware: .Pp -.Bl -tag -compact -offset indent +.Bl -tag -width 10n -compact -offset indent .It Sy Fn+F1 Make LCD backlight darker. .It Sy Fn+F2 @@ -105,7 +105,7 @@ When notified to .Xr devd 8 , the hotkey event provides the following information: .Pp -.Bl -tag -compact -offset indent +.Bl -tag -width 10n -compact -offset indent .It system .Qq Li ACPI .It subsystem @@ -119,7 +119,7 @@ Event code (see below). .El .Pp Event codes to be generated are assigned as follows: -.Bl -tag -offset indent +.Bl -tag -width 10n -offset indent .It 0x81-0x86, 0x89 .Sy Fn+F pressed. Modified: head/share/man/man4/ahci.4 == --- head/share/man/man4/ahci.4 Sat Jun 2 11:00:48 2012(r236442) +++ head/share/man/man4/ahci.4 Sat Jun 2 11:03:14 2012(r236443) @@ -52,7 +52,8 @@ The following tunables are settable from .Bl -ohang .It Va hint.ahci. Ns Ar X Ns Va .msi controls Message Signaled Interrupts (MSI) usage by the specified controller. -.Bl -tag -compact +.Pp +.Bl -tag -width 4n -offset indent -compact .It 0 MSI disabled; .It 1 @@ -72,7 +73,8 @@ controls SATA interface Power Management allowing some power to be saved at the cost of additional command latency. Possible values: -.Bl -tag -compact +.Pp +.Bl -tag -width 4n -offset indent -compact .It 0 interface Power Management is disabled (default); .It 1 @@ -86,6 +88,7 @@ driver initiates PARTIAL PM state transi .It 5 driver initiates SLUMBER PM state transition 125ms after port becomes idle. .El +.Pp Some controllers, such as ICH8, do not implement modes 2 and 3 with NCQ used. Because of artificial entering latency, performance degradation in modes 4 and 5 is much smaller then in modes 2 and 3. Modified: head/share/man/man4/ata.4 == --- head/share/man/man4/ata.4 Sat Jun 2 11:00:48 2012(r236442) +++ head/share/man/man4/ata.4 Sat Jun 2 11:03:14 2012(r236443) @@ -102,7 +102,8 @@ limits the initial ATA mode for every de controls SATA interface Power Management for the specified channel, allowing some power savings at the cost of additional command latency. Possible values: -.Bl -tag -compact +.Pp +.Bl -tag -width 4n -offset indent -compact .It 0 Interface Power Management is disabled. This is the default value. @@ -113,6 +114,7 @@ The host initiates a PARTIAL PM state tr .It 3 host initiates SLUMBER PM state transition every time port becomes idle. .El +.Pp Modes 2 and 3 are only supported for AHCI. .El .Sh DESCRIPTION Modified: head/share/man/man4/firewire.4 == --- head/share/man/man4/firewire.4 Sat Jun 2 11:00:48 2012 (r236442) +++ head/share/man/man4/firewire.4 Sat Jun 2 11:03:14 2012 (r236443) @@ -90,7 +90,7 @@ Please see .Pa http://wiki.freebsd.org/DebugWithDcons for details on how to setup debugging with firewire. .Sh FILES -.Bl -tag -compact +.Bl -tag -width "Pa /dev/fwmem0.0" -compact .It Pa /dev/fw0.0 .It Pa /dev/fwmem0.0 .El Modified: head/share/man/man4/man4.i386/sbni.4 == --- head/share/man/man4/man4.i386/sbni.4Sat Jun 2 11:00:48 2012 (r236442) +++ head/share/man/man4/man4.i386/sbni.4Sat Jun 2 11:03:14 2012 (r236443) @@ -97,7 +97,7 @@ bits 4-5 value, otherwise baud rate is s .Sh FILES The sources for the driver reside in: .Pp -.Bl -tag -compact +.Bl -tag -width ".Pa /sys/dev/sbni/if_sbni.c" -compact .It Pa /sys/dev/sbni/if_sbni.c .It Pa /sys/dev/sbni/if_sbnireg.h .It Pa /sys/dev/sbni/if_sbnivar.h Modified: head/share/man/man4/mps.4 == --- head/share/man/man4/mps.4 Sat Jun 2 11:00:48 2012(r236442) +++ head/share/man/man4/mps.4 Sat Jun 2 11:03:14 2012(r236443) @@ -166,7 +166,7 @@ variable, where X is the adapter number, or via .Xr
svn commit: r236444 - head/lib/libc++
Author: dim Date: Sat Jun 2 11:07:19 2012 New Revision: 236444 URL: http://svn.freebsd.org/changeset/base/236444 Log: Install libcxxrt's C++ ABI and unwind headers. This is done in libc++'s Makefile, so these headers go into the same destination directory as libc++'s own headers, currently /usr/include/c++/v1. MFC after:3 days Modified: head/lib/libc++/Makefile Modified: head/lib/libc++/Makefile == --- head/lib/libc++/MakefileSat Jun 2 11:03:14 2012(r236443) +++ head/lib/libc++/MakefileSat Jun 2 11:07:19 2012(r236444) @@ -138,10 +138,17 @@ STD_HEADERS= __bit_reference\ utility\ valarray\ vector +RT_HEADERS=cxxabi.h\ + unwind.h\ + unwind-arm.h\ + unwind-itanium.h .for hdr in ${STD_HEADERS} STD+= ${HDRDIR}/${hdr} .endfor +.for hdr in ${RT_HEADERS} +STD+= ${LIBCXXRTDIR}/${hdr} +.endfor STDDIR=${CXXINCLUDEDIR} EXT_HEADERS= __hash\ ___ 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: r236441 - head/lib/libc/sys
On Sat, 2 Jun 2012, Ed Schouten wrote: Log: Remove invalid remark about pipes. The stat structures returned on pipes seems to contain all the information required by POSIX. Especially the wording "and thus to a pipe" makes little sense, because it seems to imply a certain relationship between sockets and pipes that simply isn't there. It is because pipes are implemented in sockets in BSD. FreeBSD changed this in 1996, but fstat(1) still claims it, and I got fstat(1) instead of fstat(2) when I first tried to look this up: % FSTAT(1) FreeBSD General Commands Manual FSTAT(1) % ... % For example, the addresses mentioned above are the addresses which the % ``netstat -A'' command would print for tcp, udp, and unixdomain. Note % that since pipes are implemented using sockets, a pipe appears as a con- % nected unix domain stream socket. A unidirectional unix domain socket % indicates the direction of flow with an arrow (``<-'' or ``->''), and a % full duplex socket shows a double arrow (``<->''). Modified: head/lib/libc/sys/stat.2 == --- head/lib/libc/sys/stat.2Sat Jun 2 10:14:55 2012(r236440) +++ head/lib/libc/sys/stat.2Sat Jun 2 10:50:25 2012(r236441) ... @@ -431,7 +431,7 @@ system call appeared in .Sh BUGS Applying .Fn fstat -to a socket (and thus to a pipe) +to a socket returns a zeroed buffer, except for the blocksize field, and a unique device and inode number. This is still hard to parse. I think it says that fstat(2) returns a zeroed buffer except for a nonzero blocksize field in it, and it returns a unique device and inode number in addition to the buffer, but this makes no sense since fstat(1) only returns one thing. This thing isn't a generic buffer either -- other parts of the man page never use "buffer", and mostly refer to the returned thing formally as "the struct pointed to by sb". The normal informal description is more like "the stat buffer". stat.2 seems to be wrong about the unique device number too. uipc_usrreq.c sets st_blksize and st_ino as documented for the "blocksize" and "inode number" (except st_ino can be non-unique after wraparound at 2**32), but it always sets st_dev to the non-unique value NODEV. Other subsystems are more careful about inventing unique (st_dev, st_ino) ids. Pipes (ab)use devfs_alloc_cdp_inode() for st_dev and alloc_unr() for st_ino. Sockets still use the primitive ++unp_ino except when this wraps to 0, it is incremented again. I prefer the primitive version. 2**32 inode numbers should be enough for anyone :-), and there is no problem letting them grow very large and sparse, unlike for pids and device numbers, so hashing them to give uniqueness is just a waste of time and space. It probably takes a day or two to create 4G of sockets even if you try, and then the chance of a collision is about 1 in 2**32 unless you try. POSIX requires most fields in struct stat including st_dev to be "meaninful" for all POSIX file types including sockets, so the non-unique st_dev is just another thing for this BUGS section. This bug suite was only recently fixed for pipes. It seems to be very easy to fix for st_dev of sockets -- just use a single id reserved for all sockets. NODEV might already work, but only if no other subsystem abuses it and it can't happen in normal use. Or reserve a range of say 2**16 device ids for sockets, and use this to make (st_dev, st_ino) pairs unique for sockets. Nothing requires st_dev to be the same for all sockets, and 2**48 numbers should really be enough for anyone. Bruce ___ 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: r236450 - head/sys/netinet
Author: tuexen Date: Sat Jun 2 13:13:38 2012 New Revision: 236450 URL: http://svn.freebsd.org/changeset/base/236450 Log: Remove an unused parameter. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Jun 2 13:04:50 2012 (r236449) +++ head/sys/netinet/sctp_input.c Sat Jun 2 13:13:38 2012 (r236450) @@ -4516,7 +4516,7 @@ __attribute__((noinline)) } if (stcb == NULL) { /* no association, so it's out of the blue... */ - sctp_handle_ootb(m, iphlen, *offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, *offset, sh, inp, vrf_id, port); *offset = length; if (locked_tcb) { @@ -4554,7 +4554,7 @@ __attribute__((noinline)) SCTP_TCB_UNLOCK(locked_tcb); } sctp_handle_ootb(m, iphlen, *offset, sh, inp, - NULL, vrf_id, port); + vrf_id, port); return (NULL); } } else { @@ -5586,7 +5586,7 @@ sctp_common_input_processing(struct mbuf * NOT respond to any packet.. its OOTB. */ SCTP_TCB_UNLOCK(stcb); - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); goto out_now; } @@ -5630,7 +5630,7 @@ sctp_common_input_processing(struct mbuf } if (stcb == NULL) { /* out of the blue DATA chunk */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); goto out_now; } @@ -5699,7 +5699,7 @@ sctp_common_input_processing(struct mbuf /* * We consider OOTB any data sent during asoc setup. */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); SCTP_TCB_UNLOCK(stcb); goto out_now; Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sat Jun 2 13:04:50 2012(r236449) +++ head/sys/netinet/sctputil.c Sat Jun 2 13:13:38 2012(r236450) @@ -3994,7 +3994,7 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, -struct sctp_inpcb *inp, struct mbuf *op_err, uint32_t vrf_id, uint16_t port) +struct sctp_inpcb *inp, uint32_t vrf_id, uint16_t port) { struct sctp_chunkhdr *ch, chunk_buf; unsigned int chk_length; @@ -4049,7 +4049,7 @@ sctp_handle_ootb(struct mbuf *m, int iph if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (contains_init_chunk == 0))) { - sctp_send_abort(m, iphlen, sh, 0, op_err, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); } } Modified: head/sys/netinet/sctputil.h == --- head/sys/netinet/sctputil.h Sat Jun 2 13:04:50 2012(r236449) +++ head/sys/netinet/sctputil.h Sat Jun 2 13:13:38 2012(r236450) @@ -200,7 +200,7 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *, int, int, struct sctphdr *, -struct sctp_inpcb *, struct mbuf *, uint32_t, uint16_t); +struct sctp_inpcb *, uint32_t, uint16_t); int sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr, ___ 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: r236456 - in head/sys: amd64/include i386/include
Author: kib Date: Sat Jun 2 18:10:16 2012 New Revision: 236456 URL: http://svn.freebsd.org/changeset/base/236456 Log: Use plain store for atomic_store_rel on x86, instead of implicitly locked xchg instruction. IA32 memory model guarantees that store has release semantic, since stores cannot pass loads or stores. Reviewed by:bde, jhb Tested by: pho MFC after: 2 weeks Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h == --- head/sys/amd64/include/atomic.h Sat Jun 2 16:17:25 2012 (r236455) +++ head/sys/amd64/include/atomic.h Sat Jun 2 18:10:16 2012 (r236456) @@ -81,8 +81,9 @@ int atomic_cmpset_long(volatile u_long * u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); -#defineATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ -u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p); \ +#defineATOMIC_LOAD(TYPE, LOP) \ +u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) +#defineATOMIC_STORE(TYPE) \ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) #else /* !KLD_MODULE && __GNUCLIKE_ASM */ @@ -210,37 +211,43 @@ atomic_fetchadd_long(volatile u_long *p, return (v); } -#if defined(_KERNEL) && !defined(SMP) - /* - * We assume that a = b will do atomic loads and stores. However, on a - * PentiumPro or higher, reads may pass writes, so for that case we have - * to use a serializing instruction (i.e. with LOCK) to do the load in - * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we only need to take care of compiler. + * We assume that a = b will do atomic loads and stores. Due to the + * IA32 memory model, a simple store guarantees release semantics. + * + * However, loads may pass stores, so for atomic_load_acq we have to + * ensure a Store/Load barrier to do the load in SMP kernels. We use + * "lock cmpxchg" as recommended by the AMD Software Optimization + * Guide, and not mfence. For UP kernels, however, the cache of the + * single processor is always consistent, so we only need to take care + * of the compiler. */ -#defineATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +#defineATOMIC_STORE(TYPE) \ +static __inline void \ +atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile("" : : : "memory");\ + *p = v; \ +} \ +struct __hack + +#if defined(_KERNEL) && !defined(SMP) + +#defineATOMIC_LOAD(TYPE, LOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ u_##TYPE tmp; \ \ tmp = *p; \ - __asm __volatile ("" : : : "memory"); \ + __asm __volatile("" : : : "memory");\ return (tmp); \ } \ - \ -static __inline void \ -atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile ("" : : : "memory"); \ - *p = v; \ -} \ struct __hack #else /* !(_KERNEL && !SMP) */ -#defineATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +#defineATOMIC_LOAD(TYPE, LOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ @@ -254,19 +261,6 @@ atomic_load_acq_##TYPE(volatile u_##TYPE \ return (res); \ } \ - \ -/* \ - * The XCHG instruction asserts LOCK automagically.\ - */\ -static __inline void \ -atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{
Re: svn commit: r235537 - in head: etc/mtree include lib lib/libnandfs lib/libstand sbin sbin/nandfs sbin/newfs_nandfs share/man/man4 share/man/man5 share/mk sys/boot/arm/uboot sys/boot/i386/loader sy
on 17/05/2012 13:11 Grzegorz Bernacki said the following: > Author: gber > Date: Thu May 17 10:11:18 2012 > New Revision: 235537 > URL: http://svn.freebsd.org/changeset/base/235537 > > Log: > Import work done under project/nand (@235533) into head. > > The NAND Flash environment consists of several distinct components: > - NAND framework (drivers harness for NAND controllers and NAND chips) > - NAND simulator (NANDsim) > - NAND file system (NAND FS) > - Companion tools and utilities > - Documentation (manual pages) > > This work is still experimental. Please use with caution. > > Obtained from: Semihalf > Supported by: FreeBSD Foundation, Juniper Networks [snip] > head/sys/modules/Makefile Looks like this commit has unintentionally [?] removed wbwd-related lines from sys/modules/Makefile. Please fix. > head/usr.sbin/Makefile [snip] > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** The diff that I see: @@ -217,6 +217,8 @@ SUBDIR= ${_3dfx} \ ${_mwlfw} \ mxge \ my \ + ${_nandfs} \ + ${_nandsim} \ ${_ncp} \ ${_ncv} \ ${_ndis} \ @@ -335,7 +337,6 @@ SUBDIR= ${_3dfx} \ vx \ ${_vxge} \ wb \ - ${_wbwd} \ ${_wi} \ wlan \ wlan_acl \ @@ -398,6 +399,11 @@ _ipdivert= ipdivert _ipfw= ipfw .endif +.if ${MK_NAND} != "no" || defined(ALL_MODULES) +_nandfs= nandfs +_nandsim= nandsim +.endif + .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES) _netgraph= netgraph .endif @@ -513,7 +519,6 @@ _stg= stg _streams= streams _svr4= svr4 _vxge= vxge -_wbwd= wbwd _wi= wi _xe= xe .if ${MK_ZFS} != "no" || defined(ALL_MODULES) @@ -708,7 +713,6 @@ _viawd= viawd _virtio= virtio _vxge= vxge _x86bios= x86bios -_wbwd= wbwd _wi= wi _wpi= wpi .if ${MK_SOURCELESS_UCODE} != "no" -- Andriy Gapon ___ 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: r236465 - in head/sys: kern sys
Author: kib Date: Sat Jun 2 18:44:40 2012 New Revision: 236465 URL: http://svn.freebsd.org/changeset/base/236465 Log: Update the print mask for decoding b_flags. Add print masks for b_vflags and b_xflags_t and print them as well. MFC after: 1 week Modified: head/sys/kern/vfs_bio.c head/sys/sys/buf.h Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Sat Jun 2 18:36:29 2012(r236464) +++ head/sys/kern/vfs_bio.c Sat Jun 2 18:44:40 2012(r236465) @@ -3995,7 +3995,9 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) } db_printf("buf at %p\n", bp); - db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS); + db_printf("b_flags = 0x%b b_xflags=0x%b b_vflags=0x%b\n", + (u_int)bp->b_flags, PRINT_BUF_FLAGS, (u_int)bp->b_xflags, + PRINT_BUF_XFLAGS, (u_int)bp->b_vflags, PRINT_BUF_VFLAGS); db_printf( "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n" "b_bufobj = (%p), b_data = %p, b_blkno = %jd, b_lblkno = %jd, " Modified: head/sys/sys/buf.h == --- head/sys/sys/buf.h Sat Jun 2 18:36:29 2012(r236464) +++ head/sys/sys/buf.h Sat Jun 2 18:44:40 2012(r236465) @@ -224,8 +224,8 @@ struct buf { #define B_CLUSTER 0x4000 /* pagein op, so swap() can count it */ #define B_REMFREE 0x8000 /* Delayed bremfree */ -#define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34b27" \ - "\33paging\32b25\31b24\30b23\27relbuf\26dirty\25b20" \ +#define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34managed" \ + "\33paging\32needsgiant\31nocopy\30b23\27relbuf\26dirty\25b20" \ "\24b19\23b18\22clusterok\21malloc\20nocache\17b14\16inval" \ "\15b12\14b11\13eintr\12done\11persist\10delwri\7validsuspwrt" \ "\6cache\5deferred\4direct\3async\2needcommit\1age" @@ -239,6 +239,8 @@ struct buf { #define BX_BKGRDMARKER 0x0020 /* Mark buffer for splay tree */ #defineBX_ALTDATA 0x0040 /* Holds extended data */ +#definePRINT_BUF_XFLAGS "\20\7altdata\6bkgrdmarker\5bkgrdwrite\2clean\1dirty" + #defineNOOFFSET(-1LL) /* No buffer offset calculated yet */ /* @@ -249,6 +251,8 @@ struct buf { #defineBV_BKGRDWAIT0x0004 /* Background write waiting */ #defineBV_INFREECNT0x8000 /* buf is counted in numfreebufs */ +#definePRINT_BUF_VFLAGS "\20\40infreecnt\3bkrgwait\2bkgrdinprog\1scanned" + #ifdef _KERNEL /* * Buffer locking ___ 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: r236486 - head/sys/sys
Author: marius Date: Sat Jun 2 19:30:49 2012 New Revision: 236486 URL: http://svn.freebsd.org/changeset/base/236486 Log: Add nitems(), a macro for determining the number of elements in a statically-allocated array. Obtained from:OpenBSD (in principle) MFC after:3 days Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hSat Jun 2 19:21:34 2012(r236485) +++ head/sys/sys/param.hSat Jun 2 19:30:49 2012(r236486) @@ -273,6 +273,7 @@ #ifndef howmany #definehowmany(x, y) (((x)+((y)-1))/(y)) #endif +#definenitems(x) (sizeof((x)) / sizeof((x)[0])) #definerounddown(x, y) (((x)/(y))*(y)) #defineroundup(x, y) x)+((y)-1))/(y))*(y)) /* to any y */ #defineroundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ ___ 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: r236487 - in head/sys: kern sys
Author: kib Date: Sat Jun 2 19:39:12 2012 New Revision: 236487 URL: http://svn.freebsd.org/changeset/base/236487 Log: Fix typo [1]. Use commas to separate flag printouts, in style with other parts of function. Submitted by: bf [1] MFC after: 1 week Modified: head/sys/kern/vfs_bio.c head/sys/sys/buf.h Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Sat Jun 2 19:30:49 2012(r236486) +++ head/sys/kern/vfs_bio.c Sat Jun 2 19:39:12 2012(r236487) @@ -3995,7 +3995,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) } db_printf("buf at %p\n", bp); - db_printf("b_flags = 0x%b b_xflags=0x%b b_vflags=0x%b\n", + db_printf("b_flags = 0x%b, b_xflags=0x%b, b_vflags=0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS, (u_int)bp->b_xflags, PRINT_BUF_XFLAGS, (u_int)bp->b_vflags, PRINT_BUF_VFLAGS); db_printf( Modified: head/sys/sys/buf.h == --- head/sys/sys/buf.h Sat Jun 2 19:30:49 2012(r236486) +++ head/sys/sys/buf.h Sat Jun 2 19:39:12 2012(r236487) @@ -251,7 +251,7 @@ struct buf { #defineBV_BKGRDWAIT0x0004 /* Background write waiting */ #defineBV_INFREECNT0x8000 /* buf is counted in numfreebufs */ -#definePRINT_BUF_VFLAGS "\20\40infreecnt\3bkrgwait\2bkgrdinprog\1scanned" +#definePRINT_BUF_VFLAGS "\20\40infreecnt\3bkgrdwait\2bkgrdinprog\1scanned" #ifdef _KERNEL /* ___ 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: r236488 - in head/sys/dev: bge sym
Author: marius Date: Sat Jun 2 19:41:28 2012 New Revision: 236488 URL: http://svn.freebsd.org/changeset/base/236488 Log: Take advantage of nitems(). MFC after:3 days Modified: head/sys/dev/bge/if_bge.c head/sys/dev/sym/sym_hipd.c Modified: head/sys/dev/bge/if_bge.c == --- head/sys/dev/bge/if_bge.c Sat Jun 2 19:39:12 2012(r236487) +++ head/sys/dev/bge/if_bge.c Sat Jun 2 19:41:28 2012(r236488) @@ -2766,9 +2766,8 @@ bge_mbox_reorder(struct bge_softc *sc) }; devclass_t pci, pcib; device_t bus, dev; - int count, i; + int i; - count = sizeof(mbox_reorder_lists) / sizeof(mbox_reorder_lists[0]); pci = devclass_find("pci"); pcib = devclass_find("pcib"); dev = sc->bge_dev; @@ -2778,7 +2777,7 @@ bge_mbox_reorder(struct bge_softc *sc) bus = device_get_parent(dev); if (device_get_devclass(dev) != pcib) break; - for (i = 0; i < count; i++) { + for (i = 0; i < nitems(mbox_reorder_lists); i++) { if (pci_get_vendor(dev) == mbox_reorder_lists[i].vendor && pci_get_device(dev) == Modified: head/sys/dev/sym/sym_hipd.c == --- head/sys/dev/sym/sym_hipd.c Sat Jun 2 19:39:12 2012(r236487) +++ head/sys/dev/sym/sym_hipd.c Sat Jun 2 19:41:28 2012(r236488) @@ -8411,9 +8411,6 @@ static const struct sym_pci_chip sym_pci FE_RAM|FE_IO256|FE_LEDC} }; -#define sym_pci_num_devs \ - (sizeof(sym_pci_dev_table) / sizeof(sym_pci_dev_table[0])) - /* * Look up the chip table. * @@ -8434,7 +8431,7 @@ sym_find_pci_chip(device_t dev) device_id = pci_get_device(dev); revision = pci_get_revid(dev); - for (i = 0; i < sym_pci_num_devs; i++) { + for (i = 0; i < nitems(sym_pci_dev_table); i++) { chip = &sym_pci_dev_table[i]; if (device_id != chip->device_id) continue; ___ 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: r236489 - head/sys/dev/iwn
Author: marius Date: Sat Jun 2 20:00:52 2012 New Revision: 236489 URL: http://svn.freebsd.org/changeset/base/236489 Log: Remove nitems() now that it lives in since r236486. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sat Jun 2 19:41:28 2012(r236488) +++ head/sys/dev/iwn/if_iwn.c Sat Jun 2 20:00:52 2012(r236489) @@ -2005,8 +2005,6 @@ iwn_setregdomain(struct ieee80211com *ic return 0; } -#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) - static void iwn_read_eeprom_enhinfo(struct iwn_softc *sc) { ___ 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: r236491 - head/sys/dev/mmc
Author: marius Date: Sat Jun 2 20:47:00 2012 New Revision: 236491 URL: http://svn.freebsd.org/changeset/base/236491 Log: Add missing prototypes. While at it, sort them alphabetically. MFC after:3 days Modified: head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmc.c == --- head/sys/dev/mmc/mmc.c Sat Jun 2 20:18:34 2012(r236490) +++ head/sys/dev/mmc/mmc.c Sat Jun 2 20:47:00 2012(r236491) @@ -112,11 +112,21 @@ static int mmc_debug; SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RW, &mmc_debug, 0, "Debug level"); /* bus entry points */ -static int mmc_probe(device_t dev); +static int mmc_acquire_bus(device_t busdev, device_t dev); static int mmc_attach(device_t dev); +static int mmc_child_location_str(device_t dev, device_t child, char *buf, +size_t buflen); static int mmc_detach(device_t dev); -static int mmc_suspend(device_t dev); +static int mmc_probe(device_t dev); +static int mmc_read_ivar(device_t bus, device_t child, int which, +uintptr_t *result); +static int mmc_release_bus(device_t busdev, device_t dev); static int mmc_resume(device_t dev); +static int mmc_suspend(device_t dev); +static int mmc_wait_for_request(device_t brdev, device_t reqdev, +struct mmc_request *req); +static int mmc_write_ivar(device_t bus, device_t child, int which, +uintptr_t value); #define MMC_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #defineMMC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) @@ -127,25 +137,69 @@ static int mmc_resume(device_t dev); #define MMC_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); #define MMC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); +static int mmc_all_send_cid(struct mmc_softc *sc, uint32_t *rawcid); +static void mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr); +static void mmc_app_decode_sd_status(uint32_t *raw_sd_status, +struct mmc_sd_status *sd_status); +static int mmc_app_sd_status(struct mmc_softc *sc, uint16_t rca, +uint32_t *rawsdstatus); +static int mmc_app_send_scr(struct mmc_softc *sc, uint16_t rca, +uint32_t *rawscr); static int mmc_calculate_clock(struct mmc_softc *sc); -static void mmc_delayed_attach(void *); +static void mmc_decode_cid_mmc(uint32_t *raw_cid, struct mmc_cid *cid); +static void mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid); +static void mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd); +static void mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); +static void mmc_delayed_attach(void *xsc); +static int mmc_delete_cards(struct mmc_softc *sc); +static void mmc_discover_cards(struct mmc_softc *sc); +static void mmc_format_card_id_string(struct mmc_ivars *ivar); +static void mmc_go_discovery(struct mmc_softc *sc); +static uint32_t mmc_get_bits(uint32_t *bits, int bit_len, int start, +int size); +static int mmc_highest_voltage(uint32_t ocr); +static void mmc_idle_cards(struct mmc_softc *sc); +static void mmc_ms_delay(int ms); +static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard); static void mmc_power_down(struct mmc_softc *sc); +static void mmc_power_up(struct mmc_softc *sc); +static void mmc_rescan_cards(struct mmc_softc *sc); +static void mmc_scan(struct mmc_softc *sc); +static int mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, +uint8_t value, uint8_t *res); +static int mmc_select_card(struct mmc_softc *sc, uint16_t rca); +static uint32_t mmc_select_vdd(struct mmc_softc *sc, uint32_t ocr); +static int mmc_send_app_op_cond(struct mmc_softc *sc, uint32_t ocr, +uint32_t *rocr); +static int mmc_send_csd(struct mmc_softc *sc, uint16_t rca, uint32_t *rawcsd); +static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd); +static int mmc_send_if_cond(struct mmc_softc *sc, uint8_t vhs); +static int mmc_send_op_cond(struct mmc_softc *sc, uint32_t ocr, +uint32_t *rocr); +static int mmc_send_relative_addr(struct mmc_softc *sc, uint32_t *resp); +static int mmc_send_status(struct mmc_softc *sc, uint16_t rca, +uint32_t *status); +static int mmc_set_blocklen(struct mmc_softc *sc, uint32_t len); +static int mmc_set_card_bus_width(struct mmc_softc *sc, uint16_t rca, +int width); +static int mmc_set_relative_addr(struct mmc_softc *sc, uint16_t resp); +static int mmc_set_timing(struct mmc_softc *sc, int timing); +static int mmc_switch(struct mmc_softc *sc, uint8_t set, uint8_t index, +uint8_t value); +static int mmc_test_bus_width(struct mmc_softc *sc); +static int mmc_wait_for_app_cmd(struct mmc_softc *sc, uint32_t rca, +struct mmc_command *cmd, int retries); static int mmc_wait_for_cmd(struct mmc_softc *sc, struct mmc_command *cmd, int retries); static int mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, uint32_t arg, uint32_t flags, uint32_t *resp, int retries); -static int mmc_select_card(struct mmc_softc *sc, uint16_t
svn commit: r236492 - head/sys/netinet
Author: tuexen Date: Sat Jun 2 20:53:23 2012 New Revision: 236492 URL: http://svn.freebsd.org/changeset/base/236492 Log: Don't request data from the IPv6 layer, which is not used. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sat Jun 2 20:47:00 2012 (r236491) +++ head/sys/netinet/sctp_output.c Sat Jun 2 20:53:23 2012 (r236492) @@ -11047,11 +11047,8 @@ sctp_send_shutdown_complete2(struct mbuf #endif #ifdef INET6 if (ip6_out != NULL) { - struct route_in6 ro; int ret; - struct ifnet *ifp = NULL; - bzero(&ro, sizeof(ro)); mlen = SCTP_BUF_LEN(mout); #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) @@ -11077,11 +11074,7 @@ sctp_send_shutdown_complete2(struct mbuf SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); + SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); } #endif SCTP_STAT_INCR(sctps_sendpackets); @@ -12148,12 +12141,8 @@ sctp_send_abort(struct mbuf *m, int iphl #endif #ifdef INET6 if (ip6_out != NULL) { - struct route_in6 ro; int ret; - struct ifnet *ifp = NULL; - /* zap the stack pointer to the route */ - bzero(&ro, sizeof(ro)); if (port) { udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); } @@ -12184,11 +12173,7 @@ sctp_send_abort(struct mbuf *m, int iphl SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); + SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); } #endif SCTP_STAT_INCR(sctps_sendpackets); @@ -12414,12 +12399,8 @@ sctp_send_operr_to(struct mbuf *m, int i #endif #ifdef INET6 if (ip6_out != NULL) { - struct route_in6 ro; int ret; - struct ifnet *ifp = NULL; - /* zap the stack pointer to the route */ - bzero(&ro, sizeof(ro)); if (port) { udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); } @@ -12448,11 +12429,7 @@ sctp_send_operr_to(struct mbuf *m, int i SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); + SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); } #endif SCTP_STAT_INCR(sctps_sendpackets); ___ 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: r236493 - head/sys/netinet
Author: tuexen Date: Sat Jun 2 21:22:26 2012 New Revision: 236493 URL: http://svn.freebsd.org/changeset/base/236493 Log: Honor sysctl for TTL. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sat Jun 2 20:53:23 2012 (r236492) +++ head/sys/netinet/sctp_output.c Sat Jun 2 21:22:26 2012 (r236493) @@ -10923,7 +10923,7 @@ sctp_send_shutdown_complete2(struct mbuf iph_out->ip_tos = (u_char)0; iph_out->ip_id = 0; iph_out->ip_off = 0; - iph_out->ip_ttl = MAXTTL; + iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out->ip_p = IPPROTO_UDP; } else { @@ -11992,7 +11992,7 @@ sctp_send_abort(struct mbuf *m, int iphl iph_out->ip_tos = (u_char)0; iph_out->ip_id = 0; iph_out->ip_off = 0; - iph_out->ip_ttl = MAXTTL; + iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out->ip_p = IPPROTO_UDP; } else { @@ -12255,7 +12255,7 @@ sctp_send_operr_to(struct mbuf *m, int i iph_out->ip_tos = (u_char)0; iph_out->ip_id = 0; iph_out->ip_off = 0; - iph_out->ip_ttl = MAXTTL; + iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out->ip_p = IPPROTO_UDP; } else { ___ 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: r236494 - in head/sys: amd64/amd64 i386/i386
Author: alc Date: Sat Jun 2 22:14:10 2012 New Revision: 236494 URL: http://svn.freebsd.org/changeset/base/236494 Log: Isolate the global pv list lock from data and other locks to prevent false sharing within the cache. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Sat Jun 2 21:22:26 2012(r236493) +++ head/sys/amd64/amd64/pmap.c Sat Jun 2 22:14:10 2012(r236494) @@ -200,12 +200,22 @@ static u_int64_t DMPDphys; /* phys addr static u_int64_t DMPDPphys; /* phys addr of direct mapped level 3 */ /* + * Isolate the global pv list lock from data and other locks to prevent false + * sharing within the cache. + */ +static struct { + struct rwlock lock; + charpadding[CACHE_LINE_SIZE - sizeof(struct rwlock)]; +} pvh_global __aligned(CACHE_LINE_SIZE); + +#definepvh_global_lock pvh_global.lock + +/* * Data for the pv entry allocation mechanism */ static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); static long pv_entry_count; static struct md_page *pv_table; -static struct rwlock pvh_global_lock; /* * All those kernel PT submaps that BSD is so fond of Modified: head/sys/i386/i386/pmap.c == --- head/sys/i386/i386/pmap.c Sat Jun 2 21:22:26 2012(r236493) +++ head/sys/i386/i386/pmap.c Sat Jun 2 22:14:10 2012(r236494) @@ -232,12 +232,22 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_ena static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ /* + * Isolate the global pv list lock from data and other locks to prevent false + * sharing within the cache. + */ +static struct { + struct rwlock lock; + charpadding[CACHE_LINE_SIZE - sizeof(struct rwlock)]; +} pvh_global __aligned(CACHE_LINE_SIZE); + +#definepvh_global_lock pvh_global.lock + +/* * Data for the pv entry allocation mechanism */ static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; static struct md_page *pv_table; -static struct rwlock pvh_global_lock; static int shpgperproc = PMAP_SHPGPERPROC; struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */ ___ 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: r236495 - head/sys/arm/at91
Author: marius Date: Sun Jun 3 00:54:10 2012 New Revision: 236495 URL: http://svn.freebsd.org/changeset/base/236495 Log: - Prepend the device description with "AT91" to reflect its nature. [1] - Move DMA tag and map creature to at91_spi_activate() where the other resource allocation also lives. [1] - Flesh out at91_spi_deactivate(). [1] - Work around the "Software Reset must be Written Twice" erratum. - For now, run the bus at the slowest speed possible in order to work around data corruption on transit even seen with 9 MHz on ETHERNUT5 (15 MHz maximum) and AT45DB321D (20 MHz maximum). This also serves as a poor man's work-around for the "NPCSx rises if no data data is to be transmitted" erratum of RM9200. Being able to use the appropriate bus speed would require: 1) Adding a proper work-around for the RM9200 bug consisting of taking the chip select control away from the SPI peripheral and managing it directly as a GPIO line. 2) Taking the maximum frequencies supported by the actual board and the slave devices into account and basing the whole thing on the master clock instead of hardcoding a divisor as previously done. 3) Fixing the above mentioned data corruption. - KASSERT that TX/RX command and data sizes match on transfers. - Introduce a mutex ensuring that only one child device is running a SPI transfer at a time. [1] - Add preliminary, #ifdef'ed out support for setting the chip select. [1] - Use the RX instead of the TX commando size when setting up the RX side of a transfer. - For controllers having SPI_SR_TXEMPTY, i.e. !RM9200, also wait for the completion of the TX part of transfers before stopping the whole thing again. - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1, partially] Additional testing by: Ian Lepore Submitted by: Ian Lepore [1] MFC after: 1 week Modified: head/sys/arm/at91/at91_spi.c head/sys/arm/at91/at91_spireg.h Modified: head/sys/arm/at91/at91_spi.c == --- head/sys/arm/at91/at91_spi.cSat Jun 2 22:14:10 2012 (r236494) +++ head/sys/arm/at91/at91_spi.cSun Jun 3 00:54:10 2012 (r236495) @@ -1,5 +1,7 @@ /*- - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2011-2012 Ian Lepore. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,17 +33,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include +#include + #include #include #include +#include #include + #include "spibus_if.h" struct at91_spi_softc @@ -50,29 +56,39 @@ struct at91_spi_softc void *intrhand; /* Interrupt handle */ struct resource *irq_res; /* IRQ resource */ struct resource *mem_res; /* Memory resource */ - bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ + bus_dma_tag_t dmatag; /* bus dma tag for transfers */ bus_dmamap_t map[4];/* Maps for the transaction */ - int rxdone; + struct sx xfer_mtx; /* Enforce one transfer at a time */ + uint32_t xfer_mask; /* Bits to wait on for completion */ + uint32_t xfer_done; /* interrupt<->mainthread signaling */ }; +#define CS_TO_MR(cs) ((~(1 << (cs)) & 0x0f) << 16) + static inline uint32_t RD4(struct at91_spi_softc *sc, bus_size_t off) { - return bus_read_4(sc->mem_res, off); + + return (bus_read_4(sc->mem_res, off)); } static inline void WR4(struct at91_spi_softc *sc, bus_size_t off, uint32_t val) { + bus_write_4(sc->mem_res, off, val); } /* bus entry points */ -static int at91_spi_probe(device_t dev); static int at91_spi_attach(device_t dev); static int at91_spi_detach(device_t dev); +static int at91_spi_probe(device_t dev); +static int at91_spi_transfer(device_t dev, device_t child, +struct spi_command *cmd); /* helper routines */ +static void at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, +int error); static int at91_spi_activate(device_t dev); static void at91_spi_deactivate(device_t dev); static void at91_spi_intr(void *arg); @@ -80,43 +96,64 @@ static void at91_spi_intr(void *arg); static int at91_spi_probe(device_t dev) { - device_set_desc(dev, "SPI"); + + device_set_desc(dev, "AT91 SPI"); return (0); } static int at91_spi_attach(device_t dev) { - struct at91_spi_softc *sc = device_get_softc(dev); - int err, i; + struct at91_spi_softc *sc; + int err; + uint32_t csr; + + sc = device_get_softc(dev); sc->dev = dev; + sx_init(&sc->xfer_mtx, d
svn commit: r236496 - head/sys/dev/flash
Author: marius Date: Sun Jun 3 01:00:55 2012 New Revision: 236496 URL: http://svn.freebsd.org/changeset/base/236496 Log: - Loop up to 3 seconds when waiting for a device to get ready. [1] - Make the device description match the driver name. - Identify the chip variant based on the JEDEC and use that information to use the proper values for page count, offset and size instead of hardcoding a AT45DB642x with 2^N byte page support disabled. - Take advantage of bioq_takefirst(). - Given that CONTINUOUS_ARRAY_READ_HF (0x0b) command isn't even mentioned in Atmel's DataFlash Application Note, as suggested by the previous comment may not work on all all devices and actually doesn't properly on at least AT45DB321D (JEDEC 0x1f2701), rewrite at45d_task() to use CONTINUOUS_ARRAY_READ (0xe8) for reading instead. This rewrite is laid out in a way allowing to easily add support for BIO_DELETE later on. - Add support for reads and writes not starting on a page boundary. - Verify the flash content after writing. - Let at45d_task() gracefully handle errors on SPI transfers and the device not becoming ready afterwards again. [1] - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1] Additional testing by:Ian Lepore Submitted by: Ian Lepore [1] MFC after:1 week Modified: head/sys/dev/flash/at45d.c Modified: head/sys/dev/flash/at45d.c == --- head/sys/dev/flash/at45d.c Sun Jun 3 00:54:10 2012(r236495) +++ head/sys/dev/flash/at45d.c Sun Jun 3 01:00:55 2012(r236496) @@ -1,5 +1,8 @@ /*- - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2006 M. Warner Losh + * Copyright (c) 2011-2012 Ian Lepore + * Copyright (c) 2012 Marius Strobl + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,44 +45,82 @@ __FBSDID("$FreeBSD$"); #include #include "spibus_if.h" -struct at45d_softc +struct at45d_flash_ident { - struct intr_config_hook config_intrhook; - device_t dev; - struct mtx sc_mtx; - struct disk *disk; - struct proc *p; - struct bio_queue_head bio_queue; + const char *name; + uint32_tjedec; + uint16_tpagecount; + uint16_tpageoffset; + uint16_tpagesize; + uint16_tpagesize2n; }; -#define AT45D_LOCK(_sc)mtx_lock(&(_sc)->sc_mtx) +struct at45d_softc +{ + struct bio_queue_head bio_queue; + struct mtx sc_mtx; + struct disk *disk; + struct proc *p; + struct intr_config_hook config_intrhook; + device_tdev; + uint16_tpagecount; + uint16_tpageoffset; + uint16_tpagesize; +}; + +#defineAT45D_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #defineAT45D_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define AT45D_LOCK_INIT(_sc) \ +#defineAT45D_LOCK_INIT(_sc) \ mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ "at45d", MTX_DEF) -#define AT45D_LOCK_DESTROY(_sc)mtx_destroy(&_sc->sc_mtx); -#define AT45D_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); -#define AT45D_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); - -static void at45d_delayed_attach(void *xsc); +#defineAT45D_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#defineAT45D_ASSERT_LOCKED(_sc)mtx_assert(&_sc->sc_mtx, MA_OWNED); +#defineAT45D_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); + +/* bus entry points */ +static device_attach_t at45d_attach; +static device_detach_t at45d_detach; +static device_probe_t at45d_probe; /* disk routines */ -static int at45d_open(struct disk *dp); static int at45d_close(struct disk *dp); +static int at45d_open(struct disk *dp); static void at45d_strategy(struct bio *bp); static void at45d_task(void *arg); -#define CONTINUOUS_ARRAY_READ 0xE8 -#define CONTINUOUS_ARRAY_READ_HF 0x0B -#define CONTINUOUS_ARRAY_READ_LF 0x03 -#define STATUS_REGISTER_READ 0xD7 -#define PROGRAM_THROUGH_BUFFER 0x82 -#define MANUFACTURER_ID0x9F +/* helper routines */ +static void at45d_delayed_attach(void *xsc); +static int at45d_get_mfg_info(device_t dev, uint8_t *resp); +static int at45d_get_status(device_t dev, uint8_t *status); +static int at45d_wait_ready(device_t dev, uint8_t *status); + +#defineBUFFER_TRANSFER 0x53 +#defineBUFFER_COMPARE 0x60 +#definePROGRAM_THROUGH_BUFFER 0x82 +#defineMANUFACTURER_ID 0x9f +#defineSTATUS_REGISTER_READ
svn commit: r236497 - head/sys/arm/conf
Author: marius Date: Sun Jun 3 01:07:55 2012 New Revision: 236497 URL: http://svn.freebsd.org/changeset/base/236497 Log: - Now that the DataFlash related drivers work properly (at91_spi(4) since r236495 and at45d(4) since r236496), enable them by default. - Sort BOOTP options. Modified: head/sys/arm/conf/ETHERNUT5 Modified: head/sys/arm/conf/ETHERNUT5 == --- head/sys/arm/conf/ETHERNUT5 Sun Jun 3 01:00:55 2012(r236496) +++ head/sys/arm/conf/ETHERNUT5 Sun Jun 3 01:07:55 2012(r236497) @@ -66,11 +66,11 @@ options PRINTF_BUFR_SIZE=128# Prevent #options INCLUDE_CONFIG_FILE # Include this file in kernel # required for netbooting -optionsBOOTP_NFSROOT optionsBOOTP +optionsBOOTP_COMPAT +optionsBOOTP_NFSROOT optionsBOOTP_NFSV3 optionsBOOTP_WIRED_TO=ate0 -optionsBOOTP_COMPAT # alternatively, boot from a MMC/SD memory card #options ROOTDEVNAME=\"ufs:/dev/mmcsd0a\" @@ -117,11 +117,11 @@ options AT91_MCI_HAS_4WIRE device mmc # MMC/SD bus device mmcsd # MMC/SD memory card -# DataFlash - totally b0rken drivers -#deviceat91_spi# Atmel AT91 Serial Peripheral Interface -#devicespibus # SPI bus -#deviceat45d # Atmel AT45D -#devicegeom_map# GEOM partition mapping +# DataFlash +device at91_spi# Atmel AT91 Serial Peripheral Interface +device spibus # SPI bus +device at45d # Atmel AT45D +device geom_map# GEOM partition mapping # Pseudo devices. device loop# Network loopback ___ 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: r236498 - head/sys/arm/at91
Author: imp Date: Sun Jun 3 05:36:25 2012 New Revision: 236498 URL: http://svn.freebsd.org/changeset/base/236498 Log: Remove stray repeated line... Modified: head/sys/arm/at91/at91_reset.S Modified: head/sys/arm/at91/at91_reset.S == --- head/sys/arm/at91/at91_reset.S Sun Jun 3 01:07:55 2012 (r236497) +++ head/sys/arm/at91/at91_reset.S Sun Jun 3 05:36:25 2012 (r236498) @@ -18,7 +18,6 @@ __FBSDID("$FreeBSD$"); * the data until the clock restarts. * * If the User reset is programed to assert a general reset, the data - * If the User reset is programed to assert a general reset, the data * maintained by the SDRAM leads to a data bus conflict and adversly affects * the boot memories connected to the EBI: * + NAND Flash boot functionality, if the system boots out of internal ROM. ___ 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: r236500 - in head/usr.sbin: adduser arp bluetooth/bthidcontrol bluetooth/btpand bluetooth/hccontrol bluetooth/l2control bluetooth/sdpcontrol digictl fwcontrol gssd
Author: joel (doc committer) Date: Sun Jun 3 06:57:47 2012 New Revision: 236500 URL: http://svn.freebsd.org/changeset/base/236500 Log: mdoc: add missing width argument to Bl -tag. Modified: head/usr.sbin/adduser/rmuser.8 head/usr.sbin/arp/arp.4 head/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 head/usr.sbin/bluetooth/btpand/btpand.8 head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/l2control/l2control.8 head/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 head/usr.sbin/digictl/digictl.8 head/usr.sbin/fwcontrol/fwcontrol.8 head/usr.sbin/gssd/gssd.8 Modified: head/usr.sbin/adduser/rmuser.8 == --- head/usr.sbin/adduser/rmuser.8 Sun Jun 3 05:47:42 2012 (r236499) +++ head/usr.sbin/adduser/rmuser.8 Sun Jun 3 06:57:47 2012 (r236500) @@ -157,7 +157,7 @@ Identifies one or more users to be remov interactively asks for one or more users to be removed. .El .Sh FILES -.Bl -tag -compact +.Bl -tag -width "Pa /etc/master.passwd" -compact .It Pa /etc/master.passwd .It Pa /etc/passwd .It Pa /etc/group Modified: head/usr.sbin/arp/arp.4 == --- head/usr.sbin/arp/arp.4 Sun Jun 3 05:47:42 2012(r236499) +++ head/usr.sbin/arp/arp.4 Sun Jun 3 06:57:47 2012(r236500) @@ -119,7 +119,7 @@ branch of the .Xr sysctl 3 MIB. -.Bl -tag +.Bl -tag -width "useloopback" .It Va max_age How long an ARP entry is held in the cache until it needs to be refreshed. .It Va maxtries Modified: head/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 == --- head/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 Sun Jun 3 05:47:42 2012(r236499) +++ head/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 Sun Jun 3 06:57:47 2012(r236500) @@ -83,7 +83,7 @@ The currently supported node commands in .Nm are: .Pp -.Bl -tag -offset indent -compact +.Bl -tag -width "Forget" -offset indent -compact .It Cm Query .It Cm Dump .It Cm Known Modified: head/usr.sbin/bluetooth/btpand/btpand.8 == --- head/usr.sbin/bluetooth/btpand/btpand.8 Sun Jun 3 05:47:42 2012 (r236499) +++ head/usr.sbin/bluetooth/btpand/btpand.8 Sun Jun 3 06:57:47 2012 (r236500) @@ -128,7 +128,7 @@ and 1 for a PANU server. Set L2CAP connection link mode. Supported modes are: .Pp -.Bl -tag -compact +.Bl -tag -width 8n -compact .It auth require devices to be paired. .It encrypt @@ -151,7 +151,7 @@ Name of .Ar service to provide or connect to, the following services are recognised: .Pp -.Bl -tag -compact +.Bl -tag -width 8n -compact .It GN Group ad-hoc Network. .It NAP @@ -182,7 +182,7 @@ has set up the client or server connecti .Xr tap 4 interface, it will create a pid file and detach. .Sh FILES -.Bl -tag -compact +.Bl -tag -width "Pa /etc/bluetooth/hosts" -compact .It Pa /dev/tap .It Pa /etc/bluetooth/hosts .It Pa /var/run/sdp Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Sun Jun 3 05:47:42 2012(r236499) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Sun Jun 3 06:57:47 2012(r236500) @@ -81,7 +81,7 @@ The currently supported HCI commands in .Nm are: .Pp -.Bl -tag -offset indent -compact +.Bl -tag -width 40n -offset indent -compact .It Cm Inquiry .It Cm Create_Connection .It Cm Disconnect @@ -148,7 +148,7 @@ The currently supported node commands in .Nm are: .Pp -.Bl -tag -offset indent -compact +.Bl -tag -width 40n -offset indent -compact .It Cm Read_Node_State .It Cm Initialize .It Cm Read_Debug_Level Modified: head/usr.sbin/bluetooth/l2control/l2control.8 == --- head/usr.sbin/bluetooth/l2control/l2control.8 Sun Jun 3 05:47:42 2012(r236499) +++ head/usr.sbin/bluetooth/l2control/l2control.8 Sun Jun 3 06:57:47 2012(r236500) @@ -77,7 +77,7 @@ The currently supported node commands in .Nm are: .Pp -.Bl -tag -offset indent -compact +.Bl -tag -width "Write_Auto_Disconnect_Timeout" -offset indent -compact .It Cm Read_Node_Flags .It Cm Read_Debug_Level .It Cm Write_Debug_Level Modified: head/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 == --- head/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 Sun Jun 3 05:47:42 2012(r236499) +++ head/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 Sun Jun 3 06:57:47 2012(r236500) @@ -86,7 +86,7 @@ The currently supported node commands in .Nm are: .Pp -.Bl -tag -offset indent -compact +.Bl -tag -width "Browse" -offset indent -