📄 sysalib.s
字号:
* void sysOutWord (UINT16 * dataPtr,UINT16 data)*/sysOutWord: /* Write a word to address */ sthx r4,r0,r3 /* Sync I/O operation */ sync /* Return to caller */ bclr 20,0/******************************************************************************* sysPciInWord - reads a word from PCI I/O or Memory space** This function reads a word from a specified PCI I/O or Memory address* via the PCI bridge chip. This function should be used for access* to the I/O or Memory mapped registers of a PCI device. These* registers are mapped as little-endian,so we byte swap the data in order* to make the value returned look the same as it would in PCI space.** RETURNS: word from address.** UINT16 sysPciInWord (UINT16 * dataPtr)*/sysPciInWord: /* Read word from address */ lhbrx r3,r0,r3 /* Return to caller */ bclr 20,0/******************************************************************************* sysPciOutWord - writes a word to PCI I/O or Memory space** This function writes a word to a specified PCI I/O or Memory address* via the PCI bridge chip. This function should be used for access* to the I/O or Memory mapped registers of a PCI device. These* registers are mapped as little-endian,so we byte swap the data in order* to make the value written correct for the registers in PCI space.** RETURNS: N/A** void sysPciOutWord (UINT16 * dataPtr,UINT16 data)*/sysPciOutWord: /* Write a word to the address */ sthbrx r4,r0,r3 /* Sync I/O operation */ sync /* Return to caller */ bclr 20,0/******************************************************************************* sysInLong - reads a long (32-bit big-endian) from an io address.** This function reads a long from a specified io address or from local memory.* It operates in big-endian mode and does not perform any translation* operations on either the supplied address or the retrieved data.** RETURNS: long (32-bit big-endian) from address** UINT32 sysInLong ( UINT32 * dataPtr)*/sysInLong: /* Read long from address */ lwzx r3,r0,r3 /* Return to caller */ bclr 20,0/******************************************************************************** sysOutLong - writes a long (32-bit big-endian) to an io address.** This function writes a long to a specified io address or to local memory.* It operates in big-endian mode and does not perform any translation* operations on either the supplied address or data.* This function writes a long to a specified io address.** RETURNS: N/A** void sysOutLong (UINT32 * dataPtr,UINT32 data)*/sysOutLong: /* Write a long to address */ stwx r4,r0,r3 /* Sync I/O operation */ sync /* Return to caller */ bclr 20,0/******************************************************************************* sysPciInLong - reads a longword from PCI I/O or Memory space** This function reads a longword from a specified PCI I/O or Memory address* via the PCI bridge chip. This function should be used for access* to the I/O or Memory mapped registers of a PCI device. These* registers are mapped as little-endian,so we byte reverse the data in order* to make the value returned look the same as it would in PCI space.** RETURNS: longword from address.** UINT32 sysPciInLong (UINT32 * dataPtr)*/sysPciInLong: /* Read a longword from the address,and reverse the bytes */ lwbrx r3,r0,r3 /* Return to caller */ bclr 20,0/******************************************************************************* sysPciOutLong - writes a longword to PCI I/O or Memory space** This function writes a longword to a specified PCI I/O or Memory address* via the PCI bridge chip. This function should be used for access* to the I/O or Memory mapped registers of a PCI device. These* registers are mapped as little-endian,so we byte reverse the data in order* to make the value written correct for the registers in PCI space.** RETURNS: N/A** void sysPciOutLong (UINT32 * dataPtr,UINT32 data)*/sysPciOutLong: /* Write a long to the address,reversing the bytes */ stwbrx r4,r0,r3 /* Sync I/O operation */ sync /* Return to caller */ bclr 20,0/********************************************************************************* 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.** RETURNS: OK if successful probe,else ERRORSTATUS sysMemProbeSup (length,src,dest) ( int length,// length of cell to test (1,2,4,8,16) * char * src,// address to read * char * dest // address to write * )*/sysMemProbeSup: addi p7,p0,0 /* save length to p7 */ xor p0,p0,p0 /* set return status */ cmpwi p7,1 /* check for byte access */ bne sbpShort /* no,go check for short word access */ lbz p6,0(p1) /* load byte from source */ stb p6,0(p2) /* store byte to destination */ sync 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(p1) /* load half word from source */ sth p6,0(p2) /* store half word to destination */ sync 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(p1) /* load half word from source */ stw p6,0(p2) /* store half word to destination */ sync isync /* enforce for immediate exception handling */ blrsysProbeExc: li p0,-1 /* shouldn't ever get here,but... */ blr/******************************************************************************** sysTimeBaseLGet - Get lower half of Time Base Register** This routine will read the contents the lower half of the Time* Base Register (TBL - TBR 268).** From a C point of view,the routine is defined as follows:** UINT32 sysTimeBaseLGet(void)** RETURNS: value of TBR 268 (in r3)*/sysTimeBaseLGet: mftb 3 bclr 20,0/********************************************************************************* sysL2crPut - write to L2CR register of Arthur CPU** This routine will write the contents of r3 to the L2CR* register.* )* From a C point of view,the routine is defined as follows:** void sysL2crPut* (* ULONG value to write* )** RETURNS: NA*/sysL2crPut: mtspr 1017,r3 bclr 20,0 /* Return to caller *//********************************************************************************* sysL2crGet - read from L2CR register of Arthur CPU** This routine will read the contents the L2CR register.** From a C point of view,the routine is defined as follows:** UINT sysL2crGet()** RETURNS: value of SPR1017 (in r3)*/sysL2crGet: mfspr r3,1017 bclr 20,0 /* Return to caller *//******************************************************************************** sysHid1Get - read from HID1 register SPR1009.** This routine will return the contents of the HID1 (SPR1009)** From a C point of view,the routine is defined as follows:** UINT sysHid1Get()** RETURNS: value of SPR1009 (in r3)*/sysHid1Get: mfspr r3,1009 bclr 20,0/******************************************************************************** sysHid2Get - read from HID2 register SPR1011.** This routine will return the contents of the HID2 (SPR1011)** From a C point of view,the routine is defined as follows:** UINT sysHid2Get()** RETURNS: value of SPR1011 (in r3)*/sysHid2Get: mfspr r3,1011 bclr 20,0/******************************************************************************** sysHid2Set - write data to HID2 register SPR1011.** This routine will store the contents of HID2 (SPR1011) with the data* supplied in R3.** From a C point of view,the routine is defined as follows:** UINT sysHid2Set(UINT dataValue)** RETURNS: N/A*/sysHid2Set: mtspr 1011,r3 bclr 20,0/******************************************************************************** maxErrata - apply relevant errata workarounds for Max processor.** RETURNS: N/A*/maxErrata: /* Get the MAX revision type. If 2.7 or less apply errata fix. */ mfspr r29,PVR rlwinm r29,r29,0,24,31 cmpwi r29,7 bc 12,5,cpuNotMax27 /* branch if greater than 7 */ /* * The following five instructions is a workaround for errata #13 * as described in "PowerPC Max Microprocessor Errata List Release * 2.x Chips", Errata Version 9 6/27/00. Description: "Speculative * instruction stream may cause duplicate data cache tags". */ li r2,0x0 mtspr 1014,r2 /* MSSCR0 */ lis r2,HI(MEMSSCR1) ori r2,r2,LO(MEMSSCR1) /* MSSCR1: L1OPQ_SIZE=0x01000000 */ mtspr 1015,r2 /* * The following five instructions is a workaround for errata #7 * as described in "PowerPC Max Microprocessor Errata List Release * 2.x Chips",Errata Version 9 6/27/00. Description: "Store data * lost when store gathering is enabled during cache ops". */ mfspr r2,HID0 lis r3,HI(SGE_CLEAR) /* SGE: clear */ ori r3,r3,LO(SGE_CLEAR) andc r2,r2,r3 mtspr HID0,r2cpuNotMax27: bclr 20,0/******************************************************************************** nitroErrata - apply relevant errata workarounds for Nitro processor.** RETURNS: N/A*/nitroErrata: /* Get the NITRO revision type. */ mfspr r29,PVR rlwinm r29,r29,0,24,31 cmpwi r29,(CPU_REV_NITRO+2) bc 12,5,cpuNotNitro /* branch if greater than 0x1102 */ /* * The following five instructions is a workaround for errata #1 * as described in "PowerPC Nitro Microprocessor Errata List Release * 1.x Chips",Errata Version 3 3/29/00. Description: "Cache inhibited * instruction fetches that hit in L2 Direct Mapped SRAM space may * cause processor hang". */ li r2,0x0 mtspr 1014,r2 /* MSSCR0 */ lis r2,HI(MEMSSCR1_NITRO) ori r2,r2,LO(MEMSSCR1_NITRO) /* MSSCR1: Nitro errata 1 */ mtspr 1015,r2 bclr 20,0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -