aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/linux/syscalls.conf12
-rw-r--r--sys/cam/scsi/scsi_target.c15
-rw-r--r--sys/conf/newvers.sh2
-rw-r--r--sys/dev/aic7xxx/ahc_pci.c7
-rw-r--r--sys/dev/aic7xxx/aic7xxx.c242
-rw-r--r--sys/dev/aic7xxx/aic7xxx.reg4
-rw-r--r--sys/dev/aic7xxx/aic7xxx.seq10
-rw-r--r--sys/dev/ata/ata-all.c35
-rw-r--r--sys/dev/ata/atapi-all.c7
-rw-r--r--sys/dev/ata/atapi-all.h3
-rw-r--r--sys/dev/ata/atapi-tape.c10
-rw-r--r--sys/dev/ic/hd64570.h372
-rw-r--r--sys/dev/isp/isp_freebsd.c5
-rw-r--r--sys/kern/uipc_socket.c8
-rw-r--r--sys/kern/vfs_subr.c46
-rw-r--r--sys/net/bpf.c19
-rw-r--r--sys/net/bpf.h2
-rw-r--r--sys/net/bpfdesc.h1
-rw-r--r--sys/sys/unistd.h1
19 files changed, 229 insertions, 572 deletions
diff --git a/sys/alpha/linux/syscalls.conf b/sys/alpha/linux/syscalls.conf
deleted file mode 100644
index 01e258801231..000000000000
--- a/sys/alpha/linux/syscalls.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-# $FreeBSD$
-sysnames="/dev/null"
-sysproto="linux_proto.h"
-sysproto_h=_LINUX_SYSPROTO_H_
-syshdr="linux_syscall.h"
-syssw="linux_sysent.c"
-sysmk="/dev/null"
-syshide="/dev/null"
-syscallprefix="LINUX_SYS_"
-switchname="linux_sysent"
-namesname="linux_syscallnames"
-sysvec="\n"
diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c
index c1c771d2c13b..0b810458b4da 100644
--- a/sys/cam/scsi/scsi_target.c
+++ b/sys/cam/scsi/scsi_target.c
@@ -329,6 +329,7 @@ targenlun(struct cam_periph *periph)
xpt_setup_ccb(&atio->ccb_h, periph->path, /*priority*/1);
atio->ccb_h.func_code = XPT_ACCEPT_TARGET_IO;
atio->ccb_h.cbfcnp = targdone;
+ atio->ccb_h.ccb_flags = TARG_CCB_NONE;
xpt_action((union ccb *)atio);
status = atio->ccb_h.status;
if (status != CAM_REQ_INPROG) {
@@ -734,6 +735,7 @@ targfreeinstance(struct ioc_alloc_unit *alloc_unit)
/* Find our instance. */
if ((periph = cam_periph_find(path, "targ")) == NULL) {
xpt_print_path(path);
+ printf("Invalid path specified for freeing target instance\n");
status = CAM_PATH_INVALID;
goto fail;
}
@@ -984,8 +986,8 @@ targsendccb(struct cam_periph *periph, union ccb *ccb, union ccb *inccb)
&softc->device_stats);
if (ccb->ccb_h.func_code == XPT_CONT_TARGET_IO)
- TAILQ_INSERT_TAIL(&softc->pending_queue, &ccb->ccb_h,
- periph_links.tqe);
+ TAILQ_REMOVE(&softc->pending_queue, &ccb->ccb_h,
+ periph_links.tqe);
} else {
ccb->ccb_h.status = CAM_UNACKED_EVENT;
error = 0;
@@ -1405,6 +1407,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb)
atio->ccb_h.flags |= CAM_DIR_NONE;
descr->data_resid = 0;
descr->data_increment = 0;
+ descr->timeout = 5 * 1000;
descr->status = SCSI_STATUS_CHECK_COND;
copy_sense(softc, istate, (u_int8_t *)&atio->sense_data,
atio->sense_len);
@@ -1460,6 +1463,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb)
inq = (struct scsi_inquiry *)cdb;
sense = &istate->sense_data;
+ descr->status = SCSI_STATUS_OK;
CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH,
("Saw an inquiry!\n"));
/*
@@ -1473,6 +1477,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb)
atio->ccb_h.flags |= CAM_DIR_NONE;
descr->data_resid = 0;
descr->data_increment = 0;
+ descr->timeout = 5 * 1000;
descr->status = SCSI_STATUS_CHECK_COND;
fill_sense(softc, atio->init_id,
SSD_CURRENT_ERROR,
@@ -1517,7 +1522,6 @@ targdone(struct cam_periph *periph, union ccb *done_ccb)
inq->length);
descr->data_increment = descr->data_resid;
descr->timeout = 5 * 1000;
- descr->status = SCSI_STATUS_OK;
break;
}
case TEST_UNIT_READY:
@@ -1904,7 +1908,6 @@ targerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
istate = &softc->istate[csio->init_id];
switch (status) {
case CAM_REQ_ABORTED:
- printf("Request Aborted!\n");
if ((ccb->ccb_h.ccb_flags & TARG_CCB_ABORT_TO_HELDQ) != 0) {
/*
@@ -2102,7 +2105,7 @@ set_ca_condition(struct cam_periph *periph, u_int initiator_id, ca_types ca)
softc = (struct targ_softc *)periph->softc;
softc->istate[initiator_id].pending_ca = ca;
abort_pending_transactions(periph, initiator_id, TARG_TAG_WILDCARD,
- /* errno */0, /*to_held_queue*/TRUE);
+ /*errno*/0, /*to_held_queue*/TRUE);
}
static void
@@ -2192,7 +2195,7 @@ abort_pending_transactions(struct cam_periph *periph, u_int initiator_id,
CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH,
("Aborting CTIO\n"));
- TAILQ_REMOVE(&softc->work_queue, &csio->ccb_h,
+ TAILQ_REMOVE(&softc->pending_queue, &csio->ccb_h,
periph_links.tqe);
if (to_held_queue != 0)
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index abe05919c8a0..0bfbfb892dbe 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -36,7 +36,7 @@
TYPE="FreeBSD"
REVISION="4.0"
-BRANCH="STABLE"
+BRANCH="RELEASE"
RELEASE="${REVISION}-${BRANCH}"
SNAPDATE=""
if [ "X${SNAPDATE}" != "X" ]; then
diff --git a/sys/dev/aic7xxx/ahc_pci.c b/sys/dev/aic7xxx/ahc_pci.c
index b40455b2fb18..67bb43ab916f 100644
--- a/sys/dev/aic7xxx/ahc_pci.c
+++ b/sys/dev/aic7xxx/ahc_pci.c
@@ -1526,17 +1526,14 @@ acquire_seeprom(struct ahc_softc *ahc, struct seeprom_descriptor *sd)
}
static void
-release_seeprom(sd)
- struct seeprom_descriptor *sd;
+release_seeprom(struct seeprom_descriptor *sd)
{
/* Release access to the memory port and the serial EEPROM. */
SEEPROM_OUTB(sd, 0);
}
static void
-write_brdctl(ahc, value)
- struct ahc_softc *ahc;
- u_int8_t value;
+write_brdctl(struct ahc_softc *ahc, u_int8_t value)
{
u_int8_t brdctl;
diff --git a/sys/dev/aic7xxx/aic7xxx.c b/sys/dev/aic7xxx/aic7xxx.c
index e0f6794e964f..29e96f499136 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -259,6 +259,7 @@ static void ahc_free_tstate(struct ahc_softc *ahc,
u_int scsi_id, char channel, int force);
static void ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim,
union ccb *ccb);
+static void ahc_update_scsiid(struct ahc_softc *ahc, u_int targid_mask);
static int ahc_handle_target_cmd(struct ahc_softc *ahc,
struct target_cmd *cmd);
static void ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat);
@@ -541,12 +542,22 @@ ahc_run_tqinfifo(struct ahc_softc *ahc, int paused)
* Lazily update our position in the target mode incomming
* command queue as seen by the sequencer.
*/
- if ((ahc->tqinfifonext & (TQINFIFO_UPDATE_CNT-1)) == 0) {
- if (!paused)
- pause_sequencer(ahc);
- ahc_outb(ahc, KERNEL_TQINPOS, ahc->tqinfifonext - 1);
- if (!paused)
+ if ((ahc->tqinfifonext & (HOST_TQINPOS - 1)) == 1) {
+ if ((ahc->features & AHC_HS_MAILBOX) != 0) {
+ u_int hs_mailbox;
+
+ hs_mailbox = ahc_inb(ahc, HS_MAILBOX);
+ hs_mailbox &= ~HOST_TQINPOS;
+ hs_mailbox |= ahc->tqinfifonext & HOST_TQINPOS;
+ ahc_outb(ahc, HS_MAILBOX, hs_mailbox);
+ } else {
+ if (!paused)
+ pause_sequencer(ahc);
+ ahc_outb(ahc, KERNEL_TQINPOS,
+ ahc->tqinfifonext & HOST_TQINPOS);
+ if (!paused)
unpause_sequencer(ahc);
+ }
}
}
}
@@ -655,18 +666,18 @@ ahc_print_scb(struct scb *scb)
{
struct hardware_scb *hscb = scb->hscb;
- printf("scb:%p control:0x%x tcl:0x%x cmdlen:%d cmdpointer:0x%lx\n",
+ printf("scb:%p control:0x%x tcl:0x%x cmdlen:%d cmdpointer:0x%x\n",
scb,
hscb->control,
hscb->tcl,
hscb->cmdlen,
- hscb->cmdpointer );
- printf(" datlen:%d data:0x%lx segs:0x%x segp:0x%lx\n",
+ hscb->cmdpointer);
+ printf(" datlen:%d data:0x%x segs:0x%x segp:0x%x\n",
hscb->datalen,
hscb->data,
hscb->SG_count,
hscb->SG_pointer);
- printf(" sg_addr:%lx sg_len:%ld\n",
+ printf(" sg_addr:%x sg_len:%d\n",
scb->sg_list[0].addr,
scb->sg_list[0].len);
printf(" cdb:%x %x %x %x %x %x %x %x %x %x %x %x\n",
@@ -715,8 +726,8 @@ static const int num_phases = (sizeof(phase_table)/sizeof(phase_table[0])) - 1;
*/
#define AHC_SYNCRATE_DT 0
#define AHC_SYNCRATE_ULTRA2 1
-#define AHC_SYNCRATE_ULTRA 2
-#define AHC_SYNCRATE_FAST 5
+#define AHC_SYNCRATE_ULTRA 3
+#define AHC_SYNCRATE_FAST 6
static struct ahc_syncrate ahc_syncrates[] = {
/* ultra2 fast/ultra period rate */
{ 0x42, 0x000, 9, "80.0" },
@@ -1901,7 +1912,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
ahc->enabled_luns++;
if ((ahc->features & AHC_MULTI_TID) != 0) {
- u_int16_t targid_mask;
+ u_int targid_mask;
targid_mask = ahc_inb(ahc, TARGID)
| (ahc_inb(ahc, TARGID + 1) << 8);
@@ -1909,6 +1920,8 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
targid_mask |= target_mask;
ahc_outb(ahc, TARGID, targid_mask);
ahc_outb(ahc, TARGID+1, (targid_mask >> 8));
+
+ ahc_update_scsiid(ahc, targid_mask);
} else {
int our_id;
char channel;
@@ -1964,6 +1977,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
printf("Lun now enabled for target mode\n");
} else {
struct ccb_hdr *elm;
+ int i, empty;
if (lstate == NULL) {
ccb->ccb_h.status = CAM_LUN_INVALID;
@@ -1992,70 +2006,108 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
ccb->ccb_h.status = CAM_REQ_INVALID;
}
- if (ccb->ccb_h.status == CAM_REQ_CMP) {
- int i, empty;
+ if (ccb->ccb_h.status != CAM_REQ_CMP) {
+ splx(s);
+ return;
+ }
- xpt_print_path(ccb->ccb_h.path);
- printf("Target mode disabled\n");
- xpt_free_path(lstate->path);
- free(lstate, M_DEVBUF);
+ xpt_print_path(ccb->ccb_h.path);
+ printf("Target mode disabled\n");
+ xpt_free_path(lstate->path);
+ free(lstate, M_DEVBUF);
- pause_sequencer(ahc);
- /* Can we clean up the target too? */
- if (target != CAM_TARGET_WILDCARD) {
- tstate->enabled_luns[lun] = NULL;
- ahc->enabled_luns--;
- for (empty = 1, i = 0; i < 8; i++)
- if (tstate->enabled_luns[i] != NULL) {
- empty = 0;
- break;
- }
+ pause_sequencer(ahc);
+ /* Can we clean up the target too? */
+ if (target != CAM_TARGET_WILDCARD) {
+ tstate->enabled_luns[lun] = NULL;
+ ahc->enabled_luns--;
+ for (empty = 1, i = 0; i < 8; i++)
+ if (tstate->enabled_luns[i] != NULL) {
+ empty = 0;
+ break;
+ }
- if (empty) {
- ahc_free_tstate(ahc, target, channel,
- /*force*/FALSE);
- if (ahc->features & AHC_MULTI_TID) {
- u_int16_t targid_mask;
+ if (empty) {
+ ahc_free_tstate(ahc, target, channel,
+ /*force*/FALSE);
+ if (ahc->features & AHC_MULTI_TID) {
+ u_int targid_mask;
- targid_mask =
- ahc_inb(ahc, TARGID)
+ targid_mask = ahc_inb(ahc, TARGID)
| (ahc_inb(ahc, TARGID + 1)
<< 8);
- targid_mask &= ~target_mask;
- ahc_outb(ahc, TARGID,
- targid_mask);
- ahc_outb(ahc, TARGID+1,
- (targid_mask >> 8));
- }
+ targid_mask &= ~target_mask;
+ ahc_outb(ahc, TARGID, targid_mask);
+ ahc_outb(ahc, TARGID+1,
+ (targid_mask >> 8));
+ ahc_update_scsiid(ahc, targid_mask);
}
- } else {
+ }
+ } else {
- ahc->black_hole = NULL;
+ ahc->black_hole = NULL;
- /*
- * We can't allow selections without
- * our black hole device.
- */
- empty = TRUE;
- }
- if (ahc->enabled_luns == 0) {
- /* Disallow select-in */
- u_int scsiseq;
+ /*
+ * We can't allow selections without
+ * our black hole device.
+ */
+ empty = TRUE;
+ }
+ if (ahc->enabled_luns == 0) {
+ /* Disallow select-in */
+ u_int scsiseq;
- scsiseq = ahc_inb(ahc, SCSISEQ_TEMPLATE);
- scsiseq &= ~ENSELI;
- ahc_outb(ahc, SCSISEQ_TEMPLATE, scsiseq);
- scsiseq = ahc_inb(ahc, SCSISEQ);
- scsiseq &= ~ENSELI;
- ahc_outb(ahc, SCSISEQ, scsiseq);
- }
- unpause_sequencer(ahc);
+ scsiseq = ahc_inb(ahc, SCSISEQ_TEMPLATE);
+ scsiseq &= ~ENSELI;
+ ahc_outb(ahc, SCSISEQ_TEMPLATE, scsiseq);
+ scsiseq = ahc_inb(ahc, SCSISEQ);
+ scsiseq &= ~ENSELI;
+ ahc_outb(ahc, SCSISEQ, scsiseq);
}
+ unpause_sequencer(ahc);
splx(s);
}
}
+static void
+ahc_update_scsiid(struct ahc_softc *ahc, u_int targid_mask)
+{
+ u_int scsiid_mask;
+ u_int scsiid;
+
+ if ((ahc->features & AHC_MULTI_TID) == 0)
+ panic("ahc_update_scsiid called on non-multitid unit\n");
+
+ /*
+ * Since we will rely on the the TARGID mask
+ * for selection enables, ensure that OID
+ * in SCSIID is not set to some other ID
+ * that we don't want to allow selections on.
+ */
+ if ((ahc->features & AHC_ULTRA2) != 0)
+ scsiid = ahc_inb(ahc, SCSIID_ULTRA2);
+ else
+ scsiid = ahc_inb(ahc, SCSIID);
+ scsiid_mask = 0x1 << (scsiid & OID);
+ if ((targid_mask & scsiid_mask) == 0) {
+ u_int our_id;
+
+ /* ffs counts from 1 */
+ our_id = ffs(targid_mask);
+ if (our_id == 0)
+ our_id = ahc->our_id;
+ else
+ our_id--;
+ scsiid &= TID;
+ scsiid |= our_id;
+ }
+ if ((ahc->features & AHC_ULTRA2) != 0)
+ ahc_outb(ahc, SCSIID_ULTRA2, scsiid);
+ else
+ ahc_outb(ahc, SCSIID, scsiid);
+}
+
static int
ahc_handle_target_cmd(struct ahc_softc *ahc, struct target_cmd *cmd)
{
@@ -2080,23 +2132,23 @@ ahc_handle_target_cmd(struct ahc_softc *ahc, struct target_cmd *cmd)
/*
* Commands for disabled luns go to the black hole driver.
*/
- if (lstate == NULL) {
+ if (lstate == NULL)
lstate = ahc->black_hole;
- atio =
- (struct ccb_accept_tio*)SLIST_FIRST(&lstate->accept_tios);
- } else {
- atio =
- (struct ccb_accept_tio*)SLIST_FIRST(&lstate->accept_tios);
- }
+
+ atio = (struct ccb_accept_tio*)SLIST_FIRST(&lstate->accept_tios);
if (atio == NULL) {
ahc->flags |= AHC_TQINFIFO_BLOCKED;
- printf("No ATIOs for incoming command\n");
/*
* Wait for more ATIOs from the peripheral driver for this lun.
*/
return (1);
} else
ahc->flags &= ~AHC_TQINFIFO_BLOCKED;
+#if 0
+ printf("Incoming command from %d for %d:%d%s\n",
+ initiator, target, lun,
+ lstate == ahc->black_hole ? "(Black Holed)" : "");
+#endif
SLIST_REMOVE_HEAD(&lstate->accept_tios, sim_links.sle);
if (lstate == ahc->black_hole) {
@@ -2109,6 +2161,7 @@ ahc_handle_target_cmd(struct ahc_softc *ahc, struct target_cmd *cmd)
* Package it up and send it off to
* whomever has this lun enabled.
*/
+ atio->sense_len = 0;
atio->init_id = initiator;
if (byte[0] != 0xFF) {
/* Tag was included */
@@ -4122,6 +4175,11 @@ ahc_init(struct ahc_softc *ahc)
for (i = 0; i < 256; i++)
ahc->qoutfifo[i] = SCB_LIST_NULL;
+ if ((ahc->features & AHC_MULTI_TID) != 0) {
+ ahc_outb(ahc, TARGID, 0);
+ ahc_outb(ahc, TARGID + 1, 0);
+ }
+
if ((ahc->flags & AHC_TARGETMODE) != 0) {
ahc->targetcmds = (struct target_cmd *)&ahc->untagged_scbs[256];
@@ -4130,8 +4188,9 @@ ahc_init(struct ahc_softc *ahc)
/* All target command blocks start out invalid. */
for (i = 0; i < AHC_TMODE_CMDS; i++)
ahc->targetcmds[i].cmd_valid = 0;
+ ahc->tqinfifonext = 1;
ahc_outb(ahc, KERNEL_TQINPOS, ahc->tqinfifonext - 1);
- ahc_outb(ahc, TQINPOS, 0);
+ ahc_outb(ahc, TQINPOS, ahc->tqinfifonext);
}
/*
@@ -4374,14 +4433,6 @@ ahc_init(struct ahc_softc *ahc)
ahc_outb(ahc, QINPOS, 0);
ahc_outb(ahc, QOUTPOS, 0);
-#ifdef AHC_DEBUG
- if (ahc_debug & AHC_SHOWMISC)
- printf("NEEDSDTR == 0x%x\nNEEDWDTR == 0x%x\n"
- "DISCENABLE == 0x%x\nULTRAENB == 0x%x\n",
- ahc->needsdtr_orig, ahc->needwdtr_orig,
- discenable, ultraenb);
-#endif
-
/* Don't have any special messages to send to targets */
ahc_outb(ahc, TARGET_MSG_REQUEST, 0);
ahc_outb(ahc, TARGET_MSG_REQUEST + 1, 0);
@@ -5117,9 +5168,13 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments,
scb->flags |= SCB_ACTIVE;
ccb->ccb_h.status |= CAM_SIM_QUEUED;
- ccb->ccb_h.timeout_ch =
- timeout(ahc_timeout, (caddr_t)scb,
- (ccb->ccb_h.timeout * hz) / 1000);
+ if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
+ if (ccb->ccb_h.timeout == CAM_TIME_DEFAULT)
+ ccb->ccb_h.timeout = 5 * 1000;
+ ccb->ccb_h.timeout_ch =
+ timeout(ahc_timeout, (caddr_t)scb,
+ (ccb->ccb_h.timeout * hz) / 1000);
+ }
if ((scb->flags & SCB_TARGET_IMMEDIATE) != 0) {
#if 0
@@ -6328,7 +6383,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
/*
* Since we are going to restart the sequencer, avoid
* a race in the sequencer that could cause corruption
- * of our Q pointers by starting over from index 0.
+ * of our Q pointers by starting over from index 1.
*/
ahc->qoutfifonext = 0;
if ((ahc->features & AHC_QUEUE_REGS) != 0)
@@ -6336,9 +6391,16 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
else
ahc_outb(ahc, QOUTPOS, 0);
if ((ahc->flags & AHC_TARGETMODE) != 0) {
- ahc->tqinfifonext = 0;
+ ahc->tqinfifonext = 1;
ahc_outb(ahc, KERNEL_TQINPOS, ahc->tqinfifonext - 1);
- ahc_outb(ahc, TQINPOS, 0);
+ ahc_outb(ahc, TQINPOS, ahc->tqinfifonext);
+ if ((ahc->features & AHC_HS_MAILBOX) != 0) {
+ u_int hs_mailbox;
+
+ hs_mailbox = ahc_inb(ahc, HS_MAILBOX);
+ hs_mailbox &= ~HOST_TQINPOS;
+ ahc_outb(ahc, HS_MAILBOX, hs_mailbox);
+ }
}
restart_needed = TRUE;
}
@@ -6515,6 +6577,13 @@ ahc_calc_residual(struct scb *scb)
scb->ccb->csio.sense_resid = resid;
}
+
+#ifdef AHC_DEBUG
+ if (ahc_debug & AHC_SHOWMISC) {
+ xpt_print_path(scb->ccb->ccb_h.path);
+ printf("Handled Residual of %d bytes\n", resid);
+ }
+#endif
}
/*
@@ -6522,13 +6591,6 @@ ahc_calc_residual(struct scb *scb)
* next consumer.
*/
hscb->residual_SG_count = 0;
-
-#ifdef AHC_DEBUG
- if (ahc_debug & AHC_SHOWMISC) {
- sc_print_addr(xs->sc_link);
- printf("Handled Residual of %ld bytes\n" ,xs->resid);
- }
-#endif
}
static void
diff --git a/sys/dev/aic7xxx/aic7xxx.reg b/sys/dev/aic7xxx/aic7xxx.reg
index d190a9ff49a6..78c95a85a117 100644
--- a/sys/dev/aic7xxx/aic7xxx.reg
+++ b/sys/dev/aic7xxx/aic7xxx.reg
@@ -704,6 +704,8 @@ register HS_MAILBOX {
address 0x086
mask HOST_MAILBOX 0xF0
mask SEQ_MAILBOX 0x0F
+ mask HOST_REQ_INT 0x10
+ mask HOST_TQINPOS 0x80 /* Boundary at either 0 or 128 */
}
const HOST_MAILBOX_SHIFT 4
@@ -1465,8 +1467,6 @@ const HOST_MSG 0xff
const CMD_GROUP_CODE_SHIFT 0x05
const TCL_TARGET_SHIFT 4
-/* The update interval must be a power of 2 */
-const TQINFIFO_UPDATE_CNT 32
const STATUS_BUSY 0x08
const STATUS_QUEUE_FULL 0x28
diff --git a/sys/dev/aic7xxx/aic7xxx.seq b/sys/dev/aic7xxx/aic7xxx.seq
index 91ad793e5b8c..187b22eae925 100644
--- a/sys/dev/aic7xxx/aic7xxx.seq
+++ b/sys/dev/aic7xxx/aic7xxx.seq
@@ -75,7 +75,7 @@ poll_for_work_loop:
and SEQCTL, ~PAUSEDIS;
}
test SSTAT0, SELDO|SELDI jnz selection;
- test SCSISEQ, ENSELO jnz poll_for_work;
+ test SCSISEQ, ENSELO jnz poll_for_work_loop;
if ((ahc->features & AHC_TWIN) != 0) {
/*
* Twin channel devices cannot handle things like SELTO
@@ -356,7 +356,11 @@ host_target_message_loop:
ident_messages_done:
/* If ring buffer is full, return busy or queue full */
- mov A, KERNEL_TQINPOS;
+ if ((ahc->features & AHC_HS_MAILBOX) != 0) {
+ and A, HOST_TQINPOS, HS_MAILBOX;
+ } else {
+ mov A, KERNEL_TQINPOS;
+ }
cmp TQINPOS, A jne tqinfifo_has_space;
mvi P_STATUS|BSYO call change_phase;
cmp INITIATOR_TAG, SCB_LIST_NULL je . + 3;
@@ -424,7 +428,7 @@ initiator_reselect:
*/
select_out:
/* Turn off the selection hardware */
- and SCSISEQ, ENSELI|ENRSELI|ENAUTOATNP, SCSISEQ_TEMPLATE;
+ and SCSISEQ, TEMODE|ENSELI|ENRSELI|ENAUTOATNP, SCSISEQ;
mvi CLRSINT0, CLRSELDO;
mov SCBPTR, WAITING_SCBH;
mov WAITING_SCBH,SCB_NEXT;
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 63ace7c6a8c0..fe87b766abf4 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -1188,13 +1188,7 @@ ata_start(struct ata_softc *scp)
}
#endif
#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0
- /*
- * find & call the responsible driver if anything on the ATAPI queue.
- * check for device busy by polling the DSC bit, if busy, check
- * for requests to the other device on the channel (if any).
- * if the other device is an ATA disk it already had its chance above.
- * if no request can be served, timeout a call to ata_start.
- */
+ /* find & call the responsible driver if anything on the ATAPI queue */
if (TAILQ_EMPTY(&scp->atapi_queue)) {
if (scp->devices & (ATA_ATAPI_MASTER) && scp->dev_softc[0])
atapi_start((struct atapi_softc *)scp->dev_softc[0]);
@@ -1202,33 +1196,6 @@ ata_start(struct ata_softc *scp)
atapi_start((struct atapi_softc *)scp->dev_softc[1]);
}
if ((atapi_request = TAILQ_FIRST(&scp->atapi_queue))) {
- struct atapi_softc *atp = atapi_request->device;
- static int32_t interval = 1;
-
- if (atp->flags & ATAPI_F_DSC_USED) {
- outb(atp->controller->ioaddr + ATA_DRIVE, ATA_D_IBM | atp->unit);
- DELAY(1);
- if (!(inb(atp->controller->ioaddr + ATA_STATUS) & ATA_S_DSC)) {
- while ((atapi_request = TAILQ_NEXT(atapi_request, chain))) {
- if (atapi_request->device->unit != atp->unit) {
- struct atapi_softc *tmp = atapi_request->device;
-
- outb(tmp->controller->ioaddr + ATA_DRIVE,
- ATA_D_IBM | tmp->unit);
- DELAY(1);
- if (!inb(tmp->controller->ioaddr+ATA_STATUS)&ATA_S_DSC)
- atapi_request = NULL;
- break;
- }
- }
- }
- if (!atapi_request) {
- timeout((timeout_t *)ata_start, atp->controller, interval++);
- return;
- }
- else
- interval = 1;
- }
TAILQ_REMOVE(&scp->atapi_queue, atapi_request, chain);
scp->active = ATA_ACTIVE_ATAPI;
scp->running = atapi_request;
diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c
index 56103cf77d39..075081d7844f 100644
--- a/sys/dev/ata/atapi-all.c
+++ b/sys/dev/ata/atapi-all.c
@@ -237,13 +237,6 @@ atapi_transfer(struct atapi_request *request)
if (request->ccb[0] != ATAPI_REQUEST_SENSE)
atp->cmd = request->ccb[0];
- /* flag if we can trust the DSC bit */
- if (request->ccb[0] == ATAPI_READ || request->ccb[0] == ATAPI_READ_BIG ||
- request->ccb[0] == ATAPI_WRITE || request->ccb[0] == ATAPI_WRITE_BIG)
- atp->flags |= ATAPI_F_DSC_USED;
- else
- atp->flags &= ~ATAPI_F_DSC_USED;
-
/* if DMA enabled setup DMA hardware */
request->flags &= ~ATPR_F_DMA_USED;
if ((atp->controller->mode[ATA_DEV(atp->unit)] >= ATA_DMA) &&
diff --git a/sys/dev/ata/atapi-all.h b/sys/dev/ata/atapi-all.h
index 6e5bc5a7a9d5..b3e50916914f 100644
--- a/sys/dev/ata/atapi-all.h
+++ b/sys/dev/ata/atapi-all.h
@@ -148,8 +148,7 @@ struct atapi_softc {
int8_t *devname; /* this devices name */
int8_t cmd; /* last cmd executed */
u_int32_t flags; /* drive flags */
-#define ATAPI_F_DSC_USED 0x0001
-#define ATAPI_F_MEDIA_CHANGED 0x0002
+#define ATAPI_F_MEDIA_CHANGED 0x0001
};
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index 53b546e4f26b..ff7d77509e6d 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.c
@@ -466,16 +466,10 @@ ast_start(struct atapi_softc *atp)
bzero(ccb, sizeof(ccb));
- if (bp->b_flags & B_READ) {
+ if (bp->b_flags & B_READ)
ccb[0] = ATAPI_READ;
- if (!(stp->flags & ATAPI_F_DSC_USED))
- atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 2*60, NULL, NULL);
- }
- else {
+ else
ccb[0] = ATAPI_WRITE;
- if (!(stp->flags & ATAPI_F_DSC_USED))
- atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 2*60, NULL, NULL);
- }
bufq_remove(&stp->buf_queue, bp);
blkcount = bp->b_bcount / stp->blksize;
diff --git a/sys/dev/ic/hd64570.h b/sys/dev/ic/hd64570.h
deleted file mode 100644
index b676e25a9cd5..000000000000
--- a/sys/dev/ic/hd64570.h
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by [your name]
- * and [any other names deserving credit ]
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY [your name] AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _HD64570_H_
-#define _HD64570_H_
-
-typedef struct msci_channel
- {
- union
- {
- unsigned short us_trb; /* rw */
- struct
- {
- unsigned char uc_trbl;
- unsigned char uc_trbh;
- }uc_trb;
- }u_trb;
- unsigned char st0; /* ro */
- unsigned char st1; /* rw */
- unsigned char st2; /* rw */
- unsigned char st3; /* ro */
- unsigned char fst; /* rw */
- unsigned char unused0;
- unsigned char ie0; /* rw */
- unsigned char ie1; /* rw */
- unsigned char ie2; /* rw */
- unsigned char fie; /* rw */
- unsigned char cmd; /* wo */
- unsigned char unused1;
- unsigned char md0; /* rw */
- unsigned char md1; /* rw */
- unsigned char md2; /* rw */
- unsigned char ctl; /* rw */
- unsigned char sa0; /* rw */
- unsigned char sa1; /* rw */
- unsigned char idl; /* rw */
- unsigned char tmc; /* rw */
- unsigned char rxs; /* rw */
- unsigned char txs; /* rw */
- unsigned char trc0; /* rw */
- unsigned char trc1; /* rw */
- unsigned char rrc; /* rw */
- unsigned char unused2;
- unsigned char cst0; /* rw */
- unsigned char cst1; /* rw */
- unsigned char unused3[2];
- }msci_channel;
-
-#define trb u_trb.us_trb
-#define trbl u_trb.uc_trb.uc_trbl
-#define trbh u_trb.uc_trb.uc_trbh
-
-typedef struct timer_channel
- {
- unsigned short tcnt; /* rw */
- unsigned short tconr; /* wo */
- unsigned char tcsr; /* rw */
- unsigned char tepr; /* rw */
- unsigned char unused[2];
- }timer_channel;
-
-typedef struct dmac_channel
- {
- unsigned short dar; /* rw */
- unsigned char darb; /* rw */
- unsigned char unused0;
- unsigned short sar; /* rw On odd numbered dmacs (tx) only */
- unsigned char sarb; /* rw */
-#define cpb sarb
- unsigned char unused1;
- unsigned short cda; /* rw */
- unsigned short eda; /* rw */
- unsigned short bfl; /* rw On even numbered dmacs (rx) only */
- unsigned short bcr; /* rw */
- unsigned char dsr; /* rw */
- unsigned char dmr; /* rw */
- unsigned char unused2;
- unsigned char fct; /* rw */
- unsigned char dir; /* rw */
- unsigned char dcr; /* rw */
- unsigned char unused3[10];
- }dmac_channel;
-
-/* x is the channel number. rx channels are even numbered and tx, odd. */
-#define DMAC_RXCH(x) ((x*2) + 0)
-#define DMAC_TXCH(x) ((x*2) + 1)
-
-typedef struct sca_regs
- {
- unsigned char lpr; /* rw */
- unsigned char unused0; /* -- */
- /* Wait system */
- unsigned char pabr0; /* rw */
- unsigned char pabr1; /* rw */
- unsigned char wcrl; /* rw */
- unsigned char wcrm; /* rw */
- unsigned char wcrh; /* rw */
- unsigned char unused1;
- /* DMAC */
- unsigned char pcr; /* rw */
- unsigned char dmer; /* rw */
- unsigned char unused2[6];
- /* Interrupt */
- unsigned char isr0; /* ro */
- unsigned char isr1; /* ro */
- unsigned char isr2; /* ro */
- unsigned char unused3;
- unsigned char ier0; /* rw */
- unsigned char ier1; /* rw */
- unsigned char ier2; /* rw */
- unsigned char unused4;
- unsigned char itcr; /* rw */
- unsigned char unused5;
- unsigned char ivr; /* rw */
- unsigned char unused6;
- unsigned char imvr; /* rw */
- unsigned char unused7[3];
- /* MSCI Channel 0 */
- msci_channel msci[2];
- timer_channel timer[4];
- dmac_channel dmac[4];
- }sca_regs;
-
-#define SCA_CMD_TXRESET 0x01
-#define SCA_CMD_TXENABLE 0x02
-#define SCA_CMD_TXDISABLE 0x03
-#define SCA_CMD_TXCRCINIT 0x04
-#define SCA_CMD_TXCRCEXCL 0x05
-#define SCA_CMS_TXEOM 0x06
-#define SCA_CMD_TXABORT 0x07
-#define SCA_CMD_MPON 0x08
-#define SCA_CMD_TXBCLEAR 0x09
-
-#define SCA_CMD_RXRESET 0x11
-#define SCA_CMD_RXENABLE 0x12
-#define SCA_CMD_RXDISABLE 0x13
-#define SCA_CMD_RXCRCINIT 0x14
-#define SCA_CMD_RXMSGREJ 0x15
-#define SCA_CMD_MPSEARCH 0x16
-#define SCA_CMD_RXCRCEXCL 0x17
-#define SCA_CMD_RXCRCCALC 0x18
-
-#define SCA_CMD_NOP 0x00
-#define SCA_CMD_RESET 0x21
-#define SCA_CMD_SEARCH 0x31
-
-#define SCA_MD0_CRC_1 0x01
-#define SCA_MD0_CRC_CCITT 0x02
-#define SCA_MD0_CRC_ENABLE 0x04
-#define SCA_MD0_AUTO_ENABLE 0x10
-#define SCA_MD0_MODE_ASYNC 0x00
-#define SCA_MD0_MODE_BYTESYNC1 0x20
-#define SCA_MD0_MODE_BISYNC 0x40
-#define SCA_MD0_MODE_BYTESYNC2 0x60
-#define SCA_MD0_MODE_HDLC 0x80
-
-#define SCA_MD1_NOADDRCHK 0x00
-#define SCA_MD1_SNGLADDR1 0x40
-#define SCA_MD1_SNGLADDR2 0x80
-#define SCA_MD1_DUALADDR 0xC0
-
-#define SCA_MD2_DUPLEX 0x00
-#define SCA_MD2_ECHO 0x01
-#define SCA_MD2_LOOPBACK 0x03
-#define SCA_MD2_ADPLLx8 0x00
-#define SCA_MD2_ADPLLx16 0x08
-#define SCA_MD2_ADPLLx32 0x10
-#define SCA_MD2_NRZ 0x00
-#define SCA_MD2_NRZI 0x20
-#define SCA_MD2_MANCHESTER 0x80
-#define SCA_MD2_FM0 0xC0
-#define SCA_MD2_FM1 0xA0
-
-#define SCA_CTL_RTS 0x01
-#define SCA_CTL_IDLPAT 0x10
-#define SCA_CTL_UDRNC 0x20
-
-#define SCA_RXS_DIV_MASK 0x0F
-#define SCA_RXS_DIV1 0x00
-#define SCA_RXS_DIV2 0x01
-#define SCA_RXS_DIV4 0x02
-#define SCA_RXS_DIV8 0x03
-#define SCA_RXS_DIV16 0x04
-#define SCA_RXS_DIV32 0x05
-#define SCA_RXS_DIV64 0x06
-#define SCA_RXS_DIV128 0x07
-#define SCA_RXS_DIV256 0x08
-#define SCA_RXS_DIV512 0x09
-#define SCA_RXS_CLK_RXC0 0x00
-#define SCA_RXS_CLK_RXC1 0x20
-#define SCA_RXS_CLK_INT 0x40
-#define SCA_RXS_CLK_ADPLL_OUT 0x60
-#define SCA_RXS_CLK_ADPLL_IN 0x70
-
-#define SCA_TXS_DIV_MASK 0x0F
-#define SCA_TXS_DIV1 0x00
-#define SCA_TXS_DIV2 0x01
-#define SCA_TXS_DIV4 0x02
-#define SCA_TXS_DIV8 0x03
-#define SCA_TXS_DIV16 0x04
-#define SCA_TXS_DIV32 0x05
-#define SCA_TXS_DIV64 0x06
-#define SCA_TXS_DIV128 0x07
-#define SCA_TXS_DIV256 0x08
-#define SCA_TXS_DIV512 0x09
-#define SCA_TXS_CLK_TXC 0x00
-#define SCA_TXS_CLK_INT 0x40
-#define SCA_TXS_CLK_RX 0x60
-
-#define SCA_ST0_RXRDY 0x01
-#define SCA_ST0_TXRDY 0x02
-#define SCA_ST0_RXINT 0x40
-#define SCA_ST0_TXINT 0x80
-
-#define SCA_ST1_IDLST 0x01
-#define SCA_ST1_ABTST 0x02
-#define SCA_ST1_DCDCHG 0x04
-#define SCA_ST1_CTSCHG 0x08
-#define SCA_ST1_FLAG 0x10
-#define SCA_ST1_TXIDL 0x40
-#define SCA_ST1_UDRN 0x80
-
-/* ST2 and FST look the same */
-#define SCA_FST_CRCERR 0x04
-#define SCA_FST_OVRN 0x08
-#define SCA_FST_RESFRM 0x10
-#define SCA_FST_ABRT 0x20
-#define SCA_FST_SHRT 0x40
-#define SCA_FST_EOM 0x80
-
-#define SCA_ST3_RXENA 0x01
-#define SCA_ST3_TXENA 0x02
-#define SCA_ST3_DCD 0x04
-#define SCA_ST3_CTS 0x08
-#define SCA_ST3_ADPLLSRCH 0x10
-#define SCA_ST3_TXDATA 0x20
-
-#define SCA_FIE_EOMFE 0x80
-
-#define SCA_IE0_RXRDY 0x01
-#define SCA_IE0_TXRDY 0x02
-#define SCA_IE0_RXINT 0x40
-#define SCA_IE0_TXINT 0x80
-
-#define SCA_IE1_IDLDE 0x01
-#define SCA_IE1_ABTDE 0x02
-#define SCA_IE1_DCD 0x04
-#define SCA_IE1_CTS 0x08
-#define SCA_IE1_FLAG 0x10
-#define SCA_IE1_IDL 0x40
-#define SCA_IE1_UDRN 0x80
-
-#define SCA_IE2_CRCERR 0x04
-#define SCA_IE2_OVRN 0x08
-#define SCA_IE2_RESFRM 0x10
-#define SCA_IE2_ABRT 0x20
-#define SCA_IE2_SHRT 0x40
-#define SCA_IE2_EOM 0x80
-
-/* This is for RRC, TRC0 and TRC1. */
-#define SCA_RCR_MASK 0x1F
-
-#define SCA_IE1_
-
-#define SCA_IV_CHAN0 0x00
-#define SCA_IV_CHAN1 0x20
-
-#define SCA_IV_RXRDY 0x04
-#define SCA_IV_TXRDY 0x06
-#define SCA_IV_RXINT 0x08
-#define SCA_IV_TXINT 0x0A
-
-#define SCA_IV_DMACH0 0x00
-#define SCA_IV_DMACH1 0x08
-#define SCA_IV_DMACH2 0x20
-#define SCA_IV_DMACH3 0x28
-
-#define SCA_IV_DMIA 0x14
-#define SCA_IV_DMIB 0x16
-
-#define SCA_IV_TIMER0 0x1C
-#define SCA_IV_TIMER1 0x1E
-#define SCA_IV_TIMER2 0x3C
-#define SCA_IV_TIMER3 0x3E
-
-/*
- * DMA registers
- */
-#define SCA_DSR_EOT 0x80
-#define SCA_DSR_EOM 0x40
-#define SCA_DSR_BOF 0x20
-#define SCA_DSR_COF 0x10
-#define SCA_DSR_DE 0x02
-#define SCA_DSR_DWE 0x01
-
-#define SCA_DMR_TMOD 0x10
-#define SCA_DMR_NF 0x04
-#define SCA_DMR_CNTE 0x02
-
-#define SCA_DMER_EN 0x80
-
-#define SCA_DCR_ABRT 0x01
-#define SCA_DCR_FCCLR 0x02 /* Clear frame end intr counter */
-
-#define SCA_DIR_EOT 0x80
-#define SCA_DIR_EOM 0x40
-#define SCA_DIR_BOF 0x20
-#define SCA_DIR_COF 0x10
-
-#define SCA_PCR_BRC 0x10
-#define SCA_PCR_CCC 0x08
-#define SCA_PCR_PR2 0x04
-#define SCA_PCR_PR1 0x02
-#define SCA_PCR_PR0 0x01
-
-typedef struct sca_descriptor
- {
- unsigned short cp;
- unsigned short bp;
- unsigned char bpb;
- unsigned char unused0;
- unsigned short len;
- unsigned char stat;
- unsigned char unused1;
- }sca_descriptor;
-
-#define SCA_DESC_EOT 0x01
-#define SCA_DESC_CRC 0x04
-#define SCA_DESC_OVRN 0x08
-#define SCA_DESC_RESD 0x10
-#define SCA_DESC_ABORT 0x20
-#define SCA_DESC_SHRTFRM 0x40
-#define SCA_DESC_EOM 0x80
-#define SCA_DESC_ERRORS 0x7C
-
-/*
-***************************************************************************
-** END
-***************************************************************************
-**/
-#endif /* _HD64570_H_ */
-
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index f7319e6bb7e7..ac6a4b77fb05 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -1651,7 +1651,10 @@ printf("notify ack\n");
sdparam *sdp = isp->isp_param;
sdp += cam_sim_bus(xpt_path_sim(cpi->ccb_h.path));
cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
- cpi->hba_misc = 0;
+ if (IS_ULTRA2(isp))
+ cpi->hba_misc = PIM_NOBUSRESET;
+ else
+ cpi->hba_misc = 0;
cpi->initiator_id = sdp->isp_initiator_id;
cpi->base_transfer_speed = 3300;
}
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 6355dd0e5990..e4433be4a602 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -297,8 +297,14 @@ int
soabort(so)
struct socket *so;
{
+ int error;
- return (*so->so_proto->pr_usrreqs->pru_abort)(so);
+ error = (*so->so_proto->pr_usrreqs->pru_abort)(so);
+ if (error) {
+ sofree(so);
+ return error;
+ }
+ return (0);
}
int
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 7d61a1864a23..a528d8783769 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -328,40 +328,31 @@ vfs_getvfs(fsid)
}
/*
- * Get a new unique fsid. Try to make its val[0] unique mod 2^16, since
- * this value may be used to create fake device numbers for stat(), and
- * some emulators only support 16-bit device numbers.
+ * Get a new unique fsid. Try to make its val[0] unique, since this value
+ * will be used to create fake device numbers for stat(). Also try (but
+ * not so hard) make its val[0] unique mod 2^16, since some emulators only
+ * support 16-bit device numbers. We end up with unique val[0]'s for the
+ * first 2^16 calls and unique val[0]'s mod 2^16 for the first 2^8 calls.
*
* Keep in mind that several mounts may be running in parallel. Starting
- * the search one past where the previous search terminated (mod 0x10) is
- * both a micro-optimization and (incomplete) defense against returning
- * the same fsid to different mounts.
+ * the search one past where the previous search terminated is both a
+ * micro-optimization and a defense against returning the same fsid to
+ * different mounts.
*/
void
vfs_getnewfsid(mp)
struct mount *mp;
{
- static u_int mntid_base;
+ static u_int16_t mntid_base;
fsid_t tfsid;
- u_int i;
- int mtype, mynor;
+ int mtype;
simple_lock(&mntid_slock);
mtype = mp->mnt_vfc->vfc_typenum;
tfsid.val[1] = mtype;
- for (i = 0; ; i++) {
- /*
- * mtype needs to be uniquely encoded in the minor number
- * so that uniqueness of the full fsid implies uniqueness
- * of the device number. We are short of bits and only
- * guarantee uniqueness of the device number mod 2^16 if
- * mtype is always < 16 and there are never more than
- * 16 mounts per vfs type.
- */
- mynor = ((mntid_base++ & 0xFFFFF) << 4) | (mtype & 0xF);
- if (i < 0x10)
- mynor &= 0xFF;
- tfsid.val[0] = makeudev(255, mynor);
+ mtype = (mtype & 0xFF) << 16;
+ for (;;) {
+ tfsid.val[0] = makeudev(255, mtype | mntid_base++);
if (vfs_getvfs(&tfsid) == NULL)
break;
}
@@ -1119,7 +1110,6 @@ pbrelvp(bp)
KASSERT(bp->b_vp != NULL, ("pbrelvp: NULL"));
-#if !defined(MAX_PERF)
/* XXX REMOVE ME */
if (bp->b_vnbufs.tqe_next != NULL) {
panic(
@@ -1128,7 +1118,6 @@ pbrelvp(bp)
(int)bp->b_flags
);
}
-#endif
bp->b_vp = (struct vnode *) 0;
bp->b_flags &= ~B_PAGING;
}
@@ -1138,14 +1127,12 @@ pbreassignbuf(bp, newvp)
struct buf *bp;
struct vnode *newvp;
{
-#if !defined(MAX_PERF)
if ((bp->b_flags & B_PAGING) == 0) {
panic(
"pbreassignbuf() on non phys bp %p",
bp
);
}
-#endif
bp->b_vp = newvp;
}
@@ -1169,14 +1156,12 @@ reassignbuf(bp, newvp)
}
++reassignbufcalls;
-#if !defined(MAX_PERF)
/*
* B_PAGING flagged buffers cannot be reassigned because their vp
* is not fully linked in.
*/
if (bp->b_flags & B_PAGING)
panic("cannot reassign paging buffer");
-#endif
s = splbio();
/*
@@ -2924,6 +2909,11 @@ vn_isdisk(vp, errp)
*errp = ENOTBLK;
return (0);
}
+ if (vp->v_rdev == NULL) {
+ if (errp != NULL)
+ *errp = ENXIO;
+ return (0);
+ }
if (!devsw(vp->v_rdev)) {
if (errp != NULL)
*errp = ENXIO;
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index d75013e4cd54..466227ce2986 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -359,6 +359,7 @@ bpfopen(dev, flags, fmt, p)
dev->si_drv1 = d;
d->bd_bufsize = bpf_bufsize;
d->bd_sig = SIGIO;
+ d->bd_seesent = 1;
return (0);
}
@@ -633,6 +634,8 @@ reset_d(d)
* BIOCVERSION Get filter language version.
* BIOCGHDRCMPLT Get "header already complete" flag
* BIOCSHDRCMPLT Set "header already complete" flag
+ * BIOCGSEESENT Get "see packets sent" flag
+ * BIOCSSEESENT Set "see packets sent" flag
*/
/* ARGSUSED */
static int
@@ -848,6 +851,20 @@ bpfioctl(dev, cmd, addr, flags, p)
d->bd_hdrcmplt = *(u_int *)addr ? 1 : 0;
break;
+ /*
+ * Get "see sent packets" flag
+ */
+ case BIOCGSEESENT:
+ *(u_int *)addr = d->bd_seesent;
+ break;
+
+ /*
+ * Set "see sent packets" flag
+ */
+ case BIOCSSEESENT:
+ d->bd_seesent = *(u_int *)addr;
+ break;
+
case FIONBIO: /* Non-blocking I/O */
break;
@@ -1103,6 +1120,8 @@ bpf_mtap(ifp, m)
pktlen += m0->m_len;
for (d = bp->bif_dlist; d != 0; d = d->bd_next) {
+ if (!d->bd_seesent && (m->m_pkthdr.rcvif == NULL))
+ continue;
++d->bd_rcount;
slen = bpf_filter(d->bd_filter, (u_char *)m, pktlen, 0);
if (slen != 0)
diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index a684314e6841..9494e8349f7e 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -113,6 +113,8 @@ struct bpf_version {
#define BIOCSRSIG _IOW('B',115, u_int)
#define BIOCGHDRCMPLT _IOR('B',116, u_int)
#define BIOCSHDRCMPLT _IOW('B',117, u_int)
+#define BIOCGSEESENT _IOR('B',118, u_int)
+#define BIOCSSEESENT _IOW('B',119, u_int)
/*
* Structure prepended to each packet.
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h
index 1e638f7ec9d6..de3dfb9058ee 100644
--- a/sys/net/bpfdesc.h
+++ b/sys/net/bpfdesc.h
@@ -77,6 +77,7 @@ struct bpf_d {
u_char bd_state; /* idle, waiting, or timed out */
u_char bd_immediate; /* true to return on packet arrival */
int bd_hdrcmplt; /* false to fill in src lladdr automatically */
+ int bd_seesent; /* true if bpf should see sent packets */
int bd_async; /* non-zero if packet reception should generate signal */
int bd_sig; /* signal to send upon packet reception */
struct sigio * bd_sigio; /* information for async I/O */
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index 5776bc5425a0..11e74f623feb 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -85,6 +85,7 @@
* ways.
*/
/* #define _POSIX_THREAD_SAFE_FUNCTIONS */
+#define _POSIX_SEMAPHORES
/* access function */
#define F_OK 0 /* test for existence of file */