22.4.4 Write() and Read() Implementation

The Write() and Read() functions are used to write bytes out to the serial device or read in from the serial device. The only two parameters that are passed are the number of bytes and then either the buffer to write out or a buffer to read the bytes into. The amount of time that this can take is determined by the timeout value in the Mode structure (as set by SetAttributes()).
Some serial devices support FIFOs. At the time the Write() service is called, the FIFO could be full which means the entire FIFO may need to flush before any new characters can be added to the FIFO. In this case, the time that a UEFI Driver may be required to wait may be longer that the time specified by the TimeOut value in the Mode structure. The caller is not aware of the FIFO depth, so it is not correct to return an EFI_TIMEOUT error if the timeout is due to a full FIFO. Instead, the UEFI Driver should detect the FIFO depth if possible and wait to that number of character times.