patch-2.4.19 linux-2.4.19/include/asm-mips64/pci.h

Next file: linux-2.4.19/include/asm-mips64/pgalloc.h
Previous file: linux-2.4.19/include/asm-mips64/pci/bridge.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/include/asm-mips64/pci.h linux-2.4.19/include/asm-mips64/pci.h
@@ -7,6 +7,8 @@
 #define _ASM_PCI_H
 
 #include <linux/config.h>
+#include <linux/types.h>
+#include <asm/io.h>			/* 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 */
 }
@@ -48,6 +50,13 @@
 struct pci_dev;
 
 /*
+ * The PCI address space does equal the physical memory address space.  The
+ * networking and block device layers use this boolean for bounce buffer
+ * decisions.
+ */
+#define PCI_DMA_BUS_IS_PHYS	(1)
+
+/*
  * Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices,
  * NULL for PCI-like buses (ISA, EISA).
@@ -113,9 +122,9 @@
 					size_t size, int direction)
 {
 	if (direction == PCI_DMA_NONE)
-		BUG();
+		out_of_line_bug();
 
-#ifndef CONFIG_COHERENT_IO
+#ifdef CONFIG_NONCOHERENT_IO
 	dma_cache_wback_inv((unsigned long)ptr, size);
 #endif
 	return virt_to_bus(ptr);
@@ -133,7 +142,7 @@
 				    size_t size, int direction)
 {
 	if (direction == PCI_DMA_NONE)
-		BUG();
+		out_of_line_bug();
 
 	/* Nothing to do */
 }
@@ -147,6 +156,35 @@
 #define pci_unmap_len_set(PTR, LEN_NAME, VAL)	do { } while (0)
 
 /*
+ * 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)
+		out_of_line_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)
+		out_of_line_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
@@ -168,14 +206,14 @@
 	int i;
 
 	if (direction == PCI_DMA_NONE)
-		BUG();
+		out_of_line_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));
+		sg->dma_address = (char *)(__pa(sg->address));
 	}
 
 	return nents;
@@ -190,7 +228,7 @@
 				int nents, int direction)
 {
 	if (direction == PCI_DMA_NONE)
-		BUG();
+		out_of_line_bug();
 
 	/* Nothing to do */
 }
@@ -210,8 +248,8 @@
 				       size_t size, int direction)
 {
 	if (direction == PCI_DMA_NONE)
-		BUG();
-#ifndef CONFIG_COHERENT_IO
+		out_of_line_bug();
+#ifdef CONFIG_NONCOHERENT_IO
 	dma_cache_wback_inv((unsigned long)__va(dma_handle - bus_to_baddr[hwdev->bus->number]), size);
 #endif
 }
@@ -227,15 +265,15 @@
 				   struct scatterlist *sg,
 				   int nelems, int direction)
 {
-#ifndef CONFIG_COHERENT_IO
+#ifdef CONFIG_NONCOHERENT_IO
 	int i;
 #endif
 
 	if (direction == PCI_DMA_NONE)
-		BUG();
+		out_of_line_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
@@ -255,6 +293,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.
  */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)