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-sparc/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-sparc/sbus.h')
-rw-r--r-- | include/asm-sparc/sbus.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h index 76654fa2309..d036e4419d7 100644 --- a/include/asm-sparc/sbus.h +++ b/include/asm-sparc/sbus.h | |||
@@ -11,7 +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/iommu.h> */ /* Unused since we use opaque iommu (|io-unit) */ | 14 | #include <asm/prom.h> |
15 | #include <asm/of_device.h> | ||
15 | #include <asm/scatterlist.h> | 16 | #include <asm/scatterlist.h> |
16 | 17 | ||
17 | /* We scan which devices are on the SBus using the PROM node device | 18 | /* We scan which devices are on the SBus using the PROM node device |
@@ -42,18 +43,19 @@ struct sbus_bus; | |||
42 | 43 | ||
43 | /* Linux SBUS device tables */ | 44 | /* Linux SBUS device tables */ |
44 | struct sbus_dev { | 45 | struct sbus_dev { |
45 | struct sbus_bus *bus; /* Back ptr to sbus */ | 46 | struct of_device ofdev; |
46 | struct sbus_dev *next; /* next device on this SBus or null */ | 47 | struct sbus_bus *bus; |
47 | struct sbus_dev *child; /* For ledma and espdma on sun4m */ | 48 | struct sbus_dev *next; |
48 | struct sbus_dev *parent; /* Parent device if not toplevel */ | 49 | struct sbus_dev *child; |
49 | int prom_node; /* PROM device tree node for this device */ | 50 | struct sbus_dev *parent; |
50 | char prom_name[64]; /* PROM device name */ | 51 | int prom_node; |
52 | char prom_name[64]; | ||
51 | int slot; | 53 | int slot; |
52 | 54 | ||
53 | struct resource resource[PROMREG_MAX]; | 55 | struct resource resource[PROMREG_MAX]; |
54 | 56 | ||
55 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; | 57 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; |
56 | int num_registers, ranges_applied; | 58 | int num_registers; |
57 | 59 | ||
58 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; | 60 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; |
59 | int num_device_ranges; | 61 | int num_device_ranges; |
@@ -61,9 +63,11 @@ struct sbus_dev { | |||
61 | unsigned int irqs[4]; | 63 | unsigned int irqs[4]; |
62 | int num_irqs; | 64 | int num_irqs; |
63 | }; | 65 | }; |
66 | #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev) | ||
64 | 67 | ||
65 | /* This struct describes the SBus(s) found on this machine. */ | 68 | /* This struct describes the SBus(s) found on this machine. */ |
66 | struct sbus_bus { | 69 | struct sbus_bus { |
70 | struct of_device ofdev; | ||
67 | void *iommu; /* Opaque IOMMU cookie */ | 71 | void *iommu; /* Opaque IOMMU cookie */ |
68 | struct sbus_dev *devices; /* Link to devices on this SBus */ | 72 | struct sbus_dev *devices; /* Link to devices on this SBus */ |
69 | struct sbus_bus *next; /* next SBus, if more than one SBus */ | 73 | struct sbus_bus *next; /* next SBus, if more than one SBus */ |
@@ -77,6 +81,7 @@ struct sbus_bus { | |||
77 | int devid; | 81 | int devid; |
78 | int board; | 82 | int board; |
79 | }; | 83 | }; |
84 | #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev) | ||
80 | 85 | ||
81 | extern struct sbus_bus *sbus_root; | 86 | extern struct sbus_bus *sbus_root; |
82 | 87 | ||
@@ -140,4 +145,10 @@ extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, | |||
140 | BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) | 145 | BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) |
141 | #define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) | 146 | #define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) |
142 | 147 | ||
148 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | ||
149 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | ||
150 | extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); | ||
151 | extern int sbus_arch_preinit(void); | ||
152 | extern void sbus_arch_postinit(void); | ||
153 | |||
143 | #endif /* !(_SPARC_SBUS_H) */ | 154 | #endif /* !(_SPARC_SBUS_H) */ |