add comments to function declarations and definitions and updated to match coding style document.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11505 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2011-04-05 20:55:45 +00:00
parent c5981e3c3d
commit a1d4bfcc3f
47 changed files with 3680 additions and 3361 deletions

View File

@ -455,6 +455,8 @@ IsUnicodeFile(
Strips out quotes sections of a string.
All of the characters between quotes is replaced with spaces.
@param[in,out] TheString A pointer to the string to update.
**/
VOID
EFIAPI

View File

@ -12,7 +12,7 @@
**/
#if !defined (_SHELL_C_ENTRY_LIB_)
#ifndef _SHELL_C_ENTRY_LIB_
#define _SHELL_C_ENTRY_LIB_
/**

View File

@ -12,14 +12,13 @@
**/
#ifndef __SHELL_BASE__
#define __SHELL_BASE__
#ifndef _SHELL_BASE_
#define _SHELL_BASE_
#define ABS(a) ((a<0)?(-(a)):(a))
typedef VOID *SHELL_FILE_HANDLE;
#ifndef SHELL_FREE_NON_NULL
#define SHELL_FREE_NON_NULL(Pointer) \
do { \
if ((Pointer) != NULL) { \
@ -27,7 +26,6 @@ typedef VOID *SHELL_FILE_HANDLE;
(Pointer) = NULL; \
} \
} while(FALSE)
#endif //SHELL_FREE_NON_NULL
typedef enum {
///

View File

@ -12,7 +12,7 @@
**/
#if !defined (_UEFI_HANDLE_PARSING_LIB_INTERNAL_H_)
#ifndef _UEFI_HANDLE_PARSING_LIB_INTERNAL_H_
#define _UEFI_HANDLE_PARSING_LIB_INTERNAL_H_
#include <Uefi.h>

View File

@ -74,23 +74,16 @@ BOOLEAN HBufferImageOnlyLineNeedRefresh;
BOOLEAN HBufferImageMouseNeedRefresh;
/**
Initialization function for HBufferImage
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HBufferImageInit (
VOID
)
/**
Initialization function for HBufferImage
None
EFI_SUCCESS
EFI_LOAD_ERROR
**/
{
EFI_STATUS Status;
@ -144,25 +137,16 @@ HBufferImageInit (
return EFI_SUCCESS;
}
/**
Backup function for HBufferImage. Only a few fields need to be backup.
This is for making the file buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageBackup (
VOID
)
/**
Backup function for HBufferImage
Only a few fields need to be backup.
This is for making the file buffer refresh
as few as possible.
None
EFI_SUCCESS
**/
{
HBufferImageBackupVar.MousePosition = HBufferImage.MousePosition;
@ -197,27 +181,20 @@ HBufferImageBackup (
return EFI_SUCCESS;
}
EFI_STATUS
HBufferImageFreeLines (
VOID
)
/**
Free all the lines in HBufferImage
/**
Free all the lines in HBufferImage.
Fields affected:
Lines
CurrentLine
NumLines
ListHead
None
EFI_SUCCESS
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageFreeLines (
VOID
)
{
HFreeLines (HBufferImage.ListHead, HBufferImage.Lines);
@ -228,22 +205,15 @@ HBufferImageFreeLines (
return EFI_SUCCESS;
}
/**
Cleanup function for HBufferImage
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageCleanup (
VOID
)
/**
Cleanup function for HBufferImage
None
EFI_SUCCESS
**/
{
EFI_STATUS Status;
@ -257,12 +227,22 @@ HBufferImageCleanup (
HFileImageCleanup ();
HDiskImageCleanup ();
HMemImageCleanup ();
return Status;
}
/**
Print Line on Row
@param[in] Line The lline to print.
@param[in] Row The row on screen ( begin from 1 ).
@param[in] FRow The FRow.
@param[in] Orig The original color.
@param[in] New The color to print with.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImagePrintLine (
IN HEFI_EDITOR_LINE *Line,
@ -272,22 +252,6 @@ HBufferImagePrintLine (
IN HEFI_EDITOR_COLOR_UNION New
)
/**
Print Line on Row
Line - Line to print
Row - Row on screen ( begin from 1 )
FRow - FRow
Orig - Orig
New - Light display
EFI_SUCCESS
**/
{
UINTN Index;
@ -330,7 +294,7 @@ HBufferImagePrintLine (
}
if (HEditorMouseAction == FALSE) {
if (!HEditorMouseAction) {
ShellPrintEx (
0,
(INT32)Row - 1,
@ -417,7 +381,7 @@ HBufferImagePrintLine (
//
// PRINT the buffer content
//
if (HEditorMouseAction == FALSE) {
if (!HEditorMouseAction) {
for (Index = 0; Index < 0x10 && Index < Line->Size; Index++) {
Pos = ASCII_POSITION + Index;
@ -456,6 +420,15 @@ HBufferImagePrintLine (
return EFI_SUCCESS;
}
/**
Function to decide if a column number is stored in the high bits.
@param[in] Column The column to examine.
@param[out] FCol The actual column number.
@retval TRUE The actual column was in high bits and is now in FCol.
@retval FALSE There was not a column number in the high bits.
**/
BOOLEAN
HBufferImageIsAtHighBits (
IN UINTN Column,
@ -479,7 +452,7 @@ HBufferImageIsAtHighBits (
*FCol = (Column / 3) + 1;
if (!(Column % 3)) {
if (Column % 3 == 0) {
return TRUE;
}
@ -490,6 +463,15 @@ HBufferImageIsAtHighBits (
return FALSE;
}
/**
Decide if a point is in the already selected area.
@param[in] MouseRow The row of the point to test.
@param[in] MouseCol The col of the point to test.
@retval TRUE The point is in the selected area.
@retval FALSE The point is not in the selected area.
**/
BOOLEAN
HBufferImageIsInSelectedArea (
IN UINTN MouseRow,
@ -552,6 +534,11 @@ HBufferImageIsInSelectedArea (
return TRUE;
}
/**
Set mouse position according to HBufferImage.MousePosition.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageRestoreMousePosition (
VOID
@ -719,22 +706,15 @@ HBufferImageRestoreMousePosition (
return EFI_SUCCESS;
}
/**
Set cursor position according to HBufferImage.DisplayPosition.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageRestorePosition (
VOID
)
/**
Set cursor position according to HBufferImage.DisplayPosition.
None
EFI_SUCCESS
**/
{
//
// set cursor position
@ -748,7 +728,7 @@ HBufferImageRestorePosition (
return EFI_SUCCESS;
}
/**
/**
Refresh function for HBufferImage.
@retval EFI_SUCCESS The operation was successful.
@ -890,7 +870,7 @@ HBufferImageRefresh (
} while (Link != HBufferImage.ListHead && Row <= EndRow);
while (Row <= EndRow) {
HEditorClearLine (Row);
EditorClearLine (Row, HMainEditor.ScreenSize.Column, HMainEditor.ScreenSize.Row);
Row++;
}
//
@ -915,8 +895,8 @@ HBufferImageRefresh (
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] BufferType The type of buffer to save. IGNORED.
@param[in] Recover TRUE for recovermode, FALSE otherwise.
@ -980,8 +960,8 @@ HBufferImageRead (
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] BufferType The type of buffer to save. IGNORED.
@return EFI_SUCCESS The operation was successful.
@ -1036,7 +1016,7 @@ HBufferImageSave (
return Status;
}
/**
/**
Create a new line and append it to the line list.
Fields affected:
NumLines
@ -1083,7 +1063,7 @@ HBufferImageCreateLine (
return Line;
}
/**
/**
Free the current image.
@retval EFI_SUCCESS The operation was successful.
@ -1101,160 +1081,6 @@ HBufferImageFree (
return EFI_SUCCESS;
}
/**
Dispatch input to different handler
@param[in] Key The input key:
the keys can be:
ASCII KEY
Backspace/Delete
Direction key: up/down/left/right/pgup/pgdn
Home/End
INS
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_OUT_OF_RESOURCES A Memory allocation failed.
**/
EFI_STATUS
HBufferImageHandleInput (
IN EFI_INPUT_KEY *Key
)
{
EFI_STATUS Status;
Status = EFI_SUCCESS;
switch (Key->ScanCode) {
//
// ordinary key
//
case SCAN_NULL:
Status = HBufferImageDoCharInput (Key->UnicodeChar);
break;
//
// up arrow
//
case SCAN_UP:
Status = HBufferImageScrollUp ();
break;
//
// down arrow
//
case SCAN_DOWN:
Status = HBufferImageScrollDown ();
break;
//
// right arrow
//
case SCAN_RIGHT:
Status = HBufferImageScrollRight ();
break;
//
// left arrow
//
case SCAN_LEFT:
Status = HBufferImageScrollLeft ();
break;
//
// page up
//
case SCAN_PAGE_UP:
Status = HBufferImagePageUp ();
break;
//
// page down
//
case SCAN_PAGE_DOWN:
Status = HBufferImagePageDown ();
break;
//
// delete
//
case SCAN_DELETE:
Status = HBufferImageDoDelete ();
break;
//
// home
//
case SCAN_HOME:
Status = HBufferImageHome ();
break;
//
// end
//
case SCAN_END:
Status = HBufferImageEnd ();
break;
default:
Status = StatusBarSetStatusString (L"Unknown Command");
break;
}
return Status;
}
/**
ASCII key + Backspace + return.
@param[in] Char The input char.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
EFIAPI
HBufferImageDoCharInput (
IN CHAR16 Char
)
{
EFI_STATUS Status;
Status = EFI_SUCCESS;
switch (Char) {
case 0:
break;
case 0x08:
Status = HBufferImageDoBackspace ();
break;
case 0x09:
case 0x0a:
case 0x0d:
//
// Tabs, Returns are thought as nothing
//
break;
default:
//
// DEAL WITH ASCII CHAR, filter out thing like ctrl+f
//
if (Char > 127 || Char < 32) {
Status = StatusBarSetStatusString (L"Unknown Command");
} else {
Status = HBufferImageAddChar (Char);
}
break;
}
return Status;
}
/**
change char to int value based on Hex.
@ -1422,23 +1248,114 @@ HBufferImageAddChar (
}
/**
Check user specified FileRow and FileCol is in current screen.
Delete the previous character.
@param[in] FileRow Row of file position ( start from 1 ).
@retval TRUE It's on the current screen.
@retval FALSE It's not on the current screen.
@retval EFI_SUCCESS The operationw as successful.
**/
BOOLEAN
HInCurrentScreen (
IN UINTN FileRow
EFI_STATUS
EFIAPI
HBufferImageDoBackspace (
VOID
)
{
if (FileRow >= HBufferImage.LowVisibleRow && FileRow <= HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 5) - 1) {
return TRUE;
HEFI_EDITOR_LINE *Line;
UINTN FileColumn;
UINTN FPos;
BOOLEAN LastLine;
//
// variable initialization
//
LastLine = FALSE;
//
// already the first character
//
if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {
return EFI_SUCCESS;
}
return FALSE;
FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
FileColumn = HBufferImage.BufferPosition.Column;
Line = HBufferImage.CurrentLine;
LastLine = FALSE;
if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {
LastLine = TRUE;
}
HBufferImageDeleteCharacterFromBuffer (FPos - 1, 1, NULL);
//
// if is the last line
// then only this line need to be refreshed
//
if (LastLine) {
HBufferImageNeedRefresh = FALSE;
HBufferImageOnlyLineNeedRefresh = TRUE;
} else {
HBufferImageNeedRefresh = TRUE;
HBufferImageOnlyLineNeedRefresh = FALSE;
}
if (!HBufferImage.Modified) {
HBufferImage.Modified = TRUE;
}
return EFI_SUCCESS;
}
/**
ASCII key + Backspace + return.
@param[in] Char The input char.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
EFIAPI
HBufferImageDoCharInput (
IN CHAR16 Char
)
{
EFI_STATUS Status;
Status = EFI_SUCCESS;
switch (Char) {
case 0:
break;
case 0x08:
Status = HBufferImageDoBackspace ();
break;
case 0x09:
case 0x0a:
case 0x0d:
//
// Tabs, Returns are thought as nothing
//
break;
default:
//
// DEAL WITH ASCII CHAR, filter out thing like ctrl+f
//
if (Char > 127 || Char < 32) {
Status = StatusBarSetStatusString (L"Unknown Command");
} else {
Status = HBufferImageAddChar (Char);
}
break;
}
return Status;
}
/**
@ -1496,7 +1413,6 @@ HBufferImageMovePosition (
IN UINTN NewFilePosCol,
IN BOOLEAN HighBits
)
{
INTN RowGap;
UINTN Abs;
@ -1972,7 +1888,7 @@ HBufferImageGetTotalSize (
@param[in] Pos Position, Pos starting from 0.
@param[in] Count The Count of characters to delete.
@param[OUT] DeleteBuffer The DeleteBuffer.
@param[out] DeleteBuffer The DeleteBuffer.
@retval EFI_SUCCESS Success
**/
@ -2209,66 +2125,6 @@ HBufferImageAddCharacterToBuffer (
return EFI_SUCCESS;
}
/**
Delete the previous character.
@retval EFI_SUCCESS The operationw as successful.
**/
EFI_STATUS
EFIAPI
HBufferImageDoBackspace (
VOID
)
{
HEFI_EDITOR_LINE *Line;
UINTN FileColumn;
UINTN FPos;
BOOLEAN LastLine;
//
// variable initialization
//
LastLine = FALSE;
//
// already the first character
//
if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {
return EFI_SUCCESS;
}
FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
FileColumn = HBufferImage.BufferPosition.Column;
Line = HBufferImage.CurrentLine;
LastLine = FALSE;
if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {
LastLine = TRUE;
}
HBufferImageDeleteCharacterFromBuffer (FPos - 1, 1, NULL);
//
// if is the last line
// then only this line need to be refreshed
//
if (LastLine) {
HBufferImageNeedRefresh = FALSE;
HBufferImageOnlyLineNeedRefresh = TRUE;
} else {
HBufferImageNeedRefresh = TRUE;
HBufferImageOnlyLineNeedRefresh = FALSE;
}
if (!HBufferImage.Modified) {
HBufferImage.Modified = TRUE;
}
return EFI_SUCCESS;
}
/**
Delete current character from line.
@ -2534,3 +2390,107 @@ HBufferImageAdjustMousePosition (
}
}
/**
Dispatch input to different handler
@param[in] Key The input key:
the keys can be:
ASCII KEY
Backspace/Delete
Direction key: up/down/left/right/pgup/pgdn
Home/End
INS
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_OUT_OF_RESOURCES A Memory allocation failed.
**/
EFI_STATUS
HBufferImageHandleInput (
IN EFI_INPUT_KEY *Key
)
{
EFI_STATUS Status;
Status = EFI_SUCCESS;
switch (Key->ScanCode) {
//
// ordinary key
//
case SCAN_NULL:
Status = HBufferImageDoCharInput (Key->UnicodeChar);
break;
//
// up arrow
//
case SCAN_UP:
Status = HBufferImageScrollUp ();
break;
//
// down arrow
//
case SCAN_DOWN:
Status = HBufferImageScrollDown ();
break;
//
// right arrow
//
case SCAN_RIGHT:
Status = HBufferImageScrollRight ();
break;
//
// left arrow
//
case SCAN_LEFT:
Status = HBufferImageScrollLeft ();
break;
//
// page up
//
case SCAN_PAGE_UP:
Status = HBufferImagePageUp ();
break;
//
// page down
//
case SCAN_PAGE_DOWN:
Status = HBufferImagePageDown ();
break;
//
// delete
//
case SCAN_DELETE:
Status = HBufferImageDoDelete ();
break;
//
// home
//
case SCAN_HOME:
Status = HBufferImageHome ();
break;
//
// end
//
case SCAN_END:
Status = HBufferImageEnd ();
break;
default:
Status = StatusBarSetStatusString (L"Unknown Command");
break;
}
return Status;
}

View File

@ -18,177 +18,152 @@
#include "HexEditor.h"
/**
Initialization function for HBufferImage
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HBufferImageInit (
VOID
);
/**
Cleanup function for HBufferImage
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageCleanup (
VOID
);
/**
Refresh function for HBufferImage.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A Load error occured.
**/
EFI_STATUS
HBufferImageRefresh (
VOID
);
EFI_STATUS
HBufferImageHide (
VOID
);
/**
Dispatch input to different handler
@param[in] Key The input key:
the keys can be:
ASCII KEY
Backspace/Delete
Direction key: up/down/left/right/pgup/pgdn
Home/End
INS
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_OUT_OF_RESOURCES A Memory allocation failed.
**/
EFI_STATUS
HBufferImageHandleInput (
EFI_INPUT_KEY *
IN EFI_INPUT_KEY *Key
);
/**
Backup function for HBufferImage. Only a few fields need to be backup.
This is for making the file buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageBackup (
VOID
);
/**
Read an image into a buffer friom a source.
@param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] BufferType The type of buffer to save. IGNORED.
@param[in] Recover TRUE for recovermode, FALSE otherwise.
@return EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
EFIAPI
HBufferImageRead (
IN CONST CHAR16 *,
IN CONST CHAR16 *,
IN UINTN,
IN UINTN,
IN UINTN,
IN UINTN,
IN EDIT_FILE_TYPE,
IN BOOLEAN
IN CONST CHAR16 *FileName,
IN CONST CHAR16 *DiskName,
IN UINTN DiskOffset,
IN UINTN DiskSize,
IN UINTN MemOffset,
IN UINTN MemSize,
IN EDIT_FILE_TYPE BufferType,
IN BOOLEAN Recover
);
/**
Save the current image.
@param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
@param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
@param[in] BufferType The type of buffer to save. IGNORED.
@return EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HBufferImageSave (
IN CHAR16 *,
IN CHAR16 *,
IN UINTN,
IN UINTN,
IN UINTN,
IN UINTN,
IN EDIT_FILE_TYPE
IN CHAR16 *FileName,
IN CHAR16 *DiskName,
IN UINTN DiskOffset,
IN UINTN DiskSize,
IN UINTN MemOffset,
IN UINTN MemSize,
IN EDIT_FILE_TYPE BufferType
);
INTN
HBufferImageCharToHex (
IN CHAR16
);
EFI_STATUS
HBufferImageRestoreMousePosition (
VOID
);
EFI_STATUS
HBufferImageRestorePosition (
VOID
);
/**
According to cursor's file position, adjust screen display.
@param[in] NewFilePosRow Row of file position ( start from 1 ).
@param[in] NewFilePosCol Column of file position ( start from 1 ).
@param[in] HighBits Cursor will on high4 bits or low4 bits.
**/
VOID
HBufferImageMovePosition (
IN UINTN,
IN UINTN,
IN BOOLEAN
IN UINTN NewFilePosRow,
IN UINTN NewFilePosCol,
IN BOOLEAN HighBits
);
EFI_STATUS
HBufferImageHandleInput (
EFI_INPUT_KEY *
);
/**
Create a new line and append it to the line list.
Fields affected:
NumLines
Lines
@retval NULL create line failed.
@return the line created.
**/
HEFI_EDITOR_LINE *
HBufferImageCreateLine (
VOID
);
EFI_STATUS
HBufferImageDoCharInput (
CHAR16
);
EFI_STATUS
HBufferImageAddChar (
CHAR16
);
BOOLEAN
HInCurrentScreen (
UINTN
);
BOOLEAN
HAboveCurrentScreen (
UINTN
);
BOOLEAN
HUnderCurrentScreen (
UINTN
);
EFI_STATUS
HBufferImageScrollRight (
VOID
);
EFI_STATUS
HBufferImageScrollLeft (
VOID
);
EFI_STATUS
HBufferImageScrollDown (
VOID
);
EFI_STATUS
HBufferImageScrollUp (
VOID
);
EFI_STATUS
HBufferImagePageUp (
VOID
);
EFI_STATUS
HBufferImagePageDown (
VOID
);
EFI_STATUS
HBufferImageHome (
VOID
);
EFI_STATUS
HBufferImageEnd (
VOID
);
EFI_STATUS
HBufferImageDoBackspace (
VOID
);
EFI_STATUS
HBufferImageDoDelete (
VOID
);
EFI_STATUS
HBufferImageCutLine (
HEFI_EDITOR_LINE **
);
EFI_STATUS
HBufferImagePasteLine (
VOID
);
EFI_STATUS
HBufferImageGetFileInfo (
EFI_FILE_HANDLE,
CHAR16 *,
EFI_FILE_INFO **
);
EFI_STATUS
HBufferImageSearch (
CHAR16 *,
UINTN
);
EFI_STATUS
HBufferImageReplace (
CHAR16 *,
UINTN
);
/**
/**
Free the current image.
@retval EFI_SUCCESS The operation was successful.
@ -198,58 +173,105 @@ HBufferImageFree (
VOID
);
/**
Delete character from buffer.
@param[in] Pos Position, Pos starting from 0.
@param[in] Count The Count of characters to delete.
@param[out] DeleteBuffer The DeleteBuffer.
@retval EFI_SUCCESS Success
**/
EFI_STATUS
HBufferImageDeleteCharacterFromBuffer (
IN UINTN,
IN UINTN,
UINT8 *
IN UINTN Pos,
IN UINTN Count,
OUT UINT8 *DeleteBuffer
);
/**
Add character to buffer, add before pos.
@param[in] Pos Position, Pos starting from 0.
@param[in] Count Count of characters to add.
@param[in] AddBuffer Add buffer.
@retval EFI_SUCCESS Success.
**/
EFI_STATUS
HBufferImageAddCharacterToBuffer (
IN UINTN,
IN UINTN,
UINT8 *
IN UINTN Pos,
IN UINTN Count,
IN UINT8 *AddBuffer
);
/**
Change the raw buffer to a list of lines for the UI.
@param[in] Buffer The pointer to the buffer to fill.
@param[in] Bytes The size of the buffer in bytes.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
EFIAPI
HBufferImageBufferToList (
IN VOID *,
IN UINTN
IN VOID *Buffer,
IN UINTN Bytes
);
/**
Change the list of lines from the UI to a raw buffer.
@param[in] Buffer The pointer to the buffer to fill.
@param[in] Bytes The size of the buffer in bytes.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
EFIAPI
HBufferImageListToBuffer (
IN VOID *,
IN UINTN
IN VOID *Buffer,
IN UINTN Bytes
);
/**
Move the mouse in the image buffer.
@param[in] TextX The x-coordinate.
@param[in] TextY The y-coordinate.
**/
VOID
EFIAPI
HBufferImageAdjustMousePosition (
INT32,
INT32
IN INT32 TextX,
IN INT32 TextY
);
/**
Function to decide if a column number is stored in the high bits.
@param[in] Column The column to examine.
@param[out] FCol The actual column number.
@retval TRUE The actual column was in high bits and is now in FCol.
@retval FALSE There was not a column number in the high bits.
**/
BOOLEAN
HBufferImageIsAtHighBits (
UINTN,
UINTN *
) ;
EFI_STATUS
HBufferImageCutLine (
HEFI_EDITOR_LINE **
IN UINTN Column,
OUT UINTN *FCol
);
/**
Get the size of the open buffer.
@retval The size in bytes.
**/
UINTN
HBufferImageGetTotalSize (
VOID
);
BOOLEAN
HBufferImageIsInSelectedArea (
UINTN,
UINTN
);
#endif

View File

@ -14,6 +14,11 @@
#include "HexEditor.h"
typedef struct {
UINT8 *Buffer;
UINTN Size;
} HEFI_EDITOR_CLIPBOARD;
HEFI_EDITOR_CLIPBOARD HClipBoard;
//
@ -24,26 +29,16 @@ HEFI_EDITOR_CLIPBOARD HClipBoardConst = {
0
};
/**
Initialization function for HDiskImage.
@param[in] EFI_SUCCESS The operation was successful.
@param[in] EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HClipBoardInit (
VOID
)
/*++
Routine Description:
Initialization function for HDiskImage
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
--*/
{
//
// basiclly initialize the HDiskImage
@ -53,26 +48,16 @@ Returns:
return EFI_SUCCESS;
}
/**
Initialization function for HDiskImage.
@param[in] EFI_SUCCESS The operation was successful.
@param[in] EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HClipBoardCleanup (
VOID
)
/*++
Routine Description:
Initialization function for HDiskImage
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
--*/
{
SHELL_FREE_NON_NULL (HClipBoard.Buffer);
@ -80,6 +65,14 @@ Returns:
return EFI_SUCCESS;
}
/**
Set a buffer into the clipboard.
@param[in] Buffer The buffer to add to the clipboard.
@param[in] Size The size of Buffer in bytes.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HClipBoardSet (
IN UINT8 *Buffer,
@ -98,6 +91,13 @@ HClipBoardSet (
return EFI_SUCCESS;
}
/**
Get a buffer from the clipboard.
@param[out] Buffer The pointer to the buffer to add to the clipboard.
@return the size of the buffer.
**/
UINTN
HClipBoardGet (
OUT UINT8 **Buffer

View File

@ -18,23 +18,52 @@
#include "HexEditor.h"
/**
Initialization function for HDiskImage
@param[in] EFI_SUCCESS The operation was successful.
@param[in] EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HClipBoardInit (
VOID
);
/**
Initialization function for HDiskImage.
@param[in] EFI_SUCCESS The operation was successful.
@param[in] EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HClipBoardCleanup (
VOID
);
/**
Set a buffer into the clipboard.
@param[in] Buffer The buffer to add to the clipboard.
@param[in] Size The size of Buffer in bytes.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HClipBoardSet (
UINT8 *,
UINTN
IN UINT8 *Buffer,
IN UINTN Size
);
/**
Get a buffer from the clipboard.
@param[out] Buffer The pointer to the buffer to add to the clipboard.
@return the size of the buffer.
**/
UINTN
HClipBoardGet (
UINT8 **
OUT UINT8 **Buffer
);
#endif

View File

@ -37,26 +37,16 @@ HEFI_EDITOR_DISK_IMAGE HDiskImageConst = {
0
};
/**
Initialization function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HDiskImageInit (
VOID
)
/*++
Routine Description:
Initialization function for HDiskImage
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
--*/
{
//
// basically initialize the HDiskImage
@ -68,29 +58,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Backup function for HDiskImage. Only a few fields need to be backup.
This is for making the Disk buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES gST->ConOut of resources.
**/
EFI_STATUS
HDiskImageBackup (
VOID
)
/*++
Routine Description:
Backup function for HDiskImage
Only a few fields need to be backup.
This is for making the Disk buffer refresh
as few as possible.
Arguments:
None
Returns:
EFI_SUCCESS - Success
EFI_OUT_OF_RESOURCES - gST->ConOut of resources
--*/
{
//
// backup the disk name, offset and size
@ -109,25 +87,15 @@ Returns:
return EFI_SUCCESS;
}
/**
Cleanup function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HDiskImageCleanup (
VOID
)
/*++
Routine Description:
Cleanup function for HDiskImage
Arguments:
None
Returns:
EFI_SUCCESS
--*/
{
SHELL_FREE_NON_NULL (HDiskImage.Name);
SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name);
@ -135,6 +103,16 @@ Returns:
return EFI_SUCCESS;
}
/**
Set FileName field in HFileImage.
@param[in] Str File name to set.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
EFIAPI
HDiskImageSetDiskNameOffsetSize (
@ -142,24 +120,6 @@ HDiskImageSetDiskNameOffsetSize (
IN UINTN Offset,
IN UINTN Size
)
/*++
Routine Description:
Set FileName field in HFileImage
Arguments:
Str - File name to set
Offset - The offset
Size - The size
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
--*/
{
UINTN Len;
UINTN Index;
@ -188,6 +148,19 @@ Returns:
return EFI_SUCCESS;
}
/**
Read a disk from disk into HBufferImage.
@param[in] DeviceName filename to read.
@param[in] Offset The offset.
@param[in] Size The size.
@param[in] Recover if is for recover, no information print.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
**/
EFI_STATUS
HDiskImageRead (
IN CONST CHAR16 *DeviceName,
@ -195,27 +168,6 @@ HDiskImageRead (
IN UINTN Size,
IN BOOLEAN Recover
)
/*++
Routine Description:
Read a disk from disk into HBufferImage
Arguments:
DeviceName - filename to read
Offset - The offset
Size - The size
Recover - if is for recover, no information print
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
EFI_INVALID_PARAMETER
--*/
{
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
@ -374,33 +326,25 @@ Returns:
return EFI_SUCCESS;
}
/**
Save lines in HBufferImage to disk.
NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!!
@param[in] DeviceName The device name.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
**/
EFI_STATUS
HDiskImageSave (
IN CHAR16 *DeviceName,
IN UINTN Offset,
IN UINTN Size
)
/*++
Routine Description:
Save lines in HBufferImage to disk
NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!!
Arguments:
DeviceName - The device name
Offset - The offset
Size - The size
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
EFI_INVALID_PARAMETER
--*/
{
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;

View File

@ -18,31 +18,78 @@
#include "HexEditor.h"
/**
Initialization function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HDiskImageInit (
VOID
);
/**
Cleanup function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HDiskImageCleanup (
VOID
);
/**
Backup function for HDiskImage. Only a few fields need to be backup.
This is for making the Disk buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES gST->ConOut of resources.
**/
EFI_STATUS
HDiskImageBackup (
VOID
);
/**
Read a disk from disk into HBufferImage.
@param[in] DeviceName filename to read.
@param[in] Offset The offset.
@param[in] Size The size.
@param[in] Recover if is for recover, no information print.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
**/
EFI_STATUS
HDiskImageRead (
IN CONST CHAR16 *,
IN UINTN,
IN UINTN,
IN BOOLEAN
IN CONST CHAR16 *DeviceName,
IN UINTN Offset,
IN UINTN Size,
IN BOOLEAN Recover
);
/**
Save lines in HBufferImage to disk.
NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!!
@param[in] DeviceName The device name.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
**/
EFI_STATUS
HDiskImageSave (
IN CHAR16 *,
IN UINTN,
IN UINTN
IN CHAR16 *DeviceName,
IN UINTN Offset,
IN UINTN Size
);
#endif

View File

@ -35,26 +35,15 @@ HEFI_EDITOR_BUFFER_IMAGE HFileImageConst = {
FALSE
};
/**
Initialization function for HFileImage
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HFileImageInit (
VOID
)
/*++
Routine Description:
Initialization function for HFileImage
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
--*/
{
//
// basically initialize the HFileImage
@ -70,29 +59,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Backup function for HFileImage. Only a few fields need to be backup.
This is for making the file buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HFileImageBackup (
VOID
)
/*++
Routine Description:
Backup function for HFileImage
Only a few fields need to be backup.
This is for making the file buffer refresh
as few as possible.
Arguments:
None
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
--*/
{
SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName);
HFileImageBackupVar.FileName = CatSPrint(NULL, L"%s", HFileImage.FileName);
@ -103,25 +80,15 @@ Returns:
return EFI_SUCCESS;
}
/**
Cleanup function for HFileImage.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HFileImageCleanup (
VOID
)
/*++
Routine Description:
Cleanup function for HFileImage
Arguments:
None
Returns:
EFI_SUCCESS
--*/
{
SHELL_FREE_NON_NULL (HFileImage.FileName);
@ -130,26 +97,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Set FileName field in HFileImage
@param[in] Str File name to set.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HFileImageSetFileName (
IN CONST CHAR16 *Str
)
/*++
Routine Description:
Set FileName field in HFileImage
Arguments:
Str -- File name to set
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
--*/
{
UINTN Size;
UINTN Index;
@ -175,79 +134,21 @@ Returns:
return EFI_SUCCESS;
}
EFI_STATUS
HFileImageGetFileInfo (
IN EFI_FILE_HANDLE Handle,
IN CHAR16 *FileName,
OUT EFI_FILE_INFO **InfoOut
)
/*++
/**
Read a file from disk into HBufferImage.
Routine Description:
Get this file's information
Arguments:
Handle - in NT32 mode Directory handle, in other mode File Handle
FileName - The file name
InfoOut - parameter to pass file information out
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
EFI_LOAD_ERROR
--*/
{
VOID *Info;
UINTN Size;
EFI_STATUS Status;
Size = SIZE_OF_EFI_FILE_INFO + 1024;
Info = AllocateZeroPool (Size);
if (!Info) {
return EFI_OUT_OF_RESOURCES;
}
//
// get file information
//
Status = Handle->GetInfo (Handle, &gEfiFileInfoGuid, &Size, Info);
if (EFI_ERROR (Status)) {
return EFI_LOAD_ERROR;
}
*InfoOut = (EFI_FILE_INFO *) Info;
return EFI_SUCCESS;
}
@param[in] FileName filename to read.
@param[in] Recover if is for recover, no information print.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HFileImageRead (
IN CONST CHAR16 *FileName,
IN BOOLEAN Recover
)
/*++
Routine Description:
Read a file from disk into HBufferImage
Arguments:
FileName -- filename to read
Recover -- if is for recover, no information print
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
HEFI_EDITOR_LINE *Line;
UINT8 *Buffer;
@ -343,27 +244,19 @@ Returns:
return EFI_SUCCESS;
}
/**
Save lines in HBufferImage to disk.
@param[in] FileName The file name.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HFileImageSave (
IN CHAR16 *FileName
)
/*++
Routine Description:
Save lines in HBufferImage to disk
Arguments:
FileName - The file name
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
LIST_ENTRY *Link;

View File

@ -18,39 +18,66 @@
#include "HexEditor.h"
/**
Initialization function for HFileImage
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HFileImageInit (
VOID
);
/**
Cleanup function for HFileImage.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HFileImageCleanup (
VOID
);
/**
Backup function for HFileImage. Only a few fields need to be backup.
This is for making the file buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HFileImageBackup (
VOID
);
EFI_STATUS
HFileImageSetFileName (
IN CONST CHAR16 *
);
/**
Read a file from disk into HBufferImage.
EFI_STATUS
HFileImageGetFileInfo (
EFI_FILE_HANDLE,
CHAR16 *,
EFI_FILE_INFO **
);
@param[in] FileName filename to read.
@param[in] Recover if is for recover, no information print.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HFileImageRead (
IN CONST CHAR16 *,
IN BOOLEAN
IN CONST CHAR16 *FileName,
IN BOOLEAN Recover
);
/**
Save lines in HBufferImage to disk.
@param[in] FileName The file name.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HFileImageSave (
IN CHAR16 *
IN CHAR16 *FileName
);
#endif

View File

@ -109,14 +109,8 @@ typedef struct {
} HEFI_EDITOR_BUFFER_IMAGE;
typedef struct {
UINT8 *Buffer;
UINTN Size;
} HEFI_EDITOR_CLIPBOARD;
typedef struct {
HEFI_EDITOR_BUFFER_IMAGE *BufferImage;
HEFI_EDITOR_CLIPBOARD *Clipboard;
HEFI_EDITOR_COLOR_UNION ColorAttributes;
HEFI_EDITOR_POSITION ScreenSize; // row number and column number

View File

@ -37,8 +37,6 @@ BOOLEAN HEditorMouseAction;
extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
extern HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar;
extern HEFI_EDITOR_CLIPBOARD HClipBoard;
extern BOOLEAN HBufferImageMouseNeedRefresh;
extern BOOLEAN HBufferImageNeedRefresh;
extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
@ -51,7 +49,6 @@ HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar;
//
HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = {
&HBufferImage,
&HClipBoard,
{
0,
0
@ -68,25 +65,15 @@ HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = {
1
};
/**
Move cursor to specified lines.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HMainCommandGoToOffset (
VOID
)
/*++
Routine Description:
move cursor to specified lines
Arguments:
None
Returns:
EFI_SUCCESS
--*/
{
UINTN Size;
UINT64 Offset;
@ -157,29 +144,19 @@ Returns:
return EFI_SUCCESS;
}
/**
Save current opened buffer.
If is file buffer, you can save to current file name or
save to another file name.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainCommandSaveBuffer (
VOID
)
/*++
Routine Description:
save current opened buffer .
if is file buffer, you can save to current file name or
save to another file name
Arguments:
None
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
EFI_LOAD_ERROR
--*/
{
EFI_STATUS Status;
BOOLEAN Done;
@ -190,7 +167,7 @@ Returns:
SHELL_FILE_HANDLE ShellFileHandle;
if (HMainEditor.BufferImage->BufferType != FileTypeFileBuffer) {
if (HMainEditor.BufferImage->Modified == FALSE) {
if (!HMainEditor.BufferImage->Modified) {
return EFI_SUCCESS;
}
@ -381,7 +358,7 @@ Returns:
//
// if the file is read only, so can not write back to it.
//
if (HMainEditor.BufferImage->FileImage->ReadOnly == TRUE) {
if (HMainEditor.BufferImage->FileImage->ReadOnly) {
StatusBarSetStatusString (L"Access Denied");
SHELL_FREE_NON_NULL (FileName);
return EFI_SUCCESS;
@ -467,27 +444,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Load a disk buffer editor.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainCommandSelectStart (
VOID
)
/*++
Routine Description:
Load a disk buffer editor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
UINTN Start;
@ -515,27 +482,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Load a disk buffer editor.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainCommandSelectEnd (
VOID
)
/*++
Routine Description:
Load a disk buffer editor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
UINTN End;
@ -563,27 +520,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Cut current line to clipboard.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainCommandCut (
VOID
)
/*++
Routine Description:
cut current line to clipboard
Arguments:
None
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
EFI_LOAD_ERROR
--*/
{
UINTN Index;
HEFI_EDITOR_LINE *Line;
@ -648,28 +595,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Paste line to file buffer.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainCommandPaste (
VOID
)
/*++
Routine Description:
paste line to file buffer
Arguments:
None
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
EFI_LOAD_ERROR
--*/
{
BOOLEAN OnlyLineRefresh;
@ -719,27 +655,17 @@ Returns:
}
/**
Exit editor.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainCommandExit (
VOID
)
/*++
Routine Description:
exit editor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
EFI_LOAD_ERROR
--*/
{
EFI_STATUS Status;
@ -822,27 +748,17 @@ Returns:
}
/**
Load a file from disk to editor.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainCommandOpenFile (
VOID
)
/*++
Routine Description:
Load a file from disk to editor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
BOOLEAN Done;
EFI_STATUS Status;
@ -1065,28 +981,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Load a disk buffer editor.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_NOT_FOUND The disk was not found.
**/
EFI_STATUS
HMainCommandOpenDisk (
VOID
)
/*++
Routine Description:
Load a disk buffer editor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
EFI_NOT_FOUND
--*/
{
UINT64 Size;
UINT64 Offset;
@ -1320,28 +1226,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Load memory content to editor
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_NOT_FOUND The disk was not found.
**/
EFI_STATUS
HMainCommandOpenMemory (
VOID
)
/*++
Routine Description:
Load memory content to editor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
EFI_NOT_FOUND
--*/
{
UINT64 Size;
UINT64 Offset;
@ -1604,27 +1500,16 @@ CONST EDITOR_MENU_ITEM HexEditorMenuItems[] = {
}
};
/**
Init function for MainEditor
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainEditorInit (
VOID
)
/*++
Routine Description:
Init function for MainEditor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
--*/
{
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer;
@ -1754,26 +1639,16 @@ Returns:
return EFI_SUCCESS;
}
/**
Cleanup function for MainEditor.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainEditorCleanup (
VOID
)
/*++
Routine Description:
cleanup function for MainEditor
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
--*/
{
EFI_STATUS Status;
@ -1813,25 +1688,15 @@ Returns:
return EFI_SUCCESS;
}
/**
Refresh function for MainEditor.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HMainEditorRefresh (
VOID
)
/*++
Routine Description:
Refresh function for MainEditor
Arguments:
None
Returns:
EFI_SUCCESS
--*/
{
BOOLEAN NameChange;
BOOLEAN ReadChange;
@ -1874,8 +1739,8 @@ Returns:
HMainEditor.BufferImage->Modified,
HMainEditor.ScreenSize.Column,
HMainEditor.ScreenSize.Row,
HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0,
HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0
HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Offset:0,
HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Size :0
);
HBufferImageRefresh ();
}
@ -1910,7 +1775,17 @@ Returns:
return EFI_SUCCESS;
}
STATIC
/**
Handle the mouse input.
@param[in] MouseState The current mouse state.
@param[out] BeforeLeftButtonDown helps with selections.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_NOT_FOUND The disk was not found.
**/
EFI_STATUS
HMainEditorHandleMouseInput (
IN EFI_SIMPLE_POINTER_STATE MouseState,
@ -2046,7 +1921,7 @@ HMainEditorHandleMouseInput (
//
// release LButton
//
if (*BeforeLeftButtonDown == TRUE) {
if (*BeforeLeftButtonDown) {
Action = TRUE;
}
//
@ -2062,27 +1937,17 @@ HMainEditorHandleMouseInput (
return EFI_NOT_FOUND;
}
/**
Handle user key input. will route it to other components handle function.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainEditorKeyInput (
VOID
)
/*++
Routine Description:
Handle user key input. will route it to other components handle function
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
EFI_INPUT_KEY Key;
EFI_STATUS Status;
@ -2142,11 +2007,11 @@ Returns:
Status = HMainEditorHandleMouseInput (MouseState, &MouseIsDown);
if (!EFI_ERROR (Status)) {
if (BeforeMouseIsDown == FALSE) {
if (!BeforeMouseIsDown) {
//
// mouse down
//
if (MouseIsDown == TRUE) {
if (MouseIsDown) {
FRow = HBufferImage.BufferPosition.Row;
FCol = HBufferImage.BufferPosition.Column;
SelectStartBackup = HMainEditor.SelectStart;
@ -2162,8 +2027,8 @@ Returns:
//
// begin to drag
//
if (MouseIsDown == TRUE) {
if (FirstDown == TRUE) {
if (MouseIsDown) {
if (FirstDown) {
if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) {
HMainEditor.SelectStart = 0;
HMainEditor.SelectEnd = 0;
@ -2301,7 +2166,7 @@ Returns:
break;
}
if (LengthChange == FALSE) {
if (!LengthChange) {
if (OldSize != Size) {
StatusBarSetStatusString (L"Disk/Mem Buffer Length should not be changed");
}

View File

@ -20,18 +20,45 @@
#include "HexEditor.h"
/**
Init function for MainEditor
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainEditorInit (
VOID
);
/**
Cleanup function for MainEditor.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainEditorCleanup (
VOID
);
/**
Refresh function for MainEditor.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HMainEditorRefresh (
VOID
);
/**
Handle user key input. will route it to other components handle function.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation occured.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMainEditorKeyInput (
VOID
@ -45,4 +72,5 @@ EFIAPI
HMainEditorBackup (
VOID
);
#endif

View File

@ -38,6 +38,17 @@ HEFI_EDITOR_MEM_IMAGE HMemImageConst = {
0
};
/**
Empty function. always returns the same.
@param[in] This Ignored.
@param[in] Width Ignored.
@param[in] Address Ignored.
@param[in] Count Ignored.
@param[in,out] Buffer Ignored.
@retval EFI_UNSUPPORTED.
**/
EFI_STATUS
DummyMemRead (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
@ -45,8 +56,22 @@ DummyMemRead (
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
)
{
return EFI_UNSUPPORTED;
}
/**
Empty function. always returns the same.
@param[in] This Ignored.
@param[in] Width Ignored.
@param[in] Address Ignored.
@param[in] Count Ignored.
@param[in,out] Buffer Ignored.
@retval EFI_UNSUPPORTED.
**/
EFI_STATUS
DummyMemWrite (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
@ -54,28 +79,21 @@ DummyMemWrite (
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
)
{
return EFI_UNSUPPORTED;
}
/**
Initialization function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMemImageInit (
VOID
)
/*++
Routine Description:
Initialization function for HDiskImage
Arguments:
None
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
--*/
{
EFI_STATUS Status;
@ -107,28 +125,16 @@ Returns:
}
}
/**
Backup function for HDiskImage. Only a few fields need to be backup.
This is for making the Disk buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HMemImageBackup (
VOID
)
/*++
Routine Description:
Backup function for HDiskImage
Only a few fields need to be backup.
This is for making the Disk buffer refresh
as few as possible.
Arguments:
None
Returns:
EFI_SUCCESS
--*/
{
HMemImageBackupVar.Offset = HMemImage.Offset;
HMemImageBackupVar.Size = HMemImage.Size;
@ -136,51 +142,20 @@ Returns:
return EFI_SUCCESS;
}
EFI_STATUS
HMemImageCleanup (
VOID
)
/*++
/**
Set FileName field in HFileImage.
Routine Description:
Cleanup function for HDiskImage
Arguments:
None
Returns:
EFI_SUCCESS
--*/
{
return EFI_SUCCESS;
}
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HMemImageSetMemOffsetSize (
IN UINTN Offset,
IN UINTN Size
)
/*++
Routine Description:
Set FileName field in HFileImage
Arguments:
Offset - The offset
Size - The size
Returns:
EFI_SUCCESS
EFI_OUT_OF_RESOURCES
--*/
{
HMemImage.Offset = Offset;
@ -189,31 +164,23 @@ Returns:
return EFI_SUCCESS;
}
/**
Read a disk from disk into HBufferImage.
@param[in] Offset The offset.
@param[in] Size The size.
@param[in] Recover if is for recover, no information print.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HMemImageRead (
IN UINTN Offset,
IN UINTN Size,
BOOLEAN Recover
IN UINTN Offset,
IN UINTN Size,
IN BOOLEAN Recover
)
/*++
Routine Description:
Read a disk from disk into HBufferImage
Arguments:
Offset - The offset
Size - The size
Recover - if is for recover, no information print
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
EFI_STATUS Status;
@ -312,29 +279,21 @@ Returns:
}
/**
Save lines in HBufferImage to disk.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HMemImageSave (
IN UINTN Offset,
IN UINTN Size
)
/*++
Routine Description:
Save lines in HBufferImage to disk
Arguments:
Offset - The offset
Size - The size
Returns:
EFI_SUCCESS
EFI_LOAD_ERROR
EFI_OUT_OF_RESOURCES
--*/
{
EFI_STATUS Status;
@ -387,26 +346,4 @@ Returns:
return EFI_SUCCESS;
}
EFI_STATUS
DummyMemRead (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
{
return EFI_UNSUPPORTED;
}
EFI_STATUS
DummyMemWrite (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
{
return EFI_UNSUPPORTED;
}

View File

@ -18,35 +18,75 @@
#include "HexEditor.h"
/**
Initialization function for HDiskImage.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_LOAD_ERROR A load error occured.
**/
EFI_STATUS
HMemImageInit (
VOID
);
EFI_STATUS
HMemImageCleanup (
VOID
);
/**
Backup function for HDiskImage. Only a few fields need to be backup.
This is for making the Disk buffer refresh as few as possible.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HMemImageBackup (
VOID
);
/**
Set FileName field in HFileImage.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HMemImageSetMemOffsetSize (
IN UINTN,
IN UINTN
IN UINTN Offset,
IN UINTN Size
);
/**
Read a disk from disk into HBufferImage.
@param[in] Offset The offset.
@param[in] Size The size.
@param[in] Recover if is for recover, no information print.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HMemImageRead (
IN UINTN,
IN UINTN,
IN BOOLEAN
IN UINTN Offset,
IN UINTN Size,
IN BOOLEAN Recover
);
/**
Save lines in HBufferImage to disk.
@param[in] Offset The offset.
@param[in] Size The size.
@retval EFI_LOAD_ERROR A load error occured.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
HMemImageSave (
IN UINTN,
IN UINTN
IN UINTN Offset,
IN UINTN Size
);
#endif

View File

@ -1,7 +1,7 @@
/** @file
Implementation of various string and line routines
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
Copyright (TempVarC) 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
@ -16,119 +16,15 @@
extern BOOLEAN HEditorMouseAction;
VOID
HEditorClearLine (
IN UINTN Row
)
/*++
Routine Description:
Clear line at Row
Arguments:
Row -- row number to be cleared ( start from 1 )
Returns:
EFI_SUCCESS
--*/
{
CHAR16 Line[200];
UINTN Index;
UINTN Limit;
UINTN StartCol;
if (HEditorMouseAction) {
Limit = 3 * 0x10;
StartCol = 10;
} else {
Limit = HMainEditor.ScreenSize.Column;
StartCol = 1;
}
//
// prepare a blank line
//
for (Index = 0; Index < Limit; Index++) {
Line[Index] = ' ';
}
if (Row == HMainEditor.ScreenSize.Row && Limit == HMainEditor.ScreenSize.Column) {
//
// if '\0' is still at position 80, it will cause first line error
//
Line[Limit - 1] = '\0';
} else {
Line[Limit] = '\0';
}
//
// print out the blank line
//
ShellPrintEx ((INT32)StartCol - 1, (INT32)Row - 1, Line);
}
HEFI_EDITOR_LINE *
HLineDup (
IN HEFI_EDITOR_LINE *Src
)
/*++
Routine Description:
Duplicate a line
Arguments:
Src -- line to be duplicated
Returns:
NULL -- wrong
Not NULL -- line created
--*/
{
HEFI_EDITOR_LINE *Dest;
//
// allocate for the line structure
//
Dest = AllocateZeroPool (sizeof (HEFI_EDITOR_LINE));
if (Dest == NULL) {
return NULL;
}
Dest->Signature = EFI_EDITOR_LINE_LIST;
Dest->Size = Src->Size;
CopyMem (Dest->Buffer, Src->Buffer, 0x10);
Dest->Link = Src->Link;
return Dest;
}
/**
Free a line and it's internal buffer.
@param[in] Src The line to be freed.
**/
VOID
HLineFree (
IN HEFI_EDITOR_LINE *Src
)
/*++
Routine Description:
Free a line and it's internal buffer
Arguments:
Src -- line to be freed
Returns:
None
--*/
{
if (Src == NULL) {
return ;
@ -138,26 +34,18 @@ Returns:
}
/**
Advance to the next Count lines.
@param[in] Count The line number to advance.
@retval NULL An error occured.
@return A pointer to the line after advance.
**/
HEFI_EDITOR_LINE *
_HLineAdvance (
HLineAdvance (
IN UINTN Count
)
/*++
Routine Description:
Advance to the next Count lines
Arguments:
Count -- line number to advance
Returns:
NULL -- wrong
Not NULL -- line after advance
--*/
{
UINTN Index;
HEFI_EDITOR_LINE *Line;
@ -181,26 +69,18 @@ Returns:
return Line;
}
/**
Retreat to the previous Count lines.
@param[in] Count The line number to retreat.
@retval NULL An error occured.
@return A pointer to the line after retreat.
**/
HEFI_EDITOR_LINE *
_HLineRetreat (
HLineRetreat (
IN UINTN Count
)
/*++
Routine Description:
Retreat to the previous Count lines
Arguments:
Count -- line number to retreat
Returns:
NULL -- wrong
Not NULL -- line after retreat
--*/
{
UINTN Index;
HEFI_EDITOR_LINE *Line;
@ -224,28 +104,20 @@ Returns:
return Line;
}
/**
Advance/Retreat lines.
@param[in] Count The line number to advance/retreat.
>0 : advance
<0: retreat
@retval NULL An error occured.
@return A pointer to the line after move.
**/
HEFI_EDITOR_LINE *
HMoveLine (
IN INTN Count
)
/*++
Routine Description:
Advance/Retreat lines
Arguments:
Count -- line number to advance/retreat
>0 : advance
<0: retreat
Returns:
NULL -- wrong
Not NULL -- line after advance
--*/
{
HEFI_EDITOR_LINE *Line;
UINTN AbsCount;
@ -257,37 +129,28 @@ Returns:
//
if (Count <= 0) {
AbsCount = (UINTN)ABS(Count);
Line = _HLineRetreat (AbsCount);
Line = HLineRetreat (AbsCount);
} else {
Line = _HLineAdvance ((UINTN)Count);
Line = HLineAdvance ((UINTN)Count);
}
return Line;
}
/**
Advance/Retreat lines and set CurrentLine in BufferImage to it.
@param[in] Count The line number to advance/retreat.
>0 : advance
<0: retreat
@retval NULL An error occured.
@return A pointer to the line after move.
**/
HEFI_EDITOR_LINE *
HMoveCurrentLine (
IN INTN Count
)
/*++
Routine Description:
Advance/Retreat lines and set CurrentLine in BufferImage to it
Arguments:
Count -- line number to advance/retreat
>0 : advance
<0: retreat
Returns:
NULL -- wrong
Not NULL -- line after advance
--*/
{
HEFI_EDITOR_LINE *Line;
UINTN AbsCount;
@ -298,9 +161,9 @@ Returns:
//
if (Count <= 0) {
AbsCount = (UINTN)ABS(Count);
Line = _HLineRetreat (AbsCount);
Line = HLineRetreat (AbsCount);
} else {
Line = _HLineAdvance ((UINTN)Count);
Line = HLineAdvance ((UINTN)Count);
}
if (Line == NULL) {
@ -313,34 +176,26 @@ Returns:
}
EFI_STATUS
HFreeLines (
IN LIST_ENTRY *ListHead,
IN HEFI_EDITOR_LINE *Lines
)
/*++
Routine Description:
Free all the lines in HBufferImage
/**
Free all the lines in HBufferImage.
Fields affected:
Lines
CurrentLine
NumLines
ListHead
Arguments:
@param[in] ListHead The list head.
@param[in] Lines The lines.
ListHead - The list head
Lines - The lines
Returns:
EFI_SUCCESS
--*/
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HFreeLines (
IN LIST_ENTRY *ListHead,
IN HEFI_EDITOR_LINE *Lines
)
{
LIST_ENTRY *Link;
LIST_ENTRY *Link;
HEFI_EDITOR_LINE *Line;
//
@ -363,83 +218,13 @@ Returns:
return EFI_SUCCESS;
}
UINTN
HStrStr (
IN CHAR16 *Str,
IN CHAR16 *Pat
)
/*++
/**
Get the X information for the mouse.
Routine Description:
Search Pat in Str
Arguments:
Str -- mother string
Pat -- search pattern
Returns:
0 : not found
>= 1 : found position + 1
--*/
{
INTN *Failure;
INTN i;
INTN j;
INTN Lenp;
INTN Lens;
//
// this function copies from some lib
//
Lenp = StrLen (Pat);
Lens = StrLen (Str);
Failure = AllocateZeroPool ((UINTN)(Lenp * sizeof (INTN)));
if (Failure == NULL) {
return 0;
}
Failure[0] = -1;
for (j = 1; j < Lenp; j++) {
i = Failure[j - 1];
while ((Pat[j] != Pat[i + 1]) && (i >= 0)) {
i = Failure[i];
}
if (Pat[j] == Pat[i + 1]) {
Failure[j] = i + 1;
} else {
Failure[j] = -1;
}
}
i = 0;
j = 0;
while (i < Lens && j < Lenp) {
if (Str[i] == Pat[j]) {
i++;
j++;
} else if (j == 0) {
i++;
} else {
j = Failure[j - 1] + 1;
}
}
FreePool (Failure);
//
// 0: not found
// >=1 : found position + 1
//
return ((j == Lenp) ? (i - Lenp) : -1) + 1;
}
@param[in] GuidX The change.
@return the new information.
**/
INT32
HGetTextX (
IN INT32 GuidX
@ -454,6 +239,13 @@ HGetTextX (
return Gap;
}
/**
Get the Y information for the mouse.
@param[in] GuidY The change.
@return the new information.
**/
INT32
HGetTextY (
IN INT32 GuidY
@ -468,77 +260,3 @@ HGetTextY (
return Gap;
}
EFI_STATUS
HXtoi (
IN CHAR16 *Str,
OUT UINTN *Value
)
/*++
Routine Description:
convert hex string to uint
Arguments:
Str - The string
Value - The value
Returns:
--*/
{
UINT64 u;
CHAR16 c;
UINTN Size;
Size = sizeof (UINTN);
//
// skip leading white space
//
while (*Str && *Str == ' ') {
Str += 1;
}
if (StrLen (Str) > Size * 2) {
return EFI_LOAD_ERROR;
}
//
// convert hex digits
//
u = 0;
c = *Str;
while (c) {
c = *Str;
Str++;
if (c == 0) {
break;
}
//
// not valid char
//
if (!((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || (c >= '0' && c <= '9') || (c == '\0'))) {
return EFI_LOAD_ERROR;
}
if (c >= 'a' && c <= 'f') {
c -= 'a' - 'A';
}
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) {
u = LShiftU64 (u, 4) + (c - (c >= 'A' ? 'A' - 10 : '0'));
} else {
//
// '\0'
//
break;
}
}
*Value = (UINTN) u;
return EFI_SUCCESS;
}

View File

@ -17,80 +17,77 @@
#include "HexEditor.h"
VOID
HEditorClearLine (
UINTN
);
HEFI_EDITOR_LINE *
HLineDup (
HEFI_EDITOR_LINE *
);
VOID
HLineFree (
HEFI_EDITOR_LINE *
);
/**
Advance/Retreat lines.
HEFI_EDITOR_LINE *
@param[in] Count The line number to advance/retreat.
>0 : advance
<0: retreat
@retval NULL An error occured.
@return A pointer to the line after move.
**/
HEFI_EDITOR_LINE *
HMoveLine (
INTN
IN INTN Count
);
HEFI_EDITOR_LINE *
/**
Advance/Retreat lines and set CurrentLine in BufferImage to it.
@param[in] Count The line number to advance/retreat.
>0 : advance
<0: retreat
@retval NULL An error occured.
@return A pointer to the line after move.
**/
HEFI_EDITOR_LINE *
HMoveCurrentLine (
INTN
IN INTN Count
);
UINTN
HLineStrInsert (
HEFI_EDITOR_LINE *,
CHAR16,
UINTN,
UINTN
);
/**
Free all the lines in HBufferImage.
Fields affected:
Lines
CurrentLine
NumLines
ListHead
VOID
HLineCat (
HEFI_EDITOR_LINE *,
HEFI_EDITOR_LINE *
);
VOID
HLineDeleteAt (
HEFI_EDITOR_LINE *,
UINTN
);
UINTN
HUnicodeToAscii (
CHAR16 *,
UINTN,
CHAR8 *
);
UINTN
HStrStr (
CHAR16 *,
CHAR16 *
);
@param[in] ListHead The list head.
@param[in] Lines The lines.
@retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
HFreeLines (
LIST_ENTRY *,
HEFI_EDITOR_LINE *
IN LIST_ENTRY *ListHead,
IN HEFI_EDITOR_LINE *Lines
);
/**
Get the X information for the mouse.
@param[in] GuidX The change.
@return the new information.
**/
INT32
HGetTextX (
INT32
) ;
IN INT32 GuidX
);
/**
Get the Y information for the mouse.
@param[in] GuidY The change.
@return the new information.
**/
INT32
HGetTextY (
INT32
) ;
EFI_STATUS
HXtoi (
CHAR16 *,
UINTN *
IN INT32 GuidY
);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -100,9 +100,9 @@ typedef enum {
(((PcieDeviceCap) >> 3) & 0x3)
#define PCIE_CAP_EXTENDED_TAG(PcieDeviceCap) \
(((PcieDeviceCap) >> 5) & 0x1)
#define PCIE_CAP_L0sLatency(PcieDeviceCap) \
#define PCIE_CAP_L0SLATENCY(PcieDeviceCap) \
(((PcieDeviceCap) >> 6) & 0x7)
#define PCIE_CAP_L1Latency(PcieDeviceCap) \
#define PCIE_CAP_L1LATENCY(PcieDeviceCap) \
(((PcieDeviceCap) >> 9) & 0x7)
#define PCIE_CAP_ERR_REPORTING(PcieDeviceCap) \
(((PcieDeviceCap) >> 15) & 0x1)
@ -163,7 +163,7 @@ typedef enum {
(((PcieLinkCap) >> 4) & 0x3f)
#define PCIE_CAP_ASPM_SUPPORT(PcieLinkCap) \
(((PcieLinkCap) >> 10) & 0x3)
#define PCIE_CAP_L0s_LATENCY(PcieLinkCap) \
#define PCIE_CAP_L0S_LATENCY(PcieLinkCap) \
(((PcieLinkCap) >> 12) & 0x7)
#define PCIE_CAP_L1_LATENCY(PcieLinkCap) \
(((PcieLinkCap) >> 15) & 0x7)
@ -334,7 +334,7 @@ typedef struct {
UINT8 CacheLineSize;
UINT8 PrimaryLatencyTimer;
UINT8 HeaderType;
UINT8 BIST;
UINT8 Bist;
} PCI_COMMON_HEADER;
@ -427,13 +427,15 @@ typedef struct {
UINT32 Data[46];
} PCI_CARDBUS_DATA;
typedef union {
PCI_DEVICE_HEADER Device;
PCI_BRIDGE_HEADER Bridge;
PCI_CARDBUS_HEADER CardBus;
} NON_COMMON_UNION;
typedef struct {
PCI_COMMON_HEADER Common;
union {
PCI_DEVICE_HEADER Device;
PCI_BRIDGE_HEADER Bridge;
PCI_CARDBUS_HEADER CardBus;
} NonCommon;
NON_COMMON_UNION NonCommon;
UINT32 Data[48];
} PCI_CONFIG_SPACE;

View File

@ -1,7 +1,7 @@
/**
/** @file
Module for clarifying the content of the smbios structure element info.
Copyright (c) 2005-2010, Intel Corporation. All rights reserved. <BR>
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
@ -141,6 +141,12 @@ DisplaySysEventLogHeaderFormat (
}
}
/**
Display the header information for SEL log items.
@param[in] Key The information key.
@param[in] Option The option index.
**/
VOID
DisplaySELLogHeaderLen (
UINT8 Key,
@ -163,9 +169,14 @@ DisplaySELLogHeaderLen (
}
}
/**
Display the header information for type 1 items.
@param[in] LogHeader The buffer with the information.
**/
VOID
DisplaySysEventLogHeaderType1 (
UINT8 *LogHeader
IN UINT8 *LogHeader
)
{
LOG_HEADER_TYPE1_FORMAT *Header;
@ -186,8 +197,8 @@ DisplaySysEventLogHeaderType1 (
Header->OEMReserved[3],
Header->OEMReserved[4]
);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->METW);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->MECI);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->Metw);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->Meci);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);
@ -235,6 +246,12 @@ DisplaySysEventLogHeader (
}
}
/**
Display the El Vdf information.
@param[in] ElVdfType The information type.
@param[in] VarData The information buffer.
**/
VOID
DisplayElVdfInfo (
UINT8 ElVdfType,

View File

@ -1,7 +1,7 @@
/**
/** @file
Module to clarify system event log of smbios structure.
Copyright (c) 2005-2010, Intel Corporation. All rights reserved. <BR>
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
@ -12,8 +12,8 @@
**/
#ifndef _SMBIOS_EVENT_LOG_INFO_H
#define _SMBIOS_EVENT_LOG_INFO_H
#ifndef _SMBIOS_EVENT_LOG_INFO_H_
#define _SMBIOS_EVENT_LOG_INFO_H_
#define END_OF_LOG 0xFF
@ -33,8 +33,8 @@ typedef struct {
typedef struct {
UINT8 OEMReserved[5];
UINT8 METW; // Multiple Event Time Window
UINT8 MECI; // Multiple Event Count Increment
UINT8 Metw; // Multiple Event Time Window
UINT8 Meci; // Multiple Event Count Increment
UINT8 CMOSAddress; // Pre-boot Event Log Reset - CMOS Address
UINT8 CMOSBitIndex; // Pre-boot Event Log Reset - CMOS Bit Index
UINT8 StartingOffset; // CMOS Checksum - Starting Offset

View File

@ -1,7 +1,7 @@
/** @file
Lib include for SMBIOS services. Used to get system serial number and GUID
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
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
@ -12,8 +12,8 @@
**/
#ifndef _LIB_SMBIOS_H
#define _LIB_SMBIOS_H
#ifndef _LIB_SMBIOS_H_
#define _LIB_SMBIOS_H_
//
// Define SMBIOS tables.
@ -215,14 +215,14 @@ typedef struct {
UINT8 DevFuncNum;
} SMBIOS_TYPE9;
typedef struct DeviceStruct {
typedef struct _DEVICE_STRUCTURE {
UINT8 DeviceType;
SMBIOS_STRING DescriptionString;
} DeviceStruct;
} DEVICE_STRUCTURE;
typedef struct {
SMBIOS_HEADER Hdr;
DeviceStruct Device[1];
DEVICE_STRUCTURE Device[1];
} SMBIOS_TYPE10;
typedef struct {
@ -239,7 +239,7 @@ typedef struct {
SMBIOS_HEADER Hdr;
UINT8 InstallableLanguages;
UINT8 Flags;
UINT8 reserved[15];
UINT8 Reserved[15];
SMBIOS_STRING CurrentLanguages;
} SMBIOS_TYPE13;
@ -622,17 +622,19 @@ typedef union {
#pragma pack()
CHAR8 *
/**
Return SMBIOS string given the string number.
@param[in] Smbios Pointer to SMBIOS structure.
@param[in] StringNumber String number to return. -1 is used to skip all strings and
point to the next SMBIOS structure.
@return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
CHAR8*
LibGetSmbiosString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber
);
EFI_STATUS
LibGetSmbiosSystemGuidAndSerialNumber (
IN EFI_GUID *SystemGuid,
OUT CHAR8 **SystemSerialNumber
);
#endif

View File

@ -1,7 +1,7 @@
/** @file
API for SMBIOS table.
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
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
@ -17,30 +17,22 @@
#include <Guid/Smbios.h>
#include "LIbSmbios.h"
#include "LibSmbiosView.h"
#include "smbiosview.h"
#include "SmbiosView.h"
STATIC UINT8 mInit = 0;
STATIC SMBIOS_STRUCTURE_TABLE *mSmbiosTable = NULL;
STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct;
STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct;
/**
Init the SMBIOS VIEW API's environment.
@retval EFI_SUCCESS Successful to init the SMBIOS VIEW Lib.
**/
EFI_STATUS
LibSmbiosInit (
VOID
)
/*++
Routine Description:
Init the SMBIOS VIEW API's environment.
Arguments:
None
Returns:
EFI_SUCCESS - Successful to init the SMBIOS VIEW Lib
Others - Cannot get SMBIOS Table
**/
{
EFI_STATUS Status;
@ -73,6 +65,9 @@ Returns:
return EFI_SUCCESS;
}
/**
Cleanup the Smbios information.
**/
VOID
LibSmbiosCleanup (
VOID
@ -88,98 +83,46 @@ LibSmbiosCleanup (
mInit = 0;
}
/**
Get the entry point structure for the table.
@param[out] EntryPointStructure The pointer to populate.
**/
VOID
LibSmbiosGetEPS (
SMBIOS_STRUCTURE_TABLE **pEntryPointStructure
OUT SMBIOS_STRUCTURE_TABLE **EntryPointStructure
)
{
//
// return SMBIOS Table address
//
*pEntryPointStructure = mSmbiosTable;
*EntryPointStructure = mSmbiosTable;
}
VOID
LibSmbiosGetStructHead (
SMBIOS_STRUCTURE_POINTER *pHead
)
{
//
// return SMBIOS structure table address
//
pHead = mSmbiosStruct;
}
/**
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.
EFI_STATUS
LibGetSmbiosInfo (
OUT CHAR8 *dmiBIOSRevision,
OUT UINT16 *NumStructures,
OUT UINT16 *StructureSize,
OUT UINT32 *dmiStorageBase,
OUT UINT16 *dmiStorageSize
)
/*++
@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.
Routine Description:
Get SMBIOS Information.
Arguments:
dmiBIOSRevision - Revision of the SMBIOS Extensions.
NumStructures - Max. Number of Structures the BIOS will return.
StructureSize - Size of largest SMBIOS Structure.
dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data.
dmiStorageSize - Size of the memory-mapped SMBIOS data.
Returns:
DMI_SUCCESS - successful.
DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability.
@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 no SMIBOS table, unsupported.
//
if (mSmbiosTable == NULL) {
return DMI_FUNCTION_NOT_SUPPORTED;
}
*dmiBIOSRevision = mSmbiosTable->SmbiosBcdRevision;
*NumStructures = mSmbiosTable->NumberOfSmbiosStructures;
*StructureSize = mSmbiosTable->MaxStructureSize;
*dmiStorageBase = mSmbiosTable->TableAddress;
*dmiStorageSize = mSmbiosTable->TableLength;
return DMI_SUCCESS;
}
EFI_STATUS
LibGetSmbiosStructure (
IN OUT UINT16 *Handle,
IN OUT UINT8 *Buffer,
OUT UINT16 *Length
)
/*++
Routine Description:
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.
Arguments:
Handle: - 0xFFFF: get the first structure
- Others: get a structure according to this value.
Buffter: - The pointer to the caller's memory buffer.
Length: - Length of return buffer in bytes.
Returns:
DMI_SUCCESS - Buffer contains the required structure data
- Handle is updated with next structure handle or
0xFFFF(end-of-list).
DMI_INVALID_HANDLE - Buffer not contain the requiring structure data
- Handle is updated with next structure handle or
0xFFFF(end-of-list).
**/
{
SMBIOS_STRUCTURE_POINTER Smbios;
SMBIOS_STRUCTURE_POINTER SmbiosEnd;
@ -230,23 +173,18 @@ LibGetSmbiosStructure (
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.
**/
EFI_STATUS
SmbiosCheckStructure (
IN SMBIOS_STRUCTURE_POINTER *Smbios
)
/*++
Routine Description:
Check the structure to see if it is legal.
Arguments:
Smbios - Pointer to the structure that will be checked.
Returns:
DMI_SUCCESS - Structure data is legal.
DMI_BAD_PARAMETER - Structure data contains bad parameter
**/
{
//
// If key != value, then error.
@ -324,6 +262,13 @@ SmbiosCheckStructure (
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.
**/
VOID
SmbiosGetPendingString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,

View File

@ -1,7 +1,7 @@
/** @file
API for SMBIOS Plug and Play functions, access to SMBIOS table and structures.
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
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
@ -12,8 +12,8 @@
**/
#ifndef _LIB_SMBIOS_VIEW_H
#define _LIB_SMBIOS_VIEW_H
#ifndef _LIB_SMBIOS_VIEW_H_
#define _LIB_SMBIOS_VIEW_H_
#include "LibSmbios.h"
@ -39,49 +39,51 @@
#define EFI_SMBIOSERR_TYPE_UNKNOWN EFI_SMBIOSERR (3)
#define EFI_SMBIOSERR_UNSUPPORTED EFI_SMBIOSERR (4)
/**
Init the SMBIOS VIEW API's environment.
@retval EFI_SUCCESS Successful to init the SMBIOS VIEW Lib.
**/
EFI_STATUS
LibSmbiosInit (
VOID
);
/**
Cleanup the Smbios information.
**/
VOID
LibSmbiosCleanup (
VOID
);
/**
Get the entry point structure for the table.
@param[out] EntryPointStructure The pointer to populate.
**/
VOID
LibSmbiosGetEPS (
SMBIOS_STRUCTURE_TABLE **pEntryPointStructure
OUT SMBIOS_STRUCTURE_TABLE **EntryPointStructure
);
VOID
LibSmbiosGetStructHead (
SMBIOS_STRUCTURE_POINTER *pHead
);
/**
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.
EFI_STATUS
LibGetSmbiosInfo (
OUT CHAR8 *dmiBIOSRevision,
OUT UINT16 *NumStructures,
OUT UINT16 *StructureSize,
OUT UINT32 *dmiStorageBase,
OUT UINT16 *dmiStorageSize
);
@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.
/*++
Description:
Get SMBIOS Information.
@retval DMI_SUCCESS Buffer contains the required structure data
Handle is updated with next structure handle or
0xFFFF(end-of-list).
Arguments:
dmiBIOSRevision - Revision of the SMBIOS Extensions.
NumStructures - Max. Number of Structures the BIOS will return.
StructureSize - Size of largest SMBIOS Structure.
dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data.
dmiStorageSize - Size of the memory-mapped SMBIOS data.
Returns:
DMI_SUCCESS - successful.
DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability.
@retval DMI_INVALID_HANDLE Buffer not contain the requiring structure data.
Handle is updated with next structure handle or
0xFFFF(end-of-list).
**/
EFI_STATUS
LibGetSmbiosStructure (
@ -90,20 +92,12 @@ LibGetSmbiosStructure (
OUT UINT16 *Length
);
/*++
Description:
Get SMBIOS structure given the Handle,copy data to the Buffer,Handle is then the next.
/**
Get a string from the smbios information.
Arguments:
Handle: - 0x0: get the first structure
- Others: get a certain structure according to this value.
Buffter: - contains the pointer to the caller's memory buffer.
Returns:
DMI_SUCCESS - Buffer contains the required structure data
- Handle is updated with next structure handle or 0xFFFF(end-of-list).
DMI_INVALID_HANDLE - Buffer not contain the requiring structure data
- Handle is updated with next structure handle or 0xFFFF(end-of-list).
@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.
**/
VOID
SmbiosGetPendingString (
@ -112,9 +106,17 @@ SmbiosGetPendingString (
OUT CHAR8 *Buffer
);
/**
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.
**/
EFI_STATUS
SmbiosCheckStructure (
IN SMBIOS_STRUCTURE_POINTER *Smbios
IN SMBIOS_STRUCTURE_POINTER *Smbios
);
#endif

View File

@ -1,7 +1,7 @@
/** @file
Module to clarify the element info of the smbios structure.
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
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
@ -12,8 +12,8 @@
**/
#ifndef _SMBIOS_PRINT_INFO_H
#define _SMBIOS_PRINT_INFO_H
#ifndef _SMBIOS_PRINT_INFO_H_
#define _SMBIOS_PRINT_INFO_H_
#include "LibSmbios.h"
@ -34,159 +34,344 @@ extern UINT8 SmbiosMinorVersion;
#define AS_UINT32(pData) (*((UINT32 *) pData))
#define AS_UINT64(pData) (*((UINT64 *) pData))
/**
Print the info of EPS(Entry Point Structure).
@param[in] SmbiosTable Pointer to the SMBIOS table entry point.
@param[in] Option Display option.
**/
VOID
SmbiosPrintEPSInfo (
IN SMBIOS_STRUCTURE_TABLE *pSmbiosTable,
IN SMBIOS_STRUCTURE_TABLE *SmbiosTable,
IN UINT8 Option
);
/**
This function print the content of the structure pointed by Struct.
@param[in] Struct Point to the structure to be printed.
@param[in] Option Print option of information detail.
@retval EFI_SUCCESS Successfully Printing this function.
@retval EFI_INVALID_PARAMETER Invalid Structure.
@retval EFI_UNSUPPORTED Unsupported.
**/
EFI_STATUS
SmbiosPrintStructure (
IN SMBIOS_STRUCTURE_POINTER *pStruct,
IN SMBIOS_STRUCTURE_POINTER *Struct,
IN UINT8 Option
);
//
// BIOS Information (Type 0)
//
/**
Display BIOS Information (Type 0) information.
@param[in] Chara The information bits.
@param[in] Option The optional information.
**/
VOID
DisplayBiosCharacteristics (
UINT64 chara,
UINT8 Option
);
VOID
DisplayBiosCharacteristicsExt1 (
UINT8 byte1,
UINT8 Option
);
VOID
DisplayBiosCharacteristicsExt2 (
UINT8 byte2,
UINT8 Option
IN UINT64 Chara,
IN UINT8 Option
);
//
// Processor Information (Type 4)
//
/**
Display Bios Characteristice extensions1 information.
@param[in] Byte1 The information.
@param[in] Option The optional information.
**/
VOID
DisplayBiosCharacteristicsExt1 (
IN UINT8 Byte1,
IN UINT8 Option
);
/**
Display Bios Characteristice extensions2 information.
@param[in] Byte2 The information.
@param[in] Option The optional information.
**/
VOID
DisplayBiosCharacteristicsExt2 (
IN UINT8 Byte2,
IN UINT8 Option
);
/**
Display Processor Information (Type 4) information.
@param[in] Family The family value.
@param[in] Option The option value.
**/
VOID
DisplayProcessorFamily (
UINT8 Family,
UINT8 Option
);
/**
Display processor family information.
@param[in] Family2 The family value.
@param[in] Option The option value.
**/
VOID
DisplayProcessorFamily2 (
UINT16 Family2,
UINT8 Option
IN UINT16 Family2,
IN UINT8 Option
);
/**
Display processor voltage information.
@param[in] Voltage The Voltage.
Bit 7 Set to 0, indicating 'legacy' mode for processor voltage
Bits 6:4 Reserved, must be zero
Bits 3:0 Voltage Capability.
A Set bit indicates that the voltage is supported.
Bit 0 - 5V
Bit 1 - 3.3V
Bit 2 - 2.9V
Bit 3 - Reserved, must be zero.
Note:
Setting of multiple bits indicates the socket is configurable
If bit 7 is set to 1, the remaining seven bits of the field are set to
contain the processor's current voltage times 10.
For example, the field value for a processor voltage of 1.8 volts would be
92h = 80h + (1.8 * 10) = 80h + 18 = 80h +12h.
@param[in] Option The option.
**/
VOID
DisplayProcessorVoltage (
UINT8 Voltage,
UINT8 Option
IN UINT8 Voltage,
IN UINT8 Option
);
/**
Display processor information.
@param[in] Status The status.
Bit 7 Reserved, must be 0
Bit 6 CPU Socket Populated
1 - CPU Socket Populated
0 - CPU Socket UnpopulatedBits
5:3 Reserved, must be zero
Bits 2:0 CPU Status
0h - Unknown
1h - CPU Enabled
2h - CPU Disabled by User via BIOS Setup
3h - CPU Disabled By BIOS (POST Error)
4h - CPU is Idle, waiting to be enabled.
5-6h - Reserved
7h - Other
@param[in] Option The option
**/
VOID
DisplayProcessorStatus (
UINT8 Status,
UINT8 Option
IN UINT8 Status,
IN UINT8 Option
);
//
// Memory Controller Information (Type 5)
//
/**
Display information about Memory Controller Information (Type 5).
@param[in] Size Memory size.
@param[in] SlotNum Which slot is this about.
@param[in] Option Option for the level of detail output required.
**/
VOID
DisplayMaxMemoryModuleSize (
UINT8 Size,
UINT8 SlotNum,
UINT8 Option
IN UINT8 Size,
IN UINT8 SlotNum,
IN UINT8 Option
);
/**
Display information about memory configuration handles.
@param[in] Handles The buffer of handles to output info on.
@param[in] SlotNum The number of handles in the above buffer.
@param[in] Option Option for the level of detail output required.
**/
VOID
DisplayMemoryModuleConfigHandles (
UINT16 *pHandles,
UINT8 SlotNum,
UINT8 Option
IN UINT16 *Handles,
IN UINT8 SlotNum,
IN UINT8 Option
);
//
// Memory Module Information (Type 6)
//
/**
Display Memory Module Information (Type 6).
@param[in] BankConnections
@param[in] Option
**/
VOID
DisplayMmBankConnections (
UINT8 BankConnections,
UINT8 Option
IN UINT8 BankConnections,
IN UINT8 Option
);
/**
Display memory informcation.
Bits 0:6 Size (n),
where 2**n is the size in MB with three special-case values:
7Dh Not determinable (Installed Size only)
7Eh Module is installed, but no memory has been enabled
7Fh Not installed
Bit 7 Defines whether the memory module has a single- (0)
or double-bank (1) connection.
@param[in] Size - The size
@param[in] Option - The option
**/
VOID
DisplayMmMemorySize (
UINT8 Size,
UINT8 Option
IN UINT8 Size,
IN UINT8 Option
);
//
// System Slots (Type 9)
//
/**
The Slot ID field of the System Slot structure provides a mechanism to
correlate the physical attributes of the slot to its logical access method
(which varies based on the Slot Type field).
@param[in] SlotId - The slot ID
@param[in] SlotType - The slot type
@param[in] Option - The Option
**/
VOID
DisplaySystemSlotId (
UINT16 SlotId,
UINT8 SlotType,
UINT8 Option
IN UINT16 SlotId,
IN UINT8 SlotType,
IN UINT8 Option
);
//
// Physical Memory Array (Type 16)
// Memory Device (Type 17)
// Memory Array Mapped Address (Type 19)
// Memory Device Mapped Address (Type 20)
// Portable Battery (Type 22)
//
/**
Display Portable Battery (Type 22) information.
The date the cell pack was manufactured, in packed format:
Bits 15:9 Year, biased by 1980, in the range 0 to 127.
Bits 8:5 Month, in the range 1 to 12.
Bits 4:0 Date, in the range 1 to 31.
For example, 01 February 2000 would be identified as
0010 1000 0100 0001b (0x2841).
@param[in] Date The date
@param[in] Option The option
**/
VOID
DisplaySBDSManufactureDate (
UINT16 Date,
UINT8 Option
IN UINT16 Date,
IN UINT8 Option
);
//
// System Reset (Type 23)
//
/**
Display System Reset (Type 23) information.
Routine Description:
Identifies the system-reset capabilities for the system.
Bits 7:6 Reserved for future assignment via this specification, set to 00b.
Bit 5 System contains a watchdog timer, either True (1) or False (0).
Bits 4:3 Boot Option on Limit.
Identifies the system action to be taken when the Reset Limit is reached, one of:
00b Reserved, do not use.
01b Operating system
10b System utilities
11b Do not rebootBits
2:1 Boot Option. Indicates the action to be taken following a watchdog reset, one of:
00b Reserved, do not use.
01b Operating system
10b System utilities
11b Do not reboot
Bit 0 Status.
1b The system reset is enabled by the user
0b The system reset is not enabled by the user
@param[in] Reset Reset
@param[in] Option The option
**/
VOID
DisplaySystemResetCapabilities (
UINT8 Reset,
UINT8 Option
IN UINT8 Reset,
IN UINT8 Option
);
//
// Hardware Security (Type 24)
//
/**
Display Hardware Security (Type 24) information.
Routine Description:
Identifies the password and reset status for the system:
Bits 7:6 Power-on Password Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
Bits 5:4 Keyboard Password Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
Bits 3:2 Administrator Password Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
Bits 1:0 Front Panel Reset Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
@param[in] Settings The device settings.
@param[in] Option The device options.
**/
VOID
DisplayHardwareSecuritySettings (
UINT8 Settings,
UINT8 Option
IN UINT8 Settings,
IN UINT8 Option
);
//
// Out-of-Band Remote Access (Type 30)
//
/**
Display Out-of-Band Remote Access (Type 30) information.
@param[in] Connections The device characteristics.
@param[in] Option The device options.
**/
VOID
DisplayOBRAConnections (
UINT8 Connections,
UINT8 Option
IN UINT8 Connections,
IN UINT8 Option
);
//
// System Boot Information (Type 32)
//
/**
Display System Boot Information (Type 32) information.
@param[in] Parameter The parameter.
@param[in] Option The options.
**/
VOID
DisplaySystemBootStatus (
UINT8 Parameter,
UINT8 Option
IN UINT8 Parameter,
IN UINT8 Option
);
//
// System Power Supply (Type 39)
//
/**
Display System Power Supply (Type 39) information.
@param[in] Characteristics The device characteristics.
@param[in] Option The device options.
**/
VOID
DisplaySPSCharacteristics (
UINT16 Characteristics,
UINT8 Option
IN UINT16 Characteristics,
IN UINT8 Option
);
#endif

View File

@ -13,8 +13,8 @@
**/
#ifndef _SMBIOS_QUERY_TABLE_H
#define _SMBIOS_QUERY_TABLE_H
#ifndef _SMBIOS_QUERY_TABLE_H_
#define _SMBIOS_QUERY_TABLE_H_
#define QUERY_TABLE_UNFOUND 0xFF
@ -70,386 +70,665 @@ QueryTable (
IN UINTN InfoLen
);
VOID
PrintBitsInfo (
IN TABLE_ITEM *Table,
IN UINTN Number,
IN UINT32 Bits
);
/**
Display the structure type information.
//
// Display the element detail information
//
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayStructureTypeInfo (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// System Information (Type 1)
//
/**
Display System Information (Type 1) Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySystemWakeupType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
//
// System Enclosure (Type 3)
//
/**
Display System Enclosure (Type 3) Enclosure Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySystemEnclosureType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display System Enclosure (Type 3) Enclosure Status.
@param[in] Status The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySystemEnclosureStatus (
UINT8 Status,
UINT8 Option
IN UINT8 Status,
IN UINT8 Option
);
/**
Display System Enclosure (Type 3) Security Status.
@param[in] Status The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySESecurityStatus (
UINT8 Status,
UINT8 Option
);
IN UINT8 Status,
IN UINT8 Option
)
;
//
// Processor Information (Type 4)
//
/**
Display Processor Information (Type 4) Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayProcessorType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display Processor Information (Type 4) Upgrade.
@param[in] Upgrade The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayProcessorUpgrade (
UINT8 Upgrade,
UINT8 Option
IN UINT8 Upgrade,
IN UINT8 Option
);
//
// Memory Controller Information (Type 5)
//
/**
Display Memory Controller Information (Type 5) method.
@param[in] Method The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMcErrorDetectMethod (
UINT8 Method,
UINT8 Option
IN UINT8 Method,
IN UINT8 Option
);
/**
Display Memory Controller Information (Type 5) Capability.
@param[in] Capability The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMcErrorCorrectCapability (
UINT8 Capability,
UINT8 Option
IN UINT8 Capability,
IN UINT8 Option
);
/**
Display Memory Controller Information (Type 5) Support.
@param[in] Support The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMcInterleaveSupport (
UINT8 Support,
UINT8 Option
IN UINT8 Support,
IN UINT8 Option
);
/**
Display Memory Controller Information (Type 5) speeds.
@param[in] Speed The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMcMemorySpeeds (
UINT16 Speed,
UINT8 Option
IN UINT16 Speed,
IN UINT8 Option
);
/**
Display Memory Controller Information (Type 5) voltage.
@param[in] Voltage The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryModuleVoltage (
UINT8 Voltage,
UINT8 Option
IN UINT8 Voltage,
IN UINT8 Option
);
//
// Memory Module Information (Type 6)
//
/**
Display Memory Module Information (Type 6) type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMmMemoryType (
UINT16 Type,
UINT8 Option
IN UINT16 Type,
IN UINT8 Option
);
/**
Display Memory Module Information (Type 6) status.
@param[in] Status The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMmErrorStatus (
UINT8 Status,
UINT8 Option
IN UINT8 Status,
IN UINT8 Option
);
//
// Cache Information (Type 7)
//
/**
Display Cache Information (Type 7) SRAM Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayCacheSRAMType (
UINT16 Type,
UINT8 Option
IN UINT16 Type,
IN UINT8 Option
);
/**
Display Cache Information (Type 7) correcting Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayCacheErrCorrectingType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display Cache Information (Type 7) Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayCacheSystemCacheType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display Cache Information (Type 7) Associativity.
@param[in] Associativity The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayCacheAssociativity (
UINT8 Associativity,
UINT8 Option
IN UINT8 Associativity,
IN UINT8 Option
);
//
// Port Connector Information (Type 8)
//
/**
Display Port Connector Information (Type 8) type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPortConnectorType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display Port Connector Information (Type 8) port type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPortType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
//
// System Slots (Type 9)
//
/**
Display System Slots (Type 9) slot type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySystemSlotType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display System Slots (Type 9) data bus width.
@param[in] Width The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySystemSlotDataBusWidth (
UINT8 Width,
UINT8 Option
IN UINT8 Width,
IN UINT8 Option
);
/**
Display System Slots (Type 9) usage information.
@param[in] Usage The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySystemSlotCurrentUsage (
UINT8 Usage,
UINT8 Option
IN UINT8 Usage,
IN UINT8 Option
);
/**
Display System Slots (Type 9) slot length.
@param[in] Length The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySystemSlotLength (
UINT8 Length,
UINT8 Option
IN UINT8 Length,
IN UINT8 Option
);
/**
Display System Slots (Type 9) characteristics.
@param[in] Chara1 The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySlotCharacteristics1 (
UINT8 Chara1,
UINT8 Option
IN UINT8 Chara1,
IN UINT8 Option
);
/**
Display System Slots (Type 9) characteristics.
@param[in] Chara2 The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySlotCharacteristics2 (
UINT8 Chara2,
UINT8 Option
IN UINT8 Chara2,
IN UINT8 Option
);
//
// On Board Devices Information (Type 10)
//
/**
Display On Board Devices Information (Type 10) types.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayOnboardDeviceTypes (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
//
// System Event Log (Type 15)
//
/**
Display System Event Log (Type 15) types.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySELTypes (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display System Event Log (Type 15) format type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySELVarDataFormatType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display System Event Log (Type 15) dw1.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPostResultsBitmapDw1 (
UINT32 Key,
UINT8 Option
IN UINT32 Key,
IN UINT8 Option
);
/**
Display System Event Log (Type 15) dw2.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPostResultsBitmapDw2 (
UINT32 Key,
UINT8 Option
IN UINT32 Key,
IN UINT8 Option
);
/**
Display System Event Log (Type 15) type.
@param[in] SMType The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplaySELSysManagementTypes (
UINT32 SMType,
UINT8 Option
IN UINT32 SMType,
IN UINT8 Option
);
//
// Physical Memory Array (Type 16)
//
/**
Display Physical Memory Array (Type 16) Location.
@param[in] Location The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPMALocation (
UINT8 Location,
UINT8 Option
IN UINT8 Location,
IN UINT8 Option
);
/**
Display Physical Memory Array (Type 16) Use.
@param[in] Use The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPMAUse (
UINT8 Use,
UINT8 Option
IN UINT8 Use,
IN UINT8 Option
);
/**
Display Physical Memory Array (Type 16) Types.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPMAErrorCorrectionTypes (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
//
// Memory Device (Type 17)
//
/**
Display Memory Device (Type 17) form factor.
@param[in] FormFactor The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryDeviceFormFactor (
UINT8 FormFactor,
UINT8 Option
IN UINT8 FormFactor,
IN UINT8 Option
);
/**
Display Memory Device (Type 17) type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryDeviceType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display Memory Device (Type 17) details.
@param[in] Para The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryDeviceTypeDetail (
UINT16 Parameter,
UINT8 Option
IN UINT16 Para,
IN UINT8 Option
);
//
// 32-bit Memory Error Information (Type 18)
//
/**
Display 32-bit Memory Error Information (Type 18) type.
@param[in] ErrorType The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryErrorType (
UINT8 ErrorType,
UINT8 Option
IN UINT8 ErrorType,
IN UINT8 Option
);
/**
Display 32-bit Memory Error Information (Type 18) error granularity.
@param[in] Granularity The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryErrorGranularity (
UINT8 Granularity,
UINT8 Option
IN UINT8 Granularity,
IN UINT8 Option
);
/**
Display 32-bit Memory Error Information (Type 18) error information.
@param[in] Operation The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryErrorOperation (
UINT8 Operation,
UINT8 Option
IN UINT8 Operation,
IN UINT8 Option
);
//
// Memory Array Mapped Address (Type 19)
// Memory Device Mapped Address (Type 20)
//
// Built-in Pointing Device (Type 21)
//
/**
Display Built-in Pointing Device (Type 21) type information.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPointingDeviceType (
UINT8 Type,
UINT8 Option
IN UINT8 Type,
IN UINT8 Option
);
/**
Display Built-in Pointing Device (Type 21) information.
@param[in] Interface The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPointingDeviceInterface (
UINT8 Interface,
UINT8 Option
IN UINT8 Interface,
IN UINT8 Option
);
//
// Portable Battery (Type 22)
//
/**
Display Portable Battery (Type 22) information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayPBDeviceChemistry (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// Voltage Probe (Type 26)
//
/**
Display Voltage Probe (Type 26) location information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayVPLocation (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
/**
Display Voltage Probe (Type 26) status ype information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayVPStatus (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// Voltage Probe (Type 27)
//
/**
Display Cooling (Type 27) status information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayCoolingDeviceStatus (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
/**
Display Cooling (Type 27) type information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayCoolingDeviceType (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// Temperature Probe (Type 28)
//
/**
Display Temperature Probe (Type 28) status information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayTemperatureProbeStatus (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
/**
Display Temperature Probe (Type 28) location information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayTemperatureProbeLoc (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// Electrical Current Probe (Type 29)
//
/**
Display Electrical Current Probe (Type 29) status information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayECPStatus (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
/**
Display Electrical Current Probe (Type 29) location information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayECPLoc (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// Management Device (Type 34)
//
/**
Display Management Device (Type 34) information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMDType (
UINT8 Key,
UINT8 Option
);
VOID
DisplayMDAddressType (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// Memory Channel (Type 37)
//
/**
Display Memory Channel (Type 37) information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMemoryChannelType (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
//
// IPMI Device Information (Type 38)
//
/**
Display IPMI Device Information (Type 38) information.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayIPMIDIBMCInterfaceType (
UINT8 Key,
UINT8 Option
IN UINT8 Key,
IN UINT8 Option
);
#endif

View File

@ -16,77 +16,20 @@
#include <Guid/Smbios.h>
#include "LibSmbios.h"
EFI_STATUS
LibGetSmbiosSystemGuidAndSerialNumber (
IN EFI_GUID *SystemGuid,
OUT CHAR8 **SystemSerialNumber
)
{
EFI_STATUS Status;
SMBIOS_STRUCTURE_TABLE *SmbiosTable;
SMBIOS_STRUCTURE_POINTER Smbios;
SMBIOS_STRUCTURE_POINTER SmbiosEnd;
UINT16 Index;
/**
Return SMBIOS string given the string number.
Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
@param[in] Smbios Pointer to SMBIOS structure.
@param[in] StringNumber String number to return. -1 is used to skip all strings and
point to the next SMBIOS structure.
Smbios.Hdr = (SMBIOS_HEADER *) ((UINTN) (SmbiosTable->TableAddress));
SmbiosEnd.Raw = (UINT8 *) ((UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength));
for (Index = 0; Index < SmbiosTable->TableLength; Index++) {
if (Smbios.Hdr->Type == 1) {
if (Smbios.Hdr->Length < 0x19) {
//
// Older version did not support Guid and Serial number
//
continue;
}
//
// SMBIOS tables are byte packed so we need to do a byte copy to
// prevend alignment faults on Itanium-based platform.
//
CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof (EFI_GUID));
*SystemSerialNumber = LibGetSmbiosString (&Smbios, Smbios.Type1->SerialNumber);
return EFI_SUCCESS;
}
//
// Make Smbios point to the next record
//
LibGetSmbiosString (&Smbios, (UINT16) (-1));
if (Smbios.Raw >= SmbiosEnd.Raw) {
//
// SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e.
// given this we must double check against the lenght of
// the structure. My home PC has this bug.ruthard
//
return EFI_SUCCESS;
}
}
return EFI_SUCCESS;
}
CHAR8 *
@return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
CHAR8*
LibGetSmbiosString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber
)
/*++
Routine Description:
Return SMBIOS string given the string number.
Arguments:
Smbios - Pointer to SMBIOS structure
StringNumber - String number to return. -1 is used to skip all strings and
point to the next SMBIOS structure.
Returns:
Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
{
UINT16 Index;
CHAR8 *String;

View File

@ -14,7 +14,7 @@
#include "../UefiShellDebug1CommandsLib.h"
#include "LibSmbiosView.h"
#include "smbiosview.h"
#include "SmbiosView.h"
#include "PrintInfo.h"
#include "QueryTable.h"
@ -32,6 +32,12 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{NULL, TypeMax}
};
/**
Function for 'smbiosview' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunSmbiosView (
@ -197,7 +203,7 @@ SMBiosView (
// structure table head.
//
SMBIOS_STRUCTURE_POINTER pStruct;
SMBIOS_STRUCTURE_POINTER SmbiosStruct;
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
SMBiosTable = NULL;
@ -269,14 +275,14 @@ SMBiosView (
break;
}
Offset = (UINT16) (Offset + Length);
pStruct.Raw = Buffer;
SmbiosStruct.Raw = Buffer;
//
// if QueryType==Random, print this structure.
// if QueryType!=Random, but Hdr->Type==QueryType, also print it.
// only if QueryType != Random and Hdr->Type != QueryType, skiped it.
//
if (QueryType != STRUCTURE_TYPE_RANDOM && pStruct.Hdr->Type != QueryType) {
if (QueryType != STRUCTURE_TYPE_RANDOM && SmbiosStruct.Hdr->Type != QueryType) {
continue;
}
@ -284,8 +290,8 @@ SMBiosView (
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),
gShellDebug1HiiHandle,
pStruct.Hdr->Type,
pStruct.Hdr->Handle
SmbiosStruct.Hdr->Type,
SmbiosStruct.Hdr->Handle
);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);
//
@ -312,12 +318,12 @@ SMBiosView (
//
// check structure legality
//
SmbiosCheckStructure (&pStruct);
SmbiosCheckStructure (&SmbiosStruct);
//
// Print structure information
//
SmbiosPrintStructure (&pStruct, gShowType);
SmbiosPrintStructure (&SmbiosStruct, gShowType);
ShellPrintEx(-1,-1,L"\n");
/*
@ -363,9 +369,9 @@ InitSmbiosTableStatistics (
UINT16 Offset;
UINT16 Index;
SMBIOS_STRUCTURE_POINTER pStruct;
SMBIOS_STRUCTURE_POINTER SmbiosStruct;
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
STRUCTURE_STATISTICS *pStatistics;
STRUCTURE_STATISTICS *StatisticsPointer;
SMBiosTable = NULL;
LibSmbiosGetEPS (&SMBiosTable);
@ -394,7 +400,7 @@ InitSmbiosTableStatistics (
}
Offset = 0;
pStatistics = mStatisticsTable;
StatisticsPointer = mStatisticsTable;
//
// search from the first one
@ -415,19 +421,19 @@ InitSmbiosTableStatistics (
break;
}
pStruct.Raw = Buffer;
SmbiosStruct.Raw = Buffer;
Offset = (UINT16) (Offset + Length);
//
// general statistics
//
pStatistics->Index = Index;
pStatistics->Type = pStruct.Hdr->Type;
pStatistics->Handle = pStruct.Hdr->Handle;
pStatistics->Length = Length;
pStatistics->Addr = Offset;
StatisticsPointer->Index = Index;
StatisticsPointer->Type = SmbiosStruct.Hdr->Type;
StatisticsPointer->Handle = SmbiosStruct.Hdr->Handle;
StatisticsPointer->Length = Length;
StatisticsPointer->Addr = Offset;
pStatistics = &mStatisticsTable[Index];
StatisticsPointer = &mStatisticsTable[Index];
}
return EFI_SUCCESS;
@ -448,7 +454,7 @@ DisplayStatisticsTable (
{
UINTN Index;
UINTN Num;
STRUCTURE_STATISTICS *pStatistics;
STRUCTURE_STATISTICS *StatisticsPointer;
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
SMBiosTable = NULL;
@ -477,22 +483,22 @@ DisplayStatisticsTable (
}
ShellPrintEx(-1,-1,L"============================================================\n");
pStatistics = &mStatisticsTable[0];
StatisticsPointer = &mStatisticsTable[0];
Num = SMBiosTable->NumberOfSmbiosStructures;
//
// display statistics table content
//
for (Index = 1; Index <= Num; Index++) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, pStatistics->Index);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, pStatistics->Type);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, pStatistics->Handle);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle);
if (Option >= SHOW_DETAIL) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, pStatistics->Addr);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, pStatistics->Length);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length);
}
ShellPrintEx(-1,-1,L"\n");
pStatistics = &mStatisticsTable[Index];
StatisticsPointer = &mStatisticsTable[Index];
/*
//
// Display 20 lines and wait for a page break

View File

@ -1,7 +1,7 @@
/** @file
Tools of clarify the content of the smbios table.
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
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
@ -12,8 +12,8 @@
**/
#ifndef _SMBIOS_VIEW_H
#define _SMBIOS_VIEW_H
#ifndef _SMBIOS_VIEW_H_
#define _SMBIOS_VIEW_H_
#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE
#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF

View File

@ -12,7 +12,7 @@
**/
#if !defined (_UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_)
#ifndef _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
#define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
#include <Uefi.h>

View File

@ -53,7 +53,7 @@
SmbiosView/LibSmbiosView.h
SmbiosView/LibSmbios.h
SmbiosView/QueryTable.h
SmbiosView/smbiosview.h
SmbiosView/SmbiosView.h
UefiShellDebug1CommandsLib.c
UefiShellDebug1CommandsLib.h
UefiShellDebug1CommandsLib.uni

View File

@ -58,8 +58,6 @@ GetDeviceHandleInfo (
EFI_HANDLE *HandleBuffer;
UINTN Count;
UINTN TestHandle = 0x43;
if (TheHandle == NULL
|| Type == NULL
|| Cfg == NULL
@ -71,10 +69,6 @@ GetDeviceHandleInfo (
return (EFI_INVALID_PARAMETER);
}
if (ConvertHandleToHandleIndex(TheHandle) == TestHandle) {
TestHandle = TestHandle;
}
*Cfg = FALSE;
*Diag = FALSE;
*Children = 0;

View File

@ -211,7 +211,7 @@ DoDiagnostics (
FreePool(Language);
}
}
if (Found == FALSE && (Lang == NULL||(Lang!=NULL&&Lang[2]!='-'))){
if (!Found && (Lang == NULL||(Lang!=NULL&&(Lang[2]!='-')))){
Status = gBS->OpenProtocol(
DriverHandleList[DriverHandleListLoop],
&gEfiDriverDiagnosticsProtocolGuid,

View File

@ -12,7 +12,7 @@
**/
#if !defined (_UEFI_SHELL_DRIVER1_COMMANDS_LIB_H_)
#ifndef _UEFI_SHELL_DRIVER1_COMMANDS_LIB_H_
#define _UEFI_SHELL_DRIVER1_COMMANDS_LIB_H_
#include <Uefi.h>

View File

@ -12,7 +12,7 @@
**/
#if !defined (_UEFI_SHELL_INSTALL1_COMMANDS_LIB_H_)
#ifndef _UEFI_SHELL_INSTALL1_COMMANDS_LIB_H_
#define _UEFI_SHELL_INSTALL1_COMMANDS_LIB_H_
#include <Uefi.h>

View File

@ -12,7 +12,7 @@
**/
#if !defined (_UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_)
#ifndef _UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_
#define _UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_
#include <Uefi.h>

View File

@ -516,18 +516,19 @@ CONST CHAR16 AnyF[] = L"F*";
/**
Function to display mapping information to the user.
if Specific is specified then Consist and Normal will be ignored since information will
If Specific is specified then Consist and Normal will be ignored since information will
be printed for the specific item only.
@param[in] Verbose TRUE to display (extra) verbose information
@param[in] Consist TRUE to display consistent mappings
@param[in] Normal TRUE to display normal (not consist) mappings
@param[in] TypeString pointer to string of filter types
@param[in] SFO TRUE to display output in Standard Output Format
@param[in] Specific pointer to string for specific map to display
@param[in] Verbose TRUE to display (extra) verbose information.
@param[in] Consist TRUE to display consistent mappings.
@param[in] Normal TRUE to display normal (not consist) mappings.
@param[in] TypeString Pointer to string of filter types.
@param[in] SFO TRUE to display output in Standard Output Format.
@param[in] Specific Pointer to string for specific map to display.
@param[in] Header TRUE to print the header block.
@retval SHELL_SUCCESS the display was printed
@retval SHELL_INVALID_PARAMETER one of Consist or Normal must be TRUE if no Specific
@retval SHELL_SUCCESS The display was printed.
@retval SHELL_INVALID_PARAMETER One of Consist or Normal must be TRUE if no Specific.
**/
SHELL_STATUS

View File

@ -20,7 +20,7 @@
**/
#if !defined (_UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_)
#ifndef _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_
#define _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_
#include <Uefi.h>

View File

@ -12,7 +12,7 @@
**/
#if !defined (_UEFI_SHELL_LEVEL3_COMMANDS_LIB_H_)
#ifndef _UEFI_SHELL_LEVEL3_COMMANDS_LIB_H_
#define _UEFI_SHELL_LEVEL3_COMMANDS_LIB_H_
#include <Uefi.h>

View File

@ -12,7 +12,7 @@
**/
#if !defined (_UEFI_SHELL_LIB_INTERNAL_H_)
#ifndef _UEFI_SHELL_LIB_INTERNAL_H_
#define _UEFI_SHELL_LIB_INTERNAL_H_
#include <Uefi.h>

View File

@ -20,7 +20,7 @@
BOOLEAN mIp4ConfigExist = FALSE;
STATIC EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting = NULL;
STATIC CONST UINTN SEC_TO_NS = 10000000;
STATIC CONST UINTN SecondsToNanoSeconds = 10000000;
STATIC CONST CHAR16 DhcpString[5] = L"DHCP";
STATIC CONST CHAR16 StaticString[7] = L"STATIC";
STATIC CONST CHAR16 PermanentString[10] = L"PERMANENT";
@ -173,7 +173,7 @@ TestChildHandle (
Get the child handle of the NIC handle.
@param[in] Controller Routing information: GUID.
@param[in] ChildHandle Returned child handle.
@param[out] ChildHandle Returned child handle.
@retval EFI_SUCCESS Successfully to get child handle.
**/
@ -1128,7 +1128,7 @@ IfconfigStartIp4(
Status = gBS->SetTimer (
TimerToGetMap,
TimerRelative,
MultU64x32 (SEC_TO_NS, 5)
MultU64x32 (SecondsToNanoSeconds, 5)
);
if (EFI_ERROR (Status)) {

View File

@ -134,29 +134,21 @@ typedef struct _PING_PRIVATE_DATA {
PING_IPX_COMPLETION_TOKEN RxToken;
} PING_PRIVATE_DATA;
/**
Calculate the internet checksum (see RFC 1071).
@param[in] Packet Buffer which contains the data to be checksummed.
@param[in] Length Length to be checksummed.
@retval Checksum Returns the 16 bit ones complement of
ones complement sum of 16 bit words
**/
UINT16
EFIAPI
NetChecksum (
IN UINT8 *Buffer,
IN UINT32 Length
)
/*++
Routine Description:
Calculate the internet checksum (see RFC 1071)
Arguments:
Packet - Buffer which contains the data to be checksummed
Length - Length to be checksummed
Returns:
Checksum - Returns the 16 bit ones complement of
ones complement sum of 16 bit words
--*/
{
UINT32 Sum;
UINT8 Odd;
@ -167,11 +159,11 @@ Returns:
Sum = 0;
Odd = (UINT8) (Length & 1);
Length >>= 1;
while (Length--) {
while ((Length--) != 0) {
Sum += *Packet++;
}
if (Odd) {
if (Odd != 0) {
Sum += *(UINT8 *) Packet;
}

View File

@ -13,7 +13,7 @@
**/
#if !defined (_UEFI_SHELL_NETWORK1_COMMANDS_LIB_H_)
#ifndef _UEFI_SHELL_NETWORK1_COMMANDS_LIB_H_
#define _UEFI_SHELL_NETWORK1_COMMANDS_LIB_H_
#include <Uefi.h>