Re: svn commit: r268087 - head/sys/kern

2014-07-02 Thread Mateusz Guzik
On Tue, Jul 01, 2014 at 09:07:17PM +0300, Konstantin Belousov wrote:
 On Tue, Jul 01, 2014 at 04:32:38PM +0200, Mateusz Guzik wrote:
  All other threads have to be blocked, otherwise there are more dangerous
  races - for instance we support sharing file descriptor tables, so
  execve makes sure to unshare the table (fdunshare()), which is
  especially important for suid binaries. If other threads could execute,
  they could fork off after fdunshare() and then have a table shared with
  now privileged process.
 In fact, other threads can execute, just not in this process.
 If rfork(2) was used, then the filedesc table can be shared, but
 not the address space.
 

There is no problem with threads using different struct proc.

If there are rforked threads with shared fdatble, refcount is  1 and
fdunshare() copies the table. If refcount is 1, there is no rforked
thread which could modify the table. Either way, execing thread is safe
in that regard.

 I somehow thought that you already ensured that this does not happen.

My guess is you are referring to reading the table by
kern_proc_filedesc_out  friends when locks are dropped after permission
checks and nothing prevents target process from execing a suid binary
and leaking information if fdtable is read late enough.

This is not fixed yet. I had a tour over the kernel and several other
p_candebug users have this problem since they just PHOLD and drop locks.
Most PHOLD users need to also block execve, this requires some more time
to make sure all holes are spotted.

-- 
Mateusz Guzik mjguzik gmail.com
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268137 - head/sys/sys

2014-07-02 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  2 08:45:26 2014
New Revision: 268137
URL: http://svnweb.freebsd.org/changeset/base/268137

Log:
  Define a __weak macro for declaring symbols weak.

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hWed Jul  2 05:45:40 2014(r268136)
+++ head/sys/sys/cdefs.hWed Jul  2 08:45:26 2014(r268137)
@@ -210,7 +210,9 @@
 #define__packed
 #define__aligned(x)
 #define__section(x)
+#define__weak
 #else
+#define__weak  __attribute__((__weak__))
 #if !__GNUC_PREREQ__(2, 5)  !defined(__INTEL_COMPILER)
 #define__dead2
 #define__pure2
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268138 - head/sys/sys

2014-07-02 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  2 08:49:06 2014
New Revision: 268138
URL: http://svnweb.freebsd.org/changeset/base/268138

Log:
  Add support for empty data sets. Data set begin and end pointers
  should resolve to NULL when not present. This is done by declaring
  the data set begin and end symbols as weak.

Modified:
  head/sys/sys/linker_set.h

Modified: head/sys/sys/linker_set.h
==
--- head/sys/sys/linker_set.h   Wed Jul  2 08:45:26 2014(r268137)
+++ head/sys/sys/linker_set.h   Wed Jul  2 08:49:06 2014(r268138)
@@ -79,9 +79,9 @@
 /*
  * Initialize before referring to a given linker set.
  */
-#define SET_DECLARE(set, ptype)
\
-   extern ptype *__CONCAT(__start_set_,set);   \
-   extern ptype *__CONCAT(__stop_set_,set)
+#define SET_DECLARE(set, ptype)\
+   extern ptype __weak *__CONCAT(__start_set_,set);\
+   extern ptype __weak *__CONCAT(__stop_set_,set)
 
 #define SET_BEGIN(set) \
(__CONCAT(__start_set_,set))
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268139 - in stable/10/sys: cam/scsi compat/freebsd32 compat/linux

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:16:12 2014
New Revision: 268139
URL: http://svnweb.freebsd.org/changeset/base/268139

Log:
  MFC r266981:
  Overhaul CAM SG driver IOCTL interfaces.
  
  Make it really work for native FreeBSD programs.  Before this it was broken
  for years due to different number of pointer dereferences in Linux and
  FreeBSD IOCTL paths, permanently returning errors to FreeBSD programs.
  This change breaks the driver FreeBSD IOCTL ABI, making it more strict,
  but since it was not working any way -- who bother.
  
  Add shims for 32-bit programs on 64-bit host, translating the argument
  of the SG_IO IOCTL for both FreeBSD and Linux ABIs.
  
  With this change I was able to run 32-bit Linux sg3_utils tools and simple
  32 and 64-bit FreeBSD test tools on both 32 and 64-bit FreeBSD systems.

Modified:
  stable/10/sys/cam/scsi/scsi_sg.c
  stable/10/sys/cam/scsi/scsi_sg.h
  stable/10/sys/compat/freebsd32/freebsd32_ioctl.c
  stable/10/sys/compat/freebsd32/freebsd32_ioctl.h
  stable/10/sys/compat/linux/linux_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_sg.c
