All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] x86/xen: populate boot_params with EDD data
Date: Wed, 3 Apr 2013 16:00:27 +0100	[thread overview]
Message-ID: <515C440B.3010208@citrix.com> (raw)
In-Reply-To: <20130403145352.GE6044@phenom.dumpdata.com>

On 03/04/13 15:53, Konrad Rzeszutek Wilk wrote:
> On Wed, Apr 03, 2013 at 12:10:49PM +0100, David Vrabel wrote:
>> From: David Vrabel <david.vrabel@citrix.com>
>>
>> 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/.
[...]
>> --- a/arch/x86/xen/enlighten.c
>> +++ b/arch/x86/xen/enlighten.c
>> @@ -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)
>> +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;
> 
> If those two loops end up terminating at different spots (say first
> one ends at nr=1, and the second at nr=5), is that going to present
> a problem?
> 
> Should we have some form of 'min(nr_earlier, nr)' to clamp down in
> case of weird oddities?

The edd firmware driver looks to correctly handle this -- it will only
show attributes for things that exist.

David

      reply	other threads:[~2013-04-03 15:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 11:10 [PATCH] x86/xen: populate boot_params with EDD data David Vrabel
2013-04-03 12:47 ` Jan Beulich
2013-04-03 12:49   ` David Vrabel
2013-04-03 14:51     ` Konrad Rzeszutek Wilk
2013-04-03 16:31       ` [PATCHv3] " David Vrabel
2013-04-03 13:29   ` [PATCHv2] " David Vrabel
2013-04-03 13:40     ` Jan Beulich
2013-04-03 14:53 ` [PATCH] " Konrad Rzeszutek Wilk
2013-04-03 15:00   ` David Vrabel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515C440B.3010208@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.