svn commit: r266871 - in head/sys: arm/conf boot/fdt/dts/arm
Author: ganbold Date: Fri May 30 06:37:06 2014 New Revision: 266871 URL: http://svnweb.freebsd.org/changeset/base/266871 Log: Add common kernel config file for Rockchip RK3188 systems by splitting current RADXA config. Radxa Rock (RR) boards have few types such as RR (full version), RR Lite and some variants of RR engineering samples. Add kernel config and FDT file for RR Lite board. Approved by: stas (mentor) Added: head/sys/arm/conf/RADXA-LITE (contents, props changed) head/sys/arm/conf/RK3188 (contents, props changed) head/sys/boot/fdt/dts/arm/rk3188-radxa-lite.dts (contents, props changed) Modified: head/sys/arm/conf/RADXA Modified: head/sys/arm/conf/RADXA == --- head/sys/arm/conf/RADXA Fri May 30 06:34:29 2014(r266870) +++ head/sys/arm/conf/RADXA Fri May 30 06:37:06 2014(r266871) @@ -18,104 +18,10 @@ # # $FreeBSD$ +includeRK3188 ident RADXA -include../rockchip/std.rk30xx - -optionsHZ=100 -optionsSCHED_4BSD # 4BSD scheduler -optionsINET# InterNETworking -optionsINET6 # IPv6 communications protocols -optionsFFS # Berkeley Fast Filesystem -optionsSOFTUPDATES # Enable FFS soft updates support -optionsUFS_ACL # Support for access control lists -optionsUFS_DIRHASH # Improve performance on big directories -optionsGEOM_PART_BSD # BSD partition scheme -optionsGEOM_PART_MBR # MBR partition scheme -optionsTMPFS # Efficient memory filesystem -optionsMSDOSFS # MSDOS Filesystem -optionsCD9660 # ISO 9660 Filesystem -optionsPROCFS # Process filesystem (requires PSEUDOFS) -optionsPSEUDOFS# Pseudo-filesystem framework -optionsCOMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] -optionsSCSI_DELAY=5000 # Delay (in ms) before probing SCSI -optionsKTRACE # ktrace(1) support -optionsSYSVSHM # SYSV-style shared memory -optionsSYSVMSG # SYSV-style message queues -optionsSYSVSEM # SYSV-style semaphores -options_KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions -optionsKBD_INSTALL_CDEV# install a CDEV entry in /dev -optionsPREEMPTION -optionsFREEBSD_BOOT_LOADER -optionsVFP # vfp/neon -optionsSMP # Enable multiple cores - -# Debugging -makeoptionsDEBUG=-g# Build kernel with gdb(1) debug symbols -optionsBREAK_TO_DEBUGGER -#options VERBOSE_SYSINIT # Enable verbose sysinit messages -optionsKDB -optionsDDB # Enable the kernel debugger -#options INVARIANTS # Enable calls of extra sanity checking -#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -optionsWITNESS # Enable checks to detect deadlocks and cycles -optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for speed -optionsDIAGNOSTIC - -# NFS support -#options NFSCL -#options NFSSERVER # Network Filesystem Server -#options NFSCLIENT # Network Filesystem Client - -# MMC/SD/SDIO card slot support -#devicemmc # mmc/sd bus -#devicemmcsd # mmc/sd flash cards - -# Boot device is 2nd slice on USB -optionsROOTDEVNAME=\ufs:/dev/da0s2\ - -# Console and misc -device uart -device uart_ns8250 -device pty -device snp -device md -device random # Entropy device - -# I2C support -#deviceiicbus -#deviceiic - -# GPIO -device gpio - -device scbus # SCSI bus (required for SCSI) -device da # Direct Access (disks) -device pass - -# USB support -optionsUSB_HOST_ALIGN=32 # Align usb buffers to cache line size. -device usb -optionsUSB_DEBUG -#options USB_REQ_DEBUG -#options USB_VERBOSE -device dwcotg # DWC OTG controller - -device umass - -# Ethernet -device loop -device ether -device mii -device smscphy -device bpf - -# USB ethernet support, requires miibus -device miibus -device udav - # Flattened Device Tree optionsFDT optionsFDT_DTB_STATIC makeoptionsFDT_DTS_FILE=rk3188-radxa.dts - Added:
svn commit: r266872 - in head/sys: arm/samsung/exynos boot/fdt/dts/arm
Author: br Date: Fri May 30 06:45:50 2014 New Revision: 266872 URL: http://svnweb.freebsd.org/changeset/base/266872 Log: o Make keyboard-related properties to be compatible with vendor standard o Allow setting keymap in FDT, use hardcoded one by default o Represent fallback keymap as a list rather than directly usable M*N array Submitted by: Maxim Ignatenko gelraen...@gmail.com Modified: head/sys/arm/samsung/exynos/chrome_kb.c head/sys/arm/samsung/exynos/chrome_kb.h head/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Modified: head/sys/arm/samsung/exynos/chrome_kb.c == --- head/sys/arm/samsung/exynos/chrome_kb.c Fri May 30 06:37:06 2014 (r266871) +++ head/sys/arm/samsung/exynos/chrome_kb.c Fri May 30 06:45:50 2014 (r266872) @@ -105,9 +105,6 @@ __FBSDID($FreeBSD$); #defineCKB_FLAG_POLLING0x2 #defineKBD_DRIVER_NAME ckbd -/* TODO: take interrupt from DTS */ -#defineKB_GPIO_INT 146 - struct ckb_softc { keyboard_t sc_kbd; keymap_t sc_keymap; @@ -130,9 +127,11 @@ struct ckb_softc { int flag; int rows; int cols; + int gpio; device_tdev; device_tgpio_dev; struct thread *sc_poll_thread; + uint16_t*keymap; uint8_t *scan_local; uint8_t *scan; @@ -199,7 +198,7 @@ static int ckb_intr(keyboard_t *kbd, void *arg) { -return (0); + return (0); } /* lock the access to the keyboard, not used */ @@ -207,7 +206,7 @@ static int ckb_lock(keyboard_t *kbd, int lock) { -return (1); + return (1); } /* clear the internal state of the keyboard */ @@ -309,20 +308,33 @@ ckb_read(keyboard_t *kbd, int wait) return (0); } -int scantokey(int i, int j); - -int -scantokey(int i, int j) +static uint16_t +keymap_read(struct ckb_softc *sc, int col, int row) { - int k; - for (k = 0; k KEYMAP_LEN; k++) - if ((keymap[k].col == i) (keymap[k].row == j)) - return (keymap[k].key); + KASSERT(sc-keymap != NULL, keymap_read: no keymap); + if (col = 0 col sc-cols + row = 0 row sc-rows) { + return sc-keymap[row * sc-cols + col]; + } return (0); } +static int +keymap_write(struct ckb_softc *sc, int col, int row, uint16_t key) +{ + + KASSERT(sc-keymap != NULL, keymap_write: no keymap); + if (col = 0 col sc-cols + row = 0 row sc-rows) { + sc-keymap[row * sc-cols + col] = key; + return (0); + } + + return (-1); +} + /* read char from the keyboard */ static uint32_t ckb_read_char_locked(keyboard_t *kbd, int wait) @@ -350,9 +362,10 @@ ckb_read_char_locked(keyboard_t *kbd, in if (sc-sc_flags CKB_FLAG_POLLING) { for (;;) { - GPIO_PIN_GET(sc-gpio_dev, KB_GPIO_INT, status); + GPIO_PIN_GET(sc-gpio_dev, sc-gpio, status); if (status == 0) { - if (ec_command(EC_CMD_MKBP_STATE, sc-scan, sc-cols, + if (ec_command(EC_CMD_MKBP_STATE, sc-scan, + sc-cols, sc-scan, sc-cols)) { return (NOKEY); } @@ -373,7 +386,7 @@ ckb_read_char_locked(keyboard_t *kbd, in if (oldbit == newbit) continue; - key = scantokey(i,j); + key = keymap_read(sc, i, j); if (key == 0) { continue; }; @@ -666,27 +679,109 @@ dummy_kbd_configure(int flags) KEYBOARD_DRIVER(ckbd, ckbdsw, dummy_kbd_configure); +/* + * Parses 'keymap' into sc-keymap. + * Requires sc-cols and sc-rows to be set. + */ +static int +parse_keymap(struct ckb_softc *sc, pcell_t *keymap, size_t len) +{ + int i; + + sc-keymap = malloc(sc-cols * sc-rows * sizeof(sc-keymap[0]), + M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc-keymap == NULL) { + return (ENOMEM); + } + + for (i = 0; i len; i++) { + /* +* Return value is ignored, we just write whatever fits into +* specified number of rows and columns and silently ignore +* everything else. +* Keymap entries follow this format: 0xRRCC +* RR - row number, CC - column number, - key code +*/ + keymap_write(sc,
svn commit: r266873 - head/sys/dev/usb
Author: hselasky Date: Fri May 30 07:30:24 2014 New Revision: 266873 URL: http://svnweb.freebsd.org/changeset/base/266873 Log: Add support for basic read, write and read capacity disk operations to the USB mass storage test utility file. Sponsored by: DARPA, AFRL Modified: head/sys/dev/usb/usb_msctest.c head/sys/dev/usb/usb_msctest.h Modified: head/sys/dev/usb/usb_msctest.c == --- head/sys/dev/usb/usb_msctest.c Fri May 30 06:45:50 2014 (r266872) +++ head/sys/dev/usb/usb_msctest.c Fri May 30 07:30:24 2014 (r266873) @@ -87,9 +87,10 @@ enum { DIR_NONE, }; -#defineSCSI_MAX_LENMAX(0x100, BULK_SIZE) +#defineSCSI_MAX_LENMAX(SCSI_FIXED_BLOCK_SIZE, USB_MSCTEST_BULK_SIZE) #defineSCSI_INQ_LEN0x24 #defineSCSI_SENSE_LEN 0xFF +#defineSCSI_FIXED_BLOCK_SIZE 512 /* bytes */ static uint8_t scsi_test_unit_ready[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_inquiry[] = { 0x12, 0x00, 0x00, 0x00, SCSI_INQ_LEN, 0x00 }; @@ -110,7 +111,10 @@ static uint8_t scsi_request_sense[] = { static uint8_t scsi_read_capacity[] = { 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -#defineBULK_SIZE 64 /* dummy */ +#ifndef USB_MSCTEST_BULK_SIZE +#defineUSB_MSCTEST_BULK_SIZE 64 /* dummy */ +#endif + #defineERR_CSW_FAILED -1 /* Command Block Wrapper */ @@ -851,3 +855,101 @@ usb_msc_eject(struct usb_device *udev, u bbb_detach(sc); return (0); } + +usb_error_t +usb_msc_read_10(struct usb_device *udev, uint8_t iface_index, +uint32_t lba, uint32_t blocks, void *buffer) +{ + struct bbb_transfer *sc; + uint8_t cmd[10]; + usb_error_t err; + + cmd[0] = 0x28; /* READ_10 */ + cmd[1] = 0; + cmd[2] = lba 24; + cmd[3] = lba 16; + cmd[4] = lba 8; + cmd[5] = lba 0; + cmd[6] = 0; + cmd[7] = blocks 8; + cmd[8] = blocks; + cmd[9] = 0; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (USB_ERR_INVAL); + + err = bbb_command_start(sc, DIR_IN, 0, buffer, + blocks * SCSI_FIXED_BLOCK_SIZE, cmd, 10, USB_MS_HZ); + + bbb_detach(sc); + + return (err); +} + +usb_error_t +usb_msc_write_10(struct usb_device *udev, uint8_t iface_index, +uint32_t lba, uint32_t blocks, void *buffer) +{ + struct bbb_transfer *sc; + uint8_t cmd[10]; + usb_error_t err; + + cmd[0] = 0x2a; /* WRITE_10 */ + cmd[1] = 0; + cmd[2] = lba 24; + cmd[3] = lba 16; + cmd[4] = lba 8; + cmd[5] = lba 0; + cmd[6] = 0; + cmd[7] = blocks 8; + cmd[8] = blocks; + cmd[9] = 0; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (USB_ERR_INVAL); + + err = bbb_command_start(sc, DIR_OUT, 0, buffer, + blocks * SCSI_FIXED_BLOCK_SIZE, cmd, 10, USB_MS_HZ); + + bbb_detach(sc); + + return (err); +} + +usb_error_t +usb_msc_read_capacity(struct usb_device *udev, uint8_t iface_index, +uint32_t *lba_last, uint32_t *block_size) +{ + struct bbb_transfer *sc; + usb_error_t err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (USB_ERR_INVAL); + + err = bbb_command_start(sc, DIR_IN, 0, sc-buffer, 8, + scsi_read_capacity, sizeof(scsi_read_capacity), + USB_MS_HZ); + + *lba_last = + (sc-buffer[0] 24) | + (sc-buffer[1] 16) | + (sc-buffer[2] 8) | + (sc-buffer[3]); + + *block_size = + (sc-buffer[4] 24) | + (sc-buffer[5] 16) | + (sc-buffer[6] 8) | + (sc-buffer[7]); + + /* we currently only support one block size */ + if (*block_size != SCSI_FIXED_BLOCK_SIZE) + err = USB_ERR_INVAL; + + bbb_detach(sc); + + return (err); +} Modified: head/sys/dev/usb/usb_msctest.h == --- head/sys/dev/usb/usb_msctest.h Fri May 30 06:45:50 2014 (r266872) +++ head/sys/dev/usb/usb_msctest.h Fri May 30 07:30:24 2014 (r266873) @@ -42,5 +42,14 @@ usb_error_t usb_msc_eject(struct usb_dev uint8_t iface_index, int method); usb_error_t usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index); +usb_error_t usb_msc_read_10(struct usb_device *udev, + uint8_t iface_index, uint32_t lba, uint32_t blocks, + void *buffer); +usb_error_t usb_msc_write_10(struct usb_device *udev, + uint8_t iface_index, uint32_t lba, uint32_t blocks, + void *buffer); +usb_error_t usb_msc_read_capacity(struct usb_device *udev, +
svn commit: r266874 - head/sys/arm/samsung/exynos
Author: br Date: Fri May 30 07:43:55 2014 New Revision: 266874 URL: http://svnweb.freebsd.org/changeset/base/266874 Log: Fix off-by-one error that makes 0-th pins of each bank unreachable. Submitted by: Maxim Ignatenko gelraen...@gmail.com Modified: head/sys/arm/samsung/exynos/exynos5_pad.c Modified: head/sys/arm/samsung/exynos/exynos5_pad.c == --- head/sys/arm/samsung/exynos/exynos5_pad.c Fri May 30 07:30:24 2014 (r266873) +++ head/sys/arm/samsung/exynos/exynos5_pad.c Fri May 30 07:43:55 2014 (r266874) @@ -223,7 +223,7 @@ get_bank(int gpio_number, struct gpio_ba for (i = 0; i NGRP; i++) { ngpio = gpio_map[i].ngpio; - if ((n + ngpio) = gpio_number) { + if ((n + ngpio) gpio_number) { *bank = gpio_map[i]; *pin_shift = (gpio_number - n); return (0); ___ 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: r266875 - in head/sys: arm/samsung/exynos boot/fdt/dts/arm
Author: br Date: Fri May 30 07:48:55 2014 New Revision: 266875 URL: http://svnweb.freebsd.org/changeset/base/266875 Log: Reset HSIC hub during EHCI initialization. This makes devices connected to external USB ports available to the system. Submitted by: Maxim Ignatenko gelraen...@gmail.com Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c == --- head/sys/arm/samsung/exynos/exynos5_ehci.c Fri May 30 07:43:55 2014 (r266874) +++ head/sys/arm/samsung/exynos/exynos5_ehci.c Fri May 30 07:48:55 2014 (r266875) @@ -180,9 +180,43 @@ gpio_ctrl(struct exynos_ehci_softc *esc, } static int +reset_hsic_hub(struct exynos_ehci_softc *esc, phandle_t hub) +{ + device_t gpio_dev; + pcell_t pin; + + /* TODO(imax): check that hub is compatible with smsc,usb3503 */ + if (!OF_hasprop(hub, freebsd,reset-gpio)) { + device_printf(esc-dev, + cannot detect reset GPIO pin for HSIC hub\n); + return (1); + } + + if (OF_getencprop(hub, freebsd,reset-gpio, pin, sizeof(pin)) 0) { + device_printf(esc-dev, + failed to decode reset GPIO pin number for HSIC hub\n); + return (1); + } + + /* Get the GPIO device, we need this to give power to USB */ + gpio_dev = devclass_get_device(devclass_find(gpio), 0); + if (gpio_dev == NULL) { + device_printf(esc-dev, cant find gpio_dev\n); + return (1); + } + + GPIO_PIN_SET(gpio_dev, pin, GPIO_PIN_LOW); + DELAY(100); + GPIO_PIN_SET(gpio_dev, pin, GPIO_PIN_HIGH); + + return (0); +} + +static int phy_init(struct exynos_ehci_softc *esc) { int reg; + phandle_t hub; gpio_ctrl(esc, GPIO_INPUT, 1); @@ -212,6 +246,10 @@ phy_init(struct exynos_ehci_softc *esc) reg = ~(HOST_CTRL_RESET_LINK); bus_space_write_4(esc-host_bst, esc-host_bsh, 0x0, reg); + if ((hub = OF_finddevice(/hsichub)) != 0) { + reset_hsic_hub(esc, hub); + } + gpio_ctrl(esc, GPIO_OUTPUT, 1); return (0); Modified: head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts == --- head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Fri May 30 07:43:55 2014(r266874) +++ head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Fri May 30 07:48:55 2014(r266875) @@ -70,4 +70,9 @@ stdin = serial2; stdout = serial2; }; + + hsichub@1340 { + compatible = smsc,usb3503; + freebsd,reset-gpio = 172; + }; }; ___ 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: r266871 - in head/sys: arm/conf boot/fdt/dts/arm
On Fri, 30 May 2014 06:37:07 + (UTC) Ganbold Tsagaankhuu ganb...@freebsd.org wrote: Author: ganbold Date: Fri May 30 06:37:06 2014 New Revision: 266871 URL: http://svnweb.freebsd.org/changeset/base/266871 Log: Add common kernel config file for Rockchip RK3188 systems by splitting current RADXA config. Radxa Rock (RR) boards have few types such as RR (full version), RR Lite and some variants of RR engineering samples. Add kernel config and FDT file for RR Lite board. Approved by:stas (mentor) Added: head/sys/arm/conf/RADXA-LITE (contents, props changed) head/sys/arm/conf/RK3188 (contents, props changed) head/sys/boot/fdt/dts/arm/rk3188-radxa-lite.dts (contents, props changed) Modified: head/sys/arm/conf/RADXA You should add #NO_UNIVERSE to the RADXA and RADXA-LITE configs. As they don't add any new devices or options other than the dts to compile there is no need to add them to the universe build. Andrew ___ 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: r266860 - in head: sys/net sys/netinet sys/netinet6 tests/sys/netinet
On Thu, May 29, 2014 at 09:03:50PM +, Alan Somers wrote: A Author: asomers A Date: Thu May 29 21:03:49 2014 A New Revision: 266860 A URL: http://svnweb.freebsd.org/changeset/base/266860 A A Log: A Fix unintended KBI change from r264905. Add _fib versions of A ifa_ifwithnet() and ifa_ifwithdstaddr() The legacy functions will call the A _fib() versions with RT_ALL_FIBS, preserving legacy behavior. Is this intended for MFC? If not, then I'd say that API bloat hurts more than KBI change in head/. -- Totus tuus, Glebius. ___ 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: r266876 - head/sys/kern
Author: glebius Date: Fri May 30 08:22:58 2014 New Revision: 266876 URL: http://svnweb.freebsd.org/changeset/base/266876 Log: Whitespace only. Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c == --- head/sys/kern/uipc_mbuf.c Fri May 30 07:48:55 2014(r266875) +++ head/sys/kern/uipc_mbuf.c Fri May 30 08:22:58 2014(r266876) @@ -288,7 +288,7 @@ void mb_free_ext(struct mbuf *m) { int skipmbuf; - + KASSERT((m-m_flags M_EXT) == M_EXT, (%s: M_EXT not set, __func__)); KASSERT(m-m_ext.ref_cnt != NULL, (%s: ref_cnt not set, __func__)); @@ -339,7 +339,7 @@ mb_free_ext(struct mbuf *m) } if (skipmbuf) return; - + /* * Free this mbuf back to the mbuf zone with all m_ext * information purged. @@ -425,7 +425,7 @@ m_sanity(struct mbuf *m0, int sanitize) #ifdef INVARIANTS #defineM_SANITY_ACTION(s) panic(mbuf %p: s, m) -#else +#else #defineM_SANITY_ACTION(s) printf(mbuf %p: s, m) #endif @@ -583,7 +583,7 @@ m_prepend(struct mbuf *m, int len, int h if (len MHLEN) MH_ALIGN(m, len); } else { - if (len MLEN) + if (len MLEN) M_ALIGN(m, len); } m-m_len = len; @@ -621,7 +621,7 @@ m_copym(struct mbuf *m, int off0, int le top = 0; while (len 0) { if (m == NULL) { - KASSERT(len == M_COPYALL, + KASSERT(len == M_COPYALL, (m_copym, length size of mbuf chain)); break; } @@ -756,9 +756,9 @@ m_copymdata(struct mbuf *m, struct mbuf if (!(mm-m_flags M_EXT)) return NULL; bcopy(buf, (caddr_t *)mm-m_ext.ext_buf + - mm-m_ext.ext_size - mm-m_len, mm-m_len); + mm-m_ext.ext_size - mm-m_len, mm-m_len); mm-m_data = (caddr_t)mm-m_ext.ext_buf + - mm-m_ext.ext_size - mm-m_len; + mm-m_ext.ext_size - mm-m_len; } /* Append/prepend as many mbuf (clusters) as necessary to fit len. */ @@ -772,7 +772,7 @@ m_copymdata(struct mbuf *m, struct mbuf i = 0; for (x = z; x != NULL; x = x-m_next) { i += x-m_flags M_EXT ? x-m_ext.ext_size : - (x-m_flags M_PKTHDR ? MHLEN : MLEN); + (x-m_flags M_PKTHDR ? MHLEN : MLEN); if (!x-m_next) break; } @@ -1569,7 +1569,7 @@ m_defrag(struct mbuf *m0, int how) goto nospace; } #endif - + if (m0-m_pkthdr.len MHLEN) m_final = m_getcl(how, MT_DATA, M_PKTHDR); else @@ -1735,7 +1735,7 @@ m_fragment(struct mbuf *m0, int how, int if (!(m0-m_flags M_PKTHDR)) return (m0); - + if ((length == 0) || (length -2)) return (m0); @@ -1938,7 +1938,7 @@ m_unshare(struct mbuf *m0, int how) m-m_len = M_TRAILINGSPACE(mprev)) { /* XXX: this ignores mbuf types */ memcpy(mtod(mprev, caddr_t) + mprev-m_len, - mtod(m, caddr_t), m-m_len); + mtod(m, caddr_t), m-m_len); mprev-m_len += m-m_len; mprev-m_next = m-m_next; /* unlink from chain */ m_free(m); /* reclaim mbuf */ @@ -1970,7 +1970,7 @@ m_unshare(struct mbuf *m0, int how) m-m_len = M_TRAILINGSPACE(mprev)) { /* XXX: this ignores mbuf types */ memcpy(mtod(mprev, caddr_t) + mprev-m_len, - mtod(m, caddr_t), m-m_len); + mtod(m, caddr_t), m-m_len); mprev-m_len += m-m_len; mprev-m_next = m-m_next; /* unlink from chain */ m_free(m); /* reclaim mbuf */ @@ -2003,7 +2003,7 @@ m_unshare(struct mbuf *m0, int how) n-m_len = cc; if (mlast != NULL) mlast-m_next = n; - mlast = n; + mlast = n; #if 0 newipsecstat.ips_clcopied++; #endif @@ -2020,7 +2020,7 @@ m_unshare(struct mbuf *m0, int how) return (NULL); } } - n-m_next = m-m_next; + n-m_next = m-m_next;
Re: svn commit: r266083 - in head/sys/arm: arm include
On 29 May 2014, at 21:21, Mark R V Murray ma...@freebsd.org wrote: On 29 May 2014, at 19:27, Michael Tuexen tue...@fh-muenster.de wrote: On 29 May 2014, at 20:15, Mark R V Murray ma...@freebsd.org wrote: On 29 May 2014, at 19:13, Michael Tuexen tue...@fh-muenster.de wrote: I can make it work on RPI, but trying to find what else it will/won’t work on is more problematic. Wouldn't it require to use different registers on the RPI? This would mean you would need more #ifdefs… Thats the problem; too many #ifdefs. So you could just keep the code for now, but reduce the #ifdefs to the ones you know that work. Later on, you can replace it by the driver stuff… That’s what I was thinking, yes. Great. Let me know if you need testing support on the RPI... Best regards Michael M -- Mark R V Murray ___ 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: r266857 - head/sys/netinet6
On 30.05.2014 00:53, Hiroki Sato wrote: Author: hrs Date: Thu May 29 20:53:53 2014 New Revision: 266857 URL: http://svnweb.freebsd.org/changeset/base/266857 Log: Add rwlock to struct dadq. A panic could occur when a large number of addresses performed DAD at the same time. Hello, do you have a backtraces from these panics published somewhere? -- WBR, Andrey V. Elsukov ___ 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: r266878 - head/lib/libstand
Author: hselasky Date: Fri May 30 09:43:32 2014 New Revision: 266878 URL: http://svnweb.freebsd.org/changeset/base/266878 Log: Add support for snprintf() to libstand. Reviewed by: brooks @ Sponsored by: DARPA, AFRL Modified: head/lib/libstand/printf.c head/lib/libstand/stand.h Modified: head/lib/libstand/printf.c == --- head/lib/libstand/printf.c Fri May 30 09:39:59 2014(r266877) +++ head/lib/libstand/printf.c Fri May 30 09:43:32 2014(r266878) @@ -56,8 +56,16 @@ __FBSDID($FreeBSD$); #define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1) +typedef void (kvprintf_fn_t)(int, void *); + static char*ksprintn (char *buf, uintmax_t num, int base, int *len, int upper); -static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap); +static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap); + +static void +putchar_wrapper(int cc, void *arg) +{ + putchar(cc); +} int printf(const char *fmt, ...) @@ -66,7 +74,7 @@ printf(const char *fmt, ...) int retval; va_start(ap, fmt); - retval = kvprintf(fmt, putchar, NULL, 10, ap); + retval = kvprintf(fmt, putchar_wrapper, NULL, 10, ap); va_end(ap); return retval; } @@ -74,8 +82,7 @@ printf(const char *fmt, ...) void vprintf(const char *fmt, va_list ap) { - - kvprintf(fmt, putchar, NULL, 10, ap); + kvprintf(fmt, putchar_wrapper, NULL, 10, ap); } int @@ -91,6 +98,46 @@ sprintf(char *buf, const char *cfmt, ... return retval; } +struct print_buf { + char *buf; + size_t size; +}; + +static void +snprint_func(int ch, void *arg) +{ + struct print_buf *pbuf = arg; + + if (pbuf-size 2) { + /* +* Reserve last buffer position for the terminating +* character: +*/ + return; + } + *(pbuf-buf)++ = ch; + pbuf-size--; +} + +int +snprintf(char *buf, size_t size, const char *cfmt, ...) +{ + int retval; + va_list ap; + struct print_buf arg; + + arg.buf = buf; + arg.size = size; + + va_start(ap, cfmt); + retval = kvprintf(cfmt, snprint_func, arg, 10, ap); + va_end(ap); + + if (arg.size = 1) + *(arg.buf)++ = 0; + return retval; +} + void vsprintf(char *buf, const char *cfmt, va_list ap) { @@ -149,9 +196,9 @@ ksprintn(char *nbuf, uintmax_t num, int * (%*D, len, ptr, - XX XX XX XX ... */ static int -kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap) +kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc); else *d++ = cc; retval++; } +#define PCHAR(c) {int cc=(c); if (func) (*func)(cc, arg); else *d++ = cc; retval++; } char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; Modified: head/lib/libstand/stand.h == --- head/lib/libstand/stand.h Fri May 30 09:39:59 2014(r266877) +++ head/lib/libstand/stand.h Fri May 30 09:43:32 2014(r266878) @@ -238,6 +238,7 @@ extern void mallocstats(void); extern int printf(const char *fmt, ...) __printflike(1, 2); extern voidvprintf(const char *fmt, __va_list); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); +extern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); extern voidvsprintf(char *buf, const char *cfmt, __va_list); extern voidtwiddle(void); ___ 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: r266879 - head/lib/libstand
Author: hselasky Date: Fri May 30 10:18:01 2014 New Revision: 266879 URL: http://svnweb.freebsd.org/changeset/base/266879 Log: style(9) requires an empty line when function have no local variables. Suggested by: ae @ Sponsored by: DARPA, AFRL Modified: head/lib/libstand/printf.c Modified: head/lib/libstand/printf.c == --- head/lib/libstand/printf.c Fri May 30 09:43:32 2014(r266878) +++ head/lib/libstand/printf.c Fri May 30 10:18:01 2014(r266879) @@ -64,6 +64,7 @@ static intkvprintf(char const *fmt, kvp static void putchar_wrapper(int cc, void *arg) { + putchar(cc); } @@ -82,6 +83,7 @@ printf(const char *fmt, ...) void vprintf(const char *fmt, va_list ap) { + kvprintf(fmt, putchar_wrapper, NULL, 10, ap); } ___ 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: r266880 - head/sys/geom/part
Author: ae Date: Fri May 30 10:35:51 2014 New Revision: 266880 URL: http://svnweb.freebsd.org/changeset/base/266880 Log: Use g_conf_printf_escaped() to escape symbols, which can break an XML tree. MFC after:1 week Modified: head/sys/geom/part/g_part_apm.c head/sys/geom/part/g_part_gpt.c head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part_apm.c == --- head/sys/geom/part/g_part_apm.c Fri May 30 10:18:01 2014 (r266879) +++ head/sys/geom/part/g_part_apm.c Fri May 30 10:35:51 2014 (r266880) @@ -42,6 +42,7 @@ __FBSDID($FreeBSD$); #include sys/systm.h #include sys/sysctl.h #include geom/geom.h +#include geom/geom_int.h #include geom/part/g_part.h #include g_part_if.h @@ -310,10 +311,14 @@ g_part_apm_dumpconf(struct g_part_table /* confxml: partition entry information */ strncpy(u.name, entry-ent.ent_name, APM_ENT_NAMELEN); u.name[APM_ENT_NAMELEN] = '\0'; - sbuf_printf(sb, %slabel%s/label\n, indent, u.name); + sbuf_printf(sb, %slabel, indent); + g_conf_printf_escaped(sb, %s, u.name); + sbuf_printf(sb, /label\n); strncpy(u.type, entry-ent.ent_type, APM_ENT_TYPELEN); u.type[APM_ENT_TYPELEN] = '\0'; - sbuf_printf(sb, %srawtype%s/rawtype\n, indent, u.type); + sbuf_printf(sb, %srawtype, indent); + g_conf_printf_escaped(sb, %s, u.type); + sbuf_printf(sb, /rawtype\n); } else { /* confxml: scheme information */ } Modified: head/sys/geom/part/g_part_gpt.c == --- head/sys/geom/part/g_part_gpt.c Fri May 30 10:18:01 2014 (r266879) +++ head/sys/geom/part/g_part_gpt.c Fri May 30 10:35:51 2014 (r266880) @@ -44,6 +44,7 @@ __FBSDID($FreeBSD$); #include sys/sysctl.h #include sys/uuid.h #include geom/geom.h +#include geom/geom_int.h #include geom/part/g_part.h #include g_part_if.h @@ -1253,16 +1254,16 @@ g_gpt_printf_utf16(struct sbuf *sb, uint /* Write the Unicode character in UTF-8 */ if (ch 0x80) - sbuf_printf(sb, %c, ch); + g_conf_printf_escaped(sb, %c, ch); else if (ch 0x800) - sbuf_printf(sb, %c%c, 0xc0 | (ch 6), + g_conf_printf_escaped(sb, %c%c, 0xc0 | (ch 6), 0x80 | (ch 0x3f)); else if (ch 0x1) - sbuf_printf(sb, %c%c%c, 0xe0 | (ch 12), + g_conf_printf_escaped(sb, %c%c%c, 0xe0 | (ch 12), 0x80 | ((ch 6) 0x3f), 0x80 | (ch 0x3f)); else if (ch 0x20) - sbuf_printf(sb, %c%c%c%c, 0xf0 | (ch 18), - 0x80 | ((ch 12) 0x3f), + g_conf_printf_escaped(sb, %c%c%c%c, 0xf0 | + (ch 18), 0x80 | ((ch 12) 0x3f), 0x80 | ((ch 6) 0x3f), 0x80 | (ch 0x3f)); } } Modified: head/sys/geom/part/g_part_pc98.c == --- head/sys/geom/part/g_part_pc98.cFri May 30 10:18:01 2014 (r266879) +++ head/sys/geom/part/g_part_pc98.cFri May 30 10:35:51 2014 (r266880) @@ -300,7 +300,9 @@ g_part_pc98_dumpconf(struct g_part_table sbuf_printf(sb, xs PC98 xt %u sn %s, type, name); } else { /* confxml: partition entry information */ - sbuf_printf(sb, %slabel%s/label\n, indent, name); + sbuf_printf(sb, %slabel, indent); + g_conf_printf_escaped(sb, %s, name); + sbuf_printf(sb, /label\n); if (entry-ent.dp_mid PC98_MID_BOOTABLE) sbuf_printf(sb, %sattribbootable/attrib\n, indent); ___ 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: r266865 - in head: include include/xlocale lib/libc/string
Il giorno 30/mag/2014, alle ore 00:18, Rui Paulo rpa...@felyko.com ha scritto: On May 29, 2014, at 18:09, Pedro F. Giffuni p...@freebsd.org wrote: Author: pfg Date: Fri May 30 01:09:07 2014 New Revision: 266865 URL: http://svnweb.freebsd.org/changeset/base/266865 Log: Fix strcasecmp_l() and strncasecmp_l() POSIX 2008 compliance. POSIX.1-2008 specifies that those two functions should be declared by including strings.h, not string.h (the latter only has strcoll_l() and strxfrm_l()): http://pubs.opengroup.org/onlinepubs/9699919799/functions/strcasecmp.html Is this going to cause any ports fallout? I consider this a bug fix; I think ports should already be respecting standards. Should I consider a FreeBSD_version bump JIC? Pedro. ___ 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: r266865 - in head: include include/xlocale lib/libc/string
On 30 May 2014, at 06:18, Rui Paulo rpa...@felyko.com wrote: Is this going to cause any ports fallout? It shouldn't do. Any code that compiles on OS X will expect these to be in the correct place, and since DragonFly applied the fix first we'd hopefully have found any fallout via dports. David ___ 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: r266881 - head/sys/boot/usb/storage
Author: hselasky Date: Fri May 30 13:10:49 2014 New Revision: 266881 URL: http://svnweb.freebsd.org/changeset/base/266881 Log: Add support for USB mass storage to libusbboot. Sponsored by: DARPA, AFRL Added: head/sys/boot/usb/storage/ head/sys/boot/usb/storage/umass_common.c (contents, props changed) head/sys/boot/usb/storage/umass_common.h (contents, props changed) head/sys/boot/usb/storage/umass_loader.c (contents, props changed) Added: head/sys/boot/usb/storage/umass_common.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/usb/storage/umass_common.cFri May 30 13:10:49 2014 (r266881) @@ -0,0 +1,87 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky hsela...@freebsd.org + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * (CTSRD), as part of the DARPA CRASH research programme. + * + * 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 USB_GLOBAL_INCLUDE_FILE + +#include umass_common.h + +struct usb_attach_arg umass_uaa; + +static device_probe_t umass_probe; +static device_attach_t umass_attach; +static device_detach_t umass_detach; + +static devclass_t umass_devclass; + +static device_method_t umass_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, umass_probe), + DEVMETHOD(device_attach, umass_attach), + DEVMETHOD(device_detach, umass_detach), + + DEVMETHOD_END +}; + +static driver_t umass_driver = { + .name = umass, + .methods = umass_methods, +}; + +DRIVER_MODULE(umass, uhub, umass_driver, umass_devclass, NULL, 0); + +static int +umass_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + + if (uaa-usb_mode != USB_MODE_HOST || + uaa-info.bInterfaceClass != UICLASS_MASS || + uaa-info.bInterfaceSubClass != UISUBCLASS_SCSI || + uaa-info.bInterfaceProtocol != UIPROTO_MASS_BBB || + device_get_unit(dev) != 0) + return (ENXIO); + return (0); +} + +static int +umass_attach(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + umass_uaa = *uaa; + return (0); /* success */ +} + +static int +umass_detach(device_t dev) +{ + memset(umass_uaa, 0, sizeof(umass_uaa)); + return (0); +} Added: head/sys/boot/usb/storage/umass_common.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/usb/storage/umass_common.hFri May 30 13:10:49 2014 (r266881) @@ -0,0 +1,37 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky hsela...@freebsd.org + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * (CTSRD), as part of the DARPA CRASH research programme. + * + * 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
svn commit: r266882 - head/sys/boot/usb
Author: hselasky Date: Fri May 30 13:39:58 2014 New Revision: 266882 URL: http://svnweb.freebsd.org/changeset/base/266882 Log: USB boot library improvements: - Make the USB boot library more configurable. - Resolve compile issues when cross building. - Allow use of separate malloc. - Allow use of separate endian macros. Sponsored by: DARPA, AFRL Modified: head/sys/boot/usb/Makefile head/sys/boot/usb/bsd_kernel.c head/sys/boot/usb/bsd_kernel.h head/sys/boot/usb/usb_busdma_loader.c Modified: head/sys/boot/usb/Makefile == --- head/sys/boot/usb/Makefile Fri May 30 13:10:49 2014(r266881) +++ head/sys/boot/usb/Makefile Fri May 30 13:39:58 2014(r266882) @@ -30,6 +30,7 @@ S=${.CURDIR}/../.. .PATH: \ ${.CURDIR} \ + ${.CURDIR}/storage \ ${S}/dev/usb \ ${S}/dev/usb/controller \ ${S}/dev/usb/serial \ @@ -39,7 +40,7 @@ S=${.CURDIR}/../.. LIB= usbboot INTERNALLIB= OBJCOPY?= objcopy -SYSCC?=cc +SYSCC?=/usr/bin/cc CFLAGS+= -DBOOTPROG=\usbloader\ CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE=\bsd_global.h\ @@ -49,7 +50,13 @@ CFLAGS+= -Wformat -Wall CFLAGS+= -I${S} CFLAGS+= -I${T} CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR}/../common CFLAGS+= -g +CFLAGS+= -DUSB_MSCTEST_BULK_SIZE=65536 +CFLAGS+= -DUSB_POOL_SIZE=262144 +CFLAGS+= -fno-pic +CFLAGS+= -DHAVE_ENDIAN_DEFS +CFLAGS+= -DHAVE_MALLOC .if ${MACHINE_CPUARCH} == i386 || ${MACHINE_CPUARCH} == amd64 CFLAGS+= -march=i386 @@ -58,6 +65,9 @@ CFLAGS.gcc+= -mpreferred-stack-boundary= .if ${MACHINE_CPUARCH} == amd64 CFLAGS+= -m32 .endif +.if ${MACHINE_CPUARCH} == mips +CFLAGS+= -mno-abicalls +.endif # # Single threaded BSD kernel @@ -77,19 +87,66 @@ SRCS+= usb_busdma_loader.c # # USB controller drivers # + +SRCS+= usb_controller.c + +.if defined(HAVE_AT91DCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\at91dci\ SRCS+= at91dci.c +.endif + +.if defined(HAVE_ATMEGADCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\atmegadci\ SRCS+= atmegadci.c +.endif + +.if defined(HAVE_AVR32DCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\avr32dci\ SRCS+= avr32dci.c -SRCS+= dwc_otg.c +.endif + +.if defined(HAVE_DWCOTG) +CFLAGS += -DUSB_PCI_PROBE_LIST=\dwcotg\ +SRCS+= dwcotg.c +.endif + +.if defined(HAVE_MUSBOTG) +CFLAGS += -DUSB_PCI_PROBE_LIST=\musbotg\ +SRCS+= musbotg.c +.endif + +.if defined(HAVE_EHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\ehci\ SRCS+= ehci.c -SRCS+= musb_otg.c +.endif + +.if defined(HAVE_OHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\ohci\ SRCS+= ohci.c +.endif + +.if defined(HAVE_UHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\uhci\ SRCS+= uhci.c -SRCS+= uss820dci.c +.endif + +.if defined(HAVE_XHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\xhci\ SRCS+= xhci.c -SRCS+= usb_controller.c +.endif + +.if defined(HAVE_USS820DCI) +CFLAGS += -DUSB_PCI_PROBE_LIST=\uss820dci\ +SRCS+= uss820dci.c +.endif -CFLAGS += -DUSB_PROBE_LIST=\xhci\, \ehci\, \uhci\, \ohci\ +.if defined(HAVE_SAF1761OTG) +CFLAGS += -DUSB_PCI_PROBE_LIST=\saf1761otg\ +CFLAGS += -DUSB_PCI_MEMORY_ADDRESS=0x90007f10ULL +CFLAGS += -DUSB_PCI_MEMORY_SIZE=0x4U +SRCS+= saf1761_otg.c +SRCS+= saf1761_otg_boot.c +.endif # # USB core and templates @@ -119,6 +176,15 @@ SRCS+= usb_template_audio.c SRCS+= sysinit_data.c SRCS+= sysuninit_data.c +# +# USB mass storage support +# +SRCS+= umass_common.c + +.if defined(HAVE_UMASS_LOADER) +SRCS+= umass_loader.c +.endif + CLEANFILES+= sysinit CLEANFILES+= sysinit.bin CLEANFILES+= sysinit_data.c Modified: head/sys/boot/usb/bsd_kernel.c == --- head/sys/boot/usb/bsd_kernel.c Fri May 30 13:10:49 2014 (r266881) +++ head/sys/boot/usb/bsd_kernel.c Fri May 30 13:39:58 2014 (r266882) @@ -1091,6 +1091,7 @@ usb_proc_mwait(struct usb_process *up, v * SYSTEM attach **/ +#ifdef USB_PCI_PROBE_LIST static device_method_t pci_methods[] = { DEVMETHOD_END }; @@ -1105,9 +1106,7 @@ static devclass_t pci_devclass; DRIVER_MODULE(pci, pci, pci_driver, pci_devclass, 0, 0); static const char *usb_pci_devices[] = { -#ifdef USB_PROBE_LIST - USB_PROBE_LIST -#endif + USB_PCI_PROBE_LIST }; #defineUSB_PCI_USB_MAX (sizeof(usb_pci_devices) / sizeof(void *)) @@ -1150,11 +1149,13 @@ usb_pci_mod_unload(void *arg) device_delete_child(NULL, usb_pci_root); } SYSUNINIT(usb_pci_mod_unload, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, usb_pci_mod_unload, 0); +#endif /** * MALLOC API **/ +#ifndef HAVE_MALLOC #defineUSB_POOL_ALIGN 8 static uint8_t
Re: svn commit: r266865 - in head: include include/xlocale lib/libc/string
On Fri, May 30, 2014 at 06:55:46AM -0500, Pedro Giffuni wrote: I consider this a bug fix; I think ports should already be respecting standards. Hahahahahahaha You haven't looked at much ports code, I see :-) Should I consider a FreeBSD_version bump JIC? Please. mcl ___ 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: r266885 - head/sys/boot/mips/beri/loader
Author: hselasky Date: Fri May 30 13:53:37 2014 New Revision: 266885 URL: http://svnweb.freebsd.org/changeset/base/266885 Log: Fix delay() function in the BERI loader code. Reviewed by: brooks @ Sponsored by: DARPA, AFRL Modified: head/sys/boot/mips/beri/loader/main.c Modified: head/sys/boot/mips/beri/loader/main.c == --- head/sys/boot/mips/beri/loader/main.c Fri May 30 13:45:20 2014 (r266884) +++ head/sys/boot/mips/beri/loader/main.c Fri May 30 13:53:37 2014 (r266885) @@ -215,13 +215,25 @@ time(time_t *tloc) } /* - * Delay - presumably in usecs? + * Delay - in usecs + * + * NOTE: We are assuming that the CPU is running at 100MHz. */ void delay(int usecs) { - register_t t; + uint32_t delta; + uint32_t curr; + uint32_t last; - t = cp0_count_get() + usecs * 100; - while (cp0_count_get() t); + last = cp0_count_get(); + while (usecs 0) { + curr = cp0_count_get(); + delta = curr - last; + while (usecs 0 delta = 100) { + usecs--; + last += 100; + delta -= 100; + } + } } ___ 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: r266886 - head/sys/boot/usb/storage
Author: hselasky Date: Fri May 30 14:05:31 2014 New Revision: 266886 URL: http://svnweb.freebsd.org/changeset/base/266886 Log: Export structure(s) properly. Sponsored by: DARPA, AFRL Modified: head/sys/boot/usb/storage/umass_common.h Modified: head/sys/boot/usb/storage/umass_common.h == --- head/sys/boot/usb/storage/umass_common.hFri May 30 13:53:37 2014 (r266885) +++ head/sys/boot/usb/storage/umass_common.hFri May 30 14:05:31 2014 (r266886) @@ -32,6 +32,10 @@ #ifndef _UMASS_COMMON_H_ #define_UMASS_COMMON_H_ +struct usb_attach_arg; +struct devsw; + extern struct usb_attach_arg umass_uaa; +extern struct devsw umass_disk; #endif /* _UMASS_COMMON_H_ */ ___ 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: r266887 - head/sys/boot/usb
Author: hselasky Date: Fri May 30 14:30:52 2014 New Revision: 266887 URL: http://svnweb.freebsd.org/changeset/base/266887 Log: Resolve issue with resolving malloc() and free() functions at linking time. Sponsored by: DARPA, AFRL Modified: head/sys/boot/usb/bsd_kernel.h head/sys/boot/usb/bsd_usbloader_test.c Modified: head/sys/boot/usb/bsd_kernel.h == --- head/sys/boot/usb/bsd_kernel.h Fri May 30 14:05:31 2014 (r266886) +++ head/sys/boot/usb/bsd_kernel.h Fri May 30 14:30:52 2014 (r266887) @@ -430,7 +430,6 @@ size_t strlen(const char *s); /* MALLOC API */ -#ifndef HAVE_MALLOC #undef malloc #definemalloc(s,x,f) usb_malloc(s) void *usb_malloc(size_t); @@ -438,15 +437,6 @@ void *usb_malloc(size_t); #undef free #definefree(p,x) usb_free(p) void usb_free(void *); -#else -#undef malloc -void *malloc(size_t); -#definemalloc(s,x,f) malloc(s) - -#undef free -void free(void *); -#definefree(p,x) free(p) -#endif #definestrdup(p,x) usb_strdup(p) char *usb_strdup(const char *str); Modified: head/sys/boot/usb/bsd_usbloader_test.c == --- head/sys/boot/usb/bsd_usbloader_test.c Fri May 30 14:05:31 2014 (r266886) +++ head/sys/boot/usb/bsd_usbloader_test.c Fri May 30 14:30:52 2014 (r266887) @@ -26,6 +26,7 @@ #include stdio.h #include stdint.h +#include stdlib.h #include time.h extern int usleep(int); @@ -36,6 +37,18 @@ extern void usb_uninit(void); #definehz 1000 +void * +usb_malloc(size_t size) +{ + return (malloc(size)); +} + +void +usb_free(void *ptr) +{ + free(ptr); +} + void DELAY(unsigned int delay) { ___ 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: r266865 - in head: include include/xlocale lib/libc/string
El 5/30/2014 8:54 AM, Mark Linimon escribió: On Fri, May 30, 2014 at 06:55:46AM -0500, Pedro Giffuni wrote: I consider this a bug fix; I think ports should already be respecting standards. Hahahahahahaha You haven't looked at much ports code, I see :-) Not lately ;). Should I consider a FreeBSD_version bump JIC? Please. OK, Give me one more day, I want to wrap some more libc changes (from Illumos). Pedro. ___ 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: r266775 - head/sys/x86/x86
On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ 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: r266860 - in head: sys/net sys/netinet sys/netinet6 tests/sys/netinet
On Fri, May 30, 2014 at 2:11 AM, Gleb Smirnoff gleb...@freebsd.org wrote: On Thu, May 29, 2014 at 09:03:50PM +, Alan Somers wrote: A Author: asomers A Date: Thu May 29 21:03:49 2014 A New Revision: 266860 A URL: http://svnweb.freebsd.org/changeset/base/266860 A A Log: A Fix unintended KBI change from r264905. Add _fib versions of A ifa_ifwithnet() and ifa_ifwithdstaddr() The legacy functions will call the A _fib() versions with RT_ALL_FIBS, preserving legacy behavior. Is this intended for MFC? If not, then I'd say that API bloat hurts more than KBI change in head/. Yes, it's intended for MFC. -- Totus tuus, Glebius. ___ 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: r266775 - head/sys/x86/x86
On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). -- 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
svn commit: r266891 - head/sys/dev/cfe
Author: jhb Date: Fri May 30 15:46:10 2014 New Revision: 266891 URL: http://svnweb.freebsd.org/changeset/base/266891 Log: Use callout_*() rather than timeout()/untimeout(). Reviewed by: imp Modified: head/sys/dev/cfe/cfe_console.c Modified: head/sys/dev/cfe/cfe_console.c == --- head/sys/dev/cfe/cfe_console.c Fri May 30 15:02:29 2014 (r266890) +++ head/sys/dev/cfe/cfe_console.c Fri May 30 15:46:10 2014 (r266891) @@ -62,8 +62,7 @@ static struct ttydevsw cfe_ttydevsw = { static int conhandle = -1; /* XXX does cfe have to poll? */ static int polltime; -static struct callout_handle cfe_timeouthandle -= CALLOUT_HANDLE_INITIALIZER(cfe_timeouthandle); +static struct callout cfe_timer; #if defined(KDB) static int alt_break_state; @@ -89,6 +88,7 @@ cn_drvinit(void *unused) if (cfe_consdev.cn_pri != CN_DEAD cfe_consdev.cn_name[0] != '\0') { tp = tty_alloc(cfe_ttydevsw, NULL); + callout_init_mtx(cfe_timer, tty_getlock(tp), 0); tty_makedev(tp, NULL, cfecons); } } @@ -99,7 +99,7 @@ cfe_tty_open(struct tty *tp) polltime = hz / CFECONS_POLL_HZ; if (polltime 1) polltime = 1; - cfe_timeouthandle = timeout(cfe_timeout, tp, polltime); + callout_reset(cfe_timer, polltime, cfe_timeout, tp); return (0); } @@ -108,8 +108,7 @@ static void cfe_tty_close(struct tty *tp) { - /* XXX Should be replaced with callout_stop(9) */ - untimeout(cfe_timeout, tp, cfe_timeouthandle); + callout_stop(cfe_timer); } static void @@ -141,13 +140,12 @@ cfe_timeout(void *v) tp = (struct tty *)v; - tty_lock(tp); + tty_lock_assert(tp, MA_OWNED); while ((c = cfe_cngetc(NULL)) != -1) ttydisc_rint(tp, c, 0); ttydisc_rint_done(tp); - tty_unlock(tp); - cfe_timeouthandle = timeout(cfe_timeout, tp, polltime); + callout_reset(cfe_timer, polltime, cfe_timeout, tp); } static void ___ 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: r266775 - head/sys/x86/x86
On Fri, May 30, 2014 at 5:03 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). Did you notice that I *removed* the destroy not *added*? Attilio -- Peace can only be achieved by understanding - A. Einstein ___ 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: r266775 - head/sys/x86/x86
On Friday, May 30, 2014 11:39:24 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:03 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). Did you notice that I *removed* the destroy not *added*? Yes, my point was that that bug in the original code you are fixing was there regardless of Scott's change. -- 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: r266775 - head/sys/x86/x86
On Fri, May 30, 2014 at 5:47 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:39:24 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:03 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). Did you notice that I *removed* the destroy not *added*? Yes, my point was that that bug in the original code you are fixing was there regardless of Scott's change. And when I did say something different? I don't understand what's the point of your messages, besides showing that you didn't read correctly my patch. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ 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: r266892 - head/sys/dev/usb/controller
Author: hselasky Date: Fri May 30 16:44:03 2014 New Revision: 266892 URL: http://svnweb.freebsd.org/changeset/base/266892 Log: It appears the ISP/SAF1761 sometimes is busy when reading the status word of the PTD and simply returns a value of zero. Retry a few times before giving up. Sponsored by: DARPA, AFRL Modified: head/sys/dev/usb/controller/saf1761_otg.c Modified: head/sys/dev/usb/controller/saf1761_otg.c == --- head/sys/dev/usb/controller/saf1761_otg.c Fri May 30 15:46:10 2014 (r266891) +++ head/sys/dev/usb/controller/saf1761_otg.c Fri May 30 16:44:03 2014 (r266892) @@ -291,11 +291,23 @@ saf1761_host_channel_free(struct saf1761 } static uint32_t -saf1761_peek_host_memory_le_4(struct saf1761_otg_softc *sc, uint32_t offset) +saf1761_peek_host_status_le_4(struct saf1761_otg_softc *sc, uint32_t offset) { - SAF1761_WRITE_LE_4(sc, SOTG_MEMORY_REG, offset); - SAF1761_90NS_DELAY(sc); /* read prefetch time is 90ns */ - return (SAF1761_READ_LE_4(sc, offset)); + uint32_t x = 0; + while (1) { + uint32_t retval; + + SAF1761_WRITE_LE_4(sc, SOTG_MEMORY_REG, offset); + SAF1761_90NS_DELAY(sc); /* read prefetch time is 90ns */ + retval = SAF1761_READ_LE_4(sc, offset); + if (retval != 0) + return (retval); + if (++x == 8) { + DPRINTF(STAUS is zero at offset 0x%x\n, offset); + break; + } + } + return (0); } static void @@ -415,9 +427,7 @@ saf1761_host_setup_tx(struct saf1761_otg if (td-channel SOTG_HOST_CHANNEL_MAX) { pdt_addr = SOTG_PTD(td-channel); - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); - if (status == 0) - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); + status = saf1761_peek_host_status_le_4(sc, pdt_addr + SOTG_PTD_DW3); DPRINTFN(5, STATUS=0x%08x\n, status); @@ -487,9 +497,7 @@ saf1761_host_bulk_data_rx(struct saf1761 pdt_addr = SOTG_PTD(td-channel); - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); - if (status == 0) - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); + status = saf1761_peek_host_status_le_4(sc, pdt_addr + SOTG_PTD_DW3); DPRINTFN(5, STATUS=0x%08x\n, status); @@ -591,9 +599,7 @@ saf1761_host_bulk_data_tx(struct saf1761 pdt_addr = SOTG_PTD(td-channel); - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); - if (status == 0) - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); + status = saf1761_peek_host_status_le_4(sc, pdt_addr + SOTG_PTD_DW3); DPRINTFN(5, STATUS=0x%08x\n, status); @@ -681,9 +687,7 @@ saf1761_host_intr_data_rx(struct saf1761 pdt_addr = SOTG_PTD(td-channel); - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); - if (status == 0) - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); + status = saf1761_peek_host_status_le_4(sc, pdt_addr + SOTG_PTD_DW3); DPRINTFN(5, STATUS=0x%08x\n, status); @@ -788,9 +792,7 @@ saf1761_host_intr_data_tx(struct saf1761 pdt_addr = SOTG_PTD(td-channel); - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); - if (status == 0) - status = saf1761_peek_host_memory_le_4(sc, pdt_addr + SOTG_PTD_DW3); + status = saf1761_peek_host_status_le_4(sc, pdt_addr + SOTG_PTD_DW3); DPRINTFN(5, STATUS=0x%08x\n, status); ___ 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: r266775 - head/sys/x86/x86
On Friday, May 30, 2014 11:51:38 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:47 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:39:24 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:03 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). Did you notice that I *removed* the destroy not *added*? Yes, my point was that that bug in the original code you are fixing was there regardless of Scott's change. And when I did say something different? I don't understand what's the point of your messages, besides showing that you didn't read correctly my patch. I read yours correctly but worded mine poorly. My point is that Scott's change does not introduce anything new. We've had NULL maps for static allocations for many, many years. It's only been recently that we've had more maps not be NULL for this. However, even if you discounted the whole NULL vs non-NULL maps thing, the driver in question that you are fixing was broken regardless. That is, due to the extra bus_dmamap_destroy() the driver was broken regardless of whether the map was NULL or non-NULL. TL;DR: - Scott's change did not introduce any new behavior so we don't need to worry about a spate of new bugs uncovered in drivers because of it. - Your fix is correct, and it was broken with or without Scott's change. -- 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
svn commit: r266893 - head/sys/boot/mips/beri/loader
Author: hselasky Date: Fri May 30 16:47:54 2014 New Revision: 266893 URL: http://svnweb.freebsd.org/changeset/base/266893 Log: Add optional support for USB to BERI loader. Fix the linker script so that the garbage collection feature can be used when linking. Sponsored by: DARPA, AFRL Modified: head/sys/boot/mips/beri/loader/Makefile head/sys/boot/mips/beri/loader/loader.ldscript head/sys/boot/mips/beri/loader/main.c Modified: head/sys/boot/mips/beri/loader/Makefile == --- head/sys/boot/mips/beri/loader/Makefile Fri May 30 16:44:03 2014 (r266892) +++ head/sys/boot/mips/beri/loader/Makefile Fri May 30 16:47:54 2014 (r266893) @@ -136,6 +136,17 @@ FILES+= loader.rc FILES+= menu.rc .endif +.if defined(LOADER_USB_SUPPORT) +# Do garbage collection +CFLAGS+= -ffunction-sections -fdata-sections +CFLAGS+= -Wl,--gc-sections +# Link USB BOOT library +LDADD+= ${.OBJDIR}/../../../usb/libusbboot.a +CFLAGS+= -I${.CURDIR}/../../../usb +# Define USB SUPPORT +CFLAGS+= -DLOADER_USB_SUPPORT +.endif + all: loader .include bsd.prog.mk Modified: head/sys/boot/mips/beri/loader/loader.ldscript == --- head/sys/boot/mips/beri/loader/loader.ldscript Fri May 30 16:44:03 2014(r266892) +++ head/sys/boot/mips/beri/loader/loader.ldscript Fri May 30 16:47:54 2014(r266893) @@ -58,11 +58,16 @@ SECTIONS . += SIZEOF_HEADERS; .text ALIGN(0x8): { - start.o(.text) - *(EXCLUDE_FILE (start.o) .text) + start.o(.text*) + *(EXCLUDE_FILE (start.o) .text*) + *(.rodata*) + + __start_set_Xcommand_set = .; + KEEP(*(set_Xcommand_set)) + __stop_set_Xcommand_set = .; } - .data ALIGN(0x8): { *(.data)} - .bss ALIGN(0x8): { *(.bss) } + .data ALIGN(0x8): { *(.data*)} + .bss ALIGN(0x8): { *(.bss*) } __heap = ALIGN(0x8);/* 64-bit aligned heap pointer */ __data_end = .; Modified: head/sys/boot/mips/beri/loader/main.c == --- head/sys/boot/mips/beri/loader/main.c Fri May 30 16:44:03 2014 (r266892) +++ head/sys/boot/mips/beri/loader/main.c Fri May 30 16:47:54 2014 (r266893) @@ -43,12 +43,19 @@ __FBSDID($FreeBSD$); #include loader.h #include mips.h +#ifdef LOADER_USB_SUPPORT +#include storage/umass_common.h +#endif + static int __elfN(exec)(struct preloaded_file *); static voidextract_currdev(struct bootinfo *); struct devsw *devsw[] = { beri_cfi_disk, beri_sdcard_disk, +#ifdef LOADER_USB_SUPPORT + umass_disk, +#endif NULL }; ___ 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: r266894 - head/sys/boot/usb
Author: hselasky Date: Fri May 30 16:49:12 2014 New Revision: 266894 URL: http://svnweb.freebsd.org/changeset/base/266894 Log: Use own memory pool of 128K until further, hence that works the best. Sponsored by: DARPA, AFRL Modified: head/sys/boot/usb/Makefile head/sys/boot/usb/bsd_usbloader_test.c Modified: head/sys/boot/usb/Makefile == --- head/sys/boot/usb/Makefile Fri May 30 16:47:54 2014(r266893) +++ head/sys/boot/usb/Makefile Fri May 30 16:49:12 2014(r266894) @@ -53,10 +53,9 @@ CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../common CFLAGS+= -g CFLAGS+= -DUSB_MSCTEST_BULK_SIZE=65536 -CFLAGS+= -DUSB_POOL_SIZE=262144 +CFLAGS+= -DUSB_POOL_SIZE=131072 CFLAGS+= -fno-pic CFLAGS+= -DHAVE_ENDIAN_DEFS -CFLAGS+= -DHAVE_MALLOC .if ${MACHINE_CPUARCH} == i386 || ${MACHINE_CPUARCH} == amd64 CFLAGS+= -march=i386 Modified: head/sys/boot/usb/bsd_usbloader_test.c == --- head/sys/boot/usb/bsd_usbloader_test.c Fri May 30 16:47:54 2014 (r266893) +++ head/sys/boot/usb/bsd_usbloader_test.c Fri May 30 16:49:12 2014 (r266894) @@ -37,6 +37,7 @@ extern void usb_uninit(void); #definehz 1000 +#ifdef HAVE_MALLOC void * usb_malloc(size_t size) { @@ -48,6 +49,7 @@ usb_free(void *ptr) { free(ptr); } +#endif void DELAY(unsigned int delay) ___ 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: r266895 - in head/etc: etc.amd64 etc.i386
Author: nwhitehorn Date: Fri May 30 16:53:53 2014 New Revision: 266895 URL: http://svnweb.freebsd.org/changeset/base/266895 Log: Enable a login console on ttyu0 by default if it is a serial console. This prevents surprising effects post-installation on serial-only x86 systems (e.g. bhyve) where the kernel messages will appear, rc scripts will run, and then there will be no login prompt and you will be locked out of the system. Thanks to Devin Teske and Peter Grehan for ideas and testing. With this patch, it may also be possible to unify all or most of the machine-specific ttys files. Modified: head/etc/etc.amd64/ttys head/etc/etc.i386/ttys Modified: head/etc/etc.amd64/ttys == --- head/etc/etc.amd64/ttys Fri May 30 16:49:12 2014(r266894) +++ head/etc/etc.amd64/ttys Fri May 30 16:53:53 2014(r266895) @@ -41,7 +41,7 @@ ttyv7 /usr/libexec/getty Pc xterm on ttyv8 /usr/local/bin/xdm -nodaemon xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 /usr/libexec/getty std.9600 dialup off secure +ttyu0 /usr/libexec/getty std.9600 vt100 onifconsole secure ttyu1 /usr/libexec/getty std.9600 dialup off secure ttyu2 /usr/libexec/getty std.9600 dialup off secure ttyu3 /usr/libexec/getty std.9600 dialup off secure Modified: head/etc/etc.i386/ttys == --- head/etc/etc.i386/ttys Fri May 30 16:49:12 2014(r266894) +++ head/etc/etc.i386/ttys Fri May 30 16:53:53 2014(r266895) @@ -41,7 +41,7 @@ ttyv7 /usr/libexec/getty Pc xterm on ttyv8 /usr/local/bin/xdm -nodaemon xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 /usr/libexec/getty std.9600 dialup off secure +ttyu0 /usr/libexec/getty std.9600 vt100 onifconsole secure ttyu1 /usr/libexec/getty std.9600 dialup off secure ttyu2 /usr/libexec/getty std.9600 dialup off secure ttyu3 /usr/libexec/getty std.9600 dialup off secure ___ 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: r266775 - head/sys/x86/x86
On Fri, May 30, 2014 at 6:44 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:51:38 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:47 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:39:24 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:03 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). Did you notice that I *removed* the destroy not *added*? Yes, my point was that that bug in the original code you are fixing was there regardless of Scott's change. And when I did say something different? I don't understand what's the point of your messages, besides showing that you didn't read correctly my patch. I read yours correctly but worded mine poorly. My point is that Scott's change does not introduce anything new. We've had NULL maps for static allocations for many, many years. It's only been recently that we've had more maps not be NULL for this. However, even if you discounted the whole NULL vs non-NULL maps thing, the driver in question that you are fixing was broken regardless. That is, due to the extra bus_dmamap_destroy() the driver was broken regardless of whether the map was NULL or non-NULL. To be honest, pre-266775 the kernel would actually panic for this specific driver, because we were going to free memory that was never allocated (by having a valid mapping but an invalid dma memory pointer). That was prompted to look at the dma_alloc_*() bits of drivers. We need to make a real sweep at drivers on these bits. TL;DR: - Scott's change did not introduce any new behavior so we don't need to worry about a spate of new bugs uncovered in drivers because of it. Not entirely true. For ATA it was before a panic and now it is a silent memory leak. For other drivers it may be the opposite. I could just find this one becaue I got bitten by it. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ 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: r266775 - head/sys/x86/x86
On Friday, May 30, 2014 12:55:06 pm Attilio Rao wrote: On Fri, May 30, 2014 at 6:44 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:51:38 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:47 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:39:24 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:03 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). Did you notice that I *removed* the destroy not *added*? Yes, my point was that that bug in the original code you are fixing was there regardless of Scott's change. And when I did say something different? I don't understand what's the point of your messages, besides showing that you didn't read correctly my patch. I read yours correctly but worded mine poorly. My point is that Scott's change does not introduce anything new. We've had NULL maps for static allocations for many, many years. It's only been recently that we've had more maps not be NULL for this. However, even if you discounted the whole NULL vs non-NULL maps thing, the driver in question that you are fixing was broken regardless. That is, due to the extra bus_dmamap_destroy() the driver was broken regardless of whether the map was NULL or non-NULL. To be honest, pre-266775 the kernel would actually panic for this specific driver, because we were going to free memory that was never allocated (by having a valid mapping but an invalid dma memory pointer). pre-239354 bus_dma would have used a NULL map just as it does now. And even some allocations during that window could still use a NULL map. The idea of a NULL map is not a new concept. Most maps from bus_dmamem_alloc() have been NULL for most of bus_dma's existence. That was prompted to look at the dma_alloc_*() bits of drivers. We need to make a real sweep at drivers on these bits. I did a start: http://p4web.freebsd.org/@@1194266?ac=10 -- 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
svn commit: r266901 - head/sys/amd64/amd64
Author: neel Date: Fri May 30 18:59:37 2014 New Revision: 266901 URL: http://svnweb.freebsd.org/changeset/base/266901 Log: Allocate a zeroed LDT. Failing to do this might result in the LDT appearing to run out of free descriptors because of random junk in the descriptor's 'sd_type' field. http://lists.freebsd.org/pipermail/freebsd-amd64/2014-May/016088.html Reviewed by: kib MFC after:2 weeks Modified: head/sys/amd64/amd64/sys_machdep.c Modified: head/sys/amd64/amd64/sys_machdep.c == --- head/sys/amd64/amd64/sys_machdep.c Fri May 30 18:14:15 2014 (r266900) +++ head/sys/amd64/amd64/sys_machdep.c Fri May 30 18:59:37 2014 (r266901) @@ -462,7 +462,7 @@ user_ldt_alloc(struct proc *p, int force new_ldt = malloc(sizeof(struct proc_ldt), M_SUBPROC, M_WAITOK); new_ldt-ldt_base = (caddr_t)kmem_malloc(kernel_arena, max_ldt_segment * sizeof(struct user_segment_descriptor), -M_WAITOK); +M_WAITOK | M_ZERO); if (new_ldt-ldt_base == NULL) { FREE(new_ldt, M_SUBPROC); mtx_lock(dt_lock); ___ 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: r266902 - head/etc/mtree
Author: emaste Date: Fri May 30 19:45:21 2014 New Revision: 266902 URL: http://svnweb.freebsd.org/changeset/base/266902 Log: Add missing libexec/bsdconfig subdirectories Modified: head/etc/mtree/BSD.usr.dist Modified: head/etc/mtree/BSD.usr.dist == --- head/etc/mtree/BSD.usr.dist Fri May 30 18:59:37 2014(r266901) +++ head/etc/mtree/BSD.usr.dist Fri May 30 19:45:21 2014(r266902) @@ -101,6 +101,10 @@ .. include .. +includes +include +.. +.. .. bsdinstall .. ___ 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: r266903 - head/usr.sbin/pmcstat
Author: emaste Date: Fri May 30 20:12:47 2014 New Revision: 266903 URL: http://svnweb.freebsd.org/changeset/base/266903 Log: Update default callchain depth to 16 to match kernel MFC after:1 week Modified: head/usr.sbin/pmcstat/pmcstat.h Modified: head/usr.sbin/pmcstat/pmcstat.h == --- head/usr.sbin/pmcstat/pmcstat.h Fri May 30 19:45:21 2014 (r266902) +++ head/usr.sbin/pmcstat/pmcstat.h Fri May 30 20:12:47 2014 (r266903) @@ -61,7 +61,7 @@ #defineDEFAULT_DISPLAY_HEIGHT 256 /* file virtual height */ #defineDEFAULT_DISPLAY_WIDTH 1024/* file virtual width */ #defineDEFAULT_BUFFER_SIZE 4096 -#defineDEFAULT_CALLGRAPH_DEPTH 4 +#defineDEFAULT_CALLGRAPH_DEPTH 16 #definePRINT_HEADER_PREFIX # #defineREADPIPEFD 0 ___ 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: r266904 - head/sys/sys
Author: pfg Date: Fri May 30 20:56:28 2014 New Revision: 266904 URL: http://svnweb.freebsd.org/changeset/base/266904 Log: Bump FreeBSD_version due to changed header for strcasecmp(3) family. In r266865, strcasecmp_l() and strncasecmp_l() were moved from string.h to strings.h for POSIX 2008 compliance. Requested by: linimon Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hFri May 30 20:12:47 2014(r266903) +++ head/sys/sys/param.hFri May 30 20:56:28 2014(r266904) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100021 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100022 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r266905 - head/sys/amd64/amd64
Author: neel Date: Fri May 30 20:58:32 2014 New Revision: 266905 URL: http://svnweb.freebsd.org/changeset/base/266905 Log: Remove bogus check for kmem_malloc() failure even though M_WAITOK is set. Requested by: jkim Modified: head/sys/amd64/amd64/sys_machdep.c Modified: head/sys/amd64/amd64/sys_machdep.c == --- head/sys/amd64/amd64/sys_machdep.c Fri May 30 20:56:28 2014 (r266904) +++ head/sys/amd64/amd64/sys_machdep.c Fri May 30 20:58:32 2014 (r266905) @@ -357,8 +357,6 @@ amd64_set_ioperm(td, uap) if (pcb-pcb_tssp == NULL) { tssp = (struct amd64tss *)kmem_malloc(kernel_arena, ctob(IOPAGES+1), M_WAITOK); - if (tssp == NULL) - return (ENOMEM); iomap = (char *)tssp[1]; memset(iomap, 0xff, IOPERM_BITMAP_SIZE); critical_enter(); @@ -463,11 +461,6 @@ user_ldt_alloc(struct proc *p, int force new_ldt-ldt_base = (caddr_t)kmem_malloc(kernel_arena, max_ldt_segment * sizeof(struct user_segment_descriptor), M_WAITOK | M_ZERO); - if (new_ldt-ldt_base == NULL) { - FREE(new_ldt, M_SUBPROC); - mtx_lock(dt_lock); - return (NULL); - } new_ldt-ldt_refcnt = 1; sldt.ssd_base = (uint64_t)new_ldt-ldt_base; sldt.ssd_limit = max_ldt_segment * ___ 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: r266906 - head/usr.bin/top
Author: jhb Date: Fri May 30 21:18:53 2014 New Revision: 266906 URL: http://svnweb.freebsd.org/changeset/base/266906 Log: Rework the notion of CPU used in top. In particular, for subsequent displays after a pause, use the difference in runtime divided by the length of the pause as the percentage of CPU used instead of the value calculated by the kernel. In addition, when determing if a process or thread is idle or not, treat any process or thread that has used any runtime or performed any context switches during the interval as busy. Note that the percent CPU is calculated as a double and stored in an array to avoid recalculating the value multiple times in the comparison method used to sort processes in the CPU display. Tested by:Jamie Landeg-Jones ja...@dyslexicfish.net Reviewed by: emaste (earlier version) MFC after:1 week Modified: head/usr.bin/top/machine.c Modified: head/usr.bin/top/machine.c == --- head/usr.bin/top/machine.c Fri May 30 20:58:32 2014(r266905) +++ head/usr.bin/top/machine.c Fri May 30 21:18:53 2014(r266906) @@ -96,6 +96,7 @@ struct handle { #define RUTOT(pp) \ (RU(pp)-ru_inblock + RU(pp)-ru_oublock + RU(pp)-ru_majflt) +#definePCTCPU(pp) (pcpu[pp - pbase]) /* definitions for indices in the nlist array */ @@ -203,7 +204,14 @@ static struct kinfo_proc *previous_procs static struct kinfo_proc **previous_pref; static int previous_proc_count = 0; static int previous_proc_count_max = 0; -static int arc_enabled; +static int previous_thread; + +/* data used for recalculating pctcpu */ +static double *pcpu; +static struct timespec proc_uptime; +static struct timeval proc_wall_time; +static struct timeval previous_wall_time; +static uint64_t previous_interval = 0; /* total number of io operations */ static long total_inblock; @@ -212,6 +220,7 @@ static long total_majflt; /* these are for getting the memory statistics */ +static int arc_enabled; static int pageshift; /* log base 2 of the pagesize */ /* define pagetok in terms of pageshift */ @@ -329,6 +338,7 @@ machine_init(struct statics *statics, ch pbase = NULL; pref = NULL; + pcpu = NULL; nproc = 0; onproc = -1; @@ -650,6 +660,52 @@ get_io_stats(struct kinfo_proc *pp, long } /* + * If there was a previous update, use the delta in ki_runtime over + * the previous interval to calculate pctcpu. Otherwise, fall back + * to using the kernel's ki_pctcpu. + */ +static double +proc_calc_pctcpu(struct kinfo_proc *pp) +{ + const struct kinfo_proc *oldp; + + if (previous_interval != 0) { + oldp = get_old_proc(pp); + if (oldp != NULL) + return ((double)(pp-ki_runtime - oldp-ki_runtime) + / previous_interval); + + /* +* If this process/thread was created during the previous +* interval, charge it's total runtime to the previous +* interval. +*/ + else if (pp-ki_start.tv_sec previous_wall_time.tv_sec || + (pp-ki_start.tv_sec == previous_wall_time.tv_sec + pp-ki_start.tv_usec = previous_wall_time.tv_usec)) + return ((double)pp-ki_runtime / previous_interval); + } + return (pctdouble(pp-ki_pctcpu)); +} + +/* + * Return true if this process has used any CPU time since the + * previous update. + */ +static int +proc_used_cpu(struct kinfo_proc *pp) +{ + const struct kinfo_proc *oldp; + + oldp = get_old_proc(pp); + if (oldp == NULL) + return (PCTCPU(pp) != 0); + return (pp-ki_runtime != oldp-ki_runtime || + RU(pp)-ru_nvcsw != RU(oldp)-ru_nvcsw || + RU(pp)-ru_nivcsw != RU(oldp)-ru_nivcsw); +} + +/* * Return the total number of block in/out and faults by a process. */ long @@ -670,9 +726,11 @@ get_process_info(struct system_info *si, int total_procs; long p_io; long p_inblock, p_oublock, p_majflt, p_vcsw, p_ivcsw; + long nsec; int active_procs; struct kinfo_proc **prefp; struct kinfo_proc *pp; + struct timespec previous_proc_uptime; /* these are copied out of sel for speed */ int show_idle; @@ -684,6 +742,13 @@ get_process_info(struct system_info *si, int show_kidle; /* +* If thread state was toggled, don't cache the previous processes. +*/ + if (previous_thread != sel-thread) + nproc = 0; + previous_thread = sel-thread; + + /* * Save the previous process info. */ if (previous_proc_count_max nproc) { @@ -705,12 +770,32 @@ get_process_info(struct system_info *si, ps.thread ? compare_tid : compare_pid); }
svn commit: r266907 - head/sys/netinet
Author: bz Date: Fri May 30 22:34:06 2014 New Revision: 266907 URL: http://svnweb.freebsd.org/changeset/base/266907 Log: While PAWS is disabled, there are no consumers for the tcp options argument to tcp_twcheck(); thus mark it __unused. MFC after:2 weeks Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c == --- head/sys/netinet/tcp_timewait.c Fri May 30 21:18:53 2014 (r266906) +++ head/sys/netinet/tcp_timewait.c Fri May 30 22:34:06 2014 (r266907) @@ -363,7 +363,7 @@ tcp_twstart(struct tcpcb *tp) * looking for a pcb in the listen state. Returns 0 otherwise. */ int -tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, +tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr *th, struct mbuf *m, int tlen) { struct tcptw *tw; ___ 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: r266908 - head/sys/dev/cxgbe
Author: np Date: Fri May 30 22:59:45 2014 New Revision: 266908 URL: http://svnweb.freebsd.org/changeset/base/266908 Log: cxgbe(4): Fix a NULL dereference when the very first call to get_scatter_segment() in get_fl_payload() fails. While here, fix the code to adjust fl_bufs_used when a failure occurs for any other scatter segment. MFC after:3 days Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Fri May 30 22:34:06 2014(r266907) +++ head/sys/dev/cxgbe/t4_sge.c Fri May 30 22:59:45 2014(r266908) @@ -1628,6 +1628,7 @@ get_fl_payload(struct adapter *sc, struc nbuf = 0; len = G_RSPD_LEN(len_newbuf); if (__predict_false(fl-m0 != NULL)) { + M_ASSERTPKTHDR(fl-m0); MPASS(len == fl-m0-m_pkthdr.len); MPASS(fl-remaining len); @@ -1651,6 +1652,8 @@ get_fl_payload(struct adapter *sc, struc */ m0 = get_scatter_segment(sc, fl, len, M_PKTHDR); + if (m0 == NULL) + goto done; len -= m0-m_len; pnext = m0-m_next; while (len 0) { @@ -1662,7 +1665,8 @@ get_segment: fl-m0 = m0; fl-pnext = pnext; fl-remaining = len; - return (NULL); + m0 = NULL; + goto done; } *pnext = m; pnext = m-m_next; @@ -1671,7 +1675,7 @@ get_segment: *pnext = NULL; if (fl-rx_offset == 0) nbuf++; - +done: (*fl_bufs_used) += nbuf; return (m0); } ___ 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: r266775 - head/sys/x86/x86
On Fri, May 30, 2014 at 8:06 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 12:55:06 pm Attilio Rao wrote: On Fri, May 30, 2014 at 6:44 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:51:38 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:47 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 11:39:24 am Attilio Rao wrote: On Fri, May 30, 2014 at 5:03 PM, John Baldwin j...@freebsd.org wrote: On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: On Tue, May 27, 2014 at 11:31 PM, Scott Long sco...@freebsd.org wrote: Author: scottl Date: Tue May 27 21:31:11 2014 New Revision: 266775 URL: http://svnweb.freebsd.org/changeset/base/266775 Log: Eliminate the fake contig_dmamap and replace it with a new flag, BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag means that the map can be NULL again, which in turn enables significant optimizations for the common case of no bouncing. While I think this is in general a good idea, unfortunately our drivers do so many dumb things when freeing DMA allocated buffers that having a NULL map is going to cause some turbolence and make such bugs more visible. An example is with ATA, where I think this fix is needed: http://www.freebsd.org/~attilio/dmamem_free-ata.patch Otherwise, what can happen with bounce buffers, is that the allocated memory via contig malloc was not going to be freed anytime. I tried to look around and I found questionable (read broken) code in basically every driver which allocates DMA buffers, so I really don't feel I want to fix the majority of our drivers. I just think such paths are not excercised enough to be seen in practice often or the bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). Did you notice that I *removed* the destroy not *added*? Yes, my point was that that bug in the original code you are fixing was there regardless of Scott's change. And when I did say something different? I don't understand what's the point of your messages, besides showing that you didn't read correctly my patch. I read yours correctly but worded mine poorly. My point is that Scott's change does not introduce anything new. We've had NULL maps for static allocations for many, many years. It's only been recently that we've had more maps not be NULL for this. However, even if you discounted the whole NULL vs non-NULL maps thing, the driver in question that you are fixing was broken regardless. That is, due to the extra bus_dmamap_destroy() the driver was broken regardless of whether the map was NULL or non-NULL. To be honest, pre-266775 the kernel would actually panic for this specific driver, because we were going to free memory that was never allocated (by having a valid mapping but an invalid dma memory pointer). pre-239354 bus_dma would have used a NULL map just as it does now. And even some allocations during that window could still use a NULL map. The idea of a NULL map is not a new concept. Most maps from bus_dmamem_alloc() have been NULL for most of bus_dma's existence. That was prompted to look at the dma_alloc_*() bits of drivers. We need to make a real sweep at drivers on these bits. I did a start: http://p4web.freebsd.org/@@1194266?ac=10 I had converted if_alc.c, if_ale.c and e1000/ stuff before to give up. The first 2 looks good to me. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ 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: r266910 - head/sys/amd64/vmm/intel
Author: tychon Date: Fri May 30 23:37:31 2014 New Revision: 266910 URL: http://svnweb.freebsd.org/changeset/base/266910 Log: If VMX isn't enabled so long as the lock bit isn't set yet in MSR IA32_FEATURE_CONTROL it still can be. Approved by: grehan (co-mentor) Modified: head/sys/amd64/vmm/intel/vmx.c Modified: head/sys/amd64/vmm/intel/vmx.c == --- head/sys/amd64/vmm/intel/vmx.c Fri May 30 23:28:53 2014 (r266909) +++ head/sys/amd64/vmm/intel/vmx.c Fri May 30 23:37:31 2014 (r266910) @@ -512,6 +512,15 @@ static void vmx_enable(void *arg __unused) { int error; + uint64_t feature_control; + + feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL); + if ((feature_control IA32_FEATURE_CONTROL_LOCK) == 0 || + (feature_control IA32_FEATURE_CONTROL_VMX_EN) == 0) { + wrmsr(MSR_IA32_FEATURE_CONTROL, + feature_control | IA32_FEATURE_CONTROL_VMX_EN | + IA32_FEATURE_CONTROL_LOCK); + } load_cr4(rcr4() | CR4_VMXE); @@ -547,7 +556,7 @@ vmx_init(int ipinum) * are set (bits 0 and 2 respectively). */ feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL); - if ((feature_control IA32_FEATURE_CONTROL_LOCK) == 0 || + if ((feature_control IA32_FEATURE_CONTROL_LOCK) == 1 (feature_control IA32_FEATURE_CONTROL_VMX_EN) == 0) { printf(vmx_init: VMX operation disabled by BIOS\n); return (ENXIO); ___ 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: r266912 - head/usr.bin/printf/tests
Author: pfg Date: Sat May 31 00:54:21 2014 New Revision: 266912 URL: http://svnweb.freebsd.org/changeset/base/266912 Log: Fix m2 regression test. This is not really a good test as the behaviour for /c is unspecified. For the record, ksh93 returns: $ printf abc\n\cdef abc ef$ Discussed with: Garret D'Amore (Illumos) Modified: head/usr.bin/printf/tests/regress.m2.out Modified: head/usr.bin/printf/tests/regress.m2.out == --- head/usr.bin/printf/tests/regress.m2.outSat May 31 00:40:13 2014 (r266911) +++ head/usr.bin/printf/tests/regress.m2.outSat May 31 00:54:21 2014 (r266912) @@ -1 +1,2 @@ abc +cdef \ No newline at end of file ___ 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: r266915 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: delphij Date: Sat May 31 01:00:22 2014 New Revision: 266915 URL: http://svnweb.freebsd.org/changeset/base/266915 Log: MFV 266913+266914: 3897 zfs filesystem and snapshot limits (fix leak) 4901 zfs filesystem/snapshot limit leaks MFC after:3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Sat May 31 00:58:34 2014(r266914) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Sat May 31 01:00:22 2014(r266915) @@ -489,7 +489,7 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, zap_attribute_t *za; dsl_dataset_t *ds; - ASSERT(spa_feature_is_enabled(dp-dp_spa, SPA_FEATURE_FS_SS_LIMIT)); + ASSERT(spa_feature_is_active(dp-dp_spa, SPA_FEATURE_FS_SS_LIMIT)); ASSERT(dsl_pool_config_held(dp)); ASSERT(dmu_tx_is_syncing(tx)); @@ -549,6 +549,7 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, if (za-za_name[0] != '%') my_ss_cnt++; } + zap_cursor_fini(zc); dsl_dataset_rele(ds, FTAG); @@ -1717,7 +1718,7 @@ dsl_dir_rename_check(void *arg, dmu_tx_t } if (dmu_tx_is_syncing(tx)) { - if (spa_feature_is_enabled(dp-dp_spa, + if (spa_feature_is_active(dp-dp_spa, SPA_FEATURE_FS_SS_LIMIT)) { /* * Although this is the check function and we don't @@ -1745,8 +1746,11 @@ dsl_dir_rename_check(void *arg, dmu_tx_t err = zap_lookup(os, dd-dd_object, DD_FIELD_FILESYSTEM_COUNT, sizeof (fs_cnt), 1, fs_cnt); - if (err != ENOENT err != 0) + if (err != ENOENT err != 0) { + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); return (err); + } /* * have to add 1 for the filesystem itself that we're @@ -1757,8 +1761,11 @@ dsl_dir_rename_check(void *arg, dmu_tx_t err = zap_lookup(os, dd-dd_object, DD_FIELD_SNAPSHOT_COUNT, sizeof (ss_cnt), 1, ss_cnt); - if (err != ENOENT err != 0) + if (err != ENOENT err != 0) { + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); return (err); + } } /* no rename into our descendant */ @@ -1809,7 +1816,7 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t * We already made sure the dd counts were initialized in the * check function. */ - if (spa_feature_is_enabled(dp-dp_spa, + if (spa_feature_is_active(dp-dp_spa, SPA_FEATURE_FS_SS_LIMIT)) { VERIFY0(zap_lookup(os, dd-dd_object, DD_FIELD_FILESYSTEM_COUNT, sizeof (fs_cnt), 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: r266917 - in head: share/misc usr.bin/calendar/calendars
Author: pkelsey Date: Sat May 31 05:16:12 2014 New Revision: 266917 URL: http://svnweb.freebsd.org/changeset/base/266917 Log: - Added myself and mentor/mentee relationship to the src committers graph. - Added my info to the FreeBSD calendar. Approved by: jmallett (mentor) Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Sat May 31 01:44:11 2014 (r266916) +++ head/share/misc/committers-src.dot Sat May 31 05:16:12 2014 (r266917) @@ -241,6 +241,7 @@ philip [label=Philip Paeps\nphilip@Free phk [label=Poul-Henning Kamp\n...@freebsd.org\n1994/02/21] pho [label=Peter Holm\n...@freebsd.org\n2008/11/16] pjd [label=Pawel Jakub Dawidek\n...@freebsd.org\n2004/02/02] +pkelsey [label=Patrick Kelsey\pkel...@freebsd.org\n2014/05/29] pluknet [label=Sergey Kandaurov\npluk...@freebsd.org\n2010/10/05] ps [label=Paul Saab\n...@freebsd.org\n2000/02/23] qingli [label=Qing Li\nqin...@freebsd.org\n2005/04/13] @@ -509,6 +510,8 @@ jkoshy - rstone jlemon - bmilekic jlemon - brooks +jmallett - pkelsey + joerg - brian joerg - eik joerg - jmg Modified: head/usr.bin/calendar/calendars/calendar.freebsd == --- head/usr.bin/calendar/calendars/calendar.freebsdSat May 31 01:44:11 2014(r266916) +++ head/usr.bin/calendar/calendars/calendar.freebsdSat May 31 05:16:12 2014(r266917) @@ -143,6 +143,7 @@ 05/01 Randall Stewart r...@freebsd.org born in Spokane, Washington, United States, 1959 05/02 Wojciech A. Koszek wkos...@freebsd.org born in Czestochowa, Poland, 1987 05/03 Brian Dean b...@freebsd.org born in Elkins, West Virginia, United States, 1966 +05/03 Patrick Kelsey pkel...@freebsd.org born in Freehold, New Jersey, United States, 1976 05/03 Robert Nicholas Maxwell Watson rwat...@freebsd.org born in Harrow, Middlesex, United Kingdom, 1977 05/04 Denis Peplin d...@freebsd.org born in Nizhniy Novgorod, Russian Federation, 1977 05/08 Kirill Ponomarew kr...@freebsd.org born in Volgograd, Russian Federation, 1977 ___ 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