-
-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
osv: xen: split xenbus into generic & PCI parts
Xen platform PCI is x86-specific feature, not currently present on aarch64. For xenbus to work on both platforms the generic xenbus driver should be probed directly (under aarch64 in case Xen is detected), but in case of x64 special PCI driver checks for Xen platform PCI device and probes generic xenbus driver if such device is found, pretty much like the way it is done in Linux. Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com> Message-Id: <1490018087-16439-1-git-send-email-sergiy.kibrik@globallogic.com>
- Loading branch information
Showing
7 changed files
with
85 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2013 Cloudius Systems, Ltd. | ||
* 2017 Sergiy Kibrik <sergiy.kibrik@globallogic.com> | ||
* | ||
* This work is open source software, licensed under the terms of the | ||
* BSD license as described in the LICENSE file in the top-level directory. | ||
*/ | ||
|
||
#include "xen.hh" | ||
#include "xenplatform-pci.hh" | ||
|
||
#define XEN_VENDOR_ID 0x5853 | ||
#define XEN_DEVICE_ID 0x0001 | ||
|
||
namespace xenfront { | ||
|
||
hw_driver* xenplatform_pci::probe(hw_device *dev) | ||
{ | ||
if (!processor::features().xen_pci) | ||
return nullptr; | ||
|
||
if (dev->get_id() == hw_device_id(XEN_VENDOR_ID, XEN_DEVICE_ID)) { | ||
auto pci_dev = dynamic_cast<pci::device*>(dev); | ||
return new xenplatform_pci(*pci_dev); | ||
} | ||
|
||
return nullptr; | ||
} | ||
|
||
xenplatform_pci::xenplatform_pci(pci::device& dev) | ||
: hw_driver() | ||
, _dev(dev) | ||
{ | ||
_dev.set_bus_master(true); | ||
if (!processor::features().xen_vector_callback) { | ||
int irqno = _dev.get_interrupt_line(); | ||
_pgsi.reset(xen::xen_set_callback(irqno)); | ||
} | ||
_xenbus.reset(xenfront::xenbus::probe(NULL)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2013 Cloudius Systems, Ltd. | ||
* 2017 Sergiy Kibrik <sergiy.kibrik@globallogic.com> | ||
* | ||
* This work is open source software, licensed under the terms of the | ||
* BSD license as described in the LICENSE file in the top-level directory. | ||
*/ | ||
|
||
#ifndef XENPLATFORM_PCI_H | ||
#define XENPLATFORM_PCI_H | ||
|
||
#include <drivers/driver.hh> | ||
#include <drivers/xenfront-xenbus.hh> | ||
|
||
namespace xenfront { | ||
|
||
class xenplatform_pci : public hw_driver { | ||
|
||
public: | ||
static hw_driver* probe(hw_device* dev); | ||
|
||
explicit xenplatform_pci(pci::device& dev); | ||
virtual void dump_config() { _dev.dump_config(); } | ||
virtual std::string get_name() const { | ||
return std::string("xen-platform-pci"); | ||
} | ||
|
||
private: | ||
pci::device& _dev; | ||
std::unique_ptr<gsi_level_interrupt> _pgsi; | ||
std::unique_ptr<hw_driver> _xenbus; | ||
}; | ||
} | ||
#endif /* XENPLATFORM_PCI_H */ |