mvs.c (208818) | mvs.c (210471) |
---|---|
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 208818 2010-06-05 08:21:18Z mav $"); | 28__FBSDID("$FreeBSD: head/sys/dev/mvs/mvs.c 210471 2010-07-25 15:43:52Z mav $"); |
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/endian.h> 37#include <sys/malloc.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <vm/uma.h> 41#include <machine/stdarg.h> 42#include <machine/resource.h> 43#include <machine/bus.h> 44#include <sys/rman.h> | 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/endian.h> 37#include <sys/malloc.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <vm/uma.h> 41#include <machine/stdarg.h> 42#include <machine/resource.h> 43#include <machine/bus.h> 44#include <sys/rman.h> |
45#include <dev/pci/pcivar.h> |
|
45#include "mvs.h" 46 47#include <cam/cam.h> 48#include <cam/cam_ccb.h> 49#include <cam/cam_sim.h> 50#include <cam/cam_xpt_sim.h> 51#include <cam/cam_debug.h> 52 --- 1959 unchanged lines hidden (view full) --- 2012 return (-1); 2013 } 2014 return (0); 2015} 2016 2017static void 2018mvsaction(struct cam_sim *sim, union ccb *ccb) 2019{ | 46#include "mvs.h" 47 48#include <cam/cam.h> 49#include <cam/cam_ccb.h> 50#include <cam/cam_sim.h> 51#include <cam/cam_xpt_sim.h> 52#include <cam/cam_debug.h> 53 --- 1959 unchanged lines hidden (view full) --- 2013 return (-1); 2014 } 2015 return (0); 2016} 2017 2018static void 2019mvsaction(struct cam_sim *sim, union ccb *ccb) 2020{ |
2020 device_t dev; | 2021 device_t dev, parent; |
2021 struct mvs_channel *ch; 2022 2023 CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("mvsaction func_code=%x\n", 2024 ccb->ccb_h.func_code)); 2025 2026 ch = (struct mvs_channel *)cam_sim_softc(sim); 2027 dev = ch->dev; 2028 switch (ccb->ccb_h.func_code) { --- 118 unchanged lines hidden (view full) --- 2147 case XPT_TERM_IO: /* Terminate the I/O process */ 2148 /* XXX Implement */ 2149 ccb->ccb_h.status = CAM_REQ_INVALID; 2150 break; 2151 case XPT_PATH_INQ: /* Path routing inquiry */ 2152 { 2153 struct ccb_pathinq *cpi = &ccb->cpi; 2154 | 2022 struct mvs_channel *ch; 2023 2024 CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("mvsaction func_code=%x\n", 2025 ccb->ccb_h.func_code)); 2026 2027 ch = (struct mvs_channel *)cam_sim_softc(sim); 2028 dev = ch->dev; 2029 switch (ccb->ccb_h.func_code) { --- 118 unchanged lines hidden (view full) --- 2148 case XPT_TERM_IO: /* Terminate the I/O process */ 2149 /* XXX Implement */ 2150 ccb->ccb_h.status = CAM_REQ_INVALID; 2151 break; 2152 case XPT_PATH_INQ: /* Path routing inquiry */ 2153 { 2154 struct ccb_pathinq *cpi = &ccb->cpi; 2155 |
2156 parent = device_get_parent(dev); |
|
2155 cpi->version_num = 1; /* XXX??? */ 2156 cpi->hba_inquiry = PI_SDTR_ABLE; 2157 if (!(ch->quirks & MVS_Q_GENI)) { 2158 cpi->hba_inquiry |= PI_SATAPM; 2159 /* Gen-II is extremely slow with NCQ on PMP. */ 2160 if ((ch->quirks & MVS_Q_GENIIE) || ch->pm_present == 0) 2161 cpi->hba_inquiry |= PI_TAG_ABLE; 2162 } --- 12 unchanged lines hidden (view full) --- 2175 strncpy(cpi->hba_vid, "Marvell", HBA_IDLEN); 2176 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 2177 cpi->unit_number = cam_sim_unit(sim); 2178 cpi->transport = XPORT_SATA; 2179 cpi->transport_version = XPORT_VERSION_UNSPECIFIED; 2180 cpi->protocol = PROTO_ATA; 2181 cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; 2182 cpi->maxio = MAXPHYS; | 2157 cpi->version_num = 1; /* XXX??? */ 2158 cpi->hba_inquiry = PI_SDTR_ABLE; 2159 if (!(ch->quirks & MVS_Q_GENI)) { 2160 cpi->hba_inquiry |= PI_SATAPM; 2161 /* Gen-II is extremely slow with NCQ on PMP. */ 2162 if ((ch->quirks & MVS_Q_GENIIE) || ch->pm_present == 0) 2163 cpi->hba_inquiry |= PI_TAG_ABLE; 2164 } --- 12 unchanged lines hidden (view full) --- 2177 strncpy(cpi->hba_vid, "Marvell", HBA_IDLEN); 2178 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 2179 cpi->unit_number = cam_sim_unit(sim); 2180 cpi->transport = XPORT_SATA; 2181 cpi->transport_version = XPORT_VERSION_UNSPECIFIED; 2182 cpi->protocol = PROTO_ATA; 2183 cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; 2184 cpi->maxio = MAXPHYS; |
2185 if ((ch->quirks & MVS_Q_SOC) == 0) { 2186 cpi->hba_vendor = pci_get_vendor(parent); 2187 cpi->hba_device = pci_get_device(parent); 2188 cpi->hba_subvendor = pci_get_subvendor(parent); 2189 cpi->hba_subdevice = pci_get_subdevice(parent); 2190 } |
|
2183 cpi->ccb_h.status = CAM_REQ_CMP; 2184 break; 2185 } 2186 default: 2187 ccb->ccb_h.status = CAM_REQ_INVALID; 2188 break; 2189 } 2190 xpt_done(ccb); --- 13 unchanged lines hidden --- | 2191 cpi->ccb_h.status = CAM_REQ_CMP; 2192 break; 2193 } 2194 default: 2195 ccb->ccb_h.status = CAM_REQ_INVALID; 2196 break; 2197 } 2198 xpt_done(ccb); --- 13 unchanged lines hidden --- |