@@ -1495,7 +1495,7 @@ static irqreturn_t ahci_thunderx_irq_handler(int irq, void *dev_instance)
1495
1495
static void ahci_remap_check (struct pci_dev * pdev , int bar ,
1496
1496
struct ahci_host_priv * hpriv )
1497
1497
{
1498
- int i , count = 0 ;
1498
+ int i ;
1499
1499
u32 cap ;
1500
1500
1501
1501
/*
@@ -1516,13 +1516,14 @@ static void ahci_remap_check(struct pci_dev *pdev, int bar,
1516
1516
continue ;
1517
1517
1518
1518
/* We've found a remapped device */
1519
- count ++ ;
1519
+ hpriv -> remapped_nvme ++ ;
1520
1520
}
1521
1521
1522
- if (!count )
1522
+ if (!hpriv -> remapped_nvme )
1523
1523
return ;
1524
1524
1525
- dev_warn (& pdev -> dev , "Found %d remapped NVMe devices.\n" , count );
1525
+ dev_warn (& pdev -> dev , "Found %u remapped NVMe devices.\n" ,
1526
+ hpriv -> remapped_nvme );
1526
1527
dev_warn (& pdev -> dev ,
1527
1528
"Switch your BIOS from RAID to AHCI mode to use them.\n" );
1528
1529
@@ -1642,6 +1643,18 @@ static void ahci_intel_pcs_quirk(struct pci_dev *pdev, struct ahci_host_priv *hp
1642
1643
}
1643
1644
}
1644
1645
1646
+ static ssize_t remapped_nvme_show (struct device * dev ,
1647
+ struct device_attribute * attr ,
1648
+ char * buf )
1649
+ {
1650
+ struct ata_host * host = dev_get_drvdata (dev );
1651
+ struct ahci_host_priv * hpriv = host -> private_data ;
1652
+
1653
+ return sprintf (buf , "%u\n" , hpriv -> remapped_nvme );
1654
+ }
1655
+
1656
+ static DEVICE_ATTR_RO (remapped_nvme );
1657
+
1645
1658
static int ahci_init_one (struct pci_dev * pdev , const struct pci_device_id * ent )
1646
1659
{
1647
1660
unsigned int board_id = ent -> driver_data ;
@@ -1745,6 +1758,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1745
1758
/* detect remapped nvme devices */
1746
1759
ahci_remap_check (pdev , ahci_pci_bar , hpriv );
1747
1760
1761
+ sysfs_add_file_to_group (& pdev -> dev .kobj ,
1762
+ & dev_attr_remapped_nvme .attr ,
1763
+ NULL );
1764
+
1748
1765
/* must set flag prior to save config in order to take effect */
1749
1766
if (ahci_broken_devslp (pdev ))
1750
1767
hpriv -> flags |= AHCI_HFLAG_NO_DEVSLP ;
@@ -1896,6 +1913,9 @@ static void ahci_shutdown_one(struct pci_dev *pdev)
1896
1913
1897
1914
static void ahci_remove_one (struct pci_dev * pdev )
1898
1915
{
1916
+ sysfs_remove_file_from_group (& pdev -> dev .kobj ,
1917
+ & dev_attr_remapped_nvme .attr ,
1918
+ NULL );
1899
1919
pm_runtime_get_noresume (& pdev -> dev );
1900
1920
ata_pci_remove_one (pdev );
1901
1921
}
0 commit comments