diff options
| author | David Vrabel <david.vrabel@citrix.com> | 2013-04-03 12:31:50 -0400 |
|---|---|---|
| committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-04-16 15:04:37 -0400 |
| commit | 96f28bc66adb1414cfc9405ff80cfffdc44edd84 (patch) | |
| tree | 820171477737b2d8c8528a5784eccb41cf64849c | |
| parent | 31880c37c11e28cb81c70757e38392b42e695dc6 (diff) | |
x86/xen: populate boot_params with EDD data
During early setup of a dom0 kernel, populate boot_params with the
Enhanced Disk Drive (EDD) and MBR signature data. This makes
information on the BIOS boot device available in /sys/firmware/edd/.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| -rw-r--r-- | arch/x86/xen/enlighten.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index c8e1c7b95c3b..47d32434d0b6 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
| 33 | #include <linux/memblock.h> | 33 | #include <linux/memblock.h> |
| 34 | #include <linux/edd.h> | ||
| 34 | 35 | ||
| 35 | #include <xen/xen.h> | 36 | #include <xen/xen.h> |
| 36 | #include <xen/events.h> | 37 | #include <xen/events.h> |
| @@ -1306,6 +1307,55 @@ static const struct machine_ops xen_machine_ops __initconst = { | |||
| 1306 | .emergency_restart = xen_emergency_restart, | 1307 | .emergency_restart = xen_emergency_restart, |
| 1307 | }; | 1308 | }; |
| 1308 | 1309 | ||
| 1310 | static void __init xen_boot_params_init_edd(void) | ||
| 1311 | { | ||
| 1312 | #if IS_ENABLED(CONFIG_EDD) | ||
| 1313 | struct xen_platform_op op; | ||
| 1314 | struct edd_info *edd_info; | ||
| 1315 | u32 *mbr_signature; | ||
| 1316 | unsigned nr; | ||
| 1317 | int ret; | ||
| 1318 | |||
| 1319 | edd_info = boot_params.eddbuf; | ||
| 1320 | mbr_signature = boot_params.edd_mbr_sig_buffer; | ||
| 1321 | |||
| 1322 | op.cmd = XENPF_firmware_info; | ||
| 1323 | |||
| 1324 | op.u.firmware_info.type = XEN_FW_DISK_INFO; | ||
| 1325 | for (nr = 0; nr < EDDMAXNR; nr++) { | ||
| 1326 | struct edd_info *info = edd_info + nr; | ||
| 1327 | |||
| 1328 | op.u.firmware_info.index = nr; | ||
| 1329 | info->params.length = sizeof(info->params); | ||
| 1330 | set_xen_guest_handle(op.u.firmware_info.u.disk_info.edd_params, | ||
| 1331 | &info->params); | ||
| 1332 | ret = HYPERVISOR_dom0_op(&op); | ||
| 1333 | if (ret) | ||
| 1334 | break; | ||
| 1335 | |||
| 1336 | #define C(x) info->x = op.u.firmware_info.u.disk_info.x | ||
| 1337 | C(device); | ||
| 1338 | C(version); | ||
| 1339 | C(interface_support); | ||
| 1340 | C(legacy_max_cylinder); | ||
| 1341 | C(legacy_max_head); | ||
| 1342 | C(legacy_sectors_per_track); | ||
| 1343 | #undef C | ||
| 1344 | } | ||
| 1345 | boot_params.eddbuf_entries = nr; | ||
| 1346 | |||
| 1347 | op.u.firmware_info.type = XEN_FW_DISK_MBR_SIGNATURE; | ||
| 1348 | for (nr = 0; nr < EDD_MBR_SIG_MAX; nr++) { | ||
| 1349 | op.u.firmware_info.index = nr; | ||
| 1350 | ret = HYPERVISOR_dom0_op(&op); | ||
| 1351 | if (ret) | ||
| 1352 | break; | ||
| 1353 | mbr_signature[nr] = op.u.firmware_info.u.disk_mbr_signature.mbr_signature; | ||
| 1354 | } | ||
| 1355 | boot_params.edd_mbr_sig_buf_entries = nr; | ||
| 1356 | #endif | ||
| 1357 | } | ||
| 1358 | |||
| 1309 | /* | 1359 | /* |
| 1310 | * Set up the GDT and segment registers for -fstack-protector. Until | 1360 | * Set up the GDT and segment registers for -fstack-protector. Until |
| 1311 | * we do this, we have to be careful not to call any stack-protected | 1361 | * we do this, we have to be careful not to call any stack-protected |
| @@ -1508,6 +1558,8 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1508 | /* Avoid searching for BIOS MP tables */ | 1558 | /* Avoid searching for BIOS MP tables */ |
| 1509 | x86_init.mpparse.find_smp_config = x86_init_noop; | 1559 | x86_init.mpparse.find_smp_config = x86_init_noop; |
| 1510 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; | 1560 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; |
| 1561 | |||
| 1562 | xen_boot_params_init_edd(); | ||
| 1511 | } | 1563 | } |
| 1512 | #ifdef CONFIG_PCI | 1564 | #ifdef CONFIG_PCI |
| 1513 | /* PCI BIOS service won't work from a PV guest. */ | 1565 | /* PCI BIOS service won't work from a PV guest. */ |
