On 10 February 2017 at 19:37, Leif Lindholm leif.lindholm@linaro.org wrote:
On Thu, Feb 09, 2017 at 10:11:48PM +0800, Haojian Zhuang wrote:
Support Designware USB device controller on HiKey platform.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang haojian.zhuang@linaro.org
.../Hisilicon/HiKey/HiKeyUsbDxe/HiKeyUsbDxe.c | 266 +++++++++++++++++++++ .../Hisilicon/HiKey/HiKeyUsbDxe/HiKeyUsbDxe.inf | 46 ++++ 2 files changed, 312 insertions(+) create mode 100644 Platforms/Hisilicon/HiKey/HiKeyUsbDxe/HiKeyUsbDxe.c create mode 100644 Platforms/Hisilicon/HiKey/HiKeyUsbDxe/HiKeyUsbDxe.inf
diff --git a/Platforms/Hisilicon/HiKey/HiKeyUsbDxe/HiKeyUsbDxe.c b/Platforms/Hisilicon/HiKey/HiKeyUsbDxe/HiKeyUsbDxe.c new file mode 100644 index 0000000..60ad4d6 --- /dev/null +++ b/Platforms/Hisilicon/HiKey/HiKeyUsbDxe/HiKeyUsbDxe.c
+EFI_STATUS +EFIAPI +HiKeyUsbGetProduct (
- OUT CHAR16 *Product,
- OUT UINT8 *Length
- )
+{
- UINTN VariableSize;
- CHAR16 DataUnicode[PRODUCT_STRING_LENGTH];
- if ((Product == NULL) || (Length == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- VariableSize = PRODUCT_STRING_LENGTH * sizeof (CHAR16);
- ZeroMem (DataUnicode, PRODUCT_STRING_LENGTH * sizeof(CHAR16));
- StrCpy (DataUnicode, L"HiKey");
- CopyMem (Product, DataUnicode, VariableSize);
- *Length = VariableSize;
- return EFI_SUCCESS;
+}
+EFI_STATUS +EFIAPI +HiKeyUsbGetSerialNo (
- OUT CHAR16 *SerialNo,
- OUT UINT8 *Length
- )
+{
- UINTN VariableSize;
- CHAR16 DataUnicode[SERIAL_STRING_LENGTH];
- if ((SerialNo == NULL) || (Length == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- VariableSize = SERIAL_STRING_LENGTH * sizeof (CHAR16);
- ZeroMem (DataUnicode, SERIAL_STRING_LENGTH * sizeof(CHAR16));
- StrCpy (DataUnicode, L"0123456789abcdef");
A hardcoded serial number will make you no friends in validation labs. I would suggest that as a start, this fake serial number is broken out to be retreived from a helper function (which for now can return only a made up one). Then at a later date, you can figure out how to provide it with some data that lets you actually tell different devices apart.
It's simplified at here. I'll add code to fill custom serial number later. For this patch, it's used to make fastboot app working.