diff options
author | Ed Lin <ed.lin@promise.com> | 2006-12-04 20:49:39 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-12-05 12:33:24 -0500 |
commit | 94e9108b5ad8da9c02ebf5183b861f1717409555 (patch) | |
tree | b211ccc899f3bb59e9f3cbe009e75bc8c45c8622 /drivers | |
parent | ee926b27a01da1c1f0f0017c0e6af6e4fd6c05b5 (diff) |
[SCSI] stex: add new device type support
Add support for st_vsc1 type device (st_vsc is ok because it does not
require extra buffer).
Signed-off-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/stex.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 0fd115c04e59..bfd7983045b7 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -121,7 +121,8 @@ enum { | |||
121 | 121 | ||
122 | st_shasta = 0, | 122 | st_shasta = 0, |
123 | st_vsc = 1, | 123 | st_vsc = 1, |
124 | st_yosemite = 2, | 124 | st_vsc1 = 2, |
125 | st_yosemite = 3, | ||
125 | 126 | ||
126 | PASSTHRU_REQ_TYPE = 0x00000001, | 127 | PASSTHRU_REQ_TYPE = 0x00000001, |
127 | PASSTHRU_REQ_NO_WAKEUP = 0x00000100, | 128 | PASSTHRU_REQ_NO_WAKEUP = 0x00000100, |
@@ -151,6 +152,8 @@ enum { | |||
151 | MGT_CMD_SIGNATURE = 0xba, | 152 | MGT_CMD_SIGNATURE = 0xba, |
152 | 153 | ||
153 | INQUIRY_EVPD = 0x01, | 154 | INQUIRY_EVPD = 0x01, |
155 | |||
156 | ST_ADDITIONAL_MEM = 0x200000, | ||
154 | }; | 157 | }; |
155 | 158 | ||
156 | /* SCSI inquiry data */ | 159 | /* SCSI inquiry data */ |
@@ -212,7 +215,9 @@ struct handshake_frame { | |||
212 | __le32 partner_ver_minor; | 215 | __le32 partner_ver_minor; |
213 | __le32 partner_ver_oem; | 216 | __le32 partner_ver_oem; |
214 | __le32 partner_ver_build; | 217 | __le32 partner_ver_build; |
215 | u32 reserved1[4]; | 218 | __le32 extra_offset; /* NEW */ |
219 | __le32 extra_size; /* NEW */ | ||
220 | u32 reserved1[2]; | ||
216 | }; | 221 | }; |
217 | 222 | ||
218 | struct req_msg { | 223 | struct req_msg { |
@@ -303,6 +308,7 @@ struct st_hba { | |||
303 | void __iomem *mmio_base; /* iomapped PCI memory space */ | 308 | void __iomem *mmio_base; /* iomapped PCI memory space */ |
304 | void *dma_mem; | 309 | void *dma_mem; |
305 | dma_addr_t dma_handle; | 310 | dma_addr_t dma_handle; |
311 | size_t dma_size; | ||
306 | 312 | ||
307 | struct Scsi_Host *host; | 313 | struct Scsi_Host *host; |
308 | struct pci_dev *pdev; | 314 | struct pci_dev *pdev; |
@@ -941,6 +947,11 @@ static int stex_handshake(struct st_hba *hba) | |||
941 | h->status_cnt = cpu_to_le16(MU_STATUS_COUNT); | 947 | h->status_cnt = cpu_to_le16(MU_STATUS_COUNT); |
942 | stex_gettime(&h->hosttime); | 948 | stex_gettime(&h->hosttime); |
943 | h->partner_type = HMU_PARTNER_TYPE; | 949 | h->partner_type = HMU_PARTNER_TYPE; |
950 | if (hba->dma_size > STEX_BUFFER_SIZE) { | ||
951 | h->extra_offset = cpu_to_le32(STEX_BUFFER_SIZE); | ||
952 | h->extra_size = cpu_to_le32(ST_ADDITIONAL_MEM); | ||
953 | } else | ||
954 | h->extra_offset = h->extra_size = 0; | ||
944 | 955 | ||
945 | status_phys = hba->dma_handle + MU_REQ_BUFFER_SIZE; | 956 | status_phys = hba->dma_handle + MU_REQ_BUFFER_SIZE; |
946 | writel(status_phys, base + IMR0); | 957 | writel(status_phys, base + IMR0); |
@@ -1203,8 +1214,13 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1203 | goto out_iounmap; | 1214 | goto out_iounmap; |
1204 | } | 1215 | } |
1205 | 1216 | ||
1217 | hba->cardtype = (unsigned int) id->driver_data; | ||
1218 | if (hba->cardtype == st_vsc && (pdev->subsystem_device & 0xf) == 0x1) | ||
1219 | hba->cardtype = st_vsc1; | ||
1220 | hba->dma_size = (hba->cardtype == st_vsc1) ? | ||
1221 | (STEX_BUFFER_SIZE + ST_ADDITIONAL_MEM) : (STEX_BUFFER_SIZE); | ||
1206 | hba->dma_mem = dma_alloc_coherent(&pdev->dev, | 1222 | hba->dma_mem = dma_alloc_coherent(&pdev->dev, |
1207 | STEX_BUFFER_SIZE, &hba->dma_handle, GFP_KERNEL); | 1223 | hba->dma_size, &hba->dma_handle, GFP_KERNEL); |
1208 | if (!hba->dma_mem) { | 1224 | if (!hba->dma_mem) { |
1209 | err = -ENOMEM; | 1225 | err = -ENOMEM; |
1210 | printk(KERN_ERR DRV_NAME "(%s): dma mem alloc failed\n", | 1226 | printk(KERN_ERR DRV_NAME "(%s): dma mem alloc failed\n", |
@@ -1217,8 +1233,6 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1217 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; | 1233 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; |
1218 | hba->mu_status = MU_STATE_STARTING; | 1234 | hba->mu_status = MU_STATE_STARTING; |
1219 | 1235 | ||
1220 | hba->cardtype = (unsigned int) id->driver_data; | ||
1221 | |||
1222 | /* firmware uses id/lun pair for a logical drive, but lun would be | 1236 | /* firmware uses id/lun pair for a logical drive, but lun would be |
1223 | always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use | 1237 | always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use |
1224 | channel to map lun here */ | 1238 | channel to map lun here */ |
@@ -1266,7 +1280,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1266 | out_free_irq: | 1280 | out_free_irq: |
1267 | free_irq(pdev->irq, hba); | 1281 | free_irq(pdev->irq, hba); |
1268 | out_pci_free: | 1282 | out_pci_free: |
1269 | dma_free_coherent(&pdev->dev, STEX_BUFFER_SIZE, | 1283 | dma_free_coherent(&pdev->dev, hba->dma_size, |
1270 | hba->dma_mem, hba->dma_handle); | 1284 | hba->dma_mem, hba->dma_handle); |
1271 | out_iounmap: | 1285 | out_iounmap: |
1272 | iounmap(hba->mmio_base); | 1286 | iounmap(hba->mmio_base); |
@@ -1327,7 +1341,7 @@ static void stex_hba_free(struct st_hba *hba) | |||
1327 | 1341 | ||
1328 | pci_release_regions(hba->pdev); | 1342 | pci_release_regions(hba->pdev); |
1329 | 1343 | ||
1330 | dma_free_coherent(&hba->pdev->dev, STEX_BUFFER_SIZE, | 1344 | dma_free_coherent(&hba->pdev->dev, hba->dma_size, |
1331 | hba->dma_mem, hba->dma_handle); | 1345 | hba->dma_mem, hba->dma_handle); |
1332 | } | 1346 | } |
1333 | 1347 | ||