diff options
author | mav <mav@FreeBSD.org> | 2010-07-25 15:43:52 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2010-07-25 15:43:52 +0000 |
commit | 68b26f66494feb7f028f26e91a6756e69b2ba395 (patch) | |
tree | 17a1e011d37cb64ccedab6ec54cdbac15a501c84 /sys/dev/ata | |
parent | e67ee04556273868e17fd2c1a6791f8246d0a48f (diff) | |
download | FreeBSD-src-68b26f66494feb7f028f26e91a6756e69b2ba395.zip FreeBSD-src-68b26f66494feb7f028f26e91a6756e69b2ba395.tar.gz |
Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers to
GEOM. This information needed for proper soft-RAID's on-disk metadata
reading and writing.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-all.c | 11 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 13 |
2 files changed, 23 insertions, 1 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 3f7f1a9..8c0ea9d 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <sys/rman.h> #include <dev/ata/ata-all.h> +#include <dev/pci/pcivar.h> #include <ata_if.h> #ifdef ATA_CAM @@ -1523,7 +1524,7 @@ ata_check_ids(device_t dev, union ccb *ccb) static void ataaction(struct cam_sim *sim, union ccb *ccb) { - device_t dev; + device_t dev, parent; struct ata_channel *ch; CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ataaction func_code=%x\n", @@ -1674,6 +1675,7 @@ ataaction(struct cam_sim *sim, union ccb *ccb) { struct ccb_pathinq *cpi = &ccb->cpi; + parent = device_get_parent(dev); cpi->version_num = 1; /* XXX??? */ cpi->hba_inquiry = PI_SDTR_ABLE; cpi->target_sprt = 0; @@ -1702,6 +1704,13 @@ ataaction(struct cam_sim *sim, union ccb *ccb) cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; + if (device_get_devclass(device_get_parent(parent)) == + devclass_find("pci")) { + cpi->hba_vendor = pci_get_vendor(parent); + cpi->hba_device = pci_get_device(parent); + cpi->hba_subvendor = pci_get_subvendor(parent); + cpi->hba_subdevice = pci_get_subdevice(parent); + } cpi->ccb_h.status = CAM_REQ_CMP; break; } diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 722bce5d..67e092e 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <dev/ata/ata-pci.h> #include <dev/ata/ata-disk.h> #include <dev/ata/ata-raid.h> +#include <dev/pci/pcivar.h> #include <ata_if.h> /* prototypes */ @@ -94,6 +95,7 @@ ad_attach(device_t dev) struct ata_channel *ch = device_get_softc(device_get_parent(dev)); struct ata_device *atadev = device_get_softc(dev); struct ad_softc *adp; + device_t parent; /* check that we have a virgin disk to attach */ if (device_get_ivars(dev)) @@ -143,6 +145,17 @@ ad_attach(device_t dev) adp->disk->d_flags |= DISKFLAG_CANDELETE; strlcpy(adp->disk->d_ident, atadev->param.serial, sizeof(adp->disk->d_ident)); + parent = device_get_parent(ch->dev); + if (parent != NULL && device_get_parent(parent) != NULL && + (device_get_devclass(parent) == + devclass_find("atapci") || + device_get_devclass(device_get_parent(parent)) == + devclass_find("pci"))) { + adp->disk->d_hba_vendor = pci_get_vendor(parent); + adp->disk->d_hba_device = pci_get_device(parent); + adp->disk->d_hba_subvendor = pci_get_subvendor(parent); + adp->disk->d_hba_subdevice = pci_get_subdevice(parent); + } ata_disk_firmware_geom_adjust(adp->disk); disk_create(adp->disk, DISK_VERSION); device_add_child(dev, "subdisk", device_get_unit(dev)); |