[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/xen: populate boot_params with EDD data



>>> On 03.04.13 at 13:10, David Vrabel <david.vrabel@xxxxxxxxxx> wrote:
> @@ -1306,6 +1307,60 @@ static const struct machine_ops xen_machine_ops 
> __initconst = {
>       .emergency_restart = xen_emergency_restart,
>  };
>  
> +#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)

This is

#if IS_ENABLED(CONFIG_EDD)

nowadays.

> +static void __init load_edd(void)
> +{
> +     struct xen_platform_op op;
> +     struct edd_info *edd_info;
> +     u32 *mbr_signature;
> +     unsigned nr;
> +     int ret;
> +
> +     edd_info = boot_params.eddbuf;
> +     mbr_signature = boot_params.edd_mbr_sig_buffer;
> +
> +     op.cmd = XENPF_firmware_info;
> +
> +     op.u.firmware_info.type = XEN_FW_DISK_INFO;
> +     for (nr = 0; nr < EDDMAXNR; nr++) {
> +             struct edd_info *info = edd_info + nr;
> +
> +             op.u.firmware_info.index = nr;
> +             info->params.length = sizeof(info->params);
> +             set_xen_guest_handle(op.u.firmware_info.u.disk_info.edd_params,
> +                                  &info->params);
> +             ret = HYPERVISOR_dom0_op(&op);
> +             if (ret)
> +                     break;
> +
> +#define C(x) info->x = op.u.firmware_info.u.disk_info.x
> +             C(device);
> +             C(version);
> +             C(interface_support);
> +             C(legacy_max_cylinder);
> +             C(legacy_max_head);
> +             C(legacy_sectors_per_track);
> +#undef C
> +     }
> +     boot_params.eddbuf_entries = nr;
> +
> +     op.u.firmware_info.type = XEN_FW_DISK_MBR_SIGNATURE;
> +     for (nr = 0; nr < EDD_MBR_SIG_MAX; nr++) {
> +             op.u.firmware_info.index = nr;
> +             ret = HYPERVISOR_dom0_op(&op);
> +             if (ret)
> +                     break;
> +             mbr_signature[nr] = 
> op.u.firmware_info.u.disk_mbr_signature.mbr_signature;
> +     }
> +     boot_params.edd_mbr_sig_buf_entries = nr;
> +}
> +#else
> +static inline void __init load_edd(void)
> +{
> +}
> +#endif

And if you put the conditionals inside the curly braces, you can
avoid the else portion here altogether.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.