ahci_pci.c (208907) | ahci_pci.c (210471) |
---|---|
1/*- 2 * Copyright (c) 2009 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) 2009 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/ahci/ahci.c 208907 2010-06-08 10:03:08Z mav $"); | 28__FBSDID("$FreeBSD: head/sys/dev/ahci/ahci.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> --- 2417 unchanged lines hidden (view full) --- 2454 return (-1); 2455 } 2456 return (0); 2457} 2458 2459static void 2460ahciaction(struct cam_sim *sim, union ccb *ccb) 2461{ | 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> --- 2417 unchanged lines hidden (view full) --- 2454 return (-1); 2455 } 2456 return (0); 2457} 2458 2459static void 2460ahciaction(struct cam_sim *sim, union ccb *ccb) 2461{ |
2462 device_t dev; | 2462 device_t dev, parent; |
2463 struct ahci_channel *ch; 2464 2465 CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ahciaction func_code=%x\n", 2466 ccb->ccb_h.func_code)); 2467 2468 ch = (struct ahci_channel *)cam_sim_softc(sim); 2469 dev = ch->dev; 2470 switch (ccb->ccb_h.func_code) { --- 123 unchanged lines hidden (view full) --- 2594 case XPT_TERM_IO: /* Terminate the I/O process */ 2595 /* XXX Implement */ 2596 ccb->ccb_h.status = CAM_REQ_INVALID; 2597 break; 2598 case XPT_PATH_INQ: /* Path routing inquiry */ 2599 { 2600 struct ccb_pathinq *cpi = &ccb->cpi; 2601 | 2463 struct ahci_channel *ch; 2464 2465 CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ahciaction func_code=%x\n", 2466 ccb->ccb_h.func_code)); 2467 2468 ch = (struct ahci_channel *)cam_sim_softc(sim); 2469 dev = ch->dev; 2470 switch (ccb->ccb_h.func_code) { --- 123 unchanged lines hidden (view full) --- 2594 case XPT_TERM_IO: /* Terminate the I/O process */ 2595 /* XXX Implement */ 2596 ccb->ccb_h.status = CAM_REQ_INVALID; 2597 break; 2598 case XPT_PATH_INQ: /* Path routing inquiry */ 2599 { 2600 struct ccb_pathinq *cpi = &ccb->cpi; 2601 |
2602 parent = device_get_parent(dev); |
|
2602 cpi->version_num = 1; /* XXX??? */ 2603 cpi->hba_inquiry = PI_SDTR_ABLE; 2604 if (ch->caps & AHCI_CAP_SNCQ) 2605 cpi->hba_inquiry |= PI_TAG_ABLE; 2606 if (ch->caps & AHCI_CAP_SPM) 2607 cpi->hba_inquiry |= PI_SATAPM; 2608 cpi->target_sprt = 0; 2609 cpi->hba_misc = PIM_SEQSCAN; --- 11 unchanged lines hidden (view full) --- 2621 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 2622 cpi->unit_number = cam_sim_unit(sim); 2623 cpi->transport = XPORT_SATA; 2624 cpi->transport_version = XPORT_VERSION_UNSPECIFIED; 2625 cpi->protocol = PROTO_ATA; 2626 cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; 2627 cpi->maxio = MAXPHYS; 2628 /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ | 2603 cpi->version_num = 1; /* XXX??? */ 2604 cpi->hba_inquiry = PI_SDTR_ABLE; 2605 if (ch->caps & AHCI_CAP_SNCQ) 2606 cpi->hba_inquiry |= PI_TAG_ABLE; 2607 if (ch->caps & AHCI_CAP_SPM) 2608 cpi->hba_inquiry |= PI_SATAPM; 2609 cpi->target_sprt = 0; 2610 cpi->hba_misc = PIM_SEQSCAN; --- 11 unchanged lines hidden (view full) --- 2622 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 2623 cpi->unit_number = cam_sim_unit(sim); 2624 cpi->transport = XPORT_SATA; 2625 cpi->transport_version = XPORT_VERSION_UNSPECIFIED; 2626 cpi->protocol = PROTO_ATA; 2627 cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; 2628 cpi->maxio = MAXPHYS; 2629 /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ |
2629 if (pci_get_devid(device_get_parent(dev)) == 0x43801002) | 2630 if (pci_get_devid(parent) == 0x43801002) |
2630 cpi->maxio = min(cpi->maxio, 128 * 512); | 2631 cpi->maxio = min(cpi->maxio, 128 * 512); |
2632 cpi->hba_vendor = pci_get_vendor(parent); 2633 cpi->hba_device = pci_get_device(parent); 2634 cpi->hba_subvendor = pci_get_subvendor(parent); 2635 cpi->hba_subdevice = pci_get_subdevice(parent); |
|
2631 cpi->ccb_h.status = CAM_REQ_CMP; 2632 break; 2633 } 2634 default: 2635 ccb->ccb_h.status = CAM_REQ_INVALID; 2636 break; 2637 } 2638 xpt_done(ccb); 2639} 2640 2641static void 2642ahcipoll(struct cam_sim *sim) 2643{ 2644 struct ahci_channel *ch = (struct ahci_channel *)cam_sim_softc(sim); 2645 2646 ahci_ch_intr(ch->dev); 2647} | 2636 cpi->ccb_h.status = CAM_REQ_CMP; 2637 break; 2638 } 2639 default: 2640 ccb->ccb_h.status = CAM_REQ_INVALID; 2641 break; 2642 } 2643 xpt_done(ccb); 2644} 2645 2646static void 2647ahcipoll(struct cam_sim *sim) 2648{ 2649 struct ahci_channel *ch = (struct ahci_channel *)cam_sim_softc(sim); 2650 2651 ahci_ch_intr(ch->dev); 2652} |