diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2011-03-23 19:43:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 22:46:43 -0400 |
commit | 569fccb6b48878d654310e1ffaf9a5a6e46b3144 (patch) | |
tree | 20e6ded48adf7b36e9cfe71b8a0ed3721b977669 /drivers/rapidio/rio.c | |
parent | 2f809985d2cbc78078b8da1cbed1f1ce1f4a0d5f (diff) |
rapidio: modify mport ID assignment
Changes mport ID and host destination ID assignment to implement unified
method common to all mport drivers. Makes "riohdid=" kernel command line
parameter common for all architectures with support for more that one host
destination ID assignment.
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>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/rio.c')
-rw-r--r-- | drivers/rapidio/rio.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index f861b728f80e..9a7b2168d1d5 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "rio.h" | 32 | #include "rio.h" |
33 | 33 | ||
34 | static LIST_HEAD(rio_mports); | 34 | static LIST_HEAD(rio_mports); |
35 | static unsigned char next_portid; | ||
35 | 36 | ||
36 | /** | 37 | /** |
37 | * rio_local_get_device_id - Get the base/extended device id for a port | 38 | * rio_local_get_device_id - Get the base/extended device id for a port |
@@ -1164,8 +1165,33 @@ int __devinit rio_init_mports(void) | |||
1164 | 1165 | ||
1165 | device_initcall_sync(rio_init_mports); | 1166 | device_initcall_sync(rio_init_mports); |
1166 | 1167 | ||
1168 | static int hdids[RIO_MAX_MPORTS + 1]; | ||
1169 | |||
1170 | static int rio_get_hdid(int index) | ||
1171 | { | ||
1172 | if (!hdids[0] || hdids[0] <= index || index >= RIO_MAX_MPORTS) | ||
1173 | return -1; | ||
1174 | |||
1175 | return hdids[index + 1]; | ||
1176 | } | ||
1177 | |||
1178 | static int rio_hdid_setup(char *str) | ||
1179 | { | ||
1180 | (void)get_options(str, ARRAY_SIZE(hdids), hdids); | ||
1181 | return 1; | ||
1182 | } | ||
1183 | |||
1184 | __setup("riohdid=", rio_hdid_setup); | ||
1185 | |||
1167 | void rio_register_mport(struct rio_mport *port) | 1186 | void rio_register_mport(struct rio_mport *port) |
1168 | { | 1187 | { |
1188 | if (next_portid >= RIO_MAX_MPORTS) { | ||
1189 | pr_err("RIO: reached specified max number of mports\n"); | ||
1190 | return; | ||
1191 | } | ||
1192 | |||
1193 | port->id = next_portid++; | ||
1194 | port->host_deviceid = rio_get_hdid(port->id); | ||
1169 | list_add_tail(&port->node, &rio_mports); | 1195 | list_add_tail(&port->node, &rio_mports); |
1170 | } | 1196 | } |
1171 | 1197 | ||