Home | History | Annotate | Download | only in Library
      1 /** @file
      2 
      3   Copyright (c) 2017, Linaro. All rights reserved.
      4 
      5   This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 #ifndef __USB_SERIAL_NUMBER_LIB_H__
     16 #define __USB_SERIAL_NUMBER_LIB_H__
     17 
     18 #include <Uefi.h>
     19 
     20 #define SERIAL_NUMBER_SIZE                      17
     21 
     22 typedef struct {
     23   UINT64        Magic;
     24   UINT64        Data;
     25   CHAR16        UnicodeSN[SERIAL_NUMBER_SIZE];
     26 } RANDOM_SERIAL_NUMBER;
     27 
     28 EFI_STATUS
     29 GenerateUsbSNBySeed (
     30   IN  UINT32                  Seed,
     31   OUT RANDOM_SERIAL_NUMBER   *RandomSN
     32   );
     33 
     34 EFI_STATUS
     35 GenerateUsbSN (
     36   OUT CHAR16                 *UnicodeSN
     37   );
     38 
     39 EFI_STATUS
     40 LoadSNFromBlock (
     41   IN  EFI_HANDLE              FlashHandle,
     42   IN  EFI_LBA                 Lba,
     43   OUT CHAR16                 *UnicodeSN
     44   );
     45 
     46 EFI_STATUS
     47 StoreSNToBlock (
     48   IN EFI_HANDLE               FlashHandle,
     49   IN EFI_LBA                  Lba,
     50   IN CHAR16                  *UnicodeSN
     51   );
     52 
     53 #endif /* __USB_SERIAL_NUMBER_LIB_H__ */
     54