--- zzzz-none-000/linux-2.4.17/include/asm-mips64/pci.h 2001-10-12 22:35:54.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/include/asm-mips64/pci.h 2004-11-24 13:21:49.000000000 +0000 @@ -7,6 +7,8 @@ #define _ASM_PCI_H #include +#include +#include /* for virt_to_bus() */ #ifdef __KERNEL__ @@ -23,12 +25,12 @@ #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM 0x10000000 -extern inline void pcibios_set_master(struct pci_dev *dev) +static inline void pcibios_set_master(struct pci_dev *dev) { /* No special bus mastering setup handling */ } -extern inline void pcibios_penalize_isa_irq(int irq) +static inline void pcibios_penalize_isa_irq(int irq) { /* We don't do dynamic PCI IRQ allocation */ } @@ -101,7 +103,7 @@ if (direction == PCI_DMA_NONE) BUG(); -#ifndef CONFIG_COHERENT_IO +#ifdef CONFIG_NONCOHERENT_IO dma_cache_wback_inv((unsigned long)ptr, size); #endif return virt_to_bus(ptr); @@ -125,6 +127,35 @@ } /* + * pci_{map,unmap}_single_page maps a kernel page to a dma_addr_t. identical + * to pci_map_single, but takes a struct page instead of a virtual address + */ +static inline dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page, + unsigned long offset, size_t size, + int direction) +{ + unsigned long addr; + + if (direction == PCI_DMA_NONE) + BUG(); + + addr = (unsigned long) page_address(page) + offset; +#ifdef CONFIG_NONCOHERENT_IO + dma_cache_wback_inv(addr, size); +#endif + + return virt_to_bus(addr); +} + +static inline void pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address, + size_t size, int direction) +{ + if (direction == PCI_DMA_NONE) + BUG(); + /* Nothing to do */ +} + +/* * Map a set of buffers described by scatterlist in streaming * mode for DMA. This is the scather-gather version of the * above pci_map_single interface. Here the scatter gather list @@ -143,14 +174,16 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) { +#ifdef CONFIG_NONCOHERENT_IO int i; +#endif if (direction == PCI_DMA_NONE) BUG(); /* Make sure that gcc doesn't leave the empty loop body. */ for (i = 0; i < nents; i++, sg++) { -#ifndef CONFIG_COHERENT_IO +#ifdef CONFIG_NONCOHERENT_IO dma_cache_wback_inv((unsigned long)sg->address, sg->length); #endif sg->address = (char *)(bus_to_baddr[hwdev->bus->number] | __pa(sg->address)); @@ -189,7 +222,7 @@ { if (direction == PCI_DMA_NONE) BUG(); -#ifndef CONFIG_COHERENT_IO +#ifdef CONFIG_NONCOHERENT_IO dma_cache_wback_inv((unsigned long)__va(dma_handle - bus_to_baddr[hwdev->bus->number]), size); #endif } @@ -205,7 +238,7 @@ struct scatterlist *sg, int nelems, int direction) { -#ifndef CONFIG_COHERENT_IO +#ifdef CONFIG_NONCOHERENT_IO int i; #endif @@ -213,7 +246,7 @@ BUG(); /* Make sure that gcc doesn't leave the empty loop body. */ -#ifndef CONFIG_COHERENT_IO +#ifdef CONFIG_NONCOHERENT_IO for (i = 0; i < nelems; i++, sg++) dma_cache_wback_inv((unsigned long)sg->address, sg->length); #endif @@ -233,6 +266,40 @@ return 1; } +/* This is always fine. */ +/* Well ... this actually needs more thought ... */ +#define pci_dac_dma_supported(pci_dev, mask) (0) + +#if 0 +static __inline__ dma64_addr_t +pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction) +{ + return ((dma64_addr_t) page_to_bus(page) + + (dma64_addr_t) offset); +} + +static __inline__ struct page * +pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr) +{ + unsigned long poff = (dma_addr >> PAGE_SHIFT); + + return mem_map + poff; +} + +static __inline__ unsigned long +pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr) +{ + return (dma_addr & ~PAGE_MASK); +} + +static __inline__ void +pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, + size_t len, int direction) +{ + /* Nothing to do. */ +} +#endif + /* * Return the index of the PCI controller for device. */