uninorth.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * BK Id: SCCS/s.uninorth.h 1.13 10/23/01 08:09:35 trini
  3.  */
  4. /*
  5.  * uninorth.h: definitions for using the "UniNorth" host bridge chip
  6.  *             from Apple. This chip is used on "Core99" machines
  7.  *
  8.  */
  9. #ifdef __KERNEL__
  10. #ifndef __ASM_UNINORTH_H__
  11. #define __ASM_UNINORTH_H__
  12. /*
  13.  * Uni-N config space reg. definitions
  14.  * 
  15.  * (Little endian)
  16.  */
  17. /* Address ranges selection. This one should work with Bandit too */
  18. #define UNI_N_ADDR_SELECT 0x48
  19. #define UNI_N_ADDR_COARSE_MASK 0xffff0000 /* 256Mb regions at *0000000 */
  20. #define UNI_N_ADDR_FINE_MASK 0x0000ffff /*  16Mb regions at f*000000 */
  21. /* AGP registers */
  22. #define UNI_N_CFG_GART_BASE 0x8c
  23. #define UNI_N_CFG_AGP_BASE 0x90
  24. #define UNI_N_CFG_GART_CTRL 0x94
  25. #define UNI_N_CFG_INTERNAL_STATUS 0x98
  26. /* UNI_N_CFG_GART_CTRL bits definitions */
  27. #define UNI_N_CFG_GART_INVAL 0x00000001
  28. #define UNI_N_CFG_GART_ENABLE 0x00000100
  29. #define UNI_N_CFG_GART_2xRESET 0x00010000
  30. /* My understanding of UniNorth AGP as of UniNorth rev 1.0x,
  31.  * revision 1.5 (x4 AGP) may need further changes.
  32.  * 
  33.  * AGP_BASE register contains the base address of the AGP aperture on
  34.  * the AGP bus. It doesn't seem to be visible to the CPU as of UniNorth 1.x,
  35.  * even if decoding of this address range is enabled in the address select
  36.  * register. Apparently, the only supported bases are 256Mb multiples
  37.  * (high 4 bits of that register).
  38.  * 
  39.  * GART_BASE register appear to contain the physical address of the GART
  40.  * in system memory in the high address bits (page aligned), and the
  41.  * GART size in the low order bits (number of GART pages)
  42.  *
  43.  * The GART format itself is one 32bits word per physical memory page.
  44.  * This word contains, in little-endian format (!!!), the physical address
  45.  * of the page in the high bits, and what appears to be an "enable" bit
  46.  * in the LSB bit (0) that must be set to 1 when the entry is valid.
  47.  * 
  48.  * Obviously, the GART is not cache coherent and so any change to it
  49.  * must be flushed to memory (or maybe just make the GART space non
  50.  * cachable). AGP memory itself doens't seem to be cache coherent neither.
  51.  * 
  52.  * In order to invalidate the GART (which is probably necessary to inval
  53.  * the bridge internal TLBs), the following sequence has to be written,
  54.  * in order, to the GART_CTRL register:
  55.  * 
  56.  *   UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_INVAL
  57.  *   UNI_N_CFG_GART_ENABLE
  58.  *   UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_2xRESET
  59.  *   UNI_N_CFG_GART_ENABLE
  60.  *   
  61.  * As far as AGP "features" are concerned, it looks like fast write may
  62.  * not be supported but this has to be confirmed.
  63.  * 
  64.  * Turning on AGP seem to require a double invalidate operation, one before
  65.  * setting the AGP command register, on after.
  66.  * 
  67.  * Turning off AGP seems to require the following sequence: first wait
  68.  * for the AGP to be idle by reading the internal status register, then
  69.  * write in that order to the GART_CTRL register:
  70.  * 
  71.  *   UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_INVAL
  72.  *   0
  73.  *   UNI_N_CFG_GART_2xRESET
  74.  *   0
  75.  */
  76. /* 
  77.  * Uni-N memory mapped reg. definitions
  78.  * 
  79.  * Those registers are Big-Endian !!
  80.  *
  81.  * Their meaning come from either Darwin and/or from experiments I made with
  82.  * the bootrom, I'm not sure about their exact meaning yet
  83.  *
  84.  */
  85. /* Version of the UniNorth chip */
  86. #define UNI_N_VERSION 0x0000 /* Known versions: 3,7 and 8 */
  87.  
  88. /* This register is used to enable/disable various clocks */
  89. #define UNI_N_CLOCK_CNTL 0x0020
  90. #define UNI_N_CLOCK_CNTL_PCI 0x00000001 /* PCI2 clock control */
  91. #define UNI_N_CLOCK_CNTL_GMAC 0x00000002 /* GMAC clock control */
  92. #define UNI_N_CLOCK_CNTL_FW 0x00000004 /* FireWire clock control */
  93. /* Power Management control */
  94. #define UNI_N_POWER_MGT 0x0030
  95. #define UNI_N_POWER_MGT_NORMAL 0x00
  96. #define UNI_N_POWER_MGT_IDLE2 0x01
  97. #define UNI_N_POWER_MGT_SLEEP 0x02
  98. /* This register is configured by Darwin depending on the UniN
  99.  * revision
  100.  */
  101. #define UNI_N_ARB_CTRL 0x0040
  102. #define UNI_N_ARB_CTRL_QACK_DELAY_SHIFT 15
  103. #define UNI_N_ARB_CTRL_QACK_DELAY_MASK 0x0e1f8000
  104. #define UNI_N_ARB_CTRL_QACK_DELAY 0x30
  105. #define UNI_N_ARB_CTRL_QACK_DELAY105 0x00
  106. /* This one _might_ return the CPU number of the CPU reading it;
  107.  * the bootROM decides wether to boot or to sleep/spinloop depending
  108.  * on this register beeing 0 or not
  109.  */
  110. #define UNI_N_CPU_NUMBER 0x0050
  111. /* This register appear to be read by the bootROM to decide what
  112.  *  to do on a non-recoverable reset (powerup or wakeup)
  113.  */
  114. #define UNI_N_HWINIT_STATE 0x0070
  115. #define UNI_N_HWINIT_STATE_SLEEPING 0x01
  116. #define UNI_N_HWINIT_STATE_RUNNING 0x02
  117. /* This last bit appear to be used by the bootROM to know the second
  118.  * CPU has started and will enter it's sleep loop with IP=0
  119.  */
  120. #define UNI_N_HWINIT_STATE_CPU1_FLAG 0x10000000
  121. /* Uninorth 1.5 rev. has additional perf. monitor registers at 0xf00-0xf50 */
  122. #endif /* __ASM_UNINORTH_H__ */
  123. #endif /* __KERNEL__ */