Skip to content

Commit

Permalink
rapidio: modify mport ID assignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexandre Bounine authored and Linus Torvalds committed Mar 24, 2011
1 parent 2f80998 commit 569fccb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
25 changes: 0 additions & 25 deletions arch/powerpc/sysdev/fsl_rio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1288,28 +1288,6 @@ static int fsl_rio_port_write_init(struct rio_mport *mport)
return rc;
}

static char *cmdline = NULL;

static int fsl_rio_get_hdid(int index)
{
/* XXX Need to parse multiple entries in some format */
if (!cmdline)
return -1;

return simple_strtol(cmdline, NULL, 0);
}

static int fsl_rio_get_cmdline(char *s)
{
if (!s)
return 0;

cmdline = s;
return 1;
}

__setup("riohdid=", fsl_rio_get_cmdline);

static inline void fsl_rio_info(struct device *dev, u32 ccsr)
{
const char *str;
Expand Down Expand Up @@ -1439,7 +1417,6 @@ int fsl_rio_setup(struct platform_device *dev)
rc = -ENOMEM;
goto err_port;
}
port->id = 0;
port->index = 0;

priv = kzalloc(sizeof(struct rio_priv), GFP_KERNEL);
Expand Down Expand Up @@ -1470,8 +1447,6 @@ int fsl_rio_setup(struct platform_device *dev)
priv->dev = &dev->dev;

port->ops = ops;
port->host_deviceid = fsl_rio_get_hdid(port->id);

port->priv = priv;
port->phys_efptr = 0x100;
rio_register_mport(port);
Expand Down
26 changes: 26 additions & 0 deletions drivers/rapidio/rio.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "rio.h"

static LIST_HEAD(rio_mports);
static unsigned char next_portid;

/**
* rio_local_get_device_id - Get the base/extended device id for a port
Expand Down Expand Up @@ -1164,8 +1165,33 @@ int __devinit rio_init_mports(void)

device_initcall_sync(rio_init_mports);

static int hdids[RIO_MAX_MPORTS + 1];

static int rio_get_hdid(int index)
{
if (!hdids[0] || hdids[0] <= index || index >= RIO_MAX_MPORTS)
return -1;

return hdids[index + 1];
}

static int rio_hdid_setup(char *str)
{
(void)get_options(str, ARRAY_SIZE(hdids), hdids);
return 1;
}

__setup("riohdid=", rio_hdid_setup);

void rio_register_mport(struct rio_mport *port)
{
if (next_portid >= RIO_MAX_MPORTS) {
pr_err("RIO: reached specified max number of mports\n");
return;
}

port->id = next_portid++;
port->host_deviceid = rio_get_hdid(port->id);
list_add_tail(&port->node, &rio_mports);
}

Expand Down
1 change: 1 addition & 0 deletions include/linux/rio.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define RIO_NO_HOPCOUNT -1
#define RIO_INVALID_DESTID 0xffff

#define RIO_MAX_MPORTS 8
#define RIO_MAX_MPORT_RESOURCES 16
#define RIO_MAX_DEV_RESOURCES 16

Expand Down

0 comments on commit 569fccb

Please sign in to comment.