summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2014-01-29 21:14:39 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 18:21:48 -0500
commit90f3453585479d5beb75058da46eb573ced0e6ac (patch)
treee4219afd86876cd682e6c5c2581bc6c2754aa27d
parent5267cf02c7794953d89e9593a0d497bf43e3790d (diff)
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>
-rw-r--r--drivers/hv/vmbus_drv.c45
-rw-r--r--include/linux/hyperv.h3
2 files changed, 35 insertions, 13 deletions
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 077bb1bdac34..b37c91b6ba80 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -43,6 +43,10 @@ static struct acpi_device *hv_acpi_dev;
43static struct tasklet_struct msg_dpc; 43static struct tasklet_struct msg_dpc;
44static struct completion probe_event; 44static struct completion probe_event;
45static int irq; 45static int irq;
46u64 hyperv_mmio_start;
47EXPORT_SYMBOL_GPL(hyperv_mmio_start);
48u64 hyperv_mmio_size;
49EXPORT_SYMBOL_GPL(hyperv_mmio_size);
46 50
47static int vmbus_exists(void) 51static int vmbus_exists(void)
48{ 52{
@@ -886,18 +890,19 @@ void vmbus_device_unregister(struct hv_device *device_obj)
886 890
887 891
888/* 892/*
889 * VMBUS is an acpi enumerated device. Get the the IRQ information 893 * VMBUS is an acpi enumerated device. Get the the information we
890 * from DSDT. 894 * need from DSDT.
891 */ 895 */
892 896
893static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *irq) 897static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
894{ 898{
899 switch (res->type) {
900 case ACPI_RESOURCE_TYPE_IRQ:
901 irq = res->data.irq.interrupts[0];
895 902
896 if (res->type == ACPI_RESOURCE_TYPE_IRQ) { 903 case ACPI_RESOURCE_TYPE_ADDRESS64:
897 struct acpi_resource_irq *irqp; 904 hyperv_mmio_start = res->data.address64.minimum;
898 irqp = &res->data.irq; 905 hyperv_mmio_size = res->data.address64.address_length;
899
900 *((unsigned int *)irq) = irqp->interrupts[0];
901 } 906 }
902 907
903 return AE_OK; 908 return AE_OK;
@@ -906,18 +911,32 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *irq)
906static int vmbus_acpi_add(struct acpi_device *device) 911static int vmbus_acpi_add(struct acpi_device *device)
907{ 912{
908 acpi_status result; 913 acpi_status result;
914 int ret_val = -ENODEV;
909 915
910 hv_acpi_dev = device; 916 hv_acpi_dev = device;
911 917
912 result = acpi_walk_resources(device->handle, METHOD_NAME__CRS, 918 result = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
913 vmbus_walk_resources, &irq); 919 vmbus_walk_resources, NULL);
914 920
915 if (ACPI_FAILURE(result)) { 921 if (ACPI_FAILURE(result))
916 complete(&probe_event); 922 goto acpi_walk_err;
917 return -ENODEV; 923 /*
924 * The parent of the vmbus acpi device (Gen2 firmware) is the VMOD that
925 * has the mmio ranges. Get that.
926 */
927 if (device->parent) {
928 result = acpi_walk_resources(device->parent->handle,
929 METHOD_NAME__CRS,
930 vmbus_walk_resources, NULL);
931
932 if (ACPI_FAILURE(result))
933 goto acpi_walk_err;
918 } 934 }
935 ret_val = 0;
936
937acpi_walk_err:
919 complete(&probe_event); 938 complete(&probe_event);
920 return 0; 939 return ret_val;
921} 940}
922 941
923static const struct acpi_device_id vmbus_acpi_device_ids[] = { 942static const struct acpi_device_id vmbus_acpi_device_ids[] = {
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 167ef47e3d6e..6b862dadbb7a 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1143,6 +1143,9 @@ int hv_vss_init(struct hv_util_service *);
1143void hv_vss_deinit(void); 1143void hv_vss_deinit(void);
1144void hv_vss_onchannelcallback(void *); 1144void hv_vss_onchannelcallback(void *);
1145 1145
1146extern u64 hyperv_mmio_start;
1147extern u64 hyperv_mmio_size;
1148
1146/* 1149/*
1147 * Negotiated version with the Host. 1150 * Negotiated version with the Host.
1148 */ 1151 */