📄 sysalib.s
字号:
LOADPTR(r3,DBAT0L_VALUE) sync mtspr DBAT0L,r3 isync LOADPTR(r3,DBAT0U_VALUE) sync mtspr DBAT0U,r3 isync LOADPTR(r3,DBAT1L_VALUE) sync mtspr DBAT1L,r3 isync LOADPTR(r3,DBAT1U_VALUE) sync /* (PCI register space) */ mtspr DBAT1U,r3 isync LOADPTR(r3,DBAT2L_VALUE) sync mtspr DBAT2L,r3 isync LOADPTR(r3,DBAT2U_VALUE) sync mtspr DBAT2U,r3 isync LOADPTR(r3,DBAT3L_VALUE) isync mtspr DBAT3L,r3 isync LOADPTR(r3,DBAT3U_VALUE) isync mtspr DBAT3U,r3 isync blrFUNC_END(sysMinimumBATsInit)/*********************************************************************** General system Input/Output ASM Routines** If INCLUDE_C_IO_ROUTINES is not defined, then it is assumed these * routines are supplied in assembler code ( typically in sysALib.s ).**/#ifndef INCLUDE_C_IO_ROUTINES/******************************************************************************* sysInByte - reads a byte from an io address.** This function reads a byte from a specified io address.** SYNOPSIS* \ss* UCHAR sysInByte* (* ULONG address* )* \se** RETURNS: byte from address.*/FUNC_BEGIN(sysInByte) lbzx r4,r0,r3 /* Read byte from PCI space */ eieio /* Sync I/O operation */ or r3,r4,r4 /* Move data read to return register */ bclr 20,0 /* Return to caller */FUNC_END(sysInByte)/******************************************************************************** sysOutByte - writes a byte to an io address.** This function writes a byte to a specified io address.** SYNOPSIS* \ss* void sysOutByte* (* ULONG address* UCHAR data* )* \se** RETURNS: N/A*/FUNC_BEGIN(sysOutByte) stbx r4,r0,r3 /* Write a byte to PCI space */ eieio /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysOutByte)/******************************************************************************* sysInWord - reads a word from an address, swapping the bytes.** This function reads a swapped word from a specified * address.** SYNOPSIS* \ss* USHORT sysInWord* (* ULONG address* )* \se** RETURNS: swapped 16 bit data from the specified address.*/FUNC_BEGIN(sysInWord) lhbrx r4,r0,r3 /* Read and swap */ eieio /* Sync I/O operation */ sync or r3,r4,r4 /* Move data read to return register */ bclr 20,0 /* Return to caller */FUNC_END(sysInWord)/******************************************************************************* sysOutWord - writes a word to an address swapping the bytes.** This function writes a swapped word to a specified * address.** SYNOPSIS* \ss* void sysOutWord* (* ULONG address* USHORT data* )* \se** RETURNS: N/A*/FUNC_BEGIN(sysOutWord) sthbrx r4,r0,r3 /* Write with swap to address */ eieio /* Sync I/O operation */ sync bclr 20,0 /* Return to caller */FUNC_END(sysOutWord)/******************************************************************************* sysInLong - reads a long from an address.** This function reads a long from a specified PCI Config Space (little-endian)* address.** SYNOPSIS* \ss* ULONG sysInLong* (* ULONG address* )* \se** RETURNS: 32 bit data from the specified register. Note that for PCI systems* if no target responds, the data returned to the CPU will be 0xffffffff.*/FUNC_BEGIN(sysInLong) lwbrx r4,r0,r3 /* Read and swap from address */ eieio /* Sync I/O operation */ sync or r3,r4,r4 /* Move data read to return register */ bclr 20,0 /* Return to caller */FUNC_END(sysInLong)/******************************************************************************** sysOutLong - write a swapped long to address.** This routine will store a 32-bit data item (input as big-endian)* into an address in little-endian mode.** SYNOPSIS* \ss* void sysOutLong* (* ULONG address* ULONG data* )* \se** RETURNS: N/A*/FUNC_BEGIN(sysOutLong) stwbrx r4,r0,r3 /* store data as little-endian */ eieio /* Sync I/O operation */ sync bclr 20,0FUNC_END(sysOutLong)#endif /* INCLUDE_C_IO_ROUTINES *//********************************************************************************* sysMemProbeSup - sysBusProbe support routine** This routine is called to try to read byte, word, or long, as specified* by length, from the specified source to the specified destination.** SYNOPSIS* \ss* STATUS sysMemProbeSup* (* int length,* char * src,* char * dest* )* \se** RETURNS: OK if successful probe, else ERROR*/FUNC_BEGIN(sysMemProbeSup) addi p7, r4, 0 /* save length to p7 */ xor r4, r4, r4 /* set return status */ cmpwi p7, 1 /* check for byte access */ bne sbpShort /* no, go check for short word access */ lbz p6, 0(r3) /* load byte from source */ stb p6, 0(p2) /* store byte to destination */ isync /* enforce for immediate exception handling */ blrsbpShort: cmpwi p7, 2 /* check for short word access */ bne sbpWord /* no, check for word access */ lhz p6, 0(r3) /* load half word from source */ sth p6, 0(p2) /* store half word to destination */ isync /* enforce for immediate exception handling */ blrsbpWord: cmpwi p7, 4 /* check for short word access */ bne sysProbeExc /* no, check for double word access */ lwz p6, 0(r3) /* load half word from source */ stw p6, 0(p2) /* store half word to destination */ isync /* enforce for immediate exception handling */ blrsysProbeExc: li r4, -1 /* shouldn't ever get here, but... */ blrFUNC_END(sysMemProbeSup)/******************************************************************************** sysPciRead32 - read 32 bit PCI (I/O or memory) data** SYNOPSIS* \ss* void sysPciRead32* (* UINT32 *addr, /@ address of data in PCI space @/* UINT32 *pdata /@ pointer to data being returned @/* ) /@ by the read call ( data is converted @/* /@ to big-endian ) @/* \se** RETURNS: N/A*/FUNC_BEGIN(sysPciRead32) lwbrx r3,r0,r3 /* get the data and swap the bytes */ sync /* Sync I/O operation */ stw r3,0(r4) /* store into address ptd. to by r4 */ bclr 20,0 /* Return to caller */FUNC_END(sysPciRead32)/******************************************************************************** sysPciWrite32 - write a 32 bit data item to PCI space** SYNOPSIS* \ss* void sysPciWrite32* (* UINT32 *addr, /@ address to write data to @/* UINT32 data /@ 32-bit big-endian data @/* )* \se** RETURNS: N/A*/FUNC_BEGIN(sysPciWrite32) stwbrx r4,r0,r3 /* store data as little-endian */ sync /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysPciWrite32)/******************************************************************************* sysPciInByte - reads a byte from PCI Config Space.** SYNOPSIS* \ss* UCHAR sysPciInByte* (* UCHAR *addr /@ address to read data from @/* )* \se** RETURNS: byte from address.*/FUNC_BEGIN(sysPciInByte) lbzx r3,r0,r3 /* Read byte from PCI space */ sync /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysPciInByte)/******************************************************************************* sysPciInWord - reads a word (16-bit big-endian) from PCI Config Space.** SYNOPSIS* \ss* UINT16 sysPciInWord* (* UCHAR *addr /@ address to read data from @/* )* \se** RETURNS: word (16-bit big-endian) from address.*/FUNC_BEGIN(sysPciInWord) lhbrx r3,r0,r3 /* Read 16 bit byte reversed */ sync /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysPciInWord)/******************************************************************************* sysPciInLong - reads a long (32-bit big-endian) from PCI Config Space.** This function reads a long from a specified PCI Config Space (little-endian)* address.** SYNOPSIS* \ss* UINT32 sysPciInLong* (* UCHAR *addr /@ address to read data from @/* )* \se** RETURNS: long (32-bit big-endian) from address.*/FUNC_BEGIN(sysPciInLong) lwbrx r3,r0,r3 /* Read 32 bit byte reversed */ sync /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysPciInLong)/******************************************************************************** sysPciOutByte - writes a byte to PCI Config Space.** This function writes a byte to a specified PCI Config Space address.** SYNOPSIS* \ss* void sysPciOutByte* (* UCHAR *addr, /@ PCI config space address to write @/* UCHAR data /@ byte to write @/* )* \se** RETURNS: N/A*/FUNC_BEGIN(sysPciOutByte) stbx r4,r0,r3 /* Write a byte to PCI space */ sync /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysPciOutByte)/******************************************************************************** sysPciOutWord - writes a word (16-bit big-endian) to PCI Config Space.** This function writes a word to a specified PCI Config Space (little-endian)* address.** SYNOPSIS* \ss* void sysPciOutWord* (* UCHAR *addr, /@ PCI config space address to write @/* UINT16 data /@ word (16-bit big-endian) to write @/* )* \se** RETURNS: N/A*/FUNC_BEGIN(sysPciOutWord) sthbrx r4,r0,r3 /* Write byte-reversed 16 bit value */ sync /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysPciOutWord)/******************************************************************************** sysPciOutLong - writes a long (32-bit big-endian) to PCI Config Space.** SYNOPSIS* \ss* void sysPciOutByte* (* UCHAR *addr, /@ PCI config space address to write @/* UINT32 data /@ long (32-bit big-endian) to write @/* )* \se** RETURNS: N/A*/FUNC_BEGIN(sysPciOutLong) stwbrx r4,r0,r3 /* Write byte-reversed long */ sync /* Sync I/O operation */ bclr 20,0 /* Return to caller */FUNC_END(sysPciOutLong)#ifdef INCLUDE_CACHE_SUPPORT#include "sysACache.s"#include "sysCacheLockALib.s"#endif /* INCLUDE_CACHE_SUPPORT */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -