Author: mav
Date: Thu Jul  7 22:10:10 2016
New Revision: 302402
URL: https://svnweb.freebsd.org/changeset/base/302402

Log:
  Fix ahci(4) driver attach to controller with 32 ports.
  
  Incorrect sign expansion in variables that supposed to be a bit fields
  caused infinite loop.  Fixing this allows system properly detect maximal
  possible 32 devices configured on AHCI HBA of BHyVe.  That case did not
  happen in a wild before due to lack of hardware AHCI HBAs with 32 ports.
  
  Approved by:  re (gjb@)
  MFC after:    1 week

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahci.h

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c    Thu Jul  7 21:44:59 2016        (r302401)
+++ head/sys/dev/ahci/ahci.c    Thu Jul  7 22:10:10 2016        (r302402)
@@ -166,8 +166,8 @@ int
 ahci_attach(device_t dev)
 {
        struct ahci_controller *ctlr = device_get_softc(dev);
-       int error, i, u, speed, unit;
-       u_int32_t version;
+       int error, i, speed, unit;
+       uint32_t u, version;
        device_t child;
 
        ctlr->dev = dev;

Modified: head/sys/dev/ahci/ahci.h
==============================================================================
--- head/sys/dev/ahci/ahci.h    Thu Jul  7 21:44:59 2016        (r302401)
+++ head/sys/dev/ahci/ahci.h    Thu Jul  7 22:10:10 2016        (r302402)
@@ -474,7 +474,7 @@ struct ahci_enclosure {
        uint8_t                 status[AHCI_MAX_PORTS][4]; /* ArrayDev statuses 
*/
        int                     quirks;
        int                     channels;
-       int                     ichannels;
+       uint32_t                ichannels;
 };
 
 /* structure describing a AHCI controller */
@@ -509,7 +509,7 @@ struct ahci_controller {
        int                     quirks;
        int                     numirqs;
        int                     channels;
-       int                     ichannels;
+       uint32_t                ichannels;
        int                     ccc;            /* CCC timeout */
        int                     cccv;           /* CCC vector */
        int                     direct;         /* Direct command completion */
_______________________________________________
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"

Reply via email to