Page MenuHomeFreeBSD

Command-Line Input

Authored By
jrtc27
Aug 29 2024, 9:39 PM
Size
3 KB
Referenced Files
None
Subscribers
None

Command-Line Input

diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c
index e903e15c16f1..ffabd757d969 100644
--- a/sys/dev/nvd/nvd.c
+++ b/sys/dev/nvd/nvd.c
@@ -418,7 +418,7 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg)
struct nvd_disk *ndisk, *tnd;
struct disk *disk;
struct nvd_controller *ctrlr = ctrlr_arg;
- device_t dev = ctrlr->ctrlr->dev;
+ device_t dev = ctrlr->ctrlr->dev, pcidev;
int unit;
ndisk = malloc(sizeof(struct nvd_disk), M_NVD, M_ZERO | M_WAITOK);
@@ -492,11 +492,13 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg)
* the AHCI controller's data.
*/
if (ctrlr->ctrlr->quirks & QUIRK_AHCI)
- dev = device_get_parent(dev);
- disk->d_hba_vendor = pci_get_vendor(dev);
- disk->d_hba_device = pci_get_device(dev);
- disk->d_hba_subvendor = pci_get_subvendor(dev);
- disk->d_hba_subdevice = pci_get_subdevice(dev);
+ pcidev = device_get_parent(dev);
+ else
+ pcidev = dev;
+ disk->d_hba_vendor = pci_get_vendor(pcidev);
+ disk->d_hba_device = pci_get_device(pcidev);
+ disk->d_hba_subvendor = pci_get_subvendor(pcidev);
+ disk->d_hba_subdevice = pci_get_subdevice(pcidev);
disk->d_rotation_rate = DISK_RR_NON_ROTATING;
disk_create(disk, DISK_VERSION);
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
index 2ba3df9ea6e8..660657edaceb 100644
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -169,7 +169,7 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb)
case XPT_PATH_INQ: /* Path routing inquiry */
{
struct ccb_pathinq *cpi = &ccb->cpi;
- device_t dev = ctrlr->dev;
+ device_t dev = ctrlr->dev, pcidev;
/*
* For devices that are reported as children of the AHCI
@@ -177,7 +177,9 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb)
* controller, report the AHCI controller's data.
*/
if (ctrlr->quirks & QUIRK_AHCI)
- dev = device_get_parent(dev);
+ pcidev = device_get_parent(dev);
+ else
+ pcidev = dev;
cpi->version_num = 1;
cpi->hba_inquiry = 0;
cpi->target_sprt = 0;
@@ -198,17 +200,17 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb)
cpi->protocol = PROTO_NVME;
cpi->protocol_version = nvme_mmio_read_4(ctrlr, vs);
cpi->xport_specific.nvme.nsid = xpt_path_lun_id(ccb->ccb_h.path);
- cpi->xport_specific.nvme.domain = pci_get_domain(dev);
- cpi->xport_specific.nvme.bus = pci_get_bus(dev);
- cpi->xport_specific.nvme.slot = pci_get_slot(dev);
- cpi->xport_specific.nvme.function = pci_get_function(dev);
+ cpi->xport_specific.nvme.domain = pci_get_domain(pcidev);
+ cpi->xport_specific.nvme.bus = pci_get_bus(pcidev);
+ cpi->xport_specific.nvme.slot = pci_get_slot(pcidev);
+ cpi->xport_specific.nvme.function = pci_get_function(pcidev);
cpi->xport_specific.nvme.extra = 0;
strlcpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(dev),
sizeof(cpi->xport_specific.nvme.dev_name));
- cpi->hba_vendor = pci_get_vendor(dev);
- cpi->hba_device = pci_get_device(dev);
- cpi->hba_subvendor = pci_get_subvendor(dev);
- cpi->hba_subdevice = pci_get_subdevice(dev);
+ cpi->hba_vendor = pci_get_vendor(pcidev);
+ cpi->hba_device = pci_get_device(pcidev);
+ cpi->hba_subvendor = pci_get_subvendor(pcidev);
+ cpi->hba_subdevice = pci_get_subdevice(pcidev);
cpi->ccb_h.status = CAM_REQ_CMP;
break;
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
11238739
Default Alt Text
Command-Line Input (3 KB)

Event Timeline