Fixes sysfs config attribute to allow access to entire 16MB maintenance space of RapidIO devices.
Unified · Split
| @@ -77,9 +77,9 @@ rio_read_config(struct file *filp, struct kobject *kobj, · 76 unmodified lines | ||
| 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,10 +147,10 @@ rio_write_config(struct file *filp, struct kobject *kobj, · 61 unmodified lines | ||
| 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,7 +200,7 @@ static struct bin_attribute rio_config_attr = { · 43 unmodified lines | ||
| 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 | }; |
| @@ -14,10 +14,12 @@ · 13 unmodified lines | ||
| 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 */ |