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

Linux/Unix编程

开发平台:

Unix_Linux

  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_MASTER 0x4 /* Enable bus mastering */
  23. #define PCI_LATENCY_TIMER 0x0d /* 8 bits */
  24. #define PCI_VENDOR_ID           0x00 /* 16 bits */
  25. #define PCI_DEVICE_ID           0x02 /* 16 bits */
  26. #define PCI_COMMAND             0x04 /* 16 bits */
  27. #define PCI_CLASS_CODE          0x0b /* 8 bits */
  28. #define PCI_SUBCLASS_CODE       0x0a /* 8 bits */
  29. #define PCI_HEADER_TYPE         0x0e /* 8 bits */
  30. #define PCI_BASE_ADDRESS_0      0x10 /* 32 bits */
  31. #define PCI_BASE_ADDRESS_1      0x14 /* 32 bits */
  32. #define PCI_BASE_ADDRESS_2      0x18 /* 32 bits */
  33. #define PCI_BASE_ADDRESS_3      0x1c /* 32 bits */
  34. #define PCI_BASE_ADDRESS_4      0x20 /* 32 bits */
  35. #define PCI_BASE_ADDRESS_5      0x24 /* 32 bits */
  36. #ifndef PCI_BASE_ADDRESS_IO_MASK
  37. #define PCI_BASE_ADDRESS_IO_MASK       (~0x03)
  38. #endif
  39. #define PCI_BASE_ADDRESS_SPACE_IO 0x01
  40. #define PCI_ROM_ADDRESS 0x30 /* 32 bits */
  41. #define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM,
  42.    bits 31..11 are address,
  43.    10..2 are reserved */
  44. #define PCI_FUNC(devfn)           ((devfn) & 0x07)
  45. #define BIOS32_SIGNATURE        (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
  46. /* PCI signature: "PCI " */
  47. #define PCI_SIGNATURE           (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24))
  48. /* PCI service signature: "$PCI" */
  49. #define PCI_SERVICE             (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24))
  50. #define KERN_CODE_SEG 0x8 /* This _MUST_ match start.S */
  51. #define PCI_VENDOR_ID_REALTEK           0x10ec
  52. #define PCI_DEVICE_ID_REALTEK_8029      0x8029
  53. #define PCI_DEVICE_ID_REALTEK_8139      0x8139
  54. #define PCI_VENDOR_ID_WINBOND2          0x1050
  55. #define PCI_DEVICE_ID_WINBOND2_89C940   0x0940
  56. #define PCI_VENDOR_ID_COMPEX            0x11f6
  57. #define PCI_DEVICE_ID_COMPEX_RL2000     0x1401
  58. #define PCI_VENDOR_ID_KTI               0x8e2e
  59. #define PCI_DEVICE_ID_KTI_ET32P2        0x3000
  60. #define PCI_VENDOR_ID_NETVIN            0x4a14
  61. #define PCI_DEVICE_ID_NETVIN_NV5000SC   0x5000
  62. #define PCI_VENDOR_ID_3COM 0x10b7
  63. #define PCI_DEVICE_ID_3COM_3C900TPO 0x9000
  64. #define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001
  65. #define PCI_DEVICE_ID_3COM_3C905TX 0x9050
  66. #define PCI_DEVICE_ID_3COM_3C905T4 0x9051
  67. #define PCI_DEVICE_ID_3COM_3C905B_TX 0x9055
  68. #define PCI_DEVICE_ID_3COM_3C905C_TXM 0x9200
  69. #define PCI_VENDOR_ID_INTEL 0x8086
  70. #define PCI_DEVICE_ID_INTEL_82557 0x1229
  71. #define PCI_VENDOR_ID_AMD 0x1022
  72. #define PCI_DEVICE_ID_AMD_LANCE 0x2000
  73. #define PCI_VENDOR_ID_SMC_1211          0x1113
  74. #define PCI_DEVICE_ID_SMC_1211          0x1211
  75. #define PCI_VENDOR_ID_DEC 0x1011
  76. #define PCI_DEVICE_ID_DEC_TULIP 0x0002
  77. #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009
  78. #define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014
  79. #define PCI_DEVICE_ID_DEC_21142 0x0019
  80. #define PCI_VENDOR_ID_SMC 0x10B8
  81. #ifndef PCI_DEVICE_ID_SMC_EPIC100
  82. # define PCI_DEVICE_ID_SMC_EPIC100 0x0005
  83. #endif
  84. #define PCI_VENDOR_ID_MACRONIX 0x10d9
  85. #define PCI_DEVICE_ID_MX987x5 0x0531
  86. #define PCI_VENDOR_ID_LINKSYS 0x11AD
  87. #define PCI_DEVICE_ID_LC82C115 0xC115
  88. #define PCI_VENDOR_ID_VIATEC 0x1106
  89. #define PCI_DEVICE_ID_VIA_RHINE_I 0x3043
  90. #define PCI_DEVICE_ID_VIA_86C100A 0x6100
  91. #define PCI_VENDOR_ID_DAVICOM 0x1282
  92. #define PCI_DEVICE_ID_DM9102 0x9102
  93. struct pci_device {
  94. unsigned short vendor, dev_id;
  95. const char *name;
  96. unsigned int membase;
  97. unsigned int ioaddr;
  98. unsigned short devfn;
  99. unsigned short bus;
  100. };
  101. extern void eth_pci_init(struct pci_device *);
  102. int pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
  103.      unsigned char where, unsigned char *val);
  104. int pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
  105.      unsigned char where, unsigned short *val);
  106. int pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
  107.       unsigned char where, unsigned int *val);
  108. int pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
  109.       unsigned char where, unsigned char val);
  110. int pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
  111.       unsigned char where, unsigned short val);
  112. int pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
  113.        unsigned char where, unsigned int val);
  114. /*
  115.  * Error values that may be returned by the PCI bios.
  116.  */
  117. #define PCIBIOS_SUCCESSFUL              0x00
  118. #define PCIBIOS_FUNC_NOT_SUPPORTED      0x81
  119. #define PCIBIOS_BAD_VENDOR_ID           0x83
  120. #define PCIBIOS_DEVICE_NOT_FOUND        0x86
  121. #define PCIBIOS_BAD_REGISTER_NUMBER     0x87
  122. #define PCIBIOS_SET_FAILED              0x88
  123. #define PCIBIOS_BUFFER_TOO_SMALL        0x89
  124. #endif /* PCI_H */