From owner-svn-src-projects@FreeBSD.ORG Mon Jan 26 05:56:31 2015 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 414BD384; Mon, 26 Jan 2015 05:56:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21154DE4; Mon, 26 Jan 2015 05:56:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0Q5uUKX035468; Mon, 26 Jan 2015 05:56:30 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0Q5uSXM035456; Mon, 26 Jan 2015 05:56:28 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201501260556.t0Q5uSXM035456@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 26 Jan 2015 05:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r277724 - in projects/building-blocks: sbin/ipfw sys/amd64/amd64 sys/arm/ti sys/arm/ti/am335x sys/dev/mps sys/kern X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2015 05:56:31 -0000 Author: ngie Date: Mon Jan 26 05:56:27 2015 New Revision: 277724 URL: https://svnweb.freebsd.org/changeset/base/277724 Log: MFhead @ r277723 Modified: projects/building-blocks/sbin/ipfw/nat.c projects/building-blocks/sys/amd64/amd64/machdep.c projects/building-blocks/sys/arm/ti/am335x/am335x_lcd.c projects/building-blocks/sys/arm/ti/am335x/files.am335x projects/building-blocks/sys/arm/ti/ti_i2c.c projects/building-blocks/sys/dev/mps/mps.c projects/building-blocks/sys/dev/mps/mps_user.c projects/building-blocks/sys/kern/kern_timeout.c projects/building-blocks/sys/kern/vfs_subr.c Directory Properties: projects/building-blocks/ (props changed) projects/building-blocks/sbin/ (props changed) projects/building-blocks/sbin/ipfw/ (props changed) projects/building-blocks/sys/ (props changed) Modified: projects/building-blocks/sbin/ipfw/nat.c ============================================================================== --- projects/building-blocks/sbin/ipfw/nat.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sbin/ipfw/nat.c Mon Jan 26 05:56:27 2015 (r277724) @@ -163,9 +163,9 @@ set_addr_dynamic(const char *ifn, struct } } if (sin == NULL) - errx(1, "%s: cannot get interface address", ifn); - - n->ip = sin->sin_addr; + n->ip.s_addr = htonl(INADDR_ANY); + else + n->ip = sin->sin_addr; strncpy(n->if_name, ifn, IF_NAMESIZE); free(buf); Modified: projects/building-blocks/sys/amd64/amd64/machdep.c ============================================================================== --- projects/building-blocks/sys/amd64/amd64/machdep.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/amd64/amd64/machdep.c Mon Jan 26 05:56:27 2015 (r277724) @@ -1557,6 +1557,8 @@ native_parse_memmap(caddr_t kmdp, vm_pad } } +#define PAGES_PER_GB (1024 * 1024 * 1024 / PAGE_SIZE) + /* * Populate the (physmap) array with base/bound pairs describing the * available physical memory in the system, then test this memory and @@ -1575,6 +1577,7 @@ getmemsize(caddr_t kmdp, u_int64_t first u_long physmem_start, physmem_tunable, memtest; pt_entry_t *pte; quad_t dcons_addr, dcons_size; + int page_counter; bzero(physmap, sizeof(physmap)); basemem = 0; @@ -1678,6 +1681,9 @@ getmemsize(caddr_t kmdp, u_int64_t first * physmap is in bytes, so when converting to page boundaries, * round up the start address and round down the end address. */ + page_counter = 0; + if (memtest != 0) + printf("Testing system memory"); for (i = 0; i <= physmap_idx; i += 2) { vm_paddr_t end; @@ -1708,6 +1714,14 @@ getmemsize(caddr_t kmdp, u_int64_t first goto skip_memtest; /* + * Print a "." every GB to show we're making + * progress. + */ + page_counter++; + if ((page_counter % PAGES_PER_GB) == 0) + printf("."); + + /* * map page into kernel: valid, read/write,non-cacheable */ *pte = pa | PG_V | PG_RW | PG_NC_PWT | PG_NC_PCD; @@ -1794,6 +1808,8 @@ do_next: } *pte = 0; invltlb(); + if (memtest != 0) + printf("\n"); /* * XXX Modified: projects/building-blocks/sys/arm/ti/am335x/am335x_lcd.c ============================================================================== --- projects/building-blocks/sys/arm/ti/am335x/am335x_lcd.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/arm/ti/am335x/am335x_lcd.c Mon Jan 26 05:56:27 2015 (r277724) @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_syscons.h" #include #include #include @@ -41,8 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include - -/* syscons bits */ #include #include @@ -54,7 +53,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DEV_SC #include +#else /* VT */ +#include +#endif #include #include @@ -62,6 +65,8 @@ __FBSDID("$FreeBSD$"); #include "am335x_lcd.h" #include "am335x_pwm.h" +#include "fb_if.h" + #define LCD_PID 0x00 #define LCD_CTRL 0x04 #define CTRL_DIV_MASK 0xff @@ -178,6 +183,7 @@ __FBSDID("$FreeBSD$"); struct am335x_lcd_softc { device_t sc_dev; + struct fb_info sc_fb_info; struct resource *sc_mem_res; struct resource *sc_irq_res; void *sc_intr_hl; @@ -410,7 +416,9 @@ done: static int am335x_lcd_probe(device_t dev) { +#ifdef DEV_SC int err; +#endif if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -420,10 +428,12 @@ am335x_lcd_probe(device_t dev) device_set_desc(dev, "AM335x LCD controller"); +#ifdef DEV_SC err = sc_probe_unit(device_get_unit(dev), device_get_flags(dev) | SC_AUTODETECT_KBD); if (err != 0) return (err); +#endif return (BUS_PROBE_DEFAULT); } @@ -670,6 +680,16 @@ am335x_lcd_attach(device_t dev) PWM_PERIOD, PWM_PERIOD) == 0) sc->sc_backlight = 100; + sc->sc_fb_info.fb_name = device_get_nameunit(sc->sc_dev); + sc->sc_fb_info.fb_vbase = (intptr_t)sc->sc_fb_base; + sc->sc_fb_info.fb_pbase = sc->sc_fb_phys; + sc->sc_fb_info.fb_size = sc->sc_fb_size; + sc->sc_fb_info.fb_bpp = sc->sc_fb_info.fb_depth = panel.bpp; + sc->sc_fb_info.fb_stride = panel.panel_width*panel.bpp / 8; + sc->sc_fb_info.fb_width = panel.panel_width; + sc->sc_fb_info.fb_height = panel.panel_height; + +#ifdef DEV_SC err = (sc_attach_unit(device_get_unit(dev), device_get_flags(dev) | SC_AUTODETECT_KBD)); @@ -679,6 +699,18 @@ am335x_lcd_attach(device_t dev) } am335x_lcd_syscons_setup((vm_offset_t)sc->sc_fb_base, sc->sc_fb_phys, &panel); +#else /* VT */ + device_t fbd = device_add_child(dev, "fbd", + device_get_unit(dev)); + if (fbd == NULL) { + device_printf(dev, "Failed to add fbd child\n"); + goto fail; + } + if (device_probe_and_attach(fbd) != 0) { + device_printf(dev, "Failed to attach fbd device\n"); + goto fail; + } +#endif return (0); @@ -693,16 +725,29 @@ am335x_lcd_detach(device_t dev) return (EBUSY); } +static struct fb_info * +am335x_lcd_fb_getinfo(device_t dev) +{ + struct am335x_lcd_softc *sc; + + sc = device_get_softc(dev); + + return (&sc->sc_fb_info); +} + static device_method_t am335x_lcd_methods[] = { DEVMETHOD(device_probe, am335x_lcd_probe), DEVMETHOD(device_attach, am335x_lcd_attach), DEVMETHOD(device_detach, am335x_lcd_detach), + /* Framebuffer service methods */ + DEVMETHOD(fb_getinfo, am335x_lcd_fb_getinfo), + DEVMETHOD_END }; static driver_t am335x_lcd_driver = { - "am335x_lcd", + "fb", am335x_lcd_methods, sizeof(struct am335x_lcd_softc), }; Modified: projects/building-blocks/sys/arm/ti/am335x/files.am335x ============================================================================== --- projects/building-blocks/sys/arm/ti/am335x/files.am335x Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/arm/ti/am335x/files.am335x Mon Jan 26 05:56:27 2015 (r277724) @@ -4,7 +4,7 @@ arm/ti/aintc.c standard arm/ti/am335x/am335x_dmtimer.c standard arm/ti/am335x/am335x_gpio.c optional gpio -arm/ti/am335x/am335x_lcd.c optional sc +arm/ti/am335x/am335x_lcd.c optional sc | vt arm/ti/am335x/am335x_lcd_syscons.c optional sc arm/ti/am335x/am335x_pmic.c optional am335x_pmic arm/ti/am335x/am335x_prcm.c standard Modified: projects/building-blocks/sys/arm/ti/ti_i2c.c ============================================================================== --- projects/building-blocks/sys/arm/ti/ti_i2c.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/arm/ti/ti_i2c.c Mon Jan 26 05:56:27 2015 (r277724) @@ -95,6 +95,7 @@ struct ti_i2c_softc int sc_buffer_pos; int sc_error; int sc_fifo_trsh; + int sc_timeout; uint16_t sc_con_reg; uint16_t sc_rev; @@ -442,7 +443,7 @@ ti_i2c_transfer(device_t dev, struct iic ti_i2c_write_2(sc, I2C_REG_CON, reg); /* Wait for an event. */ - err = mtx_sleep(sc, &sc->sc_mtx, 0, "i2ciowait", hz); + err = mtx_sleep(sc, &sc->sc_mtx, 0, "i2ciowait", sc->sc_timeout); if (err == 0) err = sc->sc_error; @@ -761,12 +762,10 @@ ti_i2c_deactivate(device_t dev) static int ti_i2c_sysctl_clk(SYSCTL_HANDLER_ARGS) { - device_t dev; int clk, psc, sclh, scll; struct ti_i2c_softc *sc; - dev = (device_t)arg1; - sc = device_get_softc(dev); + sc = arg1; TI_I2C_LOCK(sc); /* Get the system prescaler value. */ @@ -783,6 +782,34 @@ ti_i2c_sysctl_clk(SYSCTL_HANDLER_ARGS) } static int +ti_i2c_sysctl_timeout(SYSCTL_HANDLER_ARGS) +{ + struct ti_i2c_softc *sc; + unsigned int val; + int err; + + sc = arg1; + + /* + * MTX_DEF lock can't be held while doing uimove in + * sysctl_handle_int + */ + TI_I2C_LOCK(sc); + val = sc->sc_timeout; + TI_I2C_UNLOCK(sc); + + err = sysctl_handle_int(oidp, &val, 0, req); + /* Write request? */ + if ((err == 0) && (req->newptr != NULL)) { + TI_I2C_LOCK(sc); + sc->sc_timeout = val; + TI_I2C_UNLOCK(sc); + } + + return (err); +} + +static int ti_i2c_probe(device_t dev) { @@ -858,12 +885,19 @@ ti_i2c_attach(device_t dev) /* Set the FIFO threshold to 5 for now. */ sc->sc_fifo_trsh = 5; + /* Set I2C bus timeout */ + sc->sc_timeout = 5*hz; + ctx = device_get_sysctl_ctx(dev); tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "i2c_clock", - CTLFLAG_RD | CTLTYPE_UINT | CTLFLAG_MPSAFE, dev, 0, + CTLFLAG_RD | CTLTYPE_UINT | CTLFLAG_MPSAFE, sc, 0, ti_i2c_sysctl_clk, "IU", "I2C bus clock"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "i2c_timeout", + CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, sc, 0, + ti_i2c_sysctl_timeout, "IU", "I2C bus timeout (in ticks)"); + /* Activate the interrupt. */ err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ti_i2c_intr, sc, &sc->sc_irq_h); Modified: projects/building-blocks/sys/dev/mps/mps.c ============================================================================== --- projects/building-blocks/sys/dev/mps/mps.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/dev/mps/mps.c Mon Jan 26 05:56:27 2015 (r277724) @@ -2621,9 +2621,12 @@ mps_read_config_page(struct mps_softc *s cm->cm_data = params->buffer; cm->cm_length = params->length; - cm->cm_sge = &req->PageBufferSGE; - cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); - cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; + if (cm->cm_data != NULL) { + cm->cm_sge = &req->PageBufferSGE; + cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); + cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; + } else + cm->cm_sge = NULL; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_complete_data = params; @@ -2680,9 +2683,12 @@ mps_config_complete(struct mps_softc *sc goto done; } params->status = reply->IOCStatus; - if (params->hdr.Ext.ExtPageType != 0) { + if (params->hdr.Struct.PageType == MPI2_CONFIG_PAGETYPE_EXTENDED) { params->hdr.Ext.ExtPageType = reply->ExtPageType; params->hdr.Ext.ExtPageLength = reply->ExtPageLength; + params->hdr.Ext.PageType = reply->Header.PageType; + params->hdr.Ext.PageNumber = reply->Header.PageNumber; + params->hdr.Ext.PageVersion = reply->Header.PageVersion; } else { params->hdr.Struct.PageType = reply->Header.PageType; params->hdr.Struct.PageNumber = reply->Header.PageNumber; Modified: projects/building-blocks/sys/dev/mps/mps_user.c ============================================================================== --- projects/building-blocks/sys/dev/mps/mps_user.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/dev/mps/mps_user.c Mon Jan 26 05:56:27 2015 (r277724) @@ -309,6 +309,10 @@ mps_user_read_extcfg_header(struct mps_s hdr->PageNumber = ext_page_req->header.PageNumber; hdr->ExtPageType = ext_page_req->header.ExtPageType; params.page_address = le32toh(ext_page_req->page_address); + params.buffer = NULL; + params.length = 0; + params.callback = NULL; + if ((error = mps_read_config_page(sc, ¶ms)) != 0) { /* * Leave the request. Without resetting the chip, it's Modified: projects/building-blocks/sys/kern/kern_timeout.c ============================================================================== --- projects/building-blocks/sys/kern/kern_timeout.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/kern/kern_timeout.c Mon Jan 26 05:56:27 2015 (r277724) @@ -1096,6 +1096,10 @@ _callout_stop_safe(struct callout *c, in struct lock_class *class; int direct, sq_locked, use_lock; + if (safe) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, c->c_lock, + "calling %s", __func__); + /* * Some old subsystems don't hold Giant while running a callout_stop(), * so just discard this check for the moment. Modified: projects/building-blocks/sys/kern/vfs_subr.c ============================================================================== --- projects/building-blocks/sys/kern/vfs_subr.c Mon Jan 26 04:04:57 2015 (r277723) +++ projects/building-blocks/sys/kern/vfs_subr.c Mon Jan 26 05:56:27 2015 (r277724) @@ -632,7 +632,7 @@ vfs_getnewfsid(struct mount *mp) */ enum { TSP_SEC, TSP_HZ, TSP_USEC, TSP_NSEC }; -static int timestamp_precision = TSP_SEC; +static int timestamp_precision = TSP_USEC; SYSCTL_INT(_vfs, OID_AUTO, timestamp_precision, CTLFLAG_RW, ×tamp_precision, 0, "File timestamp precision (0: seconds, " "1: sec + ns accurate to 1/HZ, 2: sec + ns truncated to ms, "