pci.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #ifndef PCI_H
  2. #define PCI_H
  3. /*
  4. ** Support for NE2000 PCI clones added David Monro June 1997
  5. ** Generalised for other PCI NICs by Ken Yap July 1997
  6. **
  7. ** Most of this is taken from:
  8. **
  9. ** /usr/src/linux/drivers/pci/pci.c
  10. ** /usr/src/linux/include/linux/pci.h
  11. ** /usr/src/linux/arch/i386/bios32.c
  12. ** /usr/src/linux/include/linux/bios32.h
  13. ** /usr/src/linux/drivers/net/ne.c
  14. */
  15. /*
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License as
  18. * published by the Free Software Foundation; either version 2, or (at
  19. * your option) any later version.
  20. */
  21. #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
  22. #define PCI_COMMAND_MEM 0x2 /* Enable response in mem space */
  23. #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
  24. #define PCI_LATENCY_TIMER 0x0d /* 8 bits */
  25. #define PCIBIOS_PCI_FUNCTION_ID 0xb1XX
  26. #define PCIBIOS_PCI_BIOS_PRESENT 0xb101
  27. #define PCIBIOS_FIND_PCI_DEVICE 0xb102
  28. #define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103
  29. #define PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106
  30. #define PCIBIOS_READ_CONFIG_BYTE 0xb108
  31. #define PCIBIOS_READ_CONFIG_WORD 0xb109
  32. #define PCIBIOS_READ_CONFIG_DWORD 0xb10a
  33. #define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b
  34. #define PCIBIOS_WRITE_CONFIG_WORD 0xb10c
  35. #define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d
  36. #define PCI_VENDOR_ID 0x00 /* 16 bits */
  37. #define PCI_DEVICE_ID 0x02 /* 16 bits */
  38. #define PCI_COMMAND 0x04 /* 16 bits */
  39. #define PCI_REVISION 0x08 /* 8 bits */
  40. #define PCI_CLASS_CODE 0x0b /* 8 bits */
  41. #define PCI_SUBCLASS_CODE 0x0a /* 8 bits */
  42. #define PCI_HEADER_TYPE 0x0e /* 8 bits */
  43. #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
  44. #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits */
  45. #define PCI_BASE_ADDRESS_2 0x18 /* 32 bits */
  46. #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */
  47. #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */
  48. #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
  49. #ifndef PCI_BASE_ADDRESS_IO_MASK
  50. #define PCI_BASE_ADDRESS_IO_MASK (~0x03)
  51. #endif
  52. #define PCI_BASE_ADDRESS_SPACE_IO 0x01
  53. #define PCI_ROM_ADDRESS 0x30 /* 32 bits */
  54. #define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM,
  55. bits 31..11 are address,
  56. 10..2 are reserved */
  57. #define PCI_FUNC(devfn) ((devfn) & 0x07)
  58. #define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
  59. /* PCI signature: "PCI " */
  60. #define PCI_SIGNATURE (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24))
  61. /* PCI service signature: "$PCI" */
  62. #define PCI_SERVICE (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24))
  63. union bios32 {
  64. struct {
  65. unsigned long signature; /* _32_ */
  66. unsigned long entry; /* 32 bit physical address */
  67. unsigned char revision; /* Revision level, 0 */
  68. unsigned char length; /* Length in paragraphs should be 01 */
  69. unsigned char checksum; /* All bytes must add up to zero */
  70. unsigned char reserved[5]; /* Must be zero */
  71. } fields;
  72. char chars[16];
  73. };
  74. #define KERN_CODE_SEG 0x8 /* This _MUST_ match start.S */
  75. /* Stuff for asm */
  76. #define save_flags(x) \
  77. __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory")
  78. #define cli() __asm__ __volatile__ ("cli": : :"memory")
  79. #define restore_flags(x) \
  80. __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
  81. #define PCI_VENDOR_ID_ADMTEK 0x1317
  82. #define PCI_DEVICE_ID_ADMTEK_0985 0x0985
  83. #define PCI_VENDOR_ID_REALTEK 0x10ec
  84. #define PCI_DEVICE_ID_REALTEK_8029 0x8029
  85. #define PCI_DEVICE_ID_REALTEK_8139 0x8139
  86. #define PCI_VENDOR_ID_WINBOND2 0x1050
  87. #define PCI_DEVICE_ID_WINBOND2_89C940 0x0940
  88. #define PCI_DEVICE_ID_WINBOND2_89C840 0x0840
  89. #define PCI_VENDOR_ID_COMPEX 0x11f6
  90. #define PCI_DEVICE_ID_COMPEX_RL2000 0x1401
  91. #define PCI_DEVICE_ID_COMPEX_RL100ATX 0x2011
  92. #define PCI_VENDOR_ID_KTI 0x8e2e
  93. #define PCI_DEVICE_ID_KTI_ET32P2 0x3000
  94. #define PCI_VENDOR_ID_NETVIN 0x4a14
  95. #define PCI_DEVICE_ID_NETVIN_NV5000SC 0x5000
  96. #define PCI_VENDOR_ID_HOLTEK 0x12c3
  97. #define PCI_DEVICE_ID_HOLTEK_HT80232 0x0058
  98. #define PCI_VENDOR_ID_3COM 0x10b7
  99. #define PCI_DEVICE_ID_3COM_3C590 0x5900
  100. #define PCI_DEVICE_ID_3COM_3C595 0x5950
  101. #define PCI_DEVICE_ID_3COM_3C595_1 0x5951
  102. #define PCI_DEVICE_ID_3COM_3C595_2 0x5952
  103. #define PCI_DEVICE_ID_3COM_3C900TPO 0x9000
  104. #define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001
  105. #define PCI_DEVICE_ID_3COM_3C905TX 0x9050
  106. #define PCI_DEVICE_ID_3COM_3C905T4 0x9051
  107. #define PCI_DEVICE_ID_3COM_3C905B_TX 0x9055
  108. #define PCI_DEVICE_ID_3COM_3C905C_TXM 0x9200
  109. #define PCI_VENDOR_ID_INTEL 0x8086
  110. #define PCI_DEVICE_ID_INTEL_82557 0x1229
  111. #define PCI_DEVICE_ID_INTEL_82559ER 0x1209
  112. #define PCI_DEVICE_ID_INTEL_ID1029 0x1029
  113. #define PCI_DEVICE_ID_INTEL_ID1030 0x1030
  114. #define PCI_DEVICE_ID_INTEL_82562 0x2449
  115. #define PCI_VENDOR_ID_AMD 0x1022
  116. #define PCI_DEVICE_ID_AMD_LANCE 0x2000
  117. #define PCI_VENDOR_ID_AMD_HOMEPNA 0x1022
  118. #define PCI_DEVICE_ID_AMD_HOMEPNA 0x2001
  119. #define PCI_VENDOR_ID_SMC_1211 0x1113
  120. #define PCI_DEVICE_ID_SMC_1211 0x1211
  121. #define PCI_VENDOR_ID_DEC 0x1011
  122. #define PCI_DEVICE_ID_DEC_TULIP 0x0002
  123. #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009
  124. #define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014
  125. #define PCI_DEVICE_ID_DEC_21142 0x0019
  126. #define PCI_VENDOR_ID_SMC 0x10B8
  127. #ifndef PCI_DEVICE_ID_SMC_EPIC100
  128. # define PCI_DEVICE_ID_SMC_EPIC100 0x0005
  129. #endif
  130. #define PCI_VENDOR_ID_MACRONIX 0x10d9
  131. #define PCI_DEVICE_ID_MX987x5 0x0531
  132. #define PCI_VENDOR_ID_LINKSYS 0x11AD
  133. #define PCI_DEVICE_ID_LC82C115 0xC115
  134. #define PCI_VENDOR_ID_VIATEC 0x1106
  135. #define PCI_DEVICE_ID_VIA_RHINE_I 0x3043
  136. #define PCI_DEVICE_ID_VIA_VT6102 0x3065
  137. #define PCI_DEVICE_ID_VIA_86C100A 0x6100
  138. #define PCI_VENDOR_ID_DAVICOM 0x1282
  139. #define PCI_DEVICE_ID_DM9009 0x9009
  140. #define PCI_DEVICE_ID_DM9102 0x9102
  141. #define PCI_VENDOR_ID_SIS 0x1039
  142. #define PCI_DEVICE_ID_SIS900 0x0900
  143. #define PCI_DEVICE_ID_SIS7016 0x7016
  144. #define PCI_VENDOR_ID_DLINK 0x1186
  145. #define PCI_DEVICE_ID_DFE530TXP 0x1300
  146. #define PCI_VENDOR_ID_NS 0x100B
  147. #define PCI_DEVICE_ID_DP83815 0x0020
  148. #define PCI_VENDOR_ID_OLICOM 0x108d
  149. #define PCI_DEVICE_ID_OLICOM_OC3136 0x0001
  150. #define PCI_DEVICE_ID_OLICOM_OC2315 0x0011
  151. #define PCI_DEVICE_ID_OLICOM_OC2325 0x0012
  152. #define PCI_DEVICE_ID_OLICOM_OC2183 0x0013
  153. #define PCI_DEVICE_ID_OLICOM_OC2326 0x0014
  154. #define PCI_DEVICE_ID_OLICOM_OC6151 0x0021
  155. struct pci_device {
  156. unsigned short vendor, dev_id;
  157. const char *name;
  158. unsigned int membase;
  159. unsigned short ioaddr;
  160. unsigned char devfn;
  161. unsigned char bus;
  162. };
  163. extern void eth_pci_init(struct pci_device *);
  164. extern int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char *value);
  165. extern int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char value);
  166. extern int pcibios_read_config_word(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned short *value);
  167. extern int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned short value);
  168. extern int pcibios_read_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned int *value);
  169. extern int pcibios_write_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned int value);
  170. void adjust_pci_device(struct pci_device *p);
  171. #endif /* PCI_H */