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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Definition of platform feature hooks for PowerMacs
  3.  * 
  4.  * This file is subject to the terms and conditions of the GNU General Public
  5.  * License.  See the file "COPYING" in the main directory of this archive
  6.  * for more details.
  7.  *
  8.  * Copyright (C) 1998 Paul Mackerras &
  9.  *                    Ben. Herrenschmidt.
  10.  *                    
  11.  *                    
  12.  * Note: I removed media-bay details from the feature stuff, I beleive it's
  13.  *       not worth it, the media-bay driver can directly use the mac-io
  14.  *       ASIC registers.
  15.  *       
  16.  * Implementation note: Currently, none of these functions will block.
  17.  * However, they may internally protect themselves with a spinlock
  18.  * for way too long. Be prepared for at least some of these to block
  19.  * in the future.
  20.  * 
  21.  * Unless specifically defined, the result code is assumed to be an
  22.  * error when negative, 0 is the default success result. Some functions
  23.  * may return additional positive result values.
  24.  * 
  25.  * To keep implementation simple, all feature calls are assumed to have
  26.  * the prototype parameters (struct device_node* node, int value).
  27.  * When either is not used, pass 0.
  28.  */
  29. #ifdef __KERNEL__
  30. #ifndef __PPC_ASM_PMAC_FEATURE_H
  31. #define __PPC_ASM_PMAC_FEATURE_H
  32. /*
  33.  * Known Mac motherboard models
  34.  * 
  35.  * Please, report any error here to benh@kernel.crashing.org, thanks !
  36.  */
  37. /* PowerSurge are the first generation of PCI Pmacs. This include
  38.  * all of the Grand-Central based machines. We currently don't
  39.  * differenciate most of them.
  40.  */
  41. #define PMAC_TYPE_PSURGE 0x10 /* PowerSurge */
  42. #define PMAC_TYPE_ANS 0x11 /* Apple Network Server */
  43. /* Here is the infamous serie of OHare based machines
  44.  */
  45. #define PMAC_TYPE_COMET 0x20 /* Beleived to be PowerBook 2400 */
  46. #define PMAC_TYPE_HOOPER 0x21 /* Beleived to be PowerBook 3400 */
  47. #define PMAC_TYPE_KANGA 0x22 /* PowerBook 3500 (first G3) */
  48. #define PMAC_TYPE_ALCHEMY 0x23 /* Alchemy motherboard base */
  49. #define PMAC_TYPE_GAZELLE 0x24 /* Spartacus, some 5xxx/6xxx */
  50. #define PMAC_TYPE_UNKNOWN_OHARE 0x2f /* Unknown, but OHare based */
  51. /* Here are the Heathrow based machines
  52.  * FIXME: Differenciate wallstreet,mainstreet,wallstreetII
  53.  */
  54. #define PMAC_TYPE_GOSSAMER 0x30 /* Gossamer motherboard */
  55. #define PMAC_TYPE_SILK 0x31 /* Desktop PowerMac G3 */
  56. #define PMAC_TYPE_WALLSTREET 0x32 /* Wallstreet/Mainstreet PowerBook*/
  57. #define PMAC_TYPE_UNKNOWN_HEATHROW 0x3f /* Unknown but heathrow based */
  58. /* Here are newworld machines based on Paddington (heathrow derivative)
  59.  */
  60. #define PMAC_TYPE_101_PBOOK 0x40 /* 101 PowerBook (aka Lombard) */
  61. #define PMAC_TYPE_ORIG_IMAC 0x41 /* First generation iMac */
  62. #define PMAC_TYPE_YOSEMITE 0x42 /* B&W G3 */
  63. #define PMAC_TYPE_YIKES 0x43 /* Yikes G4 (PCI graphics) */
  64. #define PMAC_TYPE_UNKNOWN_PADDINGTON 0x4f /* Unknown but paddington based */
  65. /* Core99 machines based on UniNorth 1.0 and 1.5
  66.  * 
  67.  * Note: A single entry here may cover several actual models according
  68.  * to the device-tree. (Sawtooth is most tower G4s, FW_IMAC is most
  69.  * FireWire based iMacs, etc...). Those machines are too similar to be
  70.  * distinguished here, when they need to be differencied, use the
  71.  * device-tree "model" or "compatible" property.
  72.  */
  73. #define PMAC_TYPE_ORIG_IBOOK 0x40 /* First iBook model (no firewire) */
  74. #define PMAC_TYPE_SAWTOOTH 0x41 /* Desktop G4s */
  75. #define PMAC_TYPE_FW_IMAC 0x42 /* FireWire iMacs (except Pangea based) */
  76. #define PMAC_TYPE_FW_IBOOK 0x43 /* FireWire iBooks (except iBook2) */
  77. #define PMAC_TYPE_CUBE 0x44 /* Cube PowerMac */
  78. #define PMAC_TYPE_QUICKSILVER 0x45 /* QuickSilver G4s */
  79. #define PMAC_TYPE_PISMO 0x46 /* Pismo PowerBook */
  80. #define PMAC_TYPE_TITANIUM 0x47 /* Titanium PowerBook */
  81. #define PMAC_TYPE_TITANIUM2 0x48 /* Titanium II PowerBook */
  82. #define PMAC_TYPE_TITANIUM3 0x49 /* Titanium III PowerBook (with L3) */
  83. #define PMAC_TYPE_EMAC 0x50 /* eMac */
  84. #define PMAC_TYPE_UNKNOWN_CORE99 0x5f
  85. /* MacRisc2 with UniNorth 2.0 */
  86. #define PMAC_TYPE_RACKMAC 0x80 /* XServe */
  87. #define PMAC_TYPE_WINDTUNNEL 0x81
  88. /* MacRISC2 machines based on the Pangea chipset
  89.  */
  90. #define PMAC_TYPE_PANGEA_IMAC 0x100 /* Flower Power iMac */
  91. #define PMAC_TYPE_IBOOK2 0x101 /* iBook2 (polycarbonate) */
  92. #define PMAC_TYPE_FLAT_PANEL_IMAC 0x102 /* Flat panel iMac */
  93. #define PMAC_TYPE_UNKNOWN_PANGEA 0x10f
  94. /*
  95.  * Motherboard flags
  96.  */
  97. #define PMAC_MB_CAN_SLEEP 0x00000001
  98. #define PMAC_MB_HAS_FW_POWER 0x00000002
  99. #define PMAC_MB_OLD_CORE99 0x00000004
  100. /*
  101.  * Feature calls supported on pmac
  102.  * 
  103.  */
  104. /*
  105.  * Use this inline wrapper
  106.  */
  107. struct device_node;
  108. static inline int pmac_call_feature(int selector, struct device_node* node,
  109. int param, int value)
  110. {
  111. if (!ppc_md.feature_call)
  112. return -ENODEV;
  113. return ppc_md.feature_call(selector, node, param, value);
  114. }
  115. /* PMAC_FTR_SERIAL_ENABLE (struct device_node* node, int param, int value)
  116.  * enable/disable an SCC side. Pass the node corresponding to the
  117.  * channel side as a parameter.
  118.  * param is the type of port
  119.  * if param is ored with PMAC_SCC_FLAG_XMON, then the SCC is locked enabled
  120.  * for use by xmon.
  121.  */
  122. #define PMAC_FTR_SCC_ENABLE PMAC_FTR_DEF(0)
  123. #define PMAC_SCC_ASYNC 0
  124. #define PMAC_SCC_IRDA 1
  125. #define PMAC_SCC_I2S1 2
  126. #define PMAC_SCC_FLAG_XMON 0x00001000
  127. /* PMAC_FTR_MODEM_ENABLE (struct device_node* node, 0, int value)
  128.  * enable/disable the internal modem.
  129.  */
  130. #define PMAC_FTR_MODEM_ENABLE PMAC_FTR_DEF(1)
  131. /* PMAC_FTR_SWIM3_ENABLE (struct device_node* node, 0,int value)
  132.  * enable/disable the swim3 (floppy) cell of a mac-io ASIC
  133.  */
  134. #define PMAC_FTR_SWIM3_ENABLE PMAC_FTR_DEF(2)
  135. /* PMAC_FTR_MESH_ENABLE (struct device_node* node, 0, int value)
  136.  * enable/disable the mesh (scsi) cell of a mac-io ASIC
  137.  */
  138. #define PMAC_FTR_MESH_ENABLE PMAC_FTR_DEF(3)
  139. /* PMAC_FTR_IDE_ENABLE (struct device_node* node, int busID, int value)
  140.  * enable/disable an IDE port of a mac-io ASIC
  141.  * pass the busID parameter
  142.  */
  143. #define PMAC_FTR_IDE_ENABLE PMAC_FTR_DEF(4)
  144. /* PMAC_FTR_IDE_RESET (struct device_node* node, int busID, int value)
  145.  * assert(1)/release(0) an IDE reset line (mac-io IDE only)
  146.  */
  147. #define PMAC_FTR_IDE_RESET PMAC_FTR_DEF(5)
  148. /* PMAC_FTR_BMAC_ENABLE (struct device_node* node, 0, int value)
  149.  * enable/disable the bmac (ethernet) cell of a mac-io ASIC, also drive
  150.  * it's reset line
  151.  */
  152. #define PMAC_FTR_BMAC_ENABLE PMAC_FTR_DEF(6)
  153. /* PMAC_FTR_GMAC_ENABLE (struct device_node* node, 0, int value)
  154.  * enable/disable the gmac (ethernet) cell of an uninorth ASIC. This
  155.  * control the cell's clock.
  156.  */
  157. #define PMAC_FTR_GMAC_ENABLE PMAC_FTR_DEF(7)
  158. /* PMAC_FTR_GMAC_PHY_RESET (struct device_node* node, 0, 0)
  159.  * Perform a HW reset of the PHY connected to a gmac controller.
  160.  * Pass the gmac device node, not the PHY node.
  161.  */
  162. #define PMAC_FTR_GMAC_PHY_RESET PMAC_FTR_DEF(8)
  163. /* PMAC_FTR_SOUND_CHIP_ENABLE (struct device_node* node, 0, int value)
  164.  * enable/disable the sound chip, whatever it is and provided it can
  165.  * acually be controlled
  166.  */
  167. #define PMAC_FTR_SOUND_CHIP_ENABLE PMAC_FTR_DEF(9)
  168. /* -- add various tweaks related to sound routing -- */
  169.  
  170. /* PMAC_FTR_AIRPORT_ENABLE (struct device_node* node, 0, int value)
  171.  * enable/disable the airport card
  172.  */
  173. #define PMAC_FTR_AIRPORT_ENABLE PMAC_FTR_DEF(10)
  174. /* PMAC_FTR_RESET_CPU (NULL, int cpu_nr, 0)
  175.  * toggle the reset line of a CPU on an uninorth-based SMP machine
  176.  */
  177. #define PMAC_FTR_RESET_CPU PMAC_FTR_DEF(11)
  178. /* PMAC_FTR_USB_ENABLE (struct device_node* node, 0, int value)
  179.  * enable/disable an USB cell, along with the power of the USB "pad"
  180.  * on keylargo based machines
  181.  */
  182. #define PMAC_FTR_USB_ENABLE PMAC_FTR_DEF(12)
  183. /* PMAC_FTR_1394_ENABLE (struct device_node* node, 0, int value)
  184.  * enable/disable the firewire cell of an uninorth ASIC.
  185.  */
  186. #define PMAC_FTR_1394_ENABLE PMAC_FTR_DEF(13)
  187. /* PMAC_FTR_1394_CABLE_POWER (struct device_node* node, 0, int value)
  188.  * enable/disable the firewire cable power supply of the uninorth
  189.  * firewire cell
  190.  */
  191. #define PMAC_FTR_1394_CABLE_POWER PMAC_FTR_DEF(14)
  192. /* PMAC_FTR_SLEEP_STATE (struct device_node* node, 0, int value)
  193.  * set the sleep state of the motherboard.
  194.  * Pass -1 as value to query for sleep capability
  195.  */
  196. #define PMAC_FTR_SLEEP_STATE PMAC_FTR_DEF(15)
  197. /* PMAC_FTR_GET_MB_INFO (NULL, selector, 0)
  198.  * 
  199.  * returns some motherboard infos.
  200.  * selector: 0  - model id
  201.  *           1  - model flags (capabilities)
  202.  *           2  - model name (cast to const char *)
  203.  */
  204. #define PMAC_FTR_GET_MB_INFO PMAC_FTR_DEF(16)
  205. #define   PMAC_MB_INFO_MODEL 0
  206. #define   PMAC_MB_INFO_FLAGS 1
  207. #define   PMAC_MB_INFO_NAME 2
  208. /* PMAC_FTR_READ_GPIO (NULL, int index, 0)
  209.  *
  210.  * read a GPIO from a mac-io controller of type KeyLargo or Pangea.
  211.  * the value returned is a byte (positive), or a negative error code
  212.  */
  213. #define PMAC_FTR_READ_GPIO PMAC_FTR_DEF(17)
  214. /* PMAC_FTR_WRITE_GPIO (NULL, int index, int value)
  215.  *
  216.  * write a GPIO of a mac-io controller of type KeyLargo or Pangea.
  217.  */
  218. #define PMAC_FTR_WRITE_GPIO PMAC_FTR_DEF(18)
  219. /* Don't use those directly, they are for the sake of pmac_setup.c */
  220. extern int pmac_do_feature_call(unsigned int selector, ...);
  221. extern void pmac_feature_init(void);
  222. extern void pmac_feature_late_init(void);
  223. #define PMAC_FTR_DEF(x) ((_MACH_Pmac << 16) | (x))
  224. #endif /* __PPC_ASM_PMAC_FEATURE_H */
  225. #endif /* __KERNEL__ */