svn commit: r297639 - head/sys/x86/xen
Author: sephe Date: Thu Apr 7 07:00:00 2016 New Revision: 297639 URL: https://svnweb.freebsd.org/changeset/base/297639 Log: xen: Set ipi_{alloc,free} even for UP This keeps XEN apic_ops aligned w/ x86's. Suggested by: kib, jhb Reviewed by: jhb, royger Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D5871 Modified: head/sys/x86/xen/xen_apic.c Modified: head/sys/x86/xen/xen_apic.c == --- head/sys/x86/xen/xen_apic.c Thu Apr 7 06:36:03 2016(r297638) +++ head/sys/x86/xen/xen_apic.c Thu Apr 7 07:00:00 2016(r297639) @@ -296,6 +296,7 @@ xen_pv_lapic_ipi_wait(int delay) XEN_APIC_UNSUPPORTED; return (0); } +#endif /* SMP */ static int xen_pv_lapic_ipi_alloc(inthand_t *ipifunc) @@ -311,7 +312,6 @@ xen_pv_lapic_ipi_free(int vector) XEN_APIC_UNSUPPORTED; } -#endif /* SMP */ static int xen_pv_lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked) @@ -372,9 +372,9 @@ struct apic_ops xen_apic_ops = { .ipi_raw= xen_pv_lapic_ipi_raw, .ipi_vectored = xen_pv_lapic_ipi_vectored, .ipi_wait = xen_pv_lapic_ipi_wait, +#endif .ipi_alloc = xen_pv_lapic_ipi_alloc, .ipi_free = xen_pv_lapic_ipi_free, -#endif .set_lvt_mask = xen_pv_lapic_set_lvt_mask, .set_lvt_mode = xen_pv_lapic_set_lvt_mode, .set_lvt_polarity = xen_pv_lapic_set_lvt_polarity, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297641 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Apr 7 07:12:57 2016 New Revision: 297641 URL: https://svnweb.freebsd.org/changeset/base/297641 Log: hyperv: Use lapic_{alloc,free}_ipi to allocate private interrupt vector Suggested by: jhb Reviewed by: Dexuan Cui , Jun Su Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D5850 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c == --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cThu Apr 7 07:12:14 2016(r297640) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cThu Apr 7 07:12:57 2016(r297641) @@ -391,80 +391,9 @@ vmbus_probe(device_t dev) { } #ifdef HYPERV -extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback); - -/** - * @brief Find a free IDT slot and setup the interrupt handler. - */ -static int -vmbus_vector_alloc(void) -{ - int vector; - uintptr_t func; - struct gate_descriptor *ip; - - /* -* Search backwards form the highest IDT vector available for use -* as vmbus channel callback vector. We install 'hv_vmbus_callback' -* handler at that vector and use it to interrupt vcpus. -*/ - vector = APIC_SPURIOUS_INT; - while (--vector >= APIC_IPI_INTS) { - ip = &idt[vector]; - func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); - if (func == (uintptr_t)&IDTVEC(rsvd)) { -#ifdef __i386__ - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYS386IGT, - SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); -#else - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYSIGT, - SEL_KPL, 0); +extern inthand_t IDTVEC(hv_vmbus_callback); #endif - return (vector); - } - } - return (0); -} - -/** - * @brief Restore the IDT slot to rsvd. - */ -static void -vmbus_vector_free(int vector) -{ -uintptr_t func; -struct gate_descriptor *ip; - - if (vector == 0) - return; - -KASSERT(vector >= APIC_IPI_INTS && vector < APIC_SPURIOUS_INT, -("invalid vector %d", vector)); - -ip = &idt[vector]; -func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); -KASSERT(func == (uintptr_t)&IDTVEC(hv_vmbus_callback), -("invalid vector %d", vector)); - -setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0); -} - -#else /* HYPERV */ - -static int -vmbus_vector_alloc(void) -{ - return(0); -} - -static void -vmbus_vector_free(int vector) -{ -} - -#endif /* HYPERV */ - /** * @brief Main vmbus driver initialization routine. * @@ -497,12 +426,15 @@ vmbus_bus_init(void) return (ret); } +#ifdef HYPERV /* * Find a free IDT slot for vmbus callback. */ - hv_vmbus_g_context.hv_cb_vector = vmbus_vector_alloc(); - - if (hv_vmbus_g_context.hv_cb_vector == 0) { + hv_vmbus_g_context.hv_cb_vector = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); +#else + hv_vmbus_g_context.hv_cb_vector = -1; +#endif + if (hv_vmbus_g_context.hv_cb_vector < 0) { if(bootverbose) printf("Error VMBUS: Cannot find free IDT slot for " "vmbus callback!\n"); @@ -595,7 +527,7 @@ vmbus_bus_init(void) } } - vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); cleanup: hv_vmbus_cleanup(); @@ -663,7 +595,7 @@ vmbus_bus_exit(void) } } - vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); return; } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h == --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Apr 7 07:12:14 2016 (r297640) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Apr 7 07:12:57 2016 (r297641) @@ -208,10 +208,10 @@ typedef struct { struct taskqueue*hv_msg_tq[MAXCPU]; struct task hv_msg_task[MAXCPU]; /* -* Host use this vector to intrrupt guest for vmbus channel +* Host use this vector to interrupt guest for vmbus channel * event and msg. */ - unsigned inthv_cb_vector; + int hv_cb_vector; } hv_vmbus_context; /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297646 - head/sys/dev/rt
Author: sgalabov Date: Thu Apr 7 07:22:22 2016 New Revision: 297646 URL: https://svnweb.freebsd.org/changeset/base/297646 Log: This revision adds support to if_rt for more SoCs. The SoCs I've tried the driver with include the following: RT3050, RT5350, RT3662, RT3883, MT7620, MT7621, MT7688. On boards, based on the above SoCs traffic is passing through correctly and the boards survive a flood ping with very little or no drops (drops may be caused elsewhere in my test setup, however). One issue still remains and needs to be fixed in the future: if_rt does not survive an ifconfig rt0 down/ifconfig rt0 up cycle. This issue existed before this commit as well, however. Reviewed by: ray Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5864 Modified: head/sys/dev/rt/if_rt.c head/sys/dev/rt/if_rtvar.h Modified: head/sys/dev/rt/if_rt.c == --- head/sys/dev/rt/if_rt.c Thu Apr 7 07:21:27 2016(r297645) +++ head/sys/dev/rt/if_rt.c Thu Apr 7 07:22:22 2016(r297646) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015, Stanislav Galabov + * Copyright (c) 2015-2016, Stanislav Galabov * Copyright (c) 2014, Aleksandr A. Mityaev * Copyright (c) 2011, Aleksandr Rybalko * based on hard work @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -69,8 +70,10 @@ __FBSDID("$FreeBSD$"); #include #include +#if 0 #include #include +#endif #ifdef IF_RT_PHY_SUPPORT #include "miibus_if.h" @@ -89,19 +92,20 @@ __FBSDID("$FreeBSD$"); #defineRT_TX_WATCHDOG_TIMEOUT 5 #define RT_CHIPID_RT3050 0x3050 -#define RT_CHIPID_RT3052 0x3052 #define RT_CHIPID_RT5350 0x5350 -#define RT_CHIPID_RT6855 0x6855 #define RT_CHIPID_MT7620 0x7620 +#define RT_CHIPID_MT7621 0x7621 #ifdef FDT /* more specific and new models should go first */ static const struct ofw_compat_data rt_compat_data[] = { - { "ralink,rt6855-eth", (uintptr_t)RT_CHIPID_RT6855 }, - { "ralink,rt5350-eth", (uintptr_t)RT_CHIPID_RT5350 }, - { "ralink,rt3052-eth", (uintptr_t)RT_CHIPID_RT3052 }, - { "ralink,rt305x-eth", (uintptr_t)RT_CHIPID_RT3050 }, - { NULL, (uintptr_t)NULL } + { "ralink,rt3050-eth", RT_CHIPID_RT3050 }, + { "ralink,rt3352-eth", RT_CHIPID_RT3050 }, + { "ralink,rt3883-eth", RT_CHIPID_RT3050 }, + { "ralink,rt5350-eth", RT_CHIPID_RT5350 }, + { "ralink,mt7620a-eth", RT_CHIPID_MT7620 }, + { "ralink,mt7621-eth", RT_CHIPID_MT7621 }, + { NULL, 0 } }; #endif @@ -182,21 +186,23 @@ rt_probe(device_t dev) const struct ofw_compat_data * cd; cd = ofw_bus_search_compatible(dev, rt_compat_data); - if (cd->ocd_data == (uintptr_t)NULL) + if (cd->ocd_data == 0) return (ENXIO); sc->rt_chipid = (unsigned int)(cd->ocd_data); #else #if defined(MT7620) sc->rt_chipid = RT_CHIPID_MT7620; +#elif defined(MT7621) + sc->rt_chipid = RT_CHIPID_MT7621; #elif defined(RT5350) sc->rt_chipid = RT_CHIPID_RT5350; #else sc->rt_chipid = RT_CHIPID_RT3050; #endif #endif - snprintf(buf, sizeof(buf), "Ralink RT%x onChip Ethernet driver", - sc->rt_chipid); + snprintf(buf, sizeof(buf), "Ralink %cT%x onChip Ethernet driver", + sc->rt_chipid >= 0x7600 ? 'M' : 'R', sc->rt_chipid); device_set_desc_copy(dev, buf); return (BUS_PROBE_GENERIC); } @@ -373,12 +379,26 @@ rt_attach(device_t dev) /* Reset hardware */ reset_freng(sc); + + + if (sc->rt_chipid == RT_CHIPID_MT7620) { + sc->csum_fail_ip = MT7620_RXD_SRC_IP_CSUM_FAIL; + sc->csum_fail_l4 = MT7620_RXD_SRC_L4_CSUM_FAIL; + } else if (sc->rt_chipid == RT_CHIPID_MT7621) { + sc->csum_fail_ip = MT7621_RXD_SRC_IP_CSUM_FAIL; + sc->csum_fail_l4 = MT7621_RXD_SRC_L4_CSUM_FAIL; + } else { + sc->csum_fail_ip = RT305X_RXD_SRC_IP_CSUM_FAIL; + sc->csum_fail_l4 = RT305X_RXD_SRC_L4_CSUM_FAIL; + } /* Fill in soc-specific registers map */ switch(sc->rt_chipid) { case RT_CHIPID_MT7620: + case RT_CHIPID_MT7621: case RT_CHIPID_RT5350: - device_printf(dev, "RT%x Ethernet MAC (rev 0x%08x)\n", + device_printf(dev, "%cT%x Ethernet MAC (rev 0x%08x)\n", + sc->rt_chipid >= 0x7600 ? 'M' : 'R', sc->rt_chipid, sc->mac_rev); /* RT5350: No GDMA, PSE, CDMA, PPE */ RT_WRITE(sc, GE_PORT_BASE + 0x0C00, // UDPCS, TCPCS, IPCS=1 @@ -406,10 +426,6 @@ rt_attach(device_t dev) sc->int_rx_done_mask=RT5350_INT_RXQ0_DONE; sc->int_tx_done_mask=RT5350
svn commit: r297662 - head/sys/netinet
Author: rrs Date: Thu Apr 7 09:10:34 2016 New Revision: 297662 URL: https://svnweb.freebsd.org/changeset/base/297662 Log: This is work done by Michael Tuexen and myself at the IETF. This adds the new I-Data (Interleaved Data) message. This allows a user to be able to have complete freedom from Head Of Line blocking that was previously there due to the in-ability to send multiple large messages without the TSN's being in sequence. The code as been tested with Michaels various packet drill scripts as well as inter-networking between the IETF's location in Argentina and Germany. Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_dtrace_define.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Thu Apr 7 08:32:37 2016(r297661) +++ head/sys/netinet/sctp.h Thu Apr 7 09:10:34 2016(r297662) @@ -196,6 +196,9 @@ struct sctp_paramhdr { #define SCTP_SS_VALUE 0x1204 #define SCTP_CC_OPTION 0x1205 /* Options for CC * modules */ +/* For I-DATA */ +#define SCTP_INTERLEAVING_SUPPORTED0x1206 + /* read only */ #define SCTP_GET_SNDBUF_USE0x1101 #define SCTP_GET_STAT_LOG 0x1103 @@ -452,6 +455,7 @@ struct sctp_error_auth_invalid_hmac { /* EY nr_sack chunk id*/ #define SCTP_NR_SELECTIVE_ACK 0x10 /0x40 series ***/ +#define SCTP_IDATA 0x40 /0x80 series ***/ /* RFC5061 */ #defineSCTP_ASCONF_ACK 0x80 @@ -467,7 +471,7 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_FORWARD_CUM_TSN 0xc0 /* RFC5061 */ #define SCTP_ASCONF0xc1 - +#define SCTP_IFORWARD_CUM_TSN 0xc2 /* ABORT and SHUTDOWN COMPLETE FLAG */ #define SCTP_HAD_NO_TCB0x01 Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_constants.h Thu Apr 7 09:10:34 2016 (r297662) @@ -386,8 +386,8 @@ __FBSDID("$FreeBSD$"); /* align to 32-bit sizes */ #define SCTP_SIZE32(x) x) + 3) >> 2) << 2) -#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA) -#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA) +#define IS_SCTP_CONTROL(a) (((a)->chunk_type != SCTP_DATA) && ((a)->chunk_type != SCTP_IDATA)) +#define IS_SCTP_DATA(a) (((a)->chunk_type == SCTP_DATA) || ((a)->chunk_type == SCTP_IDATA)) /* SCTP parameter types */ @@ -886,12 +886,19 @@ __FBSDID("$FreeBSD$"); /* modular comparison */ /* See RFC 1982 for details. */ -#define SCTP_SSN_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ - ((a > b) && ((uint16_t)(a - b) < (1U<<15 -#define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b)) -#define SCTP_TSN_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ - ((a > b) && ((uint32_t)(a - b) < (1U<<31 -#define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b)) +#define SCTP_UINT16_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ + ((a > b) && ((uint16_t)(a - b) < (1U<<15 +#define SCTP_UINT16_GE(a, b) (SCTP_UINT16_GT(a, b) || (a == b)) +#define SCTP_UINT32_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ + ((a > b) && ((uint32_t)(a - b) < (1U<<31 +#define SCTP_UINT32_GE(a, b) (SCTP_UINT32_GT(a, b) || (a == b)) + +#define SCTP_SSN_GT(a, b) SCTP_UINT16_GT(a, b) +#define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b) +#define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) +#define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) +#define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GT(a, b)) +#define SCTP_MSGID_GE(o, a, b) ((o == 1) ? SCTP_UINT16_GE((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GE(a, b)) /* Mapping array manipulation routines */ #define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) Modified: head/sys/netinet/sctp_dtrace_define.h == --- head/sys/netinet/sctp_dtrace_define.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_dtrace_define.h Thu Apr 7 09:10:34 2016
svn commit: r297663 - head/sys/netinet
Author: rrs Date: Thu Apr 7 09:34:41 2016 New Revision: 297663 URL: https://svnweb.freebsd.org/changeset/base/297663 Log: A couple of minor changes that I missed that Michael had done, most noted in these is the change to non-strict ordering for incoming data (this will make pkt-drill test 14 fail but its expected). Modified: head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_indata.h == --- head/sys/netinet/sctp_indata.h Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_indata.h Thu Apr 7 09:34:41 2016 (r297663) @@ -53,7 +53,7 @@ sctp_build_readq_entry(struct sctp_tcb * memset(_ctl, 0, sizeof(struct sctp_queued_to_read)); \ (_ctl)->sinfo_stream = stream_no; \ (_ctl)->sinfo_ssn = stream_seq; \ - TAILQ_INIT(&_ctl->reasm); \ + TAILQ_INIT(&_ctl->reasm); \ (_ctl)->top_fsn = tfsn; \ (_ctl)->msg_id = msgid; \ (_ctl)->sinfo_flags = (flags << 8); \ Modified: head/sys/netinet/sctp_os_bsd.h == --- head/sys/netinet/sctp_os_bsd.h Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_os_bsd.h Thu Apr 7 09:34:41 2016 (r297663) @@ -480,9 +480,9 @@ sctp_get_mbuf_for_msg(unsigned int space #define SCTP_SAVE_ATOMIC_DECREMENT(addr, val) \ { \ int32_t oldval; \ - oldval = atomic_fetchadd_int(addr, -val); \ + oldval = atomic_fetchadd_int(addr, -val); \ if (oldval < val) { \ - panic("Counter goes negative addr:%p val:%d oldval:%d", addr, val, oldval); \ + panic("Counter goes negative"); \ } \ } #else Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_output.c Thu Apr 7 09:34:41 2016 (r297663) @@ -10499,6 +10499,7 @@ sctp_fill_in_rest: strseq++; } else { strseq_m->stream = ntohs(at->rec.data.stream_number); + strseq_m->reserved = ntohs(0); strseq_m->msg_id = ntohl(at->rec.data.stream_seq); strseq_m++; } Modified: head/sys/netinet/sctp_sysctl.h == --- head/sys/netinet/sctp_sysctl.h Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_sysctl.h Thu Apr 7 09:34:41 2016 (r297663) @@ -432,7 +432,7 @@ struct sctp_sysctl { #define SCTPCTL_STRICT_DATA_ORDER_DESC "Enforce strict data ordering, abort if control inside data" #define SCTPCTL_STRICT_DATA_ORDER_MIN 0 #define SCTPCTL_STRICT_DATA_ORDER_MAX 1 -#define SCTPCTL_STRICT_DATA_ORDER_DEFAULT 1 +#define SCTPCTL_STRICT_DATA_ORDER_DEFAULT 0 /* min_residual: min residual in a data fragment leftover */ #define SCTPCTL_MIN_RESIDUAL_DESC "Minimum residual data chunk in second part of split" Modified: head/sys/netinet/sctp_var.h == --- head/sys/netinet/sctp_var.h Thu Apr 7 09:10:34 2016(r297662) +++ head/sys/netinet/sctp_var.h Thu Apr 7 09:34:41 2016(r297663) @@ -99,8 +99,8 @@ extern struct pr_usrreqs sctp_usrreqs; */ #ifdef INVARIANTS #define sctp_free_a_readq(_stcb, _readq) { \ - if ((_readq)->on_strm_q)\ - panic("On strm q stcb:%p readq:%p", (_stcb), (_readq)); \ + if ((_readq)->on_strm_q) \ + panic("On strm q stcb:%p readq:%p", (_stcb), (_readq)); \ SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \ SCTP_DECR_READQ_COUNT(); \ } @@ -204,7 +204,7 @@ extern struct pr_usrreqs sctp_usrreqs; } #define sctp_sbfree(ctl, stcb, sb, m) { \ - SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m)));\ + SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ if (((ctl)->do_not_ref_stcb == 0) && stcb) {\ SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Thu Apr 7 09:10:34 2016(r297662) +++ head/sys/netinet/sctputil.c Thu Apr 7 09:34:41 2016(r297663) @@ -6100,7 +6100,7 @@ wait_some_m
svn commit: r297664 - head/sys/arm64/arm64
Author: zbb Date: Thu Apr 7 10:36:50 2016 New Revision: 297664 URL: https://svnweb.freebsd.org/changeset/base/297664 Log: Fix interrupts delivery on ThunderX for VF IDs beyond 8 SR-IOV devices usually use Alternative Routing ID (ARI). In that case slot/device is always assumed to be 0 and function/identifier is extended to 8 bits. Fix interrupts delivery to VF IDs beyond 8 by using a correct DevID if ARI is enabled. Reviewed by: jhb, wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5855 Modified: head/sys/arm64/arm64/gic_v3_its.c Modified: head/sys/arm64/arm64/gic_v3_its.c == --- head/sys/arm64/arm64/gic_v3_its.c Thu Apr 7 09:34:41 2016 (r297663) +++ head/sys/arm64/arm64/gic_v3_its.c Thu Apr 7 10:36:50 2016 (r297664) @@ -1579,9 +1579,7 @@ its_get_devid_thunder(device_t pci_dev) uint32_t bus; bus = pci_get_bus(pci_dev); - - bsf = PCI_RID(pci_get_bus(pci_dev), pci_get_slot(pci_dev), - pci_get_function(pci_dev)); + bsf = pci_get_rid(pci_dev); /* Check if accessing internal PCIe (low bus numbers) */ if (bus < GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297665 - head/sys/mips/mips
Author: sgalabov Date: Thu Apr 7 10:48:26 2016 New Revision: 297665 URL: https://svnweb.freebsd.org/changeset/base/297665 Log: Bring MIPS INTRNG support back up again, in line with D5370 Reviewed by: kan Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5838 Modified: head/sys/mips/mips/mips_pic.c head/sys/mips/mips/nexus.c Modified: head/sys/mips/mips/mips_pic.c == --- head/sys/mips/mips/mips_pic.c Thu Apr 7 10:36:50 2016 (r297664) +++ head/sys/mips/mips/mips_pic.c Thu Apr 7 10:48:26 2016 (r297665) @@ -71,15 +71,24 @@ __FBSDID("$FreeBSD$"); static int mips_pic_intr(void *); +struct mips_pic_irqsrc { + struct intr_irqsrc isrc; + struct resource *res; + u_int irq; +}; + struct mips_pic_softc { - device_tpic_dev; - struct intr_irqsrc *pic_irqs[NREAL_IRQS]; - struct mtx mutex; - uint32_tnirqs; + device_tpic_dev; + struct mips_pic_irqsrc pic_irqs[NREAL_IRQS]; + struct rman pic_irq_rman; + struct mtx mutex; + uint32_tnirqs; }; static struct mips_pic_softc *pic_sc; +#define PIC_INTR_ISRC(sc, irq) (&(sc)->pic_irqs[(irq)].isrc) + #ifdef FDT static struct ofw_compat_data compat_data[] = { {"mti,cpu-interrupt-controller",true}, @@ -143,6 +152,39 @@ pic_xref(device_t dev) } static int +mips_pic_register_isrcs(struct mips_pic_softc *sc) +{ + int error; + uint32_t irq, i; + struct intr_irqsrc *isrc; + const char *name; + + name = device_get_nameunit(sc->pic_dev); + for (irq = 0; irq < sc->nirqs; irq++) { + sc->pic_irqs[irq].irq = irq; + sc->pic_irqs[irq].res = rman_reserve_resource(&sc->pic_irq_rman, + irq, irq, 1, RF_ACTIVE, sc->pic_dev); + if (sc->pic_irqs[irq].res == NULL) { + device_printf(sc->pic_dev, + "%s failed to alloc resource for irq %d", + __func__, irq); + return (ENOMEM); + } + isrc = PIC_INTR_ISRC(sc, irq); + error = intr_isrc_register(isrc, sc->pic_dev, 0, "%s", name); + if (error != 0) { + for (i = 0; i < irq; i++) { + intr_isrc_deregister(PIC_INTR_ISRC(sc, i)); + } + device_printf(sc->pic_dev, "%s failed", __func__); + return (error); + } + } + + return (0); +} + +static int mips_pic_attach(device_t dev) { struct mips_pic_softc *sc; @@ -162,6 +204,21 @@ mips_pic_attach(device_t dev) /* Set the number of interrupts */ sc->nirqs = nitems(sc->pic_irqs); + /* Init the IRQ rman */ + sc->pic_irq_rman.rm_type = RMAN_ARRAY; + sc->pic_irq_rman.rm_descr = "MIPS PIC IRQs"; + if (rman_init(&sc->pic_irq_rman) != 0 || + rman_manage_region(&sc->pic_irq_rman, 0, sc->nirqs - 1) != 0) { + device_printf(dev, "failed to setup IRQ rman\n"); + goto cleanup; + } + + /* Register the interrupts */ + if (mips_pic_register_isrcs(sc) != 0) { + device_printf(dev, "could not register PIC ISRCs\n"); + goto cleanup; + } + /* * Now, when everything is initialized, it's right time to * register interrupt controller to interrupt framefork. @@ -174,7 +231,7 @@ mips_pic_attach(device_t dev) /* Claim our root controller role */ if (intr_pic_claim_root(dev, xref, mips_pic_intr, sc, 0) != 0) { device_printf(dev, "could not set PIC as a root\n"); - intr_pic_unregister(dev, xref); + intr_pic_deregister(dev, xref); goto cleanup; } @@ -189,7 +246,6 @@ mips_pic_intr(void *arg) { struct mips_pic_softc *sc = arg; register_t cause, status; - struct intr_irqsrc *isrc; int i, intr; cause = mips_rd_cause(); @@ -205,15 +261,13 @@ mips_pic_intr(void *arg) i--; /* Get a 0-offset interrupt. */ intr &= ~(1 << i); - isrc = sc->pic_irqs[i]; - if (isrc == NULL) { + if (intr_isrc_dispatch(PIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { device_printf(sc->pic_dev, "Stray interrupt %u detected\n", i); pic_irq_mask(sc, i); continue; } - - intr_irq_dispatch(isrc, cur
svn commit: r297666 - head/sys/mips/mediatek
Author: sgalabov Date: Thu Apr 7 11:02:49 2016 New Revision: 297666 URL: https://svnweb.freebsd.org/changeset/base/297666 Log: This revision adds the following parts: - machine dependent low level init code - SoC clocks detection and some utility functions - Common interface to read/write/modify SoC system control registers, used by some of the other drivers and utility functions - simple FDT resets support, based on the fdt_clock implementation already in the tree. For the moment resets and clocks are managed using these implementations. I am planning to port those to the new extres framework in the future, but currently I simply don't have time to do this part too. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5826 Added: head/sys/mips/mediatek/ head/sys/mips/mediatek/fdt_reset.c (contents, props changed) head/sys/mips/mediatek/fdt_reset.h (contents, props changed) head/sys/mips/mediatek/fdt_reset_if.m (contents, props changed) head/sys/mips/mediatek/mtk_machdep.c (contents, props changed) head/sys/mips/mediatek/mtk_soc.c (contents, props changed) head/sys/mips/mediatek/mtk_soc.h (contents, props changed) head/sys/mips/mediatek/mtk_sysctl.c (contents, props changed) head/sys/mips/mediatek/mtk_sysctl.h (contents, props changed) Added: head/sys/mips/mediatek/fdt_reset.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/fdt_reset.c Thu Apr 7 11:02:49 2016 (r297666) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * Copyright (c) 2014 Ian Lepore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "fdt_reset_if.h" +#include + +/* + * Loop through all the tuples in the resets= property for a device, asserting + * or deasserting each reset. + * + * Be liberal about errors for now: warn about a failure to (de)assert but keep + * trying with any other resets in the list. Return ENXIO if any errors were + * found, and let the caller decide whether the problem is fatal. + */ +static int +assert_deassert_all(device_t consumer, boolean_t assert) +{ + phandle_t rnode; + device_t resetdev; + int resetnum, err, i, ncells; + uint32_t *resets; + boolean_t anyerrors; + + rnode = ofw_bus_get_node(consumer); + ncells = OF_getencprop_alloc(rnode, "resets", sizeof(*resets), + (void **)&resets); + if (!assert && ncells < 2) { + device_printf(consumer, "Warning: No resets specified in fdt " + "data; device may not function."); + return (ENXIO); + } + anyerrors = false; + for (i = 0; i < ncells; i += 2) { + resetdev = OF_device_from_xref(resets[i]); + resetnum = resets[i + 1]; + if (resetdev == NULL) { + if (!assert) + device_printf(consumer, "Warning: can not find " + "driver for reset number %u; device may " + "not function\n", resetnum); + anyerrors = true; + continue; + } + if (assert) + err = FDT_RESET_ASSERT(resetdev, resetnum); + else + err = FDT_RESET_DEASSERT(resetdev, resetnum); + if (err != 0) { +
svn commit: r297667 - head/sys/mips/mediatek
Author: sgalabov Date: Thu Apr 7 11:08:50 2016 New Revision: 297667 URL: https://svnweb.freebsd.org/changeset/base/297667 Log: Initial import of Ralink/Mediatek MIPS SoC support #2 This revision adds the following to the Mediatek/Ralink support: - initial support for "clocks" FDT property, currently based on fdt_clock - initial support for "resets" FDT property, currently based on the fdt_reset interface from D5826 - initial support for "pinctrl,bits" functionality via FDT. May be extended in the future to cover a better and fuller pinctrl implementation Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5827 Added: head/sys/mips/mediatek/mtk_clock.c (contents, props changed) head/sys/mips/mediatek/mtk_pinctrl.c (contents, props changed) head/sys/mips/mediatek/mtk_reset.c (contents, props changed) Added: head/sys/mips/mediatek/mtk_clock.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_clock.c Thu Apr 7 11:08:50 2016 (r297667) @@ -0,0 +1,156 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions, and the following disclaimer, + *without modification, immediately at the beginning of the file. + * 2. The name of the author may not be used to endorse or promote products + *derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "fdt_clock_if.h" + +static const struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-clock",1 }, + + /* Sentinel */ + { NULL, 0 } +}; + +static int +mtk_clock_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "MTK Clock Controller"); + + return (0); +} + +static int +mtk_clock_attach(device_t dev) +{ + + if (device_get_unit(dev) != 0) { + device_printf(dev, "Only one clock control allowed\n"); + return (ENXIO); + } + + fdt_clock_register_provider(dev); + + return (0); +} + +#define CLOCK_ENABLE 1 +#define CLOCK_DISABLE 0 + +static int +mtk_clock_set(device_t dev, int index, int value) +{ + uint32_t mask; + + /* Clock config register holds 32 clock gating bits */ + if (index < 0 || index > 31) + return (EINVAL); + + mask = (1u << index); + + if (value == CLOCK_ENABLE) + mtk_sysctl_clr_set(SYSCTL_CLKCFG1, 0, mask); + else + mtk_sysctl_clr_set(SYSCTL_CLKCFG1, mask, 0); + + return (0); +} + +static int +mtk_clock_enable(device_t dev, int index) +{ + + return mtk_clock_set(dev, index, CLOCK_ENABLE); +} + +static int +mtk_clock_disable(device_t dev, int index) +{ + + return mtk_clock_set(dev, index, CLOCK_DISABLE); +} + +static int +mtk_clock_get_info(device_t dev, int index, struct fdt_clock_info *info) +{ + uint32_t mask; + + if (index < 0 || index > 31 || info == NULL) + return (EINVAL); + + if (mtk_sysctl_get(SYSCTL_CLKCFG1) & mask) + info->flags = FDT_CIFLAG_RUNNING; + else + info->flags = 0; + + return (0); +} + +static device_method_t mtk_clock_methods[] = { + DEVMETHOD(device_probe, mtk_clock_probe), + DEVMETHOD(device_attach,mtk_clock_attach), + + /* fdt_clock interface */ + DEVMETHOD(fdt_clock_enable, mtk_clock_enable), + DEVMETHOD(fdt_clock_disable,mtk_clock_disab
svn commit: r297668 - head/sys/mips/mediatek
Author: sgalabov Date: Thu Apr 7 11:12:37 2016 New Revision: 297668 URL: https://svnweb.freebsd.org/changeset/base/297668 Log: Initial import of Ralink/Mediatek MIPS SoC support #3 Interrupt controllers found in various Mediatek/Ralink SoCs. mtk_intr_v1 and mtk_intr_v2 are basically the same at the moment, with just different register mappings. However, v1 interrupt controller has a subset of the functionality of the v2 interrupt controller, so in the future the v2 interrupt controller driver may be enhanced, if needed, with things like level/edge interrupts and soft interrupts. So, for the moment I suggest we keep them as 2 separate files. mtk_intr_gic provides very basic (similar to v1 and v2) support for MIPS GIC controllers, which currently maps all interrupts to a single core and sets them to type level, active high. In the future this may be developed into a generic GIC controller to support any new MIPS SoCs that include it. The GIC is a standard MTI interrupt controller in their multi-core line-up (e.g., 1004K, 1074K, etc.), rather than a SoC-specific controller. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5839 Added: head/sys/mips/mediatek/mtk_intr_gic.c (contents, props changed) head/sys/mips/mediatek/mtk_intr_v1.c (contents, props changed) head/sys/mips/mediatek/mtk_intr_v2.c (contents, props changed) Added: head/sys/mips/mediatek/mtk_intr_gic.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_intr_gic.c Thu Apr 7 11:12:37 2016 (r297668) @@ -0,0 +1,377 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * Copyright (c) 2015 Alexander Kabaev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions, and the following disclaimer, + *without modification, immediately at the beginning of the file. + * 2. The name of the author may not be used to endorse or promote products + *derived from this software without specific prior written permission. + * + * 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "pic_if.h" + +#defineMTK_NIRQS 64 /* We'll only use 64 for now */ + +#define MTK_INTPOL 0x0100 +#define MTK_INTTRIG0x0180 +#define MTK_INTDIS 0x0300 +#define MTK_INTENA 0x0380 +#define MTK_INTMASK0x0400 +#define MTK_INTSTAT0x0480 +#define MTK_MAPPIN(_i) (0x0500 + (4 * (_i))) +#define MTK_MAPVPE(_i, _v) (0x2000 + (32 * (_i)) + (((_v) / 32) * 4)) + +#define MTK_INTPOL_POS 1 +#define MTK_INTPOL_NEG 0 +#define MTK_INTTRIG_EDGE 1 +#define MTK_INTTRIG_LEVEL 0 +#define MTK_PIN_BITS(_i) ((1 << 31) | (_i)) +#define MTK_VPE_BITS(_v) (1 << ((_v) % 32)) + +static int mtk_gic_intr(void *); + +struct mtk_gic_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mtk_gic_softc { + device_tgic_dev; + void * gic_intrhand; + struct resource * gic_res[2]; + struct mtk_gic_irqsrc gic_irqs[MTK_NIRQS]; + struct mtx mutex; + uint32_tnirqs; +}; + +#define GIC_INTR_ISRC(sc, irq) (&(sc)->gic_irqs[(irq)].isrc) + +static struct resource_spec mtk_gic_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE },/* Registers */ + { SYS_RES_IRQ, 0, RF_ACTIVE },/* Parent interrupt 1 */ + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = {
svn commit: r297669 - head/sys/mips/mediatek
Author: sgalabov Date: Thu Apr 7 11:16:32 2016 New Revision: 297669 URL: https://svnweb.freebsd.org/changeset/base/297669 Log: Initial import of Ralink/Mediatek MIPS SoC support #4 UART drivers. - uart_dev_mtk.[ch] are the old-style Mediatek/Ralink-specific UART driver as also found in sys/mips/rt305x/uart_dev_rt305x.c, with minor improvements and FDT attachment enabled for the appropriate SoCs. - uart_dev_mtk_ns8250.c is the new-style ns16550a-compatible UART driver found in newer Mediatek SoCs. It uses the uart_dev_ns8250.c driver indirectly and is basically just a wrapper around it and only overrides its probe method. The reason I am not using the uart_dev_ns8250.c driver directly is because I have some code that does UART clock detection before initializing the UART, so that we don't need to hard-code the UART clock frequency in the dts files for each board. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5840 Added: head/sys/mips/mediatek/uart_dev_mtk.c (contents, props changed) head/sys/mips/mediatek/uart_dev_mtk.h (contents, props changed) head/sys/mips/mediatek/uart_dev_mtk_ns8250.c (contents, props changed) Added: head/sys/mips/mediatek/uart_dev_mtk.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/uart_dev_mtk.c Thu Apr 7 11:16:32 2016 (r297669) @@ -0,0 +1,552 @@ +/* $NetBSD: uart.c,v 1.2 2007/03/23 20:05:47 dogcow Exp $ */ + +/*- + * Copyright (c) 2013, Alexander A. Mityaev + * Copyright (c) 2010 Aleksandr Rybalko. + * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. + * Copyright (c) 2007 Oleksandr Tymoshenko. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * 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 AUTHORS ``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 AUTHORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_ddb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "uart_if.h" + +/* Set some reference clock value. Real value will be taken from FDT */ +#define DEFAULT_RCLK(120 * 1000 * 1000) + +/* + * Low-level UART interface. + */ +static int mtk_uart_probe(struct uart_bas *bas); +static void mtk_uart_init(struct uart_bas *bas, int, int, int, int); +static void mtk_uart_term(struct uart_bas *bas); +static void mtk_uart_putc(struct uart_bas *bas, int); +static int mtk_uart_rxready(struct uart_bas *bas); +static int mtk_uart_getc(struct uart_bas *bas, struct mtx *); + +static struct uart_ops uart_mtk_ops = { + .probe = mtk_uart_probe, + .init = mtk_uart_init, + .term = mtk_uart_term, + .putc = mtk_uart_putc, + .rxready = mtk_uart_rxready, + .getc = mtk_uart_getc, +}; + +static int uart_output = 1; +TUNABLE_INT("kern.uart_output", &uart_output); +SYSCTL_INT(_kern, OID_AUTO, uart_output, CTLFLAG_RW, +&uart_output, 0, "UART output enabled."); + +static int +mtk_uart_probe(struct uart_bas *bas) +{ + return (0); +} + +static void +mtk_uart_init(struct uart_bas *bas, int baudrate, int databits, +int stopbits, int parity) +{ +/* CLKDIV = 38400/ 3/ 16/ br */ +/* for 384MHz CLKDIV = 800 / baudrate; */ +switch (databits) { +case 5: + databits = UART_LCR_5B; + break; +case 6: + databits = UART_LCR_6B; + break; +case 7: + databits = UART_LCR_7B; + break; +case 8: + databits = UART_LCR_8B; +
svn commit: r297670 - head/sys/mips/mediatek
Author: sgalabov Date: Thu Apr 7 11:20:03 2016 New Revision: 297670 URL: https://svnweb.freebsd.org/changeset/base/297670 Log: Initial import of Ralink/Mediatek MIPS SoC support #5 USB support This revision adds USB (EHCI/OHCI/OTG, depending on SoC type) support for various Ralink/Mediatek SoCs. Currently USB is not supported on MT7621, this will be a future addition. A USB PHY driver is also included, so that we can properly initialize the USB PHY (e.g., clocks, resets, registers where needed), before attempting to initialize EHCI/OHCI/OTG functionality. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5841 Added: head/sys/mips/mediatek/mtk_dotg.c (contents, props changed) head/sys/mips/mediatek/mtk_ehci.c (contents, props changed) head/sys/mips/mediatek/mtk_ohci.c (contents, props changed) head/sys/mips/mediatek/mtk_usb_phy.c (contents, props changed) head/sys/mips/mediatek/mtk_usb_phy.h (contents, props changed) Added: head/sys/mips/mediatek/mtk_dotg.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_dotg.c Thu Apr 7 11:20:03 2016 (r297670) @@ -0,0 +1,220 @@ +#include +__FBSDID("$FreeBSD$"); + +/*- + * Copyright (c) 2015-2016 Stanislav Galabov. All rights reserved. + * Copyright (c) 2010,2011 Aleksandr Rybalko. All rights reserved. + * Copyright (c) 2007-2008 Hans Petter Selasky. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#defineMEM_RID 0 + +static device_probe_t dotg_fdt_probe; +static device_attach_t dotg_fdt_attach; +static device_detach_t dotg_fdt_detach; + +static int +dotg_fdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "ralink,rt3050-otg")) + return (ENXIO); + + device_set_desc(dev, "MTK DWC-OTG USB Controller"); + return (0); +} + +static int +dotg_fdt_attach(device_t dev) +{ + struct dwc_otg_softc *sc = device_get_softc(dev); + int err, rid; + + /* setup controller interface softc */ + + /* initialise some bus fields */ + sc->sc_mode = DWC_MODE_HOST; + sc->sc_bus.parent = dev; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = DWC_OTG_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_bus, + USB_GET_DMA_TAG(dev), NULL)) { + printf("No mem\n"); + return (ENOMEM); + } + rid = 0; + sc->sc_io_res = + bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (!(sc->sc_io_res)) { + printf("Can`t alloc MEM\n"); + goto error; + } + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &rid, RF_ACTIVE); + if (!(sc->sc_irq_res)) { + printf("Can`t alloc IRQ\n"); + goto error; + } + + sc->sc_bus
svn commit: r297671 - head/sys/mips/mediatek
Author: sgalabov Date: Thu Apr 7 11:21:42 2016 New Revision: 297671 URL: https://svnweb.freebsd.org/changeset/base/297671 Log: Initial import of Ralink/Mediatek MIPS SoC support #6 SPI drivers for the various Ralink/Mediatek SoCs. There are 2 versions of the SPI controller (so far) present in the supported SoCs, hence v1 and v2 drivers. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5842 Added: head/sys/mips/mediatek/mtk_spi_v1.c (contents, props changed) head/sys/mips/mediatek/mtk_spi_v1.h (contents, props changed) head/sys/mips/mediatek/mtk_spi_v2.c (contents, props changed) head/sys/mips/mediatek/mtk_spi_v2.h (contents, props changed) Added: head/sys/mips/mediatek/mtk_spi_v1.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_spi_v1.c Thu Apr 7 11:21:42 2016 (r297671) @@ -0,0 +1,351 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2011, Aleksandr Rybalko + * Copyright (c) 2013, Alexander A. Mityaev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +//#include + +#include +#include +#include "spibus_if.h" + +#include "opt_platform.h" + +#include +#include +#include + +#include +#include + +#undef MTK_SPI_DEBUG +#ifdef MTK_SPI_DEBUG +#define dprintf printf +#else +#define dprintf(x, arg...) +#endif + +/* + * register space access macros + */ +#define SPI_WRITE(sc, reg, val)do {\ + bus_write_4(sc->sc_mem_res, (reg), (val)); \ + } while (0) + +#define SPI_READ(sc, reg) bus_read_4(sc->sc_mem_res, (reg)) + +#define SPI_SET_BITS(sc, reg, bits)\ + SPI_WRITE(sc, reg, SPI_READ(sc, (reg)) | (bits)) + +#define SPI_CLEAR_BITS(sc, reg, bits) \ + SPI_WRITE(sc, reg, SPI_READ(sc, (reg)) & ~(bits)) + +struct mtk_spi_softc { + device_tsc_dev; + struct resource *sc_mem_res; +}; + +static int mtk_spi_probe(device_t); +static int mtk_spi_attach(device_t); +static int mtk_spi_detach(device_t); +static int mtk_spi_wait(struct mtk_spi_softc *); +static voidmtk_spi_chip_activate(struct mtk_spi_softc *); +static voidmtk_spi_chip_deactivate(struct mtk_spi_softc *); +static uint8_t mtk_spi_txrx(struct mtk_spi_softc *, uint8_t *, int); +static int mtk_spi_transfer(device_t, device_t, struct spi_command *); +static phandle_t mtk_spi_get_node(device_t, device_t); + +static struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-spi", 1 }, + { "ralink,rt3050-spi", 1 }, + { "ralink,rt3352-spi", 1 }, + { "ralink,rt3883-spi", 1 }, + { "ralink,rt5350-spi", 1 }, + { "ralink,mt7620a-spi", 1 }, + { NULL, 0 } +}; + +static int +mtk_spi_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return(ENXIO); + + device_set_desc(dev, "MTK SPI Controller (v1)"); + + return (0); +} + +static int +mtk_spi_attach(device_t dev) +{ + struct mtk_spi_softc *sc = device_get_softc(dev); + int rid; + + sc->sc_dev = dev; +rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "Co
svn commit: r297672 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Thu Apr 7 12:54:44 2016 New Revision: 297672 URL: https://svnweb.freebsd.org/changeset/base/297672 Log: Alike to r293708 relax pool check in vdev_geom_open_by_path(). This made impossible spare disk open by known path, which kind of worked only because the same fix was applied to vdev_geom_attach_by_guids() in r293708. MFC after:1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 7 11:21:42 2016(r297671) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 7 12:54:44 2016(r297672) @@ -679,7 +679,15 @@ vdev_geom_open_by_path(vdev_t *vd, int c g_topology_unlock(); vdev_geom_read_guids(cp, &pguid, &vguid); g_topology_lock(); - if (pguid != spa_guid(vd->vdev_spa) || + /* +* Check that the label's vdev guid matches the +* desired guid. If the label has a pool guid, +* check that it matches too. (Inactive spares +* and L2ARCs do not have any pool guid in the +* label.) +*/ + if ((pguid != 0 && + pguid != spa_guid(vd->vdev_spa)) || vguid != vd->vdev_guid) { vdev_geom_close_locked(vd); cp = NULL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r297633 - in head: sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/ext2fs sys/kern sys/sys sys/ufs/ffs sys/ufs/ufs sys/vm usr.bin/rctl
On Thu, Apr 07, 2016 at 04:23:25AM +, Edward Tomasz Napierala wrote: > Author: trasz > Date: Thu Apr 7 04:23:25 2016 > New Revision: 297633 > URL: https://svnweb.freebsd.org/changeset/base/297633 > > Log: > Add four new RCTL resources - readbps, readiops, writebps and writeiops, > for limiting disk (actually filesystem) IO. > > Note that in some cases these limits are not quite precise. It's ok, > as long as it's within some reasonable bounds. > > Testing - and review of the code, in particular the VFS and VM parts - is > very welcome. How you calculate iops for sequential IOs? As distinc IOPS or merged? I.e. readin 1 sector from offset 100 and immediately reading 1 sectro from offset 101 accounting as 2IOPS or as 1IOPS? > MFC after: 1 month ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297673 - head/bin/csh
Author: mp Date: Thu Apr 7 14:25:15 2016 New Revision: 297673 URL: https://svnweb.freebsd.org/changeset/base/297673 Log: Revert r296416 by removing SAVESIGVEC and switching to fork instead. This fixes usage with system libraries which maintain their own signal state. PR: 208132 Obtained from: kib MFC after:3 days Modified: head/bin/csh/config_p.h Modified: head/bin/csh/config_p.h == --- head/bin/csh/config_p.h Thu Apr 7 12:54:44 2016(r297672) +++ head/bin/csh/config_p.h Thu Apr 7 14:25:15 2016(r297673) @@ -34,7 +34,8 @@ * Note that some machines eg. rs6000 have a vfork, but not * with the berkeley semantics, so we cannot use it there either. */ -#define VFORK +/* #define VFORK */ +#definevfork fork /* * BSDJOBS You have BSD-style job control (both process groups and @@ -80,7 +81,6 @@ /** local defines */ #if defined(__FreeBSD__) -#defineSAVESIGVEC #define NLS_BUGS #define BSD_STYLE_COLORLS /* Use LC_MESSAGES locale category to open the message catalog */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297674 - in head/sys: arm/arm arm/broadcom/bcm2835 kern sys
Author: skra Date: Thu Apr 7 15:00:25 2016 New Revision: 297674 URL: https://svnweb.freebsd.org/changeset/base/297674 Log: Implement intr_isrc_init_on_cpu() and use it to replace very same code implemented in every interrupt controller driver running SMP. This function returns true, if provided ISRC should be enabled on given cpu. Modified: head/sys/arm/arm/gic.c head/sys/arm/broadcom/bcm2835/bcm2836.c head/sys/kern/subr_intr.c head/sys/sys/intr.h Modified: head/sys/arm/arm/gic.c == --- head/sys/arm/arm/gic.c Thu Apr 7 14:25:15 2016(r297673) +++ head/sys/arm/arm/gic.c Thu Apr 7 15:00:25 2016(r297674) @@ -256,11 +256,11 @@ static void arm_gic_init_secondary(device_t dev) { struct arm_gic_softc *sc = device_get_softc(dev); - struct intr_irqsrc *isrc; - u_int irq; + u_int irq, cpu; /* Set the mask so we can find this CPU to send it IPIs */ - arm_gic_map[PCPU_GET(cpuid)] = gic_cpu_mask(sc); + cpu = PCPU_GET(cpuid); + arm_gic_map[cpu] = gic_cpu_mask(sc); for (irq = 0; irq < sc->nirqs; irq += 4) gic_d_write_4(sc, GICD_IPRIORITYR(irq >> 2), 0); @@ -280,27 +280,14 @@ arm_gic_init_secondary(device_t dev) gic_d_write_4(sc, GICD_CTLR, 0x01); /* Unmask attached SGI interrupts. */ - for (irq = GIC_FIRST_SGI; irq <= GIC_LAST_SGI; irq++) { - isrc = GIC_INTR_ISRC(sc, irq); - if (isrc != NULL && isrc->isrc_handlers != 0) { - CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + for (irq = GIC_FIRST_SGI; irq <= GIC_LAST_SGI; irq++) + if (intr_isrc_init_on_cpu(GIC_INTR_ISRC(sc, irq), cpu)) gic_irq_unmask(sc, irq); - } - } /* Unmask attached PPI interrupts. */ - for (irq = GIC_FIRST_PPI; irq <= GIC_LAST_PPI; irq++) { - isrc = GIC_INTR_ISRC(sc, irq); - if (isrc == NULL || isrc->isrc_handlers == 0) - continue; - if (isrc->isrc_flags & INTR_ISRCF_BOUND) { - if (CPU_ISSET(PCPU_GET(cpuid), &isrc->isrc_cpu)) - gic_irq_unmask(sc, irq); - } else { - CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + for (irq = GIC_FIRST_PPI; irq <= GIC_LAST_PPI; irq++) + if (intr_isrc_init_on_cpu(GIC_INTR_ISRC(sc, irq), cpu)) gic_irq_unmask(sc, irq); - } - } } #else static void Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c == --- head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Apr 7 14:25:15 2016 (r297673) +++ head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Apr 7 15:00:25 2016 (r297674) @@ -525,40 +525,21 @@ bcm_lintc_setup_intr(device_t dev, struc } #ifdef SMP -static bool -bcm_lint_init_on_ap(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli, -u_int cpu) -{ - struct intr_irqsrc *isrc; - - isrc = &bli->bli_isrc; - - KASSERT(isrc->isrc_flags & INTR_ISRCF_PPI, - ("%s: irq %d is not PPI", __func__, bli->bli_irq)); - - if (isrc->isrc_handlers == 0) - return (false); - if (isrc->isrc_flags & INTR_ISRCF_BOUND) - return (CPU_ISSET(cpu, &isrc->isrc_cpu)); - - CPU_SET(cpu, &isrc->isrc_cpu); - return (true); -} - static void bcm_lintc_init_rwreg_on_ap(struct bcm_lintc_softc *sc, u_int cpu, u_int irq, uint32_t reg, uint32_t mask) { - if (bcm_lint_init_on_ap(sc, &sc->bls_isrcs[irq], cpu)) + if (intr_isrc_init_on_cpu(&sc->bls_isrcs[irq].bli_isrc, cpu)) bcm_lintc_rwreg_set(sc, reg, mask); } static void bcm_lintc_init_pmu_on_ap(struct bcm_lintc_softc *sc, u_int cpu) { + struct intr_irqsrc *isrc = &sc->bls_isrcs[BCM_LINTC_PMU_IRQ].bli_isrc; - if (bcm_lint_init_on_ap(sc, &sc->bls_isrcs[BCM_LINTC_PMU_IRQ], cpu)) { + if (intr_isrc_init_on_cpu(isrc, cpu)) { /* Write-set register. */ bcm_lintc_write_4(sc, BCM_LINTC_PMU_ROUTING_SET_REG, BCM_LINTC_PIRR_IRQ_EN_CORE(cpu)); Modified: head/sys/kern/subr_intr.c == --- head/sys/kern/subr_intr.c Thu Apr 7 14:25:15 2016(r297673) +++ head/sys/kern/subr_intr.c Thu Apr 7 15:00:25 2016(r297674) @@ -467,6 +467,32 @@ intr_isrc_deregister(struct intr_irqsrc return (error); } +#ifdef SMP +/* + * A support function for a PIC to decide if provided ISRC should be inited + * on given cpu. The logic of INTR_ISRCF_BOUND flag and isrc_cpu member of + * struct intr_irqsrc is the following: + * + * If INTR_ISRCF_BOUND is set, the ISRC should be inited only on cpus + * s
svn commit: r297675 - head/sys/mips/mediatek
Author: sgalabov Date: Thu Apr 7 15:11:24 2016 New Revision: 297675 URL: https://svnweb.freebsd.org/changeset/base/297675 Log: Initial import of Ralink/Mediatek MIPS SoC support #7 GPIO controller drivers import. As with other Ralink/Mediatek work, there are 2 versions of the GPIO controller driver, depending on the type of SoC. This revision introduces initial support for these. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision:https://reviews.freebsd.org/D5877 Added: head/sys/mips/mediatek/mtk_gpio_v1.c (contents, props changed) head/sys/mips/mediatek/mtk_gpio_v2.c (contents, props changed) Added: head/sys/mips/mediatek/mtk_gpio_v1.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_gpio_v1.cThu Apr 7 15:11:24 2016 (r297675) @@ -0,0 +1,646 @@ +/*- + * Copyright 2016 Stanislav Galabov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include "gpio_if.h" +#include "pic_if.h" + +#define MTK_GPIO_PINS 32 + +struct mtk_gpio_pin_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mtk_gpio_pin { + uint32_tpin_caps; + uint32_tpin_flags; + enum intr_trigger intr_trigger; + enum intr_polarity intr_polarity; + charpin_name[GPIOMAXNAME]; + struct mtk_gpio_pin_irqsrc pin_irqsrc; +}; + +struct mtk_gpio_softc { + device_tdev; + device_tbusdev; + struct resource *res[2]; + struct mtx mtx; + struct mtk_gpio_pin pins[MTK_GPIO_PINS]; + void*intrhand; + + uint32_tnum_pins; + uint8_t do_remap; +}; + +#define PIC_INTR_ISRC(sc, irq) (&(sc)->pins[(irq)].pin_irqsrc.isrc) + +static struct resource_spec mtk_gpio_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ,0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +static int mtk_gpio_probe(device_t dev); +static int mtk_gpio_attach(device_t dev); +static int mtk_gpio_detach(device_t dev); +static int mtk_gpio_intr(void *arg); + +#define MTK_GPIO_LOCK(sc) mtx_lock_spin(&(sc)->mtx) +#define MTK_GPIO_UNLOCK(sc)mtx_unlock_spin(&(sc)->mtx) +#define MTK_GPIO_LOCK_INIT(sc) \ +mtx_init(&(sc)->mtx, device_get_nameunit((sc)->dev), \ +"mtk_gpio", MTX_SPIN) +#define MTK_GPIO_LOCK_DESTROY(sc) mtx_destroy(&(sc)->mtx) + +#define MTK_WRITE_4(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) +#define MTK_READ_4(sc, reg)bus_read_4((sc)->res[0], (reg)) + +/* Register definitions */ +#define GPIO_PIOINT(_sc) 0x +#define GPIO_PIOEDGE(_sc) 0x0004 +#define GPIO_PIORENA(_sc) 0x0008 +#define GPIO_PIOFENA(_sc) 0x000C +#define GPIO_PIODATA(_sc) ((_sc)->do_remap ? 0x0020 : 0x0010) +#define GPIO_PIODIR(_sc) ((_sc)->do_remap ? 0x0024 : 0x0014) +#define GPIO_PIOPOL(_sc) ((_sc)->do_remap ? 0x0028 : 0x0018) +#define GPIO_PIOSET(_sc)
svn commit: r297676 - head/sys/kern
Author: skra Date: Thu Apr 7 15:16:33 2016 New Revision: 297676 URL: https://svnweb.freebsd.org/changeset/base/297676 Log: Fix intr_irq_shuffle(). After r297539, ISRCs doing IPI may be also registered into global interrupt table. Thus, they must be filtered out like per-cpu interrupts. Fortunately, it does not influence anything on interrupt controllers which already use INTRNG. Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c == --- head/sys/kern/subr_intr.c Thu Apr 7 15:11:24 2016(r297675) +++ head/sys/kern/subr_intr.c Thu Apr 7 15:16:33 2016(r297676) @@ -1190,7 +1190,7 @@ intr_irq_shuffle(void *arg __unused) for (i = 0; i < NIRQ; i++) { isrc = irq_sources[i]; if (isrc == NULL || isrc->isrc_handlers == 0 || - isrc->isrc_flags & INTR_ISRCF_PPI) + isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) continue; if (isrc->isrc_event != NULL && ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297677 - head/sys/arm/arm
Author: skra Date: Thu Apr 7 15:26:12 2016 New Revision: 297677 URL: https://svnweb.freebsd.org/changeset/base/297677 Log: Properly initialize isrc_cpu field of ISRC which is setup for an IPI. Modified: head/sys/arm/arm/gic.c Modified: head/sys/arm/arm/gic.c == --- head/sys/arm/arm/gic.c Thu Apr 7 15:16:33 2016(r297676) +++ head/sys/arm/arm/gic.c Thu Apr 7 15:26:12 2016(r297677) @@ -1003,13 +1003,18 @@ arm_gic_ipi_send(device_t dev, struct in static int arm_gic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc **isrcp) { + struct intr_irqsrc *isrc; struct arm_gic_softc *sc = device_get_softc(dev); if (sgi_first_unused > GIC_LAST_SGI) return (ENOSPC); - *isrcp = GIC_INTR_ISRC(sc, sgi_first_unused); + isrc = GIC_INTR_ISRC(sc, sgi_first_unused); sgi_to_ipi[sgi_first_unused++] = ipi; + + CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + + *isrcp = isrc; return (0); } #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297678 - head/usr.bin/uuencode
Author: gahr (ports committer) Date: Thu Apr 7 16:12:38 2016 New Revision: 297678 URL: https://svnweb.freebsd.org/changeset/base/297678 Log: Enhance uuencode with a -r option to produce raw output. This matches with uudecode's -r option to decode raw data without initial and final framing lines. $ echo Test | uuencode -mr - | uudecode -mr Test Approved by: cognet MFC after:1 week Modified: head/usr.bin/uuencode/uuencode.1 head/usr.bin/uuencode/uuencode.c Modified: head/usr.bin/uuencode/uuencode.1 == --- head/usr.bin/uuencode/uuencode.1Thu Apr 7 15:26:12 2016 (r297677) +++ head/usr.bin/uuencode/uuencode.1Thu Apr 7 16:12:38 2016 (r297678) @@ -40,6 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl m +.Op Fl r .Op Fl o Ar output_file .Op Ar file .Ar name @@ -50,6 +51,7 @@ .Op Fl i .Fl o Ar output_file .Nm b64encode +.Op Fl r .Op Fl o Ar output_file .Op Ar file .Ar name @@ -123,6 +125,8 @@ The following options are available for Use the Base64 method of encoding, rather than the traditional .Nm algorithm. +.It Fl r +Produce raw output by excluding the initial and final framing lines. .It Fl o Ar output_file Output to .Ar output_file Modified: head/usr.bin/uuencode/uuencode.c == --- head/usr.bin/uuencode/uuencode.cThu Apr 7 15:26:12 2016 (r297677) +++ head/usr.bin/uuencode/uuencode.cThu Apr 7 16:12:38 2016 (r297678) @@ -66,6 +66,7 @@ static void usage(void); static FILE *output; static int mode; +static char raw = 0; static char **av; int @@ -82,7 +83,7 @@ main(int argc, char *argv[]) if (strcmp(basename(argv[0]), "b64encode") == 0) base64 = 1; - while ((ch = getopt(argc, argv, "mo:")) != -1) { + while ((ch = getopt(argc, argv, "mo:r")) != -1) { switch (ch) { case 'm': base64 = 1; @@ -90,6 +91,9 @@ main(int argc, char *argv[]) case 'o': outfile = optarg; break; + case 'r': + raw = 1; + break; case '?': default: usage(); @@ -152,7 +156,8 @@ base64_encode(void) sequence = 0; - fprintf(output, "begin-base64 %o %s\n", mode, *av); + if (!raw) + fprintf(output, "begin-base64 %o %s\n", mode, *av); while ((n = fread(buf, 1, sizeof(buf), stdin))) { ++sequence; rv = b64_ntop(buf, n, buf2, (sizeof(buf2) / sizeof(buf2[0]))); @@ -162,7 +167,8 @@ base64_encode(void) } if (sequence % GROUPS) fprintf(output, "\n"); - fprintf(output, "\n"); + if (!raw) + fprintf(output, "\n"); } /* @@ -175,7 +181,8 @@ encode(void) register char *p; char buf[80]; - (void)fprintf(output, "begin %o %s\n", mode, *av); + if (!raw) + (void)fprintf(output, "begin %o %s\n", mode, *av); while ((n = fread(buf, 1, 45, stdin))) { ch = ENC(n); if (fputc(ch, output) == EOF) @@ -209,7 +216,8 @@ encode(void) } if (ferror(stdin)) errx(1, "read error"); - (void)fprintf(output, "%c\nend\n", ENC('\0')); + if (!raw) + (void)fprintf(output, "%c\nend\n", ENC('\0')); } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297679 - in head/sys/dev: acpica xen/pci
Author: jhb Date: Thu Apr 7 17:15:16 2016 New Revision: 297679 URL: https://svnweb.freebsd.org/changeset/base/297679 Log: Associate device_t objects with ACPI handles via PCI_CHILD_ADDED(). Previously, the ACPI PCI bus driver did a single pass over the devices in the namespace that were a child of a given PCI bus to associate the PCI bus-enumerated device_t devices with the corresponding ACPI handles. However, this meant that handles were only established at runtime for devices found during the initial PCI bus scan. PCI_IOV adds devices that show up after the initial PCI bus scan, and coming changes to add a bus rescan can also add devices after the initial scan. This change adds a pci_child_added() callback to the ACPI PCI bus that walks the namespace to find the ACPI handle for each device that is added. Using a callback means that the handle is correctly set for any device no matter how it is added (initial scan, IOV, or a bus rescan). Added: head/sys/dev/acpica/acpi_pcivar.h (contents, props changed) Modified: head/sys/dev/acpica/acpi_pci.c head/sys/dev/xen/pci/xen_acpi_pci.c Modified: head/sys/dev/acpica/acpi_pci.c == --- head/sys/dev/acpica/acpi_pci.c Thu Apr 7 16:12:38 2016 (r297678) +++ head/sys/dev/acpica/acpi_pci.c Thu Apr 7 17:15:16 2016 (r297679) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -104,6 +105,7 @@ static device_method_t acpi_pci_methods[ DEVMETHOD(bus_get_domain, acpi_get_domain), /* PCI interface */ + DEVMETHOD(pci_child_added, acpi_pci_child_added), DEVMETHOD(pci_set_powerstate, acpi_pci_set_powerstate_method), #ifdef PCI_IOV DEVMETHOD(pci_create_iov_child, acpi_pci_create_iov_child), @@ -271,31 +273,35 @@ acpi_pci_save_handle(ACPI_HANDLE handle, void **status) { struct acpi_pci_devinfo *dinfo; - device_t *devlist; - int devcount, i, func, slot; + device_t child; + int func, slot; UINT32 address; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + child = context; if (ACPI_FAILURE(acpi_GetInteger(handle, "_ADR", &address))) return_ACPI_STATUS (AE_OK); slot = ACPI_ADR_PCI_SLOT(address); func = ACPI_ADR_PCI_FUNC(address); - if (device_get_children((device_t)context, &devlist, &devcount) != 0) - return_ACPI_STATUS (AE_OK); - for (i = 0; i < devcount; i++) { - dinfo = device_get_ivars(devlist[i]); - if (dinfo->ap_dinfo.cfg.func == func && - dinfo->ap_dinfo.cfg.slot == slot) { - dinfo->ap_handle = handle; - acpi_pci_update_device(handle, devlist[i]); - break; - } + dinfo = device_get_ivars(child); + if (dinfo->ap_dinfo.cfg.func == func && + dinfo->ap_dinfo.cfg.slot == slot) { + dinfo->ap_handle = handle; + acpi_pci_update_device(handle, child); + return_ACPI_STATUS (AE_CTRL_TERMINATE); } - free(devlist, M_TEMP); return_ACPI_STATUS (AE_OK); } +void +acpi_pci_child_added(device_t dev, device_t child) +{ + + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_save_handle, NULL, child, NULL); +} + static int acpi_pci_probe(device_t dev) { @@ -325,18 +331,18 @@ acpi_pci_attach(device_t dev) busno = pcib_get_bus(dev); /* -* First, PCI devices are added as in the normal PCI bus driver. -* Afterwards, the ACPI namespace under the bridge driver is -* walked to save ACPI handles to all the devices that appear in -* the ACPI namespace as immediate descendants of the bridge. +* PCI devices are added via the bus scan in the normal PCI +* bus driver. As each device is added, the +* acpi_pci_child_added() callback walks the ACPI namespace +* under the bridge driver to save ACPI handles to all the +* devices that appear in the ACPI namespace as immediate +* descendants of the bridge. * * XXX: Sometimes PCI devices show up in the ACPI namespace that * pci_add_children() doesn't find. We currently just ignore * these devices. */ pci_add_children(dev, domain, busno, sizeof(struct acpi_pci_devinfo)); - AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, - acpi_pci_save_handle, NULL, dev, NULL); return (bus_generic_attach(dev)); } @@ -371,17 +377,9 @@ static device_t acpi_pci_create_iov_child(device_t bus, device_t pf, uint16_t rid, uint16_t vid, uint16_t did) { - struct acpi_pci_devinfo *dinfo; - device_t vf; - vf = pci_add_iov_child(bus, pf, sizeof(struct acpi
svn commit: r297680 - head/sys/arm/freescale/imx
Author: ian Date: Thu Apr 7 17:45:01 2016 New Revision: 297680 URL: https://svnweb.freebsd.org/changeset/base/297680 Log: Comestic changes; when INTRNG support was added, some functions became oddly separated from related functionality. This just moves some blocks of code around so that setup_intr and teardown_intr are near each other again, and likewise for enable/disable_intr. No functional changes. Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c == --- head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 17:15:16 2016 (r297679) +++ head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 17:45:01 2016 (r297680) @@ -157,45 +157,6 @@ static int imx51_gpio_pin_toggle(device_ #ifdef ARM_INTRNG static int -gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, -struct resource *res, struct intr_map_data *data) -{ - struct imx51_gpio_softc *sc; - struct gpio_irqsrc *gi; - - sc = device_get_softc(dev); - if (isrc->isrc_handlers == 0) { - gi = (struct gpio_irqsrc *)isrc; - gi->gi_pol = INTR_POLARITY_CONFORM; - gi->gi_trig = INTR_TRIGGER_CONFORM; - - // XXX Not sure this is necessary - mtx_lock_spin(&sc->sc_mtx); - CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << gi->gi_irq)); - WRITE4(sc, IMX_GPIO_ISR_REG, (1U << gi->gi_irq)); - mtx_unlock_spin(&sc->sc_mtx); - } - return (0); -} - -/* - * this is mask_intr - */ -static void -gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) -{ - struct imx51_gpio_softc *sc; - u_int irq; - - sc = device_get_softc(dev); - irq = ((struct gpio_irqsrc *)isrc)->gi_irq; - - mtx_lock_spin(&sc->sc_mtx); - CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << irq)); - mtx_unlock_spin(&sc->sc_mtx); -} - -static int gpio_pic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp, enum intr_polarity *polp, enum intr_trigger *trigp) { @@ -279,6 +240,28 @@ gpio_pic_map_intr(device_t dev, struct i } static int +gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, +struct resource *res, struct intr_map_data *data) +{ + struct imx51_gpio_softc *sc; + struct gpio_irqsrc *gi; + + sc = device_get_softc(dev); + if (isrc->isrc_handlers == 0) { + gi = (struct gpio_irqsrc *)isrc; + gi->gi_pol = INTR_POLARITY_CONFORM; + gi->gi_trig = INTR_TRIGGER_CONFORM; + + // XXX Not sure this is necessary + mtx_lock_spin(&sc->sc_mtx); + CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << gi->gi_irq)); + WRITE4(sc, IMX_GPIO_ISR_REG, (1U << gi->gi_irq)); + mtx_unlock_spin(&sc->sc_mtx); + } + return (0); +} + +static int gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, struct resource *res, struct intr_map_data *data) { @@ -345,6 +328,23 @@ gpio_pic_setup_intr(device_t dev, struct } /* + * this is mask_intr + */ +static void +gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct imx51_gpio_softc *sc; + u_int irq; + + sc = device_get_softc(dev); + irq = ((struct gpio_irqsrc *)isrc)->gi_irq; + + mtx_lock_spin(&sc->sc_mtx); + CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << irq)); + mtx_unlock_spin(&sc->sc_mtx); +} + +/* * this is unmask_intr */ static void @@ -417,7 +417,7 @@ gpio_pic_filter(void *arg) } /* - * register our isrcs into intrng to make it known about them. + * Initialize our isrcs and register them with intrng. */ static int gpio_pic_register_isrcs(struct imx51_gpio_softc *sc) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297682 - in head/sys: arm/arm mips/mips
Author: ian Date: Thu Apr 7 18:19:09 2016 New Revision: 297682 URL: https://svnweb.freebsd.org/changeset/base/297682 Log: Fix a copyright glitch before it gets copy-pasted again. I think this must have started as collateral damage in a global search-replace, then it got copied around when I cloned a file to begin creating a new file. Modified: head/sys/arm/arm/locore.S head/sys/arm/arm/physmem.c head/sys/mips/mips/ofw_machdep.c Modified: head/sys/arm/arm/locore.S == --- head/sys/arm/arm/locore.S Thu Apr 7 18:03:42 2016(r297681) +++ head/sys/arm/arm/locore.S Thu Apr 7 18:19:09 2016(r297682) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Ian Lepore - * All rights excluded. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/arm/physmem.c == --- head/sys/arm/arm/physmem.c Thu Apr 7 18:03:42 2016(r297681) +++ head/sys/arm/arm/physmem.c Thu Apr 7 18:19:09 2016(r297682) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Ian Lepore - * All rights excluded. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/mips/mips/ofw_machdep.c == --- head/sys/mips/mips/ofw_machdep.cThu Apr 7 18:03:42 2016 (r297681) +++ head/sys/mips/mips/ofw_machdep.cThu Apr 7 18:19:09 2016 (r297682) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2015 Ian Lepore - * All rights excluded. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r296986 - head/sys/netinet6
> On 17 Mar 2016, at 12:10, Andrey V. Elsukov wrote: > > Author: ae > Date: Thu Mar 17 11:10:44 2016 > New Revision: 296986 > URL: https://svnweb.freebsd.org/changeset/base/296986 > > Log: > Reduce the number of local variables. Remove redundant check that inp > pointer isn't NULL, it is safe, because we are handling IPV6_PKTINFO > socket option in this block of code. Also, use in6ifa_withaddr() instead > of ifa_withaddr(). ... > in6_selectsrc(uint32_t fibnum, struct so >* the interface must be specified; otherwise, ifa_ifwithaddr() >* will fail matching the address. >*/ > - bzero(&srcsock, sizeof(srcsock)); > - srcsock.sin6_family = AF_INET6; > - srcsock.sin6_len = sizeof(srcsock); > - srcsock.sin6_addr = pi->ipi6_addr; > + tmp = pi->ipi6_addr; > if (ifp) { > - error = in6_setscope(&srcsock.sin6_addr, ifp, NULL); > + error = in6_setscope(&tmp, ifp, &odstzone); > if (error) > return (error); > } > if (cred != NULL && (error = prison_local_ip6(cred, > - &srcsock.sin6_addr, (inp != NULL && > - (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) > + &tmp, (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0) > return (error); > > /* > @@ -262,19 +255,18 @@ in6_selectsrc(uint32_t fibnum, struct so >* ancillary data. >*/ > if ((inp->inp_flags & INP_BINDANY) == 0) { > - ia6 = (struct in6_ifaddr *)ifa_ifwithaddr( > - (struct sockaddr *)&srcsock); > - if (ia6 == NULL || (ia6->ia6_flags & (IN6_IFF_ANYCAST | > + ia = in6ifa_ifwithaddr(&tmp, odstzone); I believe this breaks radvd. It tries to send out RAs with a link-local source address. These fail with 'ERR#49 'Can't assign requested address’’. Note that ‘tmp’ has had the zoneid embedded into it already (in6_setscope() above), so the address comparison in in6ifa_ifwithaddr() fails to match. That leads to the EADDRNOTAVAIL error. I don’t think this is the specific commit that broke things (at least, I don’t see how it worked before), but I’m hoping you’ll have a better idea of what went wrong. Regards, Kristof ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297683 - head/sys/arm/freescale/imx
Author: ian Date: Thu Apr 7 19:17:47 2016 New Revision: 297683 URL: https://svnweb.freebsd.org/changeset/base/297683 Log: Code cleanup: stop searching for a pin in the array and just use the pin number directly as an index. We create the array ourselves and nothing can change the order of items in it, it's a simple 1:1 mapping. Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c == --- head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 18:19:09 2016 (r297682) +++ head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 19:17:47 2016 (r297683) @@ -497,19 +497,14 @@ static int imx51_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - *caps = sc->gpio_pins[i].gp_caps; + *caps = sc->gpio_pins[pin].gp_caps; mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -519,19 +514,14 @@ static int imx51_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - *flags = sc->gpio_pins[i].gp_flags; + *flags = sc->gpio_pins[pin].gp_flags; mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -541,19 +531,13 @@ static int imx51_gpio_pin_getname(device_t dev, uint32_t pin, char *name) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - memcpy(name, sc->gpio_pins[i].gp_name, GPIOMAXNAME); + memcpy(name, sc->gpio_pins[pin].gp_name, GPIOMAXNAME); mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -563,18 +547,13 @@ static int imx51_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); - imx51_gpio_pin_configure(sc, &sc->gpio_pins[i], flags); + imx51_gpio_pin_configure(sc, &sc->gpio_pins[pin], flags); return (0); } @@ -583,22 +562,17 @@ static int imx51_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); if (value) - SET4(sc, IMX_GPIO_DR_REG, (1U << i)); + SET4(sc, IMX_GPIO_DR_REG, (1U << pin)); else - CLEAR4(sc, IMX_GPIO_DR_REG, (1U << i)); + CLEAR4(sc, IMX_GPIO_DR_REG, (1U << pin)); mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -608,19 +582,14 @@ static int imx51_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - *val = (READ4(sc, IMX_GPIO_DR_REG) >> i) & 1; + *val = (READ4(sc, IMX_GPIO_DR_REG) >> pin) & 1; mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -630,20 +599,15 @@ static int imx51_gpio_pin_toggle(device_t dev, uint32_t pin) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (p
svn commit: r297684 - head/sys/arm/freescale/imx
Author: ian Date: Thu Apr 7 19:51:27 2016 New Revision: 297684 URL: https://svnweb.freebsd.org/changeset/base/297684 Log: Remove unecessary locking, mostly from places where a read is done of a value that can't ever be in an inconsistant intermediate state even when some other thread is in the middle of writing the value/register. Locking of the hardware remains in the few places that do r-m-w operations. Locking of metadata access is restricted to places using memcpy or sprintf to modify the metadata. Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c == --- head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 19:17:47 2016 (r297683) +++ head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 19:51:27 2016 (r297684) @@ -451,22 +451,27 @@ static void imx51_gpio_pin_configure(struct imx51_gpio_softc *sc, struct gpio_pin *pin, unsigned int flags) { + u_int newflags; mtx_lock_spin(&sc->sc_mtx); /* -* Manage input/output +* Manage input/output; other flags not supported yet. +* +* Note that changes to pin->gp_flags must be acccumulated in newflags +* and stored with a single writeback to gp_flags at the end, to enable +* unlocked reads of that value elsewhere. */ - if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { - pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); + if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { + newflags = pin->gp_flags & ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); if (flags & GPIO_PIN_OUTPUT) { - pin->gp_flags |= GPIO_PIN_OUTPUT; + newflags |= GPIO_PIN_OUTPUT; SET4(sc, IMX_GPIO_OE_REG, (1U << pin->gp_pin)); - } - else { - pin->gp_flags |= GPIO_PIN_INPUT; + } else { + newflags |= GPIO_PIN_INPUT; CLEAR4(sc, IMX_GPIO_OE_REG, (1U << pin->gp_pin)); } + pin->gp_flags = newflags; } mtx_unlock_spin(&sc->sc_mtx); @@ -503,9 +508,7 @@ imx51_gpio_pin_getcaps(device_t dev, uin if (pin >= sc->gpio_npins) return (EINVAL); - mtx_lock_spin(&sc->sc_mtx); *caps = sc->gpio_pins[pin].gp_caps; - mtx_unlock_spin(&sc->sc_mtx); return (0); } @@ -520,9 +523,7 @@ imx51_gpio_pin_getflags(device_t dev, ui if (pin >= sc->gpio_npins) return (EINVAL); - mtx_lock_spin(&sc->sc_mtx); *flags = sc->gpio_pins[pin].gp_flags; - mtx_unlock_spin(&sc->sc_mtx); return (0); } @@ -588,9 +589,7 @@ imx51_gpio_pin_get(device_t dev, uint32_ if (pin >= sc->gpio_npins) return (EINVAL); - mtx_lock_spin(&sc->sc_mtx); *val = (READ4(sc, IMX_GPIO_DR_REG) >> pin) & 1; - mtx_unlock_spin(&sc->sc_mtx); return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux
Author: emaste Date: Thu Apr 7 20:12:45 2016 New Revision: 297685 URL: https://svnweb.freebsd.org/changeset/base/297685 Log: Add option to specify built-in keymap for kbdmux PR: 153459 Submitted by: swel...@gmail.com Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/dev/kbdmux/kbdmux.c head/sys/modules/kbdmux/Makefile Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Thu Apr 7 19:51:27 2016(r297684) +++ head/sys/conf/NOTES Thu Apr 7 20:12:45 2016(r297685) @@ -1409,6 +1409,10 @@ options MSGBUF_SIZE=40960 optionsKBD_DISABLE_KEYMAP_LOAD # refuse to load a keymap optionsKBD_INSTALL_CDEV# install a CDEV entry in /dev +device kbdmux # keyboard multiplexer +optionsKBDMUX_DFLT_KEYMAP # specify the built-in keymap +makeoptionsKBDMUX_DFLT_KEYMAP=it.iso + optionsFB_DEBUG# Frame buffer debugging device splash # Splash screen and screen saver support Modified: head/sys/conf/files == --- head/sys/conf/files Thu Apr 7 19:51:27 2016(r297684) +++ head/sys/conf/files Thu Apr 7 20:12:45 2016(r297685) @@ -47,6 +47,10 @@ pccarddevs.h standard \ compile-with"${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ no-obj no-implicit-rule before-depend \ clean "pccarddevs.h" +kbdmuxmap.hoptionalkbdmux_dflt_keymap \ + compile-with"kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${KBDMUX_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > kbdmuxmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "kbdmuxmap.h" teken_state.h optional sc | vt \ dependency "$S/teken/gensequences $S/teken/sequences" \ compile-with"${AWK} -f $S/teken/gensequences $S/teken/sequences > teken_state.h" \ Modified: head/sys/conf/options == --- head/sys/conf/options Thu Apr 7 19:51:27 2016(r297684) +++ head/sys/conf/options Thu Apr 7 20:12:45 2016(r297685) @@ -801,6 +801,8 @@ KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUGopt_kbd.h +KBDMUX_DFLT_KEYMAP opt_kbdmux.h + # options for the Atheros driver ATH_DEBUG opt_ath.h ATH_TXBUF opt_ath.h Modified: head/sys/dev/kbdmux/kbdmux.c == --- head/sys/dev/kbdmux/kbdmux.cThu Apr 7 19:51:27 2016 (r297684) +++ head/sys/dev/kbdmux/kbdmux.cThu Apr 7 20:12:45 2016 (r297685) @@ -33,6 +33,7 @@ #include "opt_compat.h" #include "opt_kbd.h" +#include "opt_kbdmux.h" #include #include @@ -54,6 +55,13 @@ #include #include #include + +/* the initial key map, accent map and fkey strings */ +#ifdef KBDMUX_DFLT_KEYMAP +#define KBD_DFLT_KEYMAP +#include "kbdmuxmap.h" +#endif + #include #define KEYBOARD_NAME "kbdmux" Modified: head/sys/modules/kbdmux/Makefile == --- head/sys/modules/kbdmux/MakefileThu Apr 7 19:51:27 2016 (r297684) +++ head/sys/modules/kbdmux/MakefileThu Apr 7 20:12:45 2016 (r297685) @@ -4,7 +4,7 @@ .PATH: ${.CURDIR}/../../dev/kbdmux KMOD= kbdmux -SRCS= kbdmux.c opt_compat.h opt_kbd.h bus_if.h device_if.h +SRCS= kbdmux.c opt_compat.h opt_kbd.h opt_kbdmux.h bus_if.h device_if.h .if !defined(KERNBUILDDIR) opt_compat.h: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux
On Thu, Apr 7, 2016 at 1:12 PM, Ed Maste wrote: > Author: emaste > Date: Thu Apr 7 20:12:45 2016 > New Revision: 297685 > URL: https://svnweb.freebsd.org/changeset/base/297685 > > Log: > Add option to specify built-in keymap for kbdmux > > PR: 153459 > Submitted by: swel...@gmail.com This doesn't seem to work in the sys/modules/kbdmux case (kbdmuxmap.h isn't generated via sys/modules/kbdmux/Makefile) -- should it be generated there as well? Thanks! -Ngie ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297686 - head/sys/sys
Author: emaste Date: Thu Apr 7 20:26:27 2016 New Revision: 297686 URL: https://svnweb.freebsd.org/changeset/base/297686 Log: Rename SHT_AMD64_UNWIND to SHT_X86_64_UNWIND per ABI doc From http://www.x86-64.org/documentation_folder/abi-0.99.pdf Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h == --- head/sys/sys/elf_common.h Thu Apr 7 20:12:45 2016(r297685) +++ head/sys/sys/elf_common.h Thu Apr 7 20:26:27 2016(r297686) @@ -415,7 +415,8 @@ typedef struct { #defineSHT_HISUNW 0x6fff #defineSHT_HIOS0x6fff /* Last of OS specific semantics */ #defineSHT_LOPROC 0x7000 /* reserved range for processor */ -#defineSHT_AMD64_UNWIND0x7001 /* unwind information */ +#defineSHT_X86_64_UNWIND 0x7001 /* unwind information */ +#defineSHT_AMD64_UNWINDSHT_X86_64_UNWIND #defineSHT_ARM_EXIDX 0x7001 /* Exception index table. */ #defineSHT_ARM_PREEMPTMAP 0x7002 /* BPABI DLL dynamic linking ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297687 - head/sys/conf
Author: emaste Date: Thu Apr 7 20:30:46 2016 New Revision: 297687 URL: https://svnweb.freebsd.org/changeset/base/297687 Log: newvers.sh: rationalize licence condition numbering Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh == --- head/sys/conf/newvers.shThu Apr 7 20:26:27 2016(r297686) +++ head/sys/conf/newvers.shThu Apr 7 20:30:46 2016(r297687) @@ -11,7 +11,7 @@ # 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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors #may be used to endorse or promote products derived from this software #without specific prior written permission. # ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux
Ngie Cooper writes: > On Thu, Apr 7, 2016 at 1:12 PM, Ed Maste wrote: > >> Author: emaste >> Date: Thu Apr 7 20:12:45 2016 >> New Revision: 297685 >> URL: https://svnweb.freebsd.org/changeset/base/297685 >> >> Log: >> Add option to specify built-in keymap for kbdmux >> >> PR: 153459 >> Submitted by: swel...@gmail.com > > This doesn't seem to work in the sys/modules/kbdmux case (kbdmuxmap.h > isn't generated via sys/modules/kbdmux/Makefile) -- should it be > generated there as well? Probably not. KBDMUX_DFLT_KEYMAP can only be defined via kernel config(5). This is similar to sys/modules/usb/ukbd + opt_ukbd.h. So, build modules as part of |make buildkernel|. signature.asc Description: PGP signature
svn commit: r297688 - head/sys/cam/scsi
Author: pfg Date: Thu Apr 7 21:33:14 2016 New Revision: 297688 URL: https://svnweb.freebsd.org/changeset/base/297688 Log: chdone(): Prevent returning uninitialized scalar value. Improve over the solution in r297527: Instead of attempting to initialize all the possible cases, just move the check nearer to the case where it makes sense. CID: 1006486 Reviewed by: ken MFC after:2 weeks Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c == --- head/sys/cam/scsi/scsi_ch.c Thu Apr 7 20:30:46 2016(r297687) +++ head/sys/cam/scsi/scsi_ch.c Thu Apr 7 21:33:14 2016(r297688) @@ -648,10 +648,14 @@ chdone(struct cam_periph *periph, union softc->sc_counts[CHET_IE], PLURAL(softc->sc_counts[CHET_IE])); #undef PLURAL + if (announce_buf[0] != '\0') { + xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CH_Q_BIT_STRING); + } } else { int error; - announce_buf[0] = '\0'; error = cherror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_PRINT); /* @@ -715,14 +719,8 @@ chdone(struct cam_periph *periph, union cam_periph_invalidate(periph); - announce_buf[0] = '\0'; } } - if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); - xpt_announce_quirks(periph, softc->quirks, - CH_Q_BIT_STRING); - } softc->state = CH_STATE_NORMAL; free(mode_header, M_SCSICH); /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297689 - head/sys/arm/allwinner
Author: jmcneill Date: Fri Apr 8 00:01:19 2016 New Revision: 297689 URL: https://svnweb.freebsd.org/changeset/base/297689 Log: Match on compatible string "allwinner,sun4i-a10-sram-controller" instead of "allwinner,sun4i-sramc", to match upstream DTS. Modified: head/sys/arm/allwinner/a10_sramc.c Modified: head/sys/arm/allwinner/a10_sramc.c == --- head/sys/arm/allwinner/a10_sramc.c Thu Apr 7 21:33:14 2016 (r297688) +++ head/sys/arm/allwinner/a10_sramc.c Fri Apr 8 00:01:19 2016 (r297689) @@ -71,7 +71,7 @@ static int a10_sramc_probe(device_t dev) { - if (ofw_bus_is_compatible(dev, "allwinner,sun4i-sramc")) { + if (ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-sram-controller")) { device_set_desc(dev, "Allwinner sramc module"); return (BUS_PROBE_DEFAULT); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297690 - head/sys/boot/forth
Author: sobomax Date: Fri Apr 8 00:24:21 2016 New Revision: 297690 URL: https://svnweb.freebsd.org/changeset/base/297690 Log: Document vfs.root.mountfrom. Reviewed by: imp, wblock Differential Revision:https://reviews.freebsd.org/D5332 Modified: head/sys/boot/forth/loader.conf.5 Modified: head/sys/boot/forth/loader.conf.5 == --- head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:01:19 2016 (r297689) +++ head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:24:21 2016 (r297690) @@ -112,6 +112,31 @@ The name must be a subdirectory of that contains a kernel. .It Ar kernel_options Flags to be passed to the kernel. +.It Ar vfs.root.mountfrom +Specify the root partition to mount. +For example: +.Pp +.Dl vfs.root.mountfrom="ufs:/dev/da0s1a" +.Pp +.Xr loader 8 +automatically calculates the value of this tunable from +.Pa /etc/fstab +from the partition the kernel was loaded from. +The calculated value might be calculated incorrectly when +.Pa /etc/fstab +is not available during +.Xr loader 8 +startup (as during diskless booting from NFS), or if a different +device is desired by the user. +The preferred value can be set in +.Pa /loader.conf . +.Pp +The value can also be overridden from the +.Xr loader 8 +command line. +This is useful for system recovery when +.Pa /etc/fstab +is damaged, lost, or read from the wrong partition. .It Ar password Protect boot menu with a password without interrupting .Ic autoboot ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297691 - in head: sbin/geom/class/eli sys/geom/eli
Author: allanjude Date: Fri Apr 8 01:25:25 2016 New Revision: 297691 URL: https://svnweb.freebsd.org/changeset/base/297691 Log: Create the GELIBOOT GEOM_ELI flag This flag indicates that the user wishes to use the GELIBOOT feature to boot from a fully encrypted root file system. Currently, GELIBOOT does not support key files, and in the future when it does, they will be loaded differently. Due to the design of GELI, and the desire for secrecy, the GELI metadata does not know if key files are used or not, it just adds the key material (if any) to the HMAC before the optional passphrase, so there is no way to tell if a GELI partition requires key files or not. Since the GELIBOOT code in boot2 and the loader does not support keys, they will now only attempt to attach if this flag is set. This will stop GELIBOOT from prompting for passwords to GELIs that it cannot decrypt, disrupting the boot process PR: 208251 Reviewed by: ed, oshogbo, wblock Sponsored by: ScaleEngine Inc. Differential Revision:https://reviews.freebsd.org/D5867 Modified: head/sbin/geom/class/eli/geli.8 head/sbin/geom/class/eli/geom_eli.c head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_ctl.c Modified: head/sbin/geom/class/eli/geli.8 == --- head/sbin/geom/class/eli/geli.8 Fri Apr 8 00:24:21 2016 (r297690) +++ head/sbin/geom/class/eli/geli.8 Fri Apr 8 01:25:25 2016 (r297691) @@ -51,7 +51,7 @@ utility: .Pp .Nm .Cm init -.Op Fl bPTv +.Op Fl bgPTv .Op Fl a Ar aalgo .Op Fl B Ar backupfile .Op Fl e Ar ealgo @@ -88,7 +88,7 @@ utility: .Ar prov .Nm .Cm configure -.Op Fl bBtT +.Op Fl bBgGtT .Ar prov ... .Nm .Cm setkey @@ -293,6 +293,11 @@ The default and recommended algorithm is .Nm AES-XTS . .Nm NULL is unencrypted. +.It Fl g +Enable booting from this encrypted root filesystem. +The boot loader prompts for the passphrase and loads +.Xr loader 8 +from the encrypted partition. .It Fl i Ar iterations Number of iterations to use with PKCS#5v2 when processing User Key passphrase component. @@ -485,6 +490,13 @@ For more information, see the descriptio subcommand. .It Fl B Remove the BOOT flag from the given providers. +.It Fl g +Enable booting from this encrypted root filesystem. +The boot loader prompts for the passphrase and loads +.Xr loader 8 +from the encrypted partition. +.It Fl G +Deactivate booting from this encrypted root partition. .It Fl t Enable TRIM/UNMAP passthru. For more information, see the description of the Modified: head/sbin/geom/class/eli/geom_eli.c == --- head/sbin/geom/class/eli/geom_eli.c Fri Apr 8 00:24:21 2016 (r297690) +++ head/sbin/geom/class/eli/geom_eli.c Fri Apr 8 01:25:25 2016 (r297691) @@ -82,13 +82,13 @@ static int eli_backup_create(struct gctl /* * Available commands: * - * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-V version] prov + * init [-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov * label - alias for 'init' * attach [-dprv] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... * stop - alias for 'detach' * onetime [-d] [-a aalgo] [-e ealgo] [-l keylen] prov - * configure [-bB] prov ... + * configure [-bBgGtT] prov ... * setkey [-pPv] [-n keyno] [-j passfile] [-J newpassfile] [-k keyfile] [-K newkeyfile] prov * delkey [-afv] [-n keyno] prov * suspend [-v] -a | prov ... @@ -108,6 +108,7 @@ struct g_command class_commands[] = { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", "", G_TYPE_STRING }, + { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, @@ -118,7 +119,7 @@ struct g_command class_commands[] = { { 'V', "mdversion", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" + "[-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { @@ -126,6 +127,7 @@ struct g_command class_commands[] = { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", "", G_TYPE_STRING
svn commit: r297692 - head/sys/boot/geli
Author: allanjude Date: Fri Apr 8 01:27:40 2016 New Revision: 297692 URL: https://svnweb.freebsd.org/changeset/base/297692 Log: GELIBoot should only prompt for the GELI passphrase if the provider has the G_ELI_FLAG_GELIBOOT set PR: 208251 Sponsored by: ScaleEngine Inc. Differential Revision:https://reviews.freebsd.org/D5870 Modified: head/sys/boot/geli/geliboot.c Modified: head/sys/boot/geli/geliboot.c == --- head/sys/boot/geli/geliboot.c Fri Apr 8 01:25:25 2016 (r297691) +++ head/sys/boot/geli/geliboot.c Fri Apr 8 01:27:40 2016 (r297692) @@ -90,12 +90,12 @@ geli_taste(int read_func(void *vdev, voi return (error); } - if ((md.md_flags & G_ELI_FLAG_ONETIME)) { - /* Swap device, skip it. */ + if (!(md.md_flags & G_ELI_FLAG_GELIBOOT)) { + /* The GELIBOOT feature is not activated */ return (1); } - if (!(md.md_flags & G_ELI_FLAG_BOOT)) { - /* Disk is not GELI boot device, skip it. */ + if ((md.md_flags & G_ELI_FLAG_ONETIME)) { + /* Swap device, skip it. */ return (1); } if (md.md_iterations < 0) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297694 - head/sys/security/audit
Author: pfg Date: Fri Apr 8 03:26:21 2016 New Revision: 297694 URL: https://svnweb.freebsd.org/changeset/base/297694 Log: audit(8): leave unsigned comparison for last. aq64_minfree is unsigned so comparing to find out if it is less than zero is a nonsense. Move the comparison to the last position as we don't want to spend time if any of the others triggers first. hile it would be tempting to just remove it, it may be important to keep it for portability with platforms where may be signed(?) or in case we may want to change it in the future. Modified: head/sys/security/audit/audit_syscalls.c Modified: head/sys/security/audit/audit_syscalls.c == --- head/sys/security/audit/audit_syscalls.cFri Apr 8 01:57:40 2016 (r297693) +++ head/sys/security/audit/audit_syscalls.cFri Apr 8 03:26:21 2016 (r297694) @@ -303,8 +303,8 @@ sys_auditon(struct thread *td, struct au (udata.au_qctrl64.aq64_lowater >= udata.au_qctrl.aq_hiwater) || (udata.au_qctrl64.aq64_bufsz > AQ_MAXBUFSZ) || - (udata.au_qctrl64.aq64_minfree < 0) || - (udata.au_qctrl64.aq64_minfree > 100)) + (udata.au_qctrl64.aq64_minfree > 100) || + (udata.au_qctrl64.aq64_minfree < 0)) return (EINVAL); audit_qctrl.aq_hiwater = (int)udata.au_qctrl64.aq64_hiwater; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r297690 - head/sys/boot/forth
On Fri, 8 Apr 2016, Maxim Sobolev wrote: Log: Document vfs.root.mountfrom. Reviewed by: imp, wblock The format of this variable is still undocumented, except in the source code. Modified: head/sys/boot/forth/loader.conf.5 == --- head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:01:19 2016 (r297689) +++ head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:24:21 2016 (r297690) This variable is (partly) documented in a different wrong file than the source file. It isn't a loader option. It is a kernel tunable. No other kernel tunables are documented in loader.conf.5. Some of them are documented in loader.8 (not really the right place --- loader is just 1 way of setting them, and isn't a way of reading or interpreting them). loader.8 also documents most loader options as BUILTIN ENVIRONMENT VARIABLES. It does this much better than loader.conf.5. It documents 30 such options and only has a couple of ordering errors in the list, whie loader.conf.5 documents 15 such options in random order. About half of the 15 are in both, and their descriptions give quite different details in a quite different style (too much double quoting in loader.conf.5). loader.8 documents only 16 tunables, with more ordering errors that for options. @@ -112,6 +112,31 @@ The name must be a subdirectory of that contains a kernel. .It Ar kernel_options Flags to be passed to the kernel. +.It Ar vfs.root.mountfrom +Specify the root partition to mount. +For example: +.Pp +.Dl vfs.root.mountfrom="ufs:/dev/da0s1a" The source code gives the details needed to actually use this variable without guessing from a single example. It gives both an informal and formal description: X /* X * The root filesystem is detailed in the kernel environment variable X * vfs.root.mountfrom, which is expected to be in the general format X * X * :[][ :[] ...] X * vfsname := the name of a VFS known to the kernel and capable X * of being mounted as root X * path := disk device name or other data used by the filesystem X * to locate its physical store X * X * If the environment variable vfs.root.mountfrom is a space separated list, X * each list element is tried in turn and the root filesystem will be mounted X * from the first one that suceeds. X * X * The environment variable vfs.root.mountfrom.options is a comma delimited X * set of string mount options. These mount options must be parseable X * by nmount() in the kernel. X */ I thought that these careful descriptions were broken using sbufs which accidentally (?) changed the separator from space to newline. However, I can' find any trace of this in my config files -- they now just use a space. I might have just been confused by old kernels not supporting lists. I mainly use this feaature to work around the renaming of ad to ada and loss of the compatibility support for this. My lists look like "ufs:ad4s3a ufs:ada0s3a ufs:ad0s2a". Old kernels don't support lists, but they also don't support ada; they use the first entry and this works although the documentation says it shouldn't (the comment says that the format is :[] and doesn't mention field separators or trailing garbage). FreeBSD-11 doesn't supprt ad, but it supports lists; so it uses the second entry. This works on 2 systems with similar disk numbering. The third entry is for another system with different disk numbering an no ad4. This almost never works -- with old kernels, the list doesn't work, and with new kernels the list works and ada0 exists and ada0s3a exists, but it is not the right boot partition. This works with intermediate kernels with lists but no ada0, so that the third entry is used. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297695 - head/sys/fs/ext2fs
Author: kevlo Date: Fri Apr 8 04:29:05 2016 New Revision: 297695 URL: https://svnweb.freebsd.org/changeset/base/297695 Log: Fix comment. Modified: head/sys/fs/ext2fs/ext2_vfsops.c Modified: head/sys/fs/ext2fs/ext2_vfsops.c == --- head/sys/fs/ext2fs/ext2_vfsops.cFri Apr 8 03:26:21 2016 (r297694) +++ head/sys/fs/ext2fs/ext2_vfsops.cFri Apr 8 04:29:05 2016 (r297695) @@ -308,8 +308,8 @@ ext2_check_sb_compat(struct ext2fs *es, } /* - * This computes the fields of the ext2_sb_info structure from the - * data in the ext2_super_block structure read in. + * This computes the fields of the m_ext2fs structure from the + * data in the ext2fs structure read in. */ static int compute_sb_data(struct vnode *devvp, struct ext2fs *es, @@ -600,7 +600,7 @@ ext2_mountfs(struct vnode *devvp, struct /* * I don't know whether this is the right strategy. Note that -* we dynamically allocate both an ext2_sb_info and an ext2_super_block +* we dynamically allocate both an m_ext2fs and an ext2fs * while Linux keeps the super block in a locked buffer. */ ump->um_e2fs = malloc(sizeof(struct m_ext2fs), ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r297690 - head/sys/boot/forth
Hi Bruce, thanks for the input! I will see if I can move that piece into loader.8 and extend it a bit from the source "documentation". -Max On Thu, Apr 7, 2016 at 8:38 PM, Bruce Evans wrote: > On Fri, 8 Apr 2016, Maxim Sobolev wrote: > > Log: >> Document vfs.root.mountfrom. >> >> Reviewed by: imp, wblock >> > > The format of this variable is still undocumented, except in the source > code. > > Modified: head/sys/boot/forth/loader.conf.5 >> >> == >> --- head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:01:19 2016 >> (r297689) >> +++ head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:24:21 2016 >> (r297690) >> > > This variable is (partly) documented in a different wrong file than the > source file. It isn't a loader option. It is a kernel tunable. No > other kernel tunables are documented in loader.conf.5. Some of them are > documented in loader.8 (not really the right place --- loader is just 1 > way of setting them, and isn't a way of reading or interpreting them). > loader.8 also documents most loader options as BUILTIN ENVIRONMENT > VARIABLES. It does this much better than loader.conf.5. It documents > 30 such options and only has a couple of ordering errors in the list, > whie loader.conf.5 documents 15 such options in random order. About > half of the 15 are in both, and their descriptions give quite different > details in a quite different style (too much double quoting in > loader.conf.5). loader.8 documents only 16 tunables, with more ordering > errors that for options. > > @@ -112,6 +112,31 @@ The name must be a subdirectory of >> that contains a kernel. >> .It Ar kernel_options >> Flags to be passed to the kernel. >> +.It Ar vfs.root.mountfrom >> +Specify the root partition to mount. >> +For example: >> +.Pp >> +.Dl vfs.root.mountfrom="ufs:/dev/da0s1a" >> > > The source code gives the details needed to actually use this variable > without guessing from a single example. It gives both an informal and > formal description: > > X /* > X * The root filesystem is detailed in the kernel environment variable > X * vfs.root.mountfrom, which is expected to be in the general format > X * > X * :[][ :[] ...] > X * vfsname := the name of a VFS known to the kernel and capable > X * of being mounted as root > X * path := disk device name or other data used by the filesystem > X * to locate its physical store > X * > X * If the environment variable vfs.root.mountfrom is a space separated > list, > X * each list element is tried in turn and the root filesystem will be > mounted > X * from the first one that suceeds. > X * > X * The environment variable vfs.root.mountfrom.options is a comma > delimited > X * set of string mount options. These mount options must be parseable > X * by nmount() in the kernel. > X */ > > I thought that these careful descriptions were broken using sbufs which > accidentally (?) changed the separator from space to newline. However, > I can' find any trace of this in my config files -- they now just use > a space. I might have just been confused by old kernels not supporting > lists. > > I mainly use this feaature to work around the renaming of ad to ada and > loss of the compatibility support for this. My lists look like > "ufs:ad4s3a ufs:ada0s3a ufs:ad0s2a". Old kernels don't support lists, > but they also don't support ada; they use the first entry and this works > although the documentation says it shouldn't (the comment says that > the format is :[] and doesn't mention field separators or > trailing garbage). FreeBSD-11 doesn't supprt ad, but it supports lists; > so it uses the second entry. This works on 2 systems with similar disk > numbering. The third entry is for another system with different disk > numbering an no ad4. This almost never works -- with old kernels, the > list doesn't work, and with new kernels the list works and ada0 exists > and ada0s3a exists, but it is not the right boot partition. This works > with intermediate kernels with lists but no ada0, so that the third > entry is used. > > Bruce > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r297696 - in head/sys/dev/usb: . quirk
Author: hselasky Date: Fri Apr 8 06:51:49 2016 New Revision: 297696 URL: https://svnweb.freebsd.org/changeset/base/297696 Log: Add new USB quirk. Submitted by: AJ PR: 208623 MFC after:1 week Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c == --- head/sys/dev/usb/quirk/usb_quirk.c Fri Apr 8 04:29:05 2016 (r297695) +++ head/sys/dev/usb/quirk/usb_quirk.c Fri Apr 8 06:51:49 2016 (r297696) @@ -529,6 +529,9 @@ static struct usb_quirk_entry usb_quirks /* DYMO LabelManager Pnp */ USB_QUIRK(DYMO, LABELMANAGERPNP, 0x, 0x, UQ_MSC_DYMO_EJECT), + + /* Holtek USB gaming keyboard */ + USB_QUIRK(HOLTEK, F85, 0x, 0x, UQ_KBD_BOOTPROTO), }; #undef USB_QUIRK_VP #undef USB_QUIRK Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsFri Apr 8 04:29:05 2016(r297695) +++ head/sys/dev/usb/usbdevsFri Apr 8 06:51:49 2016(r297696) @@ -2268,6 +2268,9 @@ product HIDGLOBAL CM6020 0x1784 Omnikey product HITACHI DVDCAM_DZ_MV100A 0x0004 DVD-CAM DZ-MV100A Camcorder product HITACHI DVDCAM_USB 0x001e DVDCAM USB HS Interface +/* Holtek products */ +product HOLTEK F85 0xa030 Holtek USB gaming keyboard + /* HP products */ product HP 895C0x0004 DeskJet 895C product HP 4100C 0x0101 Scanjet 4100C ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"