diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sparc/sbus.h | 27 | ||||
-rw-r--r-- | include/asm-sparc64/sbus.h | 28 |
2 files changed, 39 insertions, 16 deletions
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h index 76654fa23091..d036e4419d79 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) */ |
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) */ |