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
7777
7878 /* Several chips lock up trying to read undefined config space */
7979 if (capable(CAP_SYS_ADMIN))
80− size = 0x200000;
80+ size = RIO_MAINT_SPACE_SZ;
8181
82− if (off > size)
82+ if (off >= size)
8383 return 0;
8484 if (off + count > size) {
8585 size -= off;
@@ -147,10 +147,10 @@ rio_write_config(struct file *filp, struct kobject *kobj, · 61 unmodified lines
147147 loff_t init_off = off;
148148 u8 *data = (u8 *) buf;
149149
150− if (off > 0x200000)
150+ if (off >= RIO_MAINT_SPACE_SZ)
151151 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;
154154 count = size;
155155 }
156156
@@ -200,7 +200,7 @@ static struct bin_attribute rio_config_attr = { · 43 unmodified lines
200200 .name = "config",
201201 .mode = S_IRUGO | S_IWUSR,
202202 },
203− .size = 0x200000,
203+ .size = RIO_MAINT_SPACE_SZ,
204204 .read = rio_read_config,
205205 .write = rio_write_config,
206206 };
include/linux/rio_regs.h+3−1
@@ -14,10 +14,12 @@ · 13 unmodified lines
1414 #define LINUX_RIO_REGS_H
1515
1616 /*
17− * In RapidIO, each device has a 2MB configuration space that is
17+ * In RapidIO, each device has a 16MB configuration space that is
1818 * accessed via maintenance transactions. Portions of configuration
1919 * space are standardized and/or reserved.
2020 */
21+#define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */
22+
2123 #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */
2224 #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */
2325 #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