svn commit: r224493 - head/sys/dev/mpt
Author: marius Date: Fri Jul 29 18:35:10 2011 New Revision: 224493 URL: http://svn.freebsd.org/changeset/base/224493 Log: - Staticize functions as appropriate and comment out unused ones. - Sprinkle some const where appropriate. - Consistently use target_id_t for the target parameter of mpt_map_physdisk() and mpt_is_raid_volume(). - Fix some whitespace bugs. Approved by: re (kib) Modified: head/sys/dev/mpt/mpt.c head/sys/dev/mpt/mpt.h head/sys/dev/mpt/mpt_cam.c head/sys/dev/mpt/mpt_debug.c head/sys/dev/mpt/mpt_pci.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/mpt/mpt_raid.h head/sys/dev/mpt/mpt_user.c Modified: head/sys/dev/mpt/mpt.c == --- head/sys/dev/mpt/mpt.c Fri Jul 29 10:51:56 2011(r224492) +++ head/sys/dev/mpt/mpt.c Fri Jul 29 18:35:10 2011(r224493) @@ -301,66 +301,75 @@ mpt_modevent(module_t mod, int type, voi return (error); } -int +static int mpt_stdload(struct mpt_personality *pers) { + /* Load is always successful. */ return (0); } -int +static int mpt_stdprobe(struct mpt_softc *mpt) { + /* Probe is always successful. */ return (0); } -int +static int mpt_stdattach(struct mpt_softc *mpt) { + /* Attach is always successful. */ return (0); } -int +static int mpt_stdenable(struct mpt_softc *mpt) { + /* Enable is always successful. */ return (0); } -void +static void mpt_stdready(struct mpt_softc *mpt) { -} +} -int +static int mpt_stdevent(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_stdevent: 0x%x\n", msg->Event & 0xFF); /* Event was not for us. */ return (0); } -void +static void mpt_stdreset(struct mpt_softc *mpt, int type) { + } -void +static void mpt_stdshutdown(struct mpt_softc *mpt) { + } -void +static void mpt_stddetach(struct mpt_softc *mpt) { + } -int +static int mpt_stdunload(struct mpt_personality *pers) { + /* Unload is always successful. */ return (0); } @@ -383,7 +392,6 @@ mpt_postattach(void *unused) } SYSINIT(mptdev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, mpt_postattach, NULL); - /*** Bus DMA Support **/ void mpt_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -478,6 +486,7 @@ static int mpt_default_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Default Handler Called: req=%p:%u reply_descriptor=%x frame=%p\n", req, req->serno, reply_desc, reply_frame); @@ -494,8 +503,8 @@ static int mpt_config_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { - if (req != NULL) { + if (req != NULL) { if (reply_frame != NULL) { MSG_CONFIG *cfgp; MSG_CONFIG_REPLY *reply; @@ -528,6 +537,7 @@ static int mpt_handshake_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + /* Nothing to be done. */ return (TRUE); } @@ -650,6 +660,7 @@ static int mpt_core_event(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_core_event: 0x%x\n", msg->Event & 0xFF); switch(msg->Event & 0xFF) { @@ -870,6 +881,7 @@ mpt_complete_request_chain(struct mpt_so void mpt_dump_reply_frame(struct mpt_softc *mpt, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Address Reply:\n"); mpt_print_reply(reply_frame); } @@ -881,12 +893,14 @@ static __inline uint32_t mpt_rd_intr(st static __inline uint32_t mpt_rd_db(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_DOORBELL); } static __inline uint32_t mpt_rd_intr(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_INTR_STATUS); } @@ -895,6 +909,7 @@ static int mpt_wait_db_ack(struct mpt_softc *mpt) { int i; + for (i=0; i < MPT_MAX_WAIT; i++) { if (!MPT_DB_IS_BUSY(mpt_rd_intr(mpt))) { maxwait_ack = i > maxwait_ack ? i : maxwait_ack; @@ -910,6 +925,7 @@ static int mpt_wait_db_int(struct mpt_softc *mpt) { int i; + for (i = 0; i < MPT_MAX_WAIT; i++) { if (MPT_DB_INTR(mpt_rd_intr(mpt))) { maxwait_int = i > maxwait_int ? i : maxwait_int; @@ -925,6 +941,7 @@ void mpt_check_doorbell(struct mpt_softc *mpt) { uint32_t db = mpt_rd_db(mpt); + if (MPT_STATE(db) != MPT_DB_STATE_RUNNING) { mpt_prt(mpt, "Device not running\n"); mpt_print_db(db); @@ -956,6 +973,7 @@ static int mpt_download_fw(struct mpt_so s
svn commit: r224494 - head/sys/dev/mpt
Author: marius Date: Fri Jul 29 18:38:31 2011 New Revision: 224494 URL: http://svn.freebsd.org/changeset/base/224494 Log: - Send the RELSIM_ADJUST_OPENINGS in response to a MPI_EVENT_QUEUE_FULL using the right SIM in case the HBA is RAID-capable but the target in question is not a hot spare or member of a RAID volume. - Report the loss and addition of SAS and SATA targets detected via PHY link status changes and signalled by MPI_EVENT_SAS_DEVICE_STATUS_CHANGE to cam(4) as lost devices and trigger rescans as appropriate. Without this it can take quite some time until a lost device actually is no longer tried to be used, if it ever stops. [1] - Handle MPI_EVENT_IR2, MPI_EVENT_LOG_ENTRY_ADDED, MPI_EVENT_SAS_DISCOVERY and MPI_EVENT_SAS_PHY_LINK_STATUS silently as these serve no additional purpose beyond adding cryptic entries to logs. Thanks to Hans-Joerg Sirtl for providing one of the HBAs these changes were developed with and RIP to the mainboard that didn't survive testing them. PR: 157534 [1] Approved by: re (kib) MFC after:2 weeks Modified: head/sys/dev/mpt/mpt_cam.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/mpt/mpt_raid.h Modified: head/sys/dev/mpt/mpt_cam.c == --- head/sys/dev/mpt/mpt_cam.c Fri Jul 29 18:35:10 2011(r224493) +++ head/sys/dev/mpt/mpt_cam.c Fri Jul 29 18:38:31 2011(r224494) @@ -2538,7 +2538,8 @@ mpt_cam_event(struct mpt_softc *mpt, req pqf->CurrentDepth = le16toh(pqf->CurrentDepth); mpt_prt(mpt, "QUEUE FULL EVENT: Bus 0x%02x Target 0x%02x Depth " "%d\n", pqf->Bus, pqf->TargetID, pqf->CurrentDepth); - if (mpt->phydisk_sim) { + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + pqf->TargetID) != 0) { sim = mpt->phydisk_sim; } else { sim = mpt->sim; @@ -2570,9 +2571,72 @@ mpt_cam_event(struct mpt_softc *mpt, req mpt_prt(mpt, "IR resync update %d completed\n", (data0 >> 16) & 0xff); break; + case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: + { + union ccb *ccb; + struct cam_sim *sim; + struct cam_path *tmppath; + PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE psdsc; + + psdsc = (PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE)msg->Data; + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + psdsc->TargetID) != 0) + sim = mpt->phydisk_sim; + else + sim = mpt->sim; + switch(psdsc->ReasonCode) { + case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: + MPTLOCK_2_CAMLOCK(mpt); + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + mpt_prt(mpt, + "unable to alloc CCB for rescan\n"); + CAMLOCK_2_MPTLOCK(mpt); + break; + } + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(sim), psdsc->TargetID, + CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + CAMLOCK_2_MPTLOCK(mpt); + mpt_prt(mpt, + "unable to create path for rescan\n"); + xpt_free_ccb(ccb); + break; + } + xpt_rescan(ccb); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: + MPTLOCK_2_CAMLOCK(mpt); + if (xpt_create_path(&tmppath, NULL, cam_sim_path(sim), + psdsc->TargetID, CAM_LUN_WILDCARD) != + CAM_REQ_CMP) { + mpt_prt(mpt, + "unable to create path for async event"); + CAMLOCK_2_MPTLOCK(mpt); + break; + } + xpt_async(AC_LOST_DEVICE, tmppath, NULL); + xpt_free_path(tmppath); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET: + break; + default: + mpt_lprt(mpt, MPT_PRT_WARN, + "SAS device status change: Bus: 0x%02x TargetID: " + "0x%02x ReasonCode: 0x%02x\n", psdsc->TargetID, + psdsc->Bus, psdsc->ReasonCode); + break
Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64
On 28.07.11 04:59, Attilio Rao wrote: I think that the following patch may better reflect the definition of size_t: http://www.freebsd.org/~attilio/sintrcnt-fixup32.diff Do you think you can test it out? PowerPC 32-bit built, booted and completed a buildworld. Thanks, Andreas ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64
2011/7/29 Andreas Tobler : > On 28.07.11 04:59, Attilio Rao wrote: >> >> I think that the following patch may better reflect the definition of >> size_t: >> http://www.freebsd.org/~attilio/sintrcnt-fixup32.diff >> >> Do you think you can test it out? > > PowerPC 32-bit built, booted and completed a buildworld. > Thanks a lot as usual. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r224495 - head/usr.sbin/mfiutil
Author: jhb Date: Fri Jul 29 20:24:04 2011 New Revision: 224495 URL: http://svn.freebsd.org/changeset/base/224495 Log: Properly initialize an error variable to avoid returning uninitialized data when 'show drives' succeeds, often resulting in a failing exit code even though the command worked fine. Reviewed by: bz Approved by: re (kib) MFC after:3 days Modified: head/usr.sbin/mfiutil/mfi_show.c Modified: head/usr.sbin/mfiutil/mfi_show.c == --- head/usr.sbin/mfiutil/mfi_show.cFri Jul 29 18:38:31 2011 (r224494) +++ head/usr.sbin/mfiutil/mfi_show.cFri Jul 29 20:24:04 2011 (r224495) @@ -533,6 +533,7 @@ show_drives(int ac, char **av) MFI_DNAME_ES)); printf("\n"); } + error = 0; error: free(list); close(fd); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r224496 - head/sys/cam
Author: mav Date: Fri Jul 29 20:30:28 2011 New Revision: 224496 URL: http://svn.freebsd.org/changeset/base/224496 Log: In some cases failed SATA disks may report their presence, but don't respond to any commands. I've found that because of multiple command retries, each of which cause 30s timeout, bus reset and another retry or requeue for many commands, it may take ages to eventually drop the failed device. The odd thing is that those retries continue even after XPT considered device as dead and invalidated it. This patch makes cam_periph_error() to block any command retries after periph was marked as invalid. With that patch all activity completes in 1-2 minutes, just after several timeouts, required to consider device death. This should make ZFS, gmirror, graid, etc. operation more robust. Reviewed by: mjacob@ on scsi@ Approved by: re (kib) Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c == --- head/sys/cam/cam_periph.c Fri Jul 29 20:24:04 2011(r224495) +++ head/sys/cam/cam_periph.c Fri Jul 29 20:30:28 2011(r224496) @@ -1550,7 +1550,8 @@ camperiphscsisenseerror(union ccb *ccb, * make sure we actually have retries available. */ if ((err_action & SSQ_DECREMENT_COUNT) != 0) { - if (ccb->ccb_h.retry_count > 0) + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) ccb->ccb_h.retry_count--; else { *action_string = "Retries exhausted"; @@ -1718,6 +1719,7 @@ int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb) { + struct cam_periph *periph; const char *action_string; cam_status status; int frozen; @@ -1725,7 +1727,8 @@ cam_periph_error(union ccb *ccb, cam_fla int openings; u_int32_t relsim_flags; u_int32_t timeout = 0; - + + periph = xpt_path_periph(ccb->ccb_h.path); action_string = NULL; status = ccb->ccb_h.status; frozen = (status & CAM_DEV_QFRZN) != 0; @@ -1787,9 +1790,9 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_print(ccb->ccb_h.path, "Data overrun\n"); printed++; } - error = EIO;/* we have to kill the command */ /* decrement the number of retries */ - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; } else { @@ -1808,7 +1811,8 @@ cam_periph_error(union ccb *ccb, cam_fla struct cam_path *newpath; if ((camflags & CAM_RETRY_SELTO) != 0) { - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; @@ -1826,10 +1830,11 @@ cam_periph_error(union ccb *ccb, cam_fla timeout = periph_selto_delay; break; } + action_string = "Retries exhausted"; } error = ENXIO; /* Should we do more if we can't create the path?? */ - if (xpt_create_path(&newpath, xpt_path_periph(ccb->ccb_h.path), + if (xpt_create_path(&newpath, periph, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), CAM_LUN_WILDCARD) != CAM_REQ_CMP) @@ -1874,11 +1879,16 @@ cam_periph_error(union ccb *ccb, cam_fla /* FALLTHROUGH */ case CAM_REQUEUE_REQ: /* Unconditional requeue */ - error = ERESTART; if (bootverbose && printed == 0) { xpt_print(ccb->ccb_h.path, "Request requeued\n"); printed++; } + if ((periph->flags & CAM_PERIPH_INVALID) == 0) + error = ERESTART; + else { + action_string = "Retries exhausted"; + error = EIO; + } break; case CAM_RESRC_UNAVAIL: /* Wait a bit for the resource shortage to abate. */ @@ -1893,7 +1903,8 @@ cam_periph_error(union ccb *ccb, cam_fla /* FALLTHROUGH */ default:
svn commit: r224497 - head/sys/cam/ata
Author: mav Date: Fri Jul 29 20:32:27 2011 New Revision: 224497 URL: http://svn.freebsd.org/changeset/base/224497 Log: Add control for ATA disk read-ahead, alike to the previously added write cache control. Some controller BIOS'es tend to disable read-ahead, that dramatically reduces read performance. Previously ata(4) always enabled read-ahead unconditionally. Approved by: re (kib) Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Fri Jul 29 20:30:28 2011(r224496) +++ head/sys/cam/ata/ata_da.c Fri Jul 29 20:32:27 2011(r224497) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #define ATA_MAX_28BIT_LBA 268435455UL typedef enum { + ADA_STATE_RAHEAD, ADA_STATE_WCACHE, ADA_STATE_NORMAL } ada_state; @@ -94,7 +95,8 @@ typedef enum { } ada_quirks; typedef enum { - ADA_CCB_WCACHE = 0x01, + ADA_CCB_RAHEAD = 0x01, + ADA_CCB_WCACHE = 0x02, ADA_CCB_BUFFER_IO = 0x03, ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP= 0x05, @@ -132,6 +134,7 @@ struct ada_softc { int outstanding_cmds; int trim_max_ranges; int trim_running; + int read_ahead; int write_cache; #ifdef ADA_TEST_FAILURE int force_read_error; @@ -294,10 +297,19 @@ static void adaresume(void *arg); #defineADA_DEFAULT_SPINDOWN_SUSPEND1 #endif +#ifndefADA_DEFAULT_READ_AHEAD +#defineADA_DEFAULT_READ_AHEAD 1 +#endif + #ifndefADA_DEFAULT_WRITE_CACHE #defineADA_DEFAULT_WRITE_CACHE 1 #endif +#defineADA_RA (softc->read_ahead >= 0 ? \ +softc->read_ahead : ada_read_ahead) +#defineADA_WC (softc->write_cache >= 0 ? \ +softc->write_cache : ada_write_cache) + /* * Most platforms map firmware geometry to actual, but some don't. If * not overridden, default to nothing. @@ -312,6 +324,7 @@ static int ada_default_timeout = ADA_DEF static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN; static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND; +static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, @@ -334,6 +347,9 @@ TUNABLE_INT("kern.cam.ada.spindown_shutd SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_suspend, CTLFLAG_RW, &ada_spindown_suspend, 0, "Spin down upon suspend"); TUNABLE_INT("kern.cam.ada.spindown_suspend", &ada_spindown_suspend); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RW, + &ada_read_ahead, 0, "Enable disk read-ahead"); +TUNABLE_INT("kern.cam.ada.read_ahead", &ada_read_ahead); SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RW, &ada_write_cache, 0, "Enable disk write cache"); TUNABLE_INT("kern.cam.ada.write_cache", &ada_write_cache); @@ -737,16 +753,19 @@ adaasync(void *callback_arg, u_int32_t c softc = (struct ada_softc *)periph->softc; cam_periph_async(periph, code, path, arg); - if (ada_write_cache < 0 && softc->write_cache < 0) - break; if (softc->state != ADA_STATE_NORMAL) break; xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if ((cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) == 0) - break; - softc->state = ADA_STATE_WCACHE; + if (ADA_RA >= 0 && + cgd.ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) + softc->state = ADA_STATE_RAHEAD; + else if (ADA_WC >= 0 && + cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) + softc->state = ADA_STATE_WCACHE; + else + break; cam_periph_acquire(periph); cam_freeze_devq_arg(periph->path, RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); @@ -789,6 +808,9 @@ adasysctlinit(void *context, int pending } SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "read_ahead", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->read_ahead, 0, "Enable disk read ahead."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); #ifdef ADA_TEST_FAILURE @@ -922,6 +944,10 @@ adaregister(struct cam_periph *per
svn commit: r224498 - head/sys/dev/ahci
Author: mav Date: Fri Jul 29 20:35:23 2011 New Revision: 224498 URL: http://svn.freebsd.org/changeset/base/224498 Log: In some cases, at least on Marvell 88SE912x controllers, Current Command Slot field of the PxCMD register may point to an empty command slot. That breaks command timeout detection logic, making impossible to find what command actually caused timeout, and leading to infinite wait. Workaround that by checking whether pointed command slot is really used and can timeout in its time. And if not, fallback to the dumb algorithm used with FBS -- let all commands to time out and then fail all of them. Approved by: re (kib) MFC after:1 week Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cFri Jul 29 20:32:27 2011(r224497) +++ head/sys/dev/ahci/ahci.cFri Jul 29 20:35:23 2011(r224498) @@ -1879,12 +1879,13 @@ ahci_execute_transaction(struct ahci_slo device_printf(dev, "Poll timeout on slot %d port %d\n", slot->slot, port); device_printf(dev, "is %08x cs %08x ss %08x " - "rs %08x tfd %02x serr %08x\n", + "rs %08x tfd %02x serr %08x cmd %08x\n", ATA_INL(ch->r_mem, AHCI_P_IS), ATA_INL(ch->r_mem, AHCI_P_CI), ATA_INL(ch->r_mem, AHCI_P_SACT), ch->rslots, ATA_INL(ch->r_mem, AHCI_P_TFD), - ATA_INL(ch->r_mem, AHCI_P_SERR)); + ATA_INL(ch->r_mem, AHCI_P_SERR), + ATA_INL(ch->r_mem, AHCI_P_CMD)); et = AHCI_ERR_TIMEOUT; } @@ -1960,8 +1961,12 @@ ahci_timeout(struct ahci_slot *slot) ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & AHCI_P_CMD_CCS_MASK) >> AHCI_P_CMD_CCS_SHIFT; if ((sstatus & (1 << slot->slot)) != 0 || ccs == slot->slot || - ch->fbs_enabled) + ch->fbs_enabled || ch->wrongccs) slot->state = AHCI_SLOT_EXECUTING; + else if ((ch->rslots & (1 << ccs)) == 0) { + ch->wrongccs = 1; + slot->state = AHCI_SLOT_EXECUTING; + } callout_reset(&slot->timeout, (int)slot->ccb->ccb_h.timeout * hz / 2000, @@ -1971,10 +1976,12 @@ ahci_timeout(struct ahci_slot *slot) device_printf(dev, "Timeout on slot %d port %d\n", slot->slot, slot->ccb->ccb_h.target_id & 0x0f); - device_printf(dev, "is %08x cs %08x ss %08x rs %08x tfd %02x serr %08x\n", + device_printf(dev, "is %08x cs %08x ss %08x rs %08x tfd %02x " + "serr %08x cmd %08x\n", ATA_INL(ch->r_mem, AHCI_P_IS), ATA_INL(ch->r_mem, AHCI_P_CI), ATA_INL(ch->r_mem, AHCI_P_SACT), ch->rslots, - ATA_INL(ch->r_mem, AHCI_P_TFD), ATA_INL(ch->r_mem, AHCI_P_SERR)); + ATA_INL(ch->r_mem, AHCI_P_TFD), ATA_INL(ch->r_mem, AHCI_P_SERR), + ATA_INL(ch->r_mem, AHCI_P_CMD)); /* Handle frozen command. */ if (ch->frozen) { @@ -1987,7 +1994,7 @@ ahci_timeout(struct ahci_slot *slot) } xpt_done(fccb); } - if (!ch->fbs_enabled) { + if (!ch->fbs_enabled && !ch->wrongccs) { /* Without FBS we know real timeout source. */ ch->fatalerr = 1; /* Handle command with timeout. */ @@ -2585,6 +2592,7 @@ ahci_reset(device_t dev) xpt_release_simq(ch->sim, TRUE); ch->eslots = 0; ch->toslots = 0; + ch->wrongccs = 0; ch->fatalerr = 0; /* Tell the XPT about the event */ xpt_async(AC_BUS_RESET, ch->path, NULL); Modified: head/sys/dev/ahci/ahci.h == --- head/sys/dev/ahci/ahci.hFri Jul 29 20:32:27 2011(r224497) +++ head/sys/dev/ahci/ahci.hFri Jul 29 20:35:23 2011(r224498) @@ -426,6 +426,7 @@ struct ahci_channel { int resetting; /* Hard-reset in progress. */ int resetpolldiv; /* Hard-reset poll divider. */ int listening; /* SUD bit is cleared. */ + int wrongccs; /* CCS field in CMD was wrong */ union ccb *frozen;/* Frozen command */ struct callout pm_timer; /* Power management events */ struct callout reset_timer;/* Hard-reset timeout */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscri
svn commit: r224499 - head/sys/dev/usb/input
Author: mav Date: Fri Jul 29 20:38:06 2011 New Revision: 224499 URL: http://svn.freebsd.org/changeset/base/224499 Log: Make ums(4) driver more picky, not attaching to "mouses" with absolute coordinates, such as digitizers and touch-screens, leaving these devices to uhid(4) and user-level. Specially patched xf86-input-mouse driver can handle them, that isn't done and can't be done properly with ums(4) because of mouse(4) protocol limitations. Approved by: re (kib) Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c == --- head/sys/dev/usb/input/ums.cFri Jul 29 20:35:23 2011 (r224498) +++ head/sys/dev/usb/input/ums.cFri Jul 29 20:38:06 2011 (r224499) @@ -367,7 +367,9 @@ ums_probe(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); void *d_ptr; - int error; + struct hid_data *hd; + struct hid_item hi; + int error, mdepth, found; uint16_t d_len; DPRINTFN(11, "\n"); @@ -388,14 +390,44 @@ ums_probe(device_t dev) if (error) return (ENXIO); - if (hid_is_collection(d_ptr, d_len, - HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE))) - error = BUS_PROBE_DEFAULT; - else - error = ENXIO; - + hd = hid_start_parse(d_ptr, d_len, 1 << hid_input); + if (hd == NULL) + return (0); + mdepth = 0; + found = 0; + while (hid_get_item(hd, &hi)) { + switch (hi.kind) { + case hid_collection: + if (mdepth != 0) + mdepth++; + else if (hi.collection == 1 && +hi.usage == + HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)) + mdepth++; + break; + case hid_endcollection: + if (mdepth != 0) + mdepth--; + break; + case hid_input: + if (mdepth == 0) + break; + if (hi.usage == +HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X) && + (hi.flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) + found++; + if (hi.usage == +HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y) && + (hi.flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) + found++; + break; + default: + break; + } + } + hid_end_parse(hd); free(d_ptr, M_TEMP); - return (error); + return (found ? BUS_PROBE_DEFAULT : ENXIO); } static void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r224502 - head/sys/dev/ath
Author: adrian Date: Fri Jul 29 23:55:17 2011 New Revision: 224502 URL: http://svn.freebsd.org/changeset/base/224502 Log: Reset the NIC if ANI is enabled or disabled. Although this may not be what the original sysctl was designed to do, it feels a bit more "expected". Before, if ANI is disabled, the initial ANI parameters are still written to the hardware, even if they're not enabled. "ANI enabled" would then adjust the noise immunity parameters dynamically. Disabling ANI would simply leave the existing noise immunity parameters where they are, and disable the dynamic part. The problem is that disabling ANI doesn't leave the hardware in a consistent, predictable state - so asking a user to disable ANI wouldn't actually reset the NIC to a consistent set of PHY signal detection parameters, resulting in an unpredictable/unreliable outcome. This makes it difficult to get reliable debugging information from the user. Approved by: re (kib) Modified: head/sys/dev/ath/if_ath_sysctl.c Modified: head/sys/dev/ath/if_ath_sysctl.c == --- head/sys/dev/ath/if_ath_sysctl.cFri Jul 29 22:11:05 2011 (r224501) +++ head/sys/dev/ath/if_ath_sysctl.cFri Jul 29 23:55:17 2011 (r224502) @@ -354,7 +354,21 @@ ath_sysctl_intmit(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &intmit, 0, req); if (error || !req->newptr) return error; - return !ath_hal_setintmit(sc->sc_ah, intmit) ? EINVAL : 0; + + /* reusing error; 1 here means "good"; 0 means "fail" */ + error = ath_hal_setintmit(sc->sc_ah, intmit); + if (! error) + return EINVAL; + + /* +* Reset the hardware here - disabling ANI in the HAL +* doesn't reset ANI related registers, so it'll leave +* things in an inconsistent state. +*/ + if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) + ath_reset(sc->sc_ifp); + + return 0; } #ifdef IEEE80211_SUPPORT_TDMA ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r224503 - in head: sbin/mount sys/ufs/ffs sys/ufs/ufs
Author: mckusick Date: Sat Jul 30 00:43:18 2011 New Revision: 224503 URL: http://svn.freebsd.org/changeset/base/224503 Log: Update to -r224294 to ensure that only one of MNT_SUJ or MNT_SOFTDEP is set so that mount can revert back to using MNT_NOWAIT when doing getmntinfo. Approved by: re (kib) Modified: head/sbin/mount/mount.c head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/inode.h Modified: head/sbin/mount/mount.c == --- head/sbin/mount/mount.c Fri Jul 29 23:55:17 2011(r224502) +++ head/sbin/mount/mount.c Sat Jul 30 00:43:18 2011(r224503) @@ -317,7 +317,7 @@ main(int argc, char *argv[]) rval = 0; switch (argc) { case 0: - if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0) + if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) err(1, "getmntinfo"); if (all) { while ((fs = getfsent()) != NULL) { @@ -666,7 +666,7 @@ getmntpt(const char *name) struct statfs *mntbuf; int i, mntsize; - mntsize = getmntinfo(&mntbuf, MNT_WAIT); + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); for (i = mntsize - 1; i >= 0; i--) { if (strcmp(mntbuf[i].f_mntfromname, name) == 0 || strcmp(mntbuf[i].f_mntonname, name) == 0) Modified: head/sys/ufs/ffs/ffs_alloc.c == --- head/sys/ufs/ffs/ffs_alloc.cFri Jul 29 23:55:17 2011 (r224502) +++ head/sys/ufs/ffs/ffs_alloc.cSat Jul 30 00:43:18 2011 (r224503) @@ -1967,7 +1967,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size ACTIVECLEAR(fs, cg); UFS_UNLOCK(ump); mp = UFSTOVFS(ump); - if (mp->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG) + if (MOUNTEDSOFTDEP(mp) && devvp->v_type != VREG) softdep_setup_blkfree(UFSTOVFS(ump), bp, bno, numfrags(fs, size), dephd); bdwrite(bp); @@ -2217,7 +2217,7 @@ ffs_freefile(ump, fs, devvp, ino, mode, fs->fs_fmod = 1; ACTIVECLEAR(fs, cg); UFS_UNLOCK(ump); - if (UFSTOVFS(ump)->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG) + if (MOUNTEDSOFTDEP(UFSTOVFS(ump)) && devvp->v_type != VREG) softdep_setup_inofree(UFSTOVFS(ump), bp, ino + cg * fs->fs_ipg, wkhd); bdwrite(bp); Modified: head/sys/ufs/ffs/ffs_softdep.c == --- head/sys/ufs/ffs/ffs_softdep.c Fri Jul 29 23:55:17 2011 (r224502) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Jul 30 00:43:18 2011 (r224503) @@ -1364,7 +1364,7 @@ softdep_flush(void) mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { nmp = TAILQ_NEXT(mp, mnt_list); - if ((mp->mnt_flag & MNT_SOFTDEP) == 0) + if (MOUNTEDSOFTDEP(mp) == 0) continue; if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) continue; @@ -2423,7 +2423,7 @@ softdep_unmount(mp) MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_SOFTDEP; - if ((mp->mnt_flag & MNT_SUJ) == 0) { + if (MOUNTEDSUJ(mp) == 0) { MNT_IUNLOCK(mp); return; } @@ -2638,6 +2638,7 @@ out: if (error == 0) { MNT_ILOCK(mp); mp->mnt_flag |= MNT_SUJ; + mp->mnt_flag &= ~MNT_SOFTDEP; MNT_IUNLOCK(mp); /* * Only validate the journal contents if the @@ -3060,7 +3061,7 @@ softdep_flushjournal(mp) struct jblocks *jblocks; struct ufsmount *ump; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); jblocks = ump->softdep_jblocks; @@ -3096,7 +3097,7 @@ softdep_process_journal(mp, needwk, flag int off; int devbsize; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -3827,8 +3828,8 @@ newfreework(ump, freeblks, parent, lbn, freework->fw_blkno = nb; freework->fw_frags = frags; freework->fw_indir = NULL; - freework->fw_ref = ((UFSTOVFS(ump)->mnt_flag & MNT_SUJ) == 0 || - lbn >= -NXADDR) ? 0 : NINDIR(ump->um_fs) + 1; + freework->fw_ref = (MOUNTEDSUJ(UFSTOVFS(ump)) == 0 || lbn >= -NXADDR) + ? 0 : NINDIR(ump->um_fs) + 1; freework->fw_start = freework->fw_off = off; if (journal) newjfreeblk(freeblks, lbn, nb
svn commit: r224504 - in head/release: amd64 i386 powerpc
Author: nwhitehorn Date: Sat Jul 30 00:51:36 2011 New Revision: 224504 URL: http://svn.freebsd.org/changeset/base/224504 Log: Mount memsticks read-only by default to prevent them being filled by user modifications and subsequently preventing a functioning installation. Approved by: re (kib) Modified: head/release/amd64/make-memstick.sh head/release/i386/make-memstick.sh head/release/powerpc/make-memstick.sh Modified: head/release/amd64/make-memstick.sh == --- head/release/amd64/make-memstick.sh Sat Jul 30 00:43:18 2011 (r224503) +++ head/release/amd64/make-memstick.sh Sat Jul 30 00:51:36 2011 (r224504) @@ -32,7 +32,7 @@ if [ -e ${2} ]; then exit 1 fi -echo '/dev/gpt/FreeBSD_Install / ufs rw,noatime 1 1' > ${1}/etc/fstab +echo '/dev/gpt/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab rm -f ${tempfile} makefs -B little ${tempfile} ${1} if [ $? -ne 0 ]; then Modified: head/release/i386/make-memstick.sh == --- head/release/i386/make-memstick.sh Sat Jul 30 00:43:18 2011 (r224503) +++ head/release/i386/make-memstick.sh Sat Jul 30 00:51:36 2011 (r224504) @@ -32,7 +32,7 @@ if [ -e ${2} ]; then exit 1 fi -echo '/dev/gpt/FreeBSD_Install / ufs rw,noatime 1 1' > ${1}/etc/fstab +echo '/dev/gpt/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab rm -f ${tempfile} makefs -B little ${tempfile} ${1} if [ $? -ne 0 ]; then Modified: head/release/powerpc/make-memstick.sh == --- head/release/powerpc/make-memstick.sh Sat Jul 30 00:43:18 2011 (r224503) +++ head/release/powerpc/make-memstick.sh Sat Jul 30 00:51:36 2011 (r224504) @@ -32,7 +32,7 @@ if [ -e ${2} ]; then exit 1 fi -echo '/dev/da0s3 / ufs rw,noatime 1 1' > ${1}/etc/fstab +echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fstab rm -f ${tempfile} makefs -B big ${tempfile} ${1} if [ $? -ne 0 ]; then ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r224505 - head/sys/powerpc/powermac
Author: nwhitehorn Date: Sat Jul 30 00:52:13 2011 New Revision: 224505 URL: http://svn.freebsd.org/changeset/base/224505 Log: Fix an error that could cause sysctl -a to enter an infinite loop in the event of a broken or busy fan due to returning incorrect error codes from the FCU sysctl handler. Reported by: Path Mather 1 Approved by: re (kib) Modified: head/sys/powerpc/powermac/fcu.c Modified: head/sys/powerpc/powermac/fcu.c == --- head/sys/powerpc/powermac/fcu.c Sat Jul 30 00:51:36 2011 (r224504) +++ head/sys/powerpc/powermac/fcu.c Sat Jul 30 00:52:13 2011 (r224505) @@ -282,14 +282,14 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int fan->setpoint = rpm; } else { device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); - return (-1); + return (ENXIO); } buf[0] = rpm >> (8 - fcu_rpm_shift); buf[1] = rpm << fcu_rpm_shift; if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0) - return (-1); + return (EIO); return (0); } @@ -377,7 +377,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int buf[0] = (pwm * 2550) / 1000; if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0) - return (-1); + return (EIO); return (0); } @@ -536,12 +536,12 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) if (fan->type == FCU_FAN_RPM) { rpm = fcu_fan_get_rpm(fan); if (rpm < 0) - return (-1); + return (EIO); error = sysctl_handle_int(oidp, &rpm, 0, req); } else { error = fcu_fan_get_pwm(fcu, fan, &pwm, &rpm); if (error < 0) - return (-1); + return (EIO); switch (arg2 & 0xff00) { case FCU_PWM_SYSCTL_PWM: @@ -552,7 +552,7 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) break; default: /* This should never happen */ - error = -1; + return (EINVAL); }; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r224506 - in head/sys: dev/re pci
Author: yongari Date: Sat Jul 30 01:06:12 2011 New Revision: 224506 URL: http://svn.freebsd.org/changeset/base/224506 Log: Add new device id of D-Link DGE-530T Rev. C controller. DGE-503T Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller. PR: kern/159116 Approved by: re (kib) Modified: head/sys/dev/re/if_re.c head/sys/pci/if_rlreg.h Modified: head/sys/dev/re/if_re.c == --- head/sys/dev/re/if_re.c Sat Jul 30 00:52:13 2011(r224505) +++ head/sys/dev/re/if_re.c Sat Jul 30 01:06:12 2011(r224506) @@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe static struct rl_type re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, + { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, + "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, { RT_VENDORID, RT_DEVICEID_8139, 0, "RealTek 8139C+ 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8101E, 0, Modified: head/sys/pci/if_rlreg.h == --- head/sys/pci/if_rlreg.h Sat Jul 30 00:52:13 2011(r224505) +++ head/sys/pci/if_rlreg.h Sat Jul 30 01:06:12 2011(r224506) @@ -1042,6 +1042,7 @@ struct rl_softc { * D-Link DFE-5280T device ID */ #defineDLINK_DEVICEID_528T 0x4300 +#defineDLINK_DEVICEID_530T_REVC0x4302 /* * D-Link DFE-690TXD device ID ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"