Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68872
b: refs/heads/master
c: a9f4a59
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Wilcox authored and James Bottomley committed Oct 12, 2007
1 parent e78eb75 commit be8daba
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 167 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8e5152bf107d7b1b982e682b00a426b515bf15f
refs/heads/master: a9f4a59a949c5de6313dcf4ebe2f91448c008a37
219 changes: 53 additions & 166 deletions trunk/drivers/scsi/advansys.c
Original file line number Diff line number Diff line change
Expand Up @@ -12881,6 +12881,56 @@ AdvInitGetConfig(struct pci_dev *pdev, ADV_DVC_VAR *asc_dvc)
return warn_code;
}

static void AdvBuildCarrierFreelist(struct adv_dvc_var *asc_dvc)
{
ADV_CARR_T *carrp;
ADV_SDCNT buf_size;
ADV_PADDR carr_paddr;

BUG_ON(!asc_dvc->carrier_buf);

carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
asc_dvc->carr_freelist = NULL;
if (carrp == asc_dvc->carrier_buf) {
buf_size = ADV_CARRIER_BUFSIZE;
} else {
buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
}

do {
/* Get physical address of the carrier 'carrp'. */
ADV_DCNT contig_len = sizeof(ADV_CARR_T);
carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL,
(uchar *)carrp,
(ADV_SDCNT *)&contig_len,
ADV_IS_CARRIER_FLAG));

buf_size -= sizeof(ADV_CARR_T);

/*
* If the current carrier is not physically contiguous, then
* maybe there was a page crossing. Try the next carrier
* aligned start address.
*/
if (contig_len < sizeof(ADV_CARR_T)) {
carrp++;
continue;
}

carrp->carr_pa = carr_paddr;
carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));

/*
* Insert the carrier at the beginning of the freelist.
*/
carrp->next_vpa =
cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
asc_dvc->carr_freelist = carrp;

carrp++;
} while (buf_size > 0);
}

/*
* Initialize the ASC-3550.
*
Expand All @@ -12902,10 +12952,6 @@ static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc)
int word;
int j;
int adv_asc3550_expanded_size;
ADV_CARR_T *carrp;
ADV_DCNT contig_len;
ADV_SDCNT buf_size;
ADV_PADDR carr_paddr;
int i;
ushort scsi_cfg1;
uchar tid;
Expand Down Expand Up @@ -13307,57 +13353,7 @@ static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc)
AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));

/*
* Build carrier freelist.
*
* Driver must have already allocated memory and set 'carrier_buf'.
*/
ASC_ASSERT(asc_dvc->carrier_buf != NULL);

carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
asc_dvc->carr_freelist = NULL;
if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf) {
buf_size = ADV_CARRIER_BUFSIZE;
} else {
buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
}

do {
/*
* Get physical address of the carrier 'carrp'.
*/
contig_len = sizeof(ADV_CARR_T);
carr_paddr =
cpu_to_le32(DvcGetPhyAddr
(asc_dvc, NULL, (uchar *)carrp,
(ADV_SDCNT *)&contig_len,
ADV_IS_CARRIER_FLAG));

buf_size -= sizeof(ADV_CARR_T);

/*
* If the current carrier is not physically contiguous, then
* maybe there was a page crossing. Try the next carrier aligned
* start address.
*/
if (contig_len < sizeof(ADV_CARR_T)) {
carrp++;
continue;
}

carrp->carr_pa = carr_paddr;
carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));

/*
* Insert the carrier at the beginning of the freelist.
*/
carrp->next_vpa =
cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
asc_dvc->carr_freelist = carrp;

carrp++;
}
while (buf_size > 0);
AdvBuildCarrierFreelist(asc_dvc);

/*
* Set-up the Host->RISC Initiator Command Queue (ICQ).
Expand Down Expand Up @@ -13471,10 +13467,6 @@ static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *asc_dvc)
int word;
int j;
int adv_asc38C0800_expanded_size;
ADV_CARR_T *carrp;
ADV_DCNT contig_len;
ADV_SDCNT buf_size;
ADV_PADDR carr_paddr;
int i;
ushort scsi_cfg1;
uchar byte;
Expand Down Expand Up @@ -13920,57 +13912,7 @@ static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *asc_dvc)
AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));

/*
* Build the carrier freelist.
*
* Driver must have already allocated memory and set 'carrier_buf'.
*/
ASC_ASSERT(asc_dvc->carrier_buf != NULL);

carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
asc_dvc->carr_freelist = NULL;
if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf) {
buf_size = ADV_CARRIER_BUFSIZE;
} else {
buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
}

do {
/*
* Get physical address for the carrier 'carrp'.
*/
contig_len = sizeof(ADV_CARR_T);
carr_paddr =
cpu_to_le32(DvcGetPhyAddr
(asc_dvc, NULL, (uchar *)carrp,
(ADV_SDCNT *)&contig_len,
ADV_IS_CARRIER_FLAG));

buf_size -= sizeof(ADV_CARR_T);

/*
* If the current carrier is not physically contiguous, then
* maybe there was a page crossing. Try the next carrier aligned
* start address.
*/
if (contig_len < sizeof(ADV_CARR_T)) {
carrp++;
continue;
}

carrp->carr_pa = carr_paddr;
carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));

/*
* Insert the carrier at the beginning of the freelist.
*/
carrp->next_vpa =
cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
asc_dvc->carr_freelist = carrp;

carrp++;
}
while (buf_size > 0);
AdvBuildCarrierFreelist(asc_dvc);

/*
* Set-up the Host->RISC Initiator Command Queue (ICQ).
Expand Down Expand Up @@ -14087,10 +14029,6 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc)
long word;
int j;
int adv_asc38C1600_expanded_size;
ADV_CARR_T *carrp;
ADV_DCNT contig_len;
ADV_SDCNT buf_size;
ADV_PADDR carr_paddr;
int i;
ushort scsi_cfg1;
uchar byte;
Expand Down Expand Up @@ -14544,58 +14482,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc)
AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));

/*
* Build the carrier freelist.
*
* Driver must have already allocated memory and set 'carrier_buf'.
*/

ASC_ASSERT(asc_dvc->carrier_buf != NULL);

carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
asc_dvc->carr_freelist = NULL;
if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf) {
buf_size = ADV_CARRIER_BUFSIZE;
} else {
buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
}

do {
/*
* Get physical address for the carrier 'carrp'.
*/
contig_len = sizeof(ADV_CARR_T);
carr_paddr =
cpu_to_le32(DvcGetPhyAddr
(asc_dvc, NULL, (uchar *)carrp,
(ADV_SDCNT *)&contig_len,
ADV_IS_CARRIER_FLAG));

buf_size -= sizeof(ADV_CARR_T);

/*
* If the current carrier is not physically contiguous, then
* maybe there was a page crossing. Try the next carrier aligned
* start address.
*/
if (contig_len < sizeof(ADV_CARR_T)) {
carrp++;
continue;
}

carrp->carr_pa = carr_paddr;
carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));

/*
* Insert the carrier at the beginning of the freelist.
*/
carrp->next_vpa =
cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
asc_dvc->carr_freelist = carrp;

carrp++;
}
while (buf_size > 0);
AdvBuildCarrierFreelist(asc_dvc);

/*
* Set-up the Host->RISC Initiator Command Queue (ICQ).
Expand Down

0 comments on commit be8daba

Please sign in to comment.