Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OcMainLib: Read and set serial PCD values from config #330

Merged
merged 40 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
358c09c
OcMainLib: PCD tests
PMheart Mar 14, 2022
afa42c9
OcMainLib: Fix PCD tests
PMheart Mar 15, 2022
56d5929
OcMainLib: Typo
PMheart Mar 15, 2022
b431838
Docs: Add serial sample
PMheart Mar 28, 2022
88b41bc
Docs: Update Serial hierarchy
PMheart Mar 31, 2022
bdd1eb4
Docs: Drop PciDevice
PMheart Mar 31, 2022
d535e5d
Docs: Fix key type
PMheart Mar 31, 2022
aa00320
Docs: Fix default RegisterBase value
PMheart Mar 31, 2022
2ea4149
OcConfigurationLib: Add Misc->Serial field
PMheart Mar 31, 2022
4e68948
OcMainLib: Read and set PCD values from config
PMheart Mar 31, 2022
68ddc2f
OcMainLib: Initialize after overriding
PMheart Mar 31, 2022
0370d79
OcMainLib: Basic sanity check
PMheart Mar 31, 2022
227d1bb
Revert "OcMainLib: Basic sanity check"
PMheart Mar 31, 2022
4c41dd3
ocvalidate: Move PCD value sanity checks to ocvalidate
PMheart Mar 31, 2022
e991b40
ocvalidate: Fix logic
PMheart Mar 31, 2022
8ce6d50
ocvalidate: Add ref links
PMheart Mar 31, 2022
51edd6b
ocvalidate: Last byte of Misc->Serial->RegisterAccessWidth must be 0xFF
PMheart Mar 31, 2022
f219375
ocvalidate: Misc->Serial->RegisterAccessWidth must be divisible by 4 …
PMheart Mar 31, 2022
aa4133e
ocvalidate: Sync Misc->Serial checklist
PMheart Mar 31, 2022
a4667c0
ocvalidate: Fix PciDeviceInfoSize check
PMheart Mar 31, 2022
9a189f5
OcConfigurationLib: Drop SerialInit
PMheart Mar 31, 2022
a383a62
ocvalidate: Fix logic
PMheart Mar 31, 2022
43c48bf
Docs: Sync Configuration.tex
PMheart Mar 31, 2022
026e0f3
OcConfigurationLib: Try to call pcd setters
PMheart Mar 31, 2022
3ecc122
Revert "OcConfigurationLib: Try to call pcd setters"
PMheart Mar 31, 2022
ec9edf1
OcConfigurationLib: Fix PciDeviceInfo failsafe value
PMheart Mar 31, 2022
021ca58
OcConfigurationLib: Fix indentation
PMheart Mar 31, 2022
07194b2
OcMainLib: Remove redundant notes
PMheart Mar 31, 2022
33f11d5
OcMainLib: Fix memory corruption
PMheart Mar 31, 2022
ec203cf
OcMainLib: Only update PcdSerialPciDeviceInfo with sane size
PMheart Mar 31, 2022
1640545
OcMainLib: Abort serial port init on error
PMheart Mar 31, 2022
653e35f
ocvalidate: Fix size calculation
PMheart Apr 1, 2022
aede0dc
Docs: Provide more details on Serial section
PMheart Apr 1, 2022
582ce6b
ocvalidate: Fix typo
PMheart Apr 2, 2022
a2fae24
Docs: Fix typo
PMheart Apr 2, 2022
9b26c63
Docs: Sync with code-wise behavior
PMheart Apr 2, 2022
ccca028
Docs: Drop wrong message
PMheart Apr 2, 2022
94d9ab6
Docs: Add missing description for RegisterAccessWidth
PMheart Apr 3, 2022
e154b97
ocvalidate: Fix conditions logic
PMheart Apr 3, 2022
22a852d
Build: Properly initialize PcdSerialPciDeviceInfo
PMheart Apr 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 128 additions & 21 deletions Docs/Configuration.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3154,6 +3154,17 @@ \subsection{Properties}\label{miscprops}
\textbf{Description}: Apply the security configuration described in the
\hyperref[miscsecurityprops]{Security Properties} section below.

\item
\texttt{Serial}\\
\textbf{Type}: \texttt{plist\ dict}\\
\textbf{Description}: Configure PCD values required by \texttt{BaseSerialPortLib16550}
for serial ports to properly function. Values are listed and described in the
\hyperref[miscserialprops]{Serial Properties} section below.

This section overrides the PCD values listed in
\href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf}{BaseSerialPortLib16550.inf}.
Refer to \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec} for the explanations of each key.
PMheart marked this conversation as resolved.
Show resolved Hide resolved

\item
\texttt{Tools}\label{misctools}\\
\textbf{Type}: \texttt{plist\ array}\\
Expand Down Expand Up @@ -3741,26 +3752,6 @@ \subsection{Debug Properties}\label{miscdebugprops}
\emph{Note 2}: Messages printed before the configuration of log protocol
cannot be filtered.

\item
\texttt{SerialInit}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Perform serial port initialisation.

This option will perform serial port initialisation within OpenCore prior to enabling
(any) debug logging. Serial port configuration is defined via PCDs at compile time
in \texttt{gEfiMdeModulePkgTokenSpaceGuid} GUID.

Default values as found in \texttt{MdeModulePkg.dec} are as follows:

\begin{itemize}
PMheart marked this conversation as resolved.
Show resolved Hide resolved
\tightlist
\item \texttt{PcdSerialBaudRate} --- Baud rate: \texttt{115200}.
\item \texttt{PcdSerialLineControl} --- Line control: no parity, 8 data bits, 1 stop bit.
\end{itemize}

Refer to the \hyperref[troubleshootingdebug]{\texttt{Debugging}} section for details.

\item
\texttt{SysReport}\\
\textbf{Type}: \texttt{plist\ boolean}\\
Expand Down Expand Up @@ -4422,6 +4413,122 @@ \subsection{Security Properties}\label{miscsecurityprops}

\end{enumerate}

\subsection{Serial Properties}\label{miscserialprops}

\begin{enumerate}
\item
\texttt{BaudRate}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{115200}\\
\textbf{Description}: Set the baud rate for serial port.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{ClockRate}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{1843200}\\
\textbf{Description}: Set the clock rate for serial port.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{ExtendedTxFifoSize}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{64}\\
\textbf{Description}: Set the extended transmit FIFO size for serial port.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{FifoControl}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{0x07}\\
\textbf{Description}: Configure serial port FIFO Control settings.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{Init}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Perform serial port initialisation.
When this option is set to \texttt{false}, no keys from this section will be overridden.

This option will perform serial port initialisation within OpenCore prior to enabling
PMheart marked this conversation as resolved.
Show resolved Hide resolved
(any) debug logging.
PMheart marked this conversation as resolved.
Show resolved Hide resolved

Refer to the \hyperref[troubleshootingdebug]{\texttt{Debugging}} section for details.

\item
\texttt{LineControl}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{0x07}\\
\textbf{Description}: Configure serial port Line Control settings.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{PciDeviceInfo}\\
\textbf{Type}: \texttt{plist\ data}\\
\textbf{Failsafe}: \texttt{0xFF}\\
\textbf{Description}: Set PCI serial device information.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joevt Would you please provide more information on how to convert a device path to the formatted PciDeviceInfo bytes? Thanks!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My current theory is that I just need the device number and function number from each PCI device in the UEFI device path for the first two bytes of each node in the PciDeviceInfo path. The second two bytes I'll leave as 00 00. The last node is followed by an FF.

The following code find PCIe serial ports and outputs their paths.

ioreg -p IODeviceTree -lw0 | perl -e '
	$ioregpath=""; $pcipath=""; while (<>) {
		if ( /^([ |]*)\+\-o (.+)  <class (\w+)/ ) {
			$indent = (length $1) / 2; $name = $2; $class = $3;
			$ioregpath =~ s|^((/[^/]*){$indent}).*|$1/$name|;
			$pcipath =~ s|^((/[^/]*){$indent}).*|$1/|;
			$name = ""; $uid = 0; $classcode = "";
		}
		   if ( $class eq "IOACPIPlatformDevice" ) { if ( /^[ |]*"name" = <"([^\"]*)">/ ) { $name = $1; }; if ( /^[ |]*"_UID" = "(\d+)"/ ) { $uid = $1; } }
		elsif ( $class eq "IOPCIDevice" ) { if ( /^[ |]*"pcidebug" = "\d+:(\d+):(\d+).*"/ ) { $name = sprintf("Pci(0x%x,0x%x)", $1, $2);  } if ( /^[ |]*"class-code" = <(\w+)>/ ) { $classcode = $1; } }
		if ( /^[ |]*}/ && $name ) {
			if ( $class eq "IOACPIPlatformDevice" ) {
				   if ($name eq "PNP0A03") { $name = sprintf ("PciRoot(0x%x)", $uid); }
				elsif ($name eq "PNP0A08") { $name = sprintf ("PciRoot(0x%x)", $uid); }
				elsif ($name =~ /PNP..../) { $name = sprintf ("Acpi(%s,0x%x)", $name, $uid); }
				# not translating all ACPI types since we only care about PCI devices
			}
			$pcipath .= $name;
			if ( $classcode eq "02000700" ) {
				$serialdevicepath = $pcipath =~ s/.*PciRoot\(0x0\)//r =~ s|/Pci\(||gr =~ s|\)| 00 00 |gr =~ s|0x||gr =~ s|,| |gr =~ s|\b(\w)\b|0\1|gr =~ s|$|FF|r;
				print $ioregpath =~ s|/Root/||r . "\n";
				print $pcipath =~ s|/*||r  . "\n"; 
				print "xxd -p -r <<< \"" . $serialdevicepath . "\" | base64\n";
				print "\n";
			}
		}
	}
'

This is the result:

/PCI0@0/P0P9@9/P9P2@0/P2P4@1/PXS3@0
PciRoot(0x0)/Pci(0x9,0x0)/Pci(0x0,0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)
xxd -p -r <<< "09 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 FF" | base64

/PCI0@0/P0P9@9/P9P2@0/P2P4@1/PXS3@0,2
PciRoot(0x0)/Pci(0x9,0x0)/Pci(0x0,0x0)/Pci(0x1,0x0)/Pci(0x0,0x2)
xxd -p -r <<< "09 00 00 00 00 00 00 00 01 00 00 00 00 02 00 00 FF" | base64

The following can take a UEFI device path and produce the serial PciDevicePath:

serialpath=PciRoot(0x0)/Pci(0x9,0x0)/Pci(0x0,0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)
perl -pe 's/PciRoot(0x0)//;s|/Pci\(||g;s|\)| 00 00 |g;s|0x||g;s|,| |g;s|\b(\w)\b|0\1|g; s|$|FF|' <<< "$serialpath" | xxd -p -r | base64

I'll let you know when I find out if this works.


This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialPciDeviceInfo}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{RegisterAccessWidth}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{8}\\
\textbf{Description}: Set serial port register access width.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterAccessWidth}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{RegisterBase}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{0x03F8}\\
\textbf{Description}: Set the base address of serial port registers.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{RegisterStride}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Failsafe}: \texttt{1}\\
\textbf{Description}: Set the serial port register stride in bytes.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{UseHardwareFlowControl}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Enable serial port hardware flow control.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\item
\texttt{UseMmio}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Indicate whether the serial port registers are in MMIO space.

This option will override the value of \texttt{gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio}
defined in \href{https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec}{MdeModulePkg.dec}.

\end{enumerate}

\subsection{Entry Properties}\label{miscentryprops}

\begin{enumerate}
Expand Down Expand Up @@ -8612,7 +8719,7 @@ \subsection{Debugging}\label{troubleshootingdebug}

To obtain the log during boot serial port debugging can be used. Serial port
debugging is enabled in \texttt{Target}, e.g. \texttt{0xB} for onscreen with serial. To
initialise serial within OpenCore use \texttt{SerialInit} configuration option.
initialise serial within OpenCore use \texttt{Init} configuration option under \texttt{Misc->Serial} with other values properly set.
For macOS the best choice is CP2102-based UART devices. Connect motherboard \texttt{TX}
to USB UART \texttt{RX}, and motherboard \texttt{GND} to USB UART \texttt{GND}. Use
\texttt{screen} utility to get the output, or download GUI software, such as
Expand Down
31 changes: 29 additions & 2 deletions Docs/Sample.plist
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,6 @@
<integer>2147483650</integer>
<key>LogModules</key>
<string>*</string>
<key>SerialInit</key>
<false/>
<key>SysReport</key>
<false/>
<key>Target</key>
Expand Down Expand Up @@ -1156,6 +1154,35 @@
<key>Vault</key>
<string>Secure</string>
</dict>
<key>Serial</key>
<dict>
<key>BaudRate</key>
<integer>115200</integer>
<key>ClockRate</key>
<integer>1843200</integer>
<key>DetectCable</key>
<false/>
<key>ExtendedTxFifoSize</key>
<integer>64</integer>
<key>FifoControl</key>
<integer>7</integer>
<key>Init</key>
<false/>
<key>LineControl</key>
<integer>3</integer>
<key>PciDeviceInfo</key>
<data>/w==</data>
<key>RegisterAccessWidth</key>
<integer>8</integer>
<key>RegisterBase</key>
<integer>1016</integer>
<key>RegisterStride</key>
<integer>1</integer>
<key>UseHardwareFlowControl</key>
<false/>
<key>UseMmio</key>
<false/>
</dict>
<key>Tools</key>
<array>
<dict>
Expand Down
31 changes: 29 additions & 2 deletions Docs/SampleCustom.plist
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,6 @@
<integer>2147483650</integer>
<key>LogModules</key>
<string>*</string>
<key>SerialInit</key>
<false/>
<key>SysReport</key>
<false/>
<key>Target</key>
Expand Down Expand Up @@ -1156,6 +1154,35 @@
<key>Vault</key>
<string>Secure</string>
</dict>
<key>Serial</key>
<dict>
<key>BaudRate</key>
<integer>115200</integer>
<key>ClockRate</key>
<integer>1843200</integer>
<key>DetectCable</key>
<false/>
<key>ExtendedTxFifoSize</key>
<integer>64</integer>
<key>FifoControl</key>
<integer>7</integer>
<key>Init</key>
<false/>
<key>LineControl</key>
<integer>3</integer>
<key>PciDeviceInfo</key>
<data>/w==</data>
<key>RegisterAccessWidth</key>
<integer>8</integer>
<key>RegisterBase</key>
<integer>1016</integer>
<key>RegisterStride</key>
<integer>1</integer>
<key>UseHardwareFlowControl</key>
<false/>
<key>UseMmio</key>
<false/>
</dict>
<key>Tools</key>
<array>
<dict>
Expand Down
29 changes: 28 additions & 1 deletion Include/Acidanthera/Library/OcConfigurationLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@
_(BOOLEAN , AppleDebug , , FALSE , ()) \
_(BOOLEAN , ApplePanic , , FALSE , ()) \
_(BOOLEAN , DisableWatchDog , , FALSE , ()) \
_(BOOLEAN , SerialInit , , FALSE , ()) \
_(BOOLEAN , SysReport , , FALSE , ()) \
_(OC_STRING , LogModules , , OC_STRING_CONSTR ("*", _, __) , OC_DESTR (OC_STRING))
OC_DECLARE (OC_MISC_DEBUG)
Expand Down Expand Up @@ -407,11 +406,39 @@ typedef enum {
OC_ARRAY (OC_MISC_TOOLS_ENTRY, _, __)
OC_DECLARE (OC_MISC_TOOLS_ARRAY)

///
/// Reference:
/// https://github.com/acidanthera/bugtracker/issues/1954#issuecomment-1084220743
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it is better to mention this 41-byte thing in docs, then remove these links in the comment. Same below.

///
#define OC_SERIAL_PCI_DEVICE_INFO_MAX_SIZE 41U

///
/// Reference:
/// https://github.com/acidanthera/audk/blob/master/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
/// https://github.com/acidanthera/audk/blob/master/MdeModulePkg/MdeModulePkg.dec
///
#define OC_MISC_SERIAL_FIELDS(_, __) \
PMheart marked this conversation as resolved.
Show resolved Hide resolved
_(UINT32 , BaudRate , , 115200 , ()) \
_(UINT32 , ClockRate , , 1843200 , ()) \
_(BOOLEAN , DetectCable , , FALSE , ()) \
_(UINT32 , ExtendedTxFifoSize , , 64 , ()) \
_(UINT8 , FifoControl , , 7 , ()) \
_(BOOLEAN , Init , , FALSE , ()) \
_(UINT8 , LineControl , , 3 , ()) \
_(OC_DATA , PciDeviceInfo , , OC_DATA_CONSTR ({0xFF}, _, __) , OC_DESTR (OC_DATA)) \
_(UINT8 , RegisterAccessWidth , , 8 , ()) \
_(UINT64 , RegisterBase , , 0x03F8 , ()) \
_(UINT32 , RegisterStride , , 1 , ()) \
_(BOOLEAN , UseHardwareFlowControl , , FALSE , ()) \
_(BOOLEAN , UseMmio , , FALSE , ())
OC_DECLARE (OC_MISC_SERIAL)

#define OC_MISC_CONFIG_FIELDS(_, __) \
_(OC_MISC_BLESS_ARRAY , BlessOverride , , OC_CONSTR2 (OC_MISC_BLESS_ARRAY, _, __) , OC_DESTR (OC_MISC_BLESS_ARRAY)) \
_(OC_MISC_BOOT , Boot , , OC_CONSTR2 (OC_MISC_BOOT, _, __) , OC_DESTR (OC_MISC_BOOT)) \
_(OC_MISC_DEBUG , Debug , , OC_CONSTR2 (OC_MISC_DEBUG, _, __) , OC_DESTR (OC_MISC_DEBUG)) \
_(OC_MISC_SECURITY , Security , , OC_CONSTR2 (OC_MISC_SECURITY, _, __) , OC_DESTR (OC_MISC_SECURITY)) \
_(OC_MISC_SERIAL , Serial , , OC_CONSTR2 (OC_MISC_SERIAL, _, __) , OC_DESTR (OC_MISC_SERIAL)) \
_(OC_MISC_TOOLS_ARRAY , Entries , , OC_CONSTR2 (OC_MISC_TOOLS_ARRAY, _, __) , OC_DESTR (OC_MISC_TOOLS_ARRAY)) \
_(OC_MISC_TOOLS_ARRAY , Tools , , OC_CONSTR2 (OC_MISC_TOOLS_ARRAY, _, __) , OC_DESTR (OC_MISC_TOOLS_ARRAY))
OC_DECLARE (OC_MISC_CONFIG)
Expand Down
21 changes: 20 additions & 1 deletion Library/OcConfigurationLib/OcConfigurationLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ OC_ARRAY_STRUCTORS (OC_MISC_BLESS_ARRAY)
OC_STRUCTORS (OC_MISC_BOOT, ())
OC_STRUCTORS (OC_MISC_DEBUG, ())
OC_STRUCTORS (OC_MISC_SECURITY, ())
OC_STRUCTORS (OC_MISC_SERIAL, ())
OC_STRUCTORS (OC_MISC_TOOLS_ENTRY, ())
OC_ARRAY_STRUCTORS (OC_MISC_TOOLS_ARRAY)
OC_STRUCTORS (OC_MISC_CONFIG, ())
Expand Down Expand Up @@ -428,7 +429,6 @@ mMiscConfigurationDebugSchema[] = {
OC_SCHEMA_INTEGER_IN ("DisplayDelay", OC_GLOBAL_CONFIG, Misc.Debug.DisplayDelay),
OC_SCHEMA_INTEGER_IN ("DisplayLevel", OC_GLOBAL_CONFIG, Misc.Debug.DisplayLevel),
OC_SCHEMA_STRING_IN ("LogModules", OC_GLOBAL_CONFIG, Misc.Debug.LogModules),
OC_SCHEMA_BOOLEAN_IN ("SerialInit", OC_GLOBAL_CONFIG, Misc.Debug.SerialInit),
OC_SCHEMA_BOOLEAN_IN ("SysReport", OC_GLOBAL_CONFIG, Misc.Debug.SysReport),
OC_SCHEMA_INTEGER_IN ("Target", OC_GLOBAL_CONFIG, Misc.Debug.Target)
};
Expand All @@ -453,6 +453,24 @@ mMiscConfigurationSecuritySchema[] = {
OC_SCHEMA_STRING_IN ("Vault", OC_GLOBAL_CONFIG, Misc.Security.Vault),
};

STATIC
OC_SCHEMA
mMiscConfigurationSerialSchema[] = {
OC_SCHEMA_INTEGER_IN ("BaudRate", OC_GLOBAL_CONFIG, Misc.Serial.BaudRate),
OC_SCHEMA_INTEGER_IN ("ClockRate", OC_GLOBAL_CONFIG, Misc.Serial.ClockRate),
OC_SCHEMA_BOOLEAN_IN ("DetectCable", OC_GLOBAL_CONFIG, Misc.Serial.DetectCable),
OC_SCHEMA_INTEGER_IN ("ExtendedTxFifoSize", OC_GLOBAL_CONFIG, Misc.Serial.ExtendedTxFifoSize),
OC_SCHEMA_INTEGER_IN ("FifoControl", OC_GLOBAL_CONFIG, Misc.Serial.FifoControl),
OC_SCHEMA_BOOLEAN_IN ("Init", OC_GLOBAL_CONFIG, Misc.Serial.Init),
OC_SCHEMA_INTEGER_IN ("LineControl", OC_GLOBAL_CONFIG, Misc.Serial.LineControl),
OC_SCHEMA_DATA_IN ("PciDeviceInfo", OC_GLOBAL_CONFIG, Misc.Serial.PciDeviceInfo),
OC_SCHEMA_INTEGER_IN ("RegisterAccessWidth", OC_GLOBAL_CONFIG, Misc.Serial.RegisterAccessWidth),
OC_SCHEMA_INTEGER_IN ("RegisterBase", OC_GLOBAL_CONFIG, Misc.Serial.RegisterBase),
OC_SCHEMA_INTEGER_IN ("RegisterStride", OC_GLOBAL_CONFIG, Misc.Serial.RegisterStride),
OC_SCHEMA_BOOLEAN_IN ("UseHardwareFlowControl", OC_GLOBAL_CONFIG, Misc.Serial.UseHardwareFlowControl),
OC_SCHEMA_BOOLEAN_IN ("UseMmio", OC_GLOBAL_CONFIG, Misc.Serial.UseMmio),
};

STATIC
OC_SCHEMA
mMiscEntriesSchemaEntry[] = {
Expand Down Expand Up @@ -496,6 +514,7 @@ mMiscConfigurationSchema[] = {
OC_SCHEMA_DICT ("Debug", mMiscConfigurationDebugSchema),
OC_SCHEMA_ARRAY_IN ("Entries", OC_GLOBAL_CONFIG, Misc.Entries, &mMiscEntriesSchema),
OC_SCHEMA_DICT ("Security", mMiscConfigurationSecuritySchema),
OC_SCHEMA_DICT ("Serial", mMiscConfigurationSerialSchema),
OC_SCHEMA_ARRAY_IN ("Tools", OC_GLOBAL_CONFIG, Misc.Tools, &mMiscToolsSchema),
};

Expand Down
15 changes: 15 additions & 0 deletions Library/OcMainLib/OcMainLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
UefiCpuPkg/UefiCpuPkg.dec

[Guids]
gEfiMdeModulePkgTokenSpaceGuid
gOcVendorVariableGuid

[Protocols]
Expand All @@ -53,6 +54,20 @@
gEfiSecurityArchProtocolGuid ## SOMETIMES_CONSUMES
gEfiSecurity2ArchProtocolGuid ## SOMETIMES_CONSUMES

[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterAccessWidth ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialPciDeviceInfo ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## CONSUMES

[LibraryClasses]
DevicePathLib
IoLib
Expand Down
Loading