drv_types_pci.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __DRV_TYPES_PCI_H__
  21. #define __DRV_TYPES_PCI_H__
  22. #ifdef PLATFORM_LINUX
  23. #include <linux/pci.h>
  24. #endif
  25. #define INTEL_VENDOR_ID 0x8086
  26. #define SIS_VENDOR_ID 0x1039
  27. #define ATI_VENDOR_ID 0x1002
  28. #define ATI_DEVICE_ID 0x7914
  29. #define AMD_VENDOR_ID 0x1022
  30. #define PCI_MAX_BRIDGE_NUMBER 255
  31. #define PCI_MAX_DEVICES 32
  32. #define PCI_MAX_FUNCTION 8
  33. #define PCI_CONF_ADDRESS 0x0CF8 // PCI Configuration Space Address
  34. #define PCI_CONF_DATA 0x0CFC // PCI Configuration Space Data
  35. #define PCI_CLASS_BRIDGE_DEV 0x06
  36. #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04
  37. #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
  38. #define U1DONTCARE 0xFF
  39. #define U2DONTCARE 0xFFFF
  40. #define U4DONTCARE 0xFFFFFFFF
  41. #define PCI_VENDER_ID_REALTEK 0x10ec
  42. #define HAL_HW_PCI_8180_DEVICE_ID 0x8180
  43. #define HAL_HW_PCI_8185_DEVICE_ID 0x8185 //8185 or 8185b
  44. #define HAL_HW_PCI_8188_DEVICE_ID 0x8188 //8185b
  45. #define HAL_HW_PCI_8198_DEVICE_ID 0x8198 //8185b
  46. #define HAL_HW_PCI_8190_DEVICE_ID 0x8190 //8190
  47. #define HAL_HW_PCI_8723E_DEVICE_ID 0x8723 //8723E
  48. #define HAL_HW_PCI_8192_DEVICE_ID 0x8192 //8192 PCI-E
  49. #define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192 //8192 SE
  50. #define HAL_HW_PCI_8174_DEVICE_ID 0x8174 //8192 SE
  51. #define HAL_HW_PCI_8173_DEVICE_ID 0x8173 //8191 SE Crab
  52. #define HAL_HW_PCI_8172_DEVICE_ID 0x8172 //8191 SE RE
  53. #define HAL_HW_PCI_8171_DEVICE_ID 0x8171 //8191 SE Unicron
  54. #define HAL_HW_PCI_0045_DEVICE_ID 0x0045 //8190 PCI for Ceraga
  55. #define HAL_HW_PCI_0046_DEVICE_ID 0x0046 //8190 Cardbus for Ceraga
  56. #define HAL_HW_PCI_0044_DEVICE_ID 0x0044 //8192e PCIE for Ceraga
  57. #define HAL_HW_PCI_0047_DEVICE_ID 0x0047 //8192e Express Card for Ceraga
  58. #define HAL_HW_PCI_700F_DEVICE_ID 0x700F
  59. #define HAL_HW_PCI_701F_DEVICE_ID 0x701F
  60. #define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304
  61. #define HAL_HW_PCI_8192CET_DEVICE_ID 0x8191 //8192ce
  62. #define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178 //8192ce
  63. #define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177 //8192ce
  64. #define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176 //8192ce
  65. #define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191 //8192ce
  66. #define HAL_HW_PCI_8192DE_DEVICE_ID 0x8193 //8192de
  67. #define HAL_HW_PCI_002B_DEVICE_ID 0x002B //8192de, provided by HW SD
  68. #define HAL_HW_PCI_8188EE_DEVICE_ID 0x8179
  69. #define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 //8190 support 16 pages of IO registers
  70. #define HAL_HW_PCI_REVISION_ID_8190PCI 0x00
  71. #define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000 //8192 support 16 pages of IO registers
  72. #define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01
  73. #define HAL_MEMORY_MAPPED_IO_RANGE_8192SE 0x4000 //8192 support 16 pages of IO registers
  74. #define HAL_HW_PCI_REVISION_ID_8192SE 0x10
  75. #define HAL_HW_PCI_REVISION_ID_8192CE 0x1
  76. #define HAL_MEMORY_MAPPED_IO_RANGE_8192CE 0x4000 //8192 support 16 pages of IO registers
  77. #define HAL_HW_PCI_REVISION_ID_8192DE 0x0
  78. #define HAL_MEMORY_MAPPED_IO_RANGE_8192DE 0x4000 //8192 support 16 pages of IO registers
  79. enum pci_bridge_vendor {
  80. PCI_BRIDGE_VENDOR_INTEL = 0x0,//0b'0000,0001
  81. PCI_BRIDGE_VENDOR_ATI, //= 0x02,//0b'0000,0010
  82. PCI_BRIDGE_VENDOR_AMD, //= 0x04,//0b'0000,0100
  83. PCI_BRIDGE_VENDOR_SIS ,//= 0x08,//0b'0000,1000
  84. PCI_BRIDGE_VENDOR_UNKNOWN, //= 0x40,//0b'0100,0000
  85. PCI_BRIDGE_VENDOR_MAX ,//= 0x80
  86. } ;
  87. struct rt_pci_capabilities_header {
  88. u8 capability_id;
  89. u8 next;
  90. };
  91. struct pci_priv{
  92. u8 linkctrl_reg;
  93. u8 busnumber;
  94. u8 devnumber;
  95. u8 funcnumber;
  96. u8 pcibridge_busnum;
  97. u8 pcibridge_devnum;
  98. u8 pcibridge_funcnum;
  99. u8 pcibridge_vendor;
  100. u16 pcibridge_vendorid;
  101. u16 pcibridge_deviceid;
  102. u8 pcibridge_pciehdr_offset;
  103. u8 pcibridge_linkctrlreg;
  104. u8 amd_l1_patch;
  105. };
  106. typedef struct _RT_ISR_CONTENT
  107. {
  108. union{
  109. u32 IntArray[2];
  110. u32 IntReg4Byte;
  111. u16 IntReg2Byte;
  112. };
  113. }RT_ISR_CONTENT, *PRT_ISR_CONTENT;
  114. //#define RegAddr(addr) (addr + 0xB2000000UL)
  115. //some platform macros will def here
  116. static inline void NdisRawWritePortUlong(u32 port, u32 val)
  117. {
  118. outl(val, port);
  119. //writel(val, (u8 *)RegAddr(port));
  120. }
  121. static inline void NdisRawWritePortUchar(u32 port, u8 val)
  122. {
  123. outb(val, port);
  124. //writeb(val, (u8 *)RegAddr(port));
  125. }
  126. static inline void NdisRawReadPortUchar(u32 port, u8 *pval)
  127. {
  128. *pval = inb(port);
  129. //*pval = readb((u8 *)RegAddr(port));
  130. }
  131. static inline void NdisRawReadPortUshort(u32 port, u16 *pval)
  132. {
  133. *pval = inw(port);
  134. //*pval = readw((u8 *)RegAddr(port));
  135. }
  136. static inline void NdisRawReadPortUlong(u32 port, u32 *pval)
  137. {
  138. *pval = inl(port);
  139. //*pval = readl((u8 *)RegAddr(port));
  140. }
  141. #endif