beautypg.com

Intel Extensible Firmware Interface User Manual

Page 494

background image

Extensible Firmware Interface Specification

12-76

12/01/02

Version 1.10

SrcBarIndex

The BAR index in the standard PCI Configuration header to use as
the base address for the memory operation to perform. This allows
all drivers to use BAR relative addressing. The legal range for this
field is 0..5. However, the value

EFI_PCI_IO_PASS_THROUGH_BAR

can be used to bypass the

BAR relative addressing and pass

Offset

to the PCI Root Bridge

I/O Protocol unchanged. Type

EFI_PCI_IO_PASS_THROUGH_BAR

is defined in Section 12.4.

SrcOffset

The source offset within the BAR specified by

SrcBarIndex

to

start the memory reads for the copy operation. The caller is
responsible for aligning the

SrcOffset

if required.

Count

The number of memory operations to perform. Bytes moved is

Width

size *

Count

, starting at

DestOffset

and

SrcOffset

.

Description

The

CopyMem()

function enables a PCI driver to copy one region of PCI memory space to

another region of PCI memory space on a PCI controller. This is especially useful for video scroll
operations 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 controller on a platform might require. For
example on some platforms, width requests of

EfiPciIoWidthUint64

do not work.

If

Width

is

EfiPciWidthUint8

,

EfiPciWidthUint16

,

EfiPciWidthUint32

, or

EfiPciWidthUint64

, then

Count

read/write transactions are performed to move the contents

of the

SrcOffset

buffer to the

DestOffset

buffer. The implementation must be reentrant,

and it must handle overlapping

SrcOffset

and

DestOffset

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

SrcOffset

and

DestOffset

buffers. If either the

SrcOffset

buffer or the

DestOffset

buffer crosses the top of the processor’s address space,

then the result of the copy operation is unpredictable.

The contents of the

DestOffset

buffer on exit from this service must match the contents of the

SrcOffset

buffer on entry to this service. Due to potential overlaps, the contents of the

SrcOffset

buffer may be modified by this service. The following rules can be used to guarantee

the correct behavior:

1. If

DestOffset

>

SrcOffset

and

DestOffset

< (

SrcOffset

+

Width

size *

Count

), then the data should be copied from the

SrcOffset

buffer to the

DestOffset

buffer starting from the end of buffers and working toward the beginning of the buffers.

2. Otherwise, the data should be copied from the

SrcOffset

buffer to the

DestOffset

buffer

starting from the beginning of the buffers and working toward the end of the buffers.