]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aic7xxx/aic79xx_pci.c
[SCSI] aic79xx: user visible misuse wrong SI units (not disk size!)
[linux-2.6-omap-h63xx.git] / drivers / scsi / aic7xxx / aic79xx_pci.c
index c07735819cd1d1aba2f3cabe9085d9d4e0dc6414..a734d77e880efb2430795442d2e3e4c719259946 100644 (file)
@@ -88,7 +88,7 @@ ahd_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
 
 #define SUBID_9005_LEGACYCONN_FUNC(id) ((id) & 0x20)
 
-#define SUBID_9005_SEEPTYPE(id) ((id) & 0x0C0) >> 6)
+#define SUBID_9005_SEEPTYPE(id) (((id) & 0x0C0) >> 6)
 #define                SUBID_9005_SEEPTYPE_NONE        0x0
 #define                SUBID_9005_SEEPTYPE_4K          0x1
 
@@ -97,7 +97,7 @@ static ahd_device_setup_t ahd_aic7901A_setup;
 static ahd_device_setup_t ahd_aic7902_setup;
 static ahd_device_setup_t ahd_aic790X_setup;
 
-static struct ahd_pci_identity ahd_pci_ident_table [] =
+static const struct ahd_pci_identity ahd_pci_ident_table[] =
 {
        /* aic7901 based controllers */
        {
@@ -109,7 +109,13 @@ static struct ahd_pci_identity ahd_pci_ident_table [] =
        {
                ID_AHA_29320ALP,
                ID_ALL_MASK,
-               "Adaptec 29320ALP Ultra320 SCSI adapter",
+               "Adaptec 29320ALP PCIx Ultra320 SCSI adapter",
+               ahd_aic7901_setup
+       },
+       {
+               ID_AHA_29320LPE,
+               ID_ALL_MASK,
+               "Adaptec 29320LPE PCIe Ultra320 SCSI adapter",
                ahd_aic7901_setup
        },
        /* aic7901A based controllers */
@@ -217,10 +223,10 @@ static const char *pci_bus_modes[] =
        "PCI bus mode unknown",
        "PCI bus mode unknown",
        "PCI bus mode unknown",
-       "PCI-X 101-133Mhz",
-       "PCI-X 67-100Mhz",
-       "PCI-X 50-66Mhz",
-       "PCI 33 or 66Mhz"
+       "PCI-X 101-133MHz",
+       "PCI-X 67-100MHz",
+       "PCI-X 50-66MHz",
+       "PCI 33 or 66MHz"
 };
 
 #define                TESTMODE        0x00000800ul
@@ -247,7 +253,7 @@ static void ahd_configure_termination(struct ahd_softc *ahd,
 static void    ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat);
 static void    ahd_pci_intr(struct ahd_softc *ahd);
 
-struct ahd_pci_identity *
+const struct ahd_pci_identity *
 ahd_find_pci_device(ahd_dev_softc_t pci)
 {
        uint64_t  full_id;
@@ -255,7 +261,7 @@ ahd_find_pci_device(ahd_dev_softc_t pci)
        uint16_t  vendor;
        uint16_t  subdevice;
        uint16_t  subvendor;
-       struct    ahd_pci_identity *entry;
+       const struct ahd_pci_identity *entry;
        u_int     i;
 
        vendor = ahd_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2);
@@ -286,7 +292,7 @@ ahd_find_pci_device(ahd_dev_softc_t pci)
 }
 
 int
-ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)
+ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry)
 {
        struct scb_data *shared_scb_data;
        u_int            command;
@@ -331,8 +337,6 @@ ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)
         * 64bit bus (PCI64BIT set in devconfig).
         */
        if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) != 0) {
-               uint32_t devconfig;
-
                if (bootverbose)
                        printf("%s: Enabling 39Bit Addressing\n",
                               ahd_name(ahd));
@@ -383,6 +387,35 @@ ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)
        return error;
 }
 
+#ifdef CONFIG_PM
+void
+ahd_pci_suspend(struct ahd_softc *ahd)
+{
+       /*
+        * Save chip register configuration data for chip resets
+        * that occur during runtime and resume events.
+        */
+       ahd->suspend_state.pci_state.devconfig =
+           ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4);
+       ahd->suspend_state.pci_state.command =
+           ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/1);
+       ahd->suspend_state.pci_state.csize_lattime =
+           ahd_pci_read_config(ahd->dev_softc, CSIZE_LATTIME, /*bytes*/1);
+
+}
+
+void
+ahd_pci_resume(struct ahd_softc *ahd)
+{
+       ahd_pci_write_config(ahd->dev_softc, DEVCONFIG,
+                            ahd->suspend_state.pci_state.devconfig, /*bytes*/4);
+       ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND,
+                            ahd->suspend_state.pci_state.command, /*bytes*/1);
+       ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME,
+                            ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1);
+}
+#endif
+
 /*
  * Perform some simple tests that should catch situations where
  * our registers are invalidly mapped.
@@ -448,8 +481,6 @@ ahd_pci_test_register_access(struct ahd_softc *ahd)
                goto fail;
 
        if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) {
-               u_int targpcistat;
-
                ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
                targpcistat = ahd_inb(ahd, TARGPCISTAT);
                if ((targpcistat & STA) != 0)
@@ -944,7 +975,7 @@ ahd_aic790X_setup(struct ahd_softc *ahd)
                          |  AHD_FAINT_LED_BUG;
 
                /*
-                * IO Cell paramter setup.
+                * IO Cell parameter setup.
                 */
                AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29);
 
@@ -960,7 +991,7 @@ ahd_aic790X_setup(struct ahd_softc *ahd)
                              |  AHD_BUSFREEREV_BUG;
                ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG;
 
-               /* If the user requested the the SLOWCRC bit to be set. */
+               /* If the user requested that the SLOWCRC bit to be set. */
                if (aic79xx_slowcrc)
                        ahd->features |= AHD_AIC79XXB_SLOWCRC;
 
@@ -971,7 +1002,7 @@ ahd_aic790X_setup(struct ahd_softc *ahd)
                        ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG;
 
                /*
-                * IO Cell paramter setup.
+                * IO Cell parameter setup.
                 */
                AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29);
                AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB);