From nobody@FreeBSD.org  Tue Feb 20 13:17:38 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 7185037B491
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Feb 2001 13:17:37 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f1KLHba85256;
	Tue, 20 Feb 2001 13:17:37 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200102202117.f1KLHba85256@freefall.freebsd.org>
Date: Tue, 20 Feb 2001 13:17:37 -0800 (PST)
From: cmjensen@dohnut.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: Intel 82559 is not working behind a DEC/Intel 21152 Bridge
X-Send-Pr-Version: www-1.0

>Number:         25236
>Category:       i386
>Synopsis:       Intel 82559 is not working behind a DEC/Intel 21152 Bridge
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 20 13:20:01 PST 2001
>Closed-Date:    Mon Nov 19 02:20:44 PST 2001
>Last-Modified:  Mon Nov 19 02:21:15 PST 2001
>Originator:     Chris Jensen
>Release:        4.2-RELEASE
>Organization:
>Environment:
FreeBSD 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000 jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC i386
>Description:
The NIC simply cannot initialize.  I have not had time and am probably not the most qualified person to debug this problem.  I searched for fixes to this problem and found several people with similar 82559/21152 setups who have the same issue.  I did not find a fix, so that's why I'm posting here.  So, forgive me if there is an easy fix, but I could not find anything.

Below is the first half of the boot dump, where the problem occurs.  The NIC works without a problem in all other tested operating systems (windows, linux, SCO).


Feb 20 11:07:02  /kernel: Copyright (c) 1992-2000 The FreeBSD Project.
Feb 20 11:07:02  /kernel: Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
Feb 20 11:07:02  /kernel: The Regents of the University of California. All rights reserved.
Feb 20 11:07:02  /kernel: FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000
Feb 20 11:07:02  /kernel: jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC
Feb 20 11:07:02  /kernel: Timecounter "i8254"  frequency 1193182 Hz
Feb 20 11:07:02  /kernel: CPU: Pentium II/Pentium II Xeon/Celeron (432.25-MHz 686-class CPU)
Feb 20 11:07:02  /kernel: Origin = "GenuineIntel"  Id = 0x665  Stepping = 5
Feb 20 11:07:02  /kernel: Features=0x183fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>
Feb 20 11:07:02  /kernel: real memory  = 67108864 (65536K bytes)
Feb 20 11:07:02  /kernel: avail memory = 61083648 (59652K bytes)
Feb 20 11:07:02  /kernel: Preloaded elf kernel "kernel" at 0xc0436000.
Feb 20 11:07:02  /kernel: Pentium Pro MTRR support enabled
Feb 20 11:07:02  /kernel: md0: Malloc disk
Feb 20 11:07:02  /kernel: npx0: <math processor> on motherboard
Feb 20 11:07:02  /kernel: npx0: INT 16 interface
Feb 20 11:07:02  /kernel: pcib0: <Intel 82443BX host to PCI bridge (AGP disabled)> on motherboard
Feb 20 11:07:02  /kernel: pci0: <PCI bus> on pcib0
Feb 20 11:07:02  /kernel: pcib1: <DEC 21152 PCI-PCI bridge> at device 4.0 on pci0
Feb 20 11:07:02  /kernel: pci1: <PCI bus> on pcib1
Feb 20 11:07:02  /kernel: pci1: <Chips & Technologies 69000 SVGA controller> at 1.0 irq 10
Feb 20 11:07:02  /kernel: fxp0: <Intel Pro 10/100B/100+ Ethernet> irq 0 at device 2.0 on pci1
Feb 20 11:07:02  /kernel: fxp0: could not map memory
Feb 20 11:07:02  /kernel: device_probe_and_attach: fxp0 attach returned 6
Feb 20 11:07:03  /kernel: isab0: <Intel 82371AB PCI to ISA bridge> at device 8.0 on pci0
...
>How-To-Repeat:
Try getting an Intel 82559 ( could not try a 82557/8, the NIC is embedded ) behind a 21152 PCI-to-PCI bridge.

NOTE: The system is a PICMG standard system with a passive backplane and a single PICMG CPU card which contains all of the CPU, chipset, and peripherals.  I may be able to get/loan the FreeBSD organization a system to debug with if the problem cannot be reproduced by other means.  Please reply to me at cmjensen@dohnut.org.  Thanks.
>Fix:

>Release-Note:
>Audit-Trail:

From: Matthew Jacob <mjacob@feral.com>
To: cmjensen@dohnut.org
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: i386/25236: Intel 82559 is not working behind a DEC/Intel 21152
 Bridge
Date: Tue, 20 Feb 2001 13:33:49 -0800 (PST)

 Try these patches from -current on if_fxp (they may not patch cleanly) and see
 if setting
 
 fxp_iomap=N
 
 either at the ok prompt for the boot loader (with the 'set' command) or in
 /boot/loader.conf (where N is the bitmap of fxp's you want to configure in I/O
 space) helps.
 
 
 
 
 

From: Matthew Jacob <mjacob@feral.com>
To: cmjensen@dohnut.org
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: i386/25236: Intel 82559 is not working behind a DEC/Intel 21152
 Bridge
Date: Tue, 20 Feb 2001 13:34:11 -0800 (PST)

 > 
 > Try these patches from -current on if_fxp (they may not patch cleanly) and see
 > if setting
 > 
 > fxp_iomap=N
 > 
 > either at the ok prompt for the boot loader (with the 'set' command) or in
 > /boot/loader.conf (where N is the bitmap of fxp's you want to configure in I/O
 > space) helps.
 
 Argh:
 Index: if_fxp.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/pci/if_fxp.c,v
 retrieving revision 1.102
 retrieving revision 1.103
 diff -u -r1.102 -r1.103
 --- if_fxp.c	2001/01/19 01:59:10	1.102
 +++ if_fxp.c	2001/01/23 23:22:17	1.103
 @@ -313,8 +313,8 @@
  	int error = 0;
  	struct fxp_softc *sc = device_get_softc(dev);
  	struct ifnet *ifp;
 -	u_long val;
 -	int rid;
 +	u_int32_t val;
 +	int rid, m1, m2, ebitmap;
  
  	mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
  	callout_handle_init(&sc->stat_ch);
 @@ -322,11 +322,13 @@
  	FXP_LOCK(sc);
  
  	/*
 -	 * Enable bus mastering.
 +	 * Enable bus mastering. Enable memory space too, in case
 +	 * BIOS/Prom forgot about it.
  	 */
  	val = pci_read_config(dev, PCIR_COMMAND, 2);
  	val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
  	pci_write_config(dev, PCIR_COMMAND, val, 2);
 +	val = pci_read_config(dev, PCIR_COMMAND, 2);
  
  	if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
  		u_int32_t		iobase, membase, irq;
 @@ -349,16 +351,44 @@
  	}
  
  	/*
 -	 * Map control/status registers.
 +	 * Figure out which we should try first - memory mapping or i/o mapping?
 +	 * We default to memory mapping. Then we accept an override from the
 +	 * command line. Then we check to see which one is enabled.
  	 */
 -	rid = FXP_PCI_MMBA;
 -	sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
 -				     0, ~0, 1, RF_ACTIVE);
 +	m1 = PCIM_CMD_MEMEN;
 +	m2 = PCIM_CMD_PORTEN;
 +	ebitmap = 0;
 +	if (getenv_int("fxp_iomap", &ebitmap)) {
 +		if (ebitmap & (1 << device_get_unit(dev))) {
 +			m1 = PCIM_CMD_PORTEN;
 +			m2 = PCIM_CMD_MEMEN;
 +		}
 +	}
 +
 +	if (val & m1) {
 +		sc->rtp =
 +		    (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
 +		sc->rgd = (m1 == PCIM_CMD_MEMEN)? FXP_PCI_MMBA : FXP_PCI_IOBA;
 +		sc->mem = bus_alloc_resource(dev, sc->rtp, &sc->rgd,
 +	                                     0, ~0, 1, RF_ACTIVE);
 +	}
 +	if (sc->mem == NULL && (val & m2)) {
 +		sc->rtp =
 +		    (m2 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
 +		sc->rgd = (m2 == PCIM_CMD_MEMEN)? FXP_PCI_MMBA : FXP_PCI_IOBA;
 +		sc->mem = bus_alloc_resource(dev, sc->rtp, &sc->rgd,
 +                                            0, ~0, 1, RF_ACTIVE);
 +	}
 +
  	if (!sc->mem) {
 -		device_printf(dev, "could not map memory\n");
 +		device_printf(dev, "could not map device registers\n");
  		error = ENXIO;
  		goto fail;
          }
 +	if (bootverbose) {
 +		device_printf(dev, "using %s space register mapping\n",
 +		   sc->rtp == SYS_RES_MEMORY? "memory" : "I/O");
 +	}
  
  	sc->sc_st = rman_get_bustag(sc->mem);
  	sc->sc_sh = rman_get_bushandle(sc->mem);
 @@ -387,7 +417,7 @@
  		/* Failed! */
  		bus_teardown_intr(dev, sc->irq, sc->ih);
  		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
 -		bus_release_resource(dev, SYS_RES_MEMORY, FXP_PCI_MMBA, sc->mem);
 +		bus_release_resource(dev, sc->rtp, sc->rgd, sc->mem);
  		error = ENXIO;
  		goto fail;
  	}
 @@ -451,7 +481,7 @@
  	 */
  	bus_teardown_intr(dev, sc->irq, sc->ih);
  	bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
 -	bus_release_resource(dev, SYS_RES_MEMORY, FXP_PCI_MMBA, sc->mem);
 +	bus_release_resource(dev, sc->rtp, sc->rgd, sc->mem);
  
  	/*
  	 * Free all the receive buffers.
 Index: if_fxpvar.h
 ===================================================================
 RCS file: /home/ncvs/src/sys/pci/if_fxpvar.h,v
 retrieving revision 1.13
 retrieving revision 1.14
 diff -u -r1.13 -r1.14
 --- if_fxpvar.h	2000/09/18 21:12:19	1.13
 +++ if_fxpvar.h	2001/01/23 23:22:17	1.14
 @@ -38,6 +38,8 @@
  struct fxp_softc {
  	struct arpcom arpcom;		/* per-interface network data */
  	struct resource *mem;		/* resource descriptor for registers */
 +	int rtp;			/* register resource type */
 +	int rgd;			/* register descriptor in use */
  	struct resource *irq;		/* resource descriptor for interrupt */
  	void *ih;			/* interrupt handler cookie */
  	struct mtx sc_mtx;
 
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sun Nov 18 17:58:31 PST 2001 
State-Changed-Why:  

Does this problem still exist? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25236 
State-Changed-From-To: feedback->closed 
State-Changed-By: iedowse 
State-Changed-When: Mon Nov 19 02:20:44 PST 2001 
State-Changed-Why:  

Submitter says that the problem no longer exists. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25236 
>Unformatted:
