mvs.c (271461) | mvs.c (274819) |
---|---|
1/*- 2 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/mvs/mvs.c 271461 2014-09-12 12:04:51Z mav $"); | 28__FBSDID("$FreeBSD: head/sys/dev/mvs/mvs.c 274819 2014-11-21 21:01:24Z smh $"); |
29 30#include <sys/param.h> 31#include <sys/module.h> 32#include <sys/systm.h> 33#include <sys/kernel.h> 34#include <sys/ata.h> 35#include <sys/bus.h> 36#include <sys/conf.h> --- 1373 unchanged lines hidden (view full) --- 1410 ATA_OUTL(ch->r_mem, DMA_DTLBA, eprd); 1411 ATA_OUTL(ch->r_mem, DMA_DTHBA, (eprd >> 16) >> 16); 1412 ATA_OUTL(ch->r_mem, DMA_C, DMA_C_START | 1413 (((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) ? 1414 DMA_C_READ : 0)); 1415 } 1416 } 1417 /* Start command execution timeout */ | 29 30#include <sys/param.h> 31#include <sys/module.h> 32#include <sys/systm.h> 33#include <sys/kernel.h> 34#include <sys/ata.h> 35#include <sys/bus.h> 36#include <sys/conf.h> --- 1373 unchanged lines hidden (view full) --- 1410 ATA_OUTL(ch->r_mem, DMA_DTLBA, eprd); 1411 ATA_OUTL(ch->r_mem, DMA_DTHBA, (eprd >> 16) >> 16); 1412 ATA_OUTL(ch->r_mem, DMA_C, DMA_C_START | 1413 (((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) ? 1414 DMA_C_READ : 0)); 1415 } 1416 } 1417 /* Start command execution timeout */ |
1418 callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 1000, 1419 (timeout_t*)mvs_timeout, slot); | 1418 callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, 1419 (timeout_t*)mvs_timeout, slot, 0); |
1420} 1421 1422/* Must be called with channel locked. */ 1423static void 1424mvs_execute_transaction(struct mvs_slot *slot) 1425{ 1426 device_t dev = slot->dev; 1427 struct mvs_channel *ch = device_get_softc(dev); --- 96 unchanged lines hidden (view full) --- 1524 BUS_DMASYNC_PREREAD); 1525 slot->state = MVS_SLOT_RUNNING; 1526 ch->rslots |= (1 << slot->slot); 1527 /* Issue command to the controller. */ 1528 ch->out_idx = (ch->out_idx + 1) & (MVS_MAX_SLOTS - 1); 1529 ATA_OUTL(ch->r_mem, EDMA_REQQIP, 1530 ch->dma.workrq_bus + MVS_CRQB_OFFSET + (MVS_CRQB_SIZE * ch->out_idx)); 1531 /* Start command execution timeout */ | 1420} 1421 1422/* Must be called with channel locked. */ 1423static void 1424mvs_execute_transaction(struct mvs_slot *slot) 1425{ 1426 device_t dev = slot->dev; 1427 struct mvs_channel *ch = device_get_softc(dev); --- 96 unchanged lines hidden (view full) --- 1524 BUS_DMASYNC_PREREAD); 1525 slot->state = MVS_SLOT_RUNNING; 1526 ch->rslots |= (1 << slot->slot); 1527 /* Issue command to the controller. */ 1528 ch->out_idx = (ch->out_idx + 1) & (MVS_MAX_SLOTS - 1); 1529 ATA_OUTL(ch->r_mem, EDMA_REQQIP, 1530 ch->dma.workrq_bus + MVS_CRQB_OFFSET + (MVS_CRQB_SIZE * ch->out_idx)); 1531 /* Start command execution timeout */ |
1532 callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 1000, 1533 (timeout_t*)mvs_timeout, slot); | 1532 callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, 1533 (timeout_t*)mvs_timeout, slot, 0); |
1534 return; 1535} 1536 1537/* Must be called with channel locked. */ 1538static void 1539mvs_process_timeout(device_t dev) 1540{ 1541 struct mvs_channel *ch = device_get_softc(dev); --- 20 unchanged lines hidden (view full) --- 1562 for (i = 0; i < MVS_MAX_SLOTS; i++) { 1563 struct mvs_slot *slot = &ch->slot[i]; 1564 1565 /* Do we have a running request on slot? */ 1566 if (slot->state < MVS_SLOT_RUNNING) 1567 continue; 1568 if ((ch->toslots & (1 << i)) == 0) 1569 continue; | 1534 return; 1535} 1536 1537/* Must be called with channel locked. */ 1538static void 1539mvs_process_timeout(device_t dev) 1540{ 1541 struct mvs_channel *ch = device_get_softc(dev); --- 20 unchanged lines hidden (view full) --- 1562 for (i = 0; i < MVS_MAX_SLOTS; i++) { 1563 struct mvs_slot *slot = &ch->slot[i]; 1564 1565 /* Do we have a running request on slot? */ 1566 if (slot->state < MVS_SLOT_RUNNING) 1567 continue; 1568 if ((ch->toslots & (1 << i)) == 0) 1569 continue; |
1570 callout_reset(&slot->timeout, 1571 (int)slot->ccb->ccb_h.timeout * hz / 2000, 1572 (timeout_t*)mvs_timeout, slot); | 1570 callout_reset_sbt(&slot->timeout, 1571 SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, 1572 (timeout_t*)mvs_timeout, slot, 0); |
1573 } 1574} 1575 1576/* Locked by callout mechanism. */ 1577static void 1578mvs_timeout(struct mvs_slot *slot) 1579{ 1580 device_t dev = slot->dev; --- 874 unchanged lines hidden --- | 1573 } 1574} 1575 1576/* Locked by callout mechanism. */ 1577static void 1578mvs_timeout(struct mvs_slot *slot) 1579{ 1580 device_t dev = slot->dev; --- 874 unchanged lines hidden --- |