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 683</b> <span style="font-size: smaller;"> cbb_print_config(device_t dev)</span></td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" border="1" cellpadding="5">
<tbody>
<tr>
<td><b>Line 683</b> <span style="font-size: smaller;"> cbb_print_config(device_t dev)</span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="diff-same"> static int</td>
<td class="diff-same"> static int</td>
</tr>
<tr>
<td class="diff-same"> cbb_attach(device_t brdev)</td>
<td class="diff-same"> cbb_attach(device_t brdev)</td>
</tr>
<tr>
<td class="diff-same"> {</td>
<td class="diff-same"> {</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> static int curr_bus_number = 1;
/* XXX EVILE BAD (see below) */</td>
</tr>
<tr>
<td class="diff-same"> struct cbb_softc *sc = (struct
cbb_softc *)device_get_softc(brdev);</td>
<td class="diff-same"> struct cbb_softc *sc = (struct
cbb_softc *)device_get_softc(brdev);</td>
</tr>
<tr>
<td class="diff-changed"> int rid;</td>
<td class="diff-changed"> int rid, bus, pribus;</td>
</tr>
<tr>
<td class="diff-changed-missing"> </td>
<td class="diff-changed"> device_t parent;</td>
</tr>
<tr>
<td class="diff-same"> </td>
<td class="diff-same"> </td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> parent = device_get_parent(brdev);</td>
</tr>
<tr>
<td class="diff-same"> mtx_init(&sc->mtx,
device_get_nameunit(brdev), "cbb", MTX_DEF);</td>
<td class="diff-same"> mtx_init(&sc->mtx,
device_get_nameunit(brdev), "cbb", MTX_DEF);</td>
</tr>
<tr>
<td class="diff-same"> cv_init(&sc->cv, "cbb cv");</td>
<td class="diff-same"> cv_init(&sc->cv, "cbb cv");</td>
</tr>
<tr>
<td class="diff-same"> sc->chipset =
cbb_chipset(pci_get_devid(brdev), NULL);</td>
<td class="diff-same"> sc->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 758</b> <span style="font-size: smaller;"> cbb_attach(device_t brdev)</span></td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" border="1" cellpadding="5">
<tbody>
<tr>
<td><b>Line 761</b> <span style="font-size: smaller;"> cbb_attach(device_t brdev)</span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="diff-same"> sc->exca.flags |=
EXCA_HAS_MEMREG_WIN;</td>
<td class="diff-same"> sc->exca.flags |=
EXCA_HAS_MEMREG_WIN;</td>
</tr>
<tr>
<td class="diff-same"> sc->exca.chipset = EXCA_CARDBUS;</td>
<td class="diff-same"> sc->exca.chipset = EXCA_CARDBUS;</td>
</tr>
<tr>
<td class="diff-same"> cbb_chipinit(sc);</td>
<td class="diff-same"> cbb_chipinit(sc);</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> </td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> /*</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> * This is a gross hack. We
should be scanning the entire pci</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> * tree, assigning bus numbers in
a way such that we (1) can</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> * reserve 1 extra bus just in
case and (2) all sub busses</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> * are in an appropriate range.</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> */</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> bus = pci_read_config(brdev,
PCIR_SECBUS_2, 1);</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> pribus = pcib_get_bus(parent);</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> DEVPRINTF((brdev, "Secondary bus
is %d\n", bus));</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> if (bus == 0) {</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> if (curr_bus_number <
pribus)</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> curr_bus_number =
pribus + 1;</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> if
(pci_read_config(brdev, PCIR_PRIBUS_2, 1) != pribus) {</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> DEVPRINTF((brdev,
"Setting primary bus to %d\n", pribus));</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added">
pci_write_config(brdev, PCIR_PRIBUS_2, pribus, 1);</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> }</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> bus = curr_bus_number;</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> DEVPRINTF((brdev,
"Secondary bus set to %d subbus %d\n", bus,</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> bus + 1));</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> sc->secbus = bus;</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> sc->subbus = bus + 1;</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> pci_write_config(brdev,
PCIR_SECBUS_2, bus, 1);</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> pci_write_config(brdev,
PCIR_SUBBUS_2, bus + 1, 1);</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> curr_bus_number += 2;</td>
</tr>
<tr>
<td class="diff-empty"> </td>
<td class="diff-added"> }</td>
</tr>
<tr>
<td class="diff-same"> </td>
<td class="diff-same"> </td>
</tr>
<tr>
<td class="diff-same"> /* attach children */</td>
<td class="diff-same"> /* attach children */</td>
</tr>
<tr>
<td class="diff-same"> sc->cbdev =
device_add_child(brdev, "cardbus", -1);</td>
<td class="diff-same"> sc->cbdev =
device_add_child(brdev, "cardbus", -1);</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--------------070308020307050204000202--
More information about the freebsd-i386
mailing list