Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mvs/mvs.c
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
static int mvs_sata_phy_reset(device_t dev); | static int mvs_sata_phy_reset(device_t dev); | ||||
static int mvs_wait(device_t dev, u_int s, u_int c, int t); | static int mvs_wait(device_t dev, u_int s, u_int c, int t); | ||||
static void mvs_tfd_read(device_t dev, union ccb *ccb); | static void mvs_tfd_read(device_t dev, union ccb *ccb); | ||||
static void mvs_tfd_write(device_t dev, union ccb *ccb); | static void mvs_tfd_write(device_t dev, union ccb *ccb); | ||||
static void mvs_legacy_intr(device_t dev, int poll); | static void mvs_legacy_intr(device_t dev, int poll); | ||||
static void mvs_crbq_intr(device_t dev); | static void mvs_crbq_intr(device_t dev); | ||||
static void mvs_begin_transaction(device_t dev, union ccb *ccb); | static void mvs_begin_transaction(device_t dev, union ccb *ccb); | ||||
static void mvs_legacy_execute_transaction(struct mvs_slot *slot); | static void mvs_legacy_execute_transaction(struct mvs_slot *slot); | ||||
static void mvs_timeout(struct mvs_slot *slot); | static void mvs_timeout(void *arg); | ||||
static void mvs_dmasetprd(void *arg, | static void mvs_dmasetprd(void *arg, | ||||
bus_dma_segment_t *segs, int nsegs, int error); | bus_dma_segment_t *segs, int nsegs, int error); | ||||
static void mvs_requeue_frozen(device_t dev); | static void mvs_requeue_frozen(device_t dev); | ||||
static void mvs_execute_transaction(struct mvs_slot *slot); | static void mvs_execute_transaction(struct mvs_slot *slot); | ||||
static void mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et); | static void mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et); | ||||
static void mvs_issue_recovery(device_t dev); | static void mvs_issue_recovery(device_t dev); | ||||
static void mvs_process_read_log(device_t dev, union ccb *ccb); | static void mvs_process_read_log(device_t dev, union ccb *ccb); | ||||
▲ Show 20 Lines • Show All 1,319 Lines • ▼ Show 20 Lines | if (ch->basic_dma) { | ||||
ATA_OUTL(ch->r_mem, DMA_DTHBA, (eprd >> 16) >> 16); | ATA_OUTL(ch->r_mem, DMA_DTHBA, (eprd >> 16) >> 16); | ||||
ATA_OUTL(ch->r_mem, DMA_C, DMA_C_START | | ATA_OUTL(ch->r_mem, DMA_C, DMA_C_START | | ||||
(((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) ? | (((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) ? | ||||
DMA_C_READ : 0)); | DMA_C_READ : 0)); | ||||
} | } | ||||
} | } | ||||
/* Start command execution timeout */ | /* Start command execution timeout */ | ||||
callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, | callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, | ||||
(timeout_t*)mvs_timeout, slot, 0); | mvs_timeout, slot, 0); | ||||
} | } | ||||
/* Must be called with channel locked. */ | /* Must be called with channel locked. */ | ||||
static void | static void | ||||
mvs_execute_transaction(struct mvs_slot *slot) | mvs_execute_transaction(struct mvs_slot *slot) | ||||
{ | { | ||||
device_t dev = slot->dev; | device_t dev = slot->dev; | ||||
struct mvs_channel *ch = device_get_softc(dev); | struct mvs_channel *ch = device_get_softc(dev); | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | mvs_execute_transaction(struct mvs_slot *slot) | ||||
slot->state = MVS_SLOT_RUNNING; | slot->state = MVS_SLOT_RUNNING; | ||||
ch->rslots |= (1 << slot->slot); | ch->rslots |= (1 << slot->slot); | ||||
/* Issue command to the controller. */ | /* Issue command to the controller. */ | ||||
ch->out_idx = (ch->out_idx + 1) & (MVS_MAX_SLOTS - 1); | ch->out_idx = (ch->out_idx + 1) & (MVS_MAX_SLOTS - 1); | ||||
ATA_OUTL(ch->r_mem, EDMA_REQQIP, | ATA_OUTL(ch->r_mem, EDMA_REQQIP, | ||||
ch->dma.workrq_bus + MVS_CRQB_OFFSET + (MVS_CRQB_SIZE * ch->out_idx)); | ch->dma.workrq_bus + MVS_CRQB_OFFSET + (MVS_CRQB_SIZE * ch->out_idx)); | ||||
/* Start command execution timeout */ | /* Start command execution timeout */ | ||||
callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, | callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, | ||||
(timeout_t*)mvs_timeout, slot, 0); | mvs_timeout, slot, 0); | ||||
return; | return; | ||||
} | } | ||||
/* Must be called with channel locked. */ | /* Must be called with channel locked. */ | ||||
static void | static void | ||||
mvs_process_timeout(device_t dev) | mvs_process_timeout(device_t dev) | ||||
{ | { | ||||
struct mvs_channel *ch = device_get_softc(dev); | struct mvs_channel *ch = device_get_softc(dev); | ||||
Show All 22 Lines | for (i = 0; i < MVS_MAX_SLOTS; i++) { | ||||
/* Do we have a running request on slot? */ | /* Do we have a running request on slot? */ | ||||
if (slot->state < MVS_SLOT_RUNNING) | if (slot->state < MVS_SLOT_RUNNING) | ||||
continue; | continue; | ||||
if ((ch->toslots & (1 << i)) == 0) | if ((ch->toslots & (1 << i)) == 0) | ||||
continue; | continue; | ||||
callout_reset_sbt(&slot->timeout, | callout_reset_sbt(&slot->timeout, | ||||
SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, | SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, | ||||
(timeout_t*)mvs_timeout, slot, 0); | mvs_timeout, slot, 0); | ||||
} | } | ||||
} | } | ||||
/* Locked by callout mechanism. */ | /* Locked by callout mechanism. */ | ||||
static void | static void | ||||
mvs_timeout(struct mvs_slot *slot) | mvs_timeout(void *arg) | ||||
{ | { | ||||
struct mvs_slot *slot = arg; | |||||
device_t dev = slot->dev; | device_t dev = slot->dev; | ||||
struct mvs_channel *ch = device_get_softc(dev); | struct mvs_channel *ch = device_get_softc(dev); | ||||
/* Check for stale timeout. */ | /* Check for stale timeout. */ | ||||
if (slot->state < MVS_SLOT_RUNNING) | if (slot->state < MVS_SLOT_RUNNING) | ||||
return; | return; | ||||
device_printf(dev, "Timeout on slot %d\n", slot->slot); | device_printf(dev, "Timeout on slot %d\n", slot->slot); | ||||
device_printf(dev, "iec %08x sstat %08x serr %08x edma_s %08x " | device_printf(dev, "iec %08x sstat %08x serr %08x edma_s %08x " | ||||
▲ Show 20 Lines • Show All 869 Lines • Show Last 20 Lines |