diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-sparc64/sbus.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-sparc64/sbus.h')
-rw-r--r-- | include/asm-sparc64/sbus.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h new file mode 100644 index 000000000000..48279e10f385 --- /dev/null +++ b/include/asm-sparc64/sbus.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* $Id: sbus.h,v 1.14 2000/02/18 13:50:55 davem Exp $ | ||
2 | * sbus.h: Defines for the Sun SBus. | ||
3 | * | ||
4 | * Copyright (C) 1996, 1999 David S. Miller (davem@redhat.com) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC64_SBUS_H | ||
8 | #define _SPARC64_SBUS_H | ||
9 | |||
10 | #include <linux/dma-mapping.h> | ||
11 | #include <linux/ioport.h> | ||
12 | |||
13 | #include <asm/oplib.h> | ||
14 | #include <asm/iommu.h> | ||
15 | #include <asm/scatterlist.h> | ||
16 | |||
17 | /* We scan which devices are on the SBus using the PROM node device | ||
18 | * tree. SBus devices are described in two different ways. You can | ||
19 | * either get an absolute address at which to access the device, or | ||
20 | * you can get a SBus 'slot' number and an offset within that slot. | ||
21 | */ | ||
22 | |||
23 | /* The base address at which to calculate device OBIO addresses. */ | ||
24 | #define SUN_SBUS_BVADDR 0x00000000 | ||
25 | #define SBUS_OFF_MASK 0x0fffffff | ||
26 | |||
27 | /* These routines are used to calculate device address from slot | ||
28 | * numbers + offsets, and vice versa. | ||
29 | */ | ||
30 | |||
31 | static __inline__ unsigned long sbus_devaddr(int slotnum, unsigned long offset) | ||
32 | { | ||
33 | return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<28)+(offset)); | ||
34 | } | ||
35 | |||
36 | static __inline__ int sbus_dev_slot(unsigned long dev_addr) | ||
37 | { | ||
38 | return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>28); | ||
39 | } | ||
40 | |||
41 | struct sbus_bus; | ||
42 | |||
43 | /* Linux SBUS device tables */ | ||
44 | struct sbus_dev { | ||
45 | struct sbus_bus *bus; /* Our toplevel parent SBUS */ | ||
46 | struct sbus_dev *next; /* Chain of siblings */ | ||
47 | struct sbus_dev *child; /* Chain of children */ | ||
48 | struct sbus_dev *parent;/* Parent device if not toplevel*/ | ||
49 | int prom_node; /* OBP node of this device */ | ||
50 | char prom_name[64]; /* OBP device name property */ | ||
51 | int slot; /* SBUS slot number */ | ||
52 | |||
53 | struct resource resource[PROMREG_MAX]; | ||
54 | |||
55 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; | ||
56 | int num_registers, ranges_applied; | ||
57 | |||
58 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; | ||
59 | int num_device_ranges; | ||
60 | |||
61 | unsigned int irqs[4]; | ||
62 | int num_irqs; | ||
63 | }; | ||
64 | |||
65 | /* This struct describes the SBus(s) found on this machine. */ | ||
66 | struct sbus_bus { | ||
67 | void *iommu; /* Opaque IOMMU cookie */ | ||
68 | struct sbus_dev *devices; /* Tree of SBUS devices */ | ||
69 | struct sbus_bus *next; /* Next SBUS in system */ | ||
70 | int prom_node; /* OBP node of SBUS */ | ||
71 | char prom_name[64]; /* Usually "sbus" or "sbi" */ | ||
72 | int clock_freq; | ||
73 | |||
74 | struct linux_prom_ranges sbus_ranges[PROMREG_MAX]; | ||
75 | int num_sbus_ranges; | ||
76 | |||
77 | int portid; | ||
78 | void *starfire_cookie; | ||
79 | }; | ||
80 | |||
81 | extern struct sbus_bus *sbus_root; | ||
82 | |||
83 | /* Device probing routines could find these handy */ | ||
84 | #define for_each_sbus(bus) \ | ||
85 | for((bus) = sbus_root; (bus); (bus)=(bus)->next) | ||
86 | |||
87 | #define for_each_sbusdev(device, bus) \ | ||
88 | for((device) = (bus)->devices; (device); (device)=(device)->next) | ||
89 | |||
90 | #define for_all_sbusdev(device, bus) \ | ||
91 | for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \ | ||
92 | for ((device) = (bus)->devices; (device); (device) = (device)->next) | ||
93 | |||
94 | /* Driver DVMA interfaces. */ | ||
95 | #define sbus_can_dma_64bit(sdev) (1) | ||
96 | #define sbus_can_burst64(sdev) (1) | ||
97 | extern void sbus_set_sbus64(struct sbus_dev *, int); | ||
98 | |||
99 | /* These yield IOMMU mappings in consistent mode. */ | ||
100 | extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); | ||
101 | extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t); | ||
102 | |||
103 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL | ||
104 | #define SBUS_DMA_TODEVICE DMA_TO_DEVICE | ||
105 | #define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE | ||
106 | #define SBUS_DMA_NONE DMA_NONE | ||
107 | |||
108 | /* All the rest use streaming mode mappings. */ | ||
109 | extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); | ||
110 | extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); | ||
111 | extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); | ||
112 | extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); | ||
113 | |||
114 | /* Finally, allow explicit synchronization of streamable mappings. */ | ||
115 | extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); | ||
116 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu | ||
117 | extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int); | ||
118 | extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int); | ||
119 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu | ||
120 | extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); | ||
121 | |||
122 | #endif /* !(_SPARC64_SBUS_H) */ | ||