===== arch/ppc/kernel/setup.c 1.121 vs edited ===== --- 1.121/arch/ppc/kernel/setup.c Thu Jul 10 03:05:24 2003 +++ edited/arch/ppc/kernel/setup.c Wed Jul 16 01:45:02 2003 @@ -537,8 +537,12 @@ ppc_md.discover_root(); } +extern void init_irq_consistent_pool(void); + void __init ppc_init(void) { + init_irq_consistent_pool(); + /* clear the progress line */ if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff); ===== arch/ppc/mm/cachemap.c 1.13 vs edited ===== --- 1.13/arch/ppc/mm/cachemap.c Thu Feb 27 11:40:16 2003 +++ edited/arch/ppc/mm/cachemap.c Wed Jul 16 01:44:27 2003 @@ -53,6 +53,46 @@ extern int map_page(unsigned long va, phys_addr_t pa, int flags); +/* XXX ugly hack for sym_2 SCSI */ +#define IRQ_POOL_SIZE 20 +#define IRQ_POOL_PAGE_SIZE 0x1000 + +static spinlock_t irq_pool_lock = SPIN_LOCK_UNLOCKED; +static int irq_pool_idx = 0; +static struct irq_consistent_pool_entry_t { + void* va; + dma_addr_t dma; +} irq_pool[IRQ_POOL_SIZE]; + +static void* irq_consistent_alloc(size_t size, dma_addr_t *dma_handle){ + unsigned long flags; + void* res; + + spin_lock_irqsave(&irq_pool_lock, flags); + if (size == IRQ_POOL_PAGE_SIZE && irq_pool_idx < IRQ_POOL_SIZE){ + res = irq_pool[irq_pool_idx].va; + *dma_handle = irq_pool[irq_pool_idx].dma; + ++irq_pool_idx; + spin_unlock_irqrestore(&irq_pool_lock, flags); + } + else { + spin_unlock_irqrestore(&irq_pool_lock, flags); + res = 0; + } + + return res; +} + +void init_irq_consistent_pool(void){ + int i; + + if (in_interrupt()) + BUG(); + + for (i = 0; i < IRQ_POOL_SIZE; ++i) + irq_pool[i].va = consistent_alloc(GFP_KERNEL, IRQ_POOL_PAGE_SIZE, &(irq_pool[i].dma)); +} + /* This function will allocate the requested contiguous pages and * map them into the kernel's vmalloc() space. This is done so we * get unique mapping for these pages, outside of the kernel's 1:1 @@ -68,13 +108,13 @@ struct vm_struct *area; void *ret; - if (in_interrupt()) - BUG(); - /* Only allocate page size areas. */ size = PAGE_ALIGN(size); order = get_order(size); + + if (in_interrupt()) + return irq_consistent_alloc(size, dma_handle); page = __get_free_pages(gfp, order); if (!page) {