AHCI driver with ASUS P5B
Hello Jeff,
first thank you for your great job on the AHCI linux kernel driver.
I have a problem with the detection of 2 of my 4 SATA ports on the mainboard (a P5B one), since ASUS implemented the last two as port 4 and 5 (started by zero) - so port 2 and 3 are physically unused.
Your driver reads a value of "4" and initializes only the first 4 ports and so ports 4 and 5 become unusable.
So I have a suggestion to support some boards with "incorrect" ports value in the controller register:
Add an extra kernel parameter (e.g. "ahci=<nr_of_ports>") and override these "autodetection" if such a kernel paramter is given.
I added a patch file, which implements this feature.
Regards,
Mathias
Signature · 4 lines
Mathias Jeschke home: http://www.informatik.hu-berlin.de/~jeschke/ mail: [email protected] gpg fingerprint: CF50 E22C 50F4 AF70 9628 7AB9 7E10 3A60 EAE5 4729
drivers/scsi/ahci.c +19 -1
@@ -201,6 +201,7 @@static u8 ahci_check_status (struct ata_port *ap);static inline int ahci_host_intr (struct ata_port *ap,struct ata_queued_cmd *qc);static void ahci_remove_one (struct pci_dev *pdev); +static u8 sata_phy_ports;static struct scsi_host_template ahci_sht = { .module =THIS_MODULE ,
@@ -1015,7 +1016,8 @@ hpriv->cap =readl (mmio +HOST_CAP ); hpriv->port_map =readl (mmio +HOST_PORTS_IMPL ); - probe_ent->n_ports = (hpriv->cap &0x1f ) +3 ; + probe_ent->n_ports = sata_phy_ports ? sata_phy_ports : (hpriv->cap &0x1f ) +1 ; +dev_printk (KERN_INFO , &pdev->dev,"override autodetection, use kernel paramter: ports=%u\n" , sata_phy_ports);VPRINTK ("cap 0x%x port_map 0x%x n_ports %d\n" , hpriv->cap, hpriv->port_map, probe_ent->n_ports);
@@ -1347,3 +1349,19 @@module_init (ahci_init);module_exit (ahci_exit); + +#if !defined(MODULE ) +static int __init ahci_setup (char *str) +{ +int ints[2 ]; + +get_options (str,ARRAY_SIZE (ints), ints); +if (ints[0 ] ==1 ) + sata_phy_ports = ints[1 ]; + +return 0 ; +} + +__setup ("ahci=" , ahci_setup); +#endif +