/** @file
API for SMBIOS table.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "../UefiShellDebug1CommandsLib.h"
#include "LibSmbios.h"
#include "LibSmbiosView.h"
#include "SmbiosView.h"
/**
Init the SMBIOS VIEW API's environment.
@retval EFI_SUCCESS Successful to init the SMBIOS VIEW Lib.
**/
)
{
//
// Init only once
//
if (mInit == 1) {
return EFI_SUCCESS;
}
//
// Get SMBIOS table from System Configure table
//
if (mSmbiosTable == NULL) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle);
return EFI_NOT_FOUND;
}
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status);
return Status;
}
//
// Init SMBIOS structure table address
//
mInit = 1;
return EFI_SUCCESS;
}
/**
Cleanup the Smbios information.
**/
)
{
//
// Release resources
//
if (mSmbiosTable != NULL) {
mSmbiosTable = NULL;
}
mInit = 0;
}
/**
Get the entry point structure for the table.
@param[out] EntryPointStructure The pointer to populate.
**/
)
{
//
// return SMBIOS Table address
//
}
/**
Get SMBIOS structure given the Handle,copy data to the Buffer,
Handle is changed to the next handle or 0xFFFF when the end is
reached or the handle is not found.
@param[in, out] Handle 0xFFFF: get the first structure
Others: get a structure according to this value.
@param[in, out] Buffer The pointer to the caller's memory buffer.
@param[out] Length Length of return buffer in bytes.
@retval DMI_SUCCESS Buffer contains the required structure data
Handle is updated with next structure handle or
0xFFFF(end-of-list).
@retval DMI_INVALID_HANDLE Buffer not contain the requiring structure data.
Handle is updated with next structure handle or
0xFFFF(end-of-list).
**/
)
{
if (*Handle == INVALIDE_HANDLE) {
return DMI_INVALID_HANDLE;
}
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_SPEC), gShellDebug1HiiHandle);
return DMI_INVALID_HANDLE;
}
*Length = 0;
//
// Walk to next structure
//
//
// Length = Next structure head - this structure head
//
//
// update with the next structure handle.
//
} else {
}
return DMI_SUCCESS;
}
//
// Walk to next structure
//
}
return DMI_INVALID_HANDLE;
}
/**
Check the structure to see if it is legal.
@param[in] Smbios - Pointer to the structure that will be checked.
@retval DMI_SUCCESS Structure data is legal.
@retval DMI_BAD_PARAMETER Structure data contains bad parameter.
**/
)
{
//
// If key != value, then error.
//
//
// Assume staus is EFI_SUCCESS,
// but if check is error, then EFI_ERROR.
//
case 0:
break;
case 1:
} else {
}
break;
case 2:
break;
case 6:
break;
case 11:
break;
case 12:
break;
case 13:
break;
case 16:
break;
case 19:
break;
case 20:
break;
case 32:
//
// Because EFI_SUCCESS == 0,
// So errors added up is also error.
//
break;
default:
}
return Status;
}
/**
Get a string from the smbios information.
@param[in] Smbios The pointer to the smbios information.
@param[in] StringNumber The index to the string to get.
@param[out] Buffer The buffer to fill with the string when retrieved.
**/
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUF_SPEC_WHEN_STRUCT), gShellDebug1HiiHandle);
return ;
}
//
// Get string and copy to buffer.
// Caller should provide the buffer.
//
} else {
}
}