diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-sparc/bitext.h | 24 | ||||
| -rw-r--r-- | include/asm-sparc/iommu.h | 9 | ||||
| -rw-r--r-- | include/asm-sparc/pgtable.h | 28 | ||||
| -rw-r--r-- | include/asm-sparc/sbus.h | 2 |
4 files changed, 55 insertions, 8 deletions
diff --git a/include/asm-sparc/bitext.h b/include/asm-sparc/bitext.h new file mode 100644 index 000000000000..88b1518834a8 --- /dev/null +++ b/include/asm-sparc/bitext.h @@ -0,0 +1,24 @@ +/* + * bitext.h: Bit string operations on the sparc, specific to architecture. + * + * Copyright 2002 Pete Zaitcev <zaitcev@yahoo.com> + */ + +#ifndef _SPARC_BITEXT_H +#define _SPARC_BITEXT_H + +#include <linux/smp_lock.h> + +struct bit_map { + spinlock_t lock; + unsigned long *map; + int size; + int used; + int last_off; +}; + +extern int bit_map_string_get(struct bit_map *t, int len, int align); +extern void bit_map_clear(struct bit_map *t, int offset, int len); +extern void bit_map_init(struct bit_map *t, unsigned long *map, int size); + +#endif /* defined(_SPARC_BITEXT_H) */ diff --git a/include/asm-sparc/iommu.h b/include/asm-sparc/iommu.h index cf1d5b794833..8171362d56b9 100644 --- a/include/asm-sparc/iommu.h +++ b/include/asm-sparc/iommu.h @@ -6,6 +6,7 @@ #define _SPARC_IOMMU_H #include <asm/page.h> +#include <asm/bitext.h> /* The iommu handles all virtual to physical address translations * that occur between the SBUS and physical memory. Access by @@ -100,11 +101,11 @@ struct iommu_regs { struct iommu_struct { struct iommu_regs *regs; iopte_t *page_table; - iopte_t *lowest; /* to speed up searches... */ - unsigned long plow; /* For convenience */ unsigned long start; /* First managed virtual address */ unsigned long end; /* Last managed virtual address */ + + struct bit_map usemap; }; extern __inline__ void iommu_invalidate(struct iommu_regs *regs) @@ -112,9 +113,9 @@ extern __inline__ void iommu_invalidate(struct iommu_regs *regs) regs->tlbflush = 0; } -extern __inline__ void iommu_invalidate_page(struct iommu_regs *regs, unsigned long page) +extern __inline__ void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) { - regs->pageflush = (page & PAGE_MASK); + regs->pageflush = (ba & PAGE_MASK); } #endif /* !(_SPARC_IOMMU_H) */ diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index c25c0d4f7461..137421b5bdc4 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -27,6 +27,7 @@ #ifndef __ASSEMBLY__ struct vm_area_struct; +struct page; extern void load_mmu(void); extern unsigned long calc_highpages(void); @@ -51,15 +52,30 @@ BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct scatterlist *, int, struct s /* * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep. + * + * The mmu_map_dma_area establishes two mappings in one go. + * These mappings point to pages normally mapped at 'va' (linear address). + * First mapping is for CPU visible address at 'a', uncached. + * This is an alias, but it works because it is an uncached mapping. + * Second mapping is for device visible address, or "bus" address. + * The bus address is returned at '*pba'. + * + * These functions seem distinct, but are hard to split. On sun4c, + * at least for now, 'a' is equal to bus address, and retured in *pba. + * On sun4m, page attributes depend on the CPU type, so we have to + * know if we are mapping RAM or I/O, so it has to be an additional argument + * to a separate mapping function for CPU visible mappings. */ -BTFIXUPDEF_CALL(void, mmu_map_dma_area, unsigned long va, __u32 addr, int len) -BTFIXUPDEF_CALL(unsigned long /*phys*/, mmu_translate_dvma, unsigned long busa) +BTFIXUPDEF_CALL(int, mmu_map_dma_area, dma_addr_t *, unsigned long, unsigned long, int len) +BTFIXUPDEF_CALL(struct page *, mmu_translate_dvma, unsigned long busa) BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, unsigned long busa, int len) -#define mmu_map_dma_area(va, ba,len) BTFIXUP_CALL(mmu_map_dma_area)(va,ba,len) +#define mmu_map_dma_area(pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(pba,va,a,len) #define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len) #define mmu_translate_dvma(ba) BTFIXUP_CALL(mmu_translate_dvma)(ba) +/* + */ BTFIXUPDEF_SIMM13(pmd_shift) BTFIXUPDEF_SETHI(pmd_size) BTFIXUPDEF_SETHI(pmd_mask) @@ -377,6 +393,12 @@ BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, #define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte) +BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long, + unsigned long, unsigned int) +BTFIXUPDEF_CALL(void, sparc_unmapiorange, unsigned long, unsigned int) +#define sparc_mapiorange(bus,pa,va,len) BTFIXUP_CALL(sparc_mapiorange)(bus,pa,va,len) +#define sparc_unmapiorange(va,len) BTFIXUP_CALL(sparc_unmapiorange)(va,len) + extern int invalid_segment; /* Encode and de-code a swap entry */ diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h index bf09706e88ea..075c98e2bc56 100644 --- a/include/asm-sparc/sbus.h +++ b/include/asm-sparc/sbus.h @@ -10,7 +10,7 @@ #include <linux/ioport.h> #include <asm/oplib.h> -#include <asm/iommu.h> +/* #include <asm/iommu.h> */ /* Unused since we use opaque iommu (|io-unit) */ #include <asm/scatterlist.h> /* We scan which devices are on the SBus using the PROM node device |
