Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/tianocore/master' into Oth…
Browse files Browse the repository at this point in the history
…erOS
  • Loading branch information
Googulator committed Nov 17, 2017
2 parents 69fecb7 + b266264 commit a37df53
Show file tree
Hide file tree
Showing 19 changed files with 299 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
AArch64/ArmPlatformHelper.S

[FixedPcd]
gArmTokenSpaceGuid.PcdSystemMemoryBase
gArmTokenSpaceGuid.PcdSystemMemorySize

gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
gArmTokenSpaceGuid.PcdArmPrimaryCore

Expand Down
4 changes: 4 additions & 0 deletions MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ UsbBootRequestSense (
Status = EFI_MEDIA_CHANGED;
Media->ReadOnly = FALSE;
Media->MediaId++;
} else if (SenseData.Asc == USB_BOOT_ASC_NOT_READY) {
Status = EFI_NOT_READY;
} else if (SenseData.Asc == USB_BOOT_ASC_NO_MEDIA) {
Status = EFI_NOT_READY;
}
break;

Expand Down
44 changes: 24 additions & 20 deletions OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,20 @@
**/

#include <Base.h>
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
#include <Library/IoLib.h>
#include <Library/PrintLib.h>
#include <Library/PcdLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugPrintErrorLevelLib.h>
#include "DebugLibDetect.h"

//
// Define the maximum debug and assert message length that this library supports
//
#define MAX_DEBUG_MESSAGE_LENGTH 0x100

/**
This constructor function does not have to do anything.
@retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS.
**/
RETURN_STATUS
EFIAPI
PlatformDebugLibIoPortConstructor (
VOID
)
{
return EFI_SUCCESS;
}

/**
Prints a debug message to the debug output device if the specified error level is enabled.
Expand Down Expand Up @@ -77,9 +62,10 @@ DebugPrint (
ASSERT (Format != NULL);

//
// Check driver debug mask value and global mask
// Check if the global mask disables this message or the device is inactive
//
if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0 ||
!PlatformDebugLibIoPortFound ()) {
return;
}

Expand Down Expand Up @@ -136,9 +122,11 @@ DebugAssert (
FileName, (UINT64)LineNumber, Description);

//
// Send the print string to the debug I/O port
// Send the print string to the debug I/O port, if present
//
IoWriteFifo8 (PcdGet16 (PcdDebugIoPort), Length, Buffer);
if (PlatformDebugLibIoPortFound ()) {
IoWriteFifo8 (PcdGet16 (PcdDebugIoPort), Length, Buffer);
}

//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
Expand Down Expand Up @@ -281,3 +269,19 @@ DebugPrintLevelEnabled (
{
return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
}

/**
Return the result of detecting the debug I/O port device.
@retval TRUE if the debug I/O port device was detected.
@retval FALSE otherwise
**/
BOOLEAN
EFIAPI
PlatformDebugLibIoPortDetect (
VOID
)
{
return IoRead8 (PcdGet16 (PcdDebugIoPort)) == BOCHS_DEBUG_PORT_MAGIC;
}
55 changes: 55 additions & 0 deletions OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/** @file
Detection code for QEMU debug port.
Non-SEC instance, caches the result of detection.
Copyright (c) 2017, Red Hat, Inc.<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 <Base.h>
#include "DebugLibDetect.h"

//
// Set to TRUE if the debug I/O port is enabled
//
STATIC BOOLEAN mDebugIoPortFound = FALSE;

/**
This constructor function checks if the debug I/O port device is present,
caching the result for later use.
@retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS.
**/
RETURN_STATUS
EFIAPI
PlatformDebugLibIoPortConstructor (
VOID
)
{
mDebugIoPortFound = PlatformDebugLibIoPortDetect();
return RETURN_SUCCESS;
}

