2 Header file for PciSioSerial Driver
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #include <IndustryStandard/Pci.h>
16 #include <Protocol/SuperIo.h>
17 #include <Protocol/PciIo.h>
18 #include <Protocol/SerialIo.h>
19 #include <Protocol/DevicePath.h>
21 #include <Library/DebugLib.h>
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Library/UefiLib.h>
24 #include <Library/DevicePathLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/ReportStatusCodeLib.h>
29 #include <Library/PcdLib.h>
30 #include <Library/IoLib.h>
31 #include <Library/PrintLib.h>
34 // Driver Binding Externs
36 extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver
;
37 extern EFI_COMPONENT_NAME_PROTOCOL gPciSioSerialComponentName
;
38 extern EFI_COMPONENT_NAME2_PROTOCOL gPciSioSerialComponentName2
;
40 #define SIO_SERIAL_PORT_NAME L"SIO Serial Port #%d"
41 #define PCI_SERIAL_PORT_NAME L"PCI Serial Port #%d"
42 #define SERIAL_PORT_NAME_LEN (sizeof (SIO_SERIAL_PORT_NAME) / sizeof (CHAR16) + MAXIMUM_VALUE_CHARACTERS)
45 // Internal Data Structures
47 #define TIMEOUT_STALL_INTERVAL 10
51 /// PcdPciSerialParameters contains zero or more instances of the below structure.
52 /// If a PCI device contains multiple UARTs, PcdPciSerialParameters needs to contain
53 /// two instances of the below structure, with the VendorId and DeviceId equals to the
54 /// device ID and vendor ID of the device. If the PCI device uses the first two BARs
55 /// to support multiple UARTs, BarIndex of first instance equals to 0 and BarIndex of
56 /// second one equals to 1; if the PCI device uses the first BAR to support multiple
57 /// UARTs, BarIndex of both instance equals to 0 and Offset of first instance equals
58 /// to 0 while Offset of second one equals to some value bigger or equal to 8.
59 /// For certain UART whose register needs to be accessed in DWORD aligned address,
60 /// RegisterStride equals to 4.
63 UINT16 VendorId
; ///< Vendor ID to match the PCI device. The value 0xFFFF terminates the list of entries.
64 UINT16 DeviceId
; ///< Device ID to match the PCI device
65 UINT32 ClockRate
; ///< UART clock rate. Set to 0 for default clock rate of 1843200 Hz
66 UINT64 Offset
; ///< The byte offset into to the BAR
67 UINT8 BarIndex
; ///< Which BAR to get the UART base address
68 UINT8 RegisterStride
; ///< UART register stride in bytes. Set to 0 for default register stride of 1 byte.
69 UINT16 ReceiveFifoDepth
; ///< UART receive FIFO depth in bytes. Set to 0 for a default FIFO depth of 16 bytes.
70 UINT16 TransmitFifoDepth
; ///< UART transmit FIFO depth in bytes. Set to 0 for a default FIFO depth of 16 bytes.
72 } PCI_SERIAL_PARAMETER
;
75 #define SERIAL_MAX_FIFO_SIZE 17 ///< Actual FIFO size is 16. FIFO based on circular wastes one unit.
77 UINT16 Head
; ///< Head pointer of the FIFO. Empty when (Head == Tail).
78 UINT16 Tail
; ///< Tail pointer of the FIFO. Full when ((Tail + 1) % SERIAL_MAX_FIFO_SIZE == Head).
79 UINT8 Data
[SERIAL_MAX_FIFO_SIZE
]; ///< Store the FIFO data.
83 EFI_PCI_IO_PROTOCOL
*PciIo
;
84 EFI_SIO_PROTOCOL
*Sio
;
85 } PARENT_IO_PROTOCOL_PTR
;
88 EFI_PCI_IO_PROTOCOL
*PciIo
; // Pointer to parent PciIo instance.
89 UINTN ChildCount
; // Count of child SerialIo instance.
90 UINT64 PciAttributes
; // Original PCI attributes.
96 EFI_SERIAL_IO_PROTOCOL SerialIo
;
97 EFI_SERIAL_IO_MODE SerialMode
;
98 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
100 EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
;
101 UART_DEVICE_PATH UartDevicePath
;
103 EFI_PHYSICAL_ADDRESS BaseAddress
; ///< UART base address
104 BOOLEAN MmioAccess
; ///< TRUE for MMIO, FALSE for IO
105 UINT8 RegisterStride
; ///< UART Register Stride
106 UINT32 ClockRate
; ///< UART clock rate
108 UINT16 ReceiveFifoDepth
; ///< UART receive FIFO depth in bytes.
109 SERIAL_DEV_FIFO Receive
; ///< The FIFO used to store received data
111 UINT16 TransmitFifoDepth
; ///< UART transmit FIFO depth in bytes.
112 SERIAL_DEV_FIFO Transmit
; ///< The FIFO used to store to-transmit data
114 BOOLEAN SoftwareLoopbackEnable
;
115 BOOLEAN HardwareFlowControl
;
116 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
117 BOOLEAN ContainsControllerNode
; ///< TRUE if the device produced contains Controller node
119 PCI_DEVICE_INFO
*PciDeviceInfo
;
122 #define SERIAL_DEV_SIGNATURE SIGNATURE_32 ('s', 'e', 'r', 'd')
123 #define SERIAL_DEV_FROM_THIS(a) CR (a, SERIAL_DEV, SerialIo, SERIAL_DEV_SIGNATURE)
126 // Serial Driver Defaults
128 #define SERIAL_PORT_DEFAULT_TIMEOUT 1000000
129 #define SERIAL_PORT_SUPPORT_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
130 EFI_SERIAL_DATA_SET_READY | \
131 EFI_SERIAL_RING_INDICATE | \
132 EFI_SERIAL_CARRIER_DETECT | \
133 EFI_SERIAL_REQUEST_TO_SEND | \
134 EFI_SERIAL_DATA_TERMINAL_READY | \
135 EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | \
136 EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE | \
137 EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE | \
138 EFI_SERIAL_OUTPUT_BUFFER_EMPTY | \
139 EFI_SERIAL_INPUT_BUFFER_EMPTY)
141 #define SERIAL_PORT_MIN_TIMEOUT 1 // 1 uS
142 #define SERIAL_PORT_MAX_TIMEOUT 100000000 // 100 seconds
146 #define SERIAL_REGISTER_THR 0 ///< WO Transmit Holding Register
147 #define SERIAL_REGISTER_RBR 0 ///< RO Receive Buffer Register
148 #define SERIAL_REGISTER_DLL 0 ///< R/W Divisor Latch LSB
149 #define SERIAL_REGISTER_DLM 1 ///< R/W Divisor Latch MSB
150 #define SERIAL_REGISTER_IER 1 ///< R/W Interrupt Enable Register
151 #define SERIAL_REGISTER_IIR 2 ///< RO Interrupt Identification Register
152 #define SERIAL_REGISTER_FCR 2 ///< WO FIFO Cotrol Register
153 #define SERIAL_REGISTER_LCR 3 ///< R/W Line Control Register
154 #define SERIAL_REGISTER_MCR 4 ///< R/W Modem Control Register
155 #define SERIAL_REGISTER_LSR 5 ///< R/W Line Status Register
156 #define SERIAL_REGISTER_MSR 6 ///< R/W Modem Status Register
157 #define SERIAL_REGISTER_SCR 7 ///< R/W Scratch Pad Register
161 /// Interrupt Enable Register
165 UINT8 Ravie
: 1; ///< Receiver Data Available Interrupt Enable
166 UINT8 Theie
: 1; ///< Transmistter Holding Register Empty Interrupt Enable
167 UINT8 Rie
: 1; ///< Receiver Interrupt Enable
168 UINT8 Mie
: 1; ///< Modem Interrupt Enable
175 /// FIFO Control Register
179 UINT8 TrFIFOE
: 1; ///< Transmit and Receive FIFO Enable
180 UINT8 ResetRF
: 1; ///< Reset Reciever FIFO
181 UINT8 ResetTF
: 1; ///< Reset Transmistter FIFO
182 UINT8 Dms
: 1; ///< DMA Mode Select
184 UINT8 TrFIFO64
: 1; ///< Enable 64 byte FIFO
185 UINT8 Rtb
: 2; ///< Receive Trigger Bits
191 /// Line Control Register
195 UINT8 SerialDB
: 2; ///< Number of Serial Data Bits
196 UINT8 StopB
: 1; ///< Number of Stop Bits
197 UINT8 ParEn
: 1; ///< Parity Enable
198 UINT8 EvenPar
: 1; ///< Even Parity Select
199 UINT8 SticPar
: 1; ///< Sticky Parity
200 UINT8 BrCon
: 1; ///< Break Control
201 UINT8 DLab
: 1; ///< Divisor Latch Access Bit
207 /// Modem Control Register
211 UINT8 DtrC
: 1; ///< Data Terminal Ready Control
212 UINT8 Rts
: 1; ///< Request To Send Control
213 UINT8 Out1
: 1; ///< Output1
214 UINT8 Out2
: 1; ///< Output2, used to disable interrupt
215 UINT8 Lme
: 1; ///< Loopback Mode Enable
222 /// Line Status Register
226 UINT8 Dr
: 1; ///< Receiver Data Ready Status
227 UINT8 Oe
: 1; ///< Overrun Error Status
228 UINT8 Pe
: 1; ///< Parity Error Status
229 UINT8 Fe
: 1; ///< Framing Error Status
230 UINT8 Bi
: 1; ///< Break Interrupt Status
231 UINT8 Thre
: 1; ///< Transmistter Holding Register Status
232 UINT8 Temt
: 1; ///< Transmitter Empty Status
233 UINT8 FIFOe
: 1; ///< FIFO Error Status
239 /// Modem Status Register
243 UINT8 DeltaCTS
: 1; ///< Delta Clear To Send Status
244 UINT8 DeltaDSR
: 1; ///< Delta Data Set Ready Status
245 UINT8 TrailingEdgeRI
: 1; ///< Trailing Edge of Ring Indicator Status
246 UINT8 DeltaDCD
: 1; ///< Delta Data Carrier Detect Status
247 UINT8 Cts
: 1; ///< Clear To Send Status
248 UINT8 Dsr
: 1; ///< Data Set Ready Status
249 UINT8 Ri
: 1; ///< Ring Indicator Status
250 UINT8 Dcd
: 1; ///< Data Carrier Detect Status
257 // Define serial register I/O macros
259 #define READ_RBR(S) SerialReadRegister (S, SERIAL_REGISTER_RBR)
260 #define READ_DLL(S) SerialReadRegister (S, SERIAL_REGISTER_DLL)
261 #define READ_DLM(S) SerialReadRegister (S, SERIAL_REGISTER_DLM)
262 #define READ_IER(S) SerialReadRegister (S, SERIAL_REGISTER_IER)
263 #define READ_IIR(S) SerialReadRegister (S, SERIAL_REGISTER_IIR)
264 #define READ_LCR(S) SerialReadRegister (S, SERIAL_REGISTER_LCR)
265 #define READ_MCR(S) SerialReadRegister (S, SERIAL_REGISTER_MCR)
266 #define READ_LSR(S) SerialReadRegister (S, SERIAL_REGISTER_LSR)
267 #define READ_MSR(S) SerialReadRegister (S, SERIAL_REGISTER_MSR)
268 #define READ_SCR(S) SerialReadRegister (S, SERIAL_REGISTER_SCR)
270 #define WRITE_THR(S, D) SerialWriteRegister (S, SERIAL_REGISTER_THR, D)
271 #define WRITE_DLL(S, D) SerialWriteRegister (S, SERIAL_REGISTER_DLL, D)
272 #define WRITE_DLM(S, D) SerialWriteRegister (S, SERIAL_REGISTER_DLM, D)
273 #define WRITE_IER(S, D) SerialWriteRegister (S, SERIAL_REGISTER_IER, D)
274 #define WRITE_FCR(S, D) SerialWriteRegister (S, SERIAL_REGISTER_FCR, D)
275 #define WRITE_LCR(S, D) SerialWriteRegister (S, SERIAL_REGISTER_LCR, D)
276 #define WRITE_MCR(S, D) SerialWriteRegister (S, SERIAL_REGISTER_MCR, D)
277 #define WRITE_LSR(S, D) SerialWriteRegister (S, SERIAL_REGISTER_LSR, D)
278 #define WRITE_MSR(S, D) SerialWriteRegister (S, SERIAL_REGISTER_MSR, D)
279 #define WRITE_SCR(S, D) SerialWriteRegister (S, SERIAL_REGISTER_SCR, D)
283 // Driver model protocol interface
287 Check to see if this driver supports the given controller
289 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
290 @param Controller The handle of the controller to test.
291 @param RemainingDevicePath A pointer to the remaining portion of a device path.
293 @return EFI_SUCCESS This driver can support the given controller
298 SerialControllerDriverSupported (
299 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
300 IN EFI_HANDLE Controller
,
301 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
305 Start to management the controller passed in
307 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
308 @param Controller The handle of the controller to test.
309 @param RemainingDevicePath A pointer to the remaining portion of a device path.
311 @return EFI_SUCCESS Driver is started successfully
315 SerialControllerDriverStart (
316 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
317 IN EFI_HANDLE Controller
,
318 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
322 Disconnect this driver with the controller, uninstall related protocol instance
324 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
325 @param Controller The handle of the controller to test.
326 @param NumberOfChildren Number of child device.
327 @param ChildHandleBuffer A pointer to the remaining portion of a device path.
329 @retval EFI_SUCCESS Operation successfully
330 @retval EFI_DEVICE_ERROR Cannot stop the driver successfully
335 SerialControllerDriverStop (
336 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
337 IN EFI_HANDLE Controller
,
338 IN UINTN NumberOfChildren
,
339 IN EFI_HANDLE
*ChildHandleBuffer
343 // Serial I/O Protocol Interface
349 @param This Pointer to EFI_SERIAL_IO_PROTOCOL
351 @retval EFI_SUCCESS Reset successfully
352 @retval EFI_DEVICE_ERROR Failed to reset
358 IN EFI_SERIAL_IO_PROTOCOL
*This
362 Set new attributes to a serial device.
364 @param This Pointer to EFI_SERIAL_IO_PROTOCOL
365 @param BaudRate The baudrate of the serial device
366 @param ReceiveFifoDepth The depth of receive FIFO buffer
367 @param Timeout The request timeout for a single char
368 @param Parity The type of parity used in serial device
369 @param DataBits Number of databits used in serial device
370 @param StopBits Number of stopbits used in serial device
372 @retval EFI_SUCCESS The new attributes were set
373 @retval EFI_INVALID_PARAMETERS One or more attributes have an unsupported value
374 @retval EFI_UNSUPPORTED Data Bits can not set to 5 or 6
375 @retval EFI_DEVICE_ERROR The serial device is not functioning correctly (no return)
380 SerialSetAttributes (
381 IN EFI_SERIAL_IO_PROTOCOL
*This
,
383 IN UINT32 ReceiveFifoDepth
,
385 IN EFI_PARITY_TYPE Parity
,
387 IN EFI_STOP_BITS_TYPE StopBits
393 @param This Pointer to EFI_SERIAL_IO_PROTOCOL
394 @param Control Control bits that can be settable
396 @retval EFI_SUCCESS New Control bits were set successfully
397 @retval EFI_UNSUPPORTED The Control bits wanted to set are not supported
403 IN EFI_SERIAL_IO_PROTOCOL
*This
,
410 @param This Pointer to EFI_SERIAL_IO_PROTOCOL
411 @param Control Control signals of the serial device
413 @retval EFI_SUCCESS Get Control signals successfully
419 IN EFI_SERIAL_IO_PROTOCOL
*This
,
424 Write the specified number of bytes to serial device.
426 @param This Pointer to EFI_SERIAL_IO_PROTOCOL
427 @param BufferSize On input the size of Buffer, on output the amount of
428 data actually written
429 @param Buffer The buffer of data to write
431 @retval EFI_SUCCESS The data were written successfully
432 @retval EFI_DEVICE_ERROR The device reported an error
433 @retval EFI_TIMEOUT The write operation was stopped due to timeout
439 IN EFI_SERIAL_IO_PROTOCOL
*This
,
440 IN OUT UINTN
*BufferSize
,
445 Read the specified number of bytes from serial device.
447 @param This Pointer to EFI_SERIAL_IO_PROTOCOL
448 @param BufferSize On input the size of Buffer, on output the amount of
449 data returned in buffer
450 @param Buffer The buffer to return the data into
452 @retval EFI_SUCCESS The data were read successfully
453 @retval EFI_DEVICE_ERROR The device reported an error
454 @retval EFI_TIMEOUT The read operation was stopped due to timeout
460 IN EFI_SERIAL_IO_PROTOCOL
*This
,
461 IN OUT UINTN
*BufferSize
,
466 // Internal Functions
470 Use scratchpad register to test if this serial port is present.
472 @param SerialDevice Pointer to serial device structure
474 @return if this serial port is present
478 IN SERIAL_DEV
*SerialDevice
482 Detect whether specific FIFO is full or not.
484 @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
486 @return whether specific FIFO is full or not
491 IN SERIAL_DEV_FIFO
*Fifo
495 Detect whether specific FIFO is empty or not.
497 @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
499 @return whether specific FIFO is empty or not
504 IN SERIAL_DEV_FIFO
*Fifo
508 Add data to specific FIFO.
510 @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
511 @param Data the data added to FIFO
513 @retval EFI_SUCCESS Add data to specific FIFO successfully
514 @retval EFI_OUT_OF_RESOURCE Failed to add data because FIFO is already full
519 IN SERIAL_DEV_FIFO
*Fifo
,
524 Remove data from specific FIFO.
526 @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
527 @param Data the data removed from FIFO
529 @retval EFI_SUCCESS Remove data from specific FIFO successfully
530 @retval EFI_OUT_OF_RESOURCE Failed to remove data because FIFO is empty
535 IN SERIAL_DEV_FIFO
*Fifo
,
540 Reads and writes all available data.
542 @param SerialDevice The device to flush
544 @retval EFI_SUCCESS Data was read/written successfully.
545 @retval EFI_OUT_OF_RESOURCE Failed because software receive FIFO is full. Note, when
546 this happens, pending writes are not done.
550 SerialReceiveTransmit (
551 IN SERIAL_DEV
*SerialDevice
557 @param SerialDev Pointer to serial device
558 @param Offset Offset in register group
560 @return Data read from serial port
564 IN SERIAL_DEV
*SerialDev
,
571 @param SerialDev Pointer to serial device
572 @param Offset Offset in register group
573 @param Data data which is to be written to some serial port register
576 SerialWriteRegister (
577 IN SERIAL_DEV
*SerialDev
,
583 // EFI Component Name Functions
587 Retrieves a Unicode string that is the user readable name of the driver.
589 This function retrieves the user readable name of a driver in the form of a
590 Unicode string. If the driver specified by This has a user readable name in
591 the language specified by Language, then a pointer to the driver name is
592 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
593 by This does not support the language specified by Language,
594 then EFI_UNSUPPORTED is returned.
596 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
597 EFI_COMPONENT_NAME_PROTOCOL instance.
599 @param Language[in] A pointer to a Null-terminated ASCII string
600 array indicating the language. This is the
601 language of the driver name that the caller is
602 requesting, and it must match one of the
603 languages specified in SupportedLanguages. The
604 number of languages supported by a driver is up
605 to the driver writer. Language is specified
606 in RFC 4646 or ISO 639-2 language code format.
608 @param DriverName[out] A pointer to the Unicode string to return.
609 This Unicode string is the name of the
610 driver specified by This in the language
611 specified by Language.
613 @retval EFI_SUCCESS The Unicode string for the Driver specified by
614 This and the language specified by Language was
615 returned in DriverName.
617 @retval EFI_INVALID_PARAMETER Language is NULL.
619 @retval EFI_INVALID_PARAMETER DriverName is NULL.
621 @retval EFI_UNSUPPORTED The driver specified by This does not support
622 the language specified by Language.
627 SerialComponentNameGetDriverName (
628 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
630 OUT CHAR16
**DriverName
634 Retrieves a Unicode string that is the user readable name of the controller
635 that is being managed by a driver.
637 This function retrieves the user readable name of the controller specified by
638 ControllerHandle and ChildHandle in the form of a Unicode string. If the
639 driver specified by This has a user readable name in the language specified by
640 Language, then a pointer to the controller name is returned in ControllerName,
641 and EFI_SUCCESS is returned. If the driver specified by This is not currently
642 managing the controller specified by ControllerHandle and ChildHandle,
643 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
644 support the language specified by Language, then EFI_UNSUPPORTED is returned.
646 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
647 EFI_COMPONENT_NAME_PROTOCOL instance.
649 @param ControllerHandle[in] The handle of a controller that the driver
650 specified by This is managing. This handle
651 specifies the controller whose name is to be
654 @param ChildHandle[in] The handle of the child controller to retrieve
655 the name of. This is an optional parameter that
656 may be NULL. It will be NULL for device
657 drivers. It will also be NULL for a bus drivers
658 that wish to retrieve the name of the bus
659 controller. It will not be NULL for a bus
660 driver that wishes to retrieve the name of a
663 @param Language[in] A pointer to a Null-terminated ASCII string
664 array indicating the language. This is the
665 language of the driver name that the caller is
666 requesting, and it must match one of the
667 languages specified in SupportedLanguages. The
668 number of languages supported by a driver is up
669 to the driver writer. Language is specified in
670 RFC 4646 or ISO 639-2 language code format.
672 @param ControllerName[out] A pointer to the Unicode string to return.
673 This Unicode string is the name of the
674 controller specified by ControllerHandle and
675 ChildHandle in the language specified by
676 Language from the point of view of the driver
679 @retval EFI_SUCCESS The Unicode string for the user readable name in
680 the language specified by Language for the
681 driver specified by This was returned in
684 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
686 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
689 @retval EFI_INVALID_PARAMETER Language is NULL.
691 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
693 @retval EFI_UNSUPPORTED The driver specified by This is not currently
694 managing the controller specified by
695 ControllerHandle and ChildHandle.
697 @retval EFI_UNSUPPORTED The driver specified by This does not support
698 the language specified by Language.
703 SerialComponentNameGetControllerName (
704 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
705 IN EFI_HANDLE ControllerHandle
,
706 IN EFI_HANDLE ChildHandle OPTIONAL
,
708 OUT CHAR16
**ControllerName
712 Add the component name for the serial io device
714 @param SerialDevice A pointer to the SERIAL_DEV instance.
715 @param Uid Unique ID for the serial device.
719 IN SERIAL_DEV
*SerialDevice
,
724 Checks whether the UART parameters are valid and computes the Divisor.
726 @param ClockRate The clock rate of the serial device used to verify
727 the BaudRate. Do not verify the BaudRate if it's 0.
728 @param BaudRate The requested baudrate of the serial device.
729 @param DataBits Number of databits used in serial device.
730 @param Parity The type of parity used in serial device.
731 @param StopBits Number of stopbits used in serial device.
732 @param Divisor Return the divisor if ClockRate is not 0.
733 @param ActualBaudRate Return the actual supported baudrate without
734 exceeding BaudRate. NULL means baudrate degradation
736 If the requested BaudRate is not supported, the routine
737 returns TRUE and the Actual Baud Rate when ActualBaudRate
738 is not NULL, returns FALSE when ActualBaudRate is NULL.
740 @retval TRUE The UART parameters are valid.
741 @retval FALSE The UART parameters are not valid.
744 VerifyUartParameters (
748 IN EFI_PARITY_TYPE Parity
,
749 IN EFI_STOP_BITS_TYPE StopBits
,
751 OUT UINT64
*ActualBaudRate
755 Skip the optional Controller device path node and return the
756 pointer to the next device path node.
758 @param DevicePath Pointer to the device path.
759 @param ContainsControllerNode Returns TRUE if the Controller device path exists.
760 @param ControllerNumber Returns the Controller Number if Controller device path exists.
762 @return Pointer to the next device path node.
765 SkipControllerDevicePathNode (
766 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
767 BOOLEAN
*ContainsControllerNode
,
768 UINT32
*ControllerNumber
772 Check the device path node whether it's the Flow Control node or not.
774 @param[in] FlowControl The device path node to be checked.
776 @retval TRUE It's the Flow Control node.
777 @retval FALSE It's not.
781 IsUartFlowControlDevicePathNode (
782 IN UART_FLOW_CONTROL_DEVICE_PATH
*FlowControl