[parisc-linux-cvs] DIFF -pa5 sba_iommu.c and scatterlist.h
Grant Grundler
grundler@puffin.external.hp.com
Sat, 17 Nov 2001 00:50:14 -0700
Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.196
diff -u -p -r1.196 Makefile
--- Makefile 2001/11/17 02:10:44 1.196
+++ Makefile 2001/11/17 07:42:23
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 14
-EXTRAVERSION = -pa4
+EXTRAVERSION = -pa5
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
Index: arch/parisc/kernel/sba_iommu.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/sba_iommu.c,v
retrieving revision 1.59
diff -u -p -r1.59 sba_iommu.c
--- arch/parisc/kernel/sba_iommu.c 2001/11/15 08:07:15 1.59
+++ arch/parisc/kernel/sba_iommu.c 2001/11/17 07:42:24
@@ -422,7 +422,7 @@ sba_dump_sg( struct ioc *ioc, struct sca
nents,
(unsigned long) sg_dma_address(startsg),
sg_dma_len(startsg),
- startsg->address, startsg->length);
+ sg_virt_addr(startsg), startsg->length);
startsg++;
}
}
@@ -1038,13 +1038,13 @@ sba_fill_pdir(
printk(KERN_DEBUG " %2d : %08lx/%05x %p/%05x\n",
nents,
(unsigned long) sg_dma_address(startsg), cnt,
- startsg->address, startsg->length
+ sg_virt_address(startsg), startsg->length
);
#else
DBG_RUN_SG(" %d : %08lx/%05x %p/%05x\n",
nents,
(unsigned long) sg_dma_address(startsg), cnt,
- startsg->address, startsg->length
+ sg_virt_addr(startsg), startsg->length
);
#endif
/*
@@ -1064,7 +1064,7 @@ sba_fill_pdir(
** Look for a VCONTIG chunk
*/
if (cnt) {
- unsigned long vaddr = (unsigned long) startsg->address;
+ unsigned long vaddr = (unsigned long) sg_virt_addr(startsg);
ASSERT(pdirp);
/* Since multiple Vcontig blocks could make up
@@ -1130,14 +1130,15 @@ sba_coalesce_chunks( struct ioc *ioc,
int n_mappings = 0;
while (nents > 0) {
+ unsigned long vaddr = sg_virt_addr(startsg);
/*
** Prepare for first/next DMA stream
*/
dma_sg = vcontig_sg = startsg;
dma_len = vcontig_len = vcontig_end = startsg->length;
- vcontig_end += (unsigned long) startsg->address;
- dma_offset = (unsigned long) startsg->address & ~IOVP_MASK;
+ vcontig_end += vaddr;
+ dma_offset = vaddr & ~IOVP_MASK;
/* PARANOID: clear entries */
sg_dma_address(startsg) = 0;
@@ -1148,6 +1149,8 @@ sba_coalesce_chunks( struct ioc *ioc,
** it's always looking one "ahead".
*/
while (--nents > 0) {
+ unsigned long vaddr; /* tmp */
+
startsg++;
/* PARANOID: clear entries */
@@ -1172,7 +1175,8 @@ sba_coalesce_chunks( struct ioc *ioc,
**
** append the next transaction?
*/
- if (vcontig_end == (unsigned long) startsg->address)
+ vaddr = (unsigned long) sg_virt_addr(startsg);
+ if (vcontig_end == vaddr)
{
vcontig_len += startsg->length;
vcontig_end += startsg->length;
@@ -1204,9 +1208,9 @@ sba_coalesce_chunks( struct ioc *ioc,
** 3) do the entries end/start on page boundaries?
** Don't update vcontig_end until we've checked.
*/
- if (DMA_CONTIG(vcontig_end, startsg->address))
+ if (DMA_CONTIG(vcontig_end, vaddr))
{
- vcontig_end = vcontig_len + (unsigned long) startsg->address;
+ vcontig_end = vcontig_len + vaddr;
dma_len += vcontig_len;
continue;
} else {
@@ -1257,9 +1261,10 @@ sba_map_sg(struct pci_dev *dev, struct s
/* Fast path single entry scatterlists. */
if (nents == 1) {
- sg_dma_address(sglist)= sba_map_single(dev, sglist->address,
+ sg_dma_address(sglist) = sba_map_single(dev,
+ sg_virt_addr(sglist),
sglist->length, direction);
- sg_dma_len(sglist)= sglist->length;
+ sg_dma_len(sglist) = sglist->length;
return 1;
}
@@ -1332,7 +1337,7 @@ sba_unmap_sg(struct pci_dev *dev, struct
#endif
DBG_RUN_SG("%s() START %d entries, %p,%x\n",
- __FUNCTION__, nents, sglist->address, sglist->length);
+ __FUNCTION__, nents, sg_virt_addr(sglist), sglist->length);
ASSERT(dev->sysdata);
ioc = GET_IOC(dev);
Index: include/asm-parisc/scatterlist.h
===================================================================
RCS file: /var/cvs/linux/include/asm-parisc/scatterlist.h,v
retrieving revision 1.4
diff -u -p -r1.4 scatterlist.h
--- include/asm-parisc/scatterlist.h 2001/11/10 00:20:37 1.4
+++ include/asm-parisc/scatterlist.h 2001/11/17 07:42:24
@@ -7,9 +7,11 @@ struct scatterlist {
/* This will disappear in 2.5.x */
char *address;
- /* These two are only valid if ADDRESS member of this
- * struct is NULL.
- */
+ /* page/offset only valid if ADDRESS member is NULL.
+ ** Needed to support CONFIG_HIGHMEM on x386.
+ ** I still think davem is a dork for forcing other
+ ** arches to add this to 2.4.x. -ggg
+ */
struct page *page;
unsigned int offset;
@@ -19,6 +21,9 @@ struct scatterlist {
dma_addr_t iova; /* I/O Virtual Address */
__u32 iova_length; /* bytes mapped */
};
+
+#define sg_virt_addr(sg) (((sg)->address) ? ((sg)->address) : \
+ ((sg)->page->virtual + (sg)->offset))
#define sg_dma_address(sg) ((sg)->iova)
#define sg_dma_len(sg) ((sg)->iova_length)