diff options
-rw-r--r-- | drivers/rapidio/rio-scan.c | 35 | ||||
-rw-r--r-- | drivers/rapidio/rio.h | 3 | ||||
-rw-r--r-- | include/linux/rio.h | 2 | ||||
-rw-r--r-- | include/linux/rio_regs.h | 13 |
4 files changed, 28 insertions, 25 deletions
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 20e1d8f74597..4f7ed4bd3be9 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | 16 | ||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/dma-mapping.h> | ||
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
19 | #include <linux/rio.h> | 20 | #include <linux/rio.h> |
20 | #include <linux/rio_drv.h> | 21 | #include <linux/rio_drv.h> |
@@ -33,7 +34,8 @@ static LIST_HEAD(rio_switches); | |||
33 | 34 | ||
34 | static void rio_enum_timeout(unsigned long); | 35 | static void rio_enum_timeout(unsigned long); |
35 | 36 | ||
36 | spinlock_t rio_global_list_lock = SPIN_LOCK_UNLOCKED; | 37 | DEFINE_SPINLOCK(rio_global_list_lock); |
38 | |||
37 | static int next_destid = 0; | 39 | static int next_destid = 0; |
38 | static int next_switchid = 0; | 40 | static int next_switchid = 0; |
39 | static int next_net = 0; | 41 | static int next_net = 0; |
@@ -55,9 +57,6 @@ static int rio_sport_phys_table[] = { | |||
55 | -1, | 57 | -1, |
56 | }; | 58 | }; |
57 | 59 | ||
58 | extern struct rio_route_ops __start_rio_route_ops[]; | ||
59 | extern struct rio_route_ops __end_rio_route_ops[]; | ||
60 | |||
61 | /** | 60 | /** |
62 | * rio_get_device_id - Get the base/extended device id for a device | 61 | * rio_get_device_id - Get the base/extended device id for a device |
63 | * @port: RIO master port | 62 | * @port: RIO master port |
@@ -85,8 +84,7 @@ static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount) | |||
85 | * | 84 | * |
86 | * Writes the base/extended device id from a device. | 85 | * Writes the base/extended device id from a device. |
87 | */ | 86 | */ |
88 | static void | 87 | static void rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did) |
89 | rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did) | ||
90 | { | 88 | { |
91 | rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR, | 89 | rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR, |
92 | RIO_SET_DID(did)); | 90 | RIO_SET_DID(did)); |
@@ -192,23 +190,9 @@ static int rio_enum_host(struct rio_mport *port) | |||
192 | static int rio_device_has_destid(struct rio_mport *port, int src_ops, | 190 | static int rio_device_has_destid(struct rio_mport *port, int src_ops, |
193 | int dst_ops) | 191 | int dst_ops) |
194 | { | 192 | { |
195 | if (((src_ops & RIO_SRC_OPS_READ) || | 193 | u32 mask = RIO_OPS_READ | RIO_OPS_WRITE | RIO_OPS_ATOMIC_TST_SWP | RIO_OPS_ATOMIC_INC | RIO_OPS_ATOMIC_DEC | RIO_OPS_ATOMIC_SET | RIO_OPS_ATOMIC_CLR; |
196 | (src_ops & RIO_SRC_OPS_WRITE) || | 194 | |
197 | (src_ops & RIO_SRC_OPS_ATOMIC_TST_SWP) || | 195 | return !!((src_ops | dst_ops) & mask); |
198 | (src_ops & RIO_SRC_OPS_ATOMIC_INC) || | ||
199 | (src_ops & RIO_SRC_OPS_ATOMIC_DEC) || | ||
200 | (src_ops & RIO_SRC_OPS_ATOMIC_SET) || | ||
201 | (src_ops & RIO_SRC_OPS_ATOMIC_CLR)) && | ||
202 | ((dst_ops & RIO_DST_OPS_READ) || | ||
203 | (dst_ops & RIO_DST_OPS_WRITE) || | ||
204 | (dst_ops & RIO_DST_OPS_ATOMIC_TST_SWP) || | ||
205 | (dst_ops & RIO_DST_OPS_ATOMIC_INC) || | ||
206 | (dst_ops & RIO_DST_OPS_ATOMIC_DEC) || | ||
207 | (dst_ops & RIO_DST_OPS_ATOMIC_SET) || | ||
208 | (dst_ops & RIO_DST_OPS_ATOMIC_CLR))) { | ||
209 | return 1; | ||
210 | } else | ||
211 | return 0; | ||
212 | } | 196 | } |
213 | 197 | ||
214 | /** | 198 | /** |
@@ -383,8 +367,9 @@ static struct rio_dev *rio_setup_device(struct rio_net *net, | |||
383 | rdev->dev.release = rio_release_dev; | 367 | rdev->dev.release = rio_release_dev; |
384 | rio_dev_get(rdev); | 368 | rio_dev_get(rdev); |
385 | 369 | ||
386 | rdev->dev.dma_mask = (u64 *) 0xffffffff; | 370 | rdev->dma_mask = DMA_32BIT_MASK; |
387 | rdev->dev.coherent_dma_mask = 0xffffffffULL; | 371 | rdev->dev.dma_mask = &rdev->dma_mask; |
372 | rdev->dev.coherent_dma_mask = DMA_32BIT_MASK; | ||
388 | 373 | ||
389 | if ((rdev->pef & RIO_PEF_INB_DOORBELL) && | 374 | if ((rdev->pef & RIO_PEF_INB_DOORBELL) && |
390 | (rdev->dst_ops & RIO_DST_OPS_DOORBELL)) | 375 | (rdev->dst_ops & RIO_DST_OPS_DOORBELL)) |
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h index f865a68cd3d5..b242cee656e7 100644 --- a/drivers/rapidio/rio.h +++ b/drivers/rapidio/rio.h | |||
@@ -26,6 +26,9 @@ extern int rio_disc_mport(struct rio_mport *mport); | |||
26 | extern struct device_attribute rio_dev_attrs[]; | 26 | extern struct device_attribute rio_dev_attrs[]; |
27 | extern spinlock_t rio_global_list_lock; | 27 | extern spinlock_t rio_global_list_lock; |
28 | 28 | ||
29 | extern struct rio_route_ops __start_rio_route_ops[]; | ||
30 | extern struct rio_route_ops __end_rio_route_ops[]; | ||
31 | |||
29 | /* Helpers internal to the RIO core code */ | 32 | /* Helpers internal to the RIO core code */ |
30 | #define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \ | 33 | #define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \ |
31 | static struct rio_route_ops __rio_route_ops __attribute_used__ \ | 34 | static struct rio_route_ops __rio_route_ops __attribute_used__ \ |
diff --git a/include/linux/rio.h b/include/linux/rio.h index 930bbb7c3802..5c29f2f477c2 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -91,6 +91,7 @@ struct rio_mport; | |||
91 | * @swpinfo: Switch port info | 91 | * @swpinfo: Switch port info |
92 | * @src_ops: Source operation capabilities | 92 | * @src_ops: Source operation capabilities |
93 | * @dst_ops: Destination operation capabilities | 93 | * @dst_ops: Destination operation capabilities |
94 | * @dma_mask: Mask of bits of RIO address this device implements | ||
94 | * @rswitch: Pointer to &struct rio_switch if valid for this device | 95 | * @rswitch: Pointer to &struct rio_switch if valid for this device |
95 | * @driver: Driver claiming this device | 96 | * @driver: Driver claiming this device |
96 | * @dev: Device model device | 97 | * @dev: Device model device |
@@ -112,6 +113,7 @@ struct rio_dev { | |||
112 | u32 swpinfo; /* Only used for switches */ | 113 | u32 swpinfo; /* Only used for switches */ |
113 | u32 src_ops; | 114 | u32 src_ops; |
114 | u32 dst_ops; | 115 | u32 dst_ops; |
116 | u64 dma_mask; | ||
115 | struct rio_switch *rswitch; /* RIO switch info */ | 117 | struct rio_switch *rswitch; /* RIO switch info */ |
116 | struct rio_driver *driver; /* RIO driver claiming this device */ | 118 | struct rio_driver *driver; /* RIO driver claiming this device */ |
117 | struct device dev; /* LDM device structure */ | 119 | struct device dev; /* LDM device structure */ |
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h index f419be3be491..326540f9b54e 100644 --- a/include/linux/rio_regs.h +++ b/include/linux/rio_regs.h | |||
@@ -78,6 +78,19 @@ | |||
78 | #define RIO_DST_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ | 78 | #define RIO_DST_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ |
79 | #define RIO_DST_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ | 79 | #define RIO_DST_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ |
80 | 80 | ||
81 | #define RIO_OPS_READ 0x00008000 /* [I] Read op */ | ||
82 | #define RIO_OPS_WRITE 0x00004000 /* [I] Write op */ | ||
83 | #define RIO_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */ | ||
84 | #define RIO_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */ | ||
85 | #define RIO_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */ | ||
86 | #define RIO_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */ | ||
87 | #define RIO_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */ | ||
88 | #define RIO_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */ | ||
89 | #define RIO_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */ | ||
90 | #define RIO_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */ | ||
91 | #define RIO_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ | ||
92 | #define RIO_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ | ||
93 | |||
81 | /* 0x20-0x3c *//* Reserved */ | 94 | /* 0x20-0x3c *//* Reserved */ |
82 | 95 | ||
83 | #define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ | 96 | #define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ |