Skip to content

Commit 86bb854

Browse files
committed
parisc/agp: Use 64-bit LE values in SBA IOMMU PDIR table
The PDIR table of the System Bus Adapter (SBA) I/O MMU uses 64-bit little-endian pointers. Signed-off-by: Helge Deller <[email protected]> Cc: [email protected] # v6.4+
1 parent 9f5989d commit 86bb854

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/char/agp/parisc-agp.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static struct _parisc_agp_info {
3838

3939
int lba_cap_offset;
4040

41-
u64 *gatt;
41+
__le64 *gatt;
4242
u64 gatt_entries;
4343

4444
u64 gart_base;
@@ -104,7 +104,7 @@ parisc_agp_create_gatt_table(struct agp_bridge_data *bridge)
104104
int i;
105105

106106
for (i = 0; i < info->gatt_entries; i++) {
107-
info->gatt[i] = (unsigned long)agp_bridge->scratch_page;
107+
info->gatt[i] = cpu_to_le64(agp_bridge->scratch_page);
108108
}
109109

110110
return 0;
@@ -158,9 +158,9 @@ parisc_agp_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
158158
for (k = 0;
159159
k < info->io_pages_per_kpage;
160160
k++, j++, paddr += info->io_page_size) {
161-
info->gatt[j] =
161+
info->gatt[j] = cpu_to_le64(
162162
parisc_agp_mask_memory(agp_bridge,
163-
paddr, type);
163+
paddr, type));
164164
asm_io_fdc(&info->gatt[j]);
165165
}
166166
}
@@ -184,7 +184,7 @@ parisc_agp_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
184184
io_pg_start = info->io_pages_per_kpage * pg_start;
185185
io_pg_count = info->io_pages_per_kpage * mem->page_count;
186186
for (i = io_pg_start; i < io_pg_count + io_pg_start; i++) {
187-
info->gatt[i] = agp_bridge->scratch_page;
187+
info->gatt[i] = cpu_to_le64(agp_bridge->scratch_page);
188188
}
189189

190190
agp_bridge->driver->tlb_flush(mem);
@@ -204,7 +204,8 @@ parisc_agp_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr,
204204
pa |= (ci >> PAGE_SHIFT) & 0xff;/* move CI (8 bits) into lowest byte */
205205
pa |= SBA_PDIR_VALID_BIT; /* set "valid" bit */
206206

207-
return cpu_to_le64(pa);
207+
/* return native (big-endian) PDIR entry */
208+
return pa;
208209
}
209210

210211
static void
@@ -251,7 +252,8 @@ static int __init
251252
agp_ioc_init(void __iomem *ioc_regs)
252253
{
253254
struct _parisc_agp_info *info = &parisc_agp_info;
254-
u64 iova_base, *io_pdir, io_tlb_ps;
255+
u64 iova_base, io_tlb_ps;
256+
__le64 *io_pdir;
255257
int io_tlb_shift;
256258

257259
printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n");

0 commit comments

Comments
 (0)