diff options
author | David S. Miller <davem@davemloft.net> | 2006-06-23 18:55:45 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-24 02:15:50 -0400 |
commit | 576c352e89e57cfa6c9f493e549d10d86f60a0cf (patch) | |
tree | 4f393f05beef86284a037b106bfb353ff0d72c8a /include/asm-sparc64/sbus.h | |
parent | fd5314311634245172d40ccb418d89dac91d6ad6 (diff) |
[SBUS]: Rewrite and plug into of_device framework.
I severely apologize, I was still learning how to program
in C when I wrote this stuff 10 years ago...
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/sbus.h')
-rw-r--r-- | include/asm-sparc64/sbus.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h index ca2054da2430..56ee985e4605 100644 --- a/include/asm-sparc64/sbus.h +++ b/include/asm-sparc64/sbus.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <linux/ioport.h> | 11 | #include <linux/ioport.h> |
12 | 12 | ||
13 | #include <asm/oplib.h> | 13 | #include <asm/oplib.h> |
14 | #include <asm/prom.h> | ||
15 | #include <asm/of_device.h> | ||
14 | #include <asm/iommu.h> | 16 | #include <asm/iommu.h> |
15 | #include <asm/scatterlist.h> | 17 | #include <asm/scatterlist.h> |
16 | 18 | ||
@@ -42,18 +44,19 @@ struct sbus_bus; | |||
42 | 44 | ||
43 | /* Linux SBUS device tables */ | 45 | /* Linux SBUS device tables */ |
44 | struct sbus_dev { | 46 | struct sbus_dev { |
45 | struct sbus_bus *bus; /* Our toplevel parent SBUS */ | 47 | struct of_device ofdev; |
46 | struct sbus_dev *next; /* Chain of siblings */ | 48 | struct sbus_bus *bus; |
47 | struct sbus_dev *child; /* Chain of children */ | 49 | struct sbus_dev *next; |
48 | struct sbus_dev *parent;/* Parent device if not toplevel*/ | 50 | struct sbus_dev *child; |
49 | int prom_node; /* OBP node of this device */ | 51 | struct sbus_dev *parent; |
50 | char prom_name[64]; /* OBP device name property */ | 52 | int prom_node; |
51 | int slot; /* SBUS slot number */ | 53 | char prom_name[64]; |
54 | int slot; | ||
52 | 55 | ||
53 | struct resource resource[PROMREG_MAX]; | 56 | struct resource resource[PROMREG_MAX]; |
54 | 57 | ||
55 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; | 58 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; |
56 | int num_registers, ranges_applied; | 59 | int num_registers; |
57 | 60 | ||
58 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; | 61 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; |
59 | int num_device_ranges; | 62 | int num_device_ranges; |
@@ -61,9 +64,11 @@ struct sbus_dev { | |||
61 | unsigned int irqs[4]; | 64 | unsigned int irqs[4]; |
62 | int num_irqs; | 65 | int num_irqs; |
63 | }; | 66 | }; |
67 | #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev) | ||
64 | 68 | ||
65 | /* This struct describes the SBus(s) found on this machine. */ | 69 | /* This struct describes the SBus(s) found on this machine. */ |
66 | struct sbus_bus { | 70 | struct sbus_bus { |
71 | struct of_device ofdev; | ||
67 | void *iommu; /* Opaque IOMMU cookie */ | 72 | void *iommu; /* Opaque IOMMU cookie */ |
68 | struct sbus_dev *devices; /* Tree of SBUS devices */ | 73 | struct sbus_dev *devices; /* Tree of SBUS devices */ |
69 | struct sbus_bus *next; /* Next SBUS in system */ | 74 | struct sbus_bus *next; /* Next SBUS in system */ |
@@ -77,6 +82,7 @@ struct sbus_bus { | |||
77 | int portid; | 82 | int portid; |
78 | void *starfire_cookie; | 83 | void *starfire_cookie; |
79 | }; | 84 | }; |
85 | #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev) | ||
80 | 86 | ||
81 | extern struct sbus_bus *sbus_root; | 87 | extern struct sbus_bus *sbus_root; |
82 | 88 | ||
@@ -120,4 +126,10 @@ extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, in | |||
120 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu | 126 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu |
121 | extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); | 127 | extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); |
122 | 128 | ||
129 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | ||
130 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | ||
131 | extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); | ||
132 | extern int sbus_arch_preinit(void); | ||
133 | extern void sbus_arch_postinit(void); | ||
134 | |||
123 | #endif /* !(_SPARC64_SBUS_H) */ | 135 | #endif /* !(_SPARC64_SBUS_H) */ |