You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

prism2_plx.c 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**************************************************************************
  2. Etherboot - BOOTP/TFTP Bootstrap Program
  3. Prism2 NIC driver for Etherboot
  4. Wrapper for prism2_plx
  5. Written by Michael Brown of Fen Systems Ltd
  6. $Id$
  7. ***************************************************************************/
  8. /*
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  22. * 02110-1301, USA.
  23. */
  24. FILE_LICENCE ( GPL2_OR_LATER );
  25. #include <ipxe/pci.h>
  26. #include <nic.h>
  27. #define WLAN_HOSTIF WLAN_PLX
  28. #include "prism2.c"
  29. /*
  30. * Find PLX card. Prints out information strings from PCMCIA CIS as visual
  31. * confirmation of presence of card.
  32. *
  33. * Arguments:
  34. * hw device structure to be filled in
  35. * p PCI device structure
  36. *
  37. * Returns:
  38. * 1 Success
  39. */
  40. static int prism2_find_plx ( hfa384x_t *hw, struct pci_device *p )
  41. {
  42. int found = 0;
  43. uint32_t plx_lcr = 0; /* PLX9052 Local Configuration Register Base (I/O) */
  44. uint32_t attr_mem = 0; /* Prism2 Attribute Memory Base */
  45. uint32_t iobase = 0; /* Prism2 I/O Base */
  46. unsigned char *cis_tpl = NULL;
  47. unsigned char *cis_string;
  48. /* Obtain all memory and IO base addresses */
  49. pci_read_config_dword( p, PLX_LOCAL_CONFIG_REGISTER_BASE, &plx_lcr);
  50. plx_lcr &= ~PCI_BASE_ADDRESS_IO_MASK;
  51. pci_read_config_dword( p, PRISM2_PLX_ATTR_MEM_BASE, &attr_mem);
  52. pci_read_config_dword( p, PRISM2_PLX_IO_BASE, &iobase);
  53. iobase &= ~PCI_BASE_ADDRESS_IO_MASK;
  54. /* Fill out hw structure */
  55. hw->iobase = iobase;
  56. printf ( "PLX9052 has local config registers at %#x\n", plx_lcr );
  57. printf ( "Prism2 has attribute memory at %#x and I/O base at %#x\n", attr_mem, iobase );
  58. /* Search for CIS strings */
  59. printf ( "Searching for PCMCIA card...\n" );
  60. cis_tpl = bus_to_virt(attr_mem);
  61. while ( *cis_tpl != CISTPL_END ) {
  62. if ( *cis_tpl == CISTPL_VERS_1 ) {
  63. /* CISTPL_VERS_1 contains some nice text strings */
  64. printf ( "...found " );
  65. found = 1;
  66. cis_string = cis_tpl + CISTPL_VERS_1_STR_OFF;
  67. while ( ! ( ( *cis_string == 0 ) && ( *(cis_string+CIS_STEP) == 0 ) ) ) {
  68. printf ( "%c", *cis_string == 0 ? ' ' : *cis_string );
  69. cis_string += CIS_STEP;
  70. }
  71. printf ( "\n" );
  72. }
  73. /* printf ( "CIS tuple type %#hhx, length %#hhx\n", *cis_tpl, *(cis_tpl+CISTPL_LEN_OFF) ); */
  74. cis_tpl += CISTPL_HEADER_LEN + CIS_STEP * ( *(cis_tpl+CISTPL_LEN_OFF) );
  75. }
  76. if ( found == 0 ) {
  77. printf ( "...nothing found\n" );
  78. }
  79. ((unsigned char *)bus_to_virt(attr_mem))[COR_OFFSET] = COR_VALUE; /* Write COR to enable PC card */
  80. return found;
  81. }
  82. static int prism2_plx_probe ( struct nic *nic, struct pci_device *pci ) {
  83. hfa384x_t *hw = &hw_global;
  84. /* Find and intialise PLX Prism2 card */
  85. if ( ! prism2_find_plx ( hw, pci ) ) return 0;
  86. nic->ioaddr = hw->iobase;
  87. nic->irqno = 0;
  88. return prism2_probe ( nic, hw );
  89. }
  90. static void prism2_plx_disable ( struct nic *nic ) {
  91. prism2_disable ( nic );
  92. }
  93. static struct pci_device_id prism2_plx_nics[] = {
  94. PCI_ROM(0x1385, 0x4100, "ma301", "Netgear MA301", 0),
  95. PCI_ROM(0x10b7, 0x7770, "3c-airconnect", "3Com AirConnect", 0),
  96. PCI_ROM(0x111a, 0x1023, "ss1023", "Siemens SpeedStream SS1023", 0),
  97. PCI_ROM(0x15e8, 0x0130, "correga", "Correga", 0),
  98. PCI_ROM(0x1638, 0x1100, "smc2602w", "SMC EZConnect SMC2602W", 0), /* or Eumitcom PCI WL11000, Addtron AWA-100 */
  99. PCI_ROM(0x16ab, 0x1100, "gl24110p", "Global Sun Tech GL24110P", 0),
  100. PCI_ROM(0x16ab, 0x1101, "16ab-1101", "Unknown", 0),
  101. PCI_ROM(0x16ab, 0x1102, "wdt11", "Linksys WDT11", 0),
  102. PCI_ROM(0x16ec, 0x3685, "usr2415", "USR 2415", 0),
  103. PCI_ROM(0xec80, 0xec00, "f5d6000", "Belkin F5D6000", 0),
  104. PCI_ROM(0x126c, 0x8030, "emobility", "Nortel emobility", 0),
  105. };
  106. PCI_DRIVER ( prism2_plx_driver, prism2_plx_nics, PCI_NO_CLASS );
  107. DRIVER ( "Prism2/PLX", nic_driver, pci_driver, prism2_plx_driver,
  108. prism2_plx_probe, prism2_plx_disable );
  109. /*
  110. * Local variables:
  111. * c-basic-offset: 8
  112. * c-indent-level: 8
  113. * tab-width: 8
  114. * End:
  115. */