==
--- stable/10/sys/cam/scsi/scsi_sg.cWed Jul  2 08:49:06 2014
(r268138)
+++ stable/10/sys/cam/scsi/scsi_sg.cWed Jul  2 10:16:12 2014
(r268139)
@@ -494,7 +494,7 @@ sgioctl(struct cdev *dev, u_long cmd, ca
struct ccb_scsiio *csio;
struct cam_periph *periph;
struct sg_softc *softc;
-   struct sg_io_hdr req;
+   struct sg_io_hdr *req;
int dir, error;
 
periph = (struct cam_periph *)dev-si_drv1;
@@ -507,40 +507,22 @@ sgioctl(struct cdev *dev, u_long cmd, ca
error = 0;
 
switch (cmd) {
-   case LINUX_SCSI_GET_BUS_NUMBER: {
-   int busno;
-
-   busno = xpt_path_path_id(periph-path);
-   error = copyout(busno, arg, sizeof(busno));
-   break;
-   }
-   case LINUX_SCSI_GET_IDLUN: {
-   struct scsi_idlun idlun;
-   struct cam_sim *sim;
+   case SG_GET_VERSION_NUM:
+   {
+   int *version = (int *)arg;
 
-   idlun.dev_id = xpt_path_target_id(periph-path);
-   sim = xpt_path_sim(periph-path);
-   idlun.host_unique_id = sim-unit_number;
-   error = copyout(idlun, arg, sizeof(idlun));
+   *version = sg_version;
break;
}
-   case SG_GET_VERSION_NUM:
-   case LINUX_SG_GET_VERSION_NUM:
-   error = copyout(sg_version, arg, sizeof(sg_version));
-   break;
case SG_SET_TIMEOUT:
-   case LINUX_SG_SET_TIMEOUT: {
-   u_int user_timeout;
+   {
+   u_int user_timeout = *(u_int *)arg;
 
-   error = copyin(arg, user_timeout, sizeof(u_int));
-   if (error == 0) {
-   softc-sg_user_timeout = user_timeout;
-   softc-sg_timeout = user_timeout / SG_DEFAULT_HZ * hz;
-   }
+   softc-sg_user_timeout = user_timeout;
+   softc-sg_timeout = user_timeout / SG_DEFAULT_HZ * hz;
break;
}
case SG_GET_TIMEOUT:
-   case LINUX_SG_GET_TIMEOUT:
/*
 * The value is returned directly to the syscall.
 */
@@ -548,17 +530,14 @@ sgioctl(struct cdev *dev, u_long cmd, ca
error = 0;
break;
case SG_IO:
-   case LINUX_SG_IO:
-   error = copyin(arg, req, sizeof(req));
-   if (error)
-   break;
+   req = (struct sg_io_hdr *)arg;
 
-   if (req.cmd_len  IOCDBLEN) {
+   if (req-cmd_len  IOCDBLEN) {
error = EINVAL;
break;
}
 
-   if (req.iovec_count != 0) {
+   if (req-iovec_count != 0) {
error = EOPNOTSUPP;
break;
}
@@ -566,14 +545,14 @@ sgioctl(struct cdev *dev, u_long cmd, ca
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
csio = ccb-csio;
 
-   error = copyin(req.cmdp, csio-cdb_io.cdb_bytes,
-   req.cmd_len);
+   error = copyin(req-cmdp, csio-cdb_io.cdb_bytes,
+   req-cmd_len);
if (error) {
xpt_release_ccb(ccb);
break;
}
 
-   switch(req.dxfer_direction) {
+   switch(req-dxfer_direction) {
case SG_DXFER_TO_DEV:
dir = CAM_DIR_OUT;
break;
@@ -594,62 +573,57 @@ sgioctl(struct cdev *dev, u_long cmd, ca
  sgdone,
  dir|CAM_DEV_QFRZDIS,
  

svn commit: r268140 - stable/10/usr.sbin/ctld

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:18:42 2014
New Revision: 268140
URL: http://svnweb.freebsd.org/changeset/base/268140

Log:
  MFC r267606:
  On discovery stage add set of TargetAddress keys to reply, reporting to
  the client all the portal groups addresses and ports.

Modified:
  stable/10/usr.sbin/ctld/discovery.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/discovery.c
==
--- stable/10/usr.sbin/ctld/discovery.c Wed Jul  2 10:16:12 2014
(r268139)
+++ stable/10/usr.sbin/ctld/discovery.c Wed Jul  2 10:18:42 2014
(r268140)
@@ -35,6 +35,8 @@
 #include stdlib.h
 #include string.h
 #include netinet/in.h
+#include netdb.h
+#include sys/socket.h
 
 #include ctld.h
 #include iscsi_proto.h
@@ -155,6 +157,48 @@ logout_new_response(struct pdu *request)
return (response);
 }
 
+static void
+discovery_add_target(struct keys *response_keys, struct target *targ)
+{
+   struct portal *portal;
+   char *buf;
+   char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
+   struct addrinfo *ai;
+   int ret;
+
+   keys_add(response_keys, TargetName, targ-t_name);
+   TAILQ_FOREACH(portal, targ-t_portal_group-pg_portals, p_next) {
+   ai = portal-p_ai;
+   ret = getnameinfo(ai-ai_addr, ai-ai_addrlen,
+   hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
+   NI_NUMERICHOST | NI_NUMERICSERV);
+   if (ret != 0) {
+   log_warnx(getnameinfo: %s, gai_strerror(ret));
+   continue;
+   }
+   switch (ai-ai_addr-sa_family) {
+   case AF_INET:
+   if (strcmp(hbuf, 0.0.0.0) == 0)
+   continue;
+   ret = asprintf(buf, %s:%s,%d, hbuf, sbuf,
+   targ-t_portal_group-pg_tag);
+   break;
+   case AF_INET6:
+   if (strcmp(hbuf, ::) == 0)
+   continue;
+   ret = asprintf(buf, [%s]:%s,%d, hbuf, sbuf,
+   targ-t_portal_group-pg_tag);
+   break;
+   default:
+   continue;
+   }
+   if (ret = 0)
+   log_err(1, asprintf);
+   keys_add(response_keys, TargetAddress, buf);
+   free(buf);
+   }
+}
+
 void
 discovery(struct connection *conn)
 {
@@ -186,7 +230,7 @@ discovery(struct connection *conn)
targ-t_name);
continue;
}
-   keys_add(response_keys, TargetName, targ-t_name);
+   discovery_add_target(response_keys, targ);
}
} else {
targ = target_find(conn-conn_portal-p_portal_group-pg_conf,
@@ -194,9 +238,8 @@ discovery(struct connection *conn)
if (targ == NULL) {
log_debugx(initiator requested information on unknown 
target \%s\; returning nothing, send_targets);
-   } else {
-   keys_add(response_keys, TargetName, targ-t_name);
-   }
+   } else
+   discovery_add_target(response_keys, targ);
}
keys_save(response_keys, response);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268141 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:20:08 2014
New Revision: 268141
URL: http://svnweb.freebsd.org/changeset/base/268141

Log:
  MFC r267872:
  Allow to use iSCSI immediate data by several ctl_datamove() calls.
  
  While for FreeBSD client that is only a minor optimization, VMWare client
  doesn't support additional data requests after all data being sent once as
  immediate.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Wed Jul  2 10:18:42 2014
(r268140)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Wed Jul  2 10:20:08 2014
(r268141)
@@ -737,12 +737,15 @@ cfiscsi_handle_data_segment(struct icl_p
buffer_offset = ntohl(bhsdo-bhsdo_buffer_offset);
else
buffer_offset = 0;
+   len = icl_pdu_data_segment_length(request);
 
/*
 * Make sure the offset, as sent by the initiator, matches the offset
 * we're supposed to be at in the scatter-gather list.
 */
-   if (buffer_offset !=
+   if (buffer_offset 
+   io-scsiio.kern_rel_offset + io-scsiio.ext_data_filled ||
+   buffer_offset + len =
io-scsiio.kern_rel_offset + io-scsiio.ext_data_filled) {
CFISCSI_SESSION_WARN(cs, received bad buffer offset %zd, 
expected %zd; dropping connection, buffer_offset,
@@ -758,8 +761,8 @@ cfiscsi_handle_data_segment(struct icl_p
 * to buffer_offset, which is the offset within the task (SCSI
 * command).
 */
-   off = 0;
-   len = icl_pdu_data_segment_length(request);
+   off = io-scsiio.kern_rel_offset + io-scsiio.ext_data_filled -
+   buffer_offset;
 
/*
 * Iterate over the scatter/gather segments, filling them with data
@@ -816,12 +819,8 @@ cfiscsi_handle_data_segment(struct icl_p
 * This obviously can only happen with SCSI Command PDU. 
 */
if ((request-ip_bhs-bhs_opcode  ~ISCSI_BHS_OPCODE_IMMEDIATE) 
==
-   ISCSI_BHS_OPCODE_SCSI_COMMAND) {
-   CFISCSI_SESSION_DEBUG(cs, received too much immediate 
-   data: got %zd bytes, expected %zd,
-   icl_pdu_data_segment_length(request), off);
+   ISCSI_BHS_OPCODE_SCSI_COMMAND)
return (true);
-   }
 
CFISCSI_SESSION_WARN(cs, received too much data: got %zd 
bytes, 
expected %zd; dropping connection,
@@ -2623,8 +2622,8 @@ cfiscsi_datamove_out(union ctl_io *io)
cdw-cdw_target_transfer_tag = target_transfer_tag;
cdw-cdw_initiator_task_tag = bhssc-bhssc_initiator_task_tag;
 
-   if (cs-cs_immediate_data  io-scsiio.kern_rel_offset == 0 
-   icl_pdu_data_segment_length(request)  0) {
+   if (cs-cs_immediate_data  io-scsiio.kern_rel_offset 
+   icl_pdu_data_segment_length(request)) {
done = cfiscsi_handle_data_segment(request, cdw);
if (done) {
uma_zfree(cfiscsi_data_wait_zone, cdw);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268142 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:32:44 2014
New Revision: 268142
URL: http://svnweb.freebsd.org/changeset/base/268142

Log:
  MFC r265323 (by trasz):
  Provide better descriptions for 'struct ctl_scsiio' fields; based mostly
  on emails from ken@.

Modified:
  stable/10/sys/cam/ctl/ctl_io.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_io.h
==
--- stable/10/sys/cam/ctl/ctl_io.h  Wed Jul  2 10:20:08 2014
(r268141)
+++ stable/10/sys/cam/ctl/ctl_io.h  Wed Jul  2 10:32:44 2014
(r268142)
@@ -293,21 +293,60 @@ union ctl_io;
  */
 struct ctl_scsiio {
struct ctl_io_hdr io_hdr;   /* common to all I/O types */
+
+   /*
+* The ext_* fields are generally intended for frontend use; CTL itself
+* doesn't modify or use them.
+*/
uint32_t   ext_sg_entries;  /* 0 = no S/G list,  0 = num entries */
uint8_t*ext_data_ptr;   /* data buffer or S/G list */
uint32_t   ext_data_len;/* Data transfer length */
uint32_t   ext_data_filled; /* Amount of data filled so far */
-   uint32_t   kern_sg_entries; /* 0 = no S/G list,  0 = num entries */
-   uint32_t   rem_sg_entries;  /* 0 = no S/G list,  0 = num entries */
-   uint8_t*kern_data_ptr;  /* data buffer or S/G list */
-   uint32_t   kern_data_len;   /* Length of this S/G list/buffer */
-   uint32_t   kern_total_len;  /* Total length of this transaction */
-   uint32_t   kern_data_resid; /* Length left to transfer after this*/
-   uint32_t   kern_rel_offset; /* Byte Offset of this transfer */
+
+   /*
+* The number of scatter/gather entries in the list pointed to
+* by kern_data_ptr.  0 means there is no list, just a data pointer.
+*/
+   uint32_t   kern_sg_entries;
+
+   uint32_t   rem_sg_entries;  /* Unused. */
+
+   /*
+* The data pointer or a pointer to the scatter/gather list.
+*/
+   uint8_t*kern_data_ptr;
+
+   /*
+* Length of the data buffer or scatter/gather list.  It's also
+* the length of this particular piece of the data transfer,
+* ie. number of bytes expected to be transferred by the current
+* invocation of frontend's datamove() callback.  It's always
+* less than or equal to kern_total_len.
+*/
+   uint32_t   kern_data_len;
+
+   /*
+* Total length of data to be transferred during this particular
+* SCSI command, as decoded from SCSI CDB.
+*/
+   uint32_t   kern_total_len;
+
+   /*
+* Amount of data left after the current data transfer.
+*/
+   uint32_t   kern_data_resid;
+
+   /*
+* Byte offset of this transfer, equal to the amount of data
+* already transferred for this SCSI command during previous
+* datamove() invocations.
+*/
+   uint32_t   kern_rel_offset;
+
struct scsi_sense_data sense_data;  /* sense data */
uint8_tsense_len;   /* Returned sense length */
uint8_tscsi_status; /* SCSI status byte */
-   uint8_tsense_residual;  /* sense residual length */
+   uint8_tsense_residual;  /* Unused. */
uint32_t   residual;/* data residual length */
uint32_t   tag_num; /* tag number */
ctl_tag_type tag_type;  /* simple, ordered, head of queue,etc.*/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268143 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:35:06 2014
New Revision: 268143
URL: http://svnweb.freebsd.org/changeset/base/268143

Log:
  MFC r267481, r267952:
  Implement small KPI to access LUN options instead doing it by hands.

Modified:
  stable/10/sys/cam/ctl/ctl_backend.c
  stable/10/sys/cam/ctl/ctl_backend.h
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_backend.c
==
--- stable/10/sys/cam/ctl/ctl_backend.c Wed Jul  2 10:32:44 2014
(r268142)
+++ stable/10/sys/cam/ctl/ctl_backend.c Wed Jul  2 10:35:06 2014
(r268143)
@@ -173,6 +173,45 @@ ctl_backend_find(char *backend_name)
return (NULL);
 }
 
-/*
- * vim: ts=8
- */
+void
+ctl_init_opts(struct ctl_be_lun *be_lun, struct ctl_lun_req *req)
+{
+   struct ctl_be_lun_option *opt;
+   int i;
+
+   STAILQ_INIT(be_lun-options);
+   for (i = 0; i  req-num_be_args; i++) {
+   opt = malloc(sizeof(*opt), M_CTL, M_WAITOK);
+   opt-name = malloc(strlen(req-kern_be_args[i].kname) + 1, 
M_CTL, M_WAITOK);
+   strcpy(opt-name, req-kern_be_args[i].kname);
+   opt-value = malloc(strlen(req-kern_be_args[i].kvalue) + 1, 
M_CTL, M_WAITOK);
+   strcpy(opt-value, req-kern_be_args[i].kvalue);
+   STAILQ_INSERT_TAIL(be_lun-options, opt, links);
+   }
+}
+
+void
+ctl_free_opts(struct ctl_be_lun *be_lun)
+{
+   struct ctl_be_lun_option *opt;
+
+   while ((opt = STAILQ_FIRST(be_lun-options)) != NULL) {
+   STAILQ_REMOVE_HEAD(be_lun-options, links);
+   free(opt-name, M_CTL);
+   free(opt-value, M_CTL);
+   free(opt, M_CTL);
+   }
+}
+
+char *
+ctl_get_opt(struct ctl_be_lun *be_lun, const char *name)
+{
+   struct ctl_be_lun_option *opt;
+
+   STAILQ_FOREACH(opt, be_lun-options, links) {
+   if (strcmp(opt-name, name) == 0) {
+   return (opt-value);
+   }
+   }
+   return (NULL);
+}

Modified: stable/10/sys/cam/ctl/ctl_backend.h
==
--- stable/10/sys/cam/ctl/ctl_backend.h Wed Jul  2 10:32:44 2014
(r268142)
+++ stable/10/sys/cam/ctl/ctl_backend.h Wed Jul  2 10:35:06 2014
(r268143)
@@ -301,6 +301,14 @@ int ctl_lun_online(struct ctl_be_lun *be
  */
 void ctl_lun_capacity_changed(struct ctl_be_lun *be_lun);
 
+/*
+ * KPI to manipulate LUN options
+ */
+struct ctl_lun_req;
+void ctl_init_opts(struct ctl_be_lun *be_lun, struct ctl_lun_req *req);
+void ctl_free_opts(struct ctl_be_lun *be_lun);
+char * ctl_get_opt(struct ctl_be_lun *be_lun, const char *name);
+
 #endif /* _KERNEL */
 #endif /* _CTL_BACKEND_H_ */
 

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==
--- stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:32:44 2014
(r268142)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:35:06 2014
(r268143)
@@ -1824,9 +1824,12 @@ ctl_be_block_create(struct ctl_be_block_
struct ctl_be_block_lun *be_lun;
struct ctl_lun_create_params *params;
struct ctl_be_arg *file_arg;
+   char num_thread_str[16];
char tmpstr[32];
+   char *value;
int retval, num_threads, unmap;
int i;
+   int tmp_num_threads;
 
params = req-reqdata.create;
retval = 0;
@@ -1841,9 +1844,9 @@ ctl_be_block_create(struct ctl_be_block_
STAILQ_INIT(be_lun-input_queue);
STAILQ_INIT(be_lun-config_write_queue);
STAILQ_INIT(be_lun-datamove_queue);
-   STAILQ_INIT(be_lun-ctl_be_lun.options);
sprintf(be_lun-lunname, cblk%d, softc-num_luns);
mtx_init(be_lun-lock, be_lun-lunname, NULL, MTX_DEF);
+   ctl_init_opts(be_lun-ctl_be_lun, req);
 
be_lun-lun_zone = uma_zcreate(be_lun-lunname, CTLBLK_MAX_SEG,
NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0);
@@ -1916,50 +1919,27 @@ ctl_be_block_create(struct ctl_be_block_
 * XXX This searching loop might be refactored to be combined with
 * the loop above,
 */
-   unmap = 0;
-   for (i = 0; i  req-num_be_args; i++) {
-   if (strcmp(req-kern_be_args[i].kname, num_threads) == 0) {
-   struct ctl_be_arg *thread_arg;
-   char num_thread_str[16];
-   int tmp_num_threads;
-
-
-   thread_arg = req-kern_be_args[i];
-
-   strlcpy(num_thread_str, (char *)thread_arg-kvalue,
-   min(thread_arg-vallen,
-   sizeof(num_thread_str)));
-
-   tmp_num_threads = strtol(num_thread_str, 

svn commit: r268144 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:36:04 2014
New Revision: 268144
URL: http://svnweb.freebsd.org/changeset/base/268144

Log:
  MFC r267485:
  Remove non-functional remnants of control LUN -- 18MB of RAM for nothing.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_private.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:35:06 2014(r268143)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:36:04 2014(r268144)
@@ -961,7 +961,6 @@ ctl_init(void)
struct ctl_softc *softc;
struct ctl_io_pool *internal_pool, *emergency_pool, *other_pool;
struct ctl_frontend *fe;
-   struct ctl_lun *lun;
 uint8_t sc_id =0;
int i, error, retval;
//int isc_retval;
@@ -1049,8 +1048,6 @@ ctl_init(void)
STAILQ_INIT(softc-be_list);
STAILQ_INIT(softc-io_pools);
 
-   lun = softc-lun;
-
/*
 * We don't bother calling these with ctl_lock held here, because,
 * in theory, no one else can try to do anything while we're in our
@@ -1085,16 +1082,6 @@ ctl_init(void)
softc-emergency_pool = emergency_pool;
softc-othersc_pool = other_pool;
 
-   /*
-* We used to allocate a processor LUN here.  The new scheme is to
-* just let the user allocate LUNs as he sees fit.
-*/
-#if 0
-   mtx_lock(softc-ctl_lock);
-   ctl_alloc_lun(softc, lun, /*be_lun*/NULL, /*target*/softc-target);
-   mtx_unlock(softc-ctl_lock);
-#endif
-
if (worker_threads  MAXCPU || worker_threads == 0) {
printf(invalid kern.cam.ctl.worker_threads value; 
setting to 1);
@@ -1116,9 +1103,6 @@ ctl_init(void)
softc-work_thread, NULL, 0, 0, ctl, work%d, i);
if (error != 0) {
printf(error creating CTL work thread!\n);
-   mtx_lock(softc-ctl_lock);
-   ctl_free_lun(lun);
-   mtx_unlock(softc-ctl_lock);
ctl_pool_free(internal_pool);
ctl_pool_free(emergency_pool);
ctl_pool_free(other_pool);

Modified: stable/10/sys/cam/ctl/ctl_private.h
==
--- stable/10/sys/cam/ctl/ctl_private.h Wed Jul  2 10:35:06 2014
(r268143)
+++ stable/10/sys/cam/ctl/ctl_private.h Wed Jul  2 10:36:04 2014
(r268144)
@@ -426,7 +426,6 @@ struct ctl_softc {
struct sysctl_ctx_list sysctl_ctx;
struct sysctl_oid *sysctl_tree;
struct ctl_ioctl_info ioctl_info;
-   struct ctl_lun lun;
struct ctl_io_pool *internal_pool;
struct ctl_io_pool *emergency_pool;
struct ctl_io_pool *othersc_pool;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268145 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:37:22 2014
New Revision: 268145
URL: http://svnweb.freebsd.org/changeset/base/268145

Log:
  MFC r267496, r267498:
  Add vendor, product and revision options to control inquiry data.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:36:04 2014(r268144)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:37:22 2014(r268145)
@@ -9303,6 +9303,7 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio
struct ctl_softc *ctl_softc;
struct ctl_lun *lun;
struct ctl_frontend *fe;
+   char *val;
 #ifndef CTL_USE_BACKEND_SN
char tmpstr[32];
 #endif /* CTL_USE_BACKEND_SN */
@@ -9396,7 +9397,13 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio
 */
desc-id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10;
desc-length = sizeof(*t10id) + CTL_DEVID_LEN;
-   strncpy((char *)t10id-vendor, CTL_VENDOR, sizeof(t10id-vendor));
+   if (lun == NULL || (val = ctl_get_opt(lun-be_lun, vendor)) == NULL) {
+   strncpy((char *)t10id-vendor, CTL_VENDOR, 
sizeof(t10id-vendor));
+   } else {
+   memset(t10id-vendor, ' ', sizeof(t10id-vendor));
+   strncpy(t10id-vendor, val,
+   min(sizeof(t10id-vendor), strlen(val)));
+   }
 
/*
 * desc1 is for the WWPN which is a port asscociation.
@@ -9634,6 +9641,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
struct scsi_inquiry *cdb;
struct ctl_softc *ctl_softc;
struct ctl_lun *lun;
+   char *val;
uint32_t alloc_len;
int is_fc;
 
@@ -9778,10 +9786,16 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
 * We have 8 bytes for the vendor name, and 16 bytes for the device
 * name and 4 bytes for the revision.
 */
-   strncpy(inq_ptr-vendor, CTL_VENDOR, sizeof(inq_ptr-vendor));
+   if (lun == NULL || (val = ctl_get_opt(lun-be_lun, vendor)) == NULL) {
+   strcpy(inq_ptr-vendor, CTL_VENDOR);
+   } else {
+   memset(inq_ptr-vendor, ' ', sizeof(inq_ptr-vendor));
+   strncpy(inq_ptr-vendor, val,
+   min(sizeof(inq_ptr-vendor), strlen(val)));
+   }
if (lun == NULL) {
strcpy(inq_ptr-product, CTL_DIRECT_PRODUCT);
-   } else {
+   } else if ((val = ctl_get_opt(lun-be_lun, product)) == NULL) {
switch (lun-be_lun-lun_type) {
case T_DIRECT:
strcpy(inq_ptr-product, CTL_DIRECT_PRODUCT);
@@ -9793,13 +9807,23 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
strcpy(inq_ptr-product, CTL_UNKNOWN_PRODUCT);
break;
}
+   } else {
+   memset(inq_ptr-product, ' ', sizeof(inq_ptr-product));
+   strncpy(inq_ptr-product, val,
+   min(sizeof(inq_ptr-product), strlen(val)));
}
 
/*
 * XXX make this a macro somewhere so it automatically gets
 * incremented when we make changes.
 */
-   strncpy(inq_ptr-revision, 0001, sizeof(inq_ptr-revision));
+   if (lun == NULL || (val = ctl_get_opt(lun-be_lun, revision)) == 
NULL) {
+   strncpy(inq_ptr-revision, 0001, sizeof(inq_ptr-revision));
+   } else {
+   memset(inq_ptr-revision, ' ', sizeof(inq_ptr-revision));
+   strncpy(inq_ptr-revision, val,
+   min(sizeof(inq_ptr-revision), strlen(val)));
+   }
 
/*
 * For parallel SCSI, we support double transition and single

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Wed Jul  2 10:36:04 2014
(r268144)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Wed Jul  2 10:37:22 2014
(r268145)
@@ -2037,6 +2037,7 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
struct scsi_vpd_id_t10 *t10id;
struct ctl_lun *lun;
const struct icl_pdu *request;
+   char *val;
size_t devid_len, wwpn_len;
 
lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
@@ -2101,7 +2102,13 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
desc-proto_codeset = (SCSI_PROTO_ISCSI  4) | SVPD_ID_CODESET_ASCII;
desc-id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10;
desc-length = sizeof(*t10id) + CTL_DEVID_LEN;
-   strncpy((char *)t10id-vendor, CTL_VENDOR, sizeof(t10id-vendor));
+   if (lun == NULL || (val = ctl_get_opt(lun-be_lun, vendor)) == NULL) {
+   strncpy((char *)t10id-vendor, CTL_VENDOR, 
sizeof(t10id-vendor));
+   } else {
+   memset(t10id-vendor, ' ', 

svn commit: r268146 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:38:22 2014
New Revision: 268146
URL: http://svnweb.freebsd.org/changeset/base/268146

Log:
  MFC r267499:
  Remove custom processing for file option.

Modified:
  stable/10/sys/cam/ctl/ctl_backend_block.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==
--- stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:37:22 2014
(r268145)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:38:22 2014
(r268146)
@@ -1823,12 +1823,10 @@ ctl_be_block_create(struct ctl_be_block_
 {
struct ctl_be_block_lun *be_lun;
struct ctl_lun_create_params *params;
-   struct ctl_be_arg *file_arg;
char num_thread_str[16];
char tmpstr[32];
char *value;
int retval, num_threads, unmap;
-   int i;
int tmp_num_threads;
 
params = req-reqdata.create;
@@ -1836,8 +1834,6 @@ ctl_be_block_create(struct ctl_be_block_
 
num_threads = cbb_num_threads;
 
-   file_arg = NULL;
-
be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK);
 
be_lun-softc = softc;
@@ -1863,24 +1859,13 @@ ctl_be_block_create(struct ctl_be_block_
be_lun-ctl_be_lun.lun_type = T_DIRECT;
 
if (be_lun-ctl_be_lun.lun_type == T_DIRECT) {
-   for (i = 0; i  req-num_be_args; i++) {
-   if (strcmp(req-kern_be_args[i].kname, file) == 0) {
-   file_arg = req-kern_be_args[i];
-   break;
-   }
-   }
-
-   if (file_arg == NULL) {
+   value = ctl_get_opt(be_lun-ctl_be_lun, file);
+   if (value == NULL) {
snprintf(req-error_str, sizeof(req-error_str),
 %s: no file argument specified, __func__);
goto bailout_error;
}
-
-   be_lun-dev_path = malloc(file_arg-vallen, M_CTLBLK,
- M_WAITOK | M_ZERO);
-
-   strlcpy(be_lun-dev_path, (char *)file_arg-kvalue,
-   file_arg-vallen);
+   be_lun-dev_path = strdup(value, M_CTLBLK);
 
retval = ctl_be_block_open(softc, be_lun, req);
if (retval != 0) {
@@ -2518,25 +2503,6 @@ ctl_be_block_lun_info(void *be_lun, stru
 
retval = sbuf_printf(sb, /num_threads);
 
-   /*
-* For processor devices, we don't have a path variable.
-*/
-   if ((retval != 0)
-|| (lun-dev_path == NULL))
-   goto bailout;
-
-   retval = sbuf_printf(sb, file);
-
-   if (retval != 0)
-   goto bailout;
-
-   retval = ctl_sbuf_printf_esc(sb, lun-dev_path);
-
-   if (retval != 0)
-   goto bailout;
-
-   retval = sbuf_printf(sb, /file\n);
-
 bailout:
 
return (retval);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268147 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:39:45 2014
New Revision: 268147
URL: http://svnweb.freebsd.org/changeset/base/268147

Log:
  MFC r267500:
  Format Portal Group Tag same as istgt does -- %4.4x instead of %x.
  
  SPC-4 spec tells it should be two or more hexadecimal digits.
  RFC3720 tells it is 16-bit value.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Wed Jul  2 10:38:22 2014
(r268146)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Wed Jul  2 10:39:45 2014
(r268147)
@@ -2045,7 +2045,7 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
cs = PDU_SESSION(request);
 
wwpn_len = strlen(cs-cs_target-ct_name);
-   wwpn_len += strlen(,t,0x01);
+   wwpn_len += strlen(,t,0x0001);
wwpn_len += 1; /* '\0' */
if ((wwpn_len % 4) != 0)
wwpn_len += (4 - (wwpn_len % 4));
@@ -2134,7 +2134,7 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
desc1-id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
SVPD_ID_TYPE_SCSI_NAME;
desc1-length = wwpn_len;
-   snprintf(desc1-identifier, wwpn_len, %s,t,0x%x,
+   snprintf(desc1-identifier, wwpn_len, %s,t,0x%4.4x,
cs-cs_target-ct_name, cs-cs_portal_group_tag);
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268148 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:41:11 2014
New Revision: 268148
URL: http://svnweb.freebsd.org/changeset/base/268148

Log:
  MFC r267514:
  Move kern_total_len setting from backend to core code.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:39:45 2014(r268147)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:41:11 2014(r268148)
@@ -8800,6 +8800,9 @@ ctl_read_write(struct ctl_scsiio *ctsio)
memcpy(ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, lbalen,
   sizeof(lbalen));
 
+   ctsio-kern_total_len = num_blocks * lun-be_lun-blocksize;
+   ctsio-kern_rel_offset = 0;
+
CTL_DEBUG_PRINT((ctl_read_write: calling data_submit()\n));
 
retval = lun-backend-data_submit((union ctl_io *)ctsio);

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==
--- stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:39:45 2014
(r268147)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:41:11 2014
(r268148)
@@ -1385,15 +1385,11 @@ ctl_be_block_worker(void *context, int p
 static int
 ctl_be_block_submit(union ctl_io *io)
 {
-   struct ctl_lba_len lbalen;
struct ctl_be_block_lun *be_lun;
struct ctl_be_lun *ctl_be_lun;
-   int retval;
 
DPRINTF(entered\n);
 
-   retval = CTL_RETVAL_COMPLETE;
-
ctl_be_lun = (struct ctl_be_lun *)io-io_hdr.ctl_private[
CTL_PRIV_BACKEND_LUN].ptr;
be_lun = (struct ctl_be_block_lun *)ctl_be_lun-be_lun;
@@ -1404,11 +1400,6 @@ ctl_be_block_submit(union ctl_io *io)
KASSERT(io-io_hdr.io_type == CTL_IO_SCSI, (Non-SCSI I/O (type 
%#x) encountered, io-io_hdr.io_type));
 
-   memcpy(lbalen, io-io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes,
-  sizeof(lbalen));
-   io-scsiio.kern_total_len = lbalen.len * be_lun-blocksize;
-   io-scsiio.kern_rel_offset = 0;
-
mtx_lock(be_lun-lock);
/*
 * XXX KDM make sure that links is okay to use at this point.
@@ -1417,10 +1408,9 @@ ctl_be_block_submit(union ctl_io *io)
 */
STAILQ_INSERT_TAIL(be_lun-input_queue, io-io_hdr, links);
mtx_unlock(be_lun-lock);
-
taskqueue_enqueue(be_lun-io_taskqueue, be_lun-io_task);
 
-   return (retval);
+   return (CTL_RETVAL_COMPLETE);
 }
 
 static int

Modified: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
==
--- stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Wed Jul  2 10:39:45 2014
(r268147)
+++ stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Wed Jul  2 10:41:11 2014
(r268148)
@@ -274,20 +274,8 @@ ctl_backend_ramdisk_move_done(union ctl_
 static int
 ctl_backend_ramdisk_submit(union ctl_io *io)
 {
-   struct ctl_lba_len lbalen;
-   struct ctl_be_lun *ctl_be_lun;
 
-   ctl_be_lun = (struct ctl_be_lun *)io-io_hdr.ctl_private[
-   CTL_PRIV_BACKEND_LUN].ptr;
-
-   memcpy(lbalen, io-io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes,
-  sizeof(lbalen));
-   io-scsiio.be_move_done = ctl_backend_ramdisk_move_done;
-   io-scsiio.kern_total_len = lbalen.len * ctl_be_lun-blocksize;
-   io-scsiio.kern_rel_offset = 0;
-   io-scsiio.kern_data_resid = 0;
ctl_backend_ramdisk_continue(io);
-
return (CTL_RETVAL_COMPLETE);
 }
 
@@ -328,6 +316,8 @@ ctl_backend_ramdisk_continue(union ctl_i
io-scsiio.kern_data_ptr = softc-ramdisk_buffer;
 #endif /* CTL_RAMDISK_PAGES */
 
+   io-scsiio.be_move_done = ctl_backend_ramdisk_move_done;
+   io-scsiio.kern_data_resid = 0;
io-scsiio.kern_data_len = len_filled;
io-scsiio.kern_sg_entries = sg_filled;
io-io_hdr.flags |= CTL_FLAG_ALLOCATED;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268149 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:42:43 2014
New Revision: 268149
URL: http://svnweb.freebsd.org/changeset/base/268149

Log:
  MFC r267515:
  Remove memcpy() from ctl_private[] accesses.
  
  That union is aligned enough to access data directly.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend_block.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:41:11 2014(r268148)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:42:43 2014(r268149)
@@ -5779,7 +5779,7 @@ int
 ctl_write_same(struct ctl_scsiio *ctsio)
 {
struct ctl_lun *lun;
-   struct ctl_lba_len_flags lbalen;
+   struct ctl_lba_len_flags *lbalen;
uint64_t lba;
uint32_t num_blocks;
int len, retval;
@@ -5872,11 +5872,10 @@ ctl_write_same(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
}
 
-   lbalen.lba = lba;
-   lbalen.len = num_blocks;
-   lbalen.flags = byte2;
-   memcpy(ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, lbalen,
-  sizeof(lbalen));
+   lbalen = (struct ctl_lba_len_flags 
*)ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
+   lbalen-lba = lba;
+   lbalen-len = num_blocks;
+   lbalen-flags = byte2;
retval = lun-backend-config_write((union ctl_io *)ctsio);
 
return (retval);
@@ -5887,7 +5886,7 @@ ctl_unmap(struct ctl_scsiio *ctsio)
 {
struct ctl_lun *lun;
struct scsi_unmap *cdb;
-   struct ctl_ptr_len_flags ptrlen;
+   struct ctl_ptr_len_flags *ptrlen;
struct scsi_unmap_header *hdr;
struct scsi_unmap_desc *buf, *end;
uint64_t lba;
@@ -5942,11 +5941,10 @@ ctl_unmap(struct ctl_scsiio *ctsio)
buf = (struct scsi_unmap_desc *)(hdr + 1);
end = buf + len / sizeof(*buf);
 
-   ptrlen.ptr = (void *)buf;
-   ptrlen.len = len;
-   ptrlen.flags = byte2;
-   memcpy(ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, ptrlen,
-  sizeof(ptrlen));
+   ptrlen = (struct ctl_ptr_len_flags 
*)ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
+   ptrlen-ptr = (void *)buf;
+   ptrlen-len = len;
+   ptrlen-flags = byte2;
 
for (; buf  end; buf++) {
lba = scsi_8btou64(buf-lba);
@@ -12755,7 +12753,7 @@ ctl_process_done(union ctl_io *io, int h
switch (io-io_hdr.io_type) {
case CTL_IO_SCSI: {
int isread;
-   struct ctl_lba_len lbalen;
+   struct ctl_lba_len *lbalen;
 
isread = 0;
switch (io-scsiio.cdb[0]) {
@@ -12772,12 +12770,12 @@ ctl_process_done(union ctl_io *io, int h
case WRITE_VERIFY_10:
case WRITE_VERIFY_12:
case WRITE_VERIFY_16:
-   memcpy(lbalen, io-io_hdr.ctl_private[
-  CTL_PRIV_LBA_LEN].bytes, sizeof(lbalen));
+   lbalen = (struct ctl_lba_len *)
+   io-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
 
if (isread) {

lun-stats.ports[targ_port].bytes[CTL_STATS_READ] +=
-   lbalen.len * blocksize;
+   lbalen-len * blocksize;

lun-stats.ports[targ_port].operations[CTL_STATS_READ]++;
 
 #ifdef CTL_TIME_IO
@@ -12807,7 +12805,7 @@ ctl_process_done(union ctl_io *io, int h
 #endif /* CTL_TIME_IO */
} else {

lun-stats.ports[targ_port].bytes[CTL_STATS_WRITE] +=
-   lbalen.len * blocksize;
+   lbalen-len * blocksize;
lun-stats.ports[targ_port].operations[
CTL_STATS_WRITE]++;
 

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==
--- stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:41:11 2014
(r268148)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:42:43 2014
(r268149)
@@ -788,7 +788,7 @@ ctl_be_block_unmap_dev(struct ctl_be_blo
 {
union ctl_io *io;
struct ctl_be_block_devdata *dev_data;
-   struct ctl_ptr_len_flags ptrlen;
+   struct ctl_ptr_len_flags *ptrlen;
struct scsi_unmap_desc *buf, *end;
uint64_t len;
 
@@ -802,10 +802,9 @@ ctl_be_block_unmap_dev(struct ctl_be_blo
 
if (beio-io_offset == -1) {
beio-io_len = 0;
-   memcpy(ptrlen, 

svn commit: r268150 - stable/10/sys/cam/ctl

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:43:53 2014
New Revision: 268150
URL: http://svnweb.freebsd.org/changeset/base/268150

Log:
  MFC r267519:
  Make backends track completion by processed number of sectors instead of
  total transfer size.
  
  Commands such as VERIFY or COMPARE AND WRITE may have transfer size not
  matching directly to number of sectors.

Modified:
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==
--- stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:42:43 2014
(r268149)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c   Wed Jul  2 10:43:53 2014
(r268150)
@@ -105,6 +105,9 @@ __FBSDID($FreeBSD$);
 #define DPRINTF(fmt, args...) do {} while(0)
 #endif
 
+#define PRIV(io)   \
+((struct ctl_ptr_len_flags *)(io)-io_hdr.ctl_private[CTL_PRIV_BACKEND])
+
 SDT_PROVIDER_DEFINE(cbb);
 
 typedef enum {
@@ -358,9 +361,7 @@ ctl_be_block_move_done(union ctl_io *io)
struct bintime cur_bt;
 #endif  
 
-   beio = (struct ctl_be_block_io *)
-   io-io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr;
-
+   beio = (struct ctl_be_block_io *)PRIV(io)-ptr;
be_lun = beio-lun;
 
DPRINTF(entered\n);
@@ -934,7 +935,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
 
DPRINTF(entered\n);
 
-   beio = io-io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr;
+   beio = (struct ctl_be_block_io *)PRIV(io)-ptr;
softc = be_lun-softc;
lbalen = (struct ctl_lba_len_flags 
*)io-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
 
@@ -1041,7 +1042,7 @@ ctl_be_block_cw_dispatch_unmap(struct ct
 
DPRINTF(entered\n);
 
-   beio = io-io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr;
+   beio = (struct ctl_be_block_io *)PRIV(io)-ptr;
softc = be_lun-softc;
ptrlen = (struct ctl_ptr_len_flags 
*)io-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
 
@@ -1116,7 +1117,7 @@ ctl_be_block_cw_dispatch(struct ctl_be_b
beio-io = io;
beio-lun = be_lun;
beio-beio_cont = ctl_be_block_cw_done;
-   io-io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr = beio;
+   PRIV(io)-ptr = (void *)beio;
 
switch (io-scsiio.cdb[0]) {
case SYNCHRONIZE_CACHE:
@@ -1183,7 +1184,8 @@ ctl_be_block_dispatch(struct ctl_be_bloc
struct ctl_be_block_io *beio;
struct ctl_be_block_softc *softc;
struct ctl_lba_len *lbalen;
-   uint64_t len_left, lbaoff;
+   struct ctl_ptr_len_flags *bptrlen;
+   uint64_t len_left, lbas;
int i;
 
softc = be_lun-softc;
@@ -1199,7 +1201,8 @@ ctl_be_block_dispatch(struct ctl_be_bloc
beio = ctl_alloc_beio(softc);
beio-io = io;
beio-lun = be_lun;
-   io-io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr = beio;
+   bptrlen = PRIV(io);
+   bptrlen-ptr = (void *)beio;
 
/*
 * If the I/O came down with an ordered or head of queue tag, set
@@ -1245,12 +1248,12 @@ ctl_be_block_dispatch(struct ctl_be_bloc
lbalen = (struct ctl_lba_len 
*)io-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
DPRINTF(%s at LBA %jx len %u @%ju\n,
   (beio-bio_cmd == BIO_READ) ? READ : WRITE,
-  (uintmax_t)lbalen-lba, lbalen-len, lbaoff);
-   lbaoff = io-scsiio.kern_rel_offset / be_lun-blocksize;
-   beio-io_offset = (lbalen-lba + lbaoff) * be_lun-blocksize;
-   beio-io_len = MIN((lbalen-len - lbaoff) * be_lun-blocksize,
-   CTLBLK_MAX_IO_SIZE);
-   beio-io_len -= beio-io_len % be_lun-blocksize;
+  (uintmax_t)lbalen-lba, lbalen-len, bptrlen-len);
+   lbas = MIN(lbalen-len - bptrlen-len,
+   CTLBLK_MAX_IO_SIZE / be_lun-blocksize);
+   beio-io_offset = (lbalen-lba + bptrlen-len) * be_lun-blocksize;
+   beio-io_len = lbas * be_lun-blocksize;
+   bptrlen-len += lbas;
 
for (i = 0, len_left = beio-io_len; len_left  0; i++) {
KASSERT(i  CTLBLK_MAX_SEGS, (Too many segs (%d = %d),
@@ -1268,8 +1271,7 @@ ctl_be_block_dispatch(struct ctl_be_bloc
beio-num_segs++;
len_left -= beio-sg_segs[i].len;
}
-   if (io-scsiio.kern_rel_offset + beio-io_len 
-   io-scsiio.kern_total_len)
+   if (bptrlen-len  lbalen-len)
beio-beio_cont = ctl_be_block_next;
io-scsiio.be_move_done = ctl_be_block_move_done;
io-scsiio.kern_data_ptr = (uint8_t *)beio-sg_segs;
@@ -1320,8 +1322,7 @@ ctl_be_block_worker(void *context, int p
 
mtx_unlock(be_lun-lock);
 
-   beio = (struct ctl_be_block_io *)
-   io-io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr;
+   beio = (struct ctl_be_block_io *)PRIV(io)-ptr;
 
be_lun-dispatch(be_lun, beio);
 
@@ -1393,6 +1394,8 @@ ctl_be_block_submit(union ctl_io *io)
 

svn commit: r268151 - in stable/10/sys/cam: ctl scsi

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:45:31 2014
New Revision: 268151
URL: http://svnweb.freebsd.org/changeset/base/268151

Log:
  MFC r267537:
  Add support for VERIFY(10/12/16) and COMPARE AND WRITE SCSI commands.
  
  Make data_submit backends method support not only read and write requests,
  but also two new ones: verify and compare.  Verify just checks readability
  of the data in specified location without transferring them outside.
  Compare reads the specified data and compares them to received data,
  returning error if they are different.
  
  VERIFY(10/12/16) commands request either verify or compare from backend,
  depending on BYTCHK CDB field.  COMPARE AND WRITE command executed in two
  stages: first it requests compare, and then, if succeesed, requests write.
  Atomicity of operation is guarantied by CTL request ordering code.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl.h
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
  stable/10/sys/cam/ctl/ctl_cmd_table.c
  stable/10/sys/cam/ctl/ctl_io.h
  stable/10/sys/cam/ctl/ctl_private.h
  stable/10/sys/cam/scsi/scsi_all.c
  stable/10/sys/cam/scsi/scsi_all.h
  stable/10/sys/cam/scsi/scsi_da.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:43:53 2014(r268150)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul  2 10:45:31 2014(r268151)
@@ -4996,6 +4996,30 @@ bailout:
 
 /*
  * This gets called by a backend driver when it is done with a
+ * data_submit method.
+ */
+void
+ctl_data_submit_done(union ctl_io *io)
+{
+   /*
+* If the IO_CONT flag is set, we need to call the supplied
+* function to continue processing the I/O, instead of completing
+* the I/O just yet.
+*
+* If there is an error, though, we don't want to keep processing.
+* Instead, just send status back to the initiator.
+*/
+   if ((io-io_hdr.flags  CTL_FLAG_IO_CONT)
+ (((io-io_hdr.status  CTL_STATUS_MASK) == CTL_STATUS_NONE)
+ || ((io-io_hdr.status  CTL_STATUS_MASK) == CTL_SUCCESS))) {
+   io-scsiio.io_cont(io);
+   return;
+   }
+   ctl_done(io);
+}
+
+/*
+ * This gets called by a backend driver when it is done with a
  * configuration write.
  */
 void
@@ -8582,7 +8606,7 @@ int
 ctl_read_write(struct ctl_scsiio *ctsio)
 {
struct ctl_lun *lun;
-   struct ctl_lba_len lbalen;
+   struct ctl_lba_len_flags *lbalen;
uint64_t lba;
uint32_t num_blocks;
int reladdr, fua, dpo, ebp;
@@ -8793,10 +8817,11 @@ ctl_read_write(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
}
 
-   lbalen.lba = lba;
-   lbalen.len = num_blocks;
-   memcpy(ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, lbalen,
-  sizeof(lbalen));
+   lbalen = (struct ctl_lba_len_flags *)
+   ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
+   lbalen-lba = lba;
+   lbalen-len = num_blocks;
+   lbalen-flags = isread ? CTL_LLF_READ : CTL_LLF_WRITE;
 
ctsio-kern_total_len = num_blocks * lun-be_lun-blocksize;
ctsio-kern_rel_offset = 0;
@@ -8808,6 +8833,228 @@ ctl_read_write(struct ctl_scsiio *ctsio)
return (retval);
 }
 
+static int
+ctl_cnw_cont(union ctl_io *io)
+{
+   struct ctl_scsiio *ctsio;
+   struct ctl_lun *lun;
+   struct ctl_lba_len_flags *lbalen;
+   int retval;
+
+   ctsio = io-scsiio;
+   ctsio-io_hdr.status = CTL_STATUS_NONE;
+   ctsio-io_hdr.flags = ~CTL_FLAG_IO_CONT;
+   lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
+   lbalen = (struct ctl_lba_len_flags *)
+   ctsio-io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
+   lbalen-flags = CTL_LLF_WRITE;
+
+   CTL_DEBUG_PRINT((ctl_cnw_cont: calling data_submit()\n));
+   retval = lun-backend-data_submit((union ctl_io *)ctsio);
+   return (retval);
+}
+
+int
+ctl_cnw(struct ctl_scsiio *ctsio)
+{
+   struct ctl_lun *lun;
+   struct ctl_lba_len_flags *lbalen;
+   uint64_t lba;
+   uint32_t num_blocks;
+   int fua, dpo;
+   int retval;
+
+   lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
+
+   CTL_DEBUG_PRINT((ctl_cnw: command: %#x\n, ctsio-cdb[0]));
+
+   fua = 0;
+   dpo = 0;
+
+   retval = CTL_RETVAL_COMPLETE;
+
+   switch (ctsio-cdb[0]) {
+   case COMPARE_AND_WRITE: {
+   struct scsi_compare_and_write *cdb;
+
+   cdb = (struct scsi_compare_and_write *)ctsio-cdb;
+
+   if (cdb-byte2  SRW10_FUA)
+   fua = 1;
+   if (cdb-byte2  SRW10_DPO)
+   dpo = 1;
+   lba = scsi_8btou64(cdb-addr);
+   num_blocks = cdb-length;
+  

svn commit: r268152 - stable/10/usr.sbin/ctladm

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:48:06 2014
New Revision: 268152
URL: http://svnweb.freebsd.org/changeset/base/268152

Log:
  MFC r267506:
  Document additional LUN/backend options.

Modified:
  stable/10/usr.sbin/ctladm/ctladm.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctladm/ctladm.8
==
--- stable/10/usr.sbin/ctladm/ctladm.8  Wed Jul  2 10:45:31 2014
(r268151)
+++ stable/10/usr.sbin/ctladm/ctladm.8  Wed Jul  2 10:48:06 2014
(r268152)
@@ -34,7 +34,7 @@
 .\ $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
 .\ $FreeBSD$
 .\
-.Dd October 30, 2013
+.Dd June 15, 2014
 .Dt CTLADM 8
 .Os
 .Sh NAME
@@ -933,6 +933,29 @@ Display
 .Nm
 usage information.
 .El
+.Sh OPTIONS
+Number of additional configuration options may be specified for LUNs.
+Some options are global, others are backend-specific.
+.Pp
+Global options:
+.Bl -tag
+.It Va vendor
+Specifies LUN vendor string up to 8 chars.
+.It Va product
+Specifies LUN product string up to 16 chars.
+.It Va revision
+Specifies LUN revision string up to 4 chars.
+.It Va unmap
+Set to on, enables UNMAP support for the LUN.
+.El
+.Pp
+Options specific for block backend:
+.Bl -tag
+.It Va file
+Specifies file or device name to use for backing store.
+.It Va num_threads
+Specifies number of backend threads to use for this LUN.
+.El
 .Sh EXAMPLES
 .Dl ctladm tur 0:1
 .Pp
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268153 - stable/10/usr.sbin/ctladm

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 10:49:06 2014
New Revision: 268153
URL: http://svnweb.freebsd.org/changeset/base/268153

Log:
  MFC r267516i (by joel):
  mdoc: add missing width to Bl -tag.

Modified:
  stable/10/usr.sbin/ctladm/ctladm.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctladm/ctladm.8
==
--- stable/10/usr.sbin/ctladm/ctladm.8  Wed Jul  2 10:48:06 2014
(r268152)
+++ stable/10/usr.sbin/ctladm/ctladm.8  Wed Jul  2 10:49:06 2014
(r268153)
@@ -938,7 +938,7 @@ Number of additional configuration optio
 Some options are global, others are backend-specific.
 .Pp
 Global options:
-.Bl -tag
+.Bl -tag -width 12n
 .It Va vendor
 Specifies LUN vendor string up to 8 chars.
 .It Va product
@@ -950,7 +950,7 @@ Set to on, enables UNMAP support for t
 .El
 .Pp
 Options specific for block backend:
-.Bl -tag
+.Bl -tag -width 12n
 .It Va file
 Specifies file or device name to use for backing store.
 .It Va num_threads
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268154 - stable/10/usr.bin/whois

2014-07-02 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Jul  2 11:49:15 2014
New Revision: 268154
URL: http://svnweb.freebsd.org/changeset/base/268154

Log:
  MFC r267871: Introduce $RA_SERVER to set default whois server.
  
  Requested by: nork
  Reviewed by:  nork

Modified:
  stable/10/usr.bin/whois/whois.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/whois/whois.c
==
--- stable/10/usr.bin/whois/whois.c Wed Jul  2 10:49:06 2014
(r268153)
+++ stable/10/usr.bin/whois/whois.c Wed Jul  2 11:49:15 2014
(r268154)
@@ -179,10 +179,12 @@ main(int argc, char *argv[])
 * back to NICHOST.
 */
if (host == NULL  country == NULL) {
-   use_qnichost = 1;
-   host = NICHOST;
-   if (!(flags  WHOIS_QUICK))
-   flags |= WHOIS_RECURSE;
+   if ((host = getenv(RA_SERVER)) == NULL) {
+   use_qnichost = 1;
+   host = NICHOST;
+   if (!(flags  WHOIS_QUICK))
+   flags |= WHOIS_RECURSE;
+   }
}
while (argc--  0) {
if (country != NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268155 - stable/9/usr.bin/whois

2014-07-02 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Jul  2 11:51:01 2014
New Revision: 268155
URL: http://svnweb.freebsd.org/changeset/base/268155

Log:
  MFC r267871: Introduce $RA_SERVER to set default whois server.
  
  Requested by: nork
  Reviewed by:  nork

Modified:
  stable/9/usr.bin/whois/whois.c
Directory Properties:
  stable/9/usr.bin/whois/   (props changed)

Modified: stable/9/usr.bin/whois/whois.c
==
--- stable/9/usr.bin/whois/whois.c  Wed Jul  2 11:49:15 2014
(r268154)
+++ stable/9/usr.bin/whois/whois.c  Wed Jul  2 11:51:01 2014
(r268155)
@@ -179,10 +179,12 @@ main(int argc, char *argv[])
 * back to NICHOST.
 */
if (host == NULL  country == NULL) {
-   use_qnichost = 1;
-   host = NICHOST;
-   if (!(flags  WHOIS_QUICK))
-   flags |= WHOIS_RECURSE;
+   if ((host = getenv(RA_SERVER)) == NULL) {
+   use_qnichost = 1;
+   host = NICHOST;
+   if (!(flags  WHOIS_QUICK))
+   flags |= WHOIS_RECURSE;
+   }
}
while (argc--  0) {
if (country != NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268087 - head/sys/kern

2014-07-02 Thread Konstantin Belousov
On Wed, Jul 02, 2014 at 10:43:28AM +0200, Mateusz Guzik wrote:
 On Tue, Jul 01, 2014 at 09:07:17PM +0300, Konstantin Belousov wrote:
  On Tue, Jul 01, 2014 at 04:32:38PM +0200, Mateusz Guzik wrote:
   All other threads have to be blocked, otherwise there are more dangerous
   races - for instance we support sharing file descriptor tables, so
   execve makes sure to unshare the table (fdunshare()), which is
   especially important for suid binaries. If other threads could execute,
   they could fork off after fdunshare() and then have a table shared with
   now privileged process.
  In fact, other threads can execute, just not in this process.
  If rfork(2) was used, then the filedesc table can be shared, but
  not the address space.
  
 
 There is no problem with threads using different struct proc.
 
 If there are rforked threads with shared fdatble, refcount is  1 and
 fdunshare() copies the table. If refcount is 1, there is no rforked
 thread which could modify the table. Either way, execing thread is safe
 in that regard.
Thank you for clarifying, this is what I asked about.

 
  I somehow thought that you already ensured that this does not happen.
 
 My guess is you are referring to reading the table by
 kern_proc_filedesc_out  friends when locks are dropped after permission
 checks and nothing prevents target process from execing a suid binary
 and leaking information if fdtable is read late enough.
 
 This is not fixed yet. I had a tour over the kernel and several other
 p_candebug users have this problem since they just PHOLD and drop locks.
 Most PHOLD users need to also block execve, this requires some more time
 to make sure all holes are spotted.
 
 -- 
 Mateusz Guzik mjguzik gmail.com


pgplUma2v_9Cc.pgp
Description: PGP signature


svn commit: r268156 - head/sys/dev/oce

2014-07-02 Thread Luigi Rizzo
Author: luigi
Date: Wed Jul  2 12:13:11 2014
New Revision: 268156
URL: http://svnweb.freebsd.org/changeset/base/268156

Log:
  Various bugfixes from Stefano Garzarella:
  
  1. oce_multiq_start(): make sure the buffer is consumed even on ENXIO
  2. oce_multiq_transmit(): there is an extra call to drbr_enqueue()
causing the mbuf to be enqueued twice when the NIC's queue is full,
and potential panics
  3. oce_multiq_transmit(): same problem fixed recently in ixgbe (r267187)
 and other drivers: if the mbuf is enqueued, the proper return value is 0
  
  Submitted by: Stefano Garzarella
  MFC after:3 days

Modified:
  head/sys/dev/oce/oce_if.c

Modified: head/sys/dev/oce/oce_if.c
==
--- head/sys/dev/oce/oce_if.c   Wed Jul  2 11:51:01 2014(r268155)
+++ head/sys/dev/oce/oce_if.c   Wed Jul  2 12:13:11 2014(r268156)
@@ -563,9 +563,6 @@ oce_multiq_start(struct ifnet *ifp, stru
int queue_index = 0;
int status = 0;
 
-   if (!sc-link_status)
-   return ENXIO;
-
if ((m-m_flags  M_FLOWID) != 0)
queue_index = m-m_pkthdr.flowid % sc-nwqs;
 
@@ -1274,7 +1271,6 @@ oce_multiq_transmit(struct ifnet *ifp, s
drbr_putback(ifp, br, next);
wq-tx_stats.tx_stops ++;
ifp-if_drv_flags |= IFF_DRV_OACTIVE;
-   status = drbr_enqueue(ifp, br, next);
}  
break;
}
@@ -1285,7 +1281,7 @@ oce_multiq_transmit(struct ifnet *ifp, s
ETHER_BPF_MTAP(ifp, next);
}
 
-   return status;
+   return 0;
 }
 
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268157 - in stable/10: share/man/man4 sys/dev/cpuctl sys/sys usr.sbin/cpucontrol

2014-07-02 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  2 13:09:26 2014
New Revision: 268157
URL: http://svnweb.freebsd.org/changeset/base/268157

Log:
  MFC r267651 (by attilio):
  Add the possibility to specify ecx when performing cpuid calls.
  
  MFC r267673:
  Restore the ABI of the cpuctl(4) ioctl request CPUCTL_CPUID.
  
  MFC r267814:
  Make cpuctl_do_cpuid() and cpuctl_do_cpuid_count() return void.

Modified:
  stable/10/share/man/man4/cpuctl.4
  stable/10/sys/dev/cpuctl/cpuctl.c
  stable/10/sys/sys/cpuctl.h
  stable/10/usr.sbin/cpucontrol/cpucontrol.8
  stable/10/usr.sbin/cpucontrol/cpucontrol.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/cpuctl.4
==
--- stable/10/share/man/man4/cpuctl.4   Wed Jul  2 12:13:11 2014
(r268156)
+++ stable/10/share/man/man4/cpuctl.4   Wed Jul  2 13:09:26 2014
(r268157)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 30, 2009
+.Dd June 20, 2014
 .Dt CPUCTL 4
 .Os
 .Sh NAME
@@ -65,7 +65,7 @@ All of the supported operations are invo
 .Xr ioctl 2
 system call.
 Currently, the following ioctls are defined:
-.Bl -tag -width CPUCTL_UPDATE
+.Bl -tag -width CPUCTL_CPUID_COUNT
 .It Dv CPUCTL_RDMSR Fa cpuctl_msr_args_t *args
 .It Dv CPUCTL_WRMSR Fa cpuctl_msr_args_t *args
 Read/write CPU machine specific register.
@@ -87,20 +87,59 @@ Set/clear MSR bits according to the mask
 field.
 .It Dv CPUCTL_CPUID Fa cpuctl_cpuid_args_t *args
 Retrieve CPUID information.
-Arguments are supplied in
-the following struct:
+Arguments are supplied in the following structure:
 .Bd -literal
 typedef struct {
-   int level;  /* CPUID level */
+   int level;  /* CPUID level */
uint32_tdata[4];
 } cpuctl_cpuid_args_t;
 .Ed
-.Pp
+It is equivalent to the
+.Dv CPUCTL_CPUID_COUNT
+request with
+.Va level_type
+set to 0.
+.It Dv CPUCTL_CPUID_COUNT Fa cpuctl_cpuid_count_args_t *args
+Retrieve CPUID information.
+Arguments are supplied in the following structure:
+.Bd -literal
+typedef struct {
+   int level;  /* CPUID level */
+   int level_type; /* CPUID level type */
+   uint32_tdata[4];
+} cpuctl_cpuid_count_args_t;
+.Ed
 The
 .Va level
-field indicates the CPUID level to retrieve information for, while the
+field indicates the CPUID level to retrieve,
+it is loaded into the
+.Va %eax
+register before the CPUID instruction is executed,
+The
+.Va level_type
+field indicates the CPUID level type to retrieve,
+it is loaded into the
+.Va %ecx
+register.
+.Pp
+The
 .Va data
 field is used to store the received CPUID data.
+That is,
+.Va data[0]
+contains the value of
+.Va %eax
+register after the CPUID instruction is executed,
+.Va data[1]
+is for
+.Va %ebx ,
+.Va data[2]
+for
+.Va %ecx ,
+and
+.Va data[3]
+for
+.Va %edx .
 .It Dv CPUCTL_UPDATE cpuctl_update_args_t *args
 Update CPU firmware (microcode).
 The structure is defined in

Modified: stable/10/sys/dev/cpuctl/cpuctl.c
==
--- stable/10/sys/dev/cpuctl/cpuctl.c   Wed Jul  2 12:13:11 2014
(r268156)
+++ stable/10/sys/dev/cpuctl/cpuctl.c   Wed Jul  2 13:09:26 2014
(r268157)
@@ -67,7 +67,9 @@ static d_ioctl_t cpuctl_ioctl;
 
 static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data, u_long cmd,
 struct thread *td);
-static int cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data,
+static void cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data,
+struct thread *td);
+static void cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data,
 struct thread *td);
 static int cpuctl_do_update(int cpu, cpuctl_update_args_t *data,
 struct thread *td);
@@ -169,7 +171,8 @@ cpuctl_ioctl(struct cdev *dev, u_long cm
ret = cpuctl_do_msr(cpu, (cpuctl_msr_args_t *)data, cmd, td);
break;
case CPUCTL_CPUID:
-   ret = cpuctl_do_cpuid(cpu, (cpuctl_cpuid_args_t *)data, td);
+   cpuctl_do_cpuid(cpu, (cpuctl_cpuid_args_t *)data, td);
+   ret = 0;
break;
case CPUCTL_UPDATE:
ret = priv_check(td, PRIV_CPUCTL_UPDATE);
@@ -177,6 +180,11 @@ cpuctl_ioctl(struct cdev *dev, u_long cm
goto fail;
ret = cpuctl_do_update(cpu, (cpuctl_update_args_t *)data, td);
break;
+   case CPUCTL_CPUID_COUNT:
+   cpuctl_do_cpuid_count(cpu, (cpuctl_cpuid_count_args_t *)data,
+   td);
+   ret = 0;
+   break;
default:
ret = EINVAL;
break;
@@ -188,8 +196,9 @@ fail:
 /*
  * Actually perform cpuid operation.
  */
-static int
-cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, struct thread *td)
+static void
+cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data,
+struct thread *td)
 {
int is_bound = 

svn commit: r268158 - in head/sys: amd64/amd64 kern sys

2014-07-02 Thread Ed Maste
Author: emaste
Date: Wed Jul  2 13:24:21 2014
New Revision: 268158
URL: http://svnweb.freebsd.org/changeset/base/268158

Log:
  Prefer vt(4) for UEFI boot
  
  The UEFI framebuffer driver vt_efifb requires vt(4), so add a mechanism
  for the startup routine to set the preferred console.  This change is
  ugly because console init happens very early in the boot, making a
  cleaner interface difficult.  This change is intended only to facilitate
  the sc(4) / vt(4) transition, and can be reverted once vt(4) is the
  default.

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/kern/kern_cons.c
  head/sys/sys/cons.h

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Wed Jul  2 13:09:26 2014
(r268157)
+++ head/sys/amd64/amd64/machdep.c  Wed Jul  2 13:24:21 2014
(r268158)
@@ -1955,6 +1955,14 @@ hammer_time(u_int64_t modulep, u_int64_t
clock_init();
 
/*
+* Use vt(4) by default for UEFI boot (during the sc(4)/vt(4)
+* transition).
+*/
+   if (preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) !=
+   NULL)
+   vty_set_preferred(VTY_VT);
+
+   /*
 * Initialize the console before we print anything out.
 */
cninit();

Modified: head/sys/kern/kern_cons.c
==
--- head/sys/kern/kern_cons.c   Wed Jul  2 13:09:26 2014(r268157)
+++ head/sys/kern/kern_cons.c   Wed Jul  2 13:24:21 2014(r268158)
@@ -652,6 +652,7 @@ sysbeep(int pitch __unused, int period _
 /*
  * Temporary support for sc(4) to vt(4) transition.
  */
+static unsigned vty_prefer;
 static char vty_name[16];
 SYSCTL_STRING(_kern, OID_AUTO, vty, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, vty_name,
 0, Console vty driver);
@@ -676,6 +677,10 @@ vty_enabled(unsigned vty)
break;
}
 #endif
+   if (vty_prefer != 0) {
+   vty_selected = vty_prefer;
+   break;
+   }
 #if defined(DEV_SC)
vty_selected = VTY_SC;
 #elif defined(DEV_VT)
@@ -691,3 +696,16 @@ vty_enabled(unsigned vty)
return ((vty_selected  vty) != 0);
 }
 
+void
+vty_set_preferred(unsigned vty)
+{
+
+   vty_prefer = vty;
+#if !defined(DEV_SC)
+   vty_prefer = ~DEV_SC;
+#endif
+#if !defined(DEV_VT)
+   vty_prefer = ~DEV_VT;
+#endif
+}
+

Modified: head/sys/sys/cons.h
==
--- head/sys/sys/cons.h Wed Jul  2 13:09:26 2014(r268157)
+++ head/sys/sys/cons.h Wed Jul  2 13:24:21 2014(r268158)
@@ -137,6 +137,7 @@ voidconstty_clear(void);
 #defineVTY_SC 0x01
 #defineVTY_VT 0x02
 intvty_enabled(unsigned int);
+void   vty_set_preferred(unsigned int);
 
 #endif /* _KERNEL */
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268159 - head/usr.bin/mkimg

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 14:34:01 2014
New Revision: 268159
URL: http://svnweb.freebsd.org/changeset/base/268159

Log:
  Add a ful stop after FreeBSD's version in the history section.
  
  Pointed out by: brueffer@ (thanks!)

Modified:
  head/usr.bin/mkimg/mkimg.1

Modified: head/usr.bin/mkimg/mkimg.1
==
--- head/usr.bin/mkimg/mkimg.1  Wed Jul  2 13:24:21 2014(r268158)
+++ head/usr.bin/mkimg/mkimg.1  Wed Jul  2 14:34:01 2014(r268159)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd July 1, 2014
+.Dd July 2, 2014
 .Dt MKIMG 1
 .Os
 .Sh NAME
@@ -174,7 +174,7 @@ In the following example the file system
 The
 .Nm
 utility first appeared in
-.Fx 10.1
+.Fx 10.1 .
 .Sh AUTHORS
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268160 - head/sys/kern

2014-07-02 Thread Ed Maste
Author: emaste
Date: Wed Jul  2 14:47:48 2014
New Revision: 268160
URL: http://svnweb.freebsd.org/changeset/base/268160

Log:
  Fix typos in VTY constant names from r268158

Modified:
  head/sys/kern/kern_cons.c

Modified: head/sys/kern/kern_cons.c
==
--- head/sys/kern/kern_cons.c   Wed Jul  2 14:34:01 2014(r268159)
+++ head/sys/kern/kern_cons.c   Wed Jul  2 14:47:48 2014(r268160)
@@ -702,10 +702,10 @@ vty_set_preferred(unsigned vty)
 
vty_prefer = vty;
 #if !defined(DEV_SC)
-   vty_prefer = ~DEV_SC;
+   vty_prefer = ~VTY_SC;
 #endif
 #if !defined(DEV_VT)
-   vty_prefer = ~DEV_VT;
+   vty_prefer = ~VTY_VT;
 #endif
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268161 - in stable/10/usr.bin: . mkimg

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 14:54:41 2014
New Revision: 268161
URL: http://svnweb.freebsd.org/changeset/base/268161

Log:
  MFC mkimg(1) -- revisions 268159, 268134, 266556, 266514, 266513,
266512, 266511, 266510, 266509, 266176, 265468, 265467,
265462, 265170, 263926, 263924, 263923, 263919 and 263918.
  
  Revision 267182 changed mkimg.1 alongside other unrelated manpages.
  The change to mkimg.1 has been applied without registering a merge
  of the revision. This allows a future merge of r267182 to happen.
  
  Relnotes: yes

Added:
  stable/10/usr.bin/mkimg/
 - copied from r263918, head/usr.bin/mkimg/
  stable/10/usr.bin/mkimg/format.c
 - copied unchanged from r266176, head/usr.bin/mkimg/format.c
  stable/10/usr.bin/mkimg/format.h
 - copied unchanged from r266176, head/usr.bin/mkimg/format.h
  stable/10/usr.bin/mkimg/image.c
 - copied, changed from r266176, head/usr.bin/mkimg/image.c
  stable/10/usr.bin/mkimg/image.h
 - copied unchanged from r266176, head/usr.bin/mkimg/image.h
  stable/10/usr.bin/mkimg/raw.c
 - copied unchanged from r266176, head/usr.bin/mkimg/raw.c
  stable/10/usr.bin/mkimg/vmdk.c
 - copied unchanged from r266176, head/usr.bin/mkimg/vmdk.c
Modified:
  stable/10/usr.bin/Makefile
  stable/10/usr.bin/mkimg/Makefile   (contents, props changed)
  stable/10/usr.bin/mkimg/apm.c
  stable/10/usr.bin/mkimg/bsd.c
  stable/10/usr.bin/mkimg/ebr.c
  stable/10/usr.bin/mkimg/gpt.c
  stable/10/usr.bin/mkimg/mbr.c
  stable/10/usr.bin/mkimg/mkimg.1   (contents, props changed)
  stable/10/usr.bin/mkimg/mkimg.c   (contents, props changed)
  stable/10/usr.bin/mkimg/mkimg.h
  stable/10/usr.bin/mkimg/pc98.c
  stable/10/usr.bin/mkimg/scheme.c   (contents, props changed)
  stable/10/usr.bin/mkimg/scheme.h   (contents, props changed)
  stable/10/usr.bin/mkimg/vtoc8.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/Makefile
==
--- stable/10/usr.bin/Makefile  Wed Jul  2 14:47:48 2014(r268160)
+++ stable/10/usr.bin/Makefile  Wed Jul  2 14:54:41 2014(r268161)
@@ -106,6 +106,7 @@ SUBDIR= alias \
mkdep \
${_mkesdb} \
mkfifo \
+   mkimg \
mklocale \
mktemp \
mkulzma \

Modified: stable/10/usr.bin/mkimg/Makefile
==
--- head/usr.bin/mkimg/Makefile Sat Mar 29 19:03:10 2014(r263918)
+++ stable/10/usr.bin/mkimg/MakefileWed Jul  2 14:54:41 2014
(r268161)
@@ -1,11 +1,16 @@
 # $FreeBSD$
 
 PROG=  mkimg
-SRCS=  mkimg.c scheme.c
+SRCS=  format.c image.c mkimg.c scheme.c
 MAN=   mkimg.1
 
 CFLAGS+=-DSPARSE_WRITE
 
+# List of formats to support
+SRCS+= \
+   raw.c \
+   vmdk.c
+
 # List of schemes to support
 SRCS+= \
apm.c \

Modified: stable/10/usr.bin/mkimg/apm.c
==
--- head/usr.bin/mkimg/apm.cSat Mar 29 19:03:10 2014(r263918)
+++ stable/10/usr.bin/mkimg/apm.c   Wed Jul  2 14:54:41 2014
(r268161)
@@ -35,11 +35,17 @@ __FBSDID($FreeBSD$);
 #include string.h
 #include unistd.h
 
+#include image.h
 #include mkimg.h
 #include scheme.h
 
+#ifndef APM_ENT_TYPE_FREEBSD_NANDFS
+#defineAPM_ENT_TYPE_FREEBSD_NANDFS FreeBSD-nandfs
+#endif
+
 static struct mkimg_alias apm_aliases[] = {
 {  ALIAS_FREEBSD, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD) },
+{  ALIAS_FREEBSD_BOOT, ALIAS_PTR2TYPE(APM_ENT_TYPE_APPLE_BOOT) },
 {  ALIAS_FREEBSD_NANDFS, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_NANDFS) },
 {  ALIAS_FREEBSD_SWAP, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_SWAP) },
 {  ALIAS_FREEBSD_UFS, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_UFS) },
@@ -58,13 +64,12 @@ apm_metadata(u_int where)
 }
 
 static int
-apm_write(int fd __unused, lba_t imgsz __unused, void *bootcode __unused)
+apm_write(lba_t imgsz, void *bootcode __unused)
 {
u_char *buf;
struct apm_ddr *ddr;
struct apm_ent *ent;
struct part *part;
-   ssize_t nbytes;
int error;
 
buf = calloc(nparts + 2, secsz);
@@ -81,8 +86,8 @@ apm_write(int fd __unused, lba_t imgsz _
be32enc(ent-ent_pmblkcnt, nparts + 1);
be32enc(ent-ent_start, 1);
be32enc(ent-ent_size, nparts + 1);
-   strcpy(ent-ent_type, APM_ENT_TYPE_SELF);
-   strcpy(ent-ent_name, Apple);
+   strncpy(ent-ent_type, APM_ENT_TYPE_SELF, sizeof(ent-ent_type));
+   strncpy(ent-ent_name, Apple, sizeof(ent-ent_name));
 
STAILQ_FOREACH(part, partlist, link) {
ent = (void *)(buf + (part-index + 2) * secsz);
@@ -90,17 +95,14 @@ apm_write(int fd __unused, lba_t imgsz _
be32enc(ent-ent_pmblkcnt, nparts + 1);
be32enc(ent-ent_start, part-block);
be32enc(ent-ent_size, part-size);
-   strcpy(ent-ent_type, ALIAS_TYPE2PTR(part-type));
+   

svn commit: r268162 - head/release/amd64

2014-07-02 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed Jul  2 15:23:13 2014
New Revision: 268162
URL: http://svnweb.freebsd.org/changeset/base/268162

Log:
  Now that GENERIC can boot on UEFI systems (r268158), switch the build to use
  UEFI-compatible images. These will boot as before on BIOS systems, but will
  boot using the UEFI loader on UEFI-aware systems.

Replaced:
  head/release/amd64/make-memstick.sh
 - copied unchanged from r268161, head/release/amd64/make-uefi-memstick.sh
  head/release/amd64/mkisoimages.sh
 - copied unchanged from r268161, head/release/amd64/mkisoimages-uefi.sh
Deleted:
  head/release/amd64/make-uefi-memstick.sh
  head/release/amd64/mkisoimages-uefi.sh

Copied: head/release/amd64/make-memstick.sh (from r268161, 
head/release/amd64/make-uefi-memstick.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/release/amd64/make-memstick.sh Wed Jul  2 15:23:13 2014
(r268162, copy of r268161, head/release/amd64/make-uefi-memstick.sh)
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# This script generates a memstick image (image that can be copied to a
+# USB memory stick) from a directory tree.  Note that the script does not
+# clean up after itself very well for error conditions on purpose so the
+# problem can be diagnosed (full filesystem most likely but ...).
+#
+# Usage: make-memstick.sh directory tree image filename
+#
+# $FreeBSD$
+#
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+export PATH
+
+if [ $# -ne 2 ]; then
+   echo make-memstick.sh /path/to/directory /path/to/image/file
+   exit 1
+fi
+
+if [ ! -d ${1} ]; then
+   echo ${1} must be a directory
+   exit 1
+fi
+
+if [ -e ${2} ]; then
+   echo won't overwrite ${2}
+   exit 1
+fi
+
+echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1'  ${1}/etc/fstab
+makefs -B little -o label=FreeBSD_Install ${2}.part ${1}
+if [ $? -ne 0 ]; then
+   echo makefs failed
+   exit 1
+fi
+rm ${1}/etc/fstab
+
+mkimg -s gpt -b ${1}/boot/pmbr -p efi:=${1}/boot/boot1.efifat -p 
freebsd-boot:=${1}/boot/gptboot -p freebsd-ufs:=${2}.part -p freebsd-swap::1M 
-o ${2}
+rm ${2}.part
+

Copied: head/release/amd64/mkisoimages.sh (from r268161, 
head/release/amd64/mkisoimages-uefi.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/release/amd64/mkisoimages.sh   Wed Jul  2 15:23:13 2014
(r268162, copy of r268161, head/release/amd64/mkisoimages-uefi.sh)
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Module: mkisoimages.sh
+# Author: Jordan K Hubbard
+# Date:   22 June 2001
+#
+# $FreeBSD$
+#
+# This script is used by release/Makefile to build the (optional) ISO images
+# for a FreeBSD release.  It is considered architecture dependent since each
+# platform has a slightly unique way of making bootable CDs.  This script
+# is also allowed to generate any number of images since that is more of
+# publishing decision than anything else.
+#
+# Usage:
+#
+# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
+#
+# Where -b is passed if the ISO image should be made bootable by
+# whatever standards this architecture supports (may be unsupported),
+# image-label is the ISO image label, image-name is the filename of the
+# resulting ISO image, base-bits-dir contains the image contents and
+# extra-bits-dir, if provided, contains additional files to be merged
+# into base-bits-dir as part of making the image.
+
+if [ x$1 = x-b ]; then
+   # This is highly x86-centric and will be used directly below.
+   bootable=-o bootimage=i386;$4/boot/cdboot -o no-emul-boot
+
+   # Make EFI system partition (should be done with makefs in the future)
+   dd if=/dev/zero of=efiboot.img bs=4k count=100
+   device=`mdconfig -a -t vnode -f efiboot.img`
+   newfs_msdos -F 12 -m 0xf8 /dev/$device
+   mkdir efi
+   mount -t msdosfs /dev/$device efi
+   mkdir -p efi/efi/boot
+   cp ${4}/boot/loader.efi efi/efi/boot/bootx64.efi
+   umount efi
+   rmdir efi
+   mdconfig -d -u $device
+   bootable=-o bootimage=i386;efiboot.img -o no-emul-boot $bootable
+   
+   shift
+else
+   bootable=
+fi
+
+if [ $# -lt 3 ]; then
+   echo Usage: $0 '[-b] image-label image-name base-bits-dir 
[extra-bits-dir]'
+   exit 1
+fi
+
+LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
+NAME=$1; shift
+
+publisher=The FreeBSD Project.  http://www.FreeBSD.org/;
+echo /dev/iso9660/$LABEL / cd9660 ro 0 0  $1/etc/fstab
+makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o 
publisher=$publisher $NAME $*
+rm $1/etc/fstab
+rm -f efiboot.img
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268165 - head/sys/dev/bge

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 16:17:48 2014
New Revision: 268165
URL: http://svnweb.freebsd.org/changeset/base/268165

Log:
  Fix off-by-one introduced by the conversion to the driver API.
  
  Submitted by:   Sreekanth Rupavatharam rupav...@juniper.net
  Obtained from:  Juniper Networks, Inc.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Wed Jul  2 16:11:59 2014(r268164)
+++ head/sys/dev/bge/if_bge.c   Wed Jul  2 16:17:48 2014(r268165)
@@ -3738,7 +3738,7 @@ bge_attach(device_t dev)
if_setioctlfn(ifp, bge_ioctl);
if_setstartfn(ifp, bge_start);
if_setinitfn(ifp, bge_init);
-   if_setsendqlen(ifp, BGE_TX_RING_CNT);
+   if_setsendqlen(ifp, BGE_TX_RING_CNT - 1);
if_setsendqready(ifp);
if_sethwassist(ifp, sc-bge_csum_features);
if_setcapabilities(ifp, IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING |
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268167 - stable/10/sys/kern

2014-07-02 Thread Don Lewis
Author: truckman
Date: Wed Jul  2 17:32:43 2014
New Revision: 268167
URL: http://svnweb.freebsd.org/changeset/base/268167

Log:
  MFC r266814
  
  Initialize r_flags the same way in all cases using a sanitized copy of
  flags that has several bits cleared. The RF_WANTED and RF_FIRSTSHARE
  bits are invalid in this context, and we want to defer setting RF_ACTIVE
  in r_flags until later.  This should make rman_get_flags() return
  the correct answer in all cases.
  
  Add a KASSERT() to catch callers which incorrectly pass the RF_WANTED
  or RF_FIRSTSHARE flags.
  
  Do a strict equality check on the share type bits of flags.  In
  particular, do an equality check on RF_PREFETCHABLE.  The previous
  code would allow one type of mismatch of RF_PREFETCHABLE but disallow
  the other type of mismatch.  Also, ignore the the RF_ALIGNMENT_MASK
  bits since alignment validity should be handled by the amask check.
  This field contains an integer value, but previous code did a strange
  bitwise comparison on it.
  
  Leave the original value of flags unmolested as a minor debug aid.
  
  Change the start+amask overflow check to a KASSERT() since it is just
  meant to catch a highly unlikely programming error in the caller.
  
  Reviewed by:  jhb

Modified:
  stable/10/sys/kern/subr_rman.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/subr_rman.c
==
--- stable/10/sys/kern/subr_rman.c  Wed Jul  2 17:25:28 2014
(r268166)
+++ stable/10/sys/kern/subr_rman.c  Wed Jul  2 17:32:43 2014
(r268167)
@@ -435,12 +435,14 @@ rman_adjust_resource(struct resource *rr
return (0);
 }
 
+#defineSHARE_TYPE(f)   (f  (RF_SHAREABLE | RF_TIMESHARE | 
RF_PREFETCHABLE))
+
 struct resource *
 rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
  u_long count, u_long bound,  u_int flags,
  struct device *dev)
 {
-   u_int   want_activate;
+   u_int   new_rflags;
struct  resource_i *r, *s, *rv;
u_long  rstart, rend, amask, bmask;
 
@@ -450,8 +452,10 @@ rman_reserve_resource_bound(struct rman 
   length %#lx, flags %u, device %s\n, rm-rm_descr, start, end,
   count, flags,
   dev == NULL ? null : device_get_nameunit(dev)));
-   want_activate = (flags  RF_ACTIVE);
-   flags = ~RF_ACTIVE;
+   KASSERT((flags  (RF_WANTED | RF_FIRSTSHARE)) == 0,
+   (invalid flags %#x, flags));
+   new_rflags = (flags  ~(RF_ACTIVE | RF_WANTED | RF_FIRSTSHARE)) |
+   RF_ALLOCATED;
 
mtx_lock(rm-rm_mtx);
 
@@ -466,10 +470,8 @@ rman_reserve_resource_bound(struct rman 
}
 
amask = (1ul  RF_ALIGNMENT(flags)) - 1;
-   if (start  ULONG_MAX - amask) {
-   DPRINTF((start+amask would wrap around\n));
-   goto out;
-   }
+   KASSERT(start = ULONG_MAX - amask,
+   (start (%#lx) + amask (%#lx) would wrap around, start, amask));
 
/* If bound is 0, bmask will also be 0 */
bmask = ~(bound - 1);
@@ -522,7 +524,7 @@ rman_reserve_resource_bound(struct rman 
if ((s-r_end - s-r_start + 1) == count) {
DPRINTF((candidate region is entire chunk\n));
rv = s;
-   rv-r_flags |= RF_ALLOCATED | flags;
+   rv-r_flags = new_rflags;
rv-r_dev = dev;
goto out;
}
@@ -542,7 +544,7 @@ rman_reserve_resource_bound(struct rman 
goto out;
rv-r_start = rstart;
rv-r_end = rstart + count - 1;
-   rv-r_flags = flags | RF_ALLOCATED;
+   rv-r_flags = new_rflags;
rv-r_dev = dev;
rv-r_rm = rm;
 
@@ -603,7 +605,7 @@ rman_reserve_resource_bound(struct rman 
goto out;
 
for (s = r; s  s-r_end = end; s = TAILQ_NEXT(s, r_link)) {
-   if ((s-r_flags  flags) == flags 
+   if (SHARE_TYPE(s-r_flags) == SHARE_TYPE(flags) 
s-r_start = start 
(s-r_end - s-r_start + 1) == count 
(s-r_start  amask) == 0 
@@ -613,8 +615,7 @@ rman_reserve_resource_bound(struct rman 
goto out;
rv-r_start = s-r_start;
rv-r_end = s-r_end;
-   rv-r_flags = s-r_flags 
-   (RF_ALLOCATED | RF_SHAREABLE | RF_TIMESHARE);
+   rv-r_flags = new_rflags;
rv-r_dev = dev;
rv-r_rm = rm;
if (s-r_sharehead == NULL) {
@@ -641,13 +642,12 @@ 

svn commit: r268168 - stable/8/etc/rc.d

2014-07-02 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jul  2 19:18:59 2014
New Revision: 268168
URL: http://svnweb.freebsd.org/changeset/base/268168

Log:
  MFC r243080:
  
Only pass ip[46].addr when _addrl contains a value
  
  Partial MFC r204759:
  
Redirect stdin from /dev/null when starting a jail:
  At least in RELENG_7 this fixes some start problems for some programs
  from the ports. It is also more correct, as a jail shall not expect
  input (interactivity) from the jail-host.
  
  PR:   180916

Modified:
  stable/8/etc/rc.d/jail
Directory Properties:
  stable/8/etc/   (props changed)
  stable/8/etc/rc.d/   (props changed)

Modified: stable/8/etc/rc.d/jail
==
--- stable/8/etc/rc.d/jail  Wed Jul  2 17:32:43 2014(r268167)
+++ stable/8/etc/rc.d/jail  Wed Jul  2 19:18:59 2014(r268168)
@@ -654,7 +654,9 @@ jail_start()
done
 
eval ${_setfib} jail -n ${_jail} ${_flags} -i -c 
path=${_rootdir} host.hostname=${_hostname} \
-   ip4.addr=\${_addrl}\ ip6.addr=\${_addr6l}\ 
${_parameters} command=${_exec_start}  ${_tmp_jail} 21
+   ${_addrl:+ip4.addr=\${_addrl}\} 
${_addr6l:+ip6.addr=\${_addr6l}\} \
+   ${_parameters} command=${_exec_start}  ${_tmp_jail} 
21 \
+   /dev/null
 
if [ $? -eq 0 ] ; then
_jail_id=$(head -1 ${_tmp_jail})
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268169 - head/share/man/man4

2014-07-02 Thread Ed Maste
Author: emaste
Date: Wed Jul  2 19:22:12 2014
New Revision: 268169
URL: http://svnweb.freebsd.org/changeset/base/268169

Log:
  Clarify the setting of syscons driver flags
  
  Submitted by: wblock

Modified:
  head/share/man/man4/syscons.4

Modified: head/share/man/man4/syscons.4
==
--- head/share/man/man4/syscons.4   Wed Jul  2 19:18:59 2014
(r268168)
+++ head/share/man/man4/syscons.4   Wed Jul  2 19:22:12 2014
(r268169)
@@ -403,7 +403,9 @@ option too.
 The following driver flags can be used to control the
 .Nm
 driver.
-They can be set either in
+Driver flags can be set with the
+.Cd hint.sc.0.flags
+tunable, either in
 .Pa /boot/device.hints ,
 or else at the loader prompt (see
 .Xr loader 8 ) .
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268171 - stable/9/usr.sbin/bsdconfig/share/packages

2014-07-02 Thread Devin Teske
Author: dteske
Date: Wed Jul  2 19:25:49 2014
New Revision: 268171
URL: http://svnweb.freebsd.org/changeset/base/268171

Log:
  MFC r267680:
  Fix a code typo that prevented mkdir from firing (unnoticed
  usually because another part of the code succeeded in making
  the same directory).

Modified:
  stable/9/usr.sbin/bsdconfig/share/packages/index.subr
Directory Properties:
  stable/9/usr.sbin/bsdconfig/   (props changed)

Modified: stable/9/usr.sbin/bsdconfig/share/packages/index.subr
==
--- stable/9/usr.sbin/bsdconfig/share/packages/index.subr   Wed Jul  2 
19:25:25 2014(r268170)
+++ stable/9/usr.sbin/bsdconfig/share/packages/index.subr   Wed Jul  2 
19:25:49 2014(r268171)
@@ -258,7 +258,7 @@ f_index_initialize()
 
# Finally, move the temporary file into place
case $PACKAGES_INDEX_CACHEFILE in
-   */*) f_eval_catch -d $funcname mkdir \
+   */*) f_eval_catch -d $__funcname mkdir \
'mkdir -p %s' ${PACKAGES_INDEX_CACHEFILE%/*}
esac
f_eval_catch -d $__funcname mv 'mv -f %s %s' \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268170 - stable/10/usr.sbin/bsdconfig/share/packages

2014-07-02 Thread Devin Teske
Author: dteske
Date: Wed Jul  2 19:25:25 2014
New Revision: 268170
URL: http://svnweb.freebsd.org/changeset/base/268170

Log:
  MFC r267680:
  Fix a code typo that prevented mkdir from firing (unnoticed
  usually because another part of the code succeeded in making
  the same directory).

Modified:
  stable/10/usr.sbin/bsdconfig/share/packages/index.subr
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bsdconfig/share/packages/index.subr
==
--- stable/10/usr.sbin/bsdconfig/share/packages/index.subr  Wed Jul  2 
19:22:12 2014(r268169)
+++ stable/10/usr.sbin/bsdconfig/share/packages/index.subr  Wed Jul  2 
19:25:25 2014(r268170)
@@ -258,7 +258,7 @@ f_index_initialize()
 
# Finally, move the temporary file into place
case $PACKAGES_INDEX_CACHEFILE in
-   */*) f_eval_catch -d $funcname mkdir \
+   */*) f_eval_catch -d $__funcname mkdir \
'mkdir -p %s' ${PACKAGES_INDEX_CACHEFILE%/*}
esac
f_eval_catch -d $__funcname mv 'mv -f %s %s' \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268172 - head/usr.bin/vtfontcvt

2014-07-02 Thread Ed Maste
Author: emaste
Date: Wed Jul  2 19:31:49 2014
New Revision: 268172
URL: http://svnweb.freebsd.org/changeset/base/268172

Log:
  vtfontcvt: correct width calculation (.hex files and commandline)
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/vtfontcvt/vtfontcvt.c

Modified: head/usr.bin/vtfontcvt/vtfontcvt.c
==
--- head/usr.bin/vtfontcvt/vtfontcvt.c  Wed Jul  2 19:25:49 2014
(r268171)
+++ head/usr.bin/vtfontcvt/vtfontcvt.c  Wed Jul  2 19:31:49 2014
(r268172)
@@ -285,6 +285,16 @@ parse_bdf(FILE *fp, unsigned int map_idx
return (0);
 }
 
+static void
+set_width(int w)
+{
+
+   if (w = 0 || w  128)
+   errx(1, invalid width %d, w);
+   width = w;
+   wbytes = howmany(width, 8);
+}
+
 static int
 parse_hex(FILE *fp, unsigned int map_idx)
 {
@@ -300,12 +310,12 @@ parse_hex(FILE *fp, unsigned int map_idx
if (strncmp(ln, # Height: , 10) == 0) {
height = atoi(ln + 10);
} else if (strncmp(ln, # Width: , 9) == 0) {
-   width = atoi(ln + 9);
+   set_width(atoi(ln + 9));
} else if (sscanf(ln, %4x:, curchar)) {
p = ln + 5;
chars_per_row = strlen(p) / height;
dwidth = width;
-   if (chars_per_row / 2  width / 8)
+   if (chars_per_row / 2  (width + 7) / 8)
dwidth *= 2; /* Double-width character. */
snprintf(fmt_str, sizeof(fmt_str), %%%ux,
chars_per_row);
@@ -528,12 +538,7 @@ main(int argc, char *argv[])
verbose = 1;
break;
case 'w':
-   val = atoi(optarg);
-   if (val = 0 || val  128) {
-   errx(1, Invalid width %d, val);
-   return (1);
-   }
-   width = val;
+   set_width(atoi(optarg));
break;
case '?':
default:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268173 - head/sys/conf

2014-07-02 Thread Marius Strobl
Author: marius
Date: Wed Jul  2 19:46:42 2014
New Revision: 268173
URL: http://svnweb.freebsd.org/changeset/base/268173

Log:
  Remove ofwfb(4) in order to fix the LINT build breakage caused by r268069.
  Both vt(4) and ofwfb(4) need a lot of love to be usable on sparc64 and even
  then the performance of ofwfb(4) would suck compared to hardware accelerated
  drivers like creator(4) and machfb(4).

Modified:
  head/sys/conf/files.sparc64

Modified: head/sys/conf/files.sparc64
==
--- head/sys/conf/files.sparc64 Wed Jul  2 19:31:49 2014(r268172)
+++ head/sys/conf/files.sparc64 Wed Jul  2 19:46:42 2014(r268173)
@@ -60,7 +60,6 @@ dev/syscons/scterm-teken.coptionalsc
 dev/syscons/scvtb.coptionalsc
 dev/uart/uart_cpu_sparc64.coptionaluart
 dev/uart/uart_kbd_sun.coptionaluart sc | vt
-dev/vt/hw/ofwfb/ofwfb.coptionalvt
 kern/kern_clocksource.cstandard
 kern/subr_dummy_vdso_tc.c  standard
 kern/syscalls.coptionalktr
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268174 - releng/9.3/usr.sbin/bsdconfig/share/packages

2014-07-02 Thread Devin Teske
Author: dteske
Date: Wed Jul  2 19:53:51 2014
New Revision: 268174
URL: http://svnweb.freebsd.org/changeset/base/268174

Log:
  MFS9 r268171 (MFC r267680):
  Fix a code typo that prevented mkdir from firing (unnoticed usually
  because another part of the code succeeded in making the same
  directory).
  
  Approved by:  re (gjb)

Modified:
  releng/9.3/usr.sbin/bsdconfig/share/packages/index.subr
Directory Properties:
  releng/9.3/usr.sbin/bsdconfig/   (props changed)

Modified: releng/9.3/usr.sbin/bsdconfig/share/packages/index.subr
==
--- releng/9.3/usr.sbin/bsdconfig/share/packages/index.subr Wed Jul  2 
19:46:42 2014(r268173)
+++ releng/9.3/usr.sbin/bsdconfig/share/packages/index.subr Wed Jul  2 
19:53:51 2014(r268174)
@@ -258,7 +258,7 @@ f_index_initialize()
 
# Finally, move the temporary file into place
case $PACKAGES_INDEX_CACHEFILE in
-   */*) f_eval_catch -d $funcname mkdir \
+   */*) f_eval_catch -d $__funcname mkdir \
'mkdir -p %s' ${PACKAGES_INDEX_CACHEFILE%/*}
esac
f_eval_catch -d $__funcname mv 'mv -f %s %s' \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268173 - head/sys/conf

2014-07-02 Thread Nathan Whitehorn
It worked at least on my Ultra 5 -- though probably because the ATI 
Mach64 FCode ROM there is substantially shared with the Mac version. It 
was even reasonably fast. But regardless of whether it's a generally 
useful console driver on SPARC, at least it proves that vt(4) works fine.

-Nathan

On 07/02/14 12:46, Marius Strobl wrote:

Author: marius
Date: Wed Jul  2 19:46:42 2014
New Revision: 268173
URL: http://svnweb.freebsd.org/changeset/base/268173

Log:
   Remove ofwfb(4) in order to fix the LINT build breakage caused by r268069.
   Both vt(4) and ofwfb(4) need a lot of love to be usable on sparc64 and even
   then the performance of ofwfb(4) would suck compared to hardware accelerated
   drivers like creator(4) and machfb(4).

Modified:
   head/sys/conf/files.sparc64

Modified: head/sys/conf/files.sparc64
==
--- head/sys/conf/files.sparc64 Wed Jul  2 19:31:49 2014(r268172)
+++ head/sys/conf/files.sparc64 Wed Jul  2 19:46:42 2014(r268173)
@@ -60,7 +60,6 @@ dev/syscons/scterm-teken.coptionalsc
  dev/syscons/scvtb.c   optionalsc
  dev/uart/uart_cpu_sparc64.c   optionaluart
  dev/uart/uart_kbd_sun.c   optionaluart sc | vt
-dev/vt/hw/ofwfb/ofwfb.coptionalvt
  kern/kern_clocksource.c   standard
  kern/subr_dummy_vdso_tc.c standard
  kern/syscalls.c   optionalktr



___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268173 - head/sys/conf

2014-07-02 Thread Marius Strobl
On Wed, Jul 02, 2014 at 01:04:48PM -0700, Nathan Whitehorn wrote:
 It worked at least on my Ultra 5 -- though probably because the ATI 
 Mach64 FCode ROM there is substantially shared with the Mac version. It 
 was even reasonably fast. But regardless of whether it's a generally 
 useful console driver on SPARC, at least it proves that vt(4) works fine.

As for vt(4), it at least needs to be taught about the differences
between virtual, physical and bus address with a clue bat. Among
other problems, similar things hold for the #ifdef'ed sparc64 code
of ofwfb(4) in combination with the accesses it does. I guess it
only had a chance of working on your machine because its firmware
is kind enough to map the framebuffer in (which not all machine
models do) in the first place _and_ in a special way/location so
accesses didn't blow. Anyway, even when going the ofwfb(4) route,
doing reads and writes via bus_space(9) will be noticeably faster
than going through the MMU on sparc64.

Marius

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268173 - head/sys/conf

2014-07-02 Thread Nathan Whitehorn


On 07/02/14 13:28, Marius Strobl wrote:

On Wed, Jul 02, 2014 at 01:04:48PM -0700, Nathan Whitehorn wrote:

It worked at least on my Ultra 5 -- though probably because the ATI
Mach64 FCode ROM there is substantially shared with the Mac version. It
was even reasonably fast. But regardless of whether it's a generally
useful console driver on SPARC, at least it proves that vt(4) works fine.

As for vt(4), it at least needs to be taught about the differences
between virtual, physical and bus address with a clue bat. Among
other problems, similar things hold for the #ifdef'ed sparc64 code
of ofwfb(4) in combination with the accesses it does. I guess it
only had a chance of working on your machine because its firmware
is kind enough to map the framebuffer in (which not all machine
models do) in the first place _and_ in a special way/location so
accesses didn't blow. Anyway, even when going the ofwfb(4) route,
doing reads and writes via bus_space(9) will be noticeably faster
than going through the MMU on sparc64.


Yeah, the firmware there is pretty kind. I just wanted to make sure we 
were on the same page. The vt core does not require any changes, I 
think: it's just that you need new drivers for mach64 and, especially, 
creator.

-Nathan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268175 - in head/usr.sbin: kbdcontrol vidcontrol

2014-07-02 Thread Ed Maste
Author: emaste
Date: Wed Jul  2 20:40:59 2014
New Revision: 268175
URL: http://svnweb.freebsd.org/changeset/base/268175

Log:
  Fix vt(4) detection in kbdcontrol and vidcontrol
  
  As sc(4) and vt(4) coexist and are both enabled in GENERIC, the existence
  of a vt(4) sysctl is not sufficient to determine that vt(4) is in use.
  
  Reported by:  Trond Endrestøl

Modified:
  head/usr.sbin/kbdcontrol/kbdcontrol.c
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c
==
--- head/usr.sbin/kbdcontrol/kbdcontrol.c   Wed Jul  2 19:53:51 2014
(r268174)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.c   Wed Jul  2 20:40:59 2014
(r268175)
@@ -146,11 +146,12 @@ static void   usage(void) __dead2;
 static int
 is_vt4(void)
 {
+   char vty_name[4] = ;
+   size_t len = sizeof(vty_name);
 
-   if (sysctlbyname(kern.vt.deadtimer, NULL, NULL, NULL, 0) == 0)
-   return (1);
-
-   return (0);
+   if (sysctlbyname(kern.vty, vty_name, len, NULL, 0) != 0)
+   return (0);
+   return (strcmp(vty_name, vt) == 0);
 }
 
 static char *

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==
--- head/usr.sbin/vidcontrol/vidcontrol.c   Wed Jul  2 19:53:51 2014
(r268174)
+++ head/usr.sbin/vidcontrol/vidcontrol.c   Wed Jul  2 20:40:59 2014
(r268175)
@@ -216,11 +216,12 @@ usage(void)
 static int
 is_vt4(void)
 {
+   char vty_name[4] = ;
+   size_t len = sizeof(vty_name);
 
-   if (sysctlbyname(kern.vt.deadtimer, NULL, NULL, NULL, 0) == 0)
-   return (1);
-
-   return (0);
+   if (sysctlbyname(kern.vty, vty_name, len, NULL, 0) != 0)
+   return (0);
+   return (strcmp(vty_name, vt) == 0);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

svn commit: r268176 - in head/sys/dev: bge nfe

2014-07-02 Thread Sergey Kandaurov
Author: pluknet
Date: Wed Jul  2 21:08:25 2014
New Revision: 268176
URL: http://svnweb.freebsd.org/changeset/base/268176

Log:
  Fixed build with DEVICE_POLLING.

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/nfe/if_nfe.c

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Wed Jul  2 20:40:59 2014(r268175)
+++ head/sys/dev/bge/if_bge.c   Wed Jul  2 21:08:25 2014(r268176)
@@ -4796,7 +4796,7 @@ bge_tick(void *xsc)
 */
 #ifdef DEVICE_POLLING
/* In polling mode we poll link state in bge_poll(). */
-   if (!(sc-bge_if_getcapenable(ifp)  IFCAP_POLLING))
+   if (!(if_getcapenable(sc-bge_ifp)  IFCAP_POLLING))
 #endif
{
sc-bge_link_evt++;
@@ -5830,7 +5830,7 @@ bge_ioctl(if_t ifp, u_long command, cadd
 #ifdef DEVICE_POLLING
if (mask  IFCAP_POLLING) {
if (ifr-ifr_reqcap  IFCAP_POLLING) {
-   error = ether_poll_register(bge_poll, ifp);
+   error = ether_poll_register_drv(bge_poll, ifp);
if (error)
return (error);
BGE_LOCK(sc);

Modified: head/sys/dev/nfe/if_nfe.c
==
--- head/sys/dev/nfe/if_nfe.c   Wed Jul  2 20:40:59 2014(r268175)
+++ head/sys/dev/nfe/if_nfe.c   Wed Jul  2 21:08:25 2014(r268176)
@@ -1630,7 +1630,7 @@ nfe_free_tx_ring(struct nfe_softc *sc, s
 }
 
 #ifdef DEVICE_POLLING
-static poll_handler_t nfe_poll;
+static poll_handler_drv_t nfe_poll;
 
 
 static int
@@ -1782,7 +1782,7 @@ nfe_ioctl(if_t ifp, u_long cmd, caddr_t 
 #ifdef DEVICE_POLLING
if ((mask  IFCAP_POLLING) != 0) {
if ((ifr-ifr_reqcap  IFCAP_POLLING) != 0) {
-   error = ether_poll_register(nfe_poll, ifp);
+   error = ether_poll_register_drv(nfe_poll, ifp);
if (error)
break;
NFE_LOCK(sc);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268177 - in vendor/NetBSD/bmake/dist: . mk mk/sys

2014-07-02 Thread Simon J. Gerraty
Author: sjg
Date: Wed Jul  2 21:24:54 2014
New Revision: 268177
URL: http://svnweb.freebsd.org/changeset/base/268177

Log:
  Import bmake-20140620

Modified:
  vendor/NetBSD/bmake/dist/ChangeLog
  vendor/NetBSD/bmake/dist/Makefile
  vendor/NetBSD/bmake/dist/README
  vendor/NetBSD/bmake/dist/bmake.1
  vendor/NetBSD/bmake/dist/bmake.cat1
  vendor/NetBSD/bmake/dist/boot-strap
  vendor/NetBSD/bmake/dist/bsd.after-import.mk
  vendor/NetBSD/bmake/dist/config.h.in
  vendor/NetBSD/bmake/dist/configure
  vendor/NetBSD/bmake/dist/configure.in
  vendor/NetBSD/bmake/dist/main.c
  vendor/NetBSD/bmake/dist/make.1
  vendor/NetBSD/bmake/dist/mk/ChangeLog
  vendor/NetBSD/bmake/dist/mk/autodep.mk
  vendor/NetBSD/bmake/dist/mk/dirdeps.mk
  vendor/NetBSD/bmake/dist/mk/dpadd.mk
  vendor/NetBSD/bmake/dist/mk/gendirdeps.mk
  vendor/NetBSD/bmake/dist/mk/host-target.mk
  vendor/NetBSD/bmake/dist/mk/install-mk
  vendor/NetBSD/bmake/dist/mk/lib.mk
  vendor/NetBSD/bmake/dist/mk/meta.autodep.mk
  vendor/NetBSD/bmake/dist/mk/meta2deps.py
  vendor/NetBSD/bmake/dist/mk/meta2deps.sh
  vendor/NetBSD/bmake/dist/mk/options.mk
  vendor/NetBSD/bmake/dist/mk/rst2htm.mk
  vendor/NetBSD/bmake/dist/mk/sys.mk
  vendor/NetBSD/bmake/dist/mk/sys/SunOS.mk
  vendor/NetBSD/bmake/dist/mk/target-flags.mk
  vendor/NetBSD/bmake/dist/mk/warnings.mk
  vendor/NetBSD/bmake/dist/os.sh
  vendor/NetBSD/bmake/dist/parse.c
  vendor/NetBSD/bmake/dist/str.c
  vendor/NetBSD/bmake/dist/var.c

Modified: vendor/NetBSD/bmake/dist/ChangeLog
==
--- vendor/NetBSD/bmake/dist/ChangeLog  Wed Jul  2 21:08:25 2014
(r268176)
+++ vendor/NetBSD/bmake/dist/ChangeLog  Wed Jul  2 21:24:54 2014
(r268177)
@@ -1,3 +1,28 @@
+2014-06-20  Simon J. Gerraty  s...@bad.crufty.net
+
+   * Makefile (MAKE_VERSION): 20140620
+ Merge with NetBSD make, pick up
+ o var.c return varNoError rather than var_Error for ::= modidiers.
+
+2014-05-22  Simon J. Gerraty  s...@bad.crufty.net
+
+   * Makefile (MAKE_VERSION): 20140522
+ Merge with NetBSD make, pick up
+ o var.c detect some parse errors.
+
+2014-04-05  Simon J. Gerraty  s...@bad.crufty.net
+
+   * Fix spelling errors - patch from Pedro Giffuni
+
+2014-02-14  Simon J. Gerraty  s...@bad.crufty.net
+
+   * Makefile (MAKE_VERSION): 20140214
+ Merge with NetBSD make, pick up
+ o .INCLUDEFROM*
+ o use Var_Value to get MAKEOBJDIR[PREFIX]
+ o reduced realloc'ign in brk_string.
+   * configure.in: add a check for compiler supporting __func__
+
 2014-01-03  Simon J. Gerraty  s...@bad.crufty.net
 
* boot-strap: ignore mksrc=none
@@ -64,7 +89,7 @@
 
* Makefile (MAKE_VERSION): 20130716
  Merge with NetBSD make, pick up
- o number of gmake compatability tweaks
+ o number of gmake compatibility tweaks
-w for gmake style entering/leaving messages
if .MAKE.LEVEL  0 indicate it in progname make[1] etc.
handle MAKEFLAGS containing only letters.

Modified: vendor/NetBSD/bmake/dist/Makefile
==
--- vendor/NetBSD/bmake/dist/Makefile   Wed Jul  2 21:08:25 2014
(r268176)
+++ vendor/NetBSD/bmake/dist/Makefile   Wed Jul  2 21:24:54 2014
(r268177)
@@ -1,7 +1,7 @@
-#  $Id: Makefile,v 1.23 2014/01/02 22:20:52 sjg Exp $
+#  $Id: Makefile,v 1.27 2014/06/20 14:51:54 sjg Exp $
 
 # Base version on src date
-MAKE_VERSION= 20140101
+MAKE_VERSION= 20140620
 
 PROG=  bmake
 
@@ -117,7 +117,7 @@ MANTARGET?= man
 # turn this on by default - ignored if we are root
 WITH_INSTALL_AS_USER=
 
-# supress with -DWITHOUT_*
+# suppress with -DWITHOUT_*
 OPTIONS_DEFAULT_YES+= \
AUTOCONF_MK \
INSTALL_MK \

Modified: vendor/NetBSD/bmake/dist/README
==
--- vendor/NetBSD/bmake/dist/README Wed Jul  2 21:08:25 2014
(r268176)
+++ vendor/NetBSD/bmake/dist/README Wed Jul  2 21:24:54 2014
(r268177)
@@ -18,7 +18,7 @@ interesting changes, so that bmake track
 
 Building:
 
-The prefered way to bootstrap bmake is:
+The preferred way to bootstrap bmake is:
 
 ./bmake/boot-strap
 

Modified: vendor/NetBSD/bmake/dist/bmake.1
==
--- vendor/NetBSD/bmake/dist/bmake.1Wed Jul  2 21:08:25 2014
(r268176)
+++ vendor/NetBSD/bmake/dist/bmake.1Wed Jul  2 21:24:54 2014
(r268177)
@@ -1,4 +1,4 @@
-.\$NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland Exp $
+.\$NetBSD: make.1,v 1.229 2014/01/19 10:23:29 apb Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\from: @(#)make.18.4 (Berkeley) 3/19/94
 .\
-.Dd October 25, 2013
+.Dd February 14, 2014
 .Dt MAKE 1
 .Os
 .Sh 

svn commit: r268178 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-07-02 Thread Alexander Motin
Author: mav
Date: Wed Jul  2 21:25:32 2014
New Revision: 268178
URL: http://svnweb.freebsd.org/changeset/base/268178

Log:
  Fix bug in sync control in new dev mode of ZVOL (r265678).
  
  Don't check ZVOL_WCE flag, used in Solaris to control device write cache.
  It is not applicable on FreeBSD and by default set to disable.
  
  MFC after:3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Wed Jul  2 
21:24:54 2014(r268177)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Wed Jul  2 
21:25:32 2014(r268178)
@@ -1629,7 +1629,11 @@ zvol_write(struct cdev *dev, struct uio 
}
 #endif
 
+#ifdef sun
sync = !(zv-zv_flags  ZVOL_WCE) ||
+#else
+   sync =
+#endif
(zv-zv_objset-os_sync == ZFS_SYNC_ALWAYS);
 
rl = zfs_range_lock(zv-zv_znode, uio-uio_loffset, uio-uio_resid,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268180 - vendor/NetBSD/bmake

2014-07-02 Thread Simon J. Gerraty
Author: sjg
Date: Wed Jul  2 21:28:50 2014
New Revision: 268180
URL: http://svnweb.freebsd.org/changeset/base/268180

Log:
  Extract URL correctly

Modified:
  vendor/NetBSD/bmake/do-update.sh

Modified: vendor/NetBSD/bmake/do-update.sh
==
--- vendor/NetBSD/bmake/do-update.shWed Jul  2 21:28:23 2014
(r268179)
+++ vendor/NetBSD/bmake/do-update.shWed Jul  2 21:28:50 2014
(r268180)
@@ -80,6 +80,6 @@ test -s $TF.rmlist  xargs $SVN rm  $T
 test -s $TF.addlist  xargs $SVN --parents add  $TF.addlist
 )
 
-url=`$SVN info | sed -n '/URL:/s,URL: ,,p'`
+url=`$SVN info | sed -n '/^URL:/s,URL: ,,p'`
 echo After committing dist...
 echo $SVN cp $url/dist $url/$MAKE_VERSION
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268179 - vendor/NetBSD/bmake/20140620

2014-07-02 Thread Simon J. Gerraty
Author: sjg
Date: Wed Jul  2 21:28:23 2014
New Revision: 268179
URL: http://svnweb.freebsd.org/changeset/base/268179

Log:
  Tag bmake-20140620

Added:
  vendor/NetBSD/bmake/20140620/
 - copied from r268178, vendor/NetBSD/bmake/dist/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268181 - stable/10/sys/ia64/ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 21:53:34 2014
New Revision: 268181
URL: http://svnweb.freebsd.org/changeset/base/268181

Log:
  MFC 257475: Respect the kern.smp.disabled tunable.

Modified:
  stable/10/sys/ia64/ia64/mp_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/mp_machdep.c
==
--- stable/10/sys/ia64/ia64/mp_machdep.cWed Jul  2 21:28:50 2014
(r268180)
+++ stable/10/sys/ia64/ia64/mp_machdep.cWed Jul  2 21:53:34 2014
(r268181)
@@ -65,6 +65,8 @@ __FBSDID($FreeBSD$);
 
 extern uint64_t bdata[];
 
+extern int smp_disabled;
+
 MALLOC_DEFINE(M_SMP, SMP, SMP related allocations);
 
 void ia64_ap_startup(void);
@@ -292,6 +294,9 @@ cpu_mp_add(u_int acpi_id, u_int id, u_in
void *dpcpu;
u_int cpuid, sapic_id;
 
+   if (smp_disabled)
+   return;
+
sapic_id = SAPIC_ID_SET(id, eid);
cpuid = (IA64_LID_GET_SAPIC_ID(ia64_get_lid()) == sapic_id)
? 0 : smp_cpus++;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268182 - in head/libexec/rtld-elf: . ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 22:04:12 2014
New Revision: 268182
URL: http://svnweb.freebsd.org/changeset/base/268182

Log:
  Fix r264346 for ia64. We need to allocate memory for the function
  descriptors in order to relocate RTLD itself. To allocate memory,
  we need the pagesizes array initialized, but that happens after
  RTLD is relocated. This ordering is important for amd64, but it's
  opposite of what ia64 needs. Handle this conflict with the define
  called RTLD_INIT_PAGESIZES_EARLY. When defined, obtain the page
  sizes before relocating rtld, otherwise do it after.

Modified:
  head/libexec/rtld-elf/ia64/rtld_machdep.h
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/ia64/rtld_machdep.h
==
--- head/libexec/rtld-elf/ia64/rtld_machdep.h   Wed Jul  2 21:53:34 2014
(r268181)
+++ head/libexec/rtld-elf/ia64/rtld_machdep.h   Wed Jul  2 22:04:12 2014
(r268182)
@@ -69,4 +69,6 @@ extern void *__tls_get_addr(unsigned lon
 #defineRTLD_DEFAULT_STACK_PF_EXEC  0
 #defineRTLD_DEFAULT_STACK_EXEC 0
 
+#defineRTLD_INIT_PAGESIZES_EARLY   1
+
 #endif

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cWed Jul  2 21:53:34 2014
(r268181)
+++ head/libexec/rtld-elf/rtld.cWed Jul  2 22:04:12 2014
(r268182)
@@ -1802,6 +1802,11 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo *
 const Elf_Dyn *dyn_soname;
 const Elf_Dyn *dyn_runpath;
 
+#ifdef RTLD_INIT_PAGESIZES_EARLY
+/* The page size is required by the dynamic memory allocator. */
+init_pagesizes(aux_info);
+#endif
+
 /*
  * Conjure up an Obj_Entry structure for the dynamic linker.
  *
@@ -1838,8 +1843,10 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo *
 /* Now that non-local variables can be accesses, copy out obj_rtld. */
 memcpy(obj_rtld, objtmp, sizeof(obj_rtld));
 
+#ifndef RTLD_INIT_PAGESIZES_EARLY
 /* The page size is required by the dynamic memory allocator. */
 init_pagesizes(aux_info);
+#endif
 
 if (aux_info[AT_OSRELDATE] != NULL)
osreldate = aux_info[AT_OSRELDATE]-a_un.a_val;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268183 - head/sys/netinet

2014-07-02 Thread Hiren Panchasara
Author: hiren
Date: Wed Jul  2 22:04:14 2014
New Revision: 268183
URL: http://svnweb.freebsd.org/changeset/base/268183

Log:
  

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Jul  2 22:04:12 2014
(r268182)
+++ head/sys/netinet/tcp_input.cWed Jul  2 22:04:14 2014
(r268183)
@@ -3472,8 +3472,8 @@ tcp_mss_update(struct tcpcb *tp, int off
bcopy(metrics, metricptr, sizeof(struct hc_metrics_lite));
 
/*
-* If there's a discovered mtu int tcp hostcache, use it
-* else, use the link mtu.
+* If there's a discovered mtu in tcp hostcache, use it.
+* Else, use the link mtu.
 */
if (metrics.rmx_mtu)
mss = min(metrics.rmx_mtu, maxmtu) - min_protoh;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268183 - head/sys/netinet

2014-07-02 Thread hiren panchasara
On Wed, Jul 2, 2014 at 3:04 PM, Hiren Panchasara hi...@freebsd.org wrote:
 Author: hiren
 Date: Wed Jul  2 22:04:14 2014
 New Revision: 268183
 URL: http://svnweb.freebsd.org/changeset/base/268183

 Log:

Ugh. sorry.

Commit log was supposed to be: Fix a typo and improve readability.


 Modified:
   head/sys/netinet/tcp_input.c

 Modified: head/sys/netinet/tcp_input.c
 ==
 --- head/sys/netinet/tcp_input.cWed Jul  2 22:04:12 2014
 (r268182)
 +++ head/sys/netinet/tcp_input.cWed Jul  2 22:04:14 2014
 (r268183)
 @@ -3472,8 +3472,8 @@ tcp_mss_update(struct tcpcb *tp, int off
 bcopy(metrics, metricptr, sizeof(struct hc_metrics_lite));

 /*
 -* If there's a discovered mtu int tcp hostcache, use it
 -* else, use the link mtu.
 +* If there's a discovered mtu in tcp hostcache, use it.
 +* Else, use the link mtu.
  */
 if (metrics.rmx_mtu)
 mss = min(metrics.rmx_mtu, maxmtu) - min_protoh;

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268184 - in stable/10/sys/ia64: ia64 include

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 22:06:31 2014
New Revision: 268184
URL: http://svnweb.freebsd.org/changeset/base/268184

Log:
  MFC r257477: Purge the translation cache of APs before we unleash them.

Modified:
  stable/10/sys/ia64/ia64/mp_machdep.c
  stable/10/sys/ia64/ia64/pmap.c
  stable/10/sys/ia64/include/pmap.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/mp_machdep.c
==
--- stable/10/sys/ia64/ia64/mp_machdep.cWed Jul  2 22:04:14 2014
(r268183)
+++ stable/10/sys/ia64/ia64/mp_machdep.cWed Jul  2 22:06:31 2014
(r268184)
@@ -240,6 +240,8 @@ ia64_ap_startup(void)
KASSERT(PCPU_GET(idlethread) != NULL, (no idle thread));
PCPU_SET(curthread, PCPU_GET(idlethread));
 
+   pmap_invalidate_all();
+
atomic_add_int(ia64_ap_state.as_awake, 1);
while (!smp_started)
cpu_spinwait();

Modified: stable/10/sys/ia64/ia64/pmap.c
==
--- stable/10/sys/ia64/ia64/pmap.c  Wed Jul  2 22:04:14 2014
(r268183)
+++ stable/10/sys/ia64/ia64/pmap.c  Wed Jul  2 22:06:31 2014
(r268184)
@@ -262,7 +262,6 @@ static vm_page_t pmap_pv_reclaim(pmap_t 
 static voidpmap_enter_quick_locked(pmap_t pmap, vm_offset_t va,
vm_page_t m, vm_prot_t prot);
 static voidpmap_free_pte(struct ia64_lpte *pte, vm_offset_t va);
-static voidpmap_invalidate_all(void);
 static int pmap_remove_pte(pmap_t pmap, struct ia64_lpte *pte,
vm_offset_t va, pv_entry_t pv, int freepte);
 static int pmap_remove_vhpt(vm_offset_t va);
@@ -537,13 +536,12 @@ pmap_invalidate_page(vm_offset_t va)
critical_exit();
 }
 
-static void
-pmap_invalidate_all_1(void *arg)
+void
+pmap_invalidate_all(void)
 {
uint64_t addr;
int i, j;
 
-   critical_enter();
addr = pmap_ptc_e_base;
for (i = 0; i  pmap_ptc_e_count1; i++) {
for (j = 0; j  pmap_ptc_e_count2; j++) {
@@ -552,20 +550,7 @@ pmap_invalidate_all_1(void *arg)
}
addr += pmap_ptc_e_stride1;
}
-   critical_exit();
-}
-
-static void
-pmap_invalidate_all(void)
-{
-
-#ifdef SMP
-   if (mp_ncpus  1) {
-   smp_rendezvous(NULL, pmap_invalidate_all_1, NULL, NULL);
-   return;
-   }
-#endif
-   pmap_invalidate_all_1(NULL);
+   ia64_srlz_i();
 }
 
 static uint32_t

Modified: stable/10/sys/ia64/include/pmap.h
==
--- stable/10/sys/ia64/include/pmap.h   Wed Jul  2 22:04:14 2014
(r268183)
+++ stable/10/sys/ia64/include/pmap.h   Wed Jul  2 22:06:31 2014
(r268184)
@@ -122,6 +122,7 @@ extern int pmap_vhpt_log2size;
 
 vm_offset_t pmap_alloc_vhpt(void);
 void   pmap_bootstrap(void);
+void   pmap_invalidate_all(void);
 void   pmap_kenter(vm_offset_t va, vm_offset_t pa);
 vm_paddr_t pmap_kextract(vm_offset_t va);
 void   pmap_kremove(vm_offset_t);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268185 - head/sys/ia64/ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 22:09:06 2014
New Revision: 268185
URL: http://svnweb.freebsd.org/changeset/base/268185

Log:
  Improve the KTR logs by naming the values.

Modified:
  head/sys/ia64/ia64/pmap.c

Modified: head/sys/ia64/ia64/pmap.c
==
--- head/sys/ia64/ia64/pmap.c   Wed Jul  2 22:06:31 2014(r268184)
+++ head/sys/ia64/ia64/pmap.c   Wed Jul  2 22:09:06 2014(r268185)
@@ -484,7 +484,7 @@ void
 pmap_page_init(vm_page_t m)
 {
 
-   CTR2(KTR_PMAP, %s(%p), __func__, m);
+   CTR2(KTR_PMAP, %s(m=%p), __func__, m);
 
TAILQ_INIT(m-md.pv_list);
m-md.memattr = VM_MEMATTR_DEFAULT;
@@ -623,7 +623,7 @@ void
 pmap_pinit0(pmap_t pmap)
 {
 
-   CTR2(KTR_PMAP, %s(%p), __func__, pmap);
+   CTR2(KTR_PMAP, %s(pm=%p), __func__, pmap);
 
PMAP_LOCK_INIT(pmap);
pmap_pinit_common(pmap);
@@ -637,7 +637,7 @@ int
 pmap_pinit(pmap_t pmap)
 {
 
-   CTR2(KTR_PMAP, %s(%p), __func__, pmap);
+   CTR2(KTR_PMAP, %s(pm=%p), __func__, pmap);
 
pmap_pinit_common(pmap);
return (1);
@@ -657,7 +657,7 @@ pmap_release(pmap_t pmap)
 {
int i;
 
-   CTR2(KTR_PMAP, %s(%p), __func__, pmap);
+   CTR2(KTR_PMAP, %s(pm=%p), __func__, pmap);
 
for (i = 0; i  IA64_VM_MINKERN_REGION; i++)
if (pmap-pm_rid[i])
@@ -674,7 +674,7 @@ pmap_growkernel(vm_offset_t addr)
struct ia64_lpte *leaf;
vm_page_t nkpg;
 
-   CTR2(KTR_PMAP, %s(%#x), __func__, addr);
+   CTR2(KTR_PMAP, %s(va=%#lx), __func__, addr);
 
while (kernel_vm_end = addr) {
if (nkpt == PAGE_SIZE/8 + PAGE_SIZE*PAGE_SIZE/64)
@@ -1170,7 +1170,7 @@ pmap_extract(pmap_t pmap, vm_offset_t va
pmap_t oldpmap;
vm_paddr_t pa;
 
-   CTR3(KTR_PMAP, %s(%p, %#x), __func__, pmap, va);
+   CTR3(KTR_PMAP, %s(pm=%p, va=%#lx), __func__, pmap, va);
 
pa = 0;
PMAP_LOCK(pmap);
@@ -1198,7 +1198,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
vm_page_t m;
vm_paddr_t pa;
 
-   CTR4(KTR_PMAP, %s(%p, %#x, %#x), __func__, pmap, va, prot);
+   CTR4(KTR_PMAP, %s(pm=%p, va=%#lx, prot=%#x), __func__, pmap, va,
+   prot);
 
pa = 0;
m = NULL;
@@ -1381,7 +1382,7 @@ pmap_kextract(vm_offset_t va)
vm_paddr_t pa;
u_int idx;
 
-   CTR2(KTR_PMAP, %s(%#x), __func__, va);
+   CTR2(KTR_PMAP, %s(va=%#lx), __func__, va);
 
KASSERT(va = VM_MAXUSER_ADDRESS, (Must be kernel VA));
 
@@ -1443,7 +1444,7 @@ pmap_qenter(vm_offset_t va, vm_page_t *m
struct ia64_lpte *pte;
int i;
 
-   CTR4(KTR_PMAP, %s(%#x, %p, %d), __func__, va, m, count);
+   CTR4(KTR_PMAP, %s(va=%#lx, m_p=%p, cnt=%d), __func__, va, m, count);
 
for (i = 0; i  count; i++) {
pte = pmap_find_kpte(va);
@@ -1468,7 +1469,7 @@ pmap_qremove(vm_offset_t va, int count)
struct ia64_lpte *pte;
int i;
 
-   CTR3(KTR_PMAP, %s(%#x, %d), __func__, va, count);
+   CTR3(KTR_PMAP, %s(va=%#lx, cnt=%d), __func__, va, count);
 
for (i = 0; i  count; i++) {
pte = pmap_find_kpte(va);
@@ -1490,7 +1491,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p
 {
struct ia64_lpte *pte;
 
-   CTR3(KTR_PMAP, %s(%#x, %#x), __func__, va, pa);
+   CTR3(KTR_PMAP, %s(va=%#lx, pa=%#lx), __func__, va, pa);
 
pte = pmap_find_kpte(va);
if (pmap_present(pte))
@@ -1510,7 +1511,7 @@ pmap_kremove(vm_offset_t va)
 {
struct ia64_lpte *pte;
 
-   CTR2(KTR_PMAP, %s(%#x), __func__, va);
+   CTR2(KTR_PMAP, %s(va=%#lx), __func__, va);
 
pte = pmap_find_kpte(va);
if (pmap_present(pte)) {
@@ -1536,8 +1537,8 @@ vm_offset_t
 pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot)
 {
 
-   CTR5(KTR_PMAP, %s(%p, %#x, %#x, %#x), __func__, virt, start, end,
-   prot);
+   CTR5(KTR_PMAP, %s(va_p=%p, sva=%#lx, eva=%#lx, prot=%#x), __func__,
+   virt, start, end, prot);
 
return IA64_PHYS_TO_RR7(start);
 }
@@ -1558,7 +1559,8 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
vm_offset_t va;
struct ia64_lpte *pte;
 
-   CTR4(KTR_PMAP, %s(%p, %#x, %#x), __func__, pmap, sva, eva);
+   CTR4(KTR_PMAP, %s(pm=%p, sva=%#lx, eva=%#lx), __func__, pmap, sva,
+   eva);
 
/*
 * Perform an unsynchronized read.  This is, however, safe.
@@ -1597,7 +1599,7 @@ pmap_remove_all(vm_page_t m)
pmap_t oldpmap;
pv_entry_t pv;
 
-   CTR2(KTR_PMAP, %s(%p), __func__, m);
+   CTR2(KTR_PMAP, %s(m=%p), __func__, m);
 
KASSERT((m-oflags  VPO_UNMANAGED) == 0,
(pmap_remove_all: page %p is not managed, m));
@@ -1631,8 +1633,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
pmap_t oldpmap;
struct ia64_lpte *pte;
 
-   CTR5(KTR_PMAP, %s(%p, %#x, %#x, %#x), __func__, pmap, sva, eva,
-   prot);
+   

svn commit: r268186 - head/sys/kern

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 22:13:07 2014
New Revision: 268186
URL: http://svnweb.freebsd.org/changeset/base/268186

Log:
  Drop KTR records when we're in the debugger so that the debugger isn't
  changing or overwriting the trace buffer. When KTR is enabled for things
  like traps or pmap functions, the amount of logging can be substantial.

Modified:
  head/sys/kern/kern_ktr.c

Modified: head/sys/kern/kern_ktr.c
==
--- head/sys/kern/kern_ktr.cWed Jul  2 22:09:06 2014(r268185)
+++ head/sys/kern/kern_ktr.cWed Jul  2 22:13:07 2014(r268186)
@@ -41,6 +41,7 @@ __FBSDID($FreeBSD$);
 #include sys/alq.h
 #include sys/cons.h
 #include sys/cpuset.h
+#include sys/kdb.h
 #include sys/kernel.h
 #include sys/ktr.h
 #include sys/libkern.h
@@ -323,7 +324,7 @@ ktr_tracepoint(u_int mask, const char *f
 #endif
int cpu;
 
-   if (panicstr)
+   if (panicstr || kdb_active)
return;
if ((ktr_mask  mask) == 0 || ktr_buf == NULL)
return;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268187 - head/share/man/man4

2014-07-02 Thread Warren Block
Author: wblock (doc committer)
Date: Wed Jul  2 22:16:01 2014
New Revision: 268187
URL: http://svnweb.freebsd.org/changeset/base/268187

Log:
  Improve markup, change references to nonexistent vt_vga(4), remove some
  language redundancy, and move the examples so sections are in the
  standard order.
  
  MFC after:1 week

Modified:
  head/share/man/man4/vt.4

Modified: head/share/man/man4/vt.4
==
--- head/share/man/man4/vt.4Wed Jul  2 22:13:07 2014(r268186)
+++ head/share/man/man4/vt.4Wed Jul  2 22:16:01 2014(r268187)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 27, 2014
+.Dd July 2, 2014
 .Dt VIRTUAL TERMINALS 4
 .Os
 .Sh NAME
@@ -109,10 +109,10 @@ These kernel options control the
 .Nm
 driver.
 .Bl -tag -width MAXCONS
-.It Dv TERMINAL_NORM_ATTR=_attribute_
-.It Dv TERMINAL_KERN_ATTR=_attribute_
-These options allow to change the default colors used for normal and kernel
-text respectively.
+.It Dv TERMINAL_NORM_ATTR= Ns Pa attribute
+.It Dv TERMINAL_KERN_ATTR= Ns Pa attribute
+These options allow changing the default colors used for normal and kernel
+text.
 Available colors are defined in
 .In sys/terminal.h .
 See
@@ -165,13 +165,13 @@ is set, the system remains in text mode.
 Otherwise,
 .Nm
 switches to 640x480x16 VGA mode using
-.Xr vt_vga 4 .
+.Cm vt_vga .
 If a KMS
 .Pq Kernel Mode Switching
 video driver is available, the display is switched to high resolution
 and the KMS driver takes over.
 When a KMS driver is not available,
-.Xr vt_vga 4
+.Cm vt_vga
 remains active.
 .Sh LOADER TUNABLES
 These settings can be entered at the
@@ -184,27 +184,18 @@ Set to 1 to use virtual terminals in tex
 Features that require graphics mode, like loadable fonts, will be
 disabled.
 .It Va kern.vty
-Set to vt to choose the
+When both
 .Nm
-driver for the system console, if the
-.Xr syscons 4
-driver is also compiled in and is the default.
+and
+.Xr sc 4 have been compiled into the kernel, the one to use for the
+system console can be selected by setting this value to
+.Ql vt
+or
+.Ql sc .
+If this value is not set,
+.Xr sc 4
+is used.
 .El
-.Sh EXAMPLES
-The following line will change the default color of normal text.
-Normal text will be green on black background.
-Reversed normal text will be black on green background.
-Note that you cannot put any white space inside the quoted string,
-because of the current implementation of
-.Xr config 8 .
-.Pp
-.Dl options TERMINAL_NORM_ATTR=(FG_GREEN|BG_BLACK)
-.Pp
-The following line will change the default color of kernel messages.
-Kernel messages will be printed bright red on black background.
-Reversed kernel messages will be black on bright red background.
-.Pp
-.Dl options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK)
 .Sh FILES
 .Bl -tag -width /usr/share/syscons/keymaps/* -compact
 .It Pa /dev/console
@@ -214,6 +205,19 @@ virtual terminals
 .It Pa /etc/ttys
 terminal initialization information
 .El
+.Sh EXAMPLES
+This example changes the default color of normal text to green on a
+black background, or black on a green background when reversed.
+Note that white space cannot be used inside the attribute string
+because of the current implementation of
+.Xr config 8 .
+.Pp
+.Dl options TERMINAL_NORM_ATTR=(FG_GREEN|BG_BLACK)
+.Pp
+This line changes the default color of kernel messages to be bright red
+on a black background, or black on a bright red background when reversed.
+.Pp
+.Dl options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK)
 .Sh SEE ALSO
 .Xr kbdcontrol 1 ,
 .Xr login 1 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268189 - stable/10/sys/ia64/ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 22:19:59 2014
New Revision: 268189
URL: http://svnweb.freebsd.org/changeset/base/268189

Log:
  MFC r257484: Change PAL_PTCE_INFO related variables.

Modified:
  stable/10/sys/ia64/ia64/pmap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/pmap.c
==
--- stable/10/sys/ia64/ia64/pmap.c  Wed Jul  2 22:17:27 2014
(r268188)
+++ stable/10/sys/ia64/ia64/pmap.c  Wed Jul  2 22:19:59 2014
(r268189)
@@ -195,12 +195,12 @@ extern struct ia64_lpte ***ia64_kptdir;
 
 vm_offset_t kernel_vm_end;
 
-/* Values for ptc.e. XXX values for SKI. */
-static uint64_t pmap_ptc_e_base = 0x1;
-static uint64_t pmap_ptc_e_count1 = 3;
-static uint64_t pmap_ptc_e_count2 = 2;
-static uint64_t pmap_ptc_e_stride1 = 0x2000;
-static uint64_t pmap_ptc_e_stride2 = 0x1;
+/* Defaults for ptc.e. */
+static uint64_t pmap_ptc_e_base = 0;
+static uint32_t pmap_ptc_e_count1 = 1;
+static uint32_t pmap_ptc_e_count2 = 1;
+static uint32_t pmap_ptc_e_stride1 = 0;
+static uint32_t pmap_ptc_e_stride2 = 0;
 
 struct mtx pmap_ptc_mutex;
 
@@ -324,12 +324,12 @@ pmap_bootstrap()
panic(Can't configure ptc.e parameters);
pmap_ptc_e_base = res.pal_result[0];
pmap_ptc_e_count1 = res.pal_result[1]  32;
-   pmap_ptc_e_count2 = res.pal_result[1]  ((1L32) - 1);
+   pmap_ptc_e_count2 = res.pal_result[1];
pmap_ptc_e_stride1 = res.pal_result[2]  32;
-   pmap_ptc_e_stride2 = res.pal_result[2]  ((1L32) - 1);
+   pmap_ptc_e_stride2 = res.pal_result[2];
if (bootverbose)
-   printf(ptc.e base=0x%lx, count1=%ld, count2=%ld, 
-  stride1=0x%lx, stride2=0x%lx\n,
+   printf(ptc.e base=0x%lx, count1=%u, count2=%u, 
+  stride1=0x%x, stride2=0x%x\n,
   pmap_ptc_e_base,
   pmap_ptc_e_count1,
   pmap_ptc_e_count2,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268190 - head/sys/netinet

2014-07-02 Thread Hiren Panchasara
Author: hiren
Date: Wed Jul  2 22:25:48 2014
New Revision: 268190
URL: http://svnweb.freebsd.org/changeset/base/268190

Log:
  Fix a typo and improve readability.

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268191 - head

2014-07-02 Thread Marcel Moolenaar
 # 20070930: rename of cached to nscd
@@ -2795,10 +2769,6 @@ OLD_FILES+=usr/share/man/man8/mount_std.
 OLD_FILES+=usr/share/man/man4/uhidev.4.gz
 # 20061106: archive_write_prepare.3 removed
 OLD_FILES+=usr/share/man/man3/archive_write_prepare.3.gz
-.if ${TARGET_ARCH} == ia64
-# 20061104: skiload.help removed
-OLD_FILES+=boot/skiload.help
-.endif
 # 20061018: pccardc removed
 OLD_FILES+=usr/sbin/pccardc usr/share/man/man8/pccardc.8.gz
 # 20060930: demangle.h from contrib/libstdc++/include/ext/

Modified: head/UPDATING
==
--- head/UPDATING   Wed Jul  2 22:25:48 2014(r268190)
+++ head/UPDATING   Wed Jul  2 22:34:06 2014(r268191)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20140702:
+   The Itanium architecture (ia64) has been removed from the list of
+   known architectures. This is the first step in the removal of the
+   architecture.
+
 20140701:
Commit r268115 has added NFSv4.1 server support, merged from
projects/nfsv4.1-server.  Since this includes changes to the
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268190 - head/sys/netinet

2014-07-02 Thread hiren panchasara
On Wed, Jul 2, 2014 at 3:25 PM, Hiren Panchasara hi...@freebsd.org wrote:
 Author: hiren
 Date: Wed Jul  2 22:25:48 2014
 New Revision: 268190
 URL: http://svnweb.freebsd.org/changeset/base/268190

 Log:
   Fix a typo and improve readability.

This commit is to somewhat fix my stupidity from r268183.

Thanks to gjb for his help and sorry for this whole thing.

Hiren
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268192 - stable/10/sys/ia64/ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 23:05:57 2014
New Revision: 268192
URL: http://svnweb.freebsd.org/changeset/base/268192

Log:
  MFC r259959  r260009: Add prototypical support for minidumps.

Modified:
  stable/10/sys/ia64/ia64/dump_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/dump_machdep.c
==
--- stable/10/sys/ia64/ia64/dump_machdep.c  Wed Jul  2 22:34:06 2014
(r268191)
+++ stable/10/sys/ia64/ia64/dump_machdep.c  Wed Jul  2 23:05:57 2014
(r268192)
@@ -56,7 +56,10 @@ CTASSERT(sizeof(struct kerneldumpheader)
 #defineMD_ALIGN(x) (((off_t)(x) + EFI_PAGE_MASK)  ~EFI_PAGE_MASK)
 #defineDEV_ALIGN(x)(((off_t)(x) + (DEV_BSIZE-1))  ~(DEV_BSIZE-1))
 
-typedef int callback_t(struct efi_md*, int, void*);
+static int minidump = 0;
+TUNABLE_INT(debug.minidump, minidump);
+SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RW, minidump, 0,
+Enable mini crash dumps);
 
 static struct kerneldumpheader kdh;
 static off_t dumplo, fileofs;
@@ -83,7 +86,7 @@ buf_write(struct dumperinfo *di, char *p
error = dump_write(di, buffer, 0, dumplo,
DEV_BSIZE);
if (error)
-   return error;
+   return (error);
dumplo += DEV_BSIZE;
fragsz = 0;
}
@@ -106,8 +109,14 @@ buf_flush(struct dumperinfo *di)
return (error);
 }
 
+/*
+ * Physical dump support
+ */
+
+typedef int phys_callback_t(struct efi_md*, int, void*);
+
 static int
-cb_dumpdata(struct efi_md *mdp, int seqnr, void *arg)
+phys_cb_dumpdata(struct efi_md *mdp, int seqnr, void *arg)
 {
struct dumperinfo *di = (struct dumperinfo*)arg;
vm_offset_t pa;
@@ -153,7 +162,7 @@ cb_dumpdata(struct efi_md *mdp, int seqn
 }
 
 static int
-cb_dumphdr(struct efi_md *mdp, int seqnr, void *arg)
+phys_cb_dumphdr(struct efi_md *mdp, int seqnr, void *arg)
 {
struct dumperinfo *di = (struct dumperinfo*)arg;
Elf64_Phdr phdr;
@@ -175,7 +184,7 @@ cb_dumphdr(struct efi_md *mdp, int seqnr
 }
 
 static int
-cb_size(struct efi_md *mdp, int seqnr, void *arg)
+phys_cb_size(struct efi_md *mdp, int seqnr, void *arg)
 {
uint64_t *sz = (uint64_t*)arg;
 
@@ -184,7 +193,7 @@ cb_size(struct efi_md *mdp, int seqnr, v
 }
 
 static int
-foreach_chunk(callback_t cb, void *arg)
+phys_foreach(phys_callback_t cb, void *arg)
 {
struct efi_md *mdp;
int error, seqnr;
@@ -206,6 +215,117 @@ foreach_chunk(callback_t cb, void *arg)
return (seqnr);
 }
 
+/*
+ * Virtual dump (aka minidump) support
+ */
+
+typedef int virt_callback_t(vm_offset_t, vm_size_t, int, void*);
+
+static int
+virt_cb_size(vm_offset_t va, vm_size_t sz, int seqnr, void *arg)
+{
+   uint64_t *dumpsize = (uint64_t *)arg;
+
+   *dumpsize += sz;
+   return (0);
+}
+
+static int
+virt_cb_dumphdr(vm_offset_t va, vm_size_t sz, int seqnr, void *arg)
+{
+   struct dumperinfo *di = (struct dumperinfo *)arg;
+   Elf64_Phdr phdr;
+   int error;
+ 
+   bzero(phdr, sizeof(phdr));
+   phdr.p_type = PT_LOAD;
+   phdr.p_flags = PF_R;/* XXX */
+   phdr.p_offset = fileofs;
+   phdr.p_vaddr = va;
+   phdr.p_paddr = ~0UL;
+   phdr.p_filesz = sz;
+   phdr.p_memsz = sz;
+   phdr.p_align = PAGE_SIZE;
+
+   error = buf_write(di, (char*)phdr, sizeof(phdr));
+   fileofs += phdr.p_filesz;
+   return (error);
+}
+
+static int
+virt_cb_dumpdata(vm_offset_t va, vm_size_t sz, int seqnr, void *arg) 
+{
+   struct dumperinfo *di = (struct dumperinfo *)arg;
+   size_t counter, iosz;
+   int c, error, twiddle;
+ 
+   error = 0;  /* catch case in which pgs is 0 */
+   counter = 0;/* Update twiddle every 16MB */
+   twiddle = 0;
+
+   printf(  chunk %d: %ld pages , seqnr, atop(sz));
+
+   while (sz) {
+   iosz = (sz  DFLTPHYS) ? DFLTPHYS : sz;
+   counter += iosz;
+   if (counter  24) {
+   printf(%c\b, |/-\\[twiddle++  3]);
+   counter = (124) - 1;
+   }
+#ifdef SW_WATCHDOG
+   wdog_kern_pat(WD_LASTVAL);
+#endif
+   error = dump_write(di, (void*)va, 0, dumplo, iosz);
+   if (error)
+   break;
+   dumplo += iosz;
+   sz -= iosz;
+   va += iosz;
+
+   /* Check for user abort. */
+   c = cncheckc();
+   if (c == 0x03)
+   return (ECANCELED);
+   if (c != -1)
+   printf((CTRL-C to abort)  );
+   }
+   printf(... %s\n, (error) ? fail : ok);
+   return (error);
+}
+
+static int
+virt_foreach(virt_callback_t cb, void *arg)
+{
+   vm_offset_t va;
+   

svn commit: r268193 - head/usr.bin/sed

2014-07-02 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jul  2 23:07:01 2014
New Revision: 268193
URL: http://svnweb.freebsd.org/changeset/base/268193

Log:
  Fix sed(1) usage: the extension -i is not an optional.
  
  MFC after:3 days

Modified:
  head/usr.bin/sed/main.c

Modified: head/usr.bin/sed/main.c
==
--- head/usr.bin/sed/main.c Wed Jul  2 23:05:57 2014(r268192)
+++ head/usr.bin/sed/main.c Wed Jul  2 23:07:01 2014(r268193)
@@ -205,7 +205,7 @@ usage(void)
 {
(void)fprintf(stderr,
usage: %s script [-Ealnru] [-i[extension]] [file ...]\n
-   \t%s [-Ealnu] [-i[extension]] [-e script] ... [-f script_file]
+   \t%s [-Ealnu] [-i extension] [-e script] ... [-f script_file]
 ... [file ...]\n, getprogname(), getprogname());
exit(1);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268194 - stable/10/sys/ia64/ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 23:12:56 2014
New Revision: 268194
URL: http://svnweb.freebsd.org/changeset/base/268194

Log:
  MFC r262726: When reading physical memory, make sure to access it using
  the right memory attributes.

Modified:
  stable/10/sys/ia64/ia64/mem.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/mem.c
==
--- stable/10/sys/ia64/ia64/mem.c   Wed Jul  2 23:07:01 2014
(r268193)
+++ stable/10/sys/ia64/ia64/mem.c   Wed Jul  2 23:12:56 2014
(r268194)
@@ -47,19 +47,11 @@ __FBSDID($FreeBSD$);
 #include sys/conf.h
 #include sys/fcntl.h
 #include sys/kernel.h
-#include sys/lock.h
 #include sys/malloc.h
 #include sys/memrange.h
-#include sys/module.h
-#include sys/msgbuf.h
-#include sys/mutex.h
-#include sys/proc.h
-#include sys/signalvar.h
 #include sys/systm.h
 #include sys/uio.h
-
-#include machine/cpu.h
-#include machine/frame.h
+#include machine/efi.h
 
 #include vm/vm.h
 #include vm/pmap.h
@@ -69,10 +61,25 @@ __FBSDID($FreeBSD$);
 
 struct mem_range_softc mem_range_softc;
 
-static __inline int
-ia64_pa_access(vm_offset_t pa)
+static int
+mem_phys2virt(vm_offset_t offset, int prot, void **ptr, u_long *limit)
 {
-   return (VM_PROT_READ|VM_PROT_WRITE);
+   struct efi_md *md;
+
+   if (prot  ~(VM_PROT_READ | VM_PROT_WRITE))
+   return (EPERM);
+
+   md = efi_md_find(offset);
+   if (md == NULL)
+   return (EFAULT);
+
+   if (md-md_type == EFI_MD_TYPE_BAD)
+   return (EIO);
+
+   *ptr = (void *)((md-md_attr  EFI_MD_ATTR_WB)
+   ? IA64_PHYS_TO_RR7(offset) : IA64_PHYS_TO_RR6(offset));
+   *limit = (md-md_pages * EFI_PAGE_SIZE) - (offset - md-md_phys);
+   return (0);
 }
 
 /* ARGSUSED */
@@ -80,10 +87,15 @@ int
 memrw(struct cdev *dev, struct uio *uio, int flags)
 {
struct iovec *iov;
-   vm_offset_t addr, eaddr, o, v;
-   int c, error, rw;
+   off_t ofs;
+   vm_offset_t addr;
+   void *ptr;
+   u_long limit;
+   int count, error, phys, rw;
 
error = 0;
+   rw = (uio-uio_rw == UIO_READ) ? VM_PROT_READ : VM_PROT_WRITE;
+
while (uio-uio_resid  0  !error) {
iov = uio-uio_iov;
if (iov-iov_len == 0) {
@@ -94,51 +106,41 @@ memrw(struct cdev *dev, struct uio *uio,
continue;
}
 
-   if (dev2unit(dev) == CDEV_MINOR_MEM) {
-   v = uio-uio_offset;
-kmemphys:
-   /* Allow reads only in RAM. */
-   rw = (uio-uio_rw == UIO_READ)
-   ? VM_PROT_READ : VM_PROT_WRITE;
-   if ((ia64_pa_access(v)  rw) != rw) {
-   error = EFAULT;
-   c = 0;
-   break;
-   }
+   ofs = uio-uio_offset;
 
-   o = uio-uio_offset  PAGE_MASK;
-   c = min(uio-uio_resid, (int)(PAGE_SIZE - o));
-   error = uiomove((caddr_t)IA64_PHYS_TO_RR7(v), c, uio);
-   continue;
+   phys = (dev2unit(dev) == CDEV_MINOR_MEM) ? 1 : 0;
+   if (phys == 0  ofs = IA64_RR_BASE(6)) {
+   ofs = IA64_RR_MASK(ofs);
+   phys++;
}
-   else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
-   v = uio-uio_offset;
-
-   if (v = IA64_RR_BASE(6)) {
-   v = IA64_RR_MASK(v);
-   goto kmemphys;
-   }
 
-   c = min(iov-iov_len, MAXPHYS);
+   if (phys) {
+   error = mem_phys2virt(ofs, rw, ptr, limit);
+   if (error)
+   return (error);
+
+   count = min(uio-uio_resid, limit);
+   error = uiomove(ptr, count, uio);
+   } else {
+   ptr = (void *)ofs;
+   count = iov-iov_len;
 
/*
 * Make sure that all of the pages are currently
 * resident so that we don't create any zero-fill
 * pages.
 */
-   addr = trunc_page(v);
-   eaddr = round_page(v + c);
+   limit = round_page(ofs + count);
+   addr = trunc_page(ofs);
if (addr  VM_MAXUSER_ADDRESS)
-   return (EFAULT);
-   for (; addr  eaddr; addr += PAGE_SIZE) {
+   return (EINVAL);
+   for (; addr  limit; addr += PAGE_SIZE) {
if (pmap_kextract(addr) == 0)
  

svn commit: r268195 - stable/10/sys/ia64/ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 23:23:18 2014
New Revision: 268195
URL: http://svnweb.freebsd.org/changeset/base/268195

Log:
  MFC r263248  r263257: In intr_event_handle() we already save and set
  td_intr_frame, so don't do it also in ia64_handle_intr().

Modified:
  stable/10/sys/ia64/ia64/clock.c
  stable/10/sys/ia64/ia64/interrupt.c
  stable/10/sys/ia64/ia64/mp_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/clock.c
==
--- stable/10/sys/ia64/ia64/clock.c Wed Jul  2 23:12:56 2014
(r268194)
+++ stable/10/sys/ia64/ia64/clock.c Wed Jul  2 23:23:18 2014
(r268195)
@@ -76,6 +76,7 @@ static u_int
 ia64_ih_clock(struct thread *td, u_int xiv, struct trapframe *tf)
 {
struct eventtimer *et;
+   struct trapframe *stf;
uint64_t itc, load;
uint32_t mode;
 
@@ -96,8 +97,12 @@ ia64_ih_clock(struct thread *td, u_int x
ia64_srlz_d();
 
et = ia64_clock_et;
-   if (et-et_active)
+   if (et-et_active) {
+   stf = td-td_intr_frame;
+   td-td_intr_frame = tf;
et-et_event_cb(et, et-et_arg);
+   td-td_intr_frame = stf;
+   }
return (1);
 }
 

Modified: stable/10/sys/ia64/ia64/interrupt.c
==
--- stable/10/sys/ia64/ia64/interrupt.c Wed Jul  2 23:12:56 2014
(r268194)
+++ stable/10/sys/ia64/ia64/interrupt.c Wed Jul  2 23:23:18 2014
(r268195)
@@ -301,7 +301,6 @@ void
 ia64_handle_intr(struct trapframe *tf)
 {
struct thread *td;
-   struct trapframe *stf;
u_int xiv;
 
td = curthread;
@@ -316,9 +315,6 @@ ia64_handle_intr(struct trapframe *tf)
}
 
critical_enter();
-   stf = td-td_intr_frame;
-   td-td_intr_frame = tf;
-
do {
CTR2(KTR_INTR, INTR: ITC=%u, XIV=%u,
(u_int)tf-tf_special.ifa, xiv);
@@ -329,8 +325,6 @@ ia64_handle_intr(struct trapframe *tf)
xiv = ia64_get_ivr();
ia64_srlz_d();
} while (xiv != 15);
-
-   td-td_intr_frame = stf;
critical_exit();
 
  out:

Modified: stable/10/sys/ia64/ia64/mp_machdep.c
==
--- stable/10/sys/ia64/ia64/mp_machdep.cWed Jul  2 23:12:56 2014
(r268194)
+++ stable/10/sys/ia64/ia64/mp_machdep.cWed Jul  2 23:23:18 2014
(r268195)
@@ -113,10 +113,14 @@ ia64_ih_ast(struct thread *td, u_int xiv
 static u_int
 ia64_ih_hardclock(struct thread *td, u_int xiv, struct trapframe *tf)
 {
+   struct trapframe *stf;
 
PCPU_INC(md.stats.pcs_nhardclocks);
CTR1(KTR_SMP, IPI_HARDCLOCK, cpuid=%d, PCPU_GET(cpuid));
+   stf = td-td_intr_frame;
+   td-td_intr_frame = tf;
hardclockintr();
+   td-td_intr_frame = stf;
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268196 - head/sys/dev/vmware/vmxnet3

2014-07-02 Thread Bryan Venteicher
Author: bryanv
Date: Wed Jul  2 23:28:21 2014
New Revision: 268196
URL: http://svnweb.freebsd.org/changeset/base/268196

Log:
  Remove some write only variables
  
  MFC after:3 days

Modified:
  head/sys/dev/vmware/vmxnet3/if_vmx.c

Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c
==
--- head/sys/dev/vmware/vmxnet3/if_vmx.cWed Jul  2 23:23:18 2014
(r268195)
+++ head/sys/dev/vmware/vmxnet3/if_vmx.cWed Jul  2 23:28:21 2014
(r268196)
@@ -2226,12 +2226,10 @@ vmxnet3_legacy_intr(void *xsc)
struct vmxnet3_softc *sc;
struct vmxnet3_rxqueue *rxq;
struct vmxnet3_txqueue *txq;
-   struct ifnet *ifp;
 
sc = xsc;
rxq = sc-vmx_rxq[0];
txq = sc-vmx_txq[0];
-   ifp = sc-vmx_ifp;
 
if (sc-vmx_intr_type == VMXNET3_IT_LEGACY) {
if (vmxnet3_read_bar1(sc, VMXNET3_BAR1_INTR) == 0)
@@ -2260,11 +2258,9 @@ vmxnet3_txq_intr(void *xtxq)
 {
struct vmxnet3_softc *sc;
struct vmxnet3_txqueue *txq;
-   struct ifnet *ifp;
 
txq = xtxq;
sc = txq-vxtxq_sc;
-   ifp = sc-vmx_ifp;
 
if (sc-vmx_intr_mask_mode == VMXNET3_IMM_ACTIVE)
vmxnet3_disable_intr(sc, txq-vxtxq_intr_idx);
@@ -2774,7 +2770,6 @@ static int
 vmxnet3_txq_encap(struct vmxnet3_txqueue *txq, struct mbuf **m0)
 {
struct vmxnet3_softc *sc;
-   struct ifnet *ifp;
struct vmxnet3_txring *txr;
struct vmxnet3_txdesc *txd, *sop;
struct mbuf *m;
@@ -2783,7 +2778,6 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue
int i, gen, nsegs, etype, proto, start, error;
 
sc = txq-vxtxq_sc;
-   ifp = sc-vmx_ifp;
start = 0;
txd = NULL;
txr = txq-vxtxq_cmd_ring;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268197 - stable/10/sys/dev/mps

2014-07-02 Thread Scott Long
Author: scottl
Date: Wed Jul  2 23:32:05 2014
New Revision: 268197
URL: http://svnweb.freebsd.org/changeset/base/268197

Log:
  Merge r268071, 268072, 268088
  
   Refactor some code in mps.c to reduce header pollution.
   Add accessor functions for manipulating the CAM CCB status field.
   Don't overload the CCB status field within the driver.
  
  Reviewed by:gibbs, slm
  Obtained from:  Netflix, Inc.

Modified:
  stable/10/sys/dev/mps/mps.c
  stable/10/sys/dev/mps/mps_sas.c
  stable/10/sys/dev/mps/mps_sas.h
  stable/10/sys/dev/mps/mps_user.c
  stable/10/sys/dev/mps/mpsvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mps/mps.c
==
--- stable/10/sys/dev/mps/mps.c Wed Jul  2 23:28:21 2014(r268196)
+++ stable/10/sys/dev/mps/mps.c Wed Jul  2 23:32:05 2014(r268197)
@@ -75,7 +75,6 @@ __FBSDID($FreeBSD$);
 #include dev/mps/mps_ioctl.h
 #include dev/mps/mpsvar.h
 #include dev/mps/mps_table.h
-#include dev/mps/mps_sas.h
 
 static int mps_diag_reset(struct mps_softc *sc, int sleep_flag);
 static int mps_init_queues(struct mps_softc *sc);
@@ -328,11 +327,9 @@ mps_transition_operational(struct mps_so
 static int
 mps_iocfacts_allocate(struct mps_softc *sc, uint8_t attaching)
 {
-   int error, i;
+   int error;
Mpi2IOCFactsReply_t saved_facts;
uint8_t saved_mode, reallocating;
-   struct mpssas_lun *lun, *lun_tmp;
-   struct mpssas_target *targ;
 
mps_dprint(sc, MPS_TRACE, %s\n, __func__);
 
@@ -489,27 +486,7 @@ mps_iocfacts_allocate(struct mps_softc *
 */
if (reallocating) {
mps_iocfacts_free(sc);
-
-   /*
-* The number of targets is based on IOC Facts, so free all of
-* the allocated LUNs for each target and then the target buffer
-* itself.
-*/
-   for (i=0; i saved_facts.MaxTargets; i++) {
-   targ = sc-sassc-targets[i];
-   SLIST_FOREACH_SAFE(lun, targ-luns, lun_link,
-   lun_tmp) {
-   free(lun, M_MPT2);
-   }
-   }
-   free(sc-sassc-targets, M_MPT2);
-
-   sc-sassc-targets = malloc(sizeof(struct mpssas_target) *
-   sc-facts-MaxTargets, M_MPT2, M_WAITOK|M_ZERO);
-   if (!sc-sassc-targets) {
-   panic(%s failed to alloc targets with error %d\n,
-   __func__, ENOMEM);
-   }
+   mpssas_realloc_targets(sc, saved_facts.MaxTargets);
}
 
/*

Modified: stable/10/sys/dev/mps/mps_sas.c
==
--- stable/10/sys/dev/mps/mps_sas.c Wed Jul  2 23:28:21 2014
(r268196)
+++ stable/10/sys/dev/mps/mps_sas.c Wed Jul  2 23:32:05 2014
(r268197)
@@ -597,7 +597,7 @@ mpssas_remove_device(struct mps_softc *s
 
mps_dprint(sc, MPS_XINFO, Completing missed command %p\n, tm);
ccb = tm-cm_complete_data;
-   ccb-ccb_h.status = CAM_DEV_NOT_THERE;
+   mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE);
mpssas_scsiio_complete(sc, tm);
}
 }
@@ -986,7 +986,7 @@ mpssas_action(struct cam_sim *sim, union
 */
cpi-maxio = 256 * 1024;
 #endif
-   cpi-ccb_h.status = CAM_REQ_CMP;
+   mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
break;
}
case XPT_GET_TRAN_SETTINGS:
@@ -1005,7 +1005,7 @@ mpssas_action(struct cam_sim *sim, union
cts-ccb_h.target_id));
targ = sassc-targets[cts-ccb_h.target_id];
if (targ-handle == 0x0) {
-   cts-ccb_h.status = CAM_SEL_TIMEOUT;
+   mpssas_set_ccbstatus(ccb, CAM_SEL_TIMEOUT);
break;
}
 
@@ -1032,12 +1032,12 @@ mpssas_action(struct cam_sim *sim, union
scsi-valid = CTS_SCSI_VALID_TQ;
scsi-flags = CTS_SCSI_FLAGS_TAG_ENB;
 
-   cts-ccb_h.status = CAM_REQ_CMP;
+   mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
break;
}
case XPT_CALC_GEOMETRY:
cam_calc_geometry(ccb-ccg, /*extended*/1);
-   ccb-ccb_h.status = CAM_REQ_CMP;
+   mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
break;
case XPT_RESET_DEV:
mps_dprint(sassc-sc, MPS_XINFO, mpssas_action 
XPT_RESET_DEV\n);
@@ -1048,7 +1048,7 @@ mpssas_action(struct cam_sim *sim, union
case XPT_TERM_IO:
mps_dprint(sassc-sc, MPS_XINFO,
mpssas_action faking success for abort or reset\n);
-   ccb-ccb_h.status = CAM_REQ_CMP;
+   mpssas_set_ccbstatus(ccb, 

svn commit: r268198 - stable/10/sys/ia64/ia64

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 23:33:07 2014
New Revision: 268198
URL: http://svnweb.freebsd.org/changeset/base/268198

Log:
  MFC r263253: Don't use the ITC as the faulting address for external
  interrupts.

Modified:
  stable/10/sys/ia64/ia64/exception.S
  stable/10/sys/ia64/ia64/interrupt.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/exception.S
==
--- stable/10/sys/ia64/ia64/exception.S Wed Jul  2 23:32:05 2014
(r268197)
+++ stable/10/sys/ia64/ia64/exception.S Wed Jul  2 23:33:07 2014
(r268198)
@@ -1388,7 +1388,7 @@ IVT_END(Break_Instruction)
 
 IVT_ENTRY(External_Interrupt, 0x3000)
 {  .mib
-   mov r17=ar.itc  // Put the ITC in the trapframe.
+   mov r17=0
mov r16=ip
br.sptk exception_save
;;

Modified: stable/10/sys/ia64/ia64/interrupt.c
==
--- stable/10/sys/ia64/ia64/interrupt.c Wed Jul  2 23:32:05 2014
(r268197)
+++ stable/10/sys/ia64/ia64/interrupt.c Wed Jul  2 23:33:07 2014
(r268198)
@@ -316,8 +316,8 @@ ia64_handle_intr(struct trapframe *tf)
 
critical_enter();
do {
-   CTR2(KTR_INTR, INTR: ITC=%u, XIV=%u,
-   (u_int)tf-tf_special.ifa, xiv);
+   CTR3(KTR_INTR, INTR: XIV=%u, #%u: frame=%p, xiv,
+   PCPU_GET(cnt.v_intr), tf);
if (!(ia64_handler[xiv])(td, xiv, tf)) {
ia64_set_eoi(0);
ia64_srlz_d();
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268199 - in stable/10/sys/ia64: ia64 include

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 23:37:14 2014
New Revision: 268199
URL: http://svnweb.freebsd.org/changeset/base/268199

Log:
  MFC r263254: Move the implementation of kdb_cpu_trap() from machine/kdb.h
  to machdep.c.

Modified:
  stable/10/sys/ia64/ia64/machdep.c
  stable/10/sys/ia64/include/kdb.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/machdep.c
==
--- stable/10/sys/ia64/ia64/machdep.c   Wed Jul  2 23:33:07 2014
(r268198)
+++ stable/10/sys/ia64/ia64/machdep.c   Wed Jul  2 23:37:14 2014
(r268199)
@@ -86,6 +86,7 @@ __FBSDID($FreeBSD$);
 #include machine/elf.h
 #include machine/fpu.h
 #include machine/intr.h
+#include machine/kdb.h
 #include machine/mca.h
 #include machine/md_var.h
 #include machine/pal.h
@@ -562,6 +563,18 @@ spinlock_exit(void)
 }
 
 void
+kdb_cpu_trap(int vector, int code __unused)
+{
+
+   __asm __volatile(flushrs;;);
+
+   /* Restart after the break instruction. */
+   if (vector == IA64_VEC_BREAK 
+   kdb_frame-tf_special.ifa == IA64_FIXED_BREAK)
+   kdb_frame-tf_special.psr += IA64_PSR_RI_1;
+}
+
+void
 map_vhpt(uintptr_t vhpt)
 {
pt_entry_t pte;

Modified: stable/10/sys/ia64/include/kdb.h
==
--- stable/10/sys/ia64/include/kdb.hWed Jul  2 23:33:07 2014
(r268198)
+++ stable/10/sys/ia64/include/kdb.hWed Jul  2 23:37:14 2014
(r268199)
@@ -35,6 +35,8 @@
 
 #defineKDB_STOPPEDPCB(pc)  ((pc)-pc_md.pcb)
 
+void kdb_cpu_trap(int, int);
+
 static __inline void
 kdb_cpu_clear_singlestep(void)
 {
@@ -62,14 +64,4 @@ kdb_cpu_sync_icache(unsigned char *addr,
}
 }
 
-static __inline void
-kdb_cpu_trap(int vector, int _)
-{
-   __asm __volatile(flushrs;;);
-
-   if (vector == IA64_VEC_BREAK 
-   kdb_frame-tf_special.ifa == IA64_FIXED_BREAK)
-kdb_frame-tf_special.psr += IA64_PSR_RI_1;
-}
-
 #endif /* _MACHINE_KDB_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268200 - in stable/10/sys: conf ia64/ia64 ia64/include

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 23:47:43 2014
New Revision: 268200
URL: http://svnweb.freebsd.org/changeset/base/268200

Log:
  MFC r263323: Fix and improve exception tracing.

Added:
  stable/10/sys/ia64/ia64/xtrace.c
 - copied unchanged from r263323, head/sys/ia64/ia64/xtrace.c
Modified:
  stable/10/sys/conf/files.ia64
  stable/10/sys/conf/options.ia64
  stable/10/sys/ia64/ia64/db_machdep.c
  stable/10/sys/ia64/ia64/exception.S
  stable/10/sys/ia64/ia64/interrupt.c
  stable/10/sys/ia64/ia64/machdep.c
  stable/10/sys/ia64/ia64/mp_machdep.c
  stable/10/sys/ia64/ia64/trap.c
  stable/10/sys/ia64/include/md_var.h
  stable/10/sys/ia64/include/pcpu.h
  stable/10/sys/ia64/include/smp.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files.ia64
==
--- stable/10/sys/conf/files.ia64   Wed Jul  2 23:37:14 2014
(r268199)
+++ stable/10/sys/conf/files.ia64   Wed Jul  2 23:47:43 2014
(r268200)
@@ -110,6 +110,7 @@ ia64/ia64/uma_machdep.c standard
 ia64/ia64/unaligned.c  standard
 ia64/ia64/unwind.c standard
 ia64/ia64/vm_machdep.c standard
+ia64/ia64/xtrace.c optionalxtrace
 ia64/isa/isa.c optionalisa
 ia64/isa/isa_dma.c optionalisa
 ia64/pci/pci_cfgreg.c  optionalpci

Modified: stable/10/sys/conf/options.ia64
==
--- stable/10/sys/conf/options.ia64 Wed Jul  2 23:37:14 2014
(r268199)
+++ stable/10/sys/conf/options.ia64 Wed Jul  2 23:47:43 2014
(r268200)
@@ -13,7 +13,7 @@ COMPAT_FREEBSD32  opt_compat.h
 
 PV_STATS   opt_pmap.h
 
-EXCEPTION_TRACING  opt_xtrace.h
+XTRACE
 
 VGA_ALT_SEQACCESS  opt_vga.h
 VGA_DEBUG  opt_vga.h

Modified: stable/10/sys/ia64/ia64/db_machdep.c
==
--- stable/10/sys/ia64/ia64/db_machdep.cWed Jul  2 23:37:14 2014
(r268199)
+++ stable/10/sys/ia64/ia64/db_machdep.cWed Jul  2 23:47:43 2014
(r268200)
@@ -26,11 +26,11 @@
  * SUCH DAMAGE.
  */
 
+#include opt_xtrace.h
+
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
-#include opt_xtrace.h
-
 #include sys/param.h
 #include sys/systm.h
 #include sys/cons.h
@@ -585,6 +585,10 @@ db_show_mdpcpu(struct pcpu *pc)
db_printf(MD: clock_load = %#lx\n, md-clock_load);
db_printf(MD: stats  = %p\n, md-stats);
db_printf(MD: pmap   = %p\n, md-current_pmap);
+#ifdef XTRACE
+   db_printf(MD: xtrace_buffer = %p\n, md-xtrace_buffer);
+   db_printf(MD: xtrace_tail   = %#lx\n, md-xtrace_tail);
+#endif
 }
 
 void
@@ -604,29 +608,3 @@ db_trace_thread(struct thread *td, int c
ctx = kdb_thr_ctx(td);
return (db_backtrace(td, ctx, count));
 }
-
-#ifdef EXCEPTION_TRACING
-
-extern long xtrace[];
-extern long *xhead;
-
-DB_COMMAND(xtrace, db_xtrace)
-{
-   long *p;
-
-   p = (*xhead == 0) ? xtrace : xhead;
-
-   db_printf(ITC\t\t IVT\t\t  IIP\t\t   IFA\t\tISR\n);
-   if (*p == 0)
-   return;
-
-   do {
-   db_printf(%016lx %016lx %016lx %016lx %016lx\n, p[0], p[1],
-   p[2], p[3], p[4]);
-   p += 5;
-   if (p == (void *)xhead)
-   p = xtrace;
-   } while (p != xhead);
-}
-
-#endif

Modified: stable/10/sys/ia64/ia64/exception.S
==
--- stable/10/sys/ia64/ia64/exception.S Wed Jul  2 23:37:14 2014
(r268199)
+++ stable/10/sys/ia64/ia64/exception.S Wed Jul  2 23:47:43 2014
(r268200)
@@ -50,63 +50,185 @@ __FBSDID($FreeBSD$);
 
.section .ivt.data, aw
 
+   .align  8
.global ia64_kptdir
+   .size   ia64_kptdir, 8
 ia64_kptdir:   data8   0
 
-#ifdef EXCEPTION_TRACING
+#ifdef XTRACE
 
-   .global xtrace, xhead
-xtrace:.space  1024*5*8
-xhead: data8   xtrace
+   .align  8
+   .global ia64_xtrace_mask
+   .size   ia64_xtrace_mask, 8
+ia64_xtrace_mask:  data8   0
+
+   .align  4
+   .global ia64_xtrace_enabled
+   .size   ia64_xtrace_enabled, 4
+ia64_xtrace_enabled:   data4   0
 
-#defineXTRACE(offset)  \
-{  .mmi ;  \
-   mov r24=ar.itc ;\
-   mov r25=cr.iip ;\
-   mov r27=offset ;\
-} ;\
-{  .mlx ;  \
-   mov r28=cr.ifa ;\
-   movlr29=xhead ;;\
-} ;\
-{  .mmi ;  \
-   ld8 r29=[r29] ;;\
-   st8  

svn commit: r268201 - in stable/10/sys/ia64: ia64 include

2014-07-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul  2 23:57:55 2014
New Revision: 268201
URL: http://svnweb.freebsd.org/changeset/base/268201

Log:
  MFC r263380  r268185: Add KTR events for the PMAP interface functions.

Modified:
  stable/10/sys/ia64/ia64/machdep.c
  stable/10/sys/ia64/ia64/pmap.c
  stable/10/sys/ia64/include/pmap.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ia64/ia64/machdep.c
==
--- stable/10/sys/ia64/ia64/machdep.c   Wed Jul  2 23:47:43 2014
(r268200)
+++ stable/10/sys/ia64/ia64/machdep.c   Wed Jul  2 23:57:55 2014
(r268201)
@@ -133,6 +133,7 @@ SYSCTL_UINT(_hw_freq, OID_AUTO, itc, CTL
 ITC frequency);
 
 int cold = 1;
+int unmapped_buf_allowed = 0;
 
 struct bootinfo *bootinfo;
 
@@ -746,8 +747,8 @@ ia64_init(void)
mdlen = md-md_pages * EFI_PAGE_SIZE;
switch (md-md_type) {
case EFI_MD_TYPE_IOPORT:
-   ia64_port_base = (uintptr_t)pmap_mapdev(md-md_phys,
-   mdlen);
+   ia64_port_base = pmap_mapdev_priv(md-md_phys,
+   mdlen, VM_MEMATTR_UNCACHEABLE);
break;
case EFI_MD_TYPE_PALCODE:
ia64_pal_base = md-md_phys;

Modified: stable/10/sys/ia64/ia64/pmap.c
==
--- stable/10/sys/ia64/ia64/pmap.c  Wed Jul  2 23:47:43 2014
(r268200)
+++ stable/10/sys/ia64/ia64/pmap.c  Wed Jul  2 23:57:55 2014
(r268201)
@@ -52,6 +52,7 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/kernel.h
+#include sys/ktr.h
 #include sys/lock.h
 #include sys/mman.h
 #include sys/mutex.h
@@ -484,6 +485,8 @@ void
 pmap_page_init(vm_page_t m)
 {
 
+   CTR2(KTR_PMAP, %s(m=%p), __func__, m);
+
TAILQ_INIT(m-md.pv_list);
m-md.memattr = VM_MEMATTR_DEFAULT;
 }
@@ -497,6 +500,8 @@ void
 pmap_init(void)
 {
 
+   CTR1(KTR_PMAP, %s(), __func__);
+
ptezone = uma_zcreate(PT ENTRY, sizeof (struct ia64_lpte), 
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM|UMA_ZONE_NOFREE);
 }
@@ -604,13 +609,25 @@ pmap_free_rid(uint32_t rid)
  * Page table page management routines.
  ***/
 
+static void
+pmap_pinit_common(pmap_t pmap)
+{
+   int i;
+
+   for (i = 0; i  IA64_VM_MINKERN_REGION; i++)
+   pmap-pm_rid[i] = pmap_allocate_rid();
+   TAILQ_INIT(pmap-pm_pvchunk);
+   bzero(pmap-pm_stats, sizeof pmap-pm_stats);
+}
+
 void
-pmap_pinit0(struct pmap *pmap)
+pmap_pinit0(pmap_t pmap)
 {
 
+   CTR2(KTR_PMAP, %s(pm=%p), __func__, pmap);
+
PMAP_LOCK_INIT(pmap);
-   /* kernel_pmap is the same as any other pmap. */
-   pmap_pinit(pmap);
+   pmap_pinit_common(pmap);
 }
 
 /*
@@ -618,14 +635,12 @@ pmap_pinit0(struct pmap *pmap)
  * such as one in a vmspace structure.
  */
 int
-pmap_pinit(struct pmap *pmap)
+pmap_pinit(pmap_t pmap)
 {
-   int i;
 
-   for (i = 0; i  IA64_VM_MINKERN_REGION; i++)
-   pmap-pm_rid[i] = pmap_allocate_rid();
-   TAILQ_INIT(pmap-pm_pvchunk);
-   bzero(pmap-pm_stats, sizeof pmap-pm_stats);
+   CTR2(KTR_PMAP, %s(pm=%p), __func__, pmap);
+
+   pmap_pinit_common(pmap);
return (1);
 }
 
@@ -643,6 +658,8 @@ pmap_release(pmap_t pmap)
 {
int i;
 
+   CTR2(KTR_PMAP, %s(pm=%p), __func__, pmap);
+
for (i = 0; i  IA64_VM_MINKERN_REGION; i++)
if (pmap-pm_rid[i])
pmap_free_rid(pmap-pm_rid[i]);
@@ -658,6 +675,8 @@ pmap_growkernel(vm_offset_t addr)
struct ia64_lpte *leaf;
vm_page_t nkpg;
 
+   CTR2(KTR_PMAP, %s(va=%#lx), __func__, addr);
+
while (kernel_vm_end = addr) {
if (nkpt == PAGE_SIZE/8 + PAGE_SIZE*PAGE_SIZE/64)
panic(%s: out of kernel address space, __func__);
@@ -1152,6 +1171,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va
pmap_t oldpmap;
vm_paddr_t pa;
 
+   CTR3(KTR_PMAP, %s(pm=%p, va=%#lx), __func__, pmap, va);
+
pa = 0;
PMAP_LOCK(pmap);
oldpmap = pmap_switch(pmap);
@@ -1178,6 +1199,9 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
vm_page_t m;
vm_paddr_t pa;
 
+   CTR4(KTR_PMAP, %s(pm=%p, va=%#lx, prot=%#x), __func__, pmap, va,
+   prot);
+
pa = 0;
m = NULL;
PMAP_LOCK(pmap);
@@ -1359,6 +1383,8 @@ pmap_kextract(vm_offset_t va)
vm_paddr_t pa;
u_int idx;
 
+   CTR2(KTR_PMAP, %s(va=%#lx), __func__, va);
+
KASSERT(va = VM_MAXUSER_ADDRESS, (Must be kernel VA));
 
/* Regions 6 and 7 are direct mapped. */
@@ -1419,6 +1445,8 @@ pmap_qenter(vm_offset_t va, vm_page_t *m
struct ia64_lpte *pte;
int i;
 
+   CTR4(KTR_PMAP, %s(va=%#lx, m_p=%p, cnt=%d), __func__, va, m, count);
+

svn commit: r268202 - head/usr.sbin/bhyve

2014-07-02 Thread Peter Grehan
Author: grehan
Date: Thu Jul  3 00:23:14 2014
New Revision: 268202
URL: http://svnweb.freebsd.org/changeset/base/268202

Log:
  Use correct flag for event index.
  
  Submitted by: luigi
  Obtained from:Vincenzo Maffione, Universita` di Pisa
  MFC after:1 week

Modified:
  head/usr.sbin/bhyve/virtio.c

Modified: head/usr.sbin/bhyve/virtio.c
==
--- head/usr.sbin/bhyve/virtio.cWed Jul  2 23:57:55 2014
(r268201)
+++ head/usr.sbin/bhyve/virtio.cThu Jul  3 00:23:14 2014
(r268202)
@@ -437,7 +437,7 @@ vq_endchains(struct vqueue_info *vq, int
if (used_all_avail 
(vs-vs_negotiated_caps  VIRTIO_F_NOTIFY_ON_EMPTY))
intr = 1;
-   else if (vs-vs_flags  VIRTIO_EVENT_IDX) {
+   else if (vs-vs_negotiated_caps  VIRTIO_RING_F_EVENT_IDX) {
event_idx = VQ_USED_EVENT_IDX(vq);
/*
 * This calculation is per docs and the kernel
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268176 - in head/sys/dev: bge nfe

2014-07-02 Thread Marcel Moolenaar

On Jul 2, 2014, at 2:08 PM, Sergey Kandaurov pluk...@freebsd.org wrote:

 Author: pluknet
 Date: Wed Jul  2 21:08:25 2014
 New Revision: 268176
 URL: http://svnweb.freebsd.org/changeset/base/268176
 
 Log:
  Fixed build with DEVICE_POLLING.

Ugh... Thanks!

I'll add that to the checklist for people to verify.

-- 
Marcel Moolenaar
mar...@xcllnt.net




signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r268203 - head/usr.bin/sed

2014-07-02 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul  3 00:31:13 2014
New Revision: 268203
URL: http://svnweb.freebsd.org/changeset/base/268203

Log:
  More sed(1) usage fixing: the extension -i is not optional.
  
  Pointed out by:   jmallet
  MFC after:3 days

Modified:
  head/usr.bin/sed/main.c

Modified: head/usr.bin/sed/main.c
==
--- head/usr.bin/sed/main.c Thu Jul  3 00:23:14 2014(r268202)
+++ head/usr.bin/sed/main.c Thu Jul  3 00:31:13 2014(r268203)
@@ -204,7 +204,7 @@ static void
 usage(void)
 {
(void)fprintf(stderr,
-   usage: %s script [-Ealnru] [-i[extension]] [file ...]\n
+   usage: %s script [-Ealnru] [-i extension] [file ...]\n
\t%s [-Ealnu] [-i extension] [-e script] ... [-f script_file]
 ... [file ...]\n, getprogname(), getprogname());
exit(1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-02 Thread Alexander Motin
Author: mav
Date: Thu Jul  3 04:26:53 2014
New Revision: 268204
URL: http://svnweb.freebsd.org/changeset/base/268204

Log:
  Use separate memory type M_CTLIO for I/Os.
  
  CTL allocate large amount of RAM.  This change give some more stats.
  
  MFC after:2 weeks

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

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Thu Jul  3 00:31:13 2014(r268203)
+++ head/sys/cam/ctl/ctl.c  Thu Jul  3 04:26:53 2014(r268204)
@@ -455,6 +455,7 @@ static struct cdevsw ctl_cdevsw = {
 
 
 MALLOC_DEFINE(M_CTL, ctlmem, Memory used for CTL);
+MALLOC_DEFINE(M_CTLIO, ctlio, Memory used for CTL requests);
 
 static int ctl_module_event_handler(module_t, int /*modeventtype_t*/, void *);
 
@@ -3358,7 +3359,7 @@ ctl_pool_create(struct ctl_softc *ctl_so
 * tracking.
 */
for (i = 0; i  total_ctl_io; i++) {
-   cur_io = (union ctl_io *)malloc(sizeof(*cur_io), M_CTL,
+   cur_io = (union ctl_io *)malloc(sizeof(*cur_io), M_CTLIO,
M_NOWAIT);
if (cur_io == NULL) {
retval = ENOMEM;
@@ -3377,7 +3378,7 @@ ctl_pool_create(struct ctl_softc *ctl_so
  links);
STAILQ_REMOVE(pool-free_queue, cur_io-io_hdr,
  ctl_io_hdr, links);
-   free(cur_io, M_CTL);
+   free(cur_io, M_CTLIO);
}
 
free(pool, M_CTL);
@@ -3439,7 +3440,7 @@ ctl_pool_release(struct ctl_io_pool *poo
while ((io = (union ctl_io *)STAILQ_FIRST(pool-free_queue)) != NULL) {
STAILQ_REMOVE(pool-free_queue, io-io_hdr, ctl_io_hdr,
  links);
-   free(io, M_CTL);
+   free(io, M_CTLIO);
}
 
STAILQ_REMOVE(ctl_softc-io_pools, pool, ctl_io_pool, links);
@@ -3543,7 +3544,7 @@ ctl_alloc_io(void *pool_ref)
 * The emergency pool (if it exists) didn't have one, so try an
 * atomic (i.e. nonblocking) malloc and see if we get lucky.
 */
-   io = (union ctl_io *)malloc(sizeof(*io), M_CTL, M_NOWAIT);
+   io = (union ctl_io *)malloc(sizeof(*io), M_CTLIO, M_NOWAIT);
if (io != NULL) {
/*
 * If the emergency pool exists but is empty, add this
@@ -3595,7 +3596,7 @@ ctl_free_io(union ctl_io *io)
 * Otherwise, just free it.  We probably malloced it and
 * the emergency pool wasn't available.
 */
-   free(io, M_CTL);
+   free(io, M_CTLIO);
}
 
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268205 - head/sys/cam/ata

2014-07-02 Thread Warner Losh
Author: imp
Date: Thu Jul  3 05:22:13 2014
New Revision: 268205
URL: http://svnweb.freebsd.org/changeset/base/268205

Log:
  Rework the BIO_DELETE code slightly. Always queue the BIO_DELETE
  requests on the trim_queue, even for the CFA ERASE. This allows us, in
  the future, to collapse adjacent requests. Since CFA ERASE is only for
  CF cards, and it is so restrictive in what it can do, the collapse
  code is not presently here. This also brings the ada driver more in
  line with the da driver's treatment of BIO_DELETEs.
  
  Reviewed by: mav@

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Jul  3 04:26:53 2014(r268204)
+++ head/sys/cam/ata/ata_da.c   Thu Jul  3 05:22:13 2014(r268205)
@@ -719,8 +719,11 @@ adastrategy(struct bio *bp)
/*
 * Place it in the queue of disk activities for this disk
 */
-   if (bp-bio_cmd == BIO_DELETE 
-   (softc-flags  ADA_FLAG_CAN_TRIM)) {
+   if (bp-bio_cmd == BIO_DELETE) {
+   KASSERT((softc-flags  ADA_FLAG_CAN_TRIM) ||
+   ((softc-flags  ADA_FLAG_CAN_CFA) 
+!(softc-flags  ADA_FLAG_CAN_48BIT)),
+   (BIO_DELETE but no supported TRIM method.));
bioq_disksort(softc-trim_queue, bp);
} else {
if (ADA_SIO)
@@ -1376,6 +1379,96 @@ adaregister(struct cam_periph *periph, v
 }
 
 static void
+ada_dsmtrim(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio)
+{
+   struct trim_request *req = softc-trim_req;
+   uint64_t lastlba = (uint64_t)-1;
+   int c, lastcount = 0, off, ranges = 0;
+
+   bzero(req, sizeof(*req));
+   TAILQ_INIT(req-bps);
+   do {
+   uint64_t lba = bp-bio_pblkno;
+   int count = bp-bio_bcount / softc-params.secsize;
+
+   bioq_remove(softc-trim_queue, bp);
+
+   /* Try to extend the previous range. */
+   if (lba == lastlba) {
+   c = min(count, ATA_DSM_RANGE_MAX - lastcount);
+   lastcount += c;
+   off = (ranges - 1) * ATA_DSM_RANGE_SIZE;
+   req-data[off + 6] = lastcount  0xff;
+   req-data[off + 7] =
+   (lastcount  8)  0xff;
+   count -= c;
+   lba += c;
+   }
+
+   while (count  0) {
+   c = min(count, ATA_DSM_RANGE_MAX);
+   off = ranges * ATA_DSM_RANGE_SIZE;
+   req-data[off + 0] = lba  0xff;
+   req-data[off + 1] = (lba  8)  0xff;
+   req-data[off + 2] = (lba  16)  0xff;
+   req-data[off + 3] = (lba  24)  0xff;
+   req-data[off + 4] = (lba  32)  0xff;
+   req-data[off + 5] = (lba  40)  0xff;
+   req-data[off + 6] = c  0xff;
+   req-data[off + 7] = (c  8)  0xff;
+   lba += c;
+   count -= c;
+   lastcount = c;
+   ranges++;
+   /*
+* Its the caller's responsibility to ensure the
+* request will fit so we don't need to check for
+* overrun here
+*/
+   }
+   lastlba = lba;
+   TAILQ_INSERT_TAIL(req-bps, bp, bio_queue);
+   bp = bioq_first(softc-trim_queue);
+   if (bp == NULL ||
+   bp-bio_bcount / softc-params.secsize 
+   (softc-trim_max_ranges - ranges) * ATA_DSM_RANGE_MAX)
+   break;
+   } while (1);
+   cam_fill_ataio(ataio,
+   ada_retry_count,
+   adadone,
+   CAM_DIR_OUT,
+   0,
+   req-data,
+   ((ranges + ATA_DSM_BLK_RANGES - 1) /
+   ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE,
+   ada_default_timeout * 1000);
+   ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT,
+   ATA_DSM_TRIM, 0, (ranges + ATA_DSM_BLK_RANGES -
+   1) / ATA_DSM_BLK_RANGES);
+}
+
+static void
+ada_cfaerase(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio)
+{
+   uint64_t lba = bp-bio_pblkno;
+   uint16_t count = bp-bio_bcount / softc-params.secsize;
+
+   cam_fill_ataio(ataio,
+   ada_retry_count,
+   adadone,
+   CAM_DIR_NONE,
+   0,
+   NULL,
+   0,
+   ada_default_timeout*1000);
+
+   if (count = 256)
+   count = 0;
+   ata_28bit_cmd(ataio, ATA_CFA_ERASE, 0, lba, count);
+}
+
+static void
 adastart(struct cam_periph *periph, union ccb *start_ccb)
 {
struct ada_softc *softc = (struct ada_softc