mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 21:54:27 +02:00
Update KbcResetDxe to be more generic by layering it on top of the ResetSystemLib class.
Reduce number of source files from 3 to 1. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10768 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
27833309f8
commit
bb77cee7d1
@ -1,54 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Reset Architectural Protocol implementation
|
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, 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
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "Reset.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reset the system.
|
|
||||||
|
|
||||||
@param ResetType warm or cold
|
|
||||||
@param ResetStatus possible cause of reset
|
|
||||||
@param DataSize Size of ResetData in bytes
|
|
||||||
@param ResetData Optional Unicode string
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
KbcResetSystem (
|
|
||||||
IN EFI_RESET_TYPE ResetType,
|
|
||||||
IN EFI_STATUS ResetStatus,
|
|
||||||
IN UINTN DataSize,
|
|
||||||
IN VOID *ResetData OPTIONAL
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINT8 Data;
|
|
||||||
|
|
||||||
switch (ResetType) {
|
|
||||||
case EfiResetWarm:
|
|
||||||
case EfiResetCold:
|
|
||||||
case EfiResetShutdown:
|
|
||||||
Data = 0xfe;
|
|
||||||
IoWrite8 (0x64, Data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Given we should have reset getting here would be bad
|
|
||||||
//
|
|
||||||
ASSERT (FALSE);
|
|
||||||
}
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Definitions for reset
|
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, 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
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef _KBC_RESET_H
|
|
||||||
#define _KBC_RESET_H
|
|
||||||
|
|
||||||
#include <PiDxe.h>
|
|
||||||
|
|
||||||
#include <Library/IoLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
|
|
||||||
#include <Protocol/Reset.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
Initialize the state information for the Reset Architectural Protocol
|
|
||||||
|
|
||||||
@param ImageHandle Handle of the loaded driver
|
|
||||||
@param SystemTable Pointer to the System Table
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Thread can be successfully created
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
|
|
||||||
@retval EFI_DEVICE_ERROR Cannot create the timer service
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
InitializeReset (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reset the system.
|
|
||||||
|
|
||||||
@param ResetType warm or cold
|
|
||||||
@param ResetStatus possible cause of reset
|
|
||||||
@param DataSize Size of ResetData in bytes
|
|
||||||
@param ResetData Optional Unicode string
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
KbcResetSystem (
|
|
||||||
IN EFI_RESET_TYPE ResetType,
|
|
||||||
IN EFI_STATUS ResetStatus,
|
|
||||||
IN UINTN DataSize,
|
|
||||||
IN VOID *ResetData OPTIONAL
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
#endif
|
|
@ -25,16 +25,15 @@
|
|||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
|
UefiDriverEntryPoint
|
||||||
DebugLib
|
DebugLib
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
UefiDriverEntryPoint
|
ResetSystemLib
|
||||||
IoLib
|
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
Reset.c
|
|
||||||
Reset.h
|
|
||||||
ResetEntry.c
|
ResetEntry.c
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
@ -42,5 +41,3 @@
|
|||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
TRUE
|
TRUE
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,13 +11,56 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "Reset.h"
|
#include <PiDxe.h>
|
||||||
|
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/ResetSystemLib.h>
|
||||||
|
|
||||||
|
#include <Protocol/Reset.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// The handle onto which the Reset Architectural Protocol is installed
|
// The handle onto which the Reset Architectural Protocol is installed
|
||||||
//
|
//
|
||||||
EFI_HANDLE mResetHandle = NULL;
|
EFI_HANDLE mResetHandle = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reset the system.
|
||||||
|
|
||||||
|
@param ResetType warm or cold
|
||||||
|
@param ResetStatus possible cause of reset
|
||||||
|
@param DataSize Size of ResetData in bytes
|
||||||
|
@param ResetData Optional Unicode string
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
KbcResetSystem (
|
||||||
|
IN EFI_RESET_TYPE ResetType,
|
||||||
|
IN EFI_STATUS ResetStatus,
|
||||||
|
IN UINTN DataSize,
|
||||||
|
IN VOID *ResetData OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (ResetType) {
|
||||||
|
case EfiResetWarm:
|
||||||
|
ResetWarm ();
|
||||||
|
break;
|
||||||
|
case EfiResetCold:
|
||||||
|
ResetCold ();
|
||||||
|
break;
|
||||||
|
case EfiResetShutdown:
|
||||||
|
ResetShutdown ();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Given we should have reset getting here would be bad
|
||||||
|
//
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the state information for the Reset Architectural Protocol
|
Initialize the state information for the Reset Architectural Protocol
|
||||||
@ -54,8 +97,7 @@ InitializeReset (
|
|||||||
//
|
//
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&mResetHandle,
|
&mResetHandle,
|
||||||
&gEfiResetArchProtocolGuid,
|
&gEfiResetArchProtocolGuid, NULL,
|
||||||
NULL,
|
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user