From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::344; helo=mail-wm1-x344.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 258CA210FCF7F for ; Thu, 4 Oct 2018 07:49:08 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id s12-v6so9329205wmc.0 for ; Thu, 04 Oct 2018 07:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=65FUzNg3J6x0SSsNl5VfG8hb3guIlCXiZRjZOMm6/5k=; b=D4duk7JeT+dOnyMLobmO/vJsZDUhlerX0IIdb+5RmD8WkPvOdmUHcNiQ0qiGjQrsVX OATHaDFCzxMQ/46mGEEvW+3dB94AJJFnRFIPqXPcVVm3gf2vvmAzc0BExDBsOmYK93cn /Hi6uI6XifKmAFryZ3kdkMp7kPdGvQzK5X9Ow= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=65FUzNg3J6x0SSsNl5VfG8hb3guIlCXiZRjZOMm6/5k=; b=Kx3bKdqdqGi9O1zMAHpQELgqBDG2gBV59vfeEoM4+OtIdZpeZnLgGDiLN4jq788Ueb mEuOt6vBXq3d31nn1C6Al0Yi27rvJJ6feXAN8Ps5Vh8DYIIPZClAGHFqT7BOJF5C+rpj tlJvzHNVc9mHJdCr/s+hqNeF9vlQsQGQpVmr5YBDEl1iTcGHCHIctqQRsEEE3m8IKvn3 0DRiajAepTIV3MqeKZ8Ro++Uls7mO5y9MZLtjHvEfd4IaJIl30DPs8Jzuh+0UIOE6npU +Sbm7/9F33joy1jWSbPnDWWc7bRtZpyYF1OYWb/99gW3DZT71p5j4gN3l60Yl5zOcpfM u7gA== X-Gm-Message-State: ABuFfohJYNoX+j8Mwq9K02HC3MtbNvLcpO+aMif5We9XG08li2mtTJZX fXMEgWH1BFybaH63AqqjLB8xJLxLxV0= X-Google-Smtp-Source: ACcGV63bkDjiZ2uxOfuNyPWKvaWcs9OS67RMbK+8Pm3FOnym3yYuViv2vlpVkmvFgmHs2iJXvgfUhw== X-Received: by 2002:a1c:7809:: with SMTP id t9-v6mr4878614wmc.77.1538664547380; Thu, 04 Oct 2018 07:49:07 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id e14-v6sm4221939wrt.76.2018.10.04.07.49.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 07:49:05 -0700 (PDT) Date: Thu, 4 Oct 2018 15:49:04 +0100 From: Leif Lindholm To: Haojian Zhuang Cc: edk2-devel@lists.01.org, Ard Biesheuvel Message-ID: <20181004144904.sdanz2vstp4hwhwk@bivouac.eciton.net> References: <1534761085-26972-1-git-send-email-haojian.zhuang@linaro.org> <1534761085-26972-2-git-send-email-haojian.zhuang@linaro.org> MIME-Version: 1.0 In-Reply-To: <1534761085-26972-2-git-send-email-haojian.zhuang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH v1 1/2] EmbeddedPkg: add DwUsb protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2018 14:49:09 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 20, 2018 at 06:31:24PM +0800, Haojian Zhuang wrote: > The protocol defines the callbacks that could be implemented in > platform driver. DwUsb device driver needs these callbacks to > implement USB device functionality. > > Cc: Leif Lindholm > Cc: Ard Biesheuvel > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Haojian Zhuang > --- > EmbeddedPkg/Include/Protocol/DwUsb.h | 81 ++++++++++++++++++++ > 1 file changed, 81 insertions(+) > > diff --git a/EmbeddedPkg/Include/Protocol/DwUsb.h b/EmbeddedPkg/Include/Protocol/DwUsb.h > new file mode 100644 > index 000000000000..b9fb776f9258 > --- /dev/null > +++ b/EmbeddedPkg/Include/Protocol/DwUsb.h > @@ -0,0 +1,81 @@ > +/** @file > + > + Copyright (c) 2018, Linaro. All rights reserved. > + > + This program and the accompanying materials are licensed and made available > + under the terms and conditions of the BSD License which accompanies this > + distribution. The full text of the license may be found at > + http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > + > +**/ > + > +#ifndef __DW_USB_H__ > +#define __DW_USB_H__ Can you expand all instances of public interfaces to DESIGNWARE? > + > +// > +// Protocol GUID > +// > +#define DW_USB_PROTOCOL_GUID { 0x109fa264, 0x7811, 0x4862, { 0xa9, 0x73, 0x4a, 0xb2, 0xef, 0x2e, 0xe2, 0xff }} > + > +// > +// Protocol interface structure > +// > +typedef struct _DW_USB_PROTOCOL DW_USB_PROTOCOL; > + > +#define USB_HOST_MODE 0 > +#define USB_DEVICE_MODE 1 > +#define USB_CABLE_NOT_ATTACHED 2 And add a DESIGNWARE_ prefix to these? > + > +#define LANG_LENGTH 8 > +#define MANU_FACTURER_STRING_LENGTH 32 MANUFACTURER. Why the hardcoded string lengths? Are they mandated somewhere? > +#define PRODUCT_STRING_LENGTH 32 > +#define SERIAL_STRING_LENGTH 17 > + > +typedef > +EFI_STATUS > +(EFIAPI *DW_USB_GET_LANG) ( > + OUT CHAR16 *Lang, > + OUT UINT8 *Length > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *DW_USB_GET_MANU_FACTURER) ( > + OUT CHAR16 *ManuFacturer, ManuFacturer -> Manufacturer. > + OUT UINT8 *Length > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *DW_USB_GET_PRODUCT) ( > + OUT CHAR16 *Product, > + OUT UINT8 *Length > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *DW_USB_GET_SERIAL_NO) ( SERIAL_NUMBER > + OUT CHAR16 *SerialNo, SerialNumber. > + OUT UINT8 *Length > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *DW_USB_PHY_INIT) ( > + IN UINT8 Mode > + ); > + > +struct _DW_USB_PROTOCOL { > + DW_USB_GET_LANG GetLang; > + DW_USB_GET_MANU_FACTURER GetManuFacturer; GetManuFacturer -> GetManufacturer. > + DW_USB_GET_PRODUCT GetProduct; > + DW_USB_GET_SERIAL_NO GetSerialNo; > + DW_USB_PHY_INIT PhyInit; > +}; > + > +extern EFI_GUID gDwUsbProtocolGuid; gDesignWareUsbProtocolGuid. / Leif > + > +#endif /* __DW_USB_H__ */ > -- > 2.7.4 >