/**
Return the cached result of detecting the debug I/O port device.
@retval TRUE if the debug I/O port device was detected.
@retval FALSE otherwise
**/
BOOLEAN
EFIAPI
PlatformDebugLibIoPortFound (
VOID
)
{
return mDebugIoPortFound;
}
57 changes: 57 additions & 0 deletions OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/** @file
Base Debug library instance for QEMU debug port.
It uses PrintLib to send debug messages to a fixed I/O port.
Copyright (c) 2017, Red Hat, Inc.<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 __DEBUG_IO_PORT_DETECT_H__
#define __DEBUG_IO_PORT_DETECT_H__

#include <Base.h>

//
// The constant value that is read from the debug I/O port
//
#define BOCHS_DEBUG_PORT_MAGIC 0xE9


/**
Helper function to return whether the virtual machine has a debug I/O port.
PlatformDebugLibIoPortFound can call this function directly or cache the
result.
@retval TRUE if the debug I/O port device was detected.
@retval FALSE otherwise
**/
BOOLEAN
EFIAPI
PlatformDebugLibIoPortDetect (
VOID
);

/**
Return whether the virtual machine has a debug I/O port. DebugLib.c
calls this function instead of PlatformDebugLibIoPortDetect, to allow
caching if possible.
@retval TRUE if the debug I/O port device was detected.
@retval FALSE otherwise
**/
BOOLEAN
EFIAPI
PlatformDebugLibIoPortFound (
VOID
);

#endif
48 changes: 48 additions & 0 deletions OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/** @file
Detection code for QEMU debug port.
SEC instance, cannot cache the result of detection.
Copyright (c) 2017, Red Hat, Inc.<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 <Base.h>
#include "DebugLibDetect.h"

/**
This constructor function does not have anything to do.
@retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS.
**/
RETURN_STATUS
EFIAPI
PlatformRomDebugLibIoPortConstructor (
VOID
)
{
return RETURN_SUCCESS;
}

/**
Return the result of detecting the debug I/O port device.
@retval TRUE if the debug I/O port device was detected.
@retval FALSE otherwise
**/
BOOLEAN
EFIAPI
PlatformDebugLibIoPortFound (
VOID
)
{
return PlatformDebugLibIoPortDetect ();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
FILE_GUID = DF934DA3-CD31-49FE-AF50-B3C87C79325F
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = DebugLib
LIBRARY_CLASS = DebugLib|PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION
CONSTRUCTOR = PlatformDebugLibIoPortConstructor

#
Expand All @@ -30,6 +30,7 @@

[Sources]
DebugLib.c
DebugLibDetect.c

[Packages]
MdePkg/MdePkg.dec
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## @file
# Instance of Debug Library for the QEMU debug console port.
# It uses Print Library to produce formatted output strings.
#
# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2017, Red Hat, Inc.<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.
#
#
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PlatformRomDebugLibIoPort
FILE_GUID = CEB0D9D3-328F-4C24-8C02-28FA1986AE1B
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = DebugLib|SEC
CONSTRUCTOR = PlatformRomDebugLibIoPortConstructor

#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#

[Sources]
DebugLib.c
DebugLibDetectRom.c

[Packages]
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec

[LibraryClasses]
BaseMemoryLib
IoLib
PcdLib
PrintLib
BaseLib
DebugPrintErrorLevelLib

[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES

2 changes: 1 addition & 1 deletion OvmfPkg/OvmfPkgIa32.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
Expand Down
2 changes: 1 addition & 1 deletion OvmfPkg/OvmfPkgIa32.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.
0x007000|0x001000
gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize

0x010000|0x008000
0x010000|0x010000
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize

0x020000|0x0E0000
Expand Down
2 changes: 1 addition & 1 deletion OvmfPkg/OvmfPkgIa32X64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
Expand Down
2 changes: 1 addition & 1 deletion OvmfPkg/OvmfPkgIa32X64.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.
0x007000|0x001000
gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize

0x010000|0x008000
0x010000|0x010000
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize

0x020000|0x0E0000
Expand Down
2 changes: 1 addition & 1 deletion OvmfPkg/OvmfPkgX64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
Expand Down
2 changes: 1 addition & 1 deletion OvmfPkg/OvmfPkgX64.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.
0x007000|0x001000
gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize

0x010000|0x008000
0x010000|0x010000
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize

0x020000|0x0E0000
Expand Down
Loading

0 comments on commit a37df53

Please sign in to comment.