2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 12:14:01 +08:00

Drivers: hv: vmbus: Extract the mmio information from DSDT

On Gen2 firmware, Hyper-V does not emulate the PCI bus. However, the MMIO
information is packaged up in DSDT. Extract this information and export it
for use by the synthetic framebuffer driver. This is the only driver that
needs this currently.

In this version of the patch mmio, I have updated the hyperv header file
(linux/hyperv.h) with mmio definitions.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
K. Y. Srinivasan 2014-01-29 18:14:39 -08:00 committed by Greg Kroah-Hartman
parent 5267cf02c7
commit 90f3453585
2 changed files with 35 additions and 13 deletions

View File

@ -43,6 +43,10 @@ static struct acpi_device *hv_acpi_dev;
static struct tasklet_struct msg_dpc; static struct tasklet_struct msg_dpc;
static struct completion probe_event; static struct completion probe_event;
static int irq; static int irq;
u64 hyperv_mmio_start;
EXPORT_SYMBOL_GPL(hyperv_mmio_start);
u64 hyperv_mmio_size;
EXPORT_SYMBOL_GPL(hyperv_mmio_size);
static int vmbus_exists(void) static int vmbus_exists(void)
{ {
@ -886,18 +890,19 @@ void vmbus_device_unregister(struct hv_device *device_obj)
/* /*
* VMBUS is an acpi enumerated device. Get the the IRQ information * VMBUS is an acpi enumerated device. Get the the information we
* from DSDT. * need from DSDT.
*/ */
static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *irq) static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
{ {
switch (res->type) {
case ACPI_RESOURCE_TYPE_IRQ:
irq = res->data.irq.interrupts[0];
if (res->type == ACPI_RESOURCE_TYPE_IRQ) { case ACPI_RESOURCE_TYPE_ADDRESS64:
struct acpi_resource_irq *irqp; hyperv_mmio_start = res->data.address64.minimum;
irqp = &res->data.irq; hyperv_mmio_size = res->data.address64.address_length;
*((unsigned int *)irq) = irqp->interrupts[0];
} }
return AE_OK; return AE_OK;
@ -906,18 +911,32 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *irq)
static int vmbus_acpi_add(struct acpi_device *device) static int vmbus_acpi_add(struct acpi_device *device)
{ {
acpi_status result; acpi_status result;
int ret_val = -ENODEV;
hv_acpi_dev = device; hv_acpi_dev = device;
result = acpi_walk_resources(device->handle, METHOD_NAME__CRS, result = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
vmbus_walk_resources, &irq); vmbus_walk_resources, NULL);
if (ACPI_FAILURE(result)) { if (ACPI_FAILURE(result))
complete(&probe_event); goto acpi_walk_err;
return -ENODEV; /*
* The parent of the vmbus acpi device (Gen2 firmware) is the VMOD that
* has the mmio ranges. Get that.
*/
if (device->parent) {
result = acpi_walk_resources(device->parent->handle,
METHOD_NAME__CRS,
vmbus_walk_resources, NULL);
if (ACPI_FAILURE(result))
goto acpi_walk_err;
} }
ret_val = 0;
acpi_walk_err:
complete(&probe_event); complete(&probe_event);
return 0; return ret_val;
} }
static const struct acpi_device_id vmbus_acpi_device_ids[] = { static const struct acpi_device_id vmbus_acpi_device_ids[] = {

View File

@ -1143,6 +1143,9 @@ int hv_vss_init(struct hv_util_service *);
void hv_vss_deinit(void); void hv_vss_deinit(void);
void hv_vss_onchannelcallback(void *); void hv_vss_onchannelcallback(void *);
extern u64 hyperv_mmio_start;
extern u64 hyperv_mmio_size;
/* /*
* Negotiated version with the Host. * Negotiated version with the Host.
*/ */