summaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/ds.c
diff options
context:
space:
mode:
authorDavid S. Miller2007-07-12 22:47:50 +0200
committerDavid S. Miller2007-07-16 13:04:28 +0200
commit43fdf27470b216ebdef47e09ff83bed2f2894b13 (patch)
tree76b9b838089e5679471026037c93325c228df84a /arch/sparc64/kernel/ds.c
parent[SPARC64]: Use more mearningful names for IRQ registry. (diff)
downloadkernel-qcow2-linux-43fdf27470b216ebdef47e09ff83bed2f2894b13.tar.gz
kernel-qcow2-linux-43fdf27470b216ebdef47e09ff83bed2f2894b13.tar.xz
kernel-qcow2-linux-43fdf27470b216ebdef47e09ff83bed2f2894b13.zip
[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/ds.c')
-rw-r--r--arch/sparc64/kernel/ds.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/arch/sparc64/kernel/ds.c b/arch/sparc64/kernel/ds.c
index c7ece8c52039..9c8839d1cffd 100644
--- a/arch/sparc64/kernel/ds.c
+++ b/arch/sparc64/kernel/ds.c
@@ -15,6 +15,7 @@
#include <asm/ldc.h>
#include <asm/vio.h>
#include <asm/power.h>
+#include <asm/mdesc.h>
#define DRV_MODULE_NAME "ds"
#define PFX DRV_MODULE_NAME ": "
@@ -170,8 +171,7 @@ static void md_update_data(struct ldc_channel *lp,
rp = (struct ds_md_update_req *) (dpkt + 1);
- printk(KERN_ERR PFX "MD update REQ [%lx] len=%d\n",
- rp->req_num, len);
+ printk(KERN_ERR PFX "Machine description update.\n");
memset(&pkt, 0, sizeof(pkt));
pkt.data.tag.type = DS_DATA;
@@ -181,6 +181,8 @@ static void md_update_data(struct ldc_channel *lp,
pkt.res.result = DS_OK;
ds_send(lp, &pkt, sizeof(pkt));
+
+ mdesc_update();
}
struct ds_shutdown_req {
@@ -555,7 +557,6 @@ static int __devinit ds_probe(struct vio_dev *vdev,
const struct vio_device_id *id)
{
static int ds_version_printed;
- struct mdesc_node *endp;
struct ldc_channel_config ds_cfg = {
.event = ds_event,
.mtu = 4096,
@@ -563,20 +564,11 @@ static int __devinit ds_probe(struct vio_dev *vdev,
};
struct ldc_channel *lp;
struct ds_info *dp;
- const u64 *chan_id;
int err;
if (ds_version_printed++ == 0)
printk(KERN_INFO "%s", version);
- endp = vio_find_endpoint(vdev);
- if (!endp)
- return -ENODEV;
-
- chan_id = md_get_property(endp, "id", NULL);
- if (!chan_id)
- return -ENODEV;
-
dp = kzalloc(sizeof(*dp), GFP_KERNEL);
err = -ENOMEM;
if (!dp)
@@ -588,10 +580,10 @@ static int __devinit ds_probe(struct vio_dev *vdev,
dp->rcv_buf_len = 4096;
- ds_cfg.tx_irq = endp->irqs[0];
- ds_cfg.rx_irq = endp->irqs[1];
+ ds_cfg.tx_irq = vdev->tx_irq;
+ ds_cfg.rx_irq = vdev->rx_irq;
- lp = ldc_alloc(*chan_id, &ds_cfg, dp);
+ lp = ldc_alloc(vdev->channel_id, &ds_cfg, dp);
if (IS_ERR(lp)) {
err = PTR_ERR(lp);
goto out_free_rcv_buf;