svn commit: r310242 - head/sys/dev/usb

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:28:12 2016
New Revision: 310242
URL: https://svnweb.freebsd.org/changeset/base/310242

Log:
  Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid
  boot panics in conjunction with the recently added EARLY_AP_STARTUP feature.
  The panics happen due to using kernel facilities like callouts too early.
  
  Tested by:jhb @
  MFC after:1 week

Modified:
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_process.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Mon Dec 19 07:48:04 2016(r310241)
+++ head/sys/dev/usb/usb_hub.c  Mon Dec 19 09:28:12 2016(r310242)
@@ -2261,6 +2261,11 @@ usb_needs_explore(struct usb_bus *bus, u
 
DPRINTF("\n");
 
+   if (cold != 0) {
+   DPRINTF("Cold\n");
+   return;
+   }
+
if (bus == NULL) {
DPRINTF("No bus pointer!\n");
return;
@@ -2326,6 +2331,26 @@ usb_needs_explore_all(void)
 }
 
 /**
+ * usb_needs_explore_init
+ *
+ * This function will ensure that the USB controllers are not enumerated
+ * until the "cold" variable is cleared.
+ **/
+static void
+usb_needs_explore_init(void *arg)
+{
+   /*
+* The cold variable should be cleared prior to this function
+* being called:
+*/
+   if (cold == 0)
+   usb_needs_explore_all();
+   else
+   DPRINTFN(-1, "Cold variable is still set!\n");
+}
+SYSINIT(usb_needs_explore_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_SECOND, 
usb_needs_explore_init, NULL);
+
+/**
  * usb_bus_power_update
  *
  * This function will ensure that all USB devices on the given bus are

Modified: head/sys/dev/usb/usb_process.c
==
--- head/sys/dev/usb/usb_process.c  Mon Dec 19 07:48:04 2016
(r310241)
+++ head/sys/dev/usb/usb_process.c  Mon Dec 19 09:28:12 2016
(r310242)
@@ -455,14 +455,15 @@ usb_proc_drain(struct usb_process *up)
up->up_csleep = 0;
cv_signal(&up->up_cv);
}
+#ifndef EARLY_AP_STARTUP
/* Check if we are still cold booted */
-
if (cold) {
USB_THREAD_SUSPEND(up->up_ptr);
printf("WARNING: A USB process has "
"been left suspended\n");
break;
}
+#endif
cv_wait(&up->up_cv, up->up_mtx);
}
/* Check if someone is waiting - should not happen */
___
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: r310171 - head/sys/sys

2016-12-19 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Sepherosa Ziehau 
> 
> Date: 2016-12-18, Sunday at 23:02
> To: Dimitry Andric 
> Cc: , , 
> 
> Subject: Re: svn commit: r310171 - head/sys/sys
> 
> The following patch unbreaks the LINT builds on amd64 for me after this 
> commit:
> https://people.freebsd.org/~sephe/geom_sscanf.diff

Wouldn't it be better to use the SCN macros?

-Ravi (rpokala@)

> Please review it.
> 
> Thanks,
> sephe
> 
> 
> On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andric  wrote:
>> Author: dim
>> Date: Fri Dec 16 19:49:22 2016
>> New Revision: 310171
>> URL: https://svnweb.freebsd.org/changeset/base/310171
>>
>> Log:
>>   Add __scanflike attributes to the kernel's sscanf() and vsscanf()
>>   declarations.  This should help to catch future mismatches between
>>   format strings and arguments.
>>
>>   MFC after:1 week
>>
>> Modified:
>>   head/sys/sys/systm.h
>>
>> Modified: head/sys/sys/systm.h
>> ==
>> --- head/sys/sys/systm.hFri Dec 16 19:09:57 2016(r310170)
>> +++ head/sys/sys/systm.hFri Dec 16 19:49:22 2016(r310171)
>> @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char
>>  intvsnrprintf(char *, size_t, int, const char *, __va_list) 
>> __printflike(4, 0);
>>  intvsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
>>  intttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
>> -intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);
>> -intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>> __nonnull(2);
>> +intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) 
>> __scanflike(2, 3);
>> +intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>> __nonnull(2) __scanflike(2, 0);
>>  long   strtol(const char *, char **, int) __nonnull(1);
>>  u_long strtoul(const char *, char **, int) __nonnull(1);
>>  quad_t strtoq(const char *, char **, int) __nonnull(1);
>> ___
>> svn-src-...@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/svn-src-all
>> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
> 
> -- 
> Tomorrow Will Never Die



___
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: r310172 - in head/sys/mips: conf ingenic

2016-12-19 Thread Andriy Gapon
On 16/12/2016 22:04, Jared McNeill wrote:
> Log:
>   Add support for Ingenic JZ4780 SMBus controller.

Just a note that it looks, swims and quacks like an I²C (I2C / IIC) controller 
:-)

>   Reviewed by:kan
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D8793
> 
> Added:
>   head/sys/mips/ingenic/jz4780_smb.c   (contents, props changed)
>   head/sys/mips/ingenic/jz4780_smb.h   (contents, props changed)
> Modified:
>   head/sys/mips/conf/JZ4780
>   head/sys/mips/ingenic/files.jz4780


-- 
Andriy Gapon
___
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: r310257 - in head/sys/cam: ctl scsi

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 10:25:47 2016
New Revision: 310257
URL: https://svnweb.freebsd.org/changeset/base/310257

Log:
  Improve support for informational exceptions.
  
  While CTL still has no real events to report in this way (like SMART),
  it is possible to trigger false event by manually setting TEST bit in
  Informational Exceptions Control mode page, that can be useful for
  initiator testing.  This code supports all flavours of IE reporting:
  UNIT ATTENTION, RECOVERED ERROR and NO SENSE sense keys, REQUEST SENSE
  command and Informational Exceptions log page.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_error.c
  head/sys/cam/ctl/ctl_private.h
  head/sys/cam/scsi/scsi_all.h
  head/sys/cam/scsi/scsi_da.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 10:00:56 2016(r310256)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 10:25:47 2016(r310257)
@@ -93,25 +93,6 @@ struct ctl_softc *control_softc = NULL;
  * Note that these are default values only.  The actual values will be
  * filled in when the user does a mode sense.
  */
-const static struct copan_debugconf_subpage debugconf_page_default = {
-   DBGCNF_PAGE_CODE | SMPH_SPF,/* page_code */
-   DBGCNF_SUBPAGE_CODE,/* subpage */
-   {(sizeof(struct copan_debugconf_subpage) - 4) >> 8,
-(sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */
-   DBGCNF_VERSION, /* page_version */
-   {CTL_TIME_IO_DEFAULT_SECS>>8,
-CTL_TIME_IO_DEFAULT_SECS>>0},  /* ctl_time_io_secs */
-};
-
-const static struct copan_debugconf_subpage debugconf_page_changeable = {
-   DBGCNF_PAGE_CODE | SMPH_SPF,/* page_code */
-   DBGCNF_SUBPAGE_CODE,/* subpage */
-   {(sizeof(struct copan_debugconf_subpage) - 4) >> 8,
-(sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */
-   0,  /* page_version */
-   {0xff,0xff},/* ctl_time_io_secs */
-};
-
 const static struct scsi_da_rw_recovery_page rw_er_page_default = {
/*page_code*/SMS_RW_ERROR_RECOVERY_PAGE,
/*page_length*/sizeof(struct scsi_da_rw_recovery_page) - 2,
@@ -129,12 +110,12 @@ const static struct scsi_da_rw_recovery_
 const static struct scsi_da_rw_recovery_page rw_er_page_changeable = {
/*page_code*/SMS_RW_ERROR_RECOVERY_PAGE,
/*page_length*/sizeof(struct scsi_da_rw_recovery_page) - 2,
-   /*byte3*/0,
+   /*byte3*/SMS_RWER_PER,
/*read_retry_count*/0,
/*correction_span*/0,
/*head_offset_count*/0,
/*data_strobe_offset_cnt*/0,
-   /*byte8*/0,
+   /*byte8*/SMS_RWER_LBPERE,
/*write_retry_count*/0,
/*reserved2*/0,
/*recovery_time_limit*/{0, 0},
@@ -206,6 +187,24 @@ const static struct scsi_rigid_disk_page
/*reserved2*/ {0, 0}
 };
 
+const static struct scsi_da_verify_recovery_page verify_er_page_default = {
+   /*page_code*/SMS_VERIFY_ERROR_RECOVERY_PAGE,
+   /*page_length*/sizeof(struct scsi_da_verify_recovery_page) - 2,
+   /*byte3*/0,
+   /*read_retry_count*/0,
+   /*reserved*/{ 0, 0, 0, 0, 0, 0 },
+   /*recovery_time_limit*/{0, 0},
+};
+
+const static struct scsi_da_verify_recovery_page verify_er_page_changeable = {
+   /*page_code*/SMS_VERIFY_ERROR_RECOVERY_PAGE,
+   /*page_length*/sizeof(struct scsi_da_verify_recovery_page) - 2,
+   /*byte3*/SMS_VER_PER,
+   /*read_retry_count*/0,
+   /*reserved*/{ 0, 0, 0, 0, 0, 0 },
+   /*recovery_time_limit*/{0, 0},
+};
+
 const static struct scsi_caching_page caching_page_default = {
/*page_code*/SMS_CACHING_PAGE,
/*page_length*/sizeof(struct scsi_caching_page) - 2,
@@ -285,19 +284,20 @@ const static struct scsi_control_ext_pag
 const static struct scsi_info_exceptions_page ie_page_default = {
/*page_code*/SMS_INFO_EXCEPTIONS_PAGE,
/*page_length*/sizeof(struct scsi_info_exceptions_page) - 2,
-   /*info_flags*/SIEP_FLAGS_DEXCPT,
-   /*mrie*/0,
+   /*info_flags*/SIEP_FLAGS_EWASC,
+   /*mrie*/SIEP_MRIE_NO,
/*interval_timer*/{0, 0, 0, 0},
-   /*report_count*/{0, 0, 0, 0}
+   /*report_count*/{0, 0, 0, 1}
 };
 
 const static struct scsi_info_exceptions_page ie_page_changeable = {
/*page_code*/SMS_INFO_EXCEPTIONS_PAGE,
/*page_length*/sizeof(struct scsi_info_exceptions_page) - 2,
-   /*info_flags*/0,
-   /*mrie*/0,
-   /*interval_timer*/{0, 0, 0, 0},
-   /*report_count*/{0, 0, 0, 0}
+   /*info_flags*/SIEP_FLAGS_EWASC | SIEP_FLAGS_DEXCPT | SIEP_FLAGS_TEST |
+   SIEP_FLAGS_LOGERR,
+   /*mrie*/0x0f,
+   /*interval_timer*/{0xff, 0xff, 0xff, 0xff},
+   /*report_count*/{0xff, 0xff, 0xff, 0xff}
 };
 
 #define CTL_LBPM_LEN   (

svn commit: r310258 - in head/sys: netinet netinet6

2016-12-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Dec 19 11:02:49 2016
New Revision: 310258
URL: https://svnweb.freebsd.org/changeset/base/310258

Log:
  ip[6]_tryforward does inbound and outbound packet firewall processing.
  This can lead to change of mbuf pointer (packet filter could do m_pullup(),
  NAT, etc). Also in case of change of destination address, tryforward can
  decide that packet should be handled by local system. In this case modified
  mbuf can be returned to the ip[6]_input(). To handle this correctly, check
  M_FASTFWD_OURS flag after return from ip[6]_tryforward. And if it is present,
  update variables that depend from mbuf pointer and skip another inbound
  firewall processing.
  
  No objection from:#network
  MFC after:3 weeks
  Sponsored by: Yandex LLC
  Differential Revision:https://reviews.freebsd.org/D8764

Modified:
  head/sys/netinet/ip_input.c
  head/sys/netinet6/ip6_input.c

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Mon Dec 19 10:25:47 2016(r310257)
+++ head/sys/netinet/ip_input.c Mon Dec 19 11:02:49 2016(r310258)
@@ -550,24 +550,35 @@ tooshort:
m_adj(m, ip_len - m->m_pkthdr.len);
}
 
-   /* Try to forward the packet, but if we fail continue */
+   /*
+* Try to forward the packet, but if we fail continue.
+* ip_tryforward() does inbound and outbound packet firewall
+* processing. If firewall has decided that destination becomes
+* our local address, it sets M_FASTFWD_OURS flag. In this
+* case skip another inbound firewall processing and update
+* ip pointer.
+*/
+   if (V_ipforwarding != 0
 #ifdef IPSEC
-   /* For now we do not handle IPSEC in tryforward. */
-   if (!key_havesp(IPSEC_DIR_INBOUND) && !key_havesp(IPSEC_DIR_OUTBOUND) &&
-   (V_ipforwarding == 1))
-   if (ip_tryforward(m) == NULL)
+   && !key_havesp(IPSEC_DIR_INBOUND)
+   && !key_havesp(IPSEC_DIR_OUTBOUND)
+#endif
+  ) {
+   if ((m = ip_tryforward(m)) == NULL)
return;
+   if (m->m_flags & M_FASTFWD_OURS) {
+   m->m_flags &= ~M_FASTFWD_OURS;
+   ip = mtod(m, struct ip *);
+   goto ours;
+   }
+   }
+#ifdef IPSEC
/*
 * Bypass packet filtering for packets previously handled by IPsec.
 */
if (ip_ipsec_filtertunnel(m))
goto passin;
-#else
-   if (V_ipforwarding == 1)
-   if (ip_tryforward(m) == NULL)
-   return;
-#endif /* IPSEC */
-
+#endif
/*
 * Run through list of hooks for input packets.
 *

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Mon Dec 19 10:25:47 2016
(r310257)
+++ head/sys/netinet6/ip6_input.c   Mon Dec 19 11:02:49 2016
(r310258)
@@ -726,23 +726,36 @@ ip6_input(struct mbuf *m)
goto bad;
}
 #endif
-   /* Try to forward the packet, but if we fail continue */
+   /*
+* Try to forward the packet, but if we fail continue.
+* ip6_tryforward() does inbound and outbound packet firewall
+* processing. If firewall has decided that destination becomes
+* our local address, it sets M_FASTFWD_OURS flag. In this
+* case skip another inbound firewall processing and update
+* ip6 pointer.
+*/
+   if (V_ip6_forwarding != 0
 #ifdef IPSEC
-   if (V_ip6_forwarding != 0 && !key_havesp(IPSEC_DIR_INBOUND) &&
-   !key_havesp(IPSEC_DIR_OUTBOUND))
-   if (ip6_tryforward(m) == NULL)
+   && !key_havesp(IPSEC_DIR_INBOUND)
+   && !key_havesp(IPSEC_DIR_OUTBOUND)
+#endif
+   ) {
+   if ((m = ip6_tryforward(m)) == NULL)
return;
+   if (m->m_flags & M_FASTFWD_OURS) {
+   m->m_flags &= ~M_FASTFWD_OURS;
+   ours = 1;
+   ip6 = mtod(m, struct ip6_hdr *);
+   goto hbhcheck;
+   }
+   }
+#ifdef IPSEC
/*
 * Bypass packet filtering for packets previously handled by IPsec.
 */
if (ip6_ipsec_filtertunnel(m))
goto passin;
-#else
-   if (V_ip6_forwarding != 0)
-   if (ip6_tryforward(m) == NULL)
-   return;
-#endif /* IPSEC */
-
+#endif
/*
 * Run through list of hooks for input packets.
 *
@@ -750,12 +763,12 @@ ip6_input(struct mbuf *m)
 * (e.g. by NAT rewriting).  When this happens,
 * tell ip6_forward to do the right thing.
 */
-   odst = ip6->ip6_dst;
 
/* Jump over all PFIL processing if hooks are n

svn commit: r310259 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 11:44:41 2016
New Revision: 310259
URL: https://svnweb.freebsd.org/changeset/base/310259

Log:
  Following SPC-5, make REQUEST SENSE report "Logical unit not supported"
  in returned parameter data for not accessible LUNs.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 11:02:49 2016(r310258)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 11:44:41 2016(r310259)
@@ -9205,7 +9205,7 @@ ctl_request_sense(struct ctl_scsiio *cts
 {
struct scsi_request_sense *cdb;
struct scsi_sense_data *sense_ptr;
-   struct ctl_softc *ctl_softc;
+   struct ctl_softc *softc;
struct ctl_lun *lun;
uint32_t initidx;
int have_error;
@@ -9215,7 +9215,7 @@ ctl_request_sense(struct ctl_scsiio *cts
 
cdb = (struct scsi_request_sense *)ctsio->cdb;
 
-   ctl_softc = control_softc;
+   softc = control_softc;
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
CTL_DEBUG_PRINT(("ctl_request_sense\n"));
@@ -9248,8 +9248,18 @@ ctl_request_sense(struct ctl_scsiio *cts
/*
 * If we don't have a LUN, we don't have any pending sense.
 */
-   if (lun == NULL)
-   goto no_sense;
+   if (lun == NULL ||
+   ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 &&
+softc->ha_link < CTL_HA_LINK_UNKNOWN)) {
+   /* "Logical unit not supported" */
+   ctl_set_sense_data(sense_ptr, NULL, sense_format,
+   /*current_error*/ 1,
+   /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
+   /*asc*/ 0x25,
+   /*ascq*/ 0x00,
+   SSD_ELEM_NONE);
+   goto send;
+   }
 
have_error = 0;
initidx = ctl_get_initindex(&ctsio->io_hdr.nexus);
@@ -9297,61 +9307,39 @@ ctl_request_sense(struct ctl_scsiio *cts
have_error = 1;
} else
 #endif
-   {
+   if (have_error == 0) {
ua_type = ctl_build_ua(lun, initidx, sense_ptr, sense_format);
if (ua_type != CTL_UA_NONE)
have_error = 1;
if (ua_type == CTL_UA_LUN_CHANGE) {
mtx_unlock(&lun->lun_lock);
-   mtx_lock(&ctl_softc->ctl_lock);
-   ctl_clr_ua_allluns(ctl_softc, initidx, ua_type);
-   mtx_unlock(&ctl_softc->ctl_lock);
+   mtx_lock(&softc->ctl_lock);
+   ctl_clr_ua_allluns(softc, initidx, ua_type);
+   mtx_unlock(&softc->ctl_lock);
mtx_lock(&lun->lun_lock);
}
-
}
-   mtx_unlock(&lun->lun_lock);
-
-   /*
-* We already have a pending error, return it.
-*/
-   if (have_error != 0) {
+   if (have_error == 0) {
/*
-* We report the SCSI status as OK, since the status of the
-* request sense command itself is OK.
-* We report 0 for the sense length, because we aren't doing
-* autosense in this case.  We're reporting sense as
-* parameter data.
+* Report informational exception if have one and allowed.
 */
-   ctl_set_success(ctsio);
-   ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
-   ctsio->be_move_done = ctl_config_move_done;
-   ctl_datamove((union ctl_io *)ctsio);
-   return (CTL_RETVAL_COMPLETE);
+   if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != 
SIEP_MRIE_NO) {
+   asc = lun->ie_asc;
+   ascq = lun->ie_ascq;
+   }
+   ctl_set_sense_data(sense_ptr, lun, sense_format,
+   /*current_error*/ 1,
+   /*sense_key*/ SSD_KEY_NO_SENSE,
+   /*asc*/ asc,
+   /*ascq*/ ascq,
+   SSD_ELEM_NONE);
}
+   mtx_unlock(&lun->lun_lock);
 
+send:
/*
-* No sense information to report, so we report that everything is
-* okay, unless we have allowed Informational Exception.
-*/
-   if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != SIEP_MRIE_NO) {
-   asc = lun->ie_asc;
-   ascq = lun->ie_ascq;
-   }
-
-no_sense:
-   ctl_set_sense_data(sense_ptr,
-  lun,
-  sense_format,
-  /*current_error*/ 1,
-  /*sense_key*/ SSD_KEY_NO_SENSE,
-  /*asc*/ asc,
-  /*ascq*/ ascq,
-  SSD_ELEM_NONE);
-
-   /*
-* We report 0 for the sense length, because we aren't doing
-* aut

svn commit: r310265 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 13:25:53 2016
New Revision: 310265
URL: https://svnweb.freebsd.org/changeset/base/310265

Log:
  Add set of macros to simplify code access to mode pages fields.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_error.c
  head/sys/cam/ctl/ctl_private.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 13:14:39 2016(r310264)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 13:25:53 2016(r310265)
@@ -5869,21 +5869,19 @@ static void
 ctl_ie_timer(void *arg)
 {
struct ctl_lun *lun = arg;
-   struct scsi_info_exceptions_page *pg;
uint64_t t;
 
if (lun->ie_asc == 0)
return;
 
-   pg = &lun->mode_pages.ie_page[CTL_PAGE_CURRENT];
-   if (pg->mrie == SIEP_MRIE_UA)
+   if (lun->MODE_IE.mrie == SIEP_MRIE_UA)
ctl_est_ua_all(lun, -1, CTL_UA_IE);
else
lun->ie_reported = 0;
 
-   if (lun->ie_reportcnt < scsi_4btoul(pg->report_count)) {
+   if (lun->ie_reportcnt < scsi_4btoul(lun->MODE_IE.report_count)) {
lun->ie_reportcnt++;
-   t = scsi_4btoul(pg->interval_timer);
+   t = scsi_4btoul(lun->MODE_IE.interval_timer);
if (t == 0 || t == UINT32_MAX)
t = 3000;  /* 5 min */
callout_schedule(&lun->ie_callout, t * hz / 10);
@@ -6477,9 +6475,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
if (lun->be_lun->lun_type == T_DIRECT) {
header->dev_specific = 0x10; /* DPOFUA */
if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) ||
-   (lun->mode_pages.control_page[CTL_PAGE_CURRENT]
-   .eca_and_aen & SCP_SWP) != 0)
-   header->dev_specific |= 0x80; /* WP */
+   (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
+   header->dev_specific |= 0x80; /* WP */
}
if (dbd)
header->block_descr_len = 0;
@@ -6500,9 +6497,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
if (lun->be_lun->lun_type == T_DIRECT) {
header->dev_specific = 0x10; /* DPOFUA */
if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) ||
-   (lun->mode_pages.control_page[CTL_PAGE_CURRENT]
-   .eca_and_aen & SCP_SWP) != 0)
-   header->dev_specific |= 0x80; /* WP */
+   (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
+   header->dev_specific |= 0x80; /* WP */
}
if (dbd)
scsi_ulto2b(0, header->block_descr_len);
@@ -8807,12 +8803,10 @@ ctl_read_write(struct ctl_scsiio *ctsio)
 
/* Set FUA and/or DPO if caches are disabled. */
if (isread) {
-   if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 &
-   SCP_RCD) != 0)
+   if ((lun->MODE_CACHING.flags1 & SCP_RCD) != 0)
flags |= CTL_LLF_FUA | CTL_LLF_DPO;
} else {
-   if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 &
-   SCP_WCE) == 0)
+   if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0)
flags |= CTL_LLF_FUA;
}
 
