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

Configure Feed

Select the types of activity you want to include in your feed.

rapidio: fix sysfs config attribute to access 16MB of maint space

Fixes sysfs config attribute to allow access to entire 16MB maintenance
space of RapidIO devices.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Micha Nelissen <micha@neli.hopto.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alexandre Bounine and committed by
Linus Torvalds
fe41947e 99b0d365

+9 -7
+6 -6
drivers/rapidio/rio-sysfs.c
··· 77 77 78 78 /* Several chips lock up trying to read undefined config space */ 79 79 if (capable(CAP_SYS_ADMIN)) 80 - size = 0x200000; 80 + size = RIO_MAINT_SPACE_SZ; 81 81 82 - if (off > size) 82 + if (off >= size) 83 83 return 0; 84 84 if (off + count > size) { 85 85 size -= off; ··· 147 147 loff_t init_off = off; 148 148 u8 *data = (u8 *) buf; 149 149 150 - if (off > 0x200000) 150 + if (off >= RIO_MAINT_SPACE_SZ) 151 151 return 0; 152 - if (off + count > 0x200000) { 153 - size = 0x200000 - off; 152 + if (off + count > RIO_MAINT_SPACE_SZ) { 153 + size = RIO_MAINT_SPACE_SZ - off; 154 154 count = size; 155 155 } 156 156 ··· 200 200 .name = "config", 201 201 .mode = S_IRUGO | S_IWUSR, 202 202 }, 203 - .size = 0x200000, 203 + .size = RIO_MAINT_SPACE_SZ, 204 204 .read = rio_read_config, 205 205 .write = rio_write_config, 206 206 };
+3 -1
include/linux/rio_regs.h
··· 14 14 #define LINUX_RIO_REGS_H 15 15 16 16 /* 17 - * In RapidIO, each device has a 2MB configuration space that is 17 + * In RapidIO, each device has a 16MB configuration space that is 18 18 * accessed via maintenance transactions. Portions of configuration 19 19 * space are standardized and/or reserved. 20 20 */ 21 + #define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */ 22 + 21 23 #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ 22 24 #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ 23 25 #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */