Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Oct 1995 23:59:18 +0100
From:      se@zpr.uni-koeln.de (Stefan Esser)
To:        current@freebsd.org
Subject:   PCI probe code
Message-ID:  <199510162259.AA17189@Sysiphos>

next in thread | raw e-mail | index | archive | help
Well, this is another try to get at least a few reports 
on the performance of the PCI probe code in -current.
I really would like to get that version into 2.1R, if 
there is evidence it works on all kinds of system ...

The last time I asked for your help, I got a surprising
number of 0 responses, all of them quite interesting :)


The code that cureently is in the 2.1 branch is known 
to fail on ONE non-PCI system, which happens to have a 
register just at the place where the PCI specs put the 
main configuration address register ... :(

I've put a modified version into -current, which works
on that system, but I've been making a (IMO) reasonable 
assumption: The PCI bus is in the "normal" working state,
and not setup to generate configuration space cycles.


If you are running -stable and want to try the new code,
then you'll find the patch appended below. It's mostly 
indentation that changed, BTW :)


Now I really would like to know whether this code does the 
right thing. It should be more cautious to not mess around 
with some non-PCI system. But it might fail to probe the 
PCI bus, in case the BIOS did some configuration and did not 
bother to lock the PCI bus against accidential configuration 
accesses ...


Please do the following the next time you reboot your 
-current system:

Boot with the "-v" option.

If the system starts up, send 'dmesg' output to my 
address: <se@zpr.uni-koeln.de>

If there really should be a system that fails to boot,
then I'd really like to know the chip set brand and model, 
and those lines from the boot message, that start with a
"pcibus_setip()" label ...


Please do me the favour and do this simple test. There is 
no risk of data corruption or other bad things happening.

Just reboot /kernel.old in case the probe fails on your
system and let me know ...



Thanks a lot in advance for your help !

Stefan

Index: /sys/i386/isa/pcibus.c
===================================================================
RCS file: /usr/cvs/src/sys/i386/isa/pcibus.c,v
retrieving revision 1.8.4.3
diff -C2 -r1.8.4.3 pcibus.c
*** 1.8.4.3	1995/10/10 01:00:58
--- pcibus.c	1995/10/16 11:13:50
***************
*** 148,152 ****
  #define CONF1_ENABLE_CHK   0x80000000ul
  #define CONF1_ENABLE_CHK1  0xFF000001ul
! #define CONF1_ENABLE_MSK1  0x80000000ul
  #define CONF1_ENABLE_RES1  0x80000000ul
  
--- 148,152 ----
  #define CONF1_ENABLE_CHK   0x80000000ul
  #define CONF1_ENABLE_CHK1  0xFF000001ul
! #define CONF1_ENABLE_MSK1  0x80000001ul
  #define CONF1_ENABLE_RES1  0x80000000ul
  
***************
*** 182,210 ****
  pcibus_setup (void)
  {
! 	unsigned long mode1res,oldval;
! 	unsigned char mode2res;
  
! 	oldval = inl (CONF1_ADDR_PORT);
! 	outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
! 	outb (CONF2_ENABLE_PORT, CONF2_ENABLE_CHK);
! 	mode1res = inl(CONF1_ADDR_PORT);
! 	mode2res = inb(CONF2_ENABLE_PORT);
! 	outb (CONF2_ENABLE_PORT, 0);
! 	outl (CONF1_ADDR_PORT, oldval);
  
  	if (bootverbose) {
! 		printf ("pcibus_setup(1):\tmode1res=0x%08lx (0x%08lx), "
! 			"mode2res=0x%02x (0x%02x)\n",
! 			mode1res,CONF1_ENABLE_CHK,
! 			(int)mode2res,CONF2_ENABLE_CHK);
! 	}
! 
! 	/*---------------------------------------
! 	**	No PCI, if neither mode1res nor mode2res could be read back
! 	**---------------------------------------
! 	*/
! 
! 	if ((mode1res != CONF1_ENABLE_CHK) && (mode2res != CONF2_ENABLE_CHK)) {
! 		return;
  	}
  
--- 182,192 ----
  pcibus_setup (void)
  {
! 	unsigned long mode1res,oldval1;
! 	unsigned char mode2res,oldval2;
  
! 	oldval1 = inl (CONF1_ADDR_PORT);
  
  	if (bootverbose) {
! 		printf ("pcibus_setup(1):\tmode1 addr port (0x0cf8) is 0x%08lx\n", oldval1);
  	}
  
***************
*** 214,247 ****
  	*/
  
! 	pci_mechanism = 1;
! 	pci_maxdevice = 32;
  
! 	outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
! 	outb (CONF1_ADDR_PORT +3, 0);
! 	mode1res = inl (CONF1_ADDR_PORT);
! 	outl (CONF1_ADDR_PORT, oldval);
! 
! 	if (bootverbose)
! 		printf ("pcibus_setup(2):\tmode1res=0x%08lx (0x%08lx)\n", 
! 			mode1res, CONF1_ENABLE_CHK);
! 
! 	if (mode1res) {
! 		if (pcibus_check()) 
! 			return;
! 	};
! 
! 	outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK1);
! 	outl (CONF1_DATA_PORT, 0);
! 	mode1res = inl(CONF1_ADDR_PORT);
! 	outl (CONF1_ADDR_PORT, oldval);
! 
! 	if (bootverbose)
! 		printf ("pcibus_setup(3):\tmode1res=0x%08lx (0x%08lx)\n", 
! 			mode1res, CONF1_ENABLE_CHK1);
! 
! 	if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) {
! 		if (pcibus_check()) 
! 			return;
! 	};
  
  	/*---------------------------------------
--- 196,231 ----
  	*/
  
! 	if ((oldval1 & CONF1_ENABLE) == 0) {
! 
! 		pci_mechanism = 1;
! 		pci_maxdevice = 32;
  
! 		outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
! 		outb (CONF1_ADDR_PORT +3, 0);
! 		mode1res = inl (CONF1_ADDR_PORT);
! 		outl (CONF1_ADDR_PORT, oldval1);
! 
! 		if (bootverbose)
! 		    printf ("pcibus_setup(1a):\tmode1res=0x%08lx (0x%08lx)\n", 
! 			    mode1res, CONF1_ENABLE_CHK);
! 
! 		if (mode1res) {
! 			if (pcibus_check()) 
! 				return;
! 		};
! 
! 		outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK1);
! 		mode1res = inl(CONF1_ADDR_PORT);
! 		outl (CONF1_ADDR_PORT, oldval1);
! 
! 		if (bootverbose)
! 		    printf ("pcibus_setup(1b):\tmode1res=0x%08lx (0x%08lx)\n", 
! 			    mode1res, CONF1_ENABLE_CHK1);
! 
! 		if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) {
! 			if (pcibus_check()) 
! 				return;
! 		};
! 	}
  
  	/*---------------------------------------
***************
*** 250,261 ****
  	*/
  
! 	if (bootverbose)
! 		printf ("pcibus_setup(4):\tnow trying mechanism 2\n");
  
! 	pci_mechanism = 2;
! 	pci_maxdevice = 16;
  
! 	if (pcibus_check()) 
! 	    return;
  
  	/*---------------------------------------
--- 234,264 ----
  	*/
  
! 	oldval2 = inb (CONF2_ENABLE_PORT);
! 
! 	if (bootverbose) {
! 		printf ("pcibus_setup(2):\tmode 2 enable port (0x0cf8) is 0x%02x\n", oldval2);
! 	}
  
! 	if ((oldval2 & 0xf0) == 0) {
  
! 		pci_mechanism = 2;
! 		pci_maxdevice = 16;
! 			
! 		outb (CONF2_ENABLE_PORT, CONF2_ENABLE_CHK);
! 		mode2res = inb(CONF2_ENABLE_PORT);
! 		outb (CONF2_ENABLE_PORT, oldval2);
! 
! 		if (bootverbose)
! 		    printf ("pcibus_setup(2a):\tmode2res=0x%02x (0x%02x)\n", 
! 			    mode2res, CONF2_ENABLE_CHK);
! 
! 		if (mode2res == CONF2_ENABLE_RES) {
! 		    if (bootverbose)
! 			printf ("pcibus_setup(2a):\tnow trying mechanism 2\n");
! 
! 			if (pcibus_check()) 
! 				return;
! 		}
! 	}
  
  	/*---------------------------------------

-- 
 Stefan Esser, Zentrum fuer Paralleles Rechnen		Tel:	+49 221 4706021
 Universitaet zu Koeln, Weyertal 80, 50931 Koeln	FAX:	+49 221 4705160
 ==============================================================================
 http://www.zpr.uni-koeln.de/staff/esser/esser.html	  <se@ZPR.Uni-Koeln.DE>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510162259.AA17189>