@@ -8915,8 +8909,7 @@ ctl_cnw(struct ctl_scsiio *ctsio)
}
 
/* Set FUA if write cache is disabled. */
-   if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 &
-   SCP_WCE) == 0)
+   if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0)
flags |= CTL_LLF_FUA;
 
ctsio->kern_total_len = 2 * num_blocks * lun->be_lun->blocksize;
@@ -9323,7 +9316,7 @@ ctl_request_sense(struct ctl_scsiio *cts
/*
 * Report informational exception if have one and allowed.
 */
-   if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != 
SIEP_MRIE_NO) {
+   if (lun->MODE_IE.mrie != SIEP_MRIE_NO) {
asc = lun->ie_asc;
ascq = lun->ie_ascq;
}
@@ -11088,8 +11081,8 @@ ctl_check_for_blockage(struct ctl_lun *l
return (ctl_extent_check(ooa_io, pending_io,
(lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
case CTL_SER_EXTENTOPT:
-   if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags
-   & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED)
+   if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) !=
+   SCP_QUEUE_ALG_UNRESTRICTED)
return (ctl_extent_check(ooa_io, pending_io,
(lun->be_lun &&
 

svn commit: r310266 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 14:19:52 2016
New Revision: 310266
URL: https://svnweb.freebsd.org/changeset/base/310266

Log:
  Add support for NUAR bit in Control mode page.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 13:25:53 2016(r310265)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 14:19:52 2016(r310266)
@@ -253,7 +253,7 @@ const static struct scsi_control_page co
/*page_code*/SMS_CONTROL_MODE_PAGE,
/*page_length*/sizeof(struct scsi_control_page) - 2,
/*rlec*/SCP_DSENSE,
-   /*queue_flags*/SCP_QUEUE_ALG_MASK,
+   /*queue_flags*/SCP_QUEUE_ALG_MASK | SCP_NUAR,
/*eca_and_aen*/SCP_SWP,
/*flags4*/0,
/*aen_holdoff_period*/{0, 0},
@@ -8440,12 +8440,11 @@ ctl_persistent_reserve_out(struct ctl_sc
lun->pr_res_type = 0;
 
/*
-* if this isn't an exclusive access
-* res generate UA for all other
-* registrants.
+* If this isn't an exclusive access reservation and NUAR
+* is not set, generate UA for all other registrants.
 */
-   if (type != SPR_TYPE_EX_AC
-&& type != SPR_TYPE_WR_EX) {
+   if (type != SPR_TYPE_EX_AC && type != SPR_TYPE_WR_EX &&
+   (lun->MODE_CTRL.queue_flags & SCP_NUAR) == 0) {
for (i = softc->init_min; i < softc->init_max; i++) {
if (i == residx || ctl_get_prkey(lun, i) == 0)
continue;
@@ -8595,11 +8594,12 @@ ctl_hndl_per_res_out_on_other_sc(union c
 
case CTL_PR_RELEASE:
/*
-* if this isn't an exclusive access res generate UA for all
-* other registrants.
+* If this isn't an exclusive access reservation and NUAR
+* is not set, generate UA for all other registrants.
 */
if (lun->pr_res_type != SPR_TYPE_EX_AC &&
-   lun->pr_res_type != SPR_TYPE_WR_EX) {
+   lun->pr_res_type != SPR_TYPE_WR_EX &&
+   (lun->MODE_CTRL.queue_flags & SCP_NUAR) == 0) {
for (i = softc->init_min; i < softc->init_max; i++)
if (i == residx || ctl_get_prkey(lun, i) == 0)
continue;
___
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: r310267 - in head/sys/boot: arm/uboot common efi/loader i386/loader mips/beri/loader mips/uboot pc98/loader powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc64/loader userboot/u...

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 14:40:59 2016
New Revision: 310267
URL: https://svnweb.freebsd.org/changeset/base/310267

Log:
  Deduplicate loader vers.c Makefile rules
  
  The Makefile rule to create vers.c for loader version info was
  previously duplicated in each of the various loader Makefiles.
  Instead, share a common rule in Makefile.inc.
  
  Reviewed by:  bapt
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8841

Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/common/Makefile.inc
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/i386/loader/Makefile
  head/sys/boot/mips/beri/loader/Makefile
  head/sys/boot/mips/uboot/Makefile
  head/sys/boot/pc98/loader/Makefile
  head/sys/boot/powerpc/kboot/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ps3/Makefile
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/sparc64/loader/Makefile
  head/sys/boot/userboot/userboot/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileMon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/arm/uboot/MakefileMon Dec 19 14:40:59 2016
(r310267)
@@ -90,7 +90,7 @@ LIBFICL=  ${.OBJDIR}/../../ficl/libficl.a
 CFLAGS+=   -I${.CURDIR}/../../common
 CFLAGS+=   -I.
 
-CLEANFILES+=   vers.c loader.help
+CLEANFILES+=   loader.help
 
 CFLAGS+=   -ffreestanding -msoft-float
 
@@ -119,9 +119,6 @@ LDADD=  ${LIBFICL} ${LIBUBOOT} ${LIBFDT}
 
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 
-vers.c:${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
-   sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
-
 loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

Modified: head/sys/boot/common/Makefile.inc
==
--- head/sys/boot/common/Makefile.inc   Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/common/Makefile.inc   Mon Dec 19 14:40:59 2016
(r310267)
@@ -71,3 +71,8 @@ CFLAGS+=  -DBOOT_PROMPT_123
 SRCS+= install.c
 CFLAGS+=-I${.CURDIR}/../../../../lib/libstand
 .endif
+
+CLEANFILES+=   vers.c
+VERSION_FILE?= ${.CURDIR}/version
+vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE}
+   sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT}

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/efi/loader/Makefile   Mon Dec 19 14:40:59 2016
(r310267)
@@ -115,13 +115,10 @@ FILESMODE_loader.efi= ${BINMODE}
 LDSCRIPT=  ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
 LDFLAGS+=  -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
 
-CLEANFILES+=   vers.c loader.efi
+CLEANFILES+=   loader.efi
 
 NEWVERSWHAT=   "EFI loader" ${MACHINE}
 
-vers.c:${.CURDIR}/../../common/newvers.sh 
${.CURDIR}/../../efi/loader/version
-   sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
-
 NM?=   nm
 OBJCOPY?=  objcopy
 

Modified: head/sys/boot/i386/loader/Makefile
==
--- head/sys/boot/i386/loader/Makefile  Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/i386/loader/Makefile  Mon Dec 19 14:40:59 2016
(r310267)
@@ -8,6 +8,7 @@ PROG=   ${LOADER}.sym
 MAN=   
 INTERNALPROG=
 NEWVERSWHAT?=  "bootstrap loader" x86
+VERSION_FILE=  ${.CURDIR}/../loader/version
 
 # architecture-specific loader code
 SRCS=  main.c conf.c vers.c
@@ -72,7 +73,7 @@ CFLAGS+=  -I${.CURDIR}/../../.. -D_STAND
 CFLAGS+=   -I${.CURDIR}/../../common
 CFLAGS+=   -I.
 
-CLEANFILES=vers.c ${LOADER} ${LOADER}.bin loader.help
+CLEANFILES=${LOADER} ${LOADER}.bin loader.help
 
 CFLAGS+=   -Wall
 LDFLAGS=   -static -Ttext 0x0
@@ -93,10 +94,6 @@ CFLAGS+= -I${.CURDIR}/../btx/lib
 # Pick up ../Makefile.inc early.
 .include 
 
-vers.c:${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
-   sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
-   ${NEWVERSWHAT}
-
 ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
-b ${BTXKERN} ${LOADER}.bin

Modified: head/sys/boot/mips/beri/loader/Makefile
==
--- head/sys/boot/mips/beri/loader/Makefile Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/mips/beri/loader/Makefile Mon Dec 19 14:40:59 2016
(r310267)
@@ -92,7 +92,7 @@ CFLAGS+=  -I${.CURD

svn commit: r310268 - in head: share/mk sys/boot/common tools/build/options

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 14:45:59 2016
New Revision: 310268
URL: https://svnweb.freebsd.org/changeset/base/310268

Log:
  Build loaders reproducibly when WITH_REPRODUCIBLE_BUILD
  
  When WITH_REPRODUCIBLE_BUILD=yes is set in src.conf(5), eliminate the
  time, user, and host from the loader's version information.  This allows
  builds to produce bit-for-bit identical output.
  
  Reviewed by:  bapt
  MFC after:1 month
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8842

Modified:
  head/share/mk/src.opts.mk
  head/sys/boot/common/Makefile.inc
  head/sys/boot/common/newvers.sh
  head/tools/build/options/WITH_REPRODUCIBLE_BUILD

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Mon Dec 19 14:40:59 2016(r310267)
+++ head/share/mk/src.opts.mk   Mon Dec 19 14:45:59 2016(r310268)
@@ -190,6 +190,7 @@ __DEFAULT_NO_OPTIONS = \
 OFED \
 OPENLDAP \
 RCS \
+REPRODUCIBLE_BUILD \
 SHARED_TOOLCHAIN \
 SORT_THREADS \
 SVN \

Modified: head/sys/boot/common/Makefile.inc
==
--- head/sys/boot/common/Makefile.inc   Mon Dec 19 14:40:59 2016
(r310267)
+++ head/sys/boot/common/Makefile.inc   Mon Dec 19 14:45:59 2016
(r310268)
@@ -74,5 +74,9 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/lib
 
 CLEANFILES+=   vers.c
 VERSION_FILE?= ${.CURDIR}/version
+.if ${MK_REPRODUCIBLE_BUILD} != no
+REPRO_FLAG=-r
+.endif
 vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE}
-   sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT}
+   sh ${SRCTOP}/sys/boot/common/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
+   ${NEWVERSWHAT}

Modified: head/sys/boot/common/newvers.sh
==
--- head/sys/boot/common/newvers.sh Mon Dec 19 14:40:59 2016
(r310267)
+++ head/sys/boot/common/newvers.sh Mon Dec 19 14:45:59 2016
(r310268)
@@ -35,11 +35,26 @@
 tempfile=$(mktemp tmp.XX) || exit
 trap "rm -f $tempfile" EXIT INT TERM
 
+include_metadata=true
+while getopts r opt; do
+   case "$opt" in
+   r)
+   include_metadata=
+   ;;
+   esac
+done
+shift $((OPTIND - 1))
+
 LC_ALL=C; export LC_ALL
 u=${USER-root} h=${HOSTNAME-`hostname`} t=`date`
 #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '`
 r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1`
 
-echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} 
${u}@${h})\\n\";" > $tempfile
+bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n"
+if [ -n "${include_metadata}" ]; then
+   bootprog_info="$bootprog_info(${t} ${u}@${h})\\n"
+fi
+
+echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile
 echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile
 mv $tempfile vers.c

Modified: head/tools/build/options/WITH_REPRODUCIBLE_BUILD
==
--- head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 14:40:59 
2016(r310267)
+++ head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 14:45:59 
2016(r310268)
@@ -1,3 +1,4 @@
 $FreeBSD$
-Set to exclude build metadata (build time, user, host and path) from the
-kernel and uname output.
+Set to exclude build metadata (such as the build time, user, or host)
+from the kernel, boot loaders, and uname output, so that builds produce
+bit-for-bit identical output.
___
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: r310269 - head/share/man/man5

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 14:54:06 2016
New Revision: 310269
URL: https://svnweb.freebsd.org/changeset/base/310269

Log:
  src.conf.5: regen after r310268 (WITH_REPRODUCIBLE_BUILD)

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Mon Dec 19 14:45:59 2016
(r310268)
+++ head/share/man/man5/src.conf.5  Mon Dec 19 14:54:06 2016
(r310269)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 306729 2016-10-05 20:12:00Z 
emaste
 .\" $FreeBSD$
-.Dd December 10, 2016
+.Dd December 19, 2016
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -1368,6 +1368,11 @@ This includes
 .Xr rlogin 1 ,
 .Xr rsh 1 ,
 etc.
+.It Va WITH_REPRODUCIBLE_BUILD
+from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 
2016-12-19 14:45:59Z emaste
+Set to exclude build metadata (such as the build time, user, or host)
+from the kernel, boot loaders, and uname output, so that builds produce
+bit-for-bit identical output.
 .It Va WITHOUT_RESCUE
 .\" from FreeBSD: head/tools/build/options/WITHOUT_RESCUE 156932 2006-03-21 
07:50:50Z ru
 Set to not build
___
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: r310270 - head/share/man/man5

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 15:05:46 2016
New Revision: 310270
URL: https://svnweb.freebsd.org/changeset/base/310270

Log:
  Restore missing comment in src.conf.5
  
  I'm not sure how I managed to generate src.conf.5 without the comment;
  add it manually while looking into that.
  
  Reported by:  gjb

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Mon Dec 19 14:54:06 2016
(r310269)
+++ head/share/man/man5/src.conf.5  Mon Dec 19 15:05:46 2016
(r310270)
@@ -1369,7 +1369,7 @@ This includes
 .Xr rsh 1 ,
 etc.
 .It Va WITH_REPRODUCIBLE_BUILD
-from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 
2016-12-19 14:45:59Z emaste
+.\" from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 
2016-12-19 14:45:59Z emaste
 Set to exclude build metadata (such as the build time, user, or host)
 from the kernel, boot loaders, and uname output, so that builds produce
 bit-for-bit identical output.
___
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: r310271 - head/tools/build/options

2016-12-19 Thread Glen Barber
Author: gjb
Date: Mon Dec 19 15:09:30 2016
New Revision: 310271
URL: https://svnweb.freebsd.org/changeset/base/310271

Log:
  Comment the RCSID.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tools/build/options/WITH_REPRODUCIBLE_BUILD

Modified: head/tools/build/options/WITH_REPRODUCIBLE_BUILD
==
--- head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 15:05:46 
2016(r310270)
+++ head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 15:09:30 
2016(r310271)
@@ -1,4 +1,4 @@
-$FreeBSD$
+.\" $FreeBSD$
 Set to exclude build metadata (such as the build time, user, or host)
 from the kernel, boot loaders, and uname output, so that builds produce
 bit-for-bit identical output.
___
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: r310272 - in head/sys/cam: ctl scsi

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 15:18:31 2016
New Revision: 310272
URL: https://svnweb.freebsd.org/changeset/base/310272

Log:
  Add new bits into Extended Inquiry VPD page.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 15:09:30 2016(r310271)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 15:18:31 2016(r310272)
@@ -9542,7 +9542,7 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio *
 * attention for a particular IT nexus on all LUNs once we report
 * it to that nexus once.  This bit is required as of SPC-4.
 */
-   eid_ptr->flags4 = SVPD_EID_LUICLT;
+   eid_ptr->flags4 = SVPD_EID_LUICLR;
 
/*
 * XXX KDM in order to correctly answer this, we would need

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hMon Dec 19 15:09:30 2016
(r310271)
+++ head/sys/cam/scsi/scsi_all.hMon Dec 19 15:18:31 2016
(r310272)
@@ -2476,10 +2476,17 @@ struct scsi_vpd_extended_inquiry_data
 #defineSVPD_EID_NV_SUP 0x02
 #defineSVPD_EID_V_SUP  0x01
uint8_t flags4;
+#defineSVPD_EID_NO_PI_CHK  0x20
 #defineSVPD_EID_P_I_I_SUP  0x10
-#defineSVPD_EID_LUICLT 0x01
+#defineSVPD_EID_LUICLR 0x01
uint8_t flags5;
+#defineSVPD_EID_LUCT_MASK  0xe0
+#defineSVPD_EID_LUCT_NOT_REP   0x00
+#defineSVPD_EID_LUCT_CONGL 0x20
+#defineSVPD_EID_LUCT_GROUP 0x40
 #defineSVPD_EID_R_SUP  0x10
+#defineSVPD_EID_RTD_SUP0x08
+#defineSVPD_EID_HSSRELEF   0x02
 #defineSVPD_EID_CBCS   0x01
uint8_t flags6;
 #defineSVPD_EID_MULTI_I_T_FW   0x0F
@@ -2490,10 +2497,16 @@ struct scsi_vpd_extended_inquiry_data
uint8_t est[2];
uint8_t flags7;
 #defineSVPD_EID_POA_SUP0x80
-#defineSVPD_EID_HRA_SUP0x80
-#defineSVPD_EID_VSA_SUP0x80
+#defineSVPD_EID_HRA_SUP0x40
+#defineSVPD_EID_VSA_SUP0x20
uint8_t max_sense_length;
-   uint8_t reserved2[50];
+   uint8_t bind_flags;
+#defineSVPD_EID_IBS0x80
+#defineSVPD_EID_IAS0x40
+#defineSVPD_EID_SAC0x04
+#defineSVPD_EID_NRD1   0x02
+#defineSVPD_EID_NRD0   0x01
+   uint8_t reserved2[49];
 };
 
 struct scsi_vpd_mode_page_policy_descr
___
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: r310273 - head/sys/conf

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 15:19:44 2016
New Revision: 310273
URL: https://svnweb.freebsd.org/changeset/base/310273

Log:
  newvers.sh: add -R option to include metadata only for unmodified src tree
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==
--- head/sys/conf/newvers.shMon Dec 19 15:18:31 2016(r310272)
+++ head/sys/conf/newvers.shMon Dec 19 15:19:44 2016(r310273)
@@ -37,6 +37,10 @@
 #  the output file.  This is intended to allow two builds
 #  done at different times and even by different people on
 #  different hosts to produce identical output.
+#
+# -R   Reproducible build if the tree represents an unmodified
+#  checkout from a version control system.  Metadata is
+#  included if the tree is modified.
 
 TYPE="FreeBSD"
 REVISION="12.0"
@@ -193,6 +197,9 @@ fi
 
 if [ -n "$svnversion" ] ; then
svn=`cd ${SYSDIR} && $svnversion 2>/dev/null`
+   if expr "$svn" : ".*M" >/dev/null; then
+   modified=true
+   fi
case "$svn" in
[0-9]*) svn=" r${svn}" ;;
*)  unset svn ;;
@@ -227,6 +234,7 @@ if [ -n "$git_cmd" ] ; then
if $git_cmd --work-tree=${VCSDIR}/.. diff-index \
--name-only HEAD | read dummy; then
git="${git}-dirty"
+   modified=true
fi
 fi
 
@@ -239,7 +247,10 @@ if [ -n "$p4_cmd" ] ; then
p4opened=`cd ${SYSDIR} && $p4_cmd opened ./... 2>&1`
case "$p4opened" in
File*) ;;
-   //*)p4version="${p4version}+edit" ;;
+   //*)
+   p4version="${p4version}+edit"
+   modified=true
+   ;;
esac
;;
*)  unset p4version ;;
@@ -264,6 +275,10 @@ while getopts r opt; do
r)
include_metadata=
;;
+   R)
+   if [ -z "${modified}" ]; then
+   include_metadata=
+   fi
esac
 done
 shift $((OPTIND - 1))
___
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: r310274 - head

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 15:23:24 2016
New Revision: 310274
URL: https://svnweb.freebsd.org/changeset/base/310274

Log:
  Add ld.debug to ObsoleteFiles.inc
  
  After r293285 GNU ld is installed as /usr/bin/ld.bfd, and linked as
  /usr/bin/ld.  The debug file is /usr/lib/debug/usr/bin/ld.bfd.debug.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Dec 19 15:19:44 2016(r310273)
+++ head/ObsoleteFiles.inc  Mon Dec 19 15:23:24 2016(r310274)
@@ -642,6 +642,8 @@ OLD_FILES+=usr/share/mdocml/style.css
 OLD_DIRS+=usr/share/mdocml
 # 20160114: SA-16:06.snmpd
 OLD_FILES+=usr/share/examples/etc/snmpd.config
+# 20160107: GNU ld installed as ld.bfd and linked as ld
+OLD_FILES+=usr/lib/debug/usr/bin/ld.debug
 # 20151225: new clang import which bumps version from 3.7.0 to 3.7.1.
 OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/asan_interface.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"


svn commit: r310275 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 15:49:59 2016
New Revision: 310275
URL: https://svnweb.freebsd.org/changeset/base/310275

Log:
  Fix typo in function name.

Modified:
  head/sys/cam/ctl/ctl_error.c

Modified: head/sys/cam/ctl/ctl_error.c
==
--- head/sys/cam/ctl/ctl_error.cMon Dec 19 15:23:24 2016
(r310274)
+++ head/sys/cam/ctl/ctl_error.cMon Dec 19 15:49:59 2016
(r310275)
@@ -366,7 +366,7 @@ ctl_set_ua(struct ctl_scsiio *ctsio, int
 }
 
 static void
-ctl_ua_to_acsq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
+ctl_ua_to_ascq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
 int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info)
 {
 
@@ -492,7 +492,7 @@ ctl_build_qae(struct ctl_lun *lun, uint3
ua_to_build = (1 << (ffs(ua) - 1));
ua_to_clear = ua_to_build;
info = NULL;
-   ctl_ua_to_acsq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
+   ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
 
resp[0] = SSD_KEY_UNIT_ATTENTION;
if (ua_to_build == ua)
@@ -537,7 +537,7 @@ ctl_build_ua(struct ctl_lun *lun, uint32
ua_to_build = (1 << (ffs(ua[i]) - 1));
ua_to_clear = ua_to_build;
info = NULL;
-   ctl_ua_to_acsq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
+   ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
 
ctl_set_sense_data(sense, lun, sense_format, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq,
___
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: r307684 - head/sbin/camcontrol

2016-12-19 Thread Kenneth D. Merry
On Sat, Dec 17, 2016 at 20:50:15 +0100, Oliver Pinter wrote:
> On 12/12/16, Kenneth D. Merry  wrote:
> > On Sun, Dec 11, 2016 at 00:49:12 +0100, Oliver Pinter wrote:
> >> On 10/20/16, Kenneth D. Merry  wrote:
> >> > Author: ken
> >> > Date: Thu Oct 20 19:42:26 2016
> >> > New Revision: 307684
> >> > URL: https://svnweb.freebsd.org/changeset/base/307684
> >> >
> >> > Log:
> >> >   For CCBs allocated on the stack, we need to clear the entire CCB, not
> >> > just
> >> >   the header.  Otherwise stack garbage can lead to random flags getting
> >> > set.
> >> >
> >> >   This showed up as 'camcontrol rescan all' failing with EINVAL because
> >> > the
> >> >   address type wasn't CAM_DATA_VADDR.
> >> >
> >> >   sbin/camcontrol/camcontrol.c:
> >> >  In rescan_or_reset_bus(), bzero the stack-allocated CCBs before
> >> >  use instead of clearing the body.
> >> >
> >> >   MFC after: 3 days
> >> >   Sponsored by:  Spectra Logic
> >>
> >> The MFC of this commit is missed both for 10-STABLE and 11-STABLE. Is
> >> this still in plan to do?
> >
> > Done, thanks for the reminder!
> 
> Thanks!
> 
> Slightly related problem what I found on one of my INVARIANTS enabled
> kernel is the following:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215356 . A similar
> change what this is required in smartmontools too.

Ahh, yes, sounds like the same basic issue.  Thanks for submitting it
upstream!

Ken
-- 
Kenneth Merry
k...@freebsd.org
___
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: r310138 - head/lib/libc/stdio

2016-12-19 Thread John Baldwin
On Friday, December 16, 2016 07:31:28 PM Eric van Gyzen wrote:
> On 12/16/2016 17:44, Warner Losh wrote:
> > On Fri, Dec 16, 2016 at 3:07 PM, John Baldwin  wrote:
> >> On Friday, December 16, 2016 04:53:04 PM Eric van Gyzen wrote:
> >>> On 12/16/2016 16:45, John Baldwin wrote:
>  On Friday, December 16, 2016 08:53:26 PM Dimitry Andric wrote:
> > On 16 Dec 2016, at 20:31, Baptiste Daroussin  wrote:
> >>
> >> On Fri, Dec 16, 2016 at 01:44:51AM +, Conrad E. Meyer wrote:
> >>> Author: cem
> >>> Date: Fri Dec 16 01:44:50 2016
> >>> New Revision: 310138
> >>> URL: https://svnweb.freebsd.org/changeset/base/310138
> >>>
> >>> Log:
> >>>  vfprintf(3): Add support for kernel %b format
> >>>
> >>>  This is a direct port of the kernel %b format.
> >>>
> >>>  I'm unclear on if (more) non-portable printf extensions will be a
> >>>  problem. I think it's desirable to have userspace formats include all
> >>>  kernel formats, but there may be competing goals I'm not aware of.
> >>>
> >>>  Reviewed by:no one, unfortunately
> >>>  Sponsored by:   Dell EMC Isilon
> >>>  Differential Revision:  https://reviews.freebsd.org/D8426
> >>>
> >>
> >> I really don't think it is a good idea, if used in userland it would 
> >> be make
> >> more of our code difficult to port elsewhere.
> >
> > Indeed, this is a bad idea.  These custom format specifiers should be
> > eliminated, not multiplied. :-)
> >
> >
> >> Other than that, it makes more difficult to use vanilla gcc with out 
> >> userland.
> >> and it is adding more complexity to be able to build freebsd from a 
> >> non freebsd
> >> system which some people are working on.
> >>
> >> Personnaly I would prefer to see those extensions removed from the 
> >> kernel rather
> >> than see them available in userland.
> >
> > Same here.
> >
> >
> >> Can't we use simple helper function instead?
> >
> > Yes, please.  Just take the snprintb(3) function from NetBSD:
> >
> > http://netbsd.gw.com/cgi-bin/man-cgi?snprintb+3+NetBSD-current
> 
>  In general I agree with something like this instead, but it is quite a 
>  bit more
>  tedious to use as you have to run it once to determine the length, 
>  allocate a
>  buffer, and then run it again.  Calling malloc() for that buffer isn't 
>  always
>  convenient in the kernel (though it should be fine in userland).  Having 
>  it live
>  in printf() itself means the output is generated to the stream without 
>  having to
>  manage a variable-sized intermediate buffer.
> >>>
> >>> I imagine most callers can simply use a char[sizeof(fmt)+C] on the stack, 
> >>> where
> >>> C is some constant that I haven't taken the time to calculate, at the 
> >>> risk of
> >>> making myself look foolish and unprofessional.
> >>
> >> Hmm, that might work, but it is still cumbersome.  Probably to make things 
> >> readable
> >> we'd end up with a wrapper:
> >>
> >> printb(uint val, const char *fmt)
> >> {
> >>char buf[strlen(fmt) + C];
> >>
> >>snprintb(...);
> >>printf("%s", buf);
> >> }
> > 
> > Sadly this "cure" is worse than the disease.
> 
> How about this cure?
> 
>   printf("reg=%b\n", value, FORMAT);
> 
>   // versus
> 
>   char buf[BITMASK_BUFFER_SIZE(FORMAT)];
>   printf("reg=%s\n", format_bitmask(buf, sizeof(buf), value, FORMAT));
> 
> That doesn't seem so bad.

The trick here is giving FORMAT twice.  For code that often uses %b that
is untenable.  You would have to make it a macro (or use printb which only
accepts it once which is why I suggested that approach instead).  But a
macro moves its definition out of context.  Here's an example to think about:

/*
 * Here we should probably set up flags indicating
 * whether or not various features are available.
 * The interesting ones are probably VME, PSE, PAE,
 * and PGE.  The code already assumes without bothering
 * to check that all CPUs >= Pentium have a TSC and
 * MSRs.
 */
printf("\n  Features=0x%b", cpu_feature,
"\020"
"\001FPU"   /* Integral FPU */
"\002VME"   /* Extended VM86 mode support */
"\003DE"/* Debugging Extensions (CR4.DE) */
"\004PSE"   /* 4MByte page tables */
"\005TSC"   /* Timestamp counter */
"\006MSR"   /* Machine specific registers */
"\007PAE"   /* Physical address extension */
"\010MCE"   /* Machine Check support */
"\011CX8"

Re: svn commit: r310242 - head/sys/dev/usb

2016-12-19 Thread John Baldwin
On Monday, December 19, 2016 09:28:13 AM Hans Petter Selasky wrote:
> Author: hselasky
> Date: Mon Dec 19 09:28:12 2016
> New Revision: 310242
> URL: https://svnweb.freebsd.org/changeset/base/310242
> 
> Log:
>   Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid
>   boot panics in conjunction with the recently added EARLY_AP_STARTUP feature.
>   The panics happen due to using kernel facilities like callouts too early.
>   
>   Tested by:  jhb @
>   MFC after:  1 week

As mentioned in the thread, the patches to usb_hub.c weren't needed and the 
block
in usb_process.c can just be removed unconditionally since it should never 
execute
in the non-EARLY_AP_STARTUP case.

-- 
John Baldwin
___
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: r310278 - head/usr.sbin/syslogd

2016-12-19 Thread Hiroki Sato
Author: hrs
Date: Mon Dec 19 17:10:30 2016
New Revision: 310278
URL: https://svnweb.freebsd.org/changeset/base/310278

Log:
  Add a missing STAILQ_INSERT_TAIL() for allowaddr rule.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Mon Dec 19 17:05:24 2016
(r310277)
+++ head/usr.sbin/syslogd/syslogd.c Mon Dec 19 17:10:30 2016
(r310278)
@@ -2303,7 +2303,7 @@ static int
 allowaddr(char *s)
 {
char *cp1, *cp2;
-   struct allowedpeer ap;
+   struct allowedpeer *ap;
struct servent *se;
int masklen = -1;
struct addrinfo hints, *res;
@@ -2314,6 +2314,10 @@ allowaddr(char *s)
 #endif
char ip[NI_MAXHOST];
 
+   ap = calloc(1, sizeof(*ap));
+   if (ap == NULL)
+   err(1, "malloc failed");
+
 #ifdef INET6
if (*s != '[' || (cp1 = strchr(s + 1, ']')) == NULL)
 #endif
@@ -2323,20 +2327,20 @@ allowaddr(char *s)
*cp1++ = '\0';
if (strlen(cp1) == 1 && *cp1 == '*')
/* any port allowed */
-   ap.port = 0;
+   ap->port = 0;
else if ((se = getservbyname(cp1, "udp"))) {
-   ap.port = ntohs(se->s_port);
+   ap->port = ntohs(se->s_port);
} else {
-   ap.port = strtol(cp1, &cp2, 0);
+   ap->port = strtol(cp1, &cp2, 0);
if (*cp2 != '\0')
return (-1); /* port not numeric */
}
} else {
if ((se = getservbyname("syslog", "udp")))
-   ap.port = ntohs(se->s_port);
+   ap->port = ntohs(se->s_port);
else
/* sanity, should not happen */
-   ap.port = 514;
+   ap->port = 514;
}
 
if ((cp1 = strchr(s, '/')) != NULL &&
@@ -2363,14 +2367,14 @@ allowaddr(char *s)
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
if (getaddrinfo(s, NULL, &hints, &res) == 0) {
-   ap.isnumeric = 1;
-   memcpy(&ap.a_addr, res->ai_addr, res->ai_addrlen);
-   memset(&ap.a_mask, 0, sizeof(ap.a_mask));
-   ap.a_mask.ss_family = res->ai_family;
+   ap->isnumeric = 1;
+   memcpy(&ap->a_addr, res->ai_addr, res->ai_addrlen);
+   memset(&ap->a_mask, 0, sizeof(ap->a_mask));
+   ap->a_mask.ss_family = res->ai_family;
if (res->ai_family == AF_INET) {
-   ap.a_mask.ss_len = sizeof(struct sockaddr_in);
-   maskp = &((struct sockaddr_in *)&ap.a_mask)->sin_addr;
-   addrp = &((struct sockaddr_in *)&ap.a_addr)->sin_addr;
+   ap->a_mask.ss_len = sizeof(struct sockaddr_in);
+   maskp = &((struct sockaddr_in *)&ap->a_mask)->sin_addr;
+   addrp = &((struct sockaddr_in *)&ap->a_addr)->sin_addr;
if (masklen < 0) {
/* use default netmask */
if (IN_CLASSA(ntohl(addrp->s_addr)))
@@ -2394,10 +2398,10 @@ allowaddr(char *s)
}
 #ifdef INET6
else if (res->ai_family == AF_INET6 && masklen <= 128) {
-   ap.a_mask.ss_len = sizeof(struct sockaddr_in6);
+   ap->a_mask.ss_len = sizeof(struct sockaddr_in6);
if (masklen < 0)
masklen = 128;
-   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)&ap.a_mask)->sin6_addr;
+   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)&ap->a_mask)->sin6_addr;
/* convert masklen to netmask */
while (masklen > 0) {
if (masklen < 32) {
@@ -2408,8 +2412,8 @@ allowaddr(char *s)
masklen -= 32;
}
/* Lose any host bits in the network number. */
-   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)&ap.a_mask)->sin6_addr;
-   addr6p = (u_int32_t *)&((struct sockaddr_in6 
*)&ap.a_addr)->sin6_addr;
+   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)&ap->a_mask)->sin6_addr;
+   addr6p = (u_int32_t *)&((struct sockaddr_in6 
*)&ap->a_addr)->sin6_addr;
for (i = 0; i < 4; i++)
addr6p[i] &= mask6p[i];
}
@@ -2421,8 +2425,8 @@ allowaddr(char *s)
freeaddrinfo(res);
} else {
/* arg `s' is domain name */
-   ap.isnumeric = 0;
-   

svn commit: r310279 - head/sys/conf

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 17:31:34 2016
New Revision: 310279
URL: https://svnweb.freebsd.org/changeset/base/310279

Log:
  newvers.sh: consider as modified SVN mixed revision and other cases
  
  The newvers -R option is intended to include build metadata (e.g. user,
  host, time) if the build is from an unmodified VCS tree. For subversion
  it considered a trailing 'M' as an indication of a modified tree, and
  any other version string as modified.
  
  Also include mixed revision checkouts (e.g. 123:126), switched (123S)
  and partial (123P) working copies as modified: the revision number is
  insufficient to uniquely determine which source was used for the build.
  
  Reported by:  gjb
  Reviewed by:  gjb
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8853

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==
--- head/sys/conf/newvers.shMon Dec 19 17:10:30 2016(r310278)
+++ head/sys/conf/newvers.shMon Dec 19 17:31:34 2016(r310279)
@@ -197,12 +197,17 @@ fi
 
 if [ -n "$svnversion" ] ; then
svn=`cd ${SYSDIR} && $svnversion 2>/dev/null`
-   if expr "$svn" : ".*M" >/dev/null; then
-   modified=true
-   fi
case "$svn" in
-   [0-9]*) svn=" r${svn}" ;;
-   *)  unset svn ;;
+   [0-9]*[MSP]|*:*)
+   svn=" r${svn}"
+   modified=true
+   ;;
+   [0-9]*)
+   svn=" r${svn}"
+   ;;
+   *)
+   unset svn
+   ;;
esac
 fi
 
@@ -270,7 +275,7 @@ if [ -n "$hg_cmd" ] ; then
 fi
 
 include_metadata=true
-while getopts r opt; do
+while getopts rR opt; do
case "$opt" in
r)
include_metadata=
___
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: r307774 - head/lib/libusb

2016-12-19 Thread Edward Tomasz Napierala
On 1211T0110, Oliver Pinter wrote:
> On 10/22/16, Edward Tomasz Napierala  wrote:
> > Author: trasz
> > Date: Sat Oct 22 14:37:13 2016
> > New Revision: 307774
> > URL: https://svnweb.freebsd.org/changeset/base/307774
> >
> > Log:
> >   Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not
> >   "product vendor". This is consistent with how it's generally done.
> >   The ordering is visible eg in usbconfig(8) output.
> >
> >   Note to self: MFC this to 9 and 8.
> >
> >   Reviewed by:  hselasky@
> >   MFC after:1 month
> 
> Is this MFC still valid? I can't see them in 10-STABLE nor in 11-STABLE.

Working on it, thanks for the reminder :-)

___
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: r310242 - head/sys/dev/usb

2016-12-19 Thread Hans Petter Selasky

On 12/19/16 17:13, John Baldwin wrote:

On Monday, December 19, 2016 09:28:13 AM Hans Petter Selasky wrote:

Author: hselasky
Date: Mon Dec 19 09:28:12 2016
New Revision: 310242
URL: https://svnweb.freebsd.org/changeset/base/310242

Log:
  Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid
  boot panics in conjunction with the recently added EARLY_AP_STARTUP feature.
  The panics happen due to using kernel facilities like callouts too early.

  Tested by:jhb @
  MFC after:1 week


As mentioned in the thread, the patches to usb_hub.c weren't needed and the 
block
in usb_process.c can just be removed unconditionally since it should never 
execute
in the non-EARLY_AP_STARTUP case.



Hi John,

The checks in usb_process.c are needed in case attaching a USB 
controller fails for some unknown reason. Then there is a problem that 
thread0 cannot wait/sleep for the process to exit, so that it doesn't 
access freed memory. Did I miss anything?


--HPS
___
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: r310284 - head/sys/cam/scsi

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 18:55:10 2016
New Revision: 310284
URL: https://svnweb.freebsd.org/changeset/base/310284

Log:
  When writing fixed format sense data, set VALID bit only if provided value
  for INFORMATION field fit into available 4 bytes (has no non-zero bytes
  except last 4), as explicitly required by SPC-5 specification.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_all.c

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cMon Dec 19 18:32:26 2016
(r310283)
+++ head/sys/cam/scsi/scsi_all.cMon Dec 19 18:55:10 2016
(r310284)
@@ -4020,11 +4020,17 @@ scsi_set_sense_data_va(struct scsi_sense
data_dest = &sense->info[0];
len_to_copy = MIN(sense_len,
sizeof(sense->info));
-   /*
-* We're setting the info field, so
-* set the valid bit.
-*/
-   sense->error_code |= SSD_ERRCODE_VALID;
+
+   /* Set VALID bit only if no overflow. */
+   for (i = 0; i < sense_len - len_to_copy;
+   i++) {
+   if (data[i] != 0)
+   break;
+   }
+   if (i >= sense_len - len_to_copy) {
+   sense->error_code |=
+   SSD_ERRCODE_VALID;
+   }
}
 
/*
___
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: r310171 - head/sys/sys

2016-12-19 Thread Warner Losh
On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala  wrote:
> -Original Message-
>> From:  on behalf of Sepherosa Ziehau 
>> 
>> Date: 2016-12-18, Sunday at 23:02
>> To: Dimitry Andric 
>> Cc: , , 
>> 
>> Subject: Re: svn commit: r310171 - head/sys/sys
>>
>> The following patch unbreaks the LINT builds on amd64 for me after this 
>> commit:
>> https://people.freebsd.org/~sephe/geom_sscanf.diff
>
> Wouldn't it be better to use the SCN macros?

Are there other precedence for avoiding the SCN macros in the tree as
well, or is this new art?

Warner

>> Thanks,
>> sephe
>>
>>
>> On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andric  wrote:
>>> Author: dim
>>> Date: Fri Dec 16 19:49:22 2016
>>> New Revision: 310171
>>> URL: https://svnweb.freebsd.org/changeset/base/310171
>>>
>>> Log:
>>>   Add __scanflike attributes to the kernel's sscanf() and vsscanf()
>>>   declarations.  This should help to catch future mismatches between
>>>   format strings and arguments.
>>>
>>>   MFC after:1 week
>>>
>>> Modified:
>>>   head/sys/sys/systm.h
>>>
>>> Modified: head/sys/sys/systm.h
>>> ==
>>> --- head/sys/sys/systm.hFri Dec 16 19:09:57 2016(r310170)
>>> +++ head/sys/sys/systm.hFri Dec 16 19:49:22 2016(r310171)
>>> @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char
>>>  intvsnrprintf(char *, size_t, int, const char *, __va_list) 
>>> __printflike(4, 0);
>>>  intvsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
>>>  intttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
>>> -intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);
>>> -intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>>> __nonnull(2);
>>> +intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) 
>>> __scanflike(2, 3);
>>> +intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>>> __nonnull(2) __scanflike(2, 0);
>>>  long   strtol(const char *, char **, int) __nonnull(1);
>>>  u_long strtoul(const char *, char **, int) __nonnull(1);
>>>  quad_t strtoq(const char *, char **, int) __nonnull(1);
>>> ___
>>> svn-src-...@freebsd.org mailing list
>>> https://lists.freebsd.org/mailman/listinfo/svn-src-all
>>> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
>>
>> --
>> Tomorrow Will Never Die
>
>
>
>
___
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: r310285 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 19:00:03 2016
New Revision: 310285
URL: https://svnweb.freebsd.org/changeset/base/310285

Log:
  When reporting "Logical block address out of range" error, report the LBA
  in sense data INFORMATION field.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_error.c
  head/sys/cam/ctl/ctl_error.h
  head/sys/cam/ctl/ctl_tpc.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 18:55:10 2016(r310284)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 19:00:03 2016(r310285)
@@ -5362,7 +5362,8 @@ ctl_sync_cache(struct ctl_scsiio *ctsio)
 * to see an error for an out of range LBA.
 */
if ((starting_lba + block_count) > (lun->be_lun->maxlba + 1)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(starting_lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
goto bailout;
}
@@ -5678,7 +5679,8 @@ ctl_write_same(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -5791,7 +5793,8 @@ ctl_unmap(struct ctl_scsiio *ctsio)
num_blocks = scsi_4btoul(range->length);
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -6995,7 +6998,7 @@ ctl_get_lba_status(struct ctl_scsiio *ct
alloc_len = scsi_4btoul(cdb->alloc_len);
 
if (lba > lun->be_lun->maxlba) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio, lba);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -8785,7 +8788,8 @@ ctl_read_write(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -8894,7 +8898,8 @@ ctl_cnw(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -9005,7 +9010,8 @@ ctl_verify(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}

Modified: head/sys/cam/ctl/ctl_error.c
==
--- head/sys/cam/ctl/ctl_error.cMon Dec 19 18:55:10 2016
(r310284)
+++ head/sys/cam/ctl/ctl_error.cMon Dec 19 19:00:03 2016
(r310285)
@@ -181,8 +181,8 @@ ctl_sense_to_desc(struct scsi_sense_data
   /*asc*/ sense_src->add_sense_code,
   /*ascq*/ sense_src->add_sense_code_qual,
 
-  /* Information Bytes */ 
-  (scsi_4btoul(sense_src->info) != 0) ?
+  /* Information Bytes */
+  (sense_src->error_code & SSD_ERRCODE_VALID) ?
   SSD_ELEM_INFO : SSD_ELEM_SKIP,
   sizeof(sense_src->info),
   sense_src->info,
@@ -727,14 +727,20 @@ ctl_set_aborted(struct ctl_scsiio *ctsio
 }
 
 void
-ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio)
+ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba)
 {
+   uint8_t info[8];
+
+   scsi_u64to8b(lba, info);
+
/* "Logical block address out of range" */
ctl_set_sense(ctsio,
  /*current_error*/ 1,
  

Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Dimitry Andric
On 19 Dec 2016, at 19:58, Warner Losh  wrote:
> 
> On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala  wrote:
>> -Original Message-
>>> From:  on behalf of Sepherosa Ziehau 
>>> 
>>> Date: 2016-12-18, Sunday at 23:02
>>> To: Dimitry Andric 
>>> Cc: , , 
>>> 
>>> Subject: Re: svn commit: r310171 - head/sys/sys
>>> 
>>> The following patch unbreaks the LINT builds on amd64 for me after this 
>>> commit:
>>> https://people.freebsd.org/~sephe/geom_sscanf.diff
>> 
>> Wouldn't it be better to use the SCN macros?
> 
> Are there other precedence for avoiding the SCN macros in the tree as
> well, or is this new art?

I personally don't have anything against using the PRI or SCN macros,
but traditionally there has been some backlash against it, if I recall
correctly.  It also requires including either  or
, depending on circumstance or preference.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Ian Lepore
On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:
> On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala  wrote:
> > 
> > -Original Message-
> > > 
> > > From:  on behalf of Sepherosa
> > > Ziehau 
> > > Date: 2016-12-18, Sunday at 23:02
> > > To: Dimitry Andric 
> > > Cc: , ,  > > -src-h...@freebsd.org>
> > > Subject: Re: svn commit: r310171 - head/sys/sys
> > > 
> > > The following patch unbreaks the LINT builds on amd64 for me
> > > after this commit:
> > > https://people.freebsd.org/~sephe/geom_sscanf.diff
> > Wouldn't it be better to use the SCN macros?
> Are there other precedence for avoiding the SCN macros in the tree as
> well, or is this new art?
> 
> Warner

There was another commit recently the fixed the same kind of scanf
error by making the variable fit the scanf type (changing uint64_t to
an explicit long long unsigned, iirc).  I don't know if that alone
counts as a precedent, but IMO it's a more palatible fix than the
SCN/PRI ugliness.

-- Ian

___
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: r310286 - head/sys/netinet6

2016-12-19 Thread Mark Johnston
Author: markj
Date: Mon Dec 19 19:21:28 2016
New Revision: 310286
URL: https://svnweb.freebsd.org/changeset/base/310286

Log:
  Remove a bogus KASSERT from nd6_prefix_unlink().
  
  The caller may unlink a prefix before purging referencing addresses. An
  identical assertion in nd6_prefix_del() verifies that the addresses are
  purged before the prefix is freed.
  
  PR:   215372
  X-MFC With:   r306829

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Mon Dec 19 19:00:03 2016(r310285)
+++ head/sys/netinet6/nd6_rtr.c Mon Dec 19 19:21:28 2016(r310286)
@@ -1122,8 +1122,6 @@ void
 nd6_prefix_unlink(struct nd_prefix *pr, struct nd_prhead *list)
 {
 
-   KASSERT(pr->ndpr_addrcnt == 0,
-   ("prefix %p has referencing addresses", pr));
ND6_WLOCK_ASSERT();
 
LIST_REMOVE(pr, ndpr_entry);
___
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: r310289 - head/sys/dev/uart

2016-12-19 Thread Jayachandran C.
Author: jchandra
Date: Mon Dec 19 19:40:11 2016
New Revision: 310289
URL: https://svnweb.freebsd.org/changeset/base/310289

Log:
  Fix whitespace issues in pl011 uart driver
  
  Fix up trailing whitespace introduced by r310190. While there,
  fix a couple of earlier whitespace errors as well.

Modified:
  head/sys/dev/uart/uart_dev_pl011.c

Modified: head/sys/dev/uart/uart_dev_pl011.c
==
--- head/sys/dev/uart/uart_dev_pl011.c  Mon Dec 19 19:39:02 2016
(r310288)
+++ head/sys/dev/uart/uart_dev_pl011.c  Mon Dec 19 19:40:11 2016
(r310289)
@@ -173,7 +173,7 @@ uart_pl011_param(struct uart_bas *bas, i
line &= ~LCR_H_PEN;
 
/* Configure the rest */
-   line &=  ~LCR_H_FEN;
+   line &= ~LCR_H_FEN;
ctrl |= (CR_RXE | CR_TXE | CR_UARTEN);
 
if (bas->rclk != 0 && baudrate != 0) {
@@ -196,7 +196,7 @@ uart_pl011_init(struct uart_bas *bas, in
/* Mask all interrupts */
__uart_setreg(bas, UART_IMSC, __uart_getreg(bas, UART_IMSC) &
~IMSC_MASK_ALL);
-   
+
uart_pl011_param(bas, baudrate, databits, stopbits, parity);
 }
 
@@ -307,7 +307,7 @@ uart_pl011_bus_attach(struct uart_softc 
struct uart_pl011_softc *psc;
struct uart_bas *bas;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = &sc->sc_bas;
 
/* Enable interrupts */
@@ -373,7 +373,7 @@ uart_pl011_bus_ipend(struct uart_softc *
uint32_t ints;
int ipend;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = &sc->sc_bas;
 
uart_lock(sc->sc_hwmtx);
@@ -472,7 +472,7 @@ uart_pl011_bus_transmit(struct uart_soft
struct uart_bas *bas;
int i;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = &sc->sc_bas;
uart_lock(sc->sc_hwmtx);
 
@@ -504,7 +504,7 @@ uart_pl011_bus_grab(struct uart_softc *s
struct uart_pl011_softc *psc;
struct uart_bas *bas;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = &sc->sc_bas;
 
/* Disable interrupts on switch to polling */
@@ -519,7 +519,7 @@ uart_pl011_bus_ungrab(struct uart_softc 
struct uart_pl011_softc *psc;
struct uart_bas *bas;
 
-   psc = (struct uart_pl011_softc *) sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = &sc->sc_bas;
 
/* Switch to using interrupts while not grabbed */
___
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: r310290 - in head/sys: dev/bhnd/nvram mips/broadcom

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:07:58 2016
New Revision: 310290
URL: https://svnweb.freebsd.org/changeset/base/310290

Log:
  bhnd(4): minor style(9) fixes
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8755

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h
  head/sys/mips/broadcom/bcm_nvram_cfe.c

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 19:40:11 2016
(r310289)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:07:58 2016
(r310290)
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
  * @param cls The NVRAM class.
  */
 const char *
-bhnd_nvram_data_class_desc(bhnd_nvram_data_class_t *cls)
+bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls)
 {
return (cls->desc);
 }
@@ -80,7 +80,7 @@ bhnd_nvram_data_class_desc(bhnd_nvram_da
  * code should be returned.
  */
 int
-bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls, struct bhnd_nvram_io *io)
+bhnd_nvram_data_probe(bhnd_nvram_data_class *cls, struct bhnd_nvram_io *io)
 {
return (cls->op_probe(io));
 }
@@ -106,10 +106,10 @@ bhnd_nvram_data_probe(bhnd_nvram_data_cl
  */
 int
 bhnd_nvram_data_probe_classes(struct bhnd_nvram_data **data,
-struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *classes[],
+struct bhnd_nvram_io *io, bhnd_nvram_data_class *classes[],
 size_t num_classes)
 {
-   bhnd_nvram_data_class_t *cls;
+   bhnd_nvram_data_class   *cls;
int  error, prio, result;
 
cls = NULL;
@@ -124,7 +124,7 @@ bhnd_nvram_data_probe_classes(struct bhn
 
/* Try to find the best data class capable of parsing io */
for (size_t i = 0; i < num_classes; i++) {
-   bhnd_nvram_data_class_t *next_cls;
+   bhnd_nvram_data_class *next_cls;
 
next_cls = classes[i];
 
@@ -196,8 +196,8 @@ bhnd_nvram_data_probe_classes(struct bhn
  * regular unix error code will be returned.
  */
 int
-bhnd_nvram_data_new(bhnd_nvram_data_class_t *cls,
-struct bhnd_nvram_data **nv, struct bhnd_nvram_io *io)
+bhnd_nvram_data_new(bhnd_nvram_data_class *cls, struct bhnd_nvram_data **nv,
+struct bhnd_nvram_io *io)
 {
struct bhnd_nvram_data  *data;
int  error;
@@ -263,8 +263,8 @@ bhnd_nvram_data_release(struct bhnd_nvra
  * 
  * @param nv The NVRAM data instance to be queried.
  */
-bhnd_nvram_data_class_t *
-bhnd_nvram_data_class(struct bhnd_nvram_data *nv)
+bhnd_nvram_data_class *
+bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv)
 {
return (nv->cls);
 }
@@ -423,6 +423,7 @@ bhnd_nvram_data_getvar(struct bhnd_nvram
return (nv->cls->op_getvar(nv, cookiep, buf, len, type));
 }
 
+
 /**
  * A generic implementation of bhnd_nvram_data_getvar().
  * 
@@ -438,9 +439,9 @@ int
 bhnd_nvram_data_generic_rp_getvar(struct bhnd_nvram_data *nv, void *cookiep,
 void *outp, size_t *olen, bhnd_nvram_type otype)
 {
-   bhnd_nvram_val_t val;
+   bhnd_nvram_val   val;
const struct bhnd_nvram_vardefn *vdefn;
-   const bhnd_nvram_val_fmt_t  *fmt;
+   const bhnd_nvram_val_fmt*fmt;
const char  *name;
const void  *vptr;
bhnd_nvram_type  vtype;

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 19:40:11 2016
(r310289)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 20:07:58 2016
(r310290)
@@ -46,7 +46,7 @@
 #include "bhnd_nvram_io.h"
 
 /* NVRAM data class */
-typedef struct bhnd_nvram_data_class bhnd_nvram_data_class_t;
+typedef struct bhnd_nvram_data_class bhnd_nvram_data_class;
 
 /* NVRAM data instance */
 struct bhnd_nvram_data;
@@ -88,25 +88,24 @@ enum {
 parsing */
 };
 
-const char *bhnd_nvram_data_class_desc(
-bhnd_nvram_data_class_t *cls);
+const char *bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls);
 
-int bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls,
+int bhnd_nvram_data_probe(bhnd_nvram_d

svn commit: r310291 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:11:48 2016
New Revision: 310291
URL: https://svnweb.freebsd.org/changeset/base/310291

Log:
  bhnd(4): Implement a new bhnd_nvram_plist and bhnd_nvram_prop API for
  representing arbitrary Broadcom NVRAM key/value pairs.
  
  This will be used to track pending changes in bhnd_nvram_store, and
  provide support for exporting all or a device subpath for NVRAM (as
  required by some fullmac wifi chipsets).
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8756

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_plistvar.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:07:58 2016(r310290)
+++ head/sys/conf/files Mon Dec 19 20:11:48 2016(r310291)
@@ -1241,6 +1241,7 @@ dev/bhnd/nvram/bhnd_nvram_if.moptional
 dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iobuf.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iores.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_plist.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_store.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_subr.c   optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value.c  optional bhnd

Added: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c  Mon Dec 19 20:11:48 2016
(r310291)
@@ -0,0 +1,947 @@
+/*-
+ * Copyright (c) 2015-2016 Landon Fuller 
+ * 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.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+
+#ifdef _KERNEL
+
+#include 
+
+#else /* !_KERNEL */
+
+#include 
+#include 
+#include 
+#include 
+
+#endif /* _KERNEL */
+
+#include "bhnd_nvram_plistvar.h"
+#include "bhnd_nvram_private.h"
+
+static bhnd_nvram_plist_entry  *bhnd_nvram_plist_get_entry(
+bhnd_nvram_plist *plist, const char *name);
+
+/**
+ * Allocate and initialize a new, empty property list.
+ * 
+ * The caller is responsible for releasing the returned property value
+ * via bhnd_nvram_plist_release().
+ * 
+ * @retval non-NULLsuccess
+ * @retval NULLif allocation fails.
+ */
+bhnd_nvram_plist *
+bhnd_nvram_plist_new(void)
+{
+   bhnd_nvram_plist *plist;
+
+   plist = bhnd_nv_calloc(1, sizeof(*plist));
+   if (plist == NULL)
+   return NULL;
+
+   /* Implicit caller-owned reference */
+   plist->refs = 1;
+
+   /* Initialize entry list */
+   plist->num_entries = 0;
+   TAILQ_INIT(&plist->entries);
+
+   /* Initialize entry hash table */
+   for (size_t i = 0; i < nitems(plist->names); i++)
+   LIST_INIT(&plist->names[i]);
+
+   return (plist);
+}
+
+/**
+ * Retain a reference and return @p plist to the caller.
+ * 
+ * The caller is responsible for releasing their reference ownership via
+ * bhnd_nvram_plist_release().
+ * 
+ * @param  plist   The property list to be retained.
+ */
+bhnd_nvram_plist *
+bhnd_nvram_plist_retain(bhn

svn commit: r310292 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:20:33 2016
New Revision: 310292
URL: https://svnweb.freebsd.org/changeset/base/310292

Log:
  bhnd(4): support direct conversion of bhnd_nvram_val
  
  This adds support for bhnd_nvram_val_convert_init() and
  bhnd_nvram_val_convert_new(), which may be used to perform value
  format-aware encoding of an NVRAM value to a new target format/type.
  
  This will be used to simplify converting to/from serialized
  format-specific NVRAM value representations to common external
  representations.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8757

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:11:48 2016(r310291)
+++ head/sys/conf/files Mon Dec 19 20:20:33 2016(r310292)
@@ -1247,6 +1247,7 @@ dev/bhnd/nvram/bhnd_nvram_subr.c  optiona
 dev/bhnd/nvram/bhnd_nvram_value.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value_fmts.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value_prf.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_value_subr.c optional bhnd
 dev/bhnd/nvram/bhnd_sprom.coptional bhnd
 dev/bhnd/siba/siba.c   optional siba bhnd
 dev/bhnd/siba/siba_bhndb.c optional siba bhnd bhndb

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:11:48 2016
(r310291)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:20:33 2016
(r310292)
@@ -111,14 +111,16 @@ typedef enum {
 NUL-terminated strings */
 } bhnd_nvram_type;
 
-const char *bhnd_nvram_string_array_next(const char *inp, size_t ilen,
-const char *prev); 
-
 boolbhnd_nvram_is_signed_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_unsigned_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_int_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_array_type(bhnd_nvram_type type);
 bhnd_nvram_type bhnd_nvram_base_type(bhnd_nvram_type type);
 const char *bhnd_nvram_type_name(bhnd_nvram_type type);
+size_t  bhnd_nvram_type_width(bhnd_nvram_type type);
+size_t  bhnd_nvram_type_host_align(bhnd_nvram_type type);
+
+const char *bhnd_nvram_string_array_next(const char *inp, size_t ilen,
+const char *prev, size_t *olen); 
 
 #endif /* _BHND_NVRAM_BHND_NVRAM_H_ */

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:11:48 
2016(r310291)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:20:33 
2016(r310292)
@@ -647,10 +647,8 @@ bhnd_nvram_bcm_getvar_ptr(struct bhnd_nv
 
/* Handle header variables */
if ((hvar = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep)) != NULL) {
-   BHND_NV_ASSERT(
-   hvar->len % bhnd_nvram_value_size(hvar->type, NULL, 0,
-   hvar->nelem) == 0,
-   ("length is not aligned to type width"));
+   BHND_NV_ASSERT(bhnd_nvram_value_check_aligned(&hvar->value,
+   hvar->len, hvar->type) == 0, ("value misaligned"));
 
*type = hvar->type;
*len = hvar->len;

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:11:48 
2016(r310291)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:20:33 
2016(r310292)
@@ -597,7 +597,7 @@ bhnd_nvram_sprom_read_offset(struct bhnd
} sp_value;
 
/* Determine type width */
-   sp_width = bhnd_nvram_value_size(type, NULL, 0, 1);
+   sp_width = bhnd_nvram_type_width(type);
if (sp_width == 0) {
/* Variable-width types are unsupported */
BHND_NV_LOG("invalid %s SPROM offset type %d\n", var->name,
@@ -716,7 +716,7 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra
var_btype 

svn commit: r310293 - head/sys/dev/bhnd/nvram

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:23:19 2016
New Revision: 310293
URL: https://svnweb.freebsd.org/changeset/base/310293

Log:
  bhnd(4): Add support for three new NVRAM value types; booleans,
  NULL (which we'll use to denote deleted values in bhnd_nvram_store), and
  opaque data (aka octet-strings).
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8758

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:20:33 2016
(r310292)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:23:19 2016
(r310293)
@@ -40,6 +40,14 @@
 #endif /* _KERNEL */
 
 /**
+ * BHND NVRAM boolean type; guaranteed to be exactly 8-bits, representing
+ * true as integer constant 1, and false as integer constant 0.
+ * 
+ * Compatible with stdbool constants (true, false).
+ */
+typedef uint8_tbhnd_nvram_bool_t;
+
+/**
  * NVRAM data sources supported by bhnd(4) devices.
  */
 typedef enum {
@@ -94,6 +102,10 @@ typedef enum {
BHND_NVRAM_TYPE_CHAR= 8,/**< ASCII/UTF-8 character */
BHND_NVRAM_TYPE_STRING  = 9,/**< ASCII/UTF-8 NUL-terminated
 string */
+   BHND_NVRAM_TYPE_BOOL= 10,   /**< uint8 boolean value. see
+bhnd_nvram_bool_t. */
+   BHND_NVRAM_TYPE_NULL= 11,   /**< NULL (empty) value */
+   BHND_NVRAM_TYPE_DATA= 12,   /**< opaque octet string */
 
/* 10-15 reserved for primitive (non-array) types */
 
@@ -109,13 +121,17 @@ typedef enum {
 characters */
BHND_NVRAM_TYPE_STRING_ARRAY= 25,   /**< array of ASCII/UTF-8
 NUL-terminated strings */
+   BHND_NVRAM_TYPE_BOOL_ARRAY  = 26,   /**< array of uint8 boolean
+values */
 } bhnd_nvram_type;
 
+
 boolbhnd_nvram_is_signed_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_unsigned_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_int_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_array_type(bhnd_nvram_type type);
 bhnd_nvram_type bhnd_nvram_base_type(bhnd_nvram_type type);
+bhnd_nvram_type bhnd_nvram_raw_type(bhnd_nvram_type type);
 const char *bhnd_nvram_type_name(bhnd_nvram_type type);
 size_t  bhnd_nvram_type_width(bhnd_nvram_type type);
 size_t  bhnd_nvram_type_host_align(bhnd_nvram_type type);

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c  Mon Dec 19 20:20:33 2016
(r310292)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c  Mon Dec 19 20:23:19 2016
(r310293)
@@ -743,6 +743,27 @@ bhnd_nvram_plist_get_uint64(bhnd_nvram_p
 }
 
 /**
+ * Return the boolean representation of a named property's value.
+ * 
+ * @param  plist   The property list to be queried.
+ * @param  nameThe name of the property value to be returned.
+ * @param[out] val On success, the boolean value of @p name.
+ *
+ * @retval 0   success
+ * @retval ENOENT  If @p name is not found in @p plist.
+ * @retval EFTYPE  If coercion of the property's value to @p val.
+ * @retval ERANGE  If coercion of the property's value would overflow
+ * (or underflow) @p val.
+ */
+int
+bhnd_nvram_plist_get_bool(bhnd_nvram_plist *plist, const char *name,
+bool *val)
+{
+   return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),
+   BHND_NVRAM_TYPE_BOOL));
+}
+
+/**
  * Allocate and initialize a new property value.
  * 
  * The caller is responsible for releasing the returned property value
@@ -901,6 +922,18 @@ bhnd_nvram_prop_type(bhnd_nvram_prop *pr
 }
 
 /**
+ * Return true if @p prop has a NULL value type (BHND_NVRAM_TYPE_NULL), false
+ * otherwise.
+ * 
+ * @param  propThe property to query.
+ */
+bool
+bhnd_nvram_prop_is_null(bhnd_nvram_prop *prop)
+{
+   return (bhnd_nvram_prop_type(prop) == BHND_NVRAM_TYPE_NULL);
+}
+
+/**
  * Return a borrowed reference to the property's internal value representation.
  *
  * @param  propThe property to query.

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h

svn commit: r310294 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:26:10 2016
New Revision: 310294
URL: https://svnweb.freebsd.org/changeset/base/310294

Log:
  bhnd(4): add support for wrapping arbitrary pointers in an NVRAM I/O
  context.
  
  Approved by:  adrian (mentor)
  Differential Revision: https://reviews.freebsd.org/D8759

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_io.h
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:23:19 2016(r310293)
+++ head/sys/conf/files Mon Dec 19 20:26:10 2016(r310294)
@@ -1240,6 +1240,7 @@ dev/bhnd/nvram/bhnd_nvram_data_tlv.c  opt
 dev/bhnd/nvram/bhnd_nvram_if.m optional bhnd
 dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iobuf.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_ioptr.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iores.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_plist.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_store.c  optional bhnd

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_io.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_io.h Mon Dec 19 20:23:19 2016
(r310293)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_io.h Mon Dec 19 20:26:10 2016
(r310294)
@@ -52,6 +52,9 @@ struct bhnd_nvram_io  *bhnd_nvram_iobuf_c
 struct bhnd_nvram_io   *bhnd_nvram_iobuf_copy_range(struct bhnd_nvram_io *src,
 size_t offset, size_t size);
 
+struct bhnd_nvram_io   *bhnd_nvram_ioptr_new(const void *ptr, size_t size,
+size_t capacity, uint32_t flags);
+
 #ifdef _KERNEL
 struct bhnd_nvram_io   *bhnd_nvram_iores_new(struct bhnd_resource *r,
 bus_size_t offset, bus_size_t size,
@@ -76,4 +79,12 @@ int   bhnd_nvram_io_write_ptr(struct bh
 
 voidbhnd_nvram_io_free(struct bhnd_nvram_io *io);
 
+/**
+ * bhnd_nvram_ioptr flags
+ */
+enum {
+   BHND_NVRAM_IOPTR_RDONLY = (1<<0),   /**< read-only */
+   BHND_NVRAM_IOPTR_RDWR   = (1<<1),   /**< read/write */
+};
+
 #endif /* _BHND_NVRAM_BHND_NVRAM_IO_H_ */

Added: head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c  Mon Dec 19 20:26:10 2016
(r310294)
@@ -0,0 +1,228 @@
+/*-
+ * Copyright (c) 2016 Landon Fuller 
+ * 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.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#ifdef _KERNEL
+#include 
+#include 
+#include 
+#else /* !_KERNEL */
+#include 
+#include 
+#include 
+#include 
+#endif /* _KERNEL */
+
+#include "bhnd_nvram_private.h"
+
+#include "bhnd_nvram_io.h"
+#include "bhnd_nvram_iovar.h"
+
+/**
+ * Memory-backed NVRAM I/O context.
+ *
+ * ioptr instances are gauranteed to provide persistent references to its
+ * backing contigious memory via bhnd_nvram_io_read_ptr() and
+ * bhnd_nvram_io_write_ptr().
+ */
+struct bhnd_nvram_ioptr {
+   struct bhnd_nvram_io io;/**< common I/O instance state 
*/
+   void*ptr;   /**< backing memory */
+   size_t   size;  /**< size at @p ptr */
+   size_t   capacity;  /**< capacity at @p p

svn commit: r310295 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:28:27 2016
New Revision: 310295
URL: https://svnweb.freebsd.org/changeset/base/310295

Log:
  bhnd(4): NVRAM device path support.
  
  Implements bhnd_nvram_store support for parsing and operating over NVRAM
  device paths, and device path aliases, as well as tracking per-path NVRAM
  variable writes.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8760

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:26:10 2016(r310294)
+++ head/sys/conf/files Mon Dec 19 20:28:27 2016(r310295)
@@ -1244,6 +1244,7 @@ dev/bhnd/nvram/bhnd_nvram_ioptr.c option
 dev/bhnd/nvram/bhnd_nvram_iores.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_plist.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_store.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_store_subr.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_subr.c   optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value_fmts.c optional bhnd

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:26:10 2016
(r310294)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:28:27 2016
(r310295)
@@ -350,7 +350,26 @@ bhnd_nvram_data_caps(struct bhnd_nvram_d
 const char *
 bhnd_nvram_data_next(struct bhnd_nvram_data *nv, void **cookiep)
 {
-   return (nv->cls->op_next(nv, cookiep));
+   const char  *name;
+#ifdef BHND_NV_INVARIANTS
+   void*prev = *cookiep;
+#endif
+
+   /* Fetch next */
+   if ((name = nv->cls->op_next(nv, cookiep)) == NULL)
+   return (NULL);
+
+   /* Enforce precedence ordering invariant between bhnd_nvram_data_next()
+* and bhnd_nvram_data_getvar_order() */
+#ifdef BHND_NV_INVARIANTS
+   if (prev != NULL &&
+   bhnd_nvram_data_getvar_order(nv, prev, *cookiep) > 0)
+   {
+   BHND_NV_PANIC("%s: returned out-of-order entry", __FUNCTION__);
+   }
+#endif
+
+   return (name);
 }
 
 /**
@@ -388,7 +407,7 @@ bhnd_nvram_data_generic_find(struct bhnd
 
cookiep = NULL;
while ((next = bhnd_nvram_data_next(nv, &cookiep))) {
-   if (strcasecmp(name, next) == 0)
+   if (strcmp(name, next) == 0)
return (cookiep);
}
 
@@ -397,6 +416,37 @@ bhnd_nvram_data_generic_find(struct bhnd
 }
 
 /**
+ * Compare the declaration order of two NVRAM variables.
+ * 
+ * Variable declaration order is used to determine the current order of
+ * the variables in the source data, as well as to determine the precedence
+ * of variable declarations in data sources that define duplicate names.
+ * 
+ * The comparison order will match the order of variables returned via
+ * bhnd_nvstore_path_data_next().
+ *
+ * @param  nv  The NVRAM data.
+ * @param  cookiep1An NVRAM variable cookie previously
+ * returned via bhnd_nvram_data_next() or
+ * bhnd_nvram_data_find().
+ * @param  cookiep2An NVRAM variable cookie previously
+ * returned via bhnd_nvram_data_next() or
+ * bhnd_nvram_data_find().
+ *
+ * @retval <= -1   If @p cookiep1 has an earlier declaration order than
+ * @p cookiep2.
+ * @retval 0   If @p cookiep1 and @p cookiep2 are identical.
+ * @retval >= 1If @p cookiep has a later declaration order than
+ * @p cookiep2.
+ */
+int
+bhnd_nvram_data_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1,
+void *cookiep2)
+{
+   return (nv->cls->op_getvar_order(nv, cookiep1, cookiep2));
+}
+
+/**
  * Read a variable and decode as @p type.
  *
  * @param  nv  The NVRAM data.
@@ -423,6 +473,58 @@ bhnd_nvram_data_getvar(struct bhnd_nvram
return (nv->cls->op_getvar(nv, cookiep, buf, len, type));
 }
 
+/

svn commit: r310296 - head/sys/dev/bhnd/nvram

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:31:27 2016
New Revision: 310296
URL: https://svnweb.freebsd.org/changeset/base/310296

Log:
  bhnd(4): Add support for exporting all (or a subtree) of NVRAM
  properties backed by an NVRAM store.
  
  This will be used to support:
  
  - Serializing the current NVRAM state for writing back to flash.
  - Exporting subsidiary device paths for serialization and upload to fullmac
chipsets.
  
  Additionally, this includes an improvement to BCM-RAW format detection
  to avoid matching on BCM-TEXT NVRAM data.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8761

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:28:27 2016
(r310295)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:31:27 2016
(r310296)
@@ -281,6 +281,18 @@ bhnd_nvram_data_count(struct bhnd_nvram_
 }
 
 /**
+ * Return a borrowed reference to the serialization options for @p nv,
+ * suitable for use with bhnd_nvram_data_serialize(), or NULL if none.
+ * 
+ * @param nv The NVRAM data to be queried.
+ */
+bhnd_nvram_plist *
+bhnd_nvram_data_options(struct bhnd_nvram_data *nv)
+{
+   return (nv->cls->op_options(nv));
+}
+
+/**
  * Compute the size of the serialized form of @p nv.
  *
  * Serialization may be performed via bhnd_nvram_data_serialize().

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 20:28:27 2016
(r310295)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 20:31:27 2016
(r310296)
@@ -44,6 +44,7 @@
 
 #include "bhnd_nvram.h"
 #include "bhnd_nvram_io.h"
+#include "bhnd_nvram_plist.h"
 #include "bhnd_nvram_value.h"
 
 /* NVRAM data class */
@@ -115,6 +116,7 @@ int  bhnd_nvram_data_size(struct bhnd_
 int bhnd_nvram_data_serialize(struct bhnd_nvram_data *nv,
 void *buf, size_t *len);
 
+bhnd_nvram_plist   *bhnd_nvram_data_options(struct bhnd_nvram_data *nv);
 uint32_tbhnd_nvram_data_caps(struct bhnd_nvram_data *nv);
 
 const char *bhnd_nvram_data_next(struct bhnd_nvram_data *nv,

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:28:27 
2016(r310295)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:31:27 
2016(r310296)
@@ -121,6 +121,7 @@ static const struct bhnd_nvram_bcm_hvar 
 struct bhnd_nvram_bcm {
struct bhnd_nvram_data   nv;/**< common instance state */
struct bhnd_nvram_io*data;  /**< backing buffer */
+   bhnd_nvram_plist*opts;  /**< serialization options */
 
/** BCM header values */
struct bhnd_nvram_bcm_hvar   hvars[nitems(bhnd_nvram_bcm_hvars)];
@@ -157,7 +158,7 @@ bhnd_nvram_bcm_init(struct bhnd_nvram_bc
uint8_t *p;
void*ptr;
size_t   io_offset, io_size;
-   uint8_t  crc, valid;
+   uint8_t  crc, valid, bcm_ver;
int  error;
 
if ((error = bhnd_nvram_io_read(src, 0x0, &hdr, sizeof(hdr
@@ -344,6 +345,14 @@ bhnd_nvram_bcm_init(struct bhnd_nvram_bc
bcm->count++;
}
 
+   /* Populate serialization options from our header */
+   bcm_ver = BCM_NVRAM_GET_BITS(hdr.cfg0, BCM_NVRAM_CFG0_VER);
+   error = bhnd_nvram_plist_append_bytes(bcm->opts,
+   BCM_NVRAM_ENCODE_OPT_VERSION, &bcm_ver, sizeof(bcm_ver),
+   BHND_NVRAM_TYPE_UINT8);
+   if (error)
+   return (error);
+
return (0);
 }
 
@@ -360,6 +369,12 @@ bhnd_nvram_bcm_new(struct bhnd_nvram_dat
"hvar declarations must match bhnd_nvram_bcm_hvars template");
memcpy(bcm->hvars, bhnd_nvram_bcm_hvars, sizeof(bcm->hvars));
 
+   /* Allocate (empty) option list, to be populated by
+   

svn commit: r310297 - in head/sys: conf dev/bhnd/nvram dev/bhnd/tools modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:34:05 2016
New Revision: 310297
URL: https://svnweb.freebsd.org/changeset/base/310297

Log:
  bhnd(4): NVRAM serialization support.
  
  This adds support for:
  
  - Serializing an bhnd_nvram_plist (as exported from bhnd_nvram_store, etc) to
an arbitrary NVRAM data format.
  - Generating a serialized representation of the current NVRAM store's state
suitable for writing back to flash, or re-encoding for upload to a
FullMAC device.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8762

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom_subr.c   (contents, props 
changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmreg.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_spromvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/tools/nvram_map_gen.awk
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:31:27 2016(r310296)
+++ head/sys/conf/files Mon Dec 19 20:34:05 2016(r310297)
@@ -1236,6 +1236,7 @@ dev/bhnd/nvram/bhnd_nvram_data_bcm.c  opt
 dev/bhnd/nvram/bhnd_nvram_data_bcmraw.coptional bhnd
 dev/bhnd/nvram/bhnd_nvram_data_btxt.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_data_sprom.c optional bhnd
+dev/bhnd/nvram/bhnd_nvram_data_sprom_subr.coptional bhnd
 dev/bhnd/nvram/bhnd_nvram_data_tlv.c   optional bhnd
 dev/bhnd/nvram/bhnd_nvram_if.m optional bhnd
 dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:31:27 2016
(r310296)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:34:05 2016
(r310297)
@@ -65,6 +65,54 @@ bhnd_nvram_data_class_desc(bhnd_nvram_da
 }
 
 /**
+ * Return the class-level capability flags (@see BHND_NVRAM_DATA_CAP_*) for
+ * of @p cls.
+ *
+ * @param cls The NVRAM class.
+ */
+uint32_t
+bhnd_nvram_data_class_caps(bhnd_nvram_data_class *cls)
+{
+   return (cls->caps);
+}
+
+/**
+ * Serialize all NVRAM properties in @p plist using @p cls's NVRAM data
+ * format, writing the result to @p outp.
+ * 
+ * @param  cls The NVRAM data class to be used to perform
+ * serialization.
+ * @param  props   The raw property values to be serialized to
+ * @p outp, in serialization order.
+ * @param  options Serialization options for @p cls, or NULL.
+ * @param[out] outpOn success, the serialed NVRAM data will be
+ * written to this buffer. This argment may be
+ * NULL if the value is not desired.
+ * @param[in,out]  olenThe capacity of @p buf. On success, will be set
+ * to the actual length of the serialized data.
+ *
+ * @retval 0   success
+ * 
+ * @retval ENOMEM  If @p outp is non-NULL and a buffer of @p olen is too
+ * small to hold the serialized data.
+ * @retval EINVAL  If a property value required by @p cls is not found in
+ * @p plist.
+ * @retval EFTYPE  If a property value in @p plist cannot be represented
+ * as the data type required by @p cls.
+ * @retval ERANGE  If a property value in @p plist would would overflow
+ * (or underflow) the data type required by @p cls.
+ * @retval non-zeroIf serialization otherwise fails, a regular unix error
+ * code will be returned.
+ */
+int
+bhnd_nvram_data_serialize(bhnd_nvram_data_class *cls,
+bhnd_nvram_plist *props, bhnd_nvram_plist *options, void *outp,
+size_t *olen)
+{
+   return (cls->op_serialize(cls, props, options, outp, olen));
+}
+
+/**
  * Probe to see if this NVRAM data class class supports the data mapped by the
  * given I/O context, returning a BHND_NVRAM_DATA_PROBE probe result.
  *
@@ -293,51 +341,6 @@ bhnd_nvram_data_options(struct bhnd_nvra
 }
 
 /**
- * Compute the size of the serialized form of @p nv.
- *
- * Serialization may be performed via bhnd_nvram_data_serialize().
- *
- * @param  nv  The NVRAM data to be queried.
- * @param[out] len On success, will be set to the computed size.
- * 
- 

Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Ian Lepore 
> 
> Date: 2016-12-19, Monday at 11:20
> To: Warner Losh , Ravi Pokala 
> Cc: Sepherosa Ziehau , Dimitry Andric 
> , src-committers , 
> "svn-src-...@freebsd.org" , 
> "svn-src-head@freebsd.org" 
> Subject: Re: svn commit: r310171 - head/sys/sys
> 
> On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:
>>
>> ...
>> 
>> Are there other precedence for avoiding the SCN macros in the tree as
>> well, or is this new art?
>> 
>> Warner
> 
> There was another commit recently the fixed the same kind of scanf
> error by making the variable fit the scanf type (changing uint64_t to
> an explicit long long unsigned, iirc).  I don't know if that alone
> counts as a precedent, but IMO it's a more palatible fix than the
> SCN/PRI ugliness.

With all apologies to Churchill, SCN/PRI are the worst way to address this in a 
machine-independent way, except for all the other ways that have been tried 
from time to time. :-P

-Ravi (rpokala@)

> -- Ian



___
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: r310298 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 21:27:18 2016
New Revision: 310298
URL: https://svnweb.freebsd.org/changeset/base/310298

Log:
  Improve error handling when I/O split between several BIOs.
  
  If we get several error codes, handle one with lowest offset.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl_backend_block.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cMon Dec 19 20:34:05 2016
(r310297)
+++ head/sys/cam/ctl/ctl_backend_block.cMon Dec 19 21:27:18 2016
(r310298)
@@ -201,7 +201,8 @@ struct ctl_be_block_io {
int num_bios_sent;
int num_bios_done;
int send_complete;
-   int num_errors;
+   int first_error;
+   uint64_tfirst_error_offset;
struct bintime  ds_t0;
devstat_tag_typeds_tag_type;
devstat_trans_flags ds_trans_type;
@@ -486,8 +487,12 @@ ctl_be_block_biodone(struct bio *bio)
 
error = bio->bio_error;
mtx_lock(&be_lun->io_lock);
-   if (error != 0)
-   beio->num_errors++;
+   if (error != 0 &&
+   (beio->first_error == 0 ||
+bio->bio_offset < beio->first_error_offset)) {
+   beio->first_error = error;
+   beio->first_error_offset = bio->bio_offset;
+   }
 
beio->num_bios_done++;
 
@@ -520,7 +525,8 @@ ctl_be_block_biodone(struct bio *bio)
 * If there are any errors from the backing device, we fail the
 * entire I/O with a medium error.
 */
-   if (beio->num_errors > 0) {
+   error = beio->first_error;
+   if (error != 0) {
if (error == EOPNOTSUPP) {
ctl_set_invalid_opcode(&io->scsiio);
} else if (error == ENOSPC || error == EDQUOT) {
___
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: r310302 - head/sys/kern

2016-12-19 Thread Konstantin Belousov
Author: kib
Date: Mon Dec 19 22:18:36 2016
New Revision: 310302
URL: https://svnweb.freebsd.org/changeset/base/310302

Log:
  Do not clear KN_INFLUX when not owning influx state.
  
  For notes in KN_INFLUX|KN_SCAN state, the influx bit is set by a
  parallel scan.  When knote() reports event for the vnode filters,
  which require kqueue unlocked, it unconditionally sets and then clears
  influx to keep note around kqueue unlock.  There, do not clear influx
  flag if a scan set it, since we do not own it, instead we prevent scan
  from executing by holding knlist lock.
  
  The knote_fork() function has somewhat similar problem, it might set
  KN_INFLUX for scanned note, drop kqueue and list locks, and then clear
  the flag after relock.  A solution there would be different enough, as
  well as the test program, so close the reported issue first.
  
  Reported and test case provided by:   yjh0...@gmail.com
  PR:   214923
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Mon Dec 19 22:15:29 2016(r310301)
+++ head/sys/kern/kern_event.c  Mon Dec 19 22:18:36 2016(r310302)
@@ -2006,6 +2006,7 @@ knote(struct knlist *list, long hint, in
struct kqueue *kq;
struct knote *kn, *tkn;
int error;
+   bool own_influx;
 
if (list == NULL)
return;
@@ -2036,11 +2037,14 @@ knote(struct knlist *list, long hint, in
 */
KQ_UNLOCK(kq);
} else if ((lockflags & KNF_NOKQLOCK) != 0) {
-   kn->kn_status |= KN_INFLUX;
+   own_influx = (kn->kn_status & KN_INFLUX) == 0;
+   if (own_influx)
+   kn->kn_status |= KN_INFLUX;
KQ_UNLOCK(kq);
error = kn->kn_fop->f_event(kn, hint);
KQ_LOCK(kq);
-   kn->kn_status &= ~KN_INFLUX;
+   if (own_influx)
+   kn->kn_status &= ~KN_INFLUX;
if (error)
KNOTE_ACTIVATE(kn, 1);
KQ_UNLOCK_FLUX(kq);
___
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: r310138 - head/lib/libc/stdio

2016-12-19 Thread Adrian Chadd
[snip]

tl;dr - can we revert it from stdio for now so we don't end up having
people use this?



-adrian
___
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: r310304 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake

2016-12-19 Thread Simon J. Gerraty
Author: sjg
Date: Mon Dec 19 23:38:07 2016
New Revision: 310304
URL: https://svnweb.freebsd.org/changeset/base/310304

Log:
  Merge bmake-20161212

Added:
  head/contrib/bmake/mk/sys.debug.mk
 - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.debug.mk
  head/contrib/bmake/mk/sys.vars.mk
 - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.vars.mk
Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/compat.c
  head/contrib/bmake/job.c
  head/contrib/bmake/main.c
  head/contrib/bmake/make.1
  head/contrib/bmake/make.c
  head/contrib/bmake/make.h
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/FILES
  head/contrib/bmake/mk/dirdeps.mk
  head/contrib/bmake/mk/gendirdeps.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/lib.mk
  head/contrib/bmake/mk/meta.stage.mk
  head/contrib/bmake/mk/meta.sys.mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/mk/meta2deps.sh
  head/contrib/bmake/mk/sys.mk
  head/contrib/bmake/nonints.h
  head/contrib/bmake/parse.c
  head/usr.bin/bmake/Makefile
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==
--- head/contrib/bmake/ChangeLogMon Dec 19 22:28:28 2016
(r310303)
+++ head/contrib/bmake/ChangeLogMon Dec 19 23:38:07 2016
(r310304)
@@ -1,3 +1,32 @@
+2016-12-12  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20161212
+ Merge with NetBSD make, pick up
+  o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too.
+
+2016-12-09  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20161209
+ Merge with NetBSD make, pick up
+ o main.c: cleanup setting of .OBJDIR
+ o parse.c: avoid coredump from (var)=val
+
+2016-11-26  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20161126
+ Merge with NetBSD make, pick up
+ o make.c: Make_OODate: report src node name if path not set
+
+2016-09-26  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20160926
+ Merge with NetBSD make, pick up
+ o support for .DELETE_ON_ERROR: (remove targets that fail)
+   
+2016-09-26  Simon J. Gerraty  
+
+   * Makefile MAN: tweak .Dt to match ${PROG}
+
 2016-08-18  Simon J. Gerraty  
 
* Makefile (_MAKE_VERSION): 20160818

Modified: head/contrib/bmake/Makefile
==
--- head/contrib/bmake/Makefile Mon Dec 19 22:28:28 2016(r310303)
+++ head/contrib/bmake/Makefile Mon Dec 19 23:38:07 2016(r310304)
@@ -1,7 +1,7 @@
-#  $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $
+#  $Id: Makefile,v 1.77 2016/12/12 07:34:19 sjg Exp $
 
 # Base version on src date
-_MAKE_VERSION= 20160818
+_MAKE_VERSION= 20161212
 
 PROG=  bmake
 
@@ -156,7 +156,10 @@ my.history: ${MAKEFILE}
 .NOPATH: ${MAN}
 ${MAN}:make.1 my.history
@echo making $@
-   @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
+   @sed \
+   -e '/^.Dt/s/MAKE/${PROG:tu}/' \
+   -e 's/^.Nx/NetBSD/' \
+   -e '/^.Nm/s/make/${PROG}/' \
-e '/^.Sh HISTORY/rmy.history' \
-e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
 

Modified: head/contrib/bmake/bmake.1
==
--- head/contrib/bmake/bmake.1  Mon Dec 19 22:28:28 2016(r310303)
+++ head/contrib/bmake/bmake.1  Mon Dec 19 23:38:07 2016(r310304)
@@ -1,4 +1,4 @@
-.\"$NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $
+.\"$NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"The Regents of the University of California.  All rights reserved.
@@ -29,8 +29,8 @@
 .\"
 .\"from: @(#)make.18.4 (Berkeley) 3/19/94
 .\"
-.Dd August 15, 2016
-.Dt MAKE 1
+.Dd August 26, 2016
+.Dt BMAKE 1
 .Os
 .Sh NAME
 .Nm bmake
@@ -2011,6 +2011,14 @@ variable of a target that inherits
 .Ic .DEFAULT Ns 's
 commands is set
 to the target's own name.
+.It Ic .DELETE_ON_ERROR
+If this target is present in the makefile, it globally causes make to
+delete targets whose commands fail.
+(By default, only targets whose commands are interrupted during
+execution are deleted.
+This is the historical behavior.)
+This setting can be used to help prevent half-finished or malformed
+targets from being left around and corrupting future rebuilds.
 .It Ic .END
 Any command lines attached to this target are executed after everything
 else is done.

Modified: head/contrib/bmake/bmake.cat1
==
--- head/contrib/bmake/bmake.cat1   Mon Dec 19 22:28:28 2016
(r310303)
+++ head/contrib/bmake/bmake.cat1   Mon Dec 19 23:38:07 2016
(r310304)
@@ -

svn commit: r310305 - in head/sys/dev/rtwn: rtl8188e/usb rtl8192c rtl8812a

2016-12-19 Thread Kevin Lo
Author: kevlo
Date: Tue Dec 20 01:13:11 2016
New Revision: 310305
URL: https://svnweb.freebsd.org/changeset/base/310305

Log:
  Merge r92c_init_rf_common() into r92c_init_rf().  In r88eu_attach.c, we could
  use r92c_init_rf() rather than r92c_init_rf_common() when sc_init_rf()
  callback is invoked.
  
  While here, constantly use RF chain instead of RF path in comment.
  
  Reviewed by:  avos

Modified:
  head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c
  head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c
  head/sys/dev/rtwn/rtl8192c/r92c.h
  head/sys/dev/rtwn/rtl8192c/r92c_init.c
  head/sys/dev/rtwn/rtl8812a/r12a_priv.h

Modified: head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c
==
--- head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c   Mon Dec 19 23:38:07 
2016(r310304)
+++ head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c   Tue Dec 20 01:13:11 
2016(r310305)
@@ -171,7 +171,7 @@ r88eu_attach(struct rtwn_usb_softc *uc)
sc->sc_init_intr= r88eu_init_intr;
sc->sc_init_edca= r92c_init_edca;
sc->sc_init_bb  = r88e_init_bb;
-   sc->sc_init_rf  = r92c_init_rf_common;
+   sc->sc_init_rf  = r92c_init_rf;
sc->sc_init_antsel  = rtwn_nop_softc;
sc->sc_post_init= r88eu_post_init;
sc->sc_init_bcnq1_boundary  = rtwn_nop_int_softc;

Modified: head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c
==
--- head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c Tue Dec 20 01:13:11 2016
(r310305)
@@ -200,9 +200,6 @@ r88eu_init_rx_agg(struct rtwn_softc *sc)
 void
 r88eu_post_init(struct rtwn_softc *sc)
 {
-   /* Turn CCK and OFDM blocks on. */
-   rtwn_bb_setbits(sc, R92C_FPGA0_RFMOD, 0, R92C_RFMOD_CCK_EN);
-   rtwn_bb_setbits(sc, R92C_FPGA0_RFMOD, 0, R92C_RFMOD_OFDM_EN);
 
/* Enable per-packet TX report. */
rtwn_setbits_1(sc, R88E_TX_RPT_CTRL, 0, R88E_TX_RPT1_ENA);

Modified: head/sys/dev/rtwn/rtl8192c/r92c.h
==
--- head/sys/dev/rtwn/rtl8192c/r92c.h   Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8192c/r92c.h   Tue Dec 20 01:13:11 2016
(r310305)
@@ -81,7 +81,6 @@ int   r92c_set_page_size(struct rtwn_softc
 void   r92c_init_bb_common(struct rtwn_softc *);
 intr92c_init_rf_chain(struct rtwn_softc *,
const struct rtwn_rf_prog *, int);
-void   r92c_init_rf_common(struct rtwn_softc *);
 void   r92c_init_rf(struct rtwn_softc *);
 void   r92c_init_edca(struct rtwn_softc *);
 void   r92c_init_ampdu(struct rtwn_softc *);

Modified: head/sys/dev/rtwn/rtl8192c/r92c_init.c
==
--- head/sys/dev/rtwn/rtl8192c/r92c_init.c  Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8192c/r92c_init.c  Tue Dec 20 01:13:11 2016
(r310305)
@@ -204,7 +204,7 @@ r92c_init_rf_chain(struct rtwn_softc *sc
 }
 
 void
-r92c_init_rf_common(struct rtwn_softc *sc)
+r92c_init_rf(struct rtwn_softc *sc)
 {
struct r92c_softc *rs = sc->sc_priv;
uint32_t reg, type;
@@ -244,14 +244,6 @@ r92c_init_rf_common(struct rtwn_softc *s
rs->rf_chnlbw[chain] = rtwn_rf_read(sc, chain,
R92C_RF_CHNLBW);
}
-}
-
-void
-r92c_init_rf(struct rtwn_softc *sc)
-{
-   struct r92c_softc *rs = sc->sc_priv;
-
-   r92c_init_rf_common(sc);
 
if ((rs->chip & (R92C_CHIP_UMC_A_CUT | R92C_CHIP_92C)) ==
R92C_CHIP_UMC_A_CUT) {

Modified: head/sys/dev/rtwn/rtl8812a/r12a_priv.h
==
--- head/sys/dev/rtwn/rtl8812a/r12a_priv.h  Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8812a/r12a_priv.h  Tue Dec 20 01:13:11 2016
(r310305)
@@ -657,7 +657,7 @@ static const struct rtwn_rf_prog rtl8812
NULL
},
{ 0, NULL, NULL, { 0 }, NULL },
-   /* RF path 2. */
+   /* RF chain 1. */
{
nitems(rtl8812au_rf1_regs0),
rtl8812au_rf1_regs0,
___
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: r310306 - in head/sys: arm/allwinner arm/arm arm/freescale/imx conf dev/hdmi

2016-12-19 Thread Jared McNeill
Author: jmcneill
Date: Tue Dec 20 01:34:29 2016
New Revision: 310306
URL: https://svnweb.freebsd.org/changeset/base/310306

Log:
  Split the DesignWare HDMI-specific code from imx6_hdmi.c into a separate
  file and add a generic DT binding that takes advantage of the extres
  framework for setting up clocks.
  
  Reviewed by:  gonzo
  Differential Revision:https://reviews.freebsd.org/D8826

Added:
  head/sys/dev/hdmi/
  head/sys/dev/hdmi/dwc_hdmi.c   (contents, props changed)
  head/sys/dev/hdmi/dwc_hdmi.h   (contents, props changed)
  head/sys/dev/hdmi/dwc_hdmi_fdt.c   (contents, props changed)
  head/sys/dev/hdmi/dwc_hdmireg.h   (contents, props changed)
  head/sys/dev/hdmi/hdmi_if.m
 - copied unchanged from r310305, head/sys/arm/arm/hdmi_if.m
Deleted:
  head/sys/arm/arm/hdmi_if.m
  head/sys/arm/freescale/imx/imx6_hdmireg.h
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/freescale/imx/files.imx6
  head/sys/arm/freescale/imx/imx6_hdmi.c
  head/sys/conf/files.arm

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Tue Dec 20 01:13:11 2016
(r310305)
+++ head/sys/arm/allwinner/files.allwinner  Tue Dec 20 01:34:29 2016
(r310306)
@@ -35,7 +35,7 @@ arm/allwinner/aw_cir.coptional
aw_cir
 arm/allwinner/a10_fb.c optionalvt
 arm/allwinner/a10_hdmi.c   optionalhdmi
 arm/allwinner/a10_hdmiaudio.c  optionalhdmi sound
-arm/arm/hdmi_if.m  optionalhdmi
+dev/hdmi/hdmi_if.m optionalhdmi
 
 arm/allwinner/aw_reset.c   standard
 arm/allwinner/aw_ccu.c standard

Modified: head/sys/arm/freescale/imx/files.imx6
==
--- head/sys/arm/freescale/imx/files.imx6   Tue Dec 20 01:13:11 2016
(r310305)
+++ head/sys/arm/freescale/imx/files.imx6   Tue Dec 20 01:34:29 2016
(r310306)
@@ -24,7 +24,8 @@ arm/freescale/imx/imx6_sdma.c optional 
 arm/freescale/imx/imx6_audmux.coptional sound
 arm/freescale/imx/imx6_ssi.c   optional sound
 
-arm/arm/hdmi_if.m  optional hdmi
+dev/hdmi/hdmi_if.m optional hdmi
+dev/hdmi/dwc_hdmi.coptional hdmi
 arm/freescale/imx/imx6_hdmi.c  optional hdmi
 
 arm/freescale/imx/imx6_ipu.c   optionalvt

Modified: head/sys/arm/freescale/imx/imx6_hdmi.c
==
--- head/sys/arm/freescale/imx/imx6_hdmi.c  Tue Dec 20 01:13:11 2016
(r310305)
+++ head/sys/arm/freescale/imx/imx6_hdmi.c  Tue Dec 20 01:34:29 2016
(r310306)
@@ -44,30 +44,18 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
-
-#include 
-#include 
 
 #include 
 #include 
 #include 
-#include 
 
-#include "hdmi_if.h"
+#include 
 
-#defineI2C_DDC_ADDR(0x50 << 1)
-#defineEDID_LENGTH 0x80
+#include "hdmi_if.h"
 
 struct imx_hdmi_softc {
-   device_tsc_dev;
-   struct resource *sc_mem_res;
-   int sc_mem_rid;
-   struct intr_config_hook sc_mode_hook;
-   struct videomodesc_mode;
-   uint8_t *sc_edid;
-   uint8_t sc_edid_len;
-   phandle_t   sc_i2c_xref;
+   struct dwc_hdmi_softc   base;
+   phandle_t   i2c_xref;
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -76,565 +64,17 @@ static struct ofw_compat_data compat_dat
{NULL,  0}
 };
 
-static inline uint8_t
-RD1(struct imx_hdmi_softc *sc, bus_size_t off)
-{
-
-   return (bus_read_1(sc->sc_mem_res, off));
-}
-
-static inline void
-WR1(struct imx_hdmi_softc *sc, bus_size_t off, uint8_t val)
-{
-
-   bus_write_1(sc->sc_mem_res, off, val);
-}
-
-static void
-imx_hdmi_phy_wait_i2c_done(struct imx_hdmi_softc *sc, int msec)
-{
-   uint8_t val;
-
-   val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) &
-   (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR);
-   while (val == 0) {
-   pause("HDMI_PHY", hz/100);
-   msec -= 10;
-   if (msec <= 0)
-   return;
-   val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) &
-   (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR);
-   }
-}
-
-static void
-imx_hdmi_phy_i2c_write(struct imx_hdmi_softc *sc, unsigned short data,
-unsigned char addr)
-{
-
-   /* clear DONE and ERROR flags */
-   WR1(sc, HDMI_IH_I2CMPHY_STAT0,
-   HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR);
-   WR1(sc, HDMI_PHY_I2CM_ADDRESS_ADDR, addr);
-   WR1(sc, HDMI_PHY_I2CM_DATAO_1_ADDR, ((data >> 8) & 0xff));
-  

svn commit: r310307 - head/sys/mips/ingenic

2016-12-19 Thread Jared McNeill
Author: jmcneill
Date: Tue Dec 20 01:37:00 2016
New Revision: 310307
URL: https://svnweb.freebsd.org/changeset/base/310307

Log:
  Choose the closes matching divider instead of one that results in a
  frequency >= target. Fix inverted rounding logic for CLK_SET_ROUND_UP/DOWN.
  
  Reviewed by:  kan
  Differential Revision:https://reviews.freebsd.org/D8784

Modified:
  head/sys/mips/ingenic/jz4780_clk_gen.c

Modified: head/sys/mips/ingenic/jz4780_clk_gen.c
==
--- head/sys/mips/ingenic/jz4780_clk_gen.c  Tue Dec 20 01:34:29 2016
(r310306)
+++ head/sys/mips/ingenic/jz4780_clk_gen.c  Tue Dec 20 01:37:00 2016
(r310307)
@@ -153,23 +153,29 @@ jz4780_clk_gen_set_freq(struct clknode *
 {
struct jz4780_clk_gen_sc *sc;
uint64_t _fout;
-   uint32_t divider, div_reg, div_msk, reg;
+   uint32_t divider, div_reg, div_msk, reg, div_l, div_h;
int rv;
 
sc = clknode_get_softc(clk);
 
-   divider = fin / *fout;
+   /* Find closest divider */
+   div_l = howmany(fin, *fout);
+   div_h = fin / *fout;
+   divider = abs((int64_t)*fout - (fin / div_l)) <
+   abs((int64_t)*fout - (fin / div_h)) ? div_l : div_h;
 
/* Adjust for divider multiplier */
div_reg = divider >> sc->clk_descr->clk_div.div_lg;
divider = div_reg << sc->clk_descr->clk_div.div_lg;
+   if (divider == 0)
+   divider = 1;
 
_fout = fin / divider;
 
/* Rounding */
-   if ((flags & CLK_SET_ROUND_UP) && (*fout < _fout))
+   if ((flags & CLK_SET_ROUND_UP) && (*fout > _fout))
div_reg--;
-   else if ((flags & CLK_SET_ROUND_DOWN) && (*fout > _fout))
+   else if ((flags & CLK_SET_ROUND_DOWN) && (*fout < _fout))
div_reg++;
if (div_reg == 0)
div_reg = 1;
___
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: r310308 - in head/sys/mips: conf ingenic

2016-12-19 Thread Jared McNeill
Author: jmcneill
Date: Tue Dec 20 01:51:09 2016
New Revision: 310308
URL: https://svnweb.freebsd.org/changeset/base/310308

Log:
  Add support for Ingenic JZ4780 LCD controller and enable framebuffer
  console support.
  
  Reviewed by:  kan
  Differential Revision:https://reviews.freebsd.org/D8827

Added:
  head/sys/mips/ingenic/jz4780_lcd.c   (contents, props changed)
  head/sys/mips/ingenic/jz4780_lcd.h   (contents, props changed)
Modified:
  head/sys/mips/conf/JZ4780
  head/sys/mips/ingenic/files.jz4780

Modified: head/sys/mips/conf/JZ4780
==
--- head/sys/mips/conf/JZ4780   Tue Dec 20 01:37:00 2016(r310307)
+++ head/sys/mips/conf/JZ4780   Tue Dec 20 01:51:09 2016(r310308)
@@ -86,6 +86,16 @@ device   mmcsd
 
 device dme
 
+device iic
+device iicbus
+
+# Framebuffer console support
+device vt
+device kbdmux
+device hdmi
+device videomode
+device pty
+
 # USB support
 optionsUSB_DEBUG   # enable debug msgs
 optionsUSB_HOST_ALIGN=128 # L2 cache line size
@@ -95,6 +105,7 @@ device   dwcotg  # DesignWare HS OTG cont
 device usb # USB Bus (required)
 #deviceudbp# USB Double Bulk Pipe devices
 device uhid# "Human Interface Devices"
+device ukbd# Allow keyboard like HIDs to control console
 #deviceulpt# Printer
 device umass   # Disks/Mass storage - Requires scbus and da
 device ums # Mouse

Modified: head/sys/mips/ingenic/files.jz4780
==
--- head/sys/mips/ingenic/files.jz4780  Tue Dec 20 01:37:00 2016
(r310307)
+++ head/sys/mips/ingenic/files.jz4780  Tue Dec 20 01:51:09 2016
(r310308)
@@ -6,6 +6,9 @@ mips/ingenic/jz4780_mmc.c   optional mmc
 mips/ingenic/jz4780_ohci.c optional ohci
 mips/ingenic/jz4780_smb.c  optional iicbus
 mips/ingenic/jz4780_uart.c optional uart
+mips/ingenic/jz4780_lcd.c  optional vt
+dev/hdmi/dwc_hdmi.coptional hdmi iicbus
+dev/hdmi/dwc_hdmi_fdt.coptional hdmi iicbus
 
 mips/ingenic/jz4780_clock.cstandard
 mips/ingenic/jz4780_clk_gen.c  standard
@@ -25,3 +28,6 @@ mips/ingenic/jz4780_mpboot.S  optional sm
 
 # Custom interface between pinctrl and gpio
 mips/ingenic/jz4780_gpio_if.m  standard
+
+# HDMI interface
+dev/hdmi/hdmi_if.m standard

Added: head/sys/mips/ingenic/jz4780_lcd.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/ingenic/jz4780_lcd.c  Tue Dec 20 01:51:09 2016
(r310308)
@@ -0,0 +1,572 @@
+/*-
+ * Copyright (c) 2016 Jared McNeill 
+ * 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 ``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 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$
+ */
+
+/*
+ * Ingenic JZ4780 LCD Controller
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "fb_if.h"
+#include "hdmi_if.h"
+
+#defineFB_DEFAULT_W800
+#defineFB_DEFAULT_H600
+#defineFB_DEFAULT_REF  60
+#defineFB_BPP  32
+#defineFB_ALIGN(16 * 4)
+#defineFB_MAX_BW   (1920 * 1080 * 60)
+#defineFB_MAX_W2048
+#defineFB_MAX_H2048
+#define FB_DIVIDE(x, y)(((x) + ((y) / 2)) / (y))
+

Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Sepherosa Ziehau
On Tue, Dec 20, 2016 at 4:37 AM, Ravi Pokala  wrote:
> -Original Message-
>> From:  on behalf of Ian Lepore 
>> 
>> Date: 2016-12-19, Monday at 11:20
>> To: Warner Losh , Ravi Pokala 
>> Cc: Sepherosa Ziehau , Dimitry Andric 
>> , src-committers , 
>> "svn-src-...@freebsd.org" , 
>> "svn-src-head@freebsd.org" 
>> Subject: Re: svn commit: r310171 - head/sys/sys
>>
>> On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:
>>>
>>> ...
>>>
>>> Are there other precedence for avoiding the SCN macros in the tree as
>>> well, or is this new art?
>>>
>>> Warner
>>
>> There was another commit recently the fixed the same kind of scanf
>> error by making the variable fit the scanf type (changing uint64_t to
>> an explicit long long unsigned, iirc).  I don't know if that alone
>> counts as a precedent, but IMO it's a more palatible fix than the
>> SCN/PRI ugliness.
>
> With all apologies to Churchill, SCN/PRI are the worst way to address this in 
> a machine-independent way, except for all the other ways that have been tried 
> from time to time. :-P
>

If no objection comes, I'd commit the posted patch as it is tomorrow in my time.

Thanks,
sephe

-- 
Tomorrow Will Never Die
___
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: r310171 - head/sys/sys

2016-12-19 Thread Bruce Evans

On Mon, 19 Dec 2016, Ravi Pokala wrote:


-Original Message-

From:  on behalf of Ian Lepore 

Date: 2016-12-19, Monday at 11:20
To: Warner Losh , Ravi Pokala 
Cc: Sepherosa Ziehau , Dimitry Andric , src-committers 
, "svn-src-...@freebsd.org" , 
"svn-src-head@freebsd.org" 
Subject: Re: svn commit: r310171 - head/sys/sys

On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:


...

Are there other precedence for avoiding the SCN macros in the tree as
well, or is this new art?


There was another commit recently the fixed the same kind of scanf
error by making the variable fit the scanf type (changing uint64_t to
an explicit long long unsigned, iirc).  I don't know if that alone
counts as a precedent, but IMO it's a more palatible fix than the
SCN/PRI ugliness.


That was apparently a bug, not a fix.  Someone said that the variable
needs to have type precisely uint64_t.
  (Extensive use of fixed-width types in FreeBSD is another bug.  It
  asks for fixed width at all cost.  Using the "fast" or "least" types
  would as for time or space efficiency instead.  Or just use basic
  types whenever possible for simplicity.  Fixed-width types should
  only be used on ABI boundaries.)
I think there is an ABI boundary near the other commit.  Some hardware
wants uint64_t, and we should use uint_fast64_t or uint_least64_t, but
we used uint64_t.  These uses require translation at the ABI boundary,
since the fast and least types may be larger than the fixed-width types.
  (In more complicated cases, the relevant fixed-width type does't exist.
  IIRC, POSIX requires only fixed width types of width 8, 16 and 32 to
  exist, since old badly designed ABIs like inet_addr() require a fixed
  width, but newer ABIs don't repeat the mistake for width 64.  The C
  standard requires the "fast" and "least" types for widths 8, 16, 32 and
  64 to exist.  This is possible since they can all be [unsigned] long
  long or [u]intmax_t although these might be very far from being either
  fast or least.  All fixed-width types are optional in C.  So to support
  bad software ABIs and some hardware ABIs using portable code, you have
  to read write the data using some basic type (perhaps unsigned char)
  and convert it to a "fast" or "least" type (or maybe [u]intmax_t).
We changed to using the unsigned long long abomination.  This is basically
a bad spelling of uintmax_t.  All uint_fast64_t, uint_least64_t, unsigned
long long and uintmax_t are at least as large asthe ABI type uint64_t, so
they can be used to represent the ABI values, but all need translation at
ABI booundaries since they may be strictly larger.  The translation may
be as simple as assignment, depending on how the code is written.  Since
the code wasn't written with this in mind, it might have type puns instead.
Or the compiler might just warn about all implicit conversions that might
lose bits.


With all apologies to Churchill, SCN/PRI are the worst way to address this in a 
machine-independent way, except for all the other ways that have been tried 
from time to time. :-P


No, there are much better ways.  For PRI*, just cast to [u]intmax_t.  The
only thing wrong with this is that it lots wastes space and time when
[u]intmax_t is very wide.  We don't have this problem yet since [u]intmax_t
is only 64 bits.  That would be very wide on 8-bit systems but is merely
wide on 32-bit systems and not wide on 63-bit systems.  PRI* is not even
available for an average typedef like uid_t.  It is available for all
"fast" and "least" typedefs.

For SCN*, first don't use *scanf().  Use APIs that can actually handle errors,
like strtol().  If you have to maintain bad code that uses *scanf(), then
convert to uintmax_t.  The conversions are not as short as casting for
*printf().  They are much like what is needed at ABI boundaries:

uintmax_t tmp;
uint64_t val;

/*
 * Good code does tmp = strtoumax() here.  Then handle errors
 * reported by strtoumax().  Then check that the result is
 * representable in uint64_t.  Then handle errors from that.
 *
 * Bad code did *sscanf(str, "%llx", &val) with no error checking
 * or handling of course.  The type didn't't match the format in
 * general, and the behaviour was undefined on overflow.
 */
sscanf(str, "%jx", &tmp); /* keep null error handling */
val = tmp;  /* preserve undefined on overflow */
/*
 * Overflow in sscanf() is less likely than before (uintmax_t
 * might be larger).  Then overflow occurs much like before on
 * assignment (if the result is too large for the final type).
 */

Since the conversion is more elaborate for *scanf() than for *printf(),
SCN* is slightly less bad than PRI*.  SCN* is also not available for an
average type like uid_t.  It is available for the "fast" and "least"
typedefs.  But with error handling, it is even easier to always read
into a temporary 

svn commit: r310309 - in head/sys/dev: mmc sdhci

2016-12-19 Thread Conrad E. Meyer
Author: cem
Date: Tue Dec 20 03:38:14 2016
New Revision: 310309
URL: https://svnweb.freebsd.org/changeset/base/310309

Log:
  sdhci/mmc: Minor whitespace cleanups
  
  No functional change.
  
  Submitted by: Johannes Lundberg 

Modified:
  head/sys/dev/mmc/mmc.c
  head/sys/dev/sdhci/sdhci_pci.c

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Tue Dec 20 01:51:09 2016(r310308)
+++ head/sys/dev/mmc/mmc.c  Tue Dec 20 03:38:14 2016(r310309)
@@ -401,7 +401,7 @@ mmc_wait_for_req(struct mmc_softc *sc, s
msleep(req, &sc->sc_mtx, 0, "mmcreq", 0);
MMC_UNLOCK(sc);
if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE))
-   device_printf(sc->dev, "CMD%d RESULT: %d\n", 
+   device_printf(sc->dev, "CMD%d RESULT: %d\n",
req->cmd->opcode, req->cmd->error);
return (0);
 }
@@ -511,7 +511,7 @@ mmc_idle_cards(struct mmc_softc *sc)
 {
device_t dev;
struct mmc_command cmd;
-   
+
dev = sc->dev;
mmcbr_set_chip_select(dev, cs_high);
mmcbr_update_ios(dev);
@@ -795,7 +795,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 8;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, &cmd, 0);
-   
+
memset(&cmd, 0, sizeof(cmd));
memset(&data, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
@@ -808,7 +808,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.flags = MMC_DATA_READ;
err = mmc_wait_for_cmd(sc, &cmd, 0);
sc->squelched--;
-   
+
mmcbr_set_bus_width(sc->dev, bus_width_1);
mmcbr_update_ios(sc->dev);
 
@@ -832,7 +832,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 4;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, &cmd, 0);
-   
+
memset(&cmd, 0, sizeof(cmd));
memset(&data, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
@@ -1017,7 +1017,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str
csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3);
csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4);
csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1);
-   } else 
+   } else
panic("unknown SD CSD version");
 }
 
@@ -1349,9 +1349,9 @@ mmc_discover_cards(struct mmc_softc *sc)
if (ivar->csd.csd_structure > 0)
ivar->high_cap = 1;
ivar->tran_speed = ivar->csd.tran_speed;
-   ivar->erase_sector = ivar->csd.erase_sector * 
+   ivar->erase_sector = ivar->csd.erase_sector *
ivar->csd.write_bl_len / MMC_SECTOR_SIZE;
-   
+
err = mmc_send_status(sc, ivar->rca, &status);
if (err != MMC_ERR_NONE) {
device_printf(sc->dev,
@@ -1446,7 +1446,7 @@ mmc_discover_cards(struct mmc_softc *sc)
mmc_decode_csd_mmc(ivar->raw_csd, &ivar->csd);
ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE;
ivar->tran_speed = ivar->csd.tran_speed;
-   ivar->erase_sector = ivar->csd.erase_sector * 
+   ivar->erase_sector = ivar->csd.erase_sector *
ivar->csd.write_bl_len / MMC_SECTOR_SIZE;
 
err = mmc_send_status(sc, ivar->rca, &status);
@@ -1655,7 +1655,7 @@ mmc_calculate_clock(struct mmc_softc *sc
int nkid, i, f_max;
device_t *kids;
struct mmc_ivars *ivar;
-   
+
f_max = mmcbr_get_f_max(sc->dev);
max_dtr = max_hs_dtr = f_max;
if ((mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED))
@@ -1770,7 +1770,7 @@ static void
 mmc_delayed_attach(void *xsc)
 {
struct mmc_softc *sc = xsc;
-   
+
mmc_scan(sc);
config_intrhook_disestablish(&sc->config_intrhook);
 }

Modified: head/sys/dev/sdhci/sdhci_pci.c
==
--- head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 01:51:09 2016
(r310308)
+++ head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 03:38:14 2016
(r310309)
@@ -63,15 +63,15 @@ __FBSDID("$FreeBSD$");
 #define PCI_SDHCI_IFVENDOR 0x02
 
 #define PCI_SLOT_INFO  0x40/* 8 bits */
-#define  PCI_SLOT_INFO_SLOTS(x)(((x >> 4) & 7) + 1)
-#define  PCI_SLOT_INFO_FIRST_BAR(x)((x) & 7)
+#define PCI_SLOT_INFO_SLOTS(x) (((x >> 4) & 7) + 1)
+#define PCI_SLOT_INFO_FIRST_BAR(x) ((x) & 7)
 
 /*
  * RICOH specific PCI registers
  */
 #defineSDHC_PCI_MODE_KEY   0xf9
 #defi

svn commit: r310310 - head/usr.sbin/syslogd

2016-12-19 Thread Hiroki Sato
Author: hrs
Date: Tue Dec 20 03:41:40 2016
New Revision: 310310
URL: https://svnweb.freebsd.org/changeset/base/310310

Log:
  Add a default socket bound to *:514 when no -b option is specified.
  This was accidentally removed at r309933.
  
  Spotted by:   Michael Butler

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:38:14 2016
(r310309)
+++ head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:41:40 2016
(r310310)
@@ -383,7 +383,7 @@ close_filed(struct filed *f)
 int
 main(int argc, char *argv[])
 {
-   int ch, i, fdsrmax = 0;
+   int ch, i, fdsrmax = 0, bflag = 0;
struct sockaddr_storage ss;
fd_set *fdsr = NULL;
char line[MAXLINE + 1];
@@ -437,6 +437,7 @@ main(int argc, char *argv[])
pe->pe_name = (strlen(optarg) == 0) ?
NULL : optarg;
}
+   bflag = 1;
STAILQ_INSERT_TAIL(&pqueue, pe, next);
break;
case 'c':
@@ -528,6 +529,14 @@ main(int argc, char *argv[])
}
if ((argc -= optind) != 0)
usage();
+
+   if (bflag == 0) {
+   pe = calloc(1, sizeof(*pe));
+   *pe = (struct peer) {
+   .pe_serv = "syslog"
+   };
+   STAILQ_INSERT_TAIL(&pqueue, pe, next);
+   }
STAILQ_FOREACH(pe, &pqueue, next)
socksetup(pe);
 
___
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: r310311 - head/usr.sbin/syslogd

2016-12-19 Thread Hiroki Sato
Author: hrs
Date: Tue Dec 20 04:05:21 2016
New Revision: 310311
URL: https://svnweb.freebsd.org/changeset/base/310311

Log:
  Add a NULL check.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:41:40 2016
(r310310)
+++ head/usr.sbin/syslogd/syslogd.c Tue Dec 20 04:05:21 2016
(r310311)
@@ -532,6 +532,8 @@ main(int argc, char *argv[])
 
if (bflag == 0) {
pe = calloc(1, sizeof(*pe));
+   if (pe == NULL)
+   err(1, "malloc failed");
*pe = (struct peer) {
.pe_serv = "syslog"
};
___
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: r310138 - head/lib/libc/stdio

2016-12-19 Thread John Baldwin
On Monday, December 19, 2016 02:23:08 PM Adrian Chadd wrote:
> [snip]
> 
> tl;dr - can we revert it from stdio for now so we don't end up having
> people use this?

I agree with that.  I think in userland something like snprintb() is ok.
In the kernel I'd rather keep '%b'.

-- 
John Baldwin
___
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: r310312 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 04:51:14 2016
New Revision: 310312
URL: https://svnweb.freebsd.org/changeset/base/310312

Log:
  hyperv/ic: Factor out function to send IC response
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8844

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/utilities/hv_util.h

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:05:21 
2016(r310311)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:51:14 
2016(r310312)
@@ -110,13 +110,9 @@ vmbus_heartbeat_cb(struct vmbus_channel 
}
 
/*
-* Send response by echoing the updated request back.
+* Send response by echoing the request back.
 */
-   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
-   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   data, dlen, xactid);
-   if (error)
-   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   vmbus_ic_sendresp(sc, chan, data, dlen, xactid);
 }
 
 static int

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016
(r310312)
@@ -122,13 +122,9 @@ vmbus_shutdown_cb(struct vmbus_channel *
}
 
/*
-* Send response by echoing the updated request back.
+* Send response by echoing the request back.
 */
-   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
-   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   data, dlen, xactid);
-   if (error)
-   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   vmbus_ic_sendresp(sc, chan, data, dlen, xactid);
 
if (do_shutdown)
shutdown_nice(RB_POWEROFF);

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:51:14 2016
(r310312)
@@ -203,13 +203,9 @@ vmbus_timesync_cb(struct vmbus_channel *
}
 
/*
-* Send response by echoing the updated request back.
+* Send response by echoing the request back.
 */
-   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
-   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   data, dlen, xactid);
-   if (error)
-   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   vmbus_ic_sendresp(sc, chan, data, dlen, xactid);
 }
 
 static int

Modified: head/sys/dev/hyperv/utilities/hv_util.c
==
--- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:51:14 2016
(r310312)
@@ -287,3 +287,21 @@ hv_util_detach(device_t dev)
 
return (0);
 }
+
+int
+vmbus_ic_sendresp(struct hv_util_sc *sc, struct vmbus_channel *chan,
+void *data, int dlen, uint64_t xactid)
+{
+   struct vmbus_icmsg_hdr *hdr;
+   int error;
+
+   KASSERT(dlen >= sizeof(*hdr), ("invalid data length %d", dlen));
+   hdr = data;
+
+   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
+   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
+   data, dlen, xactid);
+   if (error)
+   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   return (error);
+}

Modified: head/sys/dev/hyperv/utilities/hv_util.h
==
--- head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:51:14 2016
(r310312)
@@ -58,5 +58,8 @@ int   hv_util_detach(device_t dev);
 intvmbus_ic_probe(device_t dev, const struct vmbus_ic_desc 
descs[]);
 intvmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen,
uint32_t fw_ver, uint32_t msg_ver);
+intvmbus_ic_sendresp(struct hv_util_sc *sc,
+   struct vmbus_channel *chan, void *data, int dlen,
+   uint64_t xactid);
 
 #endif
___
svn-src-head@f

svn commit: r310313 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 05:07:12 2016
New Revision: 310313
URL: https://svnweb.freebsd.org/changeset/base/310313

Log:
  hyperv/ic: Cleanup common struct and functions.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8845

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_snapshot.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/utilities/hv_util.h

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:51:14 
2016(r310312)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:07:12 
2016(r310313)
@@ -61,7 +61,7 @@ static const struct vmbus_ic_desc vmbus_
 static void
 vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc)
 {
-   struct hv_util_sc *sc = xsc;
+   struct vmbus_ic_softc *sc = xsc;
struct vmbus_icmsg_hdr *hdr;
int dlen, error;
uint64_t xactid;
@@ -70,7 +70,7 @@ vmbus_heartbeat_cb(struct vmbus_channel 
/*
 * Receive request.
 */
-   data = sc->receive_buffer;
+   data = sc->ic_buf;
dlen = sc->ic_buflen;
error = vmbus_chan_recv(chan, data, &dlen, &xactid);
KASSERT(error != ENOBUFS, ("icbuf is not large enough"));
@@ -126,18 +126,22 @@ static int
 hv_heartbeat_attach(device_t dev)
 {
 
-   return (hv_util_attach(dev, vmbus_heartbeat_cb));
+   return (vmbus_ic_attach(dev, vmbus_heartbeat_cb));
 }
 
 static device_method_t heartbeat_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, hv_heartbeat_probe),
DEVMETHOD(device_attach, hv_heartbeat_attach),
-   DEVMETHOD(device_detach, hv_util_detach),
+   DEVMETHOD(device_detach, vmbus_ic_detach),
{ 0, 0 }
 };
 
-static driver_t heartbeat_driver = { "hvheartbeat", heartbeat_methods, 
sizeof(hv_util_sc)};
+static driver_t heartbeat_driver = {
+   "hvheartbeat",
+   heartbeat_methods,
+   sizeof(struct vmbus_ic_softc)
+};
 
 static devclass_t heartbeat_devclass;
 

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 04:51:14 2016
(r310312)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 05:07:12 2016
(r310313)
@@ -128,7 +128,7 @@ static struct cdevsw hv_kvp_cdevsw =
  * KVP transaction requests from the host.
  */
 typedef struct hv_kvp_sc {
-   struct hv_util_sc   util_sc;
+   struct vmbus_ic_softc   util_sc;
device_tdev;
 
/* Unless specified the pending mutex should be
@@ -590,7 +590,7 @@ hv_kvp_process_request(void *context, in
hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__);
 
sc = (hv_kvp_sc*)context;
-   kvp_buf = sc->util_sc.receive_buffer;
+   kvp_buf = sc->util_sc.ic_buf;
channel = vmbus_get_channel(sc->dev);
 
recvlen = sc->util_sc.ic_buflen;
@@ -885,7 +885,7 @@ hv_kvp_attach(device_t dev)
return (error);
sc->hv_kvp_dev->si_drv1 = sc;
 
-   return hv_util_attach(dev, hv_kvp_callback);
+   return (vmbus_ic_attach(dev, hv_kvp_callback));
 }
 
 static int
@@ -900,7 +900,7 @@ hv_kvp_detach(device_t dev)
}
 
destroy_dev(sc->hv_kvp_dev);
-   return hv_util_detach(dev);
+   return (vmbus_ic_detach(dev));
 }
 
 static device_method_t kvp_methods[] = {

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016
(r310312)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016
(r310313)
@@ -62,7 +62,7 @@ static const struct vmbus_ic_desc vmbus_
 static void
 vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc)
 {
-   struct hv_util_sc *sc = xsc;
+   struct vmbus_ic_softc *sc = xsc;
struct vmbus_icmsg_hdr *hdr;
struct vmbus_icmsg_shutdown *msg;
int dlen, error, do_shutdown = 0;
@@ -72,7 +72,7 @@ vmbus_shutdown_cb(struct vmbus_channel *
/*
 * Receive request.
 */
-   data = sc->receive_buffer;
+   data = sc->ic_buf;
dlen = sc->ic_buflen;
error = vmbus_chan_recv(chan, data, &dlen, &xactid);
KASSERT(error != ENOBUFS, ("icbuf is not large enough"));
@@ -141,18 +141,22 @@ static int
 hv_shutdown_attach(device_t dev)
 {
 
-   return (hv_util_attach(dev, vmbus_shutdown_cb));
+   return (vmbus_ic_attach(dev, vmbus_shutdown_cb));
 }
 
 static device_method_t shutdown_methods[] = {
 

svn commit: r310314 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 05:26:38 2016
New Revision: 310314
URL: https://svnweb.freebsd.org/changeset/base/310314

Log:
  hyperv/ic: Rename cleaned up header file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8846

Added:
  head/sys/dev/hyperv/utilities/vmbus_icvar.h
 - copied unchanged from r310313, head/sys/dev/hyperv/utilities/hv_util.h
Deleted:
  head/sys/dev/hyperv/utilities/hv_util.h
Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_snapshot.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:07:12 
2016(r310313)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:26:38 
2016(r310314)
@@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 05:26:38 2016
(r310314)
@@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
-#include "hv_util.h"
 #include "unicode.h"
 #include "hv_kvp.h"
 #include "vmbus_if.h"

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_snapshot.c
==
--- head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
-#include "hv_util.h"
 #include "hv_snapshot.h"
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_util.c
==
--- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -42,8 +42,8 @@
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Copied: head/sys/dev/hyperv/utilities/vmbus_icvar.h (from r310313, 
head/sys/dev/hyperv/utilities/hv_util.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/utilities/vmbus_icvar.h Tue Dec 20 05:26:38 2016
(r310314, copy of r310313, head/sys/dev/hyperv/utilities/hv_util.h)
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2012 NetApp Inc.
+ * Copyright (c) 2012 Citrix Inc.
+ * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITU

svn commit: r310315 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 05:39:00 2016
New Revision: 310315
URL: https://svnweb.freebsd.org/changeset/base/310315

Log:
  hyperv/ic: Inclusion cleanup
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8847

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:26:38 
2016(r310314)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:39:00 
2016(r310315)
@@ -38,8 +38,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "vmbus_if.h"
-
 #define VMBUS_HEARTBEAT_FWVER_MAJOR3
 #define VMBUS_HEARTBEAT_FWVER  \
VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0)

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016
(r310314)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:39:00 2016
(r310315)
@@ -39,8 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "vmbus_if.h"
-
 #define VMBUS_SHUTDOWN_FWVER_MAJOR 3
 #define VMBUS_SHUTDOWN_FWVER   \
VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0)

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016
(r310314)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:39:00 2016
(r310315)
@@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "vmbus_if.h"
-
 #define VMBUS_TIMESYNC_FWVER_MAJOR 3
 #define VMBUS_TIMESYNC_FWVER   \
VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0)

Modified: head/sys/dev/hyperv/utilities/hv_util.c
==
--- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016
(r310314)
+++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:39:00 2016
(r310315)
@@ -22,23 +22,16 @@
  * 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$
  */
 
-/*
- * A common driver for all hyper-V util services.
- */
+#include 
+__FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
___
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: r310316 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2016-12-19 Thread Mark Johnston
Author: markj
Date: Tue Dec 20 05:45:52 2016
New Revision: 310316
URL: https://svnweb.freebsd.org/changeset/base/310316

Log:
  Consistently print D variable indices in decimal when disassembling.
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Tue Dec 20 
05:39:00 2016(r310315)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Tue Dec 20 
05:45:52 2016(r310316)
@@ -499,7 +499,7 @@ dt_dis(const dtrace_difo_t *dp, FILE *fp
if (v->dtdv_flags & DIFV_F_MOD)
(void) strcat(flags, "/w");
 
-   (void) fprintf(fp, "%-16s %-4x %-3s %-3s %-4s %s\n",
+   (void) fprintf(fp, "%-16s %-4u %-3s %-3s %-4s %s\n",
&dp->dtdo_strtab[v->dtdv_name],
v->dtdv_id, kind, scope, flags + 1,
dt_dis_typestr(&v->dtdv_type, type, sizeof (type)));
___
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: r310317 - in head/sys: conf dev/hyperv/utilities modules/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 07:14:24 2016
New Revision: 310317
URL: https://svnweb.freebsd.org/changeset/base/310317

Log:
  hyperv/ic: Rname cleaned up file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8848

Added:
  head/sys/dev/hyperv/utilities/vmbus_ic.c
 - copied unchanged from r310316, head/sys/dev/hyperv/utilities/hv_util.c
Deleted:
  head/sys/dev/hyperv/utilities/hv_util.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/utilities/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Dec 20 05:45:52 2016(r310316)
+++ head/sys/conf/files.amd64   Tue Dec 20 07:14:24 2016(r310317)
@@ -303,7 +303,7 @@ dev/hyperv/utilities/hv_kvp.c   
optiona
 dev/hyperv/utilities/hv_snapshot.c optionalhyperv
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
-dev/hyperv/utilities/hv_util.c optionalhyperv
+dev/hyperv/utilities/vmbus_ic.coptional
hyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv 
pci

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Dec 20 05:45:52 2016(r310316)
+++ head/sys/conf/files.i386Tue Dec 20 07:14:24 2016(r310317)
@@ -259,7 +259,7 @@ dev/hyperv/utilities/hv_kvp.c   
optiona
 dev/hyperv/utilities/hv_snapshot.c optionalhyperv
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
-dev/hyperv/utilities/hv_util.c optionalhyperv
+dev/hyperv/utilities/vmbus_ic.coptional
hyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv 
pci

Copied: head/sys/dev/hyperv/utilities/vmbus_ic.c (from r310316, 
head/sys/dev/hyperv/utilities/hv_util.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/utilities/vmbus_ic.cTue Dec 20 07:14:24 2016
(r310317, copy of r310316, head/sys/dev/hyperv/utilities/hv_util.c)
@@ -0,0 +1,299 @@
+/*-
+ * Copyright (c) 2014,2016 Microsoft Corp.
+ * 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 ``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 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 "vmbus_if.h"
+
+#define VMBUS_IC_BRSIZE(4 * PAGE_SIZE)
+
+#define VMBUS_IC_VERCNT2
+#define VMBUS_IC_NEGOSZ\
+   __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT])
+CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE);
+
+static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS);
+static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS);
+
+int
+vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0,
+uint32_t 

svn commit: r310318 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 07:34:44 2016
New Revision: 310318
URL: https://svnweb.freebsd.org/changeset/base/310318

Log:
  hyperv/ic: Cleanup driver glue.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8849

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 07:14:24 
2016(r310317)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 07:34:44 
2016(r310318)
@@ -46,6 +46,9 @@ __FBSDID("$FreeBSD$");
 #define VMBUS_HEARTBEAT_MSGVER \
VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0)
 
+static int vmbus_heartbeat_probe(device_t);
+static int vmbus_heartbeat_attach(device_t);
+
 static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = {
{
.ic_guid = { .hv_guid = {
@@ -56,6 +59,27 @@ static const struct vmbus_ic_desc vmbus_
VMBUS_IC_DESC_END
 };
 
+static device_method_t vmbus_heartbeat_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, vmbus_heartbeat_probe),
+   DEVMETHOD(device_attach,vmbus_heartbeat_attach),
+   DEVMETHOD(device_detach,vmbus_ic_detach),
+   DEVMETHOD_END
+};
+
+static driver_t vmbus_heartbeat_driver = {
+   "hvheartbeat",
+   vmbus_heartbeat_methods,
+   sizeof(struct vmbus_ic_softc)
+};
+
+static devclass_t vmbus_heartbeat_devclass;
+
+DRIVER_MODULE(hv_heartbeat, vmbus, vmbus_heartbeat_driver,
+vmbus_heartbeat_devclass, NULL, NULL);
+MODULE_VERSION(hv_heartbeat, 1);
+MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1);
+
 static void
 vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc)
 {
@@ -114,35 +138,15 @@ vmbus_heartbeat_cb(struct vmbus_channel 
 }
 
 static int
-hv_heartbeat_probe(device_t dev)
+vmbus_heartbeat_probe(device_t dev)
 {
 
return (vmbus_ic_probe(dev, vmbus_heartbeat_descs));
 }
 
 static int
-hv_heartbeat_attach(device_t dev)
+vmbus_heartbeat_attach(device_t dev)
 {
 
return (vmbus_ic_attach(dev, vmbus_heartbeat_cb));
 }
-
-static device_method_t heartbeat_methods[] = {
-   /* Device interface */
-   DEVMETHOD(device_probe, hv_heartbeat_probe),
-   DEVMETHOD(device_attach, hv_heartbeat_attach),
-   DEVMETHOD(device_detach, vmbus_ic_detach),
-   { 0, 0 }
-};
-
-static driver_t heartbeat_driver = {
-   "hvheartbeat",
-   heartbeat_methods,
-   sizeof(struct vmbus_ic_softc)
-};
-
-static devclass_t heartbeat_devclass;
-
-DRIVER_MODULE(hv_heartbeat, vmbus, heartbeat_driver, heartbeat_devclass, NULL, 
NULL);
-MODULE_VERSION(hv_heartbeat, 1);
-MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1);

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:14:24 2016
(r310317)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:34:44 2016
(r310318)
@@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$");
 #define VMBUS_SHUTDOWN_MSGVER  \
VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0)
 
+static int vmbus_shutdown_probe(device_t);
+static int vmbus_shutdown_attach(device_t);
+
 static const struct vmbus_ic_desc vmbus_shutdown_descs[] = {
{
.ic_guid = { .hv_guid = {
@@ -57,6 +60,27 @@ static const struct vmbus_ic_desc vmbus_
VMBUS_IC_DESC_END
 };
 
+static device_method_t vmbus_shutdown_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, vmbus_shutdown_probe),
+   DEVMETHOD(device_attach,vmbus_shutdown_attach),
+   DEVMETHOD(device_detach,vmbus_ic_detach),
+   DEVMETHOD_END
+};
+
+static driver_t vmbus_shutdown_driver = {
+   "hvshutdown",
+   vmbus_shutdown_methods,
+   sizeof(struct vmbus_ic_softc)
+};
+
+static devclass_t vmbus_shutdown_devclass;
+
+DRIVER_MODULE(hv_shutdown, vmbus, vmbus_shutdown_driver,
+vmbus_shutdown_devclass, NULL, NULL);
+MODULE_VERSION(hv_shutdown, 1);
+MODULE_DEPEND(hv_shutdown, vmbus, 1, 1, 1);
+
 static void
 vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc)
 {
@@ -129,35 +153,15 @@ vmbus_shutdown_cb(struct vmbus_channel *
 }
 
 static int
-hv_shutdown_probe(device_t dev)
+vmbus_shutdown_probe(device_t dev)
 {
 
return (vmbus_ic_probe(dev, vmbus_shutdown_descs));
 }
 
 static int
-hv_shutdown_attach(device_t dev)
+vmbus_shutdown_attach(device_t dev)
 {
 
return (vmbus_ic_attach(dev, vmbus_shutdown_cb));
 }
-
-static device_method_t shutdown_methods[] = {
-   /* Device interface */
-   DEVMETHOD(device_probe, hv_shutdown