svn commit: r247534 - head/lib/libutil
Author: ru Date: Fri Mar 1 07:39:14 2013 New Revision: 247534 URL: http://svnweb.freebsd.org/changeset/base/247534 Log: Fixed documented prototype of kinfo_getproc(3). Modified: head/lib/libutil/kinfo_getproc.3 Modified: head/lib/libutil/kinfo_getproc.3 == --- head/lib/libutil/kinfo_getproc.3Fri Mar 1 07:01:24 2013 (r247533) +++ head/lib/libutil/kinfo_getproc.3Fri Mar 1 07:39:14 2013 (r247534) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd March 1, 2013 .Dt KINFO_GETPROC 3 .Os .Sh NAME @@ -37,7 +37,7 @@ .In sys/types.h .In libutil.h .Ft struct kinfo_proc * -.Fn kinfo_getproc "pid_t pid" "int *cntp" +.Fn kinfo_getproc "pid_t pid" .Sh DESCRIPTION This function is used for obtaining process information from the kernel. .Pp ___ 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: r247460 - head/sys/dev/acpica
On Thu, 28 Feb 2013, Alexander Motin wrote: On 28.02.2013 18:25, Alexey Dokuchaev wrote: On Thu, Feb 28, 2013 at 11:27:02AM +, Davide Italiano wrote: New Revision: 247460 URL: http://svnweb.freebsd.org/changeset/base/247460 Log: MFcalloutng (r247427 by mav): We don't need any precision here. Let it be fast and dirty shift then slow and excessively precise 64-bit division. -if (sbt >= 0 && us > sbt / SBT_1US) - us = sbt / SBT_1US; +if (sbt >= 0 && us > (sbt >> 12)) + us = (sbt >> 12); Does this really buy us anything? Modern compilers should be smart enough to generate correct code. Do you have evidence that this is not the case here? Not to mention that it obfuscates the code by using some magic constant. SBT_1US is 4294 (0x10c6). The best that compiler may do is replace division with multiplication. In fact, Clang even does this on amd64. But on i386 it calls __divdi3(), doing 64bit division in software. Shift is definitely cheaper and 5% precision is fine here. I missed the additional magic in my previous reply. But you should write the sloppy scaling as division by a sloppy factor: #define SSBT_1us4096/* power of 2 closest to SSBT_1US */ if (sbt >= 0 && us > (uint64_t)sbt / SSBT_1us) us = (uint64_t)sbt / SSBT_1us; or provide and use conversion functions that do sloppy and non-sloppy scaling. I don't like having conversion functions for every possible conversion, but this one is much more magic than for example TIMEVAL_TO_TIMESPEC(). The casts to (uint64_t) are to help the compiler understand that the sign bit is not there. The need for magic scaling shows that the binary representation given by sbintime_t isn't very good. Mose clients want natural units of microseconds or nanoseconds and need scale factors like (4294.967206 / 4096) to adjust (4294 is already sloppy). The binary representation allows some minor internal optimizations and APIs are made unnatural to avoid double conversions. While here, I will point out style bugs introduced in the above: - parentheses in "us = (sbt >> 12);" are redundant and reduce clarity, like parentheses in "us = (sbt / N);" would have, since the shift operator binds much more tightly than the assignment operator. - parentheses in "us > (sbt >> 12);" are redundant but may increase clarity, since the shift operator doesn't bind much more tightly than the '<' comparison operator. This one is hard to remember, but looking it up confirms that the precedence is not broken as designed in this case, but that the precedence is only 1 level higher for the shift operator. The main broken as designed cases are the shift operator being 1 level lower than addition and subtraction, and bitwise operators being many more levels lower than other aritmetic operators and even below all comparision operators. 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: r247527 - head/share/mk
Author: brooks Date: Fri Mar 1 03:25:43 2013 New Revision: 247527 URL: http://svnweb.freebsd.org/changeset/base/247527 Log: Provide slightly more helpful feedback when we can't figure out what compiler the user is using. PR: misc/173914 Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk == --- head/share/mk/bsd.compiler.mk Fri Mar 1 03:05:08 2013 (r247526) +++ head/share/mk/bsd.compiler.mk Fri Mar 1 03:25:43 2013 (r247527) @@ -14,7 +14,7 @@ COMPILER_TYPE:= gcc . elif ${_COMPILER_VERSION:Mclang} COMPILER_TYPE:=clang . else -.error Unable to determine compiler type for ${CC} +.error Unable to determine compiler type for ${CC}. Consider setting COMPILER_TYPE. . endif . undef _COMPILER_VERSION . endif ___ 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: r247460 - head/sys/dev/acpica
On Thu, Feb 28, 2013 at 07:37:32PM +0200, Alexander Motin wrote: > SBT_1US is 4294 (0x10c6). The best that compiler may do is replace > division with multiplication. In fact, Clang even does this on amd64. > But on i386 it calls __divdi3(), doing 64bit division in software. Shift > is definitely cheaper and 5% precision is fine here. I see, thanks for explanation. I overlooked SBT_1US definition. ./danfe ___ 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: r247523 - head/usr.sbin/bhyve
Author: neel Date: Fri Mar 1 02:26:28 2013 New Revision: 247523 URL: http://svnweb.freebsd.org/changeset/base/247523 Log: Specify the length of the mapping requested from 'paddr_guest2host()'. This seems prudent to do in its own right but it also opens up the possibility of not having to mmap the entire guest address space in the 'bhyve' process context. Discussed with: grehan Obtained from:NetApp Modified: head/usr.sbin/bhyve/acpi.c head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/bhyverun.h head/usr.sbin/bhyve/mptbl.c head/usr.sbin/bhyve/pci_virtio_block.c head/usr.sbin/bhyve/pci_virtio_net.c head/usr.sbin/bhyve/virtio.h Modified: head/usr.sbin/bhyve/acpi.c == --- head/usr.sbin/bhyve/acpi.c Fri Mar 1 02:09:06 2013(r247522) +++ head/usr.sbin/bhyve/acpi.c Fri Mar 1 02:26:28 2013(r247523) @@ -683,13 +683,16 @@ static int basl_load(int fd, uint64_t off) { struct stat sb; + void *gaddr; int err; err = 0; - - if (fstat(fd, &sb) < 0 || - read(fd, paddr_guest2host(basl_acpi_base + off), sb.st_size) < 0) + gaddr = paddr_guest2host(basl_acpi_base + off, sb.st_size); + if (gaddr != NULL) { + if (fstat(fd, &sb) < 0 || read(fd, gaddr, sb.st_size) < 0) err = errno; + } else + err = EFAULT; return (err); } Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Fri Mar 1 02:09:06 2013 (r247522) +++ head/usr.sbin/bhyve/bhyverun.c Fri Mar 1 02:26:28 2013 (r247523) @@ -157,17 +157,19 @@ usage(int code) } void * -paddr_guest2host(uintptr_t gaddr) +paddr_guest2host(uintptr_t gaddr, size_t len) { - if (lomem_sz == 0) - return (NULL); - if (gaddr < lomem_sz) { + if (gaddr < lomem_sz && gaddr + len <= lomem_sz) return ((void *)(lomem_addr + gaddr)); - } else if (gaddr >= 4*GB && gaddr < (4*GB + himem_sz)) { - return ((void *)(himem_addr + gaddr - 4*GB)); - } else - return (NULL); + + if (gaddr >= 4*GB) { + gaddr -= 4*GB; + if (gaddr < himem_sz && gaddr + len <= himem_sz) + return ((void *)(himem_addr + gaddr)); + } + + return (NULL); } int Modified: head/usr.sbin/bhyve/bhyverun.h == --- head/usr.sbin/bhyve/bhyverun.h Fri Mar 1 02:09:06 2013 (r247522) +++ head/usr.sbin/bhyve/bhyverun.h Fri Mar 1 02:26:28 2013 (r247523) @@ -43,7 +43,7 @@ extern char *vmname; extern u_long lomem_sz, himem_sz; -void *paddr_guest2host(uintptr_t); +void *paddr_guest2host(uintptr_t addr, size_t len); void fbsdrun_addcpu(struct vmctx *ctx, int cpu, uint64_t rip); int fbsdrun_muxed(void); Modified: head/usr.sbin/bhyve/mptbl.c == --- head/usr.sbin/bhyve/mptbl.c Fri Mar 1 02:09:06 2013(r247522) +++ head/usr.sbin/bhyve/mptbl.c Fri Mar 1 02:26:28 2013(r247523) @@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$"); #define MPTABLE_BASE 0xF +/* floating pointer length + maximum length of configuration table */ +#defineMPTABLE_MAX_LENGTH (65536 + 16) + #define LAPIC_PADDR0xFEE0 #define LAPIC_VERSION 16 @@ -346,13 +349,13 @@ mptable_build(struct vmctx *ctx, int ncp char*curraddr; char*startaddr; - if (paddr_guest2host(0) == NULL) { + startaddr = paddr_guest2host(MPTABLE_BASE, MPTABLE_MAX_LENGTH); + if (startaddr == NULL) { printf("mptable requires mapped mem\n"); return (ENOMEM); } - startaddr = curraddr = paddr_guest2host(MPTABLE_BASE); - + curraddr = startaddr; mpfp = (mpfps_t)curraddr; mpt_build_mpfp(mpfp, MPTABLE_BASE); curraddr += sizeof(*mpfp); Modified: head/usr.sbin/bhyve/pci_virtio_block.c == --- head/usr.sbin/bhyve/pci_virtio_block.c Fri Mar 1 02:09:06 2013 (r247522) +++ head/usr.sbin/bhyve/pci_virtio_block.c Fri Mar 1 02:26:28 2013 (r247523) @@ -222,13 +222,13 @@ pci_vtblk_proc(struct pci_vtblk_softc *s assert(nsegs >= 3); assert(nsegs < VTBLK_MAXSEGS + 2); - vid = paddr_guest2host(vd->vd_addr); + vid = paddr_guest2host(vd->vd_addr, vd->vd_len); assert((vid->vd_flags & VRING_DESC_F_INDIRECT) == 0); /* * The first descriptor will be the read-only fixed header */ - vbh = paddr_guest2host(vid[0].vd_addr); +
svn commit: r247520 - in head/sys: arm/allwinner arm/conf boot/fdt/dts
Author: ganbold (doc committer) Date: Fri Mar 1 01:47:11 2013 New Revision: 247520 URL: http://svnweb.freebsd.org/changeset/base/247520 Log: Enable uart driver for A10. Approved by: gonzo@ Modified: head/sys/arm/allwinner/files.a10 head/sys/arm/conf/CUBIEBOARD head/sys/boot/fdt/dts/cubieboard.dts Modified: head/sys/arm/allwinner/files.a10 == --- head/sys/arm/allwinner/files.a10Fri Mar 1 01:42:31 2013 (r247519) +++ head/sys/arm/allwinner/files.a10Fri Mar 1 01:47:11 2013 (r247520) @@ -17,5 +17,5 @@ arm/allwinner/timer.c standard arm/allwinner/aintc.c standard arm/allwinner/bus_space.c standard arm/allwinner/common.c standard -arm/allwinner/console.cstandard +#arm/allwinner/console.c standard arm/allwinner/a10_machdep.cstandard Modified: head/sys/arm/conf/CUBIEBOARD == --- head/sys/arm/conf/CUBIEBOARDFri Mar 1 01:42:31 2013 (r247519) +++ head/sys/arm/conf/CUBIEBOARDFri Mar 1 01:47:11 2013 (r247520) @@ -87,8 +87,8 @@ options ROOTDEVNAME=\"ufs:/dev/da0s2\" #options ATA_STATIC_ID # Static device numbering # Console and misc -#deviceuart -#deviceuart_ns8250 +device uart +device uart_ns8250 device pty device snp device md Modified: head/sys/boot/fdt/dts/cubieboard.dts == --- head/sys/boot/fdt/dts/cubieboard.dtsFri Mar 1 01:42:31 2013 (r247519) +++ head/sys/boot/fdt/dts/cubieboard.dtsFri Mar 1 01:47:11 2013 (r247520) @@ -121,6 +121,8 @@ interrupt-parent = <&AINTC>; current-speed = <115200>; clock-frequency = < 2400 >; + busy-detect = <1>; + broken-txfifo = <1>; }; }; ___ 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: r247519 - in head/sys/dev: ic uart
Author: ganbold (doc committer) Date: Fri Mar 1 01:42:31 2013 New Revision: 247519 URL: http://svnweb.freebsd.org/changeset/base/247519 Log: Add support for A10 uart. A10 uart is derived from Synopsys DesignWare uart and requires to read Uart Status Register when IIR_BUSY has detected. Also this change includes FDT check, where it checks device specific properties defined in dts and sets the busy_detect variable. broken_txfifo is also needed to be set in order to make it work for A10 uart case. Reviewed by: marcel@ Approved by: gonzo@ Modified: head/sys/dev/ic/ns16550.h head/sys/dev/uart/uart_dev_ns8250.c Modified: head/sys/dev/ic/ns16550.h == --- head/sys/dev/ic/ns16550.h Fri Mar 1 01:03:27 2013(r247518) +++ head/sys/dev/ic/ns16550.h Fri Mar 1 01:42:31 2013(r247519) @@ -182,6 +182,7 @@ #definecom_xoff1 6 /* XOFF 1 character (R/W) */ #definecom_xoff2 7 /* XOFF 2 character (R/W) */ +#define DW_REG_USR 31 /* DesignWare derived Uart Status Reg */ #define com_usr39 /* Octeon 16750/16550 Uart Status Reg */ #define REG_USRcom_usr #define USR_TXFIFO_NOTFULL 2/* Uart TX FIFO Not full */ Modified: head/sys/dev/uart/uart_dev_ns8250.c == --- head/sys/dev/uart/uart_dev_ns8250.c Fri Mar 1 01:03:27 2013 (r247518) +++ head/sys/dev/uart/uart_dev_ns8250.c Fri Mar 1 01:42:31 2013 (r247519) @@ -24,6 +24,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -35,6 +37,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#include +#include +#endif + #include #include #include @@ -45,6 +53,11 @@ __FBSDID("$FreeBSD$"); #defineDEFAULT_RCLK1843200 +static int broken_txfifo = 0; +SYSCTL_INT(_hw, OID_AUTO, broken_txfifo, CTLFLAG_RW | CTLFLAG_TUN, + &broken_txfifo, 0, "UART FIFO has QEMU emulation bug"); +TUNABLE_INT("hw.broken_txfifo", &broken_txfifo); + /* * Clear pending interrupts. THRE is cleared by reading IIR. Data * that may have been received gets lost here. @@ -350,6 +363,7 @@ struct ns8250_softc { uint8_t ier_mask; uint8_t ier_rxbits; + uint8_t busy_detect; }; static int ns8250_bus_attach(struct uart_softc *); @@ -401,6 +415,24 @@ ns8250_bus_attach(struct uart_softc *sc) struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc; struct uart_bas *bas; unsigned int ivar; +#ifdef FDT + phandle_t node; + pcell_t cell; +#endif + + ns8250->busy_detect = 0; + +#ifdef FDT + /* +* Check whether uart requires to read USR reg when IIR_BUSY and +* has broken txfifo. +*/ + node = ofw_bus_get_node(sc->sc_dev); + if ((OF_getprop(node, "busy-detect", &cell, sizeof(cell))) > 0) + ns8250->busy_detect = 1; + if ((OF_getprop(node, "broken-txfifo", &cell, sizeof(cell))) > 0) + broken_txfifo = 1; +#endif bas = &sc->sc_bas; @@ -592,6 +624,12 @@ ns8250_bus_ipend(struct uart_softc *sc) bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); iir = uart_getreg(bas, REG_IIR); + + if (ns8250->busy_detect && (iir & IIR_BUSY) == IIR_BUSY) { + (void)uart_getreg(bas, DW_REG_USR); + uart_unlock(sc->sc_hwmtx); + return (0); + } if (iir & IIR_NOPEND) { uart_unlock(sc->sc_hwmtx); return (0); @@ -847,11 +885,6 @@ ns8250_bus_setsig(struct uart_softc *sc, return (0); } -static int broken_txfifo = 0; -SYSCTL_INT(_hw, OID_AUTO, broken_txfifo, CTLFLAG_RW | CTLFLAG_TUN, - &broken_txfifo, 0, "UART FIFO has QEMU emulation bug"); -TUNABLE_INT("hw.broken_txfifo", &broken_txfifo); - static int ns8250_bus_transmit(struct uart_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: r247509 - head
Author: gjb (doc,ports committer) Date: Thu Feb 28 23:45:41 2013 New Revision: 247509 URL: http://svnweb.freebsd.org/changeset/base/247509 Log: Minor wordsmithing. X-MFC-Needs: r245617 Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Thu Feb 28 23:39:38 2013(r247508) +++ head/UPDATING Thu Feb 28 23:45:41 2013(r247509) @@ -46,8 +46,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 unlikely event that -M was the last option on the command line and the command line contained at least two files and a target directory the first file will have logs appended to it. The -M - option served little practical purpose in the last decade so it's - used expected to be extremely rare. + option served little practical purpose in the last decade so its + use is expected to be extremely rare. 20121223: After switching to Clang as the default compiler some users of ZFS ___ 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: r247508 - head/sys/dev/ath
Author: adrian Date: Thu Feb 28 23:39:38 2013 New Revision: 247508 URL: http://svnweb.freebsd.org/changeset/base/247508 Log: Add missing flags. Modified: head/sys/dev/ath/if_athrate.h Modified: head/sys/dev/ath/if_athrate.h == --- head/sys/dev/ath/if_athrate.h Thu Feb 28 23:39:22 2013 (r247507) +++ head/sys/dev/ath/if_athrate.h Thu Feb 28 23:39:38 2013 (r247508) @@ -84,6 +84,8 @@ void ath_rate_detach(struct ath_ratectrl #defineATH_RC_SGI_FLAG 0x04/* use short-GI */ #defineATH_RC_HT_FLAG 0x08/* use HT */ #defineATH_RC_RTSCTS_FLAG 0x10/* enable RTS/CTS protection */ +#defineATH_RC_STBC_FLAG0x20/* enable STBC */ +#defineATH_RC_LDPC_FLAG0x40/* enable STBC */ struct ath_rc_series { uint8_t rix;/* ratetable index, not rate code */ ___ 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: r247507 - head/sys/dev/ath
Author: adrian Date: Thu Feb 28 23:39:22 2013 New Revision: 247507 URL: http://svnweb.freebsd.org/changeset/base/247507 Log: Oops - fix an incorrect test. Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c == --- head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 28 23:31:23 2013 (r247506) +++ head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 28 23:39:22 2013 (r247507) @@ -238,7 +238,7 @@ ath_tx_rate_fill_rcflags(struct ath_soft /* * Only enable short preamble for legacy rates */ - if (IS_HT_RATE(rate) && bf->bf_state.bfs_shpream) + if ((! IS_HT_RATE(rate)) && bf->bf_state.bfs_shpream) rate |= rt->info[rc[i].rix].shortPreamble; /* ___ 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: r247506 - head/sys/dev/ath
Author: adrian Date: Thu Feb 28 23:31:23 2013 New Revision: 247506 URL: http://svnweb.freebsd.org/changeset/base/247506 Log: Don't enable the HT flags for legacy rates. I stumbled across this whilst trying to debug another weird hang reported on the freebsd-wireless list. Whilst here, add in the STBC check to ath_rateseries_setup(). Whilst here, fix the short preamble flag to be set only for legacy rates. Whilst here, comment that we should be using the full set of decisions made by ath_rateseries_setup() rather than recalculating them! Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c == --- head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 28 22:48:00 2013 (r247505) +++ head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 28 23:31:23 2013 (r247506) @@ -236,9 +236,9 @@ ath_tx_rate_fill_rcflags(struct ath_soft rate = rt->info[rc[i].rix].rateCode; /* -* XXX only do this for legacy rates? +* Only enable short preamble for legacy rates */ - if (bf->bf_state.bfs_shpream) + if (IS_HT_RATE(rate) && bf->bf_state.bfs_shpream) rate |= rt->info[rc[i].rix].shortPreamble; /* @@ -267,6 +267,19 @@ ath_tx_rate_fill_rcflags(struct ath_soft ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) rc[i].flags |= ATH_RC_SGI_FLAG; + /* +* If we have STBC TX enabled and the receiver +* can receive (at least) 1 stream STBC, AND it's +* MCS 0-7, AND we have at least two chains enabled, +* enable STBC. +*/ + if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC && + ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM && + (sc->sc_cur_txchainmask > 1) && + HT_RC_2_STREAMS(rate) == 1) { + rc[i].flags |= ATH_RC_STBC_FLAG; + } + /* XXX dual stream? and 3-stream? */ } @@ -459,6 +472,9 @@ ath_get_aggr_limit(struct ath_softc *sc, * * It, along with ath_buf_set_rate, must be called -after- a burst * or aggregate is setup. + * + * XXX TODO: it should use the rate series information from the + * ath_buf, rather than recalculating it here! */ static void ath_rateseries_setup(struct ath_softc *sc, struct ieee80211_node *ni, @@ -507,34 +523,6 @@ ath_rateseries_setup(struct ath_softc *s */ series[i].ChSel = sc->sc_cur_txchainmask; - if (flags & (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA)) - series[i].RateFlags |= HAL_RATESERIES_RTS_CTS; - - /* -* Transmit 40MHz frames only if the node has negotiated -* it rather than whether the node is capable of it or not. -* It's subtly different in the hostap case. -*/ - if (ni->ni_chw == 40) - series[i].RateFlags |= HAL_RATESERIES_2040; - - /* -* Set short-GI only if the node has advertised it -* the channel width is suitable, and we support it. -* We don't currently have a "negotiated" set of bits - -* ni_htcap is what the remote end sends, not what this -* node is capable of. -*/ - if (ni->ni_chw == 40 && - ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 && - ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) - series[i].RateFlags |= HAL_RATESERIES_HALFGI; - - if (ni->ni_chw == 20 && - ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 && - ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) - series[i].RateFlags |= HAL_RATESERIES_HALFGI; - /* * Setup rate and TX power cap for this series. */ @@ -542,23 +530,55 @@ ath_rateseries_setup(struct ath_softc *s series[i].RateIndex = rc[i].rix; series[i].tx_power_cap = 0x3f; /* XXX for now */ - /* -* If we have STBC TX enabled and the receiver -* can receive (at least) 1 stream STBC, AND it's -* MCS 0-7, AND we have at least two chains enabled, -* enable STBC. +* Enable RTS/CTS as appropriate. */ - if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC && - ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM && - (sc->sc_cur_txchainmask > 1) && - HT_RC_2_STREAMS(seri
Re: svn commit: r246877 - head/sys/ufs/ffs
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 02/18/13 01:56, Gennady Proskurin wrote: > May be a dumb question, but I want to be explicit here. > > Can system before this commit crash here or filesystem corruption > happen during ordinary work? (I mean no power loss and no crashes > in other kernel code) > > Or filesystem can be corrupted only if system crashes by other > means (power loss or something) during inode block allocation? There has to be some kind of crashes to get corruption on system running without this changeset. If the system runs and shutdowns normally, eventually the initialized inode would be written and therefore there would be no inconsistency. Kirk, I think this is a good MFC candidate, do you have plan to merge it back to stable branches? Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- iQEcBAEBCgAGBQJRL+H9AAoJEG80Jeu8UPuzHHcH/jma0S+9tMpPVD9zODXFaPhU Uib+qSBoQ/7pXsidGd+Cm5nI5duvpe2KGbNWomOQFy3Ovllzjg6CPHfTPo6ZXYkX FpOr93IPcbkEIiwSVP7yXhgp1r5BH3SmV3ulx6SkgKkf8kd8Ir+dif/X+Z695Ot+ M1y8suSXlYQs4z7ZHWMkVJcZ3VhH/oPJVpUQCZ7uqXeZQuquW4BLuKBYirGiGZrL 77QbQa4OunUMJN4XbU/WmEh/TGkvSRKuWfCYq9JHAXiQ4ItqhD5bGCUh0AZ0iOgq y94ydCOUojI65VX8yBzlR1VyOi0ba3k3JSt/GmIEGvFu2ZcBW+nPXG+hjRJaKKk= =sj5S -END PGP SIGNATURE- ___ 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: r247505 - head/sys/modules/ixgbe
Author: jfv Date: Thu Feb 28 22:48:00 2013 New Revision: 247505 URL: http://svnweb.freebsd.org/changeset/base/247505 Log: Change the ixgbe module name to if_ixgbe to conform to the usual naming convention. Modified: head/sys/modules/ixgbe/Makefile Modified: head/sys/modules/ixgbe/Makefile == --- head/sys/modules/ixgbe/Makefile Thu Feb 28 22:31:26 2013 (r247504) +++ head/sys/modules/ixgbe/Makefile Thu Feb 28 22:48:00 2013 (r247505) @@ -4,7 +4,7 @@ .PATH: ${.CURDIR}/../../dev/ixgbe -KMOD= ixgbe +KMOD= if_ixgbe SRCS= device_if.h bus_if.h pci_if.h SRCS += opt_inet.h opt_inet6.h SRCS+= ixgbe.c ixv.c ___ 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: r247495 - head/sys/dev/sdhci
On 2/28/2013 12:02 PM, Ian Lepore wrote: On Thu, 2013-02-28 at 19:43 +, Oleksandr Tymoshenko wrote: Author: gonzo Date: Thu Feb 28 19:43:14 2013 New Revision: 247495 URL: http://svnweb.freebsd.org/changeset/base/247495 Log: Add hooks for plugging platform-provided transfer backend. In order to use platorm backend hardware driver should impement three methods: - platform_start_transfer and platform_finish_transfer to start and finish transfer - platform_will_handle - check whether transaction is suitable for backend. If not - driver will fall back to PIO mode. Submitted by: Daisuke Aoyama Approved by: ian@ Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_if.m I think that was meant to be "Reviewed by" rather than "Approved by". I do very much approve of the changes, but not in any formal administrative sense, I'm just happy the sdcard IO is faster. :) Yeah, wrong "to:" field :) Thanks for reviewing these patches ___ 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: r247495 - head/sys/dev/sdhci
On Thu, 2013-02-28 at 19:43 +, Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Thu Feb 28 19:43:14 2013 > New Revision: 247495 > URL: http://svnweb.freebsd.org/changeset/base/247495 > > Log: > Add hooks for plugging platform-provided transfer backend. > > In order to use platorm backend hardware driver should > impement three methods: > - platform_start_transfer and platform_finish_transfer > to start and finish transfer > - platform_will_handle - check whether transaction is > suitable for backend. If not - driver will fall back > to PIO mode. > > Submitted by: Daisuke Aoyama > Approved by:ian@ > > Modified: > head/sys/dev/sdhci/sdhci.c > head/sys/dev/sdhci/sdhci.h > head/sys/dev/sdhci/sdhci_if.m > I think that was meant to be "Reviewed by" rather than "Approved by". I do very much approve of the changes, but not in any formal administrative sense, I'm just happy the sdcard IO is faster. :) -- Ian ___ 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: r247497 - head/sys/arm/broadcom/bcm2835
Author: gonzo Date: Thu Feb 28 19:51:30 2013 New Revision: 247497 URL: http://svnweb.freebsd.org/changeset/base/247497 Log: Add platform DMA support to SDHCI driver for BCM2835 Submitted by: Daisuke Aoyama Reviewed by: ian@ Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c == --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Feb 28 19:48:19 2013(r247496) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Feb 28 19:51:30 2013(r247497) @@ -67,8 +67,13 @@ __FBSDID("$FreeBSD$"); #include #include "sdhci_if.h" +#include "bcm2835_dma.h" +#include "bcm2835_vcbus.h" + #defineBCM2835_DEFAULT_SDHCI_FREQ 50 +#defineBCM_SDHCI_BUFFER_SIZE 512 + #defineDEBUG #ifdef DEBUG @@ -85,9 +90,11 @@ __FBSDID("$FreeBSD$"); */ static int bcm2835_sdhci_min_freq = 40; static int bcm2835_sdhci_hs = 1; +static int bcm2835_sdhci_pio_mode = 0; TUNABLE_INT("hw.bcm2835.sdhci.min_freq", &bcm2835_sdhci_min_freq); TUNABLE_INT("hw.bcm2835.sdhci.hs", &bcm2835_sdhci_hs); +TUNABLE_INT("hw.bcm2835.sdhci.pio_mode", &bcm2835_sdhci_pio_mode); struct bcm_sdhci_dmamap_arg { bus_addr_t sc_dma_busaddr; @@ -111,23 +118,41 @@ struct bcm_sdhci_softc { int sc_xfer_done; int sc_bus_busy; struct sdhci_slot sc_slot; + int sc_dma_inuse; + int sc_dma_ch; + bus_dma_tag_t sc_dma_tag; + bus_dmamap_tsc_dma_map; + void*sc_dma_buffer; + vm_paddr_t sc_dma_buffer_phys; + vm_paddr_t sc_sdhci_buffer_phys;; }; -#defineSD_MAX_BLOCKSIZE1024 -/* XXX */ - static int bcm_sdhci_probe(device_t); static int bcm_sdhci_attach(device_t); static int bcm_sdhci_detach(device_t); static void bcm_sdhci_intr(void *); static int bcm_sdhci_get_ro(device_t, device_t); +static void bcm_sdhci_dma_intr(int ch, void *arg); #definebcm_sdhci_lock(_sc) \ mtx_lock(&_sc->sc_mtx); #definebcm_sdhci_unlock(_sc) \ mtx_unlock(&_sc->sc_mtx); +static void +bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs, + int nseg, int err) +{ +bus_addr_t *addr; + +if (err) +return; + +addr = (bus_addr_t*)arg; +*addr = segs[0].ds_addr; +} + static int bcm_sdhci_probe(device_t dev) { @@ -146,9 +171,13 @@ bcm_sdhci_attach(device_t dev) phandle_t node; pcell_t cell; int default_freq; + void *buffer; + vm_paddr_t buffer_phys; + void *va; sc->sc_dev = dev; sc->sc_req = NULL; + err = 0; default_freq = BCM2835_DEFAULT_SDHCI_FREQ; node = ofw_bus_get_node(sc->sc_dev); @@ -191,6 +220,9 @@ bcm_sdhci_attach(device_t dev) goto fail; } + if (!bcm2835_sdhci_pio_mode) + sc->sc_slot.opt = SDHCI_PLATFORM_TRANSFER; + sc->sc_slot.caps = SDHCI_CAN_VDD_330 | SDHCI_CAN_VDD_180; if (bcm2835_sdhci_hs) sc->sc_slot.caps |= SDHCI_CAN_DO_HISPD; @@ -201,6 +233,61 @@ bcm_sdhci_attach(device_t dev) sdhci_init_slot(dev, &sc->sc_slot, 0); + sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_FAST1); + if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) + sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_FAST2); + if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) + sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); + if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) + goto fail; + + bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); + + /* Allocate DMA buffers */ + err = bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, NULL, NULL, + BCM_SDHCI_BUFFER_SIZE, 1, BCM_SDHCI_BUFFER_SIZE, + BUS_DMA_ALLOCNOW, NULL, NULL, + &sc->sc_dma_tag); + + if (err) { + device_printf(dev, "failed allocate DMA tag"); + goto fail; + } + + err = bus_dmamem_alloc(sc->sc_dma_tag, &buffer, + BUS_DMA_WAITOK | BUS_DMA_COHERENT| BUS_DMA_ZERO, + &sc->sc_dma_map); + + if (err) { + device_printf(dev, "cannot allocate DMA memory\n"); + goto fail; + } + + err = bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, buffer, + BCM_SDHCI_BUFFER_SIZE, bcm_dmamap_cb, &buffer_phys, + BUS_DMA_WAITOK); + if (err) { + device_printf(dev, "cannot load DMA memory\n"); + goto fail; + } + + /* +* Sanity check: two least bits of ad
svn commit: r247496 - head/sys/arm/broadcom/bcm2835
Author: gonzo Date: Thu Feb 28 19:48:19 2013 New Revision: 247496 URL: http://svnweb.freebsd.org/changeset/base/247496 Log: Add driver for BCM2835's DMA engine This is a version of code submitted by Daisuke Aoyama with some architectural changes. Added: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c (contents, props changed) head/sys/arm/broadcom/bcm2835/bcm2835_dma.h (contents, props changed) Modified: head/sys/arm/broadcom/bcm2835/files.bcm2835 Added: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Thu Feb 28 19:48:19 2013 (r247496) @@ -0,0 +1,727 @@ +/* + * Copyright (c) 2013 Daisuke Aoyama + * Copyright (c) 2013 Oleksandr Tymoshenko + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "bcm2835_dma.h" +#include "bcm2835_vcbus.h" + +#defineMAX_REG 9 + +/* private flags */ +#defineBCM_DMA_CH_USED 0x0001 +#defineBCM_DMA_CH_FREE 0x4000 +#defineBCM_DMA_CH_UNMAP0x8000 + +/* Register Map (4.2.1.2) */ +#defineBCM_DMA_CS(n) (0x100*(n) + 0x00) +#defineCS_ACTIVE (1 << 0) +#defineCS_END (1 << 1) +#defineCS_INT (1 << 2) +#defineCS_DREQ (1 << 3) +#defineCS_ISPAUSED (1 << 4) +#defineCS_ISHELD (1 << 5) +#defineCS_ISWAIT (1 << 6) +#defineCS_ERR (1 << 8) +#defineCS_WAITWRT (1 << 28) +#defineCS_DISDBG (1 << 29) +#defineCS_ABORT(1 << 30) +#defineCS_RESET(1 << 31) +#defineBCM_DMA_CBADDR(n) (0x100*(n) + 0x04) +#defineBCM_DMA_INFO(n) (0x100*(n) + 0x08) +#defineINFO_INT_EN (1 << 0) +#defineINFO_TDMODE (1 << 1) +#defineINFO_WAIT_RESP (1 << 3) +#defineINFO_D_INC (1 << 4) +#defineINFO_D_WIDTH(1 << 5) +#defineINFO_D_DREQ (1 << 6) +#defineINFO_S_INC (1 << 8) +#defineINFO_S_WIDTH(1 << 9) +#defineINFO_S_DREQ (1 << 10) +#defineINFO_WAITS_SHIFT(21) +#defineINFO_PERMAP_SHIFT (16) +#defineINFO_PERMAP_MASK(0x1f << INFO_PERMAP_SHIFT) + +#defineBCM_DMA_SRC(n) (0x100*(n) + 0x0C) +#defineBCM_DMA_DST(n) (0x100*(n) + 0x10) +#defineBCM_DMA_LEN(n) (0x100*(n) + 0x14) +#defineBCM_DMA_STRIDE(n) (0x100*(n) + 0x18) +#defineBCM_DMA_CBNEXT(n) (0x100*(n) + 0x1C) +#defineBCM_DMA_DEBUG(n)(0x100*(n) + 0x20) +#defineDEBUG_ERROR_MASK(7) + +#defineBCM_DMA_INT_STATUS 0xfe0 +#defineBCM_DMA_ENABLE 0xff0 + +/* relative offset from BCM_VC_DMA0_BASE (p.39) */ +#defineBCM_DMA_CH(n) (0x100*(n)) + +/* DMA Control Block - 256bit aligned (p.40) */ +stru
svn commit: r247495 - head/sys/dev/sdhci
Author: gonzo Date: Thu Feb 28 19:43:14 2013 New Revision: 247495 URL: http://svnweb.freebsd.org/changeset/base/247495 Log: Add hooks for plugging platform-provided transfer backend. In order to use platorm backend hardware driver should impement three methods: - platform_start_transfer and platform_finish_transfer to start and finish transfer - platform_will_handle - check whether transaction is suitable for backend. If not - driver will fall back to PIO mode. Submitted by: Daisuke Aoyama Approved by: ian@ Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_if.m Modified: head/sys/dev/sdhci/sdhci.c == --- head/sys/dev/sdhci/sdhci.c Thu Feb 28 19:36:22 2013(r247494) +++ head/sys/dev/sdhci/sdhci.c Thu Feb 28 19:43:14 2013(r247495) @@ -573,6 +573,13 @@ sdhci_init_slot(device_t dev, struct sdh if (slot->quirks & SDHCI_QUIRK_FORCE_DMA) slot->opt |= SDHCI_HAVE_DMA; + /* +* Use platform-provided transfer backend +* with PIO as a fallback mechanism +*/ + if (slot->opt & SDHCI_PLATFORM_TRANSFER) + slot->opt &= ~SDHCI_HAVE_DMA; + if (bootverbose || sdhci_debug) { slot_printf(slot, "%uMHz%s 4bits%s%s%s %s\n", slot->max_clk / 100, @@ -909,7 +916,7 @@ sdhci_start_data(struct sdhci_slot *slot WR2(slot, SDHCI_BLOCK_COUNT, (data->len + 511) / 512); } -static void +void sdhci_finish_data(struct sdhci_slot *slot) { struct mmc_data *data = slot->curcmd->data; @@ -1102,13 +1109,23 @@ sdhci_data_irq(struct sdhci_slot *slot, } if (slot->curcmd->error) { /* No need to continue after any error. */ - sdhci_finish_data(slot); + if (slot->flags & PLATFORM_DATA_STARTED) { + slot->flags &= ~PLATFORM_DATA_STARTED; + SDHCI_PLATFORM_FINISH_TRANSFER(slot->bus, slot); + } else + sdhci_finish_data(slot); return; } /* Handle PIO interrupt. */ - if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) - sdhci_transfer_pio(slot); + if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) { + if ((slot->opt & SDHCI_PLATFORM_TRANSFER) && + SDHCI_PLATFORM_WILL_HANDLE(slot->bus, slot)) { + SDHCI_PLATFORM_START_TRANSFER(slot->bus, slot, &intmask); + slot->flags |= PLATFORM_DATA_STARTED; + } else + sdhci_transfer_pio(slot); + } /* Handle DMA border. */ if (intmask & SDHCI_INT_DMA_END) { struct mmc_data *data = slot->curcmd->data; @@ -1147,8 +1164,13 @@ sdhci_data_irq(struct sdhci_slot *slot, WR4(slot, SDHCI_DMA_ADDRESS, slot->paddr); } /* We have got all data. */ - if (intmask & SDHCI_INT_DATA_END) - sdhci_finish_data(slot); + if (intmask & SDHCI_INT_DATA_END) { + if (slot->flags & PLATFORM_DATA_STARTED) { + slot->flags &= ~PLATFORM_DATA_STARTED; + SDHCI_PLATFORM_FINISH_TRANSFER(slot->bus, slot); + } else + sdhci_finish_data(slot); + } } static void Modified: head/sys/dev/sdhci/sdhci.h == --- head/sys/dev/sdhci/sdhci.h Thu Feb 28 19:36:22 2013(r247494) +++ head/sys/dev/sdhci/sdhci.h Thu Feb 28 19:43:14 2013(r247495) @@ -224,8 +224,9 @@ struct sdhci_slot { device_tdev;/* Slot device */ u_char num;/* Slot number */ u_char opt;/* Slot options */ +#define SDHCI_HAVE_DMA 1 +#define SDHCI_PLATFORM_TRANSFER2 u_char version; -#define SDHCI_HAVE_DMA 1 uint32_tmax_clk;/* Max possible freq */ uint32_ttimeout_clk;/* Timeout freq */ bus_dma_tag_t dmatag; @@ -250,6 +251,7 @@ struct sdhci_slot { #define CMD_STARTED1 #define STOP_STARTED 2 #define SDHCI_USE_DMA 4 /* Use DMA for this req. */ +#define PLATFORM_DATA_STARTED 8 /* Data transfer is handled by platform */ struct mtx mtx;/* Slot mutex */ }; @@ -257,6 +259,8 @@ int sdhci_generic_read_ivar(device_t bus int sdhci_generic_write_ivar(device_t bus, device_t child, int which, uintptr_t value); int sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num); void sdhci_start_slot(struct sdhci_slot *slot); +/* performs generic clean-up for platform transfers */ +void sdhci_finish_data(struct sdhci_slot *slot);
Re: svn commit: r244157 - head/sys/netinet
On 12 December 2012 12:41, Gleb Smirnoff wrote: > Author: glebius > Date: Wed Dec 12 17:41:21 2012 > New Revision: 244157 > URL: http://svnweb.freebsd.org/changeset/base/244157 > > Log: > Fix a crash in tcp_input(), that happens when mbuf has a fwd_tag on it, > but later after processing and freeing the tag, we need to jump back again > to the findpcb label. Since the fwd_tag pointer wasn't NULL we tried to > process and free the tag for second time. This will fix the crash, but I worry that packets matching the TIMEWAIT cases that previously caused the crash will now fail to be forwarded instead. I'm looking at separating the detach and free of the fwd_tag to address this. ___ 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: r247359 - head/sbin/reboot
On Feb 28, 2013, at 8:01 AM, John Baldwin wrote: > On Wednesday, February 27, 2013 6:23:02 pm Daniel O'Connor wrote: >> >> On 28/02/2013, at 3:08, John Baldwin wrote: URL: http://svnweb.freebsd.org/changeset/base/247359 Log: Clarify that overriding the -h/-D flags through flags in device.hints only works for sio(4) but not for uart(4) which no longer has this flag. >>> >>> You should probably just remove the flag entirely. sio(4) doesn't build on >>> 8.x and later. >> >> >> The handbook will need fixing too since it mentions sio(4) and -D/-h. > > -D/-h are still valid and work fine with uart. +1 The only thing that isn't really there is symmetry in the .flags hint.. I'll file a pr for that today so it doesn't get forgotten.. Thanks, -Garrett ___ 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: r247460 - head/sys/dev/acpica
On Thu, 28 Feb 2013, Alexey Dokuchaev wrote: On Thu, Feb 28, 2013 at 11:27:02AM +, Davide Italiano wrote: New Revision: 247460 URL: http://svnweb.freebsd.org/changeset/base/247460 Log: MFcalloutng (r247427 by mav): We don't need any precision here. Let it be fast and dirty shift then slow and excessively precise 64-bit division. -if (sbt >= 0 && us > sbt / SBT_1US) - us = sbt / SBT_1US; +if (sbt >= 0 && us > (sbt >> 12)) + us = (sbt >> 12); Does this really buy us anything? Only a little. Modern compilers should be smart enough to generate correct code. Do you have evidence that this is not the case here? Not to mention that it obfuscates the code by using some magic constant. Modern compilers aren't smart enough to generate optimal code for this. But they can be helped by casting sbt to uint64_t before dividing it by the power of 2. Testing showed the following non-optimal code: - clang on amd64: generates 2 extra shifts and 1 more addition for signed division. It apparently doesn't notice that the tst ensures that sbt is >= 0. It reduces the division to a shift but this needs fixups if the result might be negative. - gcc on amd64: turns the division into a single shift without help. - clang on i386: as on amd64. Nice code except for the poor algorithm. - gcc on i386: uses the poor algorithm and generates fairly horrible code for it, with about 6 more register move instuctions than clang. Correct code for signed division by a power of 2 is different from correct code for unsigned division by a power of 2. The former can't use a a shift, because C99 specifies division to be broken (that it rounds towards zero). C90 permitted signed division to work correctly (to round towards minus infinity, or towards zero, in an implementation-defined way), but most hardware does the broken rounding so not many C implementations do correct rounding. 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"
Re: svn commit: r247460 - head/sys/dev/acpica
On 28.02.2013 18:25, Alexey Dokuchaev wrote: > On Thu, Feb 28, 2013 at 11:27:02AM +, Davide Italiano wrote: >> New Revision: 247460 >> URL: http://svnweb.freebsd.org/changeset/base/247460 >> >> Log: >> MFcalloutng (r247427 by mav): >> We don't need any precision here. Let it be fast and dirty shift then >> slow and excessively precise 64-bit division. >> >> -if (sbt >= 0 && us > sbt / SBT_1US) >> -us = sbt / SBT_1US; >> +if (sbt >= 0 && us > (sbt >> 12)) >> +us = (sbt >> 12); > > Does this really buy us anything? Modern compilers should be smart enough to > generate correct code. Do you have evidence that this is not the case here? > Not to mention that it obfuscates the code by using some magic constant. SBT_1US is 4294 (0x10c6). The best that compiler may do is replace division with multiplication. In fact, Clang even does this on amd64. But on i386 it calls __divdi3(), doing 64bit division in software. Shift is definitely cheaper and 5% precision is fine here. -- Alexander Motin ___ 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: r247476 - head/sys/sys
Author: davide Date: Thu Feb 28 17:10:30 2013 New Revision: 247476 URL: http://svnweb.freebsd.org/changeset/base/247476 Log: Move the definition of sbintime_t type from to . With this change we prevent gross namespace pollution. Reported by: bde Suggested by: attilio Modified: head/sys/sys/time.h head/sys/sys/types.h Modified: head/sys/sys/time.h == --- head/sys/sys/time.h Thu Feb 28 16:56:08 2013(r247475) +++ head/sys/sys/time.h Thu Feb 28 17:10:30 2013(r247476) @@ -109,7 +109,6 @@ bintime_mul(struct bintime *bt, u_int x) ((a)->frac cmp (b)->frac) : \ ((a)->sec cmp (b)->sec)) -typedef int64_t sbintime_t; #defineSBT_1S ((sbintime_t)1 << 32) #defineSBT_1M (SBT_1S * 60) #defineSBT_1MS (SBT_1S / 1000) Modified: head/sys/sys/types.h == --- head/sys/sys/types.hThu Feb 28 16:56:08 2013(r247475) +++ head/sys/sys/types.hThu Feb 28 17:10:30 2013(r247476) @@ -188,6 +188,8 @@ typedef __rlim_trlim_t; /* resource li #define_RLIM_T_DECLARED #endif +typedef__int64_t sbintime_t; + typedef__segsz_t segsz_t;/* segment size (in pages) */ #ifndef _SIZE_T_DECLARED ___ 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: r247359 - head/sbin/reboot
On Wednesday, February 27, 2013 6:23:02 pm Daniel O'Connor wrote: > > On 28/02/2013, at 3:08, John Baldwin wrote: > >> URL: http://svnweb.freebsd.org/changeset/base/247359 > >> > >> Log: > >> Clarify that overriding the -h/-D flags through flags in device.hints > >> only works for sio(4) but not for uart(4) which no longer has this flag. > > > > You should probably just remove the flag entirely. sio(4) doesn't build on > > 8.x and later. > > > The handbook will need fixing too since it mentions sio(4) and -D/-h. -D/-h are still valid and work fine with uart. -- John Baldwin ___ 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: r247460 - head/sys/dev/acpica
On Thu, Feb 28, 2013 at 11:25 AM, Alexey Dokuchaev wrote: > On Thu, Feb 28, 2013 at 11:27:02AM +, Davide Italiano wrote: > > New Revision: 247460 > > URL: http://svnweb.freebsd.org/changeset/base/247460 > > > > Log: > > MFcalloutng (r247427 by mav): > > We don't need any precision here. Let it be fast and dirty shift then > > slow and excessively precise 64-bit division. > > > > -if (sbt >= 0 && us > sbt / SBT_1US) > > - us = sbt / SBT_1US; > > +if (sbt >= 0 && us > (sbt >> 12)) > > + us = (sbt >> 12); > > Does this really buy us anything? Modern compilers should be smart enough > to > generate correct code. Do you have evidence that this is not the case > here? > Not to mention that it obfuscates the code by using some magic constant. > > ./danfe > SBT_1US is 4294, not 4096 (1 << 12). This is an approximation, which the compiler obviously can't automatically apply. ___ 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: r247460 - head/sys/dev/acpica
On Thu, Feb 28, 2013 at 11:27:02AM +, Davide Italiano wrote: > New Revision: 247460 > URL: http://svnweb.freebsd.org/changeset/base/247460 > > Log: > MFcalloutng (r247427 by mav): > We don't need any precision here. Let it be fast and dirty shift then > slow and excessively precise 64-bit division. > > -if (sbt >= 0 && us > sbt / SBT_1US) > - us = sbt / SBT_1US; > +if (sbt >= 0 && us > (sbt >> 12)) > + us = (sbt >> 12); Does this really buy us anything? Modern compilers should be smart enough to generate correct code. Do you have evidence that this is not the case here? Not to mention that it obfuscates the code by using some magic constant. ./danfe ___ 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: r247467 - head/sys/kern
Author: davide Date: Thu Feb 28 16:22:49 2013 New Revision: 247467 URL: http://svnweb.freebsd.org/changeset/base/247467 Log: MFcalloutng: Style fixes. Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cThu Feb 28 15:21:12 2013 (r247466) +++ head/sys/kern/kern_timeout.cThu Feb 28 16:22:49 2013 (r247467) @@ -100,7 +100,7 @@ struct cc_mig_ent { int ce_migration_ticks; #endif }; - + /* * There is one struct callout_cpu per cpu, holding all relevant * state for the callout processing thread on the individual CPU. @@ -613,7 +613,7 @@ skip: } /* - * The callout mechanism is based on the work of Adam M. Costello and + * The callout mechanism is based on the work of Adam M. Costello and * George Varghese, published in a technical report entitled "Redesigning * the BSD Callout and Timer Facilities" and modified slightly for inclusion * in FreeBSD by Justin T. Gibbs. The original work on the data structures ___ 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: r247463 - in head: share/man/man9 sys/arm/allwinner sys/arm/arm sys/arm/broadcom/bcm2835 sys/arm/lpc sys/arm/mv sys/arm/ti/am335x sys/arm/versatile sys/dev/acpica sys/i386/xen sys/ia64/...
Author: mav Date: Thu Feb 28 13:46:03 2013 New Revision: 247463 URL: http://svnweb.freebsd.org/changeset/base/247463 Log: MFcalloutng: Switch eventtimers(9) from using struct bintime to sbintime_t. Even before this not a single driver really supported full dynamic range of struct bintime even in theory, not speaking about practical inexpediency. This change legitimates the status quo and cleans up the code. Modified: head/share/man/man9/eventtimers.9 head/sys/arm/allwinner/timer.c head/sys/arm/arm/mpcore_timer.c head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c head/sys/arm/lpc/lpc_timer.c head/sys/arm/mv/timer.c head/sys/arm/ti/am335x/am335x_dmtimer.c head/sys/arm/versatile/sp804.c head/sys/dev/acpica/acpi_hpet.c head/sys/i386/xen/clock.c head/sys/ia64/ia64/clock.c head/sys/kern/kern_clocksource.c head/sys/kern/kern_et.c head/sys/mips/mips/tick.c head/sys/mips/nlm/tick.c head/sys/mips/rmi/tick.c head/sys/powerpc/aim/clock.c head/sys/powerpc/booke/clock.c head/sys/sparc64/sparc64/tick.c head/sys/sys/timeet.h head/sys/x86/isa/atrtc.c head/sys/x86/isa/clock.c head/sys/x86/x86/local_apic.c Modified: head/share/man/man9/eventtimers.9 == --- head/share/man/man9/eventtimers.9 Thu Feb 28 12:09:36 2013 (r247462) +++ head/share/man/man9/eventtimers.9 Thu Feb 28 13:46:03 2013 (r247463) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2011 Alexander Motin +.\" Copyright (c) 2011-2013 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 2011 +.Dd February 25, 2013 .Dt EVENTTIMERS 9 .Os .Sh NAME @@ -36,7 +36,7 @@ struct eventtimer; typedef int et_start_t(struct eventtimer *et, -struct bintime *first, struct bintime *period); +sbintime_t first, sbintime_t period); typedef int et_stop_t(struct eventtimer *et); typedef void et_event_cb_t(struct eventtimer *et, void *arg); typedef int et_deregister_cb_t(struct eventtimer *et, void *arg); @@ -53,8 +53,8 @@ struct eventtimer { int et_quality; int et_active; uint64_tet_frequency; - struct bintime et_min_period; - struct bintime et_max_period; + sbintime_t et_min_period; + sbintime_t et_max_period; et_start_t *et_start; et_stop_t *et_stop; et_event_cb_t *et_event_cb; @@ -75,7 +75,7 @@ struct eventtimer { .Ft int .Fn et_init "struct eventtimer *et" "et_event_cb_t *event" "et_deregister_cb_t *deregister" "void *arg" .Ft int -.Fn et_start "struct eventtimer *et" "struct bintime *first" "struct bintime *period" +.Fn et_start "struct eventtimer *et" "sbintime_t first" "sbintime_t period" .Ft int .Fn et_stop "struct eventtimer *et" .Ft int Modified: head/sys/arm/allwinner/timer.c == --- head/sys/arm/allwinner/timer.c Thu Feb 28 12:09:36 2013 (r247462) +++ head/sys/arm/allwinner/timer.c Thu Feb 28 13:46:03 2013 (r247463) @@ -95,7 +95,7 @@ int a10_timer_get_timerfreq(struct a10_t static u_int a10_timer_get_timecount(struct timecounter *); static int a10_timer_timer_start(struct eventtimer *, -struct bintime *, struct bintime *); +sbintime_t first, sbintime_t period); static int a10_timer_timer_stop(struct eventtimer *); static uint64_t timer_read_counter64(void); @@ -193,12 +193,8 @@ a10_timer_attach(device_t dev) sc->et.et_name = "a10_timer Eventtimer"; sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC; sc->et.et_quality = 1000; - sc->et.et_min_period.sec = 0; - sc->et.et_min_period.frac = - ((0x0005LLU << 32) / sc->et.et_frequency) << 32; - sc->et.et_max_period.sec = 0xfff0U / sc->et.et_frequency; - sc->et.et_max_period.frac = - ((0xfffeLLU << 32) / sc->et.et_frequency) << 32; + sc->et.et_min_period = (0x0005LLU << 32) / sc->et.et_frequency; + sc->et.et_max_period = (0xfffeLLU << 32) / sc->et.et_frequency; sc->et.et_start = a10_timer_timer_start; sc->et.et_stop = a10_timer_timer_stop; sc->et.et_priv = sc; @@ -225,8 +221,8 @@ a10_timer_attach(device_t dev) } static int -a10_timer_timer_start(struct eventtimer *et, struct bintime *first, -struct bintime *period) +a10_timer_timer_start(struct eventtimer *et, sbintime_t first, +sbintime_t period) { struct a10_timer_softc *sc; uint32_t count; @@ -234,26 +230,21 @@ a10_timer_timer_start(struct eventtimer sc = (struct a10_timer_softc *)et->et_priv; - sc->sc_period = 0; - - if (period != NULL) { - sc->sc_period = (sc->et.
svn commit: r247460 - head/sys/dev/acpica
Author: davide Date: Thu Feb 28 11:27:01 2013 New Revision: 247460 URL: http://svnweb.freebsd.org/changeset/base/247460 Log: MFcalloutng (r247427 by mav): We don't need any precision here. Let it be fast and dirty shift then slow and excessively precise 64-bit division. Modified: head/sys/dev/acpica/acpi_cpu.c Modified: head/sys/dev/acpica/acpi_cpu.c == --- head/sys/dev/acpica/acpi_cpu.c Thu Feb 28 10:59:40 2013 (r247459) +++ head/sys/dev/acpica/acpi_cpu.c Thu Feb 28 11:27:01 2013 (r247460) @@ -981,8 +981,8 @@ acpi_cpu_idle(sbintime_t sbt) /* Find the lowest state that has small enough latency. */ us = sc->cpu_prev_sleep; -if (sbt >= 0 && us > sbt / SBT_1US) - us = sbt / SBT_1US; +if (sbt >= 0 && us > (sbt >> 12)) + us = (sbt >> 12); cx_next_idx = 0; if (cpu_disable_deep_sleep) i = min(sc->cpu_cx_lowest, sc->cpu_non_c3); ___ 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: r247454 - in head/sys: amd64/amd64 dev/acpica i386/i386 ia64/ia64 kern pc98/pc98 powerpc/powerpc powerpc/ps3 powerpc/wii sys
Author: davide Date: Thu Feb 28 10:46:54 2013 New Revision: 247454 URL: http://svnweb.freebsd.org/changeset/base/247454 Log: MFcalloutng: When CPU becomes idle, cpu_idleclock() calculates time to the next timer event in order to reprogram hw timer. Return that time in sbintime_t to the caller and pass it to acpi_cpu_idle(), where it can be used as one more factor (quite precise) to extimate furter sleep time and choose optimal sleep state. This is a preparatory change for further callout improvements will be committed in the next days. The commmit is not targeted for MFC. Modified: head/sys/amd64/amd64/machdep.c head/sys/dev/acpica/acpi_cpu.c head/sys/i386/i386/machdep.c head/sys/ia64/ia64/machdep.c head/sys/kern/kern_clocksource.c head/sys/pc98/pc98/machdep.c head/sys/powerpc/powerpc/cpu.c head/sys/powerpc/ps3/platform_ps3.c head/sys/powerpc/wii/platform_wii.c head/sys/sys/proc.h head/sys/sys/systm.h Modified: head/sys/amd64/amd64/machdep.c == --- head/sys/amd64/amd64/machdep.c Thu Feb 28 10:45:16 2013 (r247453) +++ head/sys/amd64/amd64/machdep.c Thu Feb 28 10:46:54 2013 (r247454) @@ -658,7 +658,7 @@ cpu_halt(void) halt(); } -void (*cpu_idle_hook)(void) = NULL;/* ACPI idle hook. */ +void (*cpu_idle_hook)(sbintime_t) = NULL; /* ACPI idle hook. */ static int cpu_ident_amdc1e = 0; /* AMD C1E supported. */ static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ TUNABLE_INT("machdep.idle_mwait", &idle_mwait); @@ -670,7 +670,7 @@ SYSCTL_INT(_machdep, OID_AUTO, idle_mwai #defineSTATE_SLEEPING 0x2 static void -cpu_idle_acpi(int busy) +cpu_idle_acpi(sbintime_t sbt) { int *state; @@ -682,14 +682,14 @@ cpu_idle_acpi(int busy) if (sched_runnable()) enable_intr(); else if (cpu_idle_hook) - cpu_idle_hook(); + cpu_idle_hook(sbt); else __asm __volatile("sti; hlt"); *state = STATE_RUNNING; } static void -cpu_idle_hlt(int busy) +cpu_idle_hlt(sbintime_t sbt) { int *state; @@ -730,7 +730,7 @@ cpu_idle_hlt(int busy) #defineMWAIT_C40x30 static void -cpu_idle_mwait(int busy) +cpu_idle_mwait(sbintime_t sbt) { int *state; @@ -753,7 +753,7 @@ cpu_idle_mwait(int busy) } static void -cpu_idle_spin(int busy) +cpu_idle_spin(sbintime_t sbt) { int *state; int i; @@ -802,12 +802,13 @@ cpu_probe_amdc1e(void) } } -void (*cpu_idle_fn)(int) = cpu_idle_acpi; +void (*cpu_idle_fn)(sbintime_t) = cpu_idle_acpi; void cpu_idle(int busy) { uint64_t msr; + sbintime_t sbt = -1; CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); @@ -825,7 +826,7 @@ cpu_idle(int busy) /* If we have time - switch timers into idle mode. */ if (!busy) { critical_enter(); - cpu_idleclock(); + sbt = cpu_idleclock(); } /* Apply AMD APIC timer C1E workaround. */ @@ -836,7 +837,7 @@ cpu_idle(int busy) } /* Call main idle method. */ - cpu_idle_fn(busy); + cpu_idle_fn(sbt); /* Switch timers mack into active mode. */ if (!busy) { Modified: head/sys/dev/acpica/acpi_cpu.c == --- head/sys/dev/acpica/acpi_cpu.c Thu Feb 28 10:45:16 2013 (r247453) +++ head/sys/dev/acpica/acpi_cpu.c Thu Feb 28 10:46:54 2013 (r247454) @@ -168,7 +168,7 @@ static int acpi_cpu_cx_cst(struct acpi_c static voidacpi_cpu_startup(void *arg); static voidacpi_cpu_startup_cx(struct acpi_cpu_softc *sc); static voidacpi_cpu_cx_list(struct acpi_cpu_softc *sc); -static voidacpi_cpu_idle(void); +static voidacpi_cpu_idle(sbintime_t sbt); static voidacpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context); static int acpi_cpu_quirks(void); static int acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARGS); @@ -954,13 +954,13 @@ acpi_cpu_startup_cx(struct acpi_cpu_soft * interrupts are re-enabled. */ static void -acpi_cpu_idle() +acpi_cpu_idle(sbintime_t sbt) { struct acpi_cpu_softc *sc; struct acpi_cx *cx_next; uint64_t cputicks; uint32_t start_time, end_time; -intbm_active, cx_next_idx, i; +intbm_active, cx_next_idx, i, us; /* * Look up our CPU id to get our softc. If it's NULL, we'll use C1 @@ -980,13 +980,16 @@ acpi_cpu_idle() } /* Find the lowest state that has small enough latency. */ +us = sc->cpu_prev_sleep; +if (sbt >= 0 && us > sbt / SBT_1US) + us = sbt / SBT_1US; cx_next_idx = 0; if (cpu_disable_deep_sleep) i = min(sc->cpu_cx_lowest, sc->cpu_non_c3); else i = sc->cpu_cx_lowest;
svn commit: r247452 - head/sys/sys
Author: mav Date: Thu Feb 28 10:21:04 2013 New Revision: 247452 URL: http://svnweb.freebsd.org/changeset/base/247452 Log: Introduce sbintime_t type -- the simplified version of struct bintime, using 32.32 fixed point in form of single int64_t. It is much easier to use in cases where additional precision and range of struct bintime is not required. Reviewed by: bde (previous version), davide Modified: head/sys/sys/time.h Modified: head/sys/sys/time.h == --- head/sys/sys/time.h Thu Feb 28 08:19:55 2013(r247451) +++ head/sys/sys/time.h Thu Feb 28 10:21:04 2013(r247452) @@ -109,6 +109,37 @@ bintime_mul(struct bintime *bt, u_int x) ((a)->frac cmp (b)->frac) : \ ((a)->sec cmp (b)->sec)) +typedef int64_t sbintime_t; +#defineSBT_1S ((sbintime_t)1 << 32) +#defineSBT_1M (SBT_1S * 60) +#defineSBT_1MS (SBT_1S / 1000) +#defineSBT_1US (SBT_1S / 100) +#defineSBT_1NS (SBT_1S / 10) + +static __inline int +sbintime_getsec(sbintime_t sbt) +{ + + return (sbt >> 32); +} + +static __inline sbintime_t +bttosbt(const struct bintime bt) +{ + + return (((sbintime_t)bt.sec << 32) + (bt.frac >> 32)); +} + +static __inline struct bintime +sbttobt(sbintime_t sbt) +{ + struct bintime bt; + + bt.sec = sbt >> 32; + bt.frac = sbt << 32; + return (bt); +} + /*- * Background information: * @@ -156,6 +187,42 @@ timeval2bintime(const struct timeval *tv /* 18446744073709 = int(2^64 / 100) */ bt->frac = tv->tv_usec * (uint64_t)18446744073709LL; } + +static __inline struct timespec +sbttots(sbintime_t sbt) +{ + struct timespec ts; + + ts.tv_sec = sbt >> 32; + ts.tv_nsec = ((uint64_t)10 * (uint32_t)sbt) >> 32; + return (ts); +} + +static __inline sbintime_t +tstosbt(struct timespec ts) +{ + + return (((sbintime_t)ts.tv_sec << 32) + + (ts.tv_nsec * (((uint64_t)1 << 63) / 5) >> 32)); +} + +static __inline struct timeval +sbttotv(sbintime_t sbt) +{ + struct timeval tv; + + tv.tv_sec = sbt >> 32; + tv.tv_usec = ((uint64_t)100 * (uint32_t)sbt) >> 32; + return (tv); +} + +static __inline sbintime_t +tvtosbt(struct timeval tv) +{ + + return (((sbintime_t)tv.tv_sec << 32) + + (tv.tv_usec * (((uint64_t)1 << 63) / 50) >> 32)); +} #endif /* __BSD_VISIBLE */ #ifdef _KERNEL @@ -317,6 +384,15 @@ void binuptime(struct bintime *bt); void nanouptime(struct timespec *tsp); void microuptime(struct timeval *tvp); +static __inline sbintime_t +sbinuptime(void) +{ + struct bintime bt; + + binuptime(&bt); + return (bttosbt(bt)); +} + void bintime(struct bintime *bt); void nanotime(struct timespec *tsp); void microtime(struct timeval *tvp); @@ -325,6 +401,15 @@ void getbinuptime(struct bintime *bt); void getnanouptime(struct timespec *tsp); void getmicrouptime(struct timeval *tvp); +static __inline sbintime_t +getsbinuptime(void) +{ + struct bintime bt; + + getbinuptime(&bt); + return (bttosbt(bt)); +} + void getbintime(struct bintime *bt); void getnanotime(struct timespec *tsp); void getmicrotime(struct timeval *tvp); ___ 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"