From: Laszlo Ersek <lersek@redhat.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
edk2-devel@ml01.01.org
Cc: fabio.fantoni@m2r.biz, xen-devel@lists.xensource.com
Subject: Re: [edk2] [PATCH v2] OvmfPkg: XenPvBlkDxe: handle empty cdrom drives
Date: Wed, 21 Oct 2015 14:45:23 +0200 [thread overview]
Message-ID: <562788E3.4080408@redhat.com> (raw)
In-Reply-To: <1445427562-21121-1-git-send-email-stefano.stabellini@eu.citrix.com>
On 10/21/15 13:39, Stefano Stabellini wrote:
> Empty cdroms are not going to connect, avoid waiting for the backend to
> switch to state 4, which is never going to happen, and return
> error instead from XenPvBlockFrontInitialization(). Detect an
> empty cdrom by looking at the "params" node on xenstore, which is set to
> "" or "aio:" for empty drives by libxl.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> ---
> Changes in v2:
> - better commit message
> - return EFI_DEVICE_ERROR instead of EFI_NO_MEDIA
> - check the return status of XenBusIo->XsBackendRead
> ---
> OvmfPkg/XenPvBlkDxe/BlockFront.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c
> index 256ac55..d07e980 100644
> --- a/OvmfPkg/XenPvBlkDxe/BlockFront.c
> +++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c
> @@ -169,6 +169,7 @@ XenPvBlockFrontInitialization (
> XEN_BLOCK_FRONT_DEVICE *Dev;
> XenbusState State;
> UINT64 Value;
> + CHAR8 *Params;
>
> ASSERT (NodeName != NULL);
>
> @@ -186,6 +187,20 @@ XenPvBlockFrontInitialization (
> }
> FreePool (DeviceType);
>
> + if (Dev->MediaInfo.CdRom) {
> + Status = XenBusIo->XsBackendRead (XenBusIo, XST_NIL, "params", (VOID**)&Params);
> + if (Status != XENSTORE_STATUS_SUCCESS) {
> + DEBUG ((EFI_D_ERROR, "%a: Failed to read params (%d)\n", __FUNCTION__, Status));
> + goto Error;
> + }
> + if (AsciiStrLen (Params) == 0 || AsciiStrCmp (Params, "aio:") == 0) {
> + FreePool (Params);
> + DEBUG ((EFI_D_INFO, "%a: Empty cdrom\n", __FUNCTION__));
> + goto Error;
> + }
> + FreePool (Params);
> + }
> +
> Status = XenBusReadUint64 (XenBusIo, "backend-id", FALSE, &Value);
> if (Status != XENSTORE_STATUS_SUCCESS || Value > MAX_UINT16) {
> DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to get backend-id (%d)\n",
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
I test-built this for X64 and Ia32, and then committed it to SVN as rev
18651.
Thanks!
Laszlo
next prev parent reply other threads:[~2015-10-21 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 11:39 [edk2] [PATCH v2] OvmfPkg: XenPvBlkDxe: handle empty cdrom drives Stefano Stabellini
2015-10-21 12:45 ` Laszlo Ersek [this message]
2015-10-21 13:59 ` Fabio Fantoni
2015-10-21 15:29 ` Stefano Stabellini
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=562788E3.4080408@redhat.com \
--to=lersek@redhat.com \
--cc=edk2-devel@ml01.01.org \
--cc=fabio.fantoni@m2r.biz \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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.