aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/advansys.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2007-10-02 21:55:38 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:53:52 -0400
commitfd625f4705977de1ad00ac3cb519ec3ee8fd8598 (patch)
tree4f4e38fe30f39a7ca39a6171bf16683125defe0f /drivers/scsi/advansys.c
parent98d41c29a4b38c5b5e8ce5e13c4f3ac852615e0b (diff)
[SCSI] advansys: Remove DvcGetPhyAddr
This rather complex function boiled down to calling virt_to_bus(). Also get rid of some obsolete defines and variables that could never vary. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/advansys.c')
-rw-r--r--drivers/scsi/advansys.c73
1 files changed, 3 insertions, 70 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 0459c85b74b8..ab9108293d0f 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -992,19 +992,6 @@ typedef struct asc_mc_saved {
992#define ADV_MAX_SG_LIST 255 992#define ADV_MAX_SG_LIST 255
993#define NO_OF_SG_PER_BLOCK 15 993#define NO_OF_SG_PER_BLOCK 15
994 994
995/* Number of SG blocks needed. */
996#define ADV_NUM_SG_BLOCK \
997 ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK)
998
999/* Total contiguous memory needed for SG blocks. */
1000#define ADV_SG_TOTAL_MEM_SIZE \
1001 (sizeof(ADV_SG_BLOCK) * ADV_NUM_SG_BLOCK)
1002
1003#define ADV_PAGE_SIZE PAGE_SIZE
1004
1005#define ADV_NUM_PAGE_CROSSING \
1006 ((ADV_SG_TOTAL_MEM_SIZE + (ADV_PAGE_SIZE - 1))/ADV_PAGE_SIZE)
1007
1008#define ADV_EEP_DVC_CFG_BEGIN (0x00) 995#define ADV_EEP_DVC_CFG_BEGIN (0x00)
1009#define ADV_EEP_DVC_CFG_END (0x15) 996#define ADV_EEP_DVC_CFG_END (0x15)
1010#define ADV_EEP_DVC_CTL_BEGIN (0x16) /* location of OEM name */ 997#define ADV_EEP_DVC_CTL_BEGIN (0x16) /* location of OEM name */
@@ -1792,8 +1779,7 @@ typedef struct adv_carr_t {
1792#define ASC_GET_CARRP(carrp) ((carrp) & ASC_NEXT_VPA_MASK) 1779#define ASC_GET_CARRP(carrp) ((carrp) & ASC_NEXT_VPA_MASK)
1793 1780
1794#define ADV_CARRIER_NUM_PAGE_CROSSING \ 1781#define ADV_CARRIER_NUM_PAGE_CROSSING \
1795 (((ADV_CARRIER_COUNT * sizeof(ADV_CARR_T)) + \ 1782 (((ADV_CARRIER_COUNT * sizeof(ADV_CARR_T)) + (PAGE_SIZE - 1))/PAGE_SIZE)
1796 (ADV_PAGE_SIZE - 1))/ADV_PAGE_SIZE)
1797 1783
1798#define ADV_CARRIER_BUFSIZE \ 1784#define ADV_CARRIER_BUFSIZE \
1799 ((ADV_CARRIER_COUNT + ADV_CARRIER_NUM_PAGE_CROSSING) * sizeof(ADV_CARR_T)) 1785 ((ADV_CARRIER_COUNT + ADV_CARRIER_NUM_PAGE_CROSSING) * sizeof(ADV_CARR_T))
@@ -2174,16 +2160,6 @@ do { \
2174#define QHSTA_M_FROZEN_TIDQ 0x46 /* TID Queue frozen. */ 2160#define QHSTA_M_FROZEN_TIDQ 0x46 /* TID Queue frozen. */
2175#define QHSTA_M_SGBACKUP_ERROR 0x47 /* Scatter-Gather backup error */ 2161#define QHSTA_M_SGBACKUP_ERROR 0x47 /* Scatter-Gather backup error */
2176 2162
2177/*
2178 * DvcGetPhyAddr() flag arguments
2179 */
2180#define ADV_IS_SCSIQ_FLAG 0x01 /* 'addr' is ASC_SCSI_REQ_Q pointer */
2181#define ADV_ASCGETSGLIST_VADDR 0x02 /* 'addr' is AscGetSGList() virtual addr */
2182#define ADV_IS_SENSE_FLAG 0x04 /* 'addr' is sense virtual pointer */
2183#define ADV_IS_DATA_FLAG 0x08 /* 'addr' is data virtual pointer */
2184#define ADV_IS_SGLIST_FLAG 0x10 /* 'addr' is sglist virtual pointer */
2185#define ADV_IS_CARRIER_FLAG 0x20 /* 'addr' is ADV_CARR_T pointer */
2186
2187/* Return the address that is aligned at the next doubleword >= to 'addr'. */ 2163/* Return the address that is aligned at the next doubleword >= to 'addr'. */
2188#define ADV_8BALIGN(addr) (((ulong) (addr) + 0x7) & ~0x7) 2164#define ADV_8BALIGN(addr) (((ulong) (addr) + 0x7) & ~0x7)
2189#define ADV_16BALIGN(addr) (((ulong) (addr) + 0xF) & ~0xF) 2165#define ADV_16BALIGN(addr) (((ulong) (addr) + 0xF) & ~0xF)
@@ -6483,29 +6459,6 @@ static int AdvLoadMicrocode(AdvPortAddr iop_base, unsigned char *buf, int size,
6483 return 0; 6459 return 0;
6484} 6460}
6485 6461
6486/*
6487 * DvcGetPhyAddr()
6488 *
6489 * Return the physical address of 'vaddr' and set '*lenp' to the
6490 * number of physically contiguous bytes that follow 'vaddr'.
6491 * 'flag' indicates the type of structure whose physical address
6492 * is being translated.
6493 *
6494 * Note: Because Linux currently doesn't page the kernel and all
6495 * kernel buffers are physically contiguous, leave '*lenp' unchanged.
6496 */
6497ADV_PADDR
6498DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq,
6499 uchar *vaddr, ADV_SDCNT *lenp, int flag)
6500{
6501 ADV_PADDR paddr = virt_to_bus(vaddr);
6502
6503 ASC_DBG(4, "vaddr 0x%p, lenp 0x%p *lenp %lu, paddr 0x%lx\n",
6504 vaddr, lenp, (ulong)*((ulong *)lenp), (ulong)paddr);
6505
6506 return paddr;
6507}
6508
6509static void AdvBuildCarrierFreelist(struct adv_dvc_var *asc_dvc) 6462static void AdvBuildCarrierFreelist(struct adv_dvc_var *asc_dvc)
6510{ 6463{
6511 ADV_CARR_T *carrp; 6464 ADV_CARR_T *carrp;
@@ -6522,24 +6475,10 @@ static void AdvBuildCarrierFreelist(struct adv_dvc_var *asc_dvc)
6522 6475
6523 do { 6476 do {
6524 /* Get physical address of the carrier 'carrp'. */ 6477 /* Get physical address of the carrier 'carrp'. */
6525 ADV_DCNT contig_len = sizeof(ADV_CARR_T); 6478 carr_paddr = cpu_to_le32(virt_to_bus(carrp));
6526 carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL,
6527 (uchar *)carrp,
6528 (ADV_SDCNT *)&contig_len,
6529 ADV_IS_CARRIER_FLAG));
6530 6479
6531 buf_size -= sizeof(ADV_CARR_T); 6480 buf_size -= sizeof(ADV_CARR_T);
6532 6481
6533 /*
6534 * If the current carrier is not physically contiguous, then
6535 * maybe there was a page crossing. Try the next carrier
6536 * aligned start address.
6537 */
6538 if (contig_len < sizeof(ADV_CARR_T)) {
6539 carrp++;
6540 continue;
6541 }
6542
6543 carrp->carr_pa = carr_paddr; 6482 carrp->carr_pa = carr_paddr;
6544 carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp)); 6483 carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));
6545 6484
@@ -10915,7 +10854,6 @@ static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq)
10915static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq) 10854static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq)
10916{ 10855{
10917 AdvPortAddr iop_base; 10856 AdvPortAddr iop_base;
10918 ADV_DCNT req_size;
10919 ADV_PADDR req_paddr; 10857 ADV_PADDR req_paddr;
10920 ADV_CARR_T *new_carrp; 10858 ADV_CARR_T *new_carrp;
10921 10859
@@ -10953,13 +10891,8 @@ static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq)
10953 */ 10891 */
10954 scsiq->a_flag &= ~ADV_SCSIQ_DONE; 10892 scsiq->a_flag &= ~ADV_SCSIQ_DONE;
10955 10893
10956 req_size = sizeof(ADV_SCSI_REQ_Q); 10894 req_paddr = virt_to_bus(scsiq);
10957 req_paddr = DvcGetPhyAddr(asc_dvc, scsiq, (uchar *)scsiq,
10958 (ADV_SDCNT *)&req_size, ADV_IS_SCSIQ_FLAG);
10959
10960 BUG_ON(req_paddr & 31); 10895 BUG_ON(req_paddr & 31);
10961 BUG_ON(req_size < sizeof(ADV_SCSI_REQ_Q));
10962
10963 /* Wait for assertion before making little-endian */ 10896 /* Wait for assertion before making little-endian */
10964 req_paddr = cpu_to_le32(req_paddr); 10897 req_paddr = cpu_to_le32(req_paddr);
10965 10898