iPXE
|
Xen HVM driver. More...
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <ipxe/malloc.h>
#include <ipxe/pci.h>
#include <ipxe/cpuid.h>
#include <ipxe/msr.h>
#include <ipxe/xen.h>
#include <ipxe/xenver.h>
#include <ipxe/xenmem.h>
#include <ipxe/xenstore.h>
#include <ipxe/xenbus.h>
#include <ipxe/xengrant.h>
#include "hvm.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | hvm_cpuid_base (struct hvm_device *hvm) |
Get CPUID base. More... | |
static int | hvm_map_hypercall (struct hvm_device *hvm) |
Map hypercall page(s) More... | |
static void | hvm_unmap_hypercall (struct hvm_device *hvm) |
Unmap hypercall page(s) More... | |
static void * | hvm_ioremap (struct hvm_device *hvm, unsigned int space, size_t len) |
Allocate and map MMIO space. More... | |
static void | hvm_iounmap (struct hvm_device *hvm, void *mmio, size_t len) |
Unmap MMIO space. More... | |
static int | hvm_map_shared_info (struct hvm_device *hvm) |
Map shared info page. More... | |
static void | hvm_unmap_shared_info (struct hvm_device *hvm) |
Unmap shared info page. More... | |
static int | hvm_map_grant (struct hvm_device *hvm) |
Map grant table. More... | |
static void | hvm_unmap_grant (struct hvm_device *hvm) |
Unmap grant table. More... | |
static int | hvm_map_xenstore (struct hvm_device *hvm) |
Map XenStore. More... | |
static void | hvm_unmap_xenstore (struct hvm_device *hvm) |
Unmap XenStore. More... | |
static int | hvm_probe (struct pci_device *pci) |
Probe PCI device. More... | |
static void | hvm_remove (struct pci_device *pci) |
Remove PCI device. More... | |
REQUIRING_SYMBOL (hvm_driver) | |
REQUIRE_OBJECT (netfront) | |
Variables | |
static struct pci_device_id | hvm_ids [] |
PCI device IDs. More... | |
struct pci_driver hvm_driver | __pci_driver |
PCI driver. More... | |
Xen HVM driver.
Definition in file hvm.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Get CPUID base.
hvm | HVM device |
rc | Return status code |
Definition at line 53 of file hvm.c.
References __attribute__, base, hvm_device::cpuid_base, DBGC, DBGC2, discard_ecx, discard_edx, ebx, ecx, edx, ENODEV, HVM_CPUID_MAGIC, HVM_CPUID_MAX, HVM_CPUID_MIN, HVM_CPUID_STEP, HVM_CPUID_VERSION, memcmp(), signature, and version.
Referenced by hvm_probe().
|
static |
Map hypercall page(s)
hvm | HVM device |
rc | Return status code |
Definition at line 92 of file hvm.c.
References hvm_device::cpuid_base, DBGC, DBGC2, discard_ecx, discard_edx, ENOMEM, EXEN, extraversion, HVM_CPUID_PAGES, xen_hypervisor::hypercall, hvm_device::hypercall_len, malloc_phys(), PAGE_SIZE, rc, strerror(), version, virt_to_phys(), and hvm_device::xen.
Referenced by hvm_probe().
|
static |
Unmap hypercall page(s)
hvm | HVM device |
Definition at line 141 of file hvm.c.
References free_phys(), xen_hypervisor::hypercall, hvm_device::hypercall_len, and hvm_device::xen.
Referenced by hvm_probe(), and hvm_remove().
|
static |
Allocate and map MMIO space.
hvm | HVM device |
space | Source mapping space |
len | Length (must be a multiple of PAGE_SIZE) |
mmio | MMIO space address, or NULL on error |
Definition at line 155 of file hvm.c.
References add, assert(), DBGC, xen_add_to_physmap::domid, xen_remove_from_physmap::domid, DOMID_SELF, EXEN, xen_add_to_physmap::gpfn, xen_add_to_physmap::idx, iounmap(), len, hvm_device::mmio, hvm_device::mmio_len, hvm_device::mmio_offset, NULL, PAGE_SIZE, hvm_device::pci, pci_ioremap(), rc, remove, xen_add_to_physmap::space, strerror(), virt_to_phys(), and hvm_device::xen.
Referenced by hvm_map_grant(), and hvm_map_shared_info().
|
static |
Unmap MMIO space.
hvm | HVM device |
mmio | MMIO space address |
len | Length (must be a multiple of PAGE_SIZE) |
Definition at line 229 of file hvm.c.
References DBGC, xen_remove_from_physmap::domid, DOMID_SELF, EXEN, xen_remove_from_physmap::gpfn, iounmap(), len, PAGE_SIZE, rc, remove, strerror(), virt_to_phys(), and hvm_device::xen.
Referenced by hvm_map_shared_info(), hvm_unmap_grant(), and hvm_unmap_shared_info().
|
static |
Map shared info page.
hvm | HVM device |
rc | Return status code |
Definition at line 262 of file hvm.c.
References DBGC2, ENOMEM, hvm_ioremap(), hvm_iounmap(), PAGE_SIZE, rc, readl(), xen_hypervisor::shared, virt_to_phys(), shared_info::wc_sec, hvm_device::xen, and XENMAPSPACE_shared_info.
Referenced by hvm_probe().
|
static |
Unmap shared info page.
hvm | HVM device |
Definition at line 293 of file hvm.c.
References hvm_iounmap(), PAGE_SIZE, xen_hypervisor::shared, and hvm_device::xen.
Referenced by hvm_probe(), and hvm_remove().
|
static |
Map grant table.
hvm | HVM device |
rc | Return status code |
Definition at line 305 of file hvm.c.
References DBGC, DBGC2, ENODEV, xen_hypervisor::grant, hvm_ioremap(), xen_grant::len, rc, strerror(), xen_grant::table, virt_to_phys(), hvm_device::xen, xengrant_init(), and XENMAPSPACE_grant_table.
Referenced by hvm_probe().
|
static |
Unmap grant table.
hvm | HVM device |
Definition at line 333 of file hvm.c.
References xen_hypervisor::grant, hvm_iounmap(), xen_grant::len, xen_grant::table, and hvm_device::xen.
Referenced by hvm_probe(), and hvm_remove().
|
static |
Map XenStore.
hvm | HVM device |
rc | Return status code |
Definition at line 345 of file hvm.c.
References DBGC, DBGC2, ENODEV, EXEN, free, HVM_PARAM_STORE_EVTCHN, HVM_PARAM_STORE_PFN, xen_store::intf, name, NULL, PAGE_SIZE, hvm_device::pci, pci_ioremap(), xen_store::port, rc, xen_hypervisor::store, strerror(), hvm_device::xen, xen_hvm_get_param(), and xenstore_read().
Referenced by hvm_probe().
|
static |
Unmap XenStore.
hvm | HVM device |
Definition at line 402 of file hvm.c.
References xen_store::intf, iounmap(), xen_hypervisor::store, and hvm_device::xen.
Referenced by hvm_probe(), and hvm_remove().
|
static |
Probe PCI device.
pci | PCI device |
rc | Return status code |
Definition at line 414 of file hvm.c.
References adjust_pci_device(), DBGC, DBGC2, pci_device::dev, ENOMEM, free, hvm_cpuid_base(), hvm_map_grant(), hvm_map_hypercall(), hvm_map_shared_info(), hvm_map_xenstore(), HVM_MMIO_BAR, hvm_unmap_grant(), hvm_unmap_hypercall(), hvm_unmap_shared_info(), hvm_unmap_xenstore(), hvm_device::mmio, hvm_device::mmio_len, hvm_device::pci, pci_bar_size(), pci_bar_start(), pci_set_drvdata(), rc, strerror(), hvm_device::xen, xenbus_probe(), xenbus_remove(), and zalloc().
|
static |
Remove PCI device.
pci | PCI device |
Definition at line 476 of file hvm.c.
References pci_device::dev, free, hvm_unmap_grant(), hvm_unmap_hypercall(), hvm_unmap_shared_info(), hvm_unmap_xenstore(), hvm_device::pci, pci_get_drvdata(), hvm_device::xen, and xenbus_remove().
REQUIRING_SYMBOL | ( | hvm_driver | ) |
REQUIRE_OBJECT | ( | netfront | ) |
|
static |
struct pci_driver hvm_driver __pci_driver |
PCI driver.