Skip to content

Commit

Permalink
Store NVME serial number to smbios
Browse files Browse the repository at this point in the history
Store NVME serial number to smbios at efiwrapper.

Tracked-On: OAM-112587
Signed-off-by: Guo, Jade <[email protected]>
  • Loading branch information
jiaxuan-guo committed Nov 8, 2023
1 parent 1b79ef8 commit f250c8a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/nvme/NvmExpressHci.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <efi.h>
#include <efilib.h>
#include <arch/io.h>

#include "smbios.h"
#include "NvmExpress.h"

/**
Expand Down Expand Up @@ -803,7 +803,7 @@ NvmeControllerInit (
NVME_AQA Aqa;
NVME_ASQ Asq;
NVME_ACQ Acq;
UINT8 Sn[21];
UINT8 Sn[9];
UINT8 Mn[41];
UINT32 NvmeHCBase;

Expand Down Expand Up @@ -935,7 +935,7 @@ NvmeControllerInit (
// Dump NvmExpress Identify Controller Data
//
CopyMem (Sn, Private->ControllerData->Sn, sizeof (Private->ControllerData->Sn));
Sn[20] = 0;
Sn[8] = 0;
CopyMem (Mn, Private->ControllerData->Mn, sizeof (Private->ControllerData->Mn));
Mn[40] = 0;
DEBUG_NVME ((EFI_D_INFO, " == NVME IDENTIFY CONTROLLER DATA ==\n"));
Expand All @@ -953,6 +953,8 @@ NvmeControllerInit (
DEBUG_NVME ((EFI_D_INFO, " Oncs : 0x%x\n", Private->ControllerData->Oncs));
DEBUG_NVME ((EFI_D_INFO, " Oacs : 0x%x\n", Private->ControllerData->Oacs));

smbios_set(TYPE_PRODUCT, offsetof(SMBIOS_TYPE1, SerialNumber), Sn);

//
// Create two I/O completion queues.
// One for blocking I/O, one for non-blocking I/O.
Expand Down
7 changes: 7 additions & 0 deletions include/libefiwrapper/smbios.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@

#define SMBIOS_UNDEFINED "N/A"

#define offsetof(st, m) __builtin_offsetof(st, m)
//copy from celadon/hardware/intel/kernelflinger/include/smbios.h
#define TYPE_BIOS 0
#define TYPE_PRODUCT 1
#define TYPE_BOARD 2
#define TYPE_CHASSIS 3

EFI_STATUS smbios_init(EFI_SYSTEM_TABLE *st);
EFI_STATUS smbios_free(EFI_SYSTEM_TABLE *st);
EFI_STATUS smbios_set(UINT8 type, UINT8 offset, const char *value);
Expand Down

0 comments on commit f250c8a

Please sign in to comment.