Author: mav Date: Wed Aug 12 19:11:53 2020 New Revision: 364177 URL: https://svnweb.freebsd.org/changeset/base/364177
Log: Report attachment for nvd same as reported for nda. MFC after: 1 week Modified: head/sys/dev/nvd/nvd.c Modified: head/sys/dev/nvd/nvd.c ============================================================================== --- head/sys/dev/nvd/nvd.c Wed Aug 12 18:45:36 2020 (r364176) +++ head/sys/dev/nvd/nvd.c Wed Aug 12 19:11:53 2020 (r364177) @@ -3,7 +3,7 @@ * * Copyright (C) 2012-2016 Intel Corporation * All rights reserved. - * Copyright (C) 2018 Alexander Motin <m...@freebsd.org> + * Copyright (C) 2018-2020 Alexander Motin <m...@freebsd.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,7 +45,10 @@ __FBSDID("$FreeBSD$"); #include <geom/geom_disk.h> #include <dev/nvme/nvme.h> +#include <dev/nvme/nvme_private.h> +#include <dev/pci/pcivar.h> + #define NVD_STR "nvd" struct nvd_disk; @@ -92,7 +95,7 @@ struct nvd_disk { }; struct nvd_controller { - + struct nvme_controller *ctrlr; TAILQ_ENTRY(nvd_controller) tailq; TAILQ_HEAD(, nvd_disk) disk_head; }; @@ -401,6 +404,7 @@ nvd_new_controller(struct nvme_controller *ctrlr) nvd_ctrlr = malloc(sizeof(struct nvd_controller), M_NVD, M_ZERO | M_WAITOK); + nvd_ctrlr->ctrlr = ctrlr; TAILQ_INIT(&nvd_ctrlr->disk_head); mtx_lock(&nvd_lock); TAILQ_INSERT_TAIL(&ctrlr_head, nvd_ctrlr, tailq); @@ -416,6 +420,7 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_ar struct nvd_disk *ndisk, *tnd; struct disk *disk; struct nvd_controller *ctrlr = ctrlr_arg; + device_t dev = ctrlr->ctrlr->dev; int unit; ndisk = malloc(sizeof(struct nvd_disk), M_NVD, M_ZERO | M_WAITOK); @@ -479,7 +484,13 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_ar NVME_MODEL_NUMBER_LENGTH); strlcpy(disk->d_descr, descr, sizeof(descr)); + 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); disk->d_rotation_rate = DISK_RR_NON_ROTATING; + strlcpy(disk->d_attachment, device_get_nameunit(dev), + sizeof(disk->d_attachment)); disk_create(disk, DISK_VERSION); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"