Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] rapidio: core updates

Addresses issues raised with the 2.6.12-rc6-mm1 RIO support. Fix dma_mask
init, shrink some code, general cleanup.

Signed-off-by: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Matt Porter and committed by
Linus Torvalds
fa78cc51 eb188d0e

+28 -25
+10 -25
drivers/rapidio/rio-scan.c
··· 15 15 #include <linux/kernel.h> 16 16 17 17 #include <linux/delay.h> 18 + #include <linux/dma-mapping.h> 18 19 #include <linux/init.h> 19 20 #include <linux/rio.h> 20 21 #include <linux/rio_drv.h> ··· 34 33 35 34 static void rio_enum_timeout(unsigned long); 36 35 37 - spinlock_t rio_global_list_lock = SPIN_LOCK_UNLOCKED; 36 + DEFINE_SPINLOCK(rio_global_list_lock); 37 + 38 38 static int next_destid = 0; 39 39 static int next_switchid = 0; 40 40 static int next_net = 0; ··· 56 54 RIO_EFB_SER_EP_FREE_ID, 57 55 -1, 58 56 }; 59 - 60 - extern struct rio_route_ops __start_rio_route_ops[]; 61 - extern struct rio_route_ops __end_rio_route_ops[]; 62 57 63 58 /** 64 59 * rio_get_device_id - Get the base/extended device id for a device ··· 84 85 * 85 86 * Writes the base/extended device id from a device. 86 87 */ 87 - static void 88 - rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did) 88 + static void rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did) 89 89 { 90 90 rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR, 91 91 RIO_SET_DID(did)); ··· 190 192 static int rio_device_has_destid(struct rio_mport *port, int src_ops, 191 193 int dst_ops) 192 194 { 193 - if (((src_ops & RIO_SRC_OPS_READ) || 194 - (src_ops & RIO_SRC_OPS_WRITE) || 195 - (src_ops & RIO_SRC_OPS_ATOMIC_TST_SWP) || 196 - (src_ops & RIO_SRC_OPS_ATOMIC_INC) || 197 - (src_ops & RIO_SRC_OPS_ATOMIC_DEC) || 198 - (src_ops & RIO_SRC_OPS_ATOMIC_SET) || 199 - (src_ops & RIO_SRC_OPS_ATOMIC_CLR)) && 200 - ((dst_ops & RIO_DST_OPS_READ) || 201 - (dst_ops & RIO_DST_OPS_WRITE) || 202 - (dst_ops & RIO_DST_OPS_ATOMIC_TST_SWP) || 203 - (dst_ops & RIO_DST_OPS_ATOMIC_INC) || 204 - (dst_ops & RIO_DST_OPS_ATOMIC_DEC) || 205 - (dst_ops & RIO_DST_OPS_ATOMIC_SET) || 206 - (dst_ops & RIO_DST_OPS_ATOMIC_CLR))) { 207 - return 1; 208 - } else 209 - return 0; 195 + 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 + 197 + return !!((src_ops | dst_ops) & mask); 210 198 } 211 199 212 200 /** ··· 367 383 rdev->dev.release = rio_release_dev; 368 384 rio_dev_get(rdev); 369 385 370 - rdev->dev.dma_mask = (u64 *) 0xffffffff; 371 - rdev->dev.coherent_dma_mask = 0xffffffffULL; 386 + rdev->dma_mask = DMA_32BIT_MASK; 387 + rdev->dev.dma_mask = &rdev->dma_mask; 388 + rdev->dev.coherent_dma_mask = DMA_32BIT_MASK; 372 389 373 390 if ((rdev->pef & RIO_PEF_INB_DOORBELL) && 374 391 (rdev->dst_ops & RIO_DST_OPS_DOORBELL))
+3
drivers/rapidio/rio.h
··· 26 26 extern struct device_attribute rio_dev_attrs[]; 27 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 32 /* Helpers internal to the RIO core code */ 30 33 #define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \ 31 34 static struct rio_route_ops __rio_route_ops __attribute_used__ \
+2
include/linux/rio.h
··· 91 91 * @swpinfo: Switch port info 92 92 * @src_ops: Source operation capabilities 93 93 * @dst_ops: Destination operation capabilities 94 + * @dma_mask: Mask of bits of RIO address this device implements 94 95 * @rswitch: Pointer to &struct rio_switch if valid for this device 95 96 * @driver: Driver claiming this device 96 97 * @dev: Device model device ··· 113 112 u32 swpinfo; /* Only used for switches */ 114 113 u32 src_ops; 115 114 u32 dst_ops; 115 + u64 dma_mask; 116 116 struct rio_switch *rswitch; /* RIO switch info */ 117 117 struct rio_driver *driver; /* RIO driver claiming this device */ 118 118 struct device dev; /* LDM device structure */
+13
include/linux/rio_regs.h
··· 78 78 #define RIO_DST_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ 79 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 94 /* 0x20-0x3c *//* Reserved */ 82 95 83 96 #define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */