diff options
Diffstat (limited to 'arch/sparc')
| -rw-r--r-- | arch/sparc/kernel/ebus.c | 1 | ||||
| -rw-r--r-- | arch/sparc/mm/init.c | 3 | ||||
| -rw-r--r-- | arch/sparc/mm/io-unit.c | 18 | ||||
| -rw-r--r-- | arch/sparc/mm/iommu.c | 12 | ||||
| -rw-r--r-- | arch/sparc/mm/sun4c.c | 2 |
5 files changed, 17 insertions, 19 deletions
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c index ac352eb6dff3..e2d02fd13f35 100644 --- a/arch/sparc/kernel/ebus.c +++ b/arch/sparc/kernel/ebus.c | |||
| @@ -238,6 +238,7 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d | |||
| 238 | sd = &dev->ofdev.dev.archdata; | 238 | sd = &dev->ofdev.dev.archdata; |
| 239 | sd->prom_node = dp; | 239 | sd->prom_node = dp; |
| 240 | sd->op = &dev->ofdev; | 240 | sd->op = &dev->ofdev; |
| 241 | sd->iommu = dev->bus->ofdev.dev.parent->archdata.iommu; | ||
| 241 | 242 | ||
| 242 | dev->ofdev.node = dp; | 243 | dev->ofdev.node = dp; |
| 243 | dev->ofdev.dev.parent = &dev->bus->ofdev.dev; | 244 | dev->ofdev.dev.parent = &dev->bus->ofdev.dev; |
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c index a1bef07755a9..c13e6cd279ac 100644 --- a/arch/sparc/mm/init.c +++ b/arch/sparc/mm/init.c | |||
| @@ -206,8 +206,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) | |||
| 206 | #ifdef CONFIG_BLK_DEV_INITRD | 206 | #ifdef CONFIG_BLK_DEV_INITRD |
| 207 | /* Now have to check initial ramdisk, so that bootmap does not overwrite it */ | 207 | /* Now have to check initial ramdisk, so that bootmap does not overwrite it */ |
| 208 | if (sparc_ramdisk_image) { | 208 | if (sparc_ramdisk_image) { |
| 209 | if (sparc_ramdisk_image >= (unsigned long)&_end - 2 * PAGE_SIZE) | 209 | sparc_ramdisk_image -= KERNBASE; |
| 210 | sparc_ramdisk_image -= KERNBASE; | ||
| 211 | initrd_start = sparc_ramdisk_image + phys_base; | 210 | initrd_start = sparc_ramdisk_image + phys_base; |
| 212 | initrd_end = initrd_start + sparc_ramdisk_size; | 211 | initrd_end = initrd_start + sparc_ramdisk_size; |
| 213 | if (initrd_end > end_of_phys_memory) { | 212 | if (initrd_end > end_of_phys_memory) { |
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 4ccda77d08d6..7c89893b1fe8 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c | |||
| @@ -66,7 +66,7 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus) | |||
| 66 | } | 66 | } |
| 67 | if(!xpt) panic("Cannot map External Page Table."); | 67 | if(!xpt) panic("Cannot map External Page Table."); |
| 68 | 68 | ||
| 69 | sbus->iommu = (struct iommu_struct *)iounit; | 69 | sbus->ofdev.dev.archdata.iommu = iounit; |
| 70 | iounit->page_table = xpt; | 70 | iounit->page_table = xpt; |
| 71 | spin_lock_init(&iounit->lock); | 71 | spin_lock_init(&iounit->lock); |
| 72 | 72 | ||
| @@ -127,7 +127,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan); | |||
| 127 | static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) | 127 | static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) |
| 128 | { | 128 | { |
| 129 | unsigned long ret, flags; | 129 | unsigned long ret, flags; |
| 130 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 130 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 131 | 131 | ||
| 132 | spin_lock_irqsave(&iounit->lock, flags); | 132 | spin_lock_irqsave(&iounit->lock, flags); |
| 133 | ret = iounit_get_area(iounit, (unsigned long)vaddr, len); | 133 | ret = iounit_get_area(iounit, (unsigned long)vaddr, len); |
| @@ -138,7 +138,7 @@ static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus | |||
| 138 | static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) | 138 | static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) |
| 139 | { | 139 | { |
| 140 | unsigned long flags; | 140 | unsigned long flags; |
| 141 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 141 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 142 | 142 | ||
| 143 | /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ | 143 | /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ |
| 144 | spin_lock_irqsave(&iounit->lock, flags); | 144 | spin_lock_irqsave(&iounit->lock, flags); |
| @@ -153,7 +153,7 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus | |||
| 153 | static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) | 153 | static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) |
| 154 | { | 154 | { |
| 155 | unsigned long flags; | 155 | unsigned long flags; |
| 156 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 156 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 157 | 157 | ||
| 158 | spin_lock_irqsave(&iounit->lock, flags); | 158 | spin_lock_irqsave(&iounit->lock, flags); |
| 159 | len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; | 159 | len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; |
| @@ -168,7 +168,7 @@ static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_ | |||
| 168 | { | 168 | { |
| 169 | unsigned long flags; | 169 | unsigned long flags; |
| 170 | unsigned long vaddr, len; | 170 | unsigned long vaddr, len; |
| 171 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 171 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 172 | 172 | ||
| 173 | spin_lock_irqsave(&iounit->lock, flags); | 173 | spin_lock_irqsave(&iounit->lock, flags); |
| 174 | while (sz != 0) { | 174 | while (sz != 0) { |
| @@ -211,7 +211,7 @@ static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, in | |||
| 211 | i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); | 211 | i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); |
| 212 | 212 | ||
| 213 | for_each_sbus(sbus) { | 213 | for_each_sbus(sbus) { |
| 214 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 214 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 215 | 215 | ||
| 216 | iopte = (iopte_t *)(iounit->page_table + i); | 216 | iopte = (iopte_t *)(iounit->page_table + i); |
| 217 | *iopte = MKIOPTE(__pa(page)); | 217 | *iopte = MKIOPTE(__pa(page)); |
| @@ -235,7 +235,7 @@ static void iounit_unmap_dma_area(unsigned long addr, int len) | |||
| 235 | static struct page *iounit_translate_dvma(unsigned long addr) | 235 | static struct page *iounit_translate_dvma(unsigned long addr) |
| 236 | { | 236 | { |
| 237 | struct sbus_bus *sbus = sbus_root; /* They are all the same */ | 237 | struct sbus_bus *sbus = sbus_root; /* They are all the same */ |
| 238 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 238 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 239 | int i; | 239 | int i; |
| 240 | iopte_t *iopte; | 240 | iopte_t *iopte; |
| 241 | 241 | ||
| @@ -279,7 +279,7 @@ __u32 iounit_map_dma_init(struct sbus_bus *sbus, int size) | |||
| 279 | unsigned long rotor, scan, limit; | 279 | unsigned long rotor, scan, limit; |
| 280 | unsigned long flags; | 280 | unsigned long flags; |
| 281 | __u32 ret; | 281 | __u32 ret; |
| 282 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 282 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 283 | 283 | ||
| 284 | npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT; | 284 | npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT; |
| 285 | i = 0x0213; | 285 | i = 0x0213; |
| @@ -315,7 +315,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan); | |||
| 315 | __u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus) | 315 | __u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus) |
| 316 | { | 316 | { |
| 317 | int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT; | 317 | int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT; |
| 318 | struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; | 318 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; |
| 319 | 319 | ||
| 320 | iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK)); | 320 | iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK)); |
| 321 | return vaddr + (((unsigned long)addr) & ~PAGE_MASK); | 321 | return vaddr + (((unsigned long)addr) & ~PAGE_MASK); |
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index be042efd1ba4..52e907af9d29 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c | |||
| @@ -132,7 +132,7 @@ iommu_init(int iommund, struct sbus_bus *sbus) | |||
| 132 | impl, vers, iommu->page_table, | 132 | impl, vers, iommu->page_table, |
| 133 | (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); | 133 | (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); |
| 134 | 134 | ||
| 135 | sbus->iommu = iommu; | 135 | sbus->ofdev.dev.archdata.iommu = iommu; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /* This begs to be btfixup-ed by srmmu. */ | 138 | /* This begs to be btfixup-ed by srmmu. */ |
| @@ -166,7 +166,7 @@ static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte) | |||
| 166 | 166 | ||
| 167 | static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) | 167 | static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) |
| 168 | { | 168 | { |
| 169 | struct iommu_struct *iommu = sbus->iommu; | 169 | struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu; |
| 170 | int ioptex; | 170 | int ioptex; |
| 171 | iopte_t *iopte, *iopte0; | 171 | iopte_t *iopte, *iopte0; |
| 172 | unsigned int busa, busa0; | 172 | unsigned int busa, busa0; |
| @@ -291,7 +291,7 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu | |||
| 291 | 291 | ||
| 292 | static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) | 292 | static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) |
| 293 | { | 293 | { |
| 294 | struct iommu_struct *iommu = sbus->iommu; | 294 | struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu; |
| 295 | int ioptex; | 295 | int ioptex; |
| 296 | int i; | 296 | int i; |
| 297 | 297 | ||
| @@ -334,7 +334,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va, | |||
| 334 | unsigned long addr, int len) | 334 | unsigned long addr, int len) |
| 335 | { | 335 | { |
| 336 | unsigned long page, end; | 336 | unsigned long page, end; |
| 337 | struct iommu_struct *iommu = sbus_root->iommu; | 337 | struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu; |
| 338 | iopte_t *iopte = iommu->page_table; | 338 | iopte_t *iopte = iommu->page_table; |
| 339 | iopte_t *first; | 339 | iopte_t *first; |
| 340 | int ioptex; | 340 | int ioptex; |
| @@ -399,7 +399,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va, | |||
| 399 | 399 | ||
| 400 | static void iommu_unmap_dma_area(unsigned long busa, int len) | 400 | static void iommu_unmap_dma_area(unsigned long busa, int len) |
| 401 | { | 401 | { |
| 402 | struct iommu_struct *iommu = sbus_root->iommu; | 402 | struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu; |
| 403 | iopte_t *iopte = iommu->page_table; | 403 | iopte_t *iopte = iommu->page_table; |
| 404 | unsigned long end; | 404 | unsigned long end; |
| 405 | int ioptex = (busa - iommu->start) >> PAGE_SHIFT; | 405 | int ioptex = (busa - iommu->start) >> PAGE_SHIFT; |
| @@ -420,7 +420,7 @@ static void iommu_unmap_dma_area(unsigned long busa, int len) | |||
| 420 | 420 | ||
| 421 | static struct page *iommu_translate_dvma(unsigned long busa) | 421 | static struct page *iommu_translate_dvma(unsigned long busa) |
| 422 | { | 422 | { |
| 423 | struct iommu_struct *iommu = sbus_root->iommu; | 423 | struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu; |
| 424 | iopte_t *iopte = iommu->page_table; | 424 | iopte_t *iopte = iommu->page_table; |
| 425 | 425 | ||
| 426 | iopte += ((busa - iommu->start) >> PAGE_SHIFT); | 426 | iopte += ((busa - iommu->start) >> PAGE_SHIFT); |
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 79d60d86f6f8..005a3e72d4f2 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c | |||
| @@ -268,7 +268,6 @@ static inline void sun4c_init_clean_mmu(unsigned long kernel_end) | |||
| 268 | unsigned char savectx, ctx; | 268 | unsigned char savectx, ctx; |
| 269 | 269 | ||
| 270 | savectx = sun4c_get_context(); | 270 | savectx = sun4c_get_context(); |
| 271 | kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); | ||
| 272 | for (ctx = 0; ctx < num_contexts; ctx++) { | 271 | for (ctx = 0; ctx < num_contexts; ctx++) { |
| 273 | sun4c_set_context(ctx); | 272 | sun4c_set_context(ctx); |
| 274 | for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE) | 273 | for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE) |
| @@ -2064,7 +2063,6 @@ void __init sun4c_paging_init(void) | |||
| 2064 | unsigned long end_pfn, pages_avail; | 2063 | unsigned long end_pfn, pages_avail; |
| 2065 | 2064 | ||
| 2066 | kernel_end = (unsigned long) &end; | 2065 | kernel_end = (unsigned long) &end; |
| 2067 | kernel_end += (SUN4C_REAL_PGDIR_SIZE * 4); | ||
| 2068 | kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); | 2066 | kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); |
| 2069 | 2067 | ||
| 2070 | pages_avail = 0; | 2068 | pages_avail = 0; |
