summaryrefslogtreecommitdiff
path: root/arch/sparc64/kernel/viohs.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-12 13:47:50 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-16 04:04:28 -0700
commit43fdf27470b216ebdef47e09ff83bed2f2894b13 (patch)
tree76b9b838089e5679471026037c93325c228df84a /arch/sparc64/kernel/viohs.c
parent133f09a169f3022be3de671b29658b7ecb375022 (diff)
[SPARC64]: Abstract out mdesc accesses for better MD update handling.
Since we have to be able to handle MD updates, having an in-tree set of data structures representing the MD objects actually makes things more painful. The MD itself is easy to parse, and we can implement the existing interfaces using direct parsing of the MD binary image. The MD is now reference counted, so accesses have to now take the form: handle = mdesc_grab(); ... operations on MD ... mdesc_release(handle); The only remaining issue are cases where code holds on to references to MD property values. mdesc_get_property() returns a direct pointer to the property value, most cases just pull in the information they need and discard the pointer, but there are few that use the pointer directly over a long lifetime. Those will be fixed up in a subsequent changeset. A preliminary handler for MD update events from domain services is there, it is rudimentry but it works and handles all of the reference counting. It does not check the generation number of the MDs, and it does not generate a "add/delete" list for notification to interesting parties about MD changes but that will be forthcoming. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/viohs.c')
-rw-r--r--arch/sparc64/kernel/viohs.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/arch/sparc64/kernel/viohs.c b/arch/sparc64/kernel/viohs.c
index b0b1b8779342..15613add45d1 100644
--- a/arch/sparc64/kernel/viohs.c
+++ b/arch/sparc64/kernel/viohs.c
@@ -136,7 +136,7 @@ static int process_unknown(struct vio_driver_state *vio, void *arg)
pkt->type, pkt->stype, pkt->stype_env, pkt->sid);
printk(KERN_ERR "vio: ID[%lu] Resetting connection.\n",
- vio->channel_id);
+ vio->vdev->channel_id);
ldc_disconnect(vio->lp);
@@ -678,21 +678,11 @@ extern int vio_ldc_alloc(struct vio_driver_state *vio,
{
struct ldc_channel_config cfg = *base_cfg;
struct ldc_channel *lp;
- const u64 *id;
- id = md_get_property(vio->endpoint, "id", NULL);
- if (!id) {
- printk(KERN_ERR "%s: Channel lacks id property.\n",
- vio->name);
- return -ENODEV;
- }
-
- vio->channel_id = *id;
-
- cfg.rx_irq = vio->rx_irq;
- cfg.tx_irq = vio->tx_irq;
+ cfg.tx_irq = vio->vdev->tx_irq;
+ cfg.rx_irq = vio->vdev->rx_irq;
- lp = ldc_alloc(vio->channel_id, &cfg, event_arg);
+ lp = ldc_alloc(vio->vdev->channel_id, &cfg, event_arg);
if (IS_ERR(lp))
return PTR_ERR(lp);
@@ -728,7 +718,7 @@ void vio_port_up(struct vio_driver_state *vio)
if (err)
printk(KERN_WARNING "%s: Port %lu bind failed, "
"err=%d\n",
- vio->name, vio->channel_id, err);
+ vio->name, vio->vdev->channel_id, err);
}
if (!err) {
@@ -736,7 +726,7 @@ void vio_port_up(struct vio_driver_state *vio)
if (err)
printk(KERN_WARNING "%s: Port %lu connect failed, "
"err=%d\n",
- vio->name, vio->channel_id, err);
+ vio->name, vio->vdev->channel_id, err);
}
if (err) {
unsigned long expires = jiffies + HZ;
@@ -757,9 +747,9 @@ static void vio_port_timer(unsigned long _arg)
}
int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
- u8 dev_class, struct mdesc_node *channel_endpoint,
- struct vio_version *ver_table, int ver_table_size,
- struct vio_driver_ops *ops, char *name)
+ u8 dev_class, struct vio_version *ver_table,
+ int ver_table_size, struct vio_driver_ops *ops,
+ char *name)
{
switch (dev_class) {
case VDEV_NETWORK:
@@ -777,9 +767,6 @@ int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
!ops->handshake_complete)
return -EINVAL;
- if (!channel_endpoint)
- return -EINVAL;
-
if (!ver_table || ver_table_size < 0)
return -EINVAL;
@@ -793,10 +780,6 @@ int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
vio->dev_class = dev_class;
vio->vdev = vdev;
- vio->endpoint = channel_endpoint;
- vio->tx_irq = channel_endpoint->irqs[0];
- vio->rx_irq = channel_endpoint->irqs[1];
-
vio->ver_table = ver_table;
vio->ver_table_entries = ver_table_size;