Intel Extensible Firmware Interface User Manual
Page 445

Protocols
— PCI Bus Support
Version 1.10
12/01/02
12-27
Description
The
CopyMem()
function enables a PCI driver to copy one region of PCI root bridge memory
space to another region of PCI root bridge memory space. This is especially useful for video scroll
operation on a memory mapped video buffer.
The memory operations are carried out exactly as requested. The caller is responsible for satisfying
any alignment and memory width restrictions that a PCI root bridge on a platform might require.
For example on some platforms, width requests of
EfiPciWidthUint64
do not work.
If
Width
is
EfiPciWidthUint8
,
EfiPciWidthUint16
,
EfiPciWidthUint32
, or
EfiPciWidthUint64
, then
Count
read/write transactions are performed to move the contents
of the
SrcAddress
buffer to the
DestAddress
buffer. The implementation must be reentrant,
and it must handle overlapping
SrcAddress
and
DestAddress
buffers. This means that the
implementation of
CopyMem()
must choose the correct direction of the copy operation based on
the type of overlap that exists between the
SrcAddress
and
DestAddress
buffers. If either
the
SrcAddress
buffer or the
DestAddress
buffer crosses the top of the processor’s address
space, then the result of the copy operation is unpredictable.
The contents of the
DestAddress
buffer on exit from this service must match the contents of the
SrcAddress
buffer on entry to this service. Due to potential overlaps, the contents of the
SrcAddress
buffer may be modified by this service. The following rules can be used to
guarantee the correct behavior:
1. If
DestAddress
>
SrcAddress
and
DestAddress
< (
SrcAddress
+
Width
size *
Count
), then the data should be copied from the
SrcAddress
buffer to the
DestAddress
buffer starting from the end of buffers and working toward the beginning of the buffers.
2. Otherwise, the data should be copied from the
SrcAddress
buffer to the
DestAddress
buffer starting from the beginning of the buffers and working toward the end of the buffers.
All the PCI transactions generated by this function are guaranteed to be completed before
this function returns. All the PCI write transactions generated by this function will follow the
write ordering and completion rules defined in the PCI Specification. However, if the memory-
mapped I/O region being accessed by this function has the
EFI_PCI_ATTRIBUTE_MEMORY_CACHED
attribute set, then the transactions will follow the
ordering rules defined by the processor architecture.
Status Codes Returned
EFI_SUCCESS
The data was copied from one memory region to another memory region.
EFI_INVALID_PARAMETER
Width
is invalid for this PCI root bridge.
EFI_OUT_OF_RESOURCES
The request could not be completed due to a lack of resources.