From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from blyat.fensystems.co.uk (blyat.fensystems.co.uk [54.246.183.96]) by mx.groups.io with SMTP id smtpd.web11.7436.1625218900488394470 for ; Fri, 02 Jul 2021 02:41:41 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: ipxe.org, ip: 54.246.183.96, mailfrom: mcb30@ipxe.org) Received: from dolphin.home (unknown [IPv6:2a00:23c6:5495:5e00:72b3:d5ff:feb1:e101]) by blyat.fensystems.co.uk (Postfix) with ESMTPSA id B7D4544181; Fri, 2 Jul 2021 09:41:36 +0000 (UTC) Subject: Re: [edk2-devel] EFI_AUDIO_OUTPUT_PROTOCOL: assistance with VirtIO initialization To: Ethin Probst Cc: devel@edk2.groups.io References: From: "Michael Brown" Message-ID: <078c0061-ba4c-dc72-a6b5-2341ed56dd40@ipxe.org> Date: Fri, 2 Jul 2021 10:41:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on blyat.fensystems.co.uk Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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