diff options
Diffstat (limited to 'OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.c')
-rw-r--r-- | OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.c b/OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.c index 895dfc02f9..b29ed3e58e 100644 --- a/OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.c +++ b/OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.c @@ -36,8 +36,8 @@ // in general, it is actually fine for the Xen domU (guest) environment that
// this module is intended for, as UEFI always executes from DRAM in that case.
//
-STATIC evtchn_send_t mXenConsoleEventChain;
-STATIC struct xencons_interface *mXenConsoleInterface;
+STATIC evtchn_send_t mXenConsoleEventChain;
+STATIC struct xencons_interface *mXenConsoleInterface;
/**
Initialize the serial device hardware.
@@ -56,19 +56,20 @@ SerialPortInitialize ( VOID
)
{
- if (! XenHypercallIsAvailable ()) {
+ if (!XenHypercallIsAvailable ()) {
return RETURN_DEVICE_ERROR;
}
if (!mXenConsoleInterface) {
mXenConsoleEventChain.port = (UINT32)XenHypercallHvmGetParam (HVM_PARAM_CONSOLE_EVTCHN);
- mXenConsoleInterface = (struct xencons_interface *)(UINTN)
- (XenHypercallHvmGetParam (HVM_PARAM_CONSOLE_PFN) << EFI_PAGE_SHIFT);
+ mXenConsoleInterface = (struct xencons_interface *)(UINTN)
+ (XenHypercallHvmGetParam (HVM_PARAM_CONSOLE_PFN) << EFI_PAGE_SHIFT);
//
// No point in ASSERT'ing here as we won't be seeing the output
//
}
+
return RETURN_SUCCESS;
}
@@ -92,8 +93,8 @@ SerialPortInitialize ( UINTN
EFIAPI
SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
)
{
XENCONS_RING_IDX Consumer, Producer;
@@ -116,15 +117,15 @@ SerialPortWrite ( MemoryFence ();
- while (Sent < NumberOfBytes && ((Producer - Consumer) < sizeof (mXenConsoleInterface->out)))
- mXenConsoleInterface->out[MASK_XENCONS_IDX(Producer++, mXenConsoleInterface->out)] = Buffer[Sent++];
+ while (Sent < NumberOfBytes && ((Producer - Consumer) < sizeof (mXenConsoleInterface->out))) {
+ mXenConsoleInterface->out[MASK_XENCONS_IDX (Producer++, mXenConsoleInterface->out)] = Buffer[Sent++];
+ }
MemoryFence ();
mXenConsoleInterface->out_prod = Producer;
XenHypercallEventChannelOp (EVTCHNOP_send, &mXenConsoleEventChain);
-
} while (Sent < NumberOfBytes);
return Sent;
@@ -148,9 +149,9 @@ SerialPortWrite ( UINTN
EFIAPI
SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
+ OUT UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
{
XENCONS_RING_IDX Consumer, Producer;
UINTN Received;
@@ -171,8 +172,9 @@ SerialPortRead ( MemoryFence ();
Received = 0;
- while (Received < NumberOfBytes && Consumer < Producer)
- Buffer[Received++] = mXenConsoleInterface->in[MASK_XENCONS_IDX(Consumer++, mXenConsoleInterface->in)];
+ while (Received < NumberOfBytes && Consumer < Producer) {
+ Buffer[Received++] = mXenConsoleInterface->in[MASK_XENCONS_IDX (Consumer++, mXenConsoleInterface->in)];
+ }
MemoryFence ();
@@ -197,7 +199,7 @@ SerialPortPoll ( )
{
return mXenConsoleInterface &&
- mXenConsoleInterface->in_cons != mXenConsoleInterface->in_prod;
+ mXenConsoleInterface->in_cons != mXenConsoleInterface->in_prod;
}
/**
@@ -213,7 +215,7 @@ SerialPortPoll ( RETURN_STATUS
EFIAPI
SerialPortSetControl (
- IN UINT32 Control
+ IN UINT32 Control
)
{
return RETURN_UNSUPPORTED;
@@ -232,7 +234,7 @@ SerialPortSetControl ( RETURN_STATUS
EFIAPI
SerialPortGetControl (
- OUT UINT32 *Control
+ OUT UINT32 *Control
)
{
if (!mXenConsoleInterface) {
@@ -243,6 +245,7 @@ SerialPortGetControl ( if (!SerialPortPoll ()) {
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY;
}
+
return RETURN_SUCCESS;
}
@@ -282,14 +285,13 @@ SerialPortGetControl ( RETURN_STATUS
EFIAPI
SerialPortSetAttributes (
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT UINT32 *Timeout,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
+ IN OUT UINT64 *BaudRate,
+ IN OUT UINT32 *ReceiveFifoDepth,
+ IN OUT UINT32 *Timeout,
+ IN OUT EFI_PARITY_TYPE *Parity,
+ IN OUT UINT8 *DataBits,
+ IN OUT EFI_STOP_BITS_TYPE *StopBits
)
{
return RETURN_UNSUPPORTED;
}
-
|