From: "Michael Brown" <mcb30@ipxe.org>
To: Ethin Probst <harlydavidsen@gmail.com>
Cc: devel@edk2.groups.io
Subject: Re: [edk2-devel] EFI_AUDIO_OUTPUT_PROTOCOL: assistance with VirtIO initialization
Date: Fri, 2 Jul 2021 10:41:36 +0100 [thread overview]
Message-ID: <078c0061-ba4c-dc72-a6b5-2341ed56dd40@ipxe.org> (raw)
In-Reply-To: <CAJQtwF3WnWCvgmfPJ6NFS9GuqwPdWeOZz1Nnn3WmeZm5A7xDmg@mail.gmail.com>
On 01/07/2021 19:10, Ethin Probst wrote:
> The first: I don't know how to retrieve the descriptors on the UEFI
> API. I've looked at the Chaos Key DXE, if memory serves, or the
> display port one -- one of the two. One of them contained a
> ReadDescriptor() function, and so I've borrowed that, but that doesn't
> really help much.
I have no idea what higher-level utility library functions exist within
EDK2 that you might be able to use. Based on skimming through the USB
audio spec, at the raw protocol level you would need to use
EFI_USB_IO_PROTOCOL.UsbControlTransfer() something like:
#define AUDIO_CS_INTERFACE 0x24
#pragma pack(1)
typedef struct {
UINT8 Length;
UINT8 DescriptorType;
UINT8 DescriptorSubType;
UINT16 BcdADC;
UINT16 TotalLength;
UINT8 InCollection;
} AUDIO_HEADER_DESCRIPTOR;
#pragma pack()
EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
EFI_USB_DEVICE_REQUEST Req;
AUDIO_CS_HEADER Header;
UINT32 Status;
UsbIo->UsbGetInterfaceDescriptor(UsbIo, &InterfaceDescriptor);
Req.RequestType = (USB_DEV_GET_DESCRIPTOR_REQ_TYPE |
USB_REQ_TYPE_CLASS);
Req.Request = USB_REQ_GET_DESCRIPTOR;
Req.Value = (AUDIO_CS_INTERFACE << 8);
Req.Index = InterfaceDescriptor.InterfaceNumber;
Req.Length = sizeof(Header);
UsbIo->UsbControlTransfer(UsbIo, &Req, EfiUsbDataIn,
PcdGet32 (PcdUsbTransferTimeoutValue),
&Header, sizeof(Header), &Status);
(Error handling etc omitted for brevity)
That would get you the first 8 bytes of the class-specific AC interface
header descriptor. You would then need to extract the TotalLength
field, allocate that length of memory, and repeat the
UsbControlTransfer() call to fetch the full-length descriptor into the
newly allocated block.
Hope that helps,
Michael
next prev parent reply other threads:[~2021-07-02 9:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 23:01 EFI_AUDIO_OUTPUT_PROTOCOL: assistance with VirtIO initialization Ethin Probst
2021-07-01 14:15 ` [edk2-devel] " Michael Brown
2021-07-01 18:10 ` Ethin Probst
2021-07-02 8:59 ` Laszlo Ersek
2021-07-02 9:41 ` Michael Brown [this message]
[not found] ` <168DEFFB0E406B59.30759@groups.io>
2021-07-02 9:46 ` Michael Brown
2021-07-02 18:18 ` Ethin Probst
2021-07-02 18:22 ` Ethin Probst
2021-07-06 12:53 ` Michael Brown
2021-07-02 8:54 ` Laszlo Ersek
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-list 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=078c0061-ba4c-dc72-a6b5-2341ed56dd40@ipxe.org \
--to=devel@edk2.groups.io \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox