Figure9.16 patching routine, Patching routine – Avago Technologies LSI53C1010 User Manual
Page 236

9-38
SCRIPTS Programming Topics
Figure 9.16 Patching Routine
void main() {
ulong Int_Script_Phys_Addr;
ulong Ext_Script_Phys_Addr;
/* Get RAM physical address, which is assumed to be */
/* the internal SCRIPTS physical address */
outpw(ChipIOBase+CTEST2, regval | 0x08);/* Set bit 3 to get RAM Base in ScratchB*/
Int_Script_Phys_Addr = (ulong) ((ulong) (inpw(ChipBaseIO+
SCRATCHB2) << 16) | inpw(ChipIOBase+SCRATCHB));
/* Read Reg*/
outpw(ChipIOBase+CTEST5, 0x00);/* Clear bit 3 */
Ext_Script_Phys_Addr = (ulong) VirttoPhys(Ext_Script);
/* Patch External Script entries */
Ext_Script[E_Int_dataout_Used[0]] = Int_Script_Phys_Addr +
Ent_Int_dataout;
Ext_Script[E_Int_Start_Used[0]] = Int_Script_Phys_Addr + Ent_Int_Start;
/* Patch Internal SCRIPTS entries */
/* The cmd_buf, data_buf, identify_buf, stat_buf */
/* and msgin_buf should also be done but they will not be */
/* shown in this example as they are not pertinent */
Int_Script[E_Ext_done_Used[0]] = Ext_Script_Phys_Addr +
Ent_Ext_done;
Int_Script[E_Ext_Start_Used[0]] = Ext_Script_Phys_Addr +
Ent_Ext_Start;
}