History

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.

Alexandre Bounine committed 15 years ago

Commit fe419471 parent 99b0d362 files · +9 −7Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t