From a9e07a227ed77a42f0ffc03714a5dee3148e6bcc Mon Sep 17 00:00:00 2001 From: bryanv Date: Sun, 1 Sep 2013 04:20:23 +0000 Subject: [PATCH] Add optional VirtIO device method for post-attach notifications This is called after the parent device (ie virito_pci) has completed the device attachment/initialization. --- sys/dev/virtio/pci/virtio_pci.c | 4 +++- sys/dev/virtio/virtio_if.m | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/virtio/pci/virtio_pci.c b/sys/dev/virtio/pci/virtio_pci.c index b3df3d9c73b1..dcd82ec03a37 100644 --- a/sys/dev/virtio/pci/virtio_pci.c +++ b/sys/dev/virtio/pci/virtio_pci.c @@ -757,8 +757,10 @@ vtpci_probe_and_attach_child(struct vtpci_softc *sc) vtpci_release_child_resources(sc); /* Reset status for future attempt. */ vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_ACK); - } else + } else { vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_DRIVER_OK); + VIRTIO_ATTACH_COMPLETED(child); + } } static int diff --git a/sys/dev/virtio/virtio_if.m b/sys/dev/virtio/virtio_if.m index 9a99d371f663..521f4b8973a8 100644 --- a/sys/dev/virtio/virtio_if.m +++ b/sys/dev/virtio/virtio_if.m @@ -29,6 +29,18 @@ INTERFACE virtio; +CODE { + static int + virtio_default_attach_completed(device_t dev) + { + return (0); + } +}; + +METHOD int attach_completed { + device_t dev; +} DEFAULT virtio_default_attach_completed; + CODE { static int virtio_default_config_change(device_t dev)