beautypg.com

Avago Technologies LSI53C1010 User Manual

Page 214

background image

9-16

SCRIPTS Programming Topics

static void HandleDataInPM(ULONG PCIDeviceIOBase, INT\ *Current_SG_Entry)
{

ULONG Current_DSP; /* Holds current DSP value */
/* where am I in the SG list? */
Current_DSP = IORead32(PCIDeviceIOBase+DSP) - 8;
*Current_SG_Entry = (VINT) (Current_DSP -\ FirstDIMove_paddr) / 8;
/* On Data In phase mismatch interrupts the part is automatically flushed so there

is no need to check for residual data in the part, except for data in the SWIDE byte*/

/* now update the address and count */
dsa_table[DATA_BUF1 + *Current_SG_Entry].address +=

dsa_table[DATA_BUF1 + *Current_SG_Entry].count -
(IORead32(PCIDeviceIOBase+DBC) & 0x00FFFFFFl);

dsa_table[DATA_BUF1 + *Current_SG_Entry].count =

IORead32(PCIDeviceIOBase+DBC) & 0x00FFFFFFl;

/* update the jump offset into the SG list */
script[(INT) (Ent_RW_Offset_patch_di/4) + 1] =

(ULONG) *Current_SG_Entry * 8;

/* move the byte in SWIDE if necessary */
if (IORead8(PCIDeviceIOBase+SCNTL2) & 0x01)
{

/* patch move to get byte out of chip */
script[(INT) E_RW_Last_di_byte_buf_Used[0]] =

buffer_table[DATA_BUF1 +
*Current_SG_Entry].address;

/* start script to move byte */
iowrite32(PCIDeviceIOBase+DSP,

getPhysAddr(rw_script) +
Ent_RW_Move_swide_byte);

}
else

/* nothing in swide so start the disconnect

/*script */

iowrite32(PCIDeviceIOBase+DSP,

getPhysAddr(rw_script) + Ent_RW_Handle_Phase);

}

Figure 9.9

Example Function for Handling DATA OUT Phase Mismatch Interrupts

/***********************************************************

Function: HandleDataOutPM

Purpose: To handle clean up after a Phase Mismatch (PM) during Data Out phase
Input: A pointer the pcidev_record.
Output: None
Assumptions: That a phase mismatch has actually

occurred during data out.

Restrictions: None
Other functions called:IORead32/8 to read chip info

RMWon to set bits in chip registers
iowrite32 to start the script

Global Variables Used:FirstDOMove_paddr is the

physical address of the first Data
Out block move in the scatter/gather
list. This is needed to get the
location of the scatter/gather entry

This manual is related to the following products: