summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2010-07-25 15:43:52 +0000
committermav <mav@FreeBSD.org>2010-07-25 15:43:52 +0000
commit68b26f66494feb7f028f26e91a6756e69b2ba395 (patch)
tree17a1e011d37cb64ccedab6ec54cdbac15a501c84 /sys/dev
parente67ee04556273868e17fd2c1a6791f8246d0a48f (diff)
downloadFreeBSD-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')
-rw-r--r--sys/dev/ahci/ahci.c9
-rw-r--r--sys/dev/ata/ata-all.c11
-rw-r--r--sys/dev/ata/ata-disk.c13
-rw-r--r--sys/dev/mvs/mvs.c10
-rw-r--r--sys/dev/siis/siis.c9
5 files changed, 46 insertions, 6 deletions
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index 9de7740..2f53f82 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -2459,7 +2459,7 @@ ahci_check_ids(device_t dev, union ccb *ccb)
static void
ahciaction(struct cam_sim *sim, union ccb *ccb)
{
- device_t dev;
+ device_t dev, parent;
struct ahci_channel *ch;
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ahciaction func_code=%x\n",
@@ -2599,6 +2599,7 @@ ahciaction(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;
if (ch->caps & AHCI_CAP_SNCQ)
@@ -2626,8 +2627,12 @@ ahciaction(struct cam_sim *sim, union ccb *ccb)
cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
cpi->maxio = MAXPHYS;
/* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */
- if (pci_get_devid(device_get_parent(dev)) == 0x43801002)
+ if (pci_get_devid(parent) == 0x43801002)
cpi->maxio = min(cpi->maxio, 128 * 512);
+ 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-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));
diff --git a/sys/dev/mvs/mvs.c b/sys/dev/mvs/mvs.c
index a7800ec..6b08222 100644
--- a/sys/dev/mvs/mvs.c
+++ b/sys/dev/mvs/mvs.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <dev/pci/pcivar.h>
#include "mvs.h"
#include <cam/cam.h>
@@ -2017,7 +2018,7 @@ mvs_check_ids(device_t dev, union ccb *ccb)
static void
mvsaction(struct cam_sim *sim, union ccb *ccb)
{
- device_t dev;
+ device_t dev, parent;
struct mvs_channel *ch;
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("mvsaction func_code=%x\n",
@@ -2152,6 +2153,7 @@ mvsaction(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;
if (!(ch->quirks & MVS_Q_GENI)) {
@@ -2180,6 +2182,12 @@ mvsaction(struct cam_sim *sim, union ccb *ccb)
cpi->protocol = PROTO_ATA;
cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
cpi->maxio = MAXPHYS;
+ if ((ch->quirks & MVS_Q_SOC) == 0) {
+ 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/siis/siis.c b/sys/dev/siis/siis.c
index 6b25d4b..34a77fc 100644
--- a/sys/dev/siis/siis.c
+++ b/sys/dev/siis/siis.c
@@ -1677,7 +1677,7 @@ siis_check_ids(device_t dev, union ccb *ccb)
static void
siisaction(struct cam_sim *sim, union ccb *ccb)
{
- device_t dev;
+ device_t dev, parent;
struct siis_channel *ch;
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("siisaction func_code=%x\n",
@@ -1816,6 +1816,7 @@ siisaction(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 | PI_TAG_ABLE;
cpi->hba_inquiry |= PI_SATAPM;
@@ -1835,8 +1836,12 @@ siisaction(struct cam_sim *sim, union ccb *ccb)
cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
cpi->protocol = PROTO_ATA;
cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
- cpi->ccb_h.status = CAM_REQ_CMP;
cpi->maxio = MAXPHYS;
+ 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;
}
default:
OpenPOWER on IntegriCloud