Deleted Added
full compact
if_ste.c (155671) if_ste.c (162315)
1/*-
2 * Copyright (c) 1997, 1998, 1999
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997, 1998, 1999
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/pci/if_ste.c 155671 2006-02-14 12:44:56Z glebius $");
34__FBSDID("$FreeBSD: head/sys/pci/if_ste.c 162315 2006-09-15 10:40:54Z glebius $");
35
36#ifdef HAVE_KERNEL_OPTION_HEADERS
37#include "opt_device_polling.h"
38#endif
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/sockio.h>

--- 456 unchanged lines hidden (view full) ---

499 register int i;
500
501 for (i = 0; i < STE_TIMEOUT; i++) {
502 if (!(CSR_READ_4(sc, STE_DMACTL) & STE_DMACTL_DMA_HALTINPROG))
503 break;
504 }
505
506 if (i == STE_TIMEOUT)
35
36#ifdef HAVE_KERNEL_OPTION_HEADERS
37#include "opt_device_polling.h"
38#endif
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/sockio.h>

--- 456 unchanged lines hidden (view full) ---

499 register int i;
500
501 for (i = 0; i < STE_TIMEOUT; i++) {
502 if (!(CSR_READ_4(sc, STE_DMACTL) & STE_DMACTL_DMA_HALTINPROG))
503 break;
504 }
505
506 if (i == STE_TIMEOUT)
507 if_printf(sc->ste_ifp, "command never completed!\n");
507 device_printf(sc->ste_dev, "command never completed!\n");
508
509 return;
510}
511
512/*
513 * The EEPROM is slow: give it time to come ready after issuing
514 * it a command.
515 */

--- 8 unchanged lines hidden (view full) ---

524 for (i = 0; i < 100; i++) {
525 if (CSR_READ_2(sc, STE_EEPROM_CTL) & STE_EECTL_BUSY)
526 DELAY(1000);
527 else
528 break;
529 }
530
531 if (i == 100) {
508
509 return;
510}
511
512/*
513 * The EEPROM is slow: give it time to come ready after issuing
514 * it a command.
515 */

--- 8 unchanged lines hidden (view full) ---

524 for (i = 0; i < 100; i++) {
525 if (CSR_READ_2(sc, STE_EEPROM_CTL) & STE_EECTL_BUSY)
526 DELAY(1000);
527 else
528 break;
529 }
530
531 if (i == 100) {
532 if_printf(sc->ste_ifp, "eeprom failed to come ready\n");
532 device_printf(sc->ste_dev, "eeprom failed to come ready\n");
533 return(1);
534 }
535
536 return(0);
537}
538
539/*
540 * Read a sequence of words from the EEPROM. Note that ethernet address

--- 266 unchanged lines hidden (view full) ---

807 }
808
809 /*
810 * If there error bit was not set, the upload complete
811 * bit should be set which means we have a valid packet.
812 * If not, something truly strange has happened.
813 */
814 if (!(rxstat & STE_RXSTAT_DMADONE)) {
533 return(1);
534 }
535
536 return(0);
537}
538
539/*
540 * Read a sequence of words from the EEPROM. Note that ethernet address

--- 266 unchanged lines hidden (view full) ---

807 }
808
809 /*
810 * If there error bit was not set, the upload complete
811 * bit should be set which means we have a valid packet.
812 * If not, something truly strange has happened.
813 */
814 if (!(rxstat & STE_RXSTAT_DMADONE)) {
815 if_printf(ifp,
815 device_printf(sc->ste_dev,
816 "bad receive status -- packet dropped\n");
817 ifp->if_ierrors++;
818 cur_rx->ste_ptr->ste_status = 0;
819 continue;
820 }
821
822 /* No errors; receive the packet. */
823 m = cur_rx->ste_mbuf;

--- 37 unchanged lines hidden (view full) ---

861 ifp = sc->ste_ifp;
862
863 while ((txstat = CSR_READ_1(sc, STE_TX_STATUS)) &
864 STE_TXSTATUS_TXDONE) {
865 if (txstat & STE_TXSTATUS_UNDERRUN ||
866 txstat & STE_TXSTATUS_EXCESSCOLLS ||
867 txstat & STE_TXSTATUS_RECLAIMERR) {
868 ifp->if_oerrors++;
816 "bad receive status -- packet dropped\n");
817 ifp->if_ierrors++;
818 cur_rx->ste_ptr->ste_status = 0;
819 continue;
820 }
821
822 /* No errors; receive the packet. */
823 m = cur_rx->ste_mbuf;

--- 37 unchanged lines hidden (view full) ---

861 ifp = sc->ste_ifp;
862
863 while ((txstat = CSR_READ_1(sc, STE_TX_STATUS)) &
864 STE_TXSTATUS_TXDONE) {
865 if (txstat & STE_TXSTATUS_UNDERRUN ||
866 txstat & STE_TXSTATUS_EXCESSCOLLS ||
867 txstat & STE_TXSTATUS_RECLAIMERR) {
868 ifp->if_oerrors++;
869 if_printf(ifp, "transmission error: %x\n", txstat);
869 device_printf(sc->ste_dev,
870 "transmission error: %x\n", txstat);
870
871 ste_reset(sc);
872 ste_init_locked(sc);
873
874 if (txstat & STE_TXSTATUS_UNDERRUN &&
875 sc->ste_tx_thresh < STE_PACKET_SIZE) {
876 sc->ste_tx_thresh += STE_MIN_FRAMELEN;
871
872 ste_reset(sc);
873 ste_init_locked(sc);
874
875 if (txstat & STE_TXSTATUS_UNDERRUN &&
876 sc->ste_tx_thresh < STE_PACKET_SIZE) {
877 sc->ste_tx_thresh += STE_MIN_FRAMELEN;
877 if_printf(ifp, "tx underrun, increasing tx"
878 device_printf(sc->ste_dev,
879 "tx underrun, increasing tx"
878 " start threshold to %d bytes\n",
879 sc->ste_tx_thresh);
880 }
881 CSR_WRITE_2(sc, STE_TX_STARTTHRESH, sc->ste_tx_thresh);
882 CSR_WRITE_2(sc, STE_TX_RECLAIM_THRESH,
883 (STE_PACKET_SIZE >> 4));
884 }
885 ste_init_locked(sc);

--- 418 unchanged lines hidden (view full) ---

1304
1305 /* Init our MAC address */
1306 for (i = 0; i < ETHER_ADDR_LEN; i++) {
1307 CSR_WRITE_1(sc, STE_PAR0 + i, IF_LLADDR(sc->ste_ifp)[i]);
1308 }
1309
1310 /* Init RX list */
1311 if (ste_init_rx_list(sc) == ENOBUFS) {
880 " start threshold to %d bytes\n",
881 sc->ste_tx_thresh);
882 }
883 CSR_WRITE_2(sc, STE_TX_STARTTHRESH, sc->ste_tx_thresh);
884 CSR_WRITE_2(sc, STE_TX_RECLAIM_THRESH,
885 (STE_PACKET_SIZE >> 4));
886 }
887 ste_init_locked(sc);

--- 418 unchanged lines hidden (view full) ---

1306
1307 /* Init our MAC address */
1308 for (i = 0; i < ETHER_ADDR_LEN; i++) {
1309 CSR_WRITE_1(sc, STE_PAR0 + i, IF_LLADDR(sc->ste_ifp)[i]);
1310 }
1311
1312 /* Init RX list */
1313 if (ste_init_rx_list(sc) == ENOBUFS) {
1312 if_printf(ifp,
1314 device_printf(sc->ste_dev,
1313 "initialization failed: no memory for RX buffers\n");
1314 ste_stop(sc);
1315 return;
1316 }
1317
1318 /* Set RX polling interval */
1319 CSR_WRITE_1(sc, STE_RX_DMAPOLL_PERIOD, 64);
1320

--- 143 unchanged lines hidden (view full) ---

1464 DELAY(100000);
1465
1466 for (i = 0; i < STE_TIMEOUT; i++) {
1467 if (!(CSR_READ_4(sc, STE_ASICCTL) & STE_ASICCTL_RESET_BUSY))
1468 break;
1469 }
1470
1471 if (i == STE_TIMEOUT)
1315 "initialization failed: no memory for RX buffers\n");
1316 ste_stop(sc);
1317 return;
1318 }
1319
1320 /* Set RX polling interval */
1321 CSR_WRITE_1(sc, STE_RX_DMAPOLL_PERIOD, 64);
1322

--- 143 unchanged lines hidden (view full) ---

1466 DELAY(100000);
1467
1468 for (i = 0; i < STE_TIMEOUT; i++) {
1469 if (!(CSR_READ_4(sc, STE_ASICCTL) & STE_ASICCTL_RESET_BUSY))
1470 break;
1471 }
1472
1473 if (i == STE_TIMEOUT)
1472 if_printf(sc->ste_ifp, "global reset never completed\n");
1474 device_printf(sc->ste_dev, "global reset never completed\n");
1473
1474 return;
1475}
1476
1477static int
1478ste_ioctl(ifp, command, data)
1479 struct ifnet *ifp;
1480 u_long command;

--- 267 unchanged lines hidden ---
1475
1476 return;
1477}
1478
1479static int
1480ste_ioctl(ifp, command, data)
1481 struct ifnet *ifp;
1482 u_long command;

--- 267 unchanged lines hidden ---