Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store NVME serial number to smbios #11

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

jiaxuan-guo marked this conversation as resolved.
Show resolved Hide resolved
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
Loading