i386/71158: pci bus number 3 devices are missing on laptop [5.3-BETA5]

Don L. Belcher don at siad.net
Sun Oct 17 13:10:35 PDT 2004


The following reply was made to PR i386/71158; it has been noted by GNATS.

From: "Don L. Belcher" <don at siad.net>
To: freebsd-gnats-submit at FreeBSD.org
Cc:  
Subject: Re: i386/71158: pci bus number 3 devices are missing on laptop [5.3-BETA5]
Date: Sun, 17 Oct 2004 13:09:31 -0700

 This is a multi-part message in MIME format.
 --------------070308020307050204000202
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: 7bit
 
 
 
 
 By removing this change from 5.3-stable built on Oct. 17 2004 fixes the 
 problem.
 
 
       Diff for /src/sys/dev/pccbb/pccbb.c between version 1.108 and 1.109
 
 Line 683  cbb_print_config(device_t dev)
 
 	
 Line 683  cbb_print_config(device_t dev)
 
  static int 	 static int
  cbb_attach(device_t brdev) 	 cbb_attach(device_t brdev)
  { 	 {
   	         static int curr_bus_number = 1; /* XXX EVILE BAD (see below) */
          struct cbb_softc *sc = (struct cbb_softc 
 *)device_get_softc(brdev); 	         struct cbb_softc *sc = (struct 
 cbb_softc *)device_get_softc(brdev);
          int rid; 	         int rid, bus, pribus;
   	         device_t parent;
   	 
   	         parent = device_get_parent(brdev);
          mtx_init(&sc->mtx, device_get_nameunit(brdev), "cbb", 
 MTX_DEF); 	         mtx_init(&sc->mtx, device_get_nameunit(brdev), 
 "cbb", MTX_DEF);
          cv_init(&sc->cv, "cbb cv"); 	         cv_init(&sc->cv, "cbb cv");
          sc->chipset = cbb_chipset(pci_get_devid(brdev), NULL); 	        
  sc->chipset = cbb_chipset(pci_get_devid(brdev), NULL);
 Line 758  cbb_attach(device_t brdev)
 
 	
 Line 761  cbb_attach(device_t brdev)
 
          sc->exca.flags |= EXCA_HAS_MEMREG_WIN; 	         sc->exca.flags 
 |= EXCA_HAS_MEMREG_WIN;
          sc->exca.chipset = EXCA_CARDBUS; 	         sc->exca.chipset = 
 EXCA_CARDBUS;
          cbb_chipinit(sc); 	         cbb_chipinit(sc);
   	 
   	         /*
   	          * This is a gross hack.  We should be scanning the entire pci
   	          * tree, assigning bus numbers in a way such that we (1) can
   	          * reserve 1 extra bus just in case and (2) all sub busses
   	          * are in an appropriate range.
   	          */
   	         bus = pci_read_config(brdev, PCIR_SECBUS_2, 1);
   	         pribus = pcib_get_bus(parent);
   	         DEVPRINTF((brdev, "Secondary bus is %d\n", bus));
   	         if (bus == 0) {
   	                 if (curr_bus_number < pribus)
   	                         curr_bus_number = pribus + 1;
   	                 if (pci_read_config(brdev, PCIR_PRIBUS_2, 1) != 
 pribus) {
   	                         DEVPRINTF((brdev, "Setting primary bus to 
 %d\n", pribus));
   	                         pci_write_config(brdev, PCIR_PRIBUS_2, 
 pribus, 1);
   	                 }
   	                 bus = curr_bus_number;
   	                 DEVPRINTF((brdev, "Secondary bus set to %d subbus 
 %d\n", bus,
   	                     bus + 1));
   	                 sc->secbus = bus;
   	                 sc->subbus = bus + 1;
   	                 pci_write_config(brdev, PCIR_SECBUS_2, bus, 1);
   	                 pci_write_config(brdev, PCIR_SUBBUS_2, bus + 1, 1);
   	                 curr_bus_number += 2;
   	         }
   	 
          /* attach children */ 	         /* attach children */
          sc->cbdev = device_add_child(brdev, "cardbus", -1); 	        
  sc->cbdev = device_add_child(brdev, "cardbus", -1);
 
 
 
 --------------070308020307050204000202
 Content-Type: text/html; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
   <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
   <title></title>
 </head>
 <body text="#000000" bgcolor="#ffffff">
 <h3 style="text-align: center;"><br>
 </h3>
 <br>
 By removing this change from 5.3-stable built on Oct. 17 2004 fixes the
 problem.<br>
 <br>
 <h3 style="text-align: center;">Diff for /src/sys/dev/pccbb/pccbb.c
 between version 1.108 and 1.109</h3>
 <table border="0" cellspacing="0" cellpadding="0" width="100%">
   <tbody>
     <tr class="diff-heading">
       <td width="50%">
       <table width="100%" border="1" cellpadding="5">
         <tbody>
           <tr>
             <td><b>Line&nbsp;683</b>&nbsp;<span style="font-size: smaller;">&nbsp;cbb_print_config(device_t&nbsp;dev)</span></td>
           </tr>
         </tbody>
       </table>
       </td>
       <td width="50%">
       <table width="100%" border="1" cellpadding="5">
         <tbody>
           <tr>
             <td><b>Line&nbsp;683</b>&nbsp;<span style="font-size: smaller;">&nbsp;cbb_print_config(device_t&nbsp;dev)</span></td>
           </tr>
         </tbody>
       </table>
       </td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp;static int</td>
       <td class="diff-same">&nbsp;static int</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp;cbb_attach(device_t brdev)</td>
       <td class="diff-same">&nbsp;cbb_attach(device_t brdev)</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp;{</td>
       <td class="diff-same">&nbsp;{</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;static int curr_bus_number = 1;
 /* XXX EVILE BAD (see below) */</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;struct cbb_softc *sc = (struct
 cbb_softc *)device_get_softc(brdev);</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;struct cbb_softc *sc = (struct
 cbb_softc *)device_get_softc(brdev);</td>
     </tr>
     <tr>
       <td class="diff-changed">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int rid;</td>
       <td class="diff-changed">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int rid, bus, pribus;</td>
     </tr>
     <tr>
       <td class="diff-changed-missing">&nbsp;</td>
       <td class="diff-changed">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;device_t parent;</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp;</td>
       <td class="diff-same">&nbsp;</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;parent = device_get_parent(brdev);</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mtx_init(&amp;sc-&gt;mtx,
 device_get_nameunit(brdev), "cbb", MTX_DEF);</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mtx_init(&amp;sc-&gt;mtx,
 device_get_nameunit(brdev), "cbb", MTX_DEF);</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cv_init(&amp;sc-&gt;cv, "cbb cv");</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cv_init(&amp;sc-&gt;cv, "cbb cv");</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;chipset =
 cbb_chipset(pci_get_devid(brdev), NULL);</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;chipset =
 cbb_chipset(pci_get_devid(brdev), NULL);</td>
     </tr>
     <tr class="diff-heading">
       <td width="50%">
       <table width="100%" border="1" cellpadding="5">
         <tbody>
           <tr>
             <td><b>Line&nbsp;758</b>&nbsp;<span style="font-size: smaller;">&nbsp;cbb_attach(device_t&nbsp;brdev)</span></td>
           </tr>
         </tbody>
       </table>
       </td>
       <td width="50%">
       <table width="100%" border="1" cellpadding="5">
         <tbody>
           <tr>
             <td><b>Line&nbsp;761</b>&nbsp;<span style="font-size: smaller;">&nbsp;cbb_attach(device_t&nbsp;brdev)</span></td>
           </tr>
         </tbody>
       </table>
       </td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;exca.flags |=
 EXCA_HAS_MEMREG_WIN;</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;exca.flags |=
 EXCA_HAS_MEMREG_WIN;</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;exca.chipset = EXCA_CARDBUS;</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;exca.chipset = EXCA_CARDBUS;</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cbb_chipinit(sc);</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cbb_chipinit(sc);</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp;</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/*</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * This is a gross hack. &nbsp;We
 should be scanning the entire pci</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * tree, assigning bus numbers in
 a way such that we (1) can</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * reserve 1 extra bus just in
 case and (2) all sub busses</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * are in an appropriate range.</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bus = pci_read_config(brdev,
 PCIR_SECBUS_2, 1);</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pribus = pcib_get_bus(parent);</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DEVPRINTF((brdev, "Secondary bus
 is %d\n", bus));</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (bus == 0) {</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (curr_bus_number &lt;
 pribus)</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;curr_bus_number =
 pribus + 1;</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if
 (pci_read_config(brdev, PCIR_PRIBUS_2, 1) != pribus) {</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DEVPRINTF((brdev,
 "Setting primary bus to %d\n", pribus));</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp;pci_write_config(brdev, PCIR_PRIBUS_2, pribus, 1);</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bus = curr_bus_number;</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DEVPRINTF((brdev,
 "Secondary bus set to %d subbus %d\n", bus,</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bus + 1));</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;secbus = bus;</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;subbus = bus + 1;</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pci_write_config(brdev,
 PCIR_SECBUS_2, bus, 1);</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pci_write_config(brdev,
 PCIR_SUBBUS_2, bus + 1, 1);</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;curr_bus_number += 2;</td>
     </tr>
     <tr>
       <td class="diff-empty">&nbsp;</td>
       <td class="diff-added">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp;</td>
       <td class="diff-same">&nbsp;</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* attach children */</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* attach children */</td>
     </tr>
     <tr>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;cbdev =
 device_add_child(brdev, "cardbus", -1);</td>
       <td class="diff-same">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sc-&gt;cbdev =
 device_add_child(brdev, "cardbus", -1);</td>
     </tr>
   </tbody>
 </table>
 <br>
 </body>
 </html>
 
 --------------070308020307050204000202--
 


More information about the freebsd-i386 mailing list