OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
SmbiosInternal.c File Reference
#include <Uefi.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcCpuLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcSmbiosLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include "SmbiosInternal.h"
#include "DebugSmbios.h"

Go to the source code of this file.

Functions

EFI_STATUS SmbiosExtendTable (IN OUT OC_SMBIOS_TABLE *Table, IN UINT32 Size)
 
UINT8 SmbiosOverrideString (IN OC_SMBIOS_TABLE *Table, IN CONST CHAR8 *Override OPTIONAL, IN UINT8 *Index)
 
STATIC EFI_STATUS SmbiosAssignStructHandle (IN OUT OC_SMBIOS_TABLE *Table, IN UINT32 Type, IN UINT16 Index)
 
EFI_STATUS SmbiosInitialiseStruct (IN OUT OC_SMBIOS_TABLE *Table, IN SMBIOS_TYPE Type, IN UINT8 MinLength, IN UINT16 Index)
 
VOID SmbiosFinaliseStruct (IN OUT OC_SMBIOS_TABLE *Table)
 
CHAR8 * SmbiosGetString (IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable, IN SMBIOS_TABLE_STRING String)
 
UINT8 SmbiosSetString (IN OUT CHAR8 **Buffer, IN CONST CHAR8 *String, IN UINT32 Length, IN OUT UINT8 *Index)
 
UINT32 SmbiosGetStructureLength (IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable, IN UINT32 SmbiosTableSize)
 
APPLE_SMBIOS_STRUCTURE_POINTER SmbiosGetStructureOfType (IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable, IN UINT32 SmbiosTableSize, IN SMBIOS_TYPE Type, IN UINT16 Index)
 
UINT16 SmbiosGetStructureCount (IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable, IN UINT32 SmbiosTableSize, IN SMBIOS_TYPE Type)
 

Detailed Description

Copyright (C) 2016 - 2017, The HermitCrabs Lab. All rights reserved.

All rights reserved.

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 http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file SmbiosInternal.c.

Function Documentation

◆ SmbiosAssignStructHandle()

STATIC EFI_STATUS SmbiosAssignStructHandle ( IN OUT OC_SMBIOS_TABLE * Table,
IN UINT32 Type,
IN UINT16 Index )

Definition at line 136 of file SmbiosInternal.c.

◆ SmbiosExtendTable()

EFI_STATUS SmbiosExtendTable ( IN OUT OC_SMBIOS_TABLE * Table,
IN UINT32 Size )

Allocate bytes in SMBIOS table if necessary

Parameters
[in,out]TableCurrent table buffer.
[in]SizeAmount of free bytes needed.
Return values
EFI_SUCCESSon success

Definition at line 34 of file SmbiosInternal.c.

◆ SmbiosFinaliseStruct()

VOID SmbiosFinaliseStruct ( IN OUT OC_SMBIOS_TABLE * Table)

Finalise SMBIOS structure

Parameters
[in]TablePointer to location containing the current address within the buffer.
Return values

Definition at line 332 of file SmbiosInternal.c.

◆ SmbiosGetString()

CHAR8 * SmbiosGetString ( IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable,
IN SMBIOS_TABLE_STRING StringIndex )

Obtain string from previously validated structure.

Parameters
[in]SmbiosTable
[in]StringIndexString Index to retrieve
Return values

Definition at line 362 of file SmbiosInternal.c.

◆ SmbiosGetStructureCount()

UINT16 SmbiosGetStructureCount ( IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable,
IN UINT32 SmbiosTableSize,
IN SMBIOS_TYPE Type )

Obtain structure count of specified type.

Parameters
[in]SmbiosTablePointer to SMBIOS table.
[in]SmbiosTableSizeSMBIOS table size
Return values
structurecount or 0

Definition at line 501 of file SmbiosInternal.c.

◆ SmbiosGetStructureLength()

UINT32 SmbiosGetStructureLength ( IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable,
IN UINT32 SmbiosTableSize )

Obtain and validate structure length.

Parameters
[in]SmbiosTable
[in]SmbiosTableSizeSMBIOS table size
Return values
tablelength or 0 for invalid

Definition at line 415 of file SmbiosInternal.c.

◆ SmbiosGetStructureOfType()

APPLE_SMBIOS_STRUCTURE_POINTER SmbiosGetStructureOfType ( IN APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable,
IN UINT32 SmbiosTableSize,
IN SMBIOS_TYPE Type,
IN UINT16 Index )

Obtain and validate Nth structure of specified type.

Parameters
[in]SmbiosTablePointer to SMBIOS table.
[in]SmbiosTableSizeSMBIOS table size
[in]TypeSMBIOS table type
[in]IndexSMBIOS table index starting from 1
Return values
foundtable or NULL

Definition at line 444 of file SmbiosInternal.c.

◆ SmbiosInitialiseStruct()

EFI_STATUS SmbiosInitialiseStruct ( IN OUT OC_SMBIOS_TABLE * Table,
IN SMBIOS_TYPE Type,
IN UINT8 MinLength,
IN UINT16 Index )

Initialise SMBIOS structure

Parameters
[in]TablePointer to location containing the current address within the buffer.
[in]TypeTable type.
[in]MinLengthInitial length of the table.
[in]IndexTable index, normally 1.
Return values

Definition at line 304 of file SmbiosInternal.c.

◆ SmbiosOverrideString()

UINT8 SmbiosOverrideString ( IN OC_SMBIOS_TABLE * Table,
IN CONST CHAR8 *Override OPTIONAL,
IN UINT8 * Index )

Definition at line 93 of file SmbiosInternal.c.

◆ SmbiosSetString()

UINT8 SmbiosSetString ( IN OUT CHAR8 ** Buffer,
IN CONST CHAR8 * String,
IN UINT32 Length,
IN OUT UINT8 * Index )

Write string to SMBIOS structure

Parameters
[in,out]BufferPointer to location containing the current address within the buffer.
[in]StringBuffer containing the null terminated ascii string.
[in]LengthString length to write.
[in,out]IndexPointer to current string index, incremented on success.
Return values
assignedstring index or 0

Definition at line 395 of file SmbiosInternal.c.