Re: netdde not detecting cards

2012-07-06 Thread Barry deFreese
On 7/6/2012 12:10 AM, Samuel Thibault wrote:
> Hello,
> 
> To people who were having problems of network card detection with
> netdde, I've found that it was hardcoded that only bus 0 and 2 were
> probed for.  The attached patch should probe for all buses, and
> probably fix the issue you were having. Check your lspci output, if it
> looked like
> 
> 03:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network
> Connection (rev 04)
> 
> i.e. first number for the network board is neither 00 nor 02, then
> it's normal that netdde was not finding your card. You can apply the
> attached patch to the hurd package, install it, and rebuild netdde, or
> just wait for the next hurd+netdde upload, or CD image build.
> 
> Samuel
> 

Rockin', I will see if I can try this tonight.  Thanks Samuel!!

Barry




netdde not detecting cards

2012-07-05 Thread Samuel Thibault
Hello,

To people who were having problems of network card detection with
netdde, I've found that it was hardcoded that only bus 0 and 2 were
probed for.  The attached patch should probe for all buses, and
probably fix the issue you were having. Check your lspci output, if it
looked like

03:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network
Connection (rev 04)

i.e. first number for the network board is neither 00 nor 02, then
it's normal that netdde was not finding your card. You can apply the
attached patch to the hurd package, install it, and rebuild netdde, or
just wait for the next hurd+netdde upload, or CD image build.

Samuel
diff --git a/libdde_linux26/lib/src/arch/l4/pci.c 
b/libdde_linux26/lib/src/arch/l4/pci.c
index c393fd3..b50a735 100644
--- a/libdde_linux26/lib/src/arch/l4/pci.c
+++ b/libdde_linux26/lib/src/arch/l4/pci.c
@@ -24,10 +24,6 @@ typedef struct l4dde_pci_dev {
 /** List of Linux-DDEKit PCIDev mappings */
 static LIST_HEAD(pcidev_mappings);
 
-/** PCI bus */
-static struct pci_bus *pci_bus = NULL;
-static struct pci_bus *pci_bus1 = NULL;
-
 static int l4dde26_pci_read(struct pci_bus *bus, unsigned int devfn, int 
where, int size, u32 *val);
 static int l4dde26_pci_write(struct pci_bus *bus, unsigned int devfn, int 
where, int size, u32 val);
 
@@ -187,18 +183,21 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 void __init l4dde26_init_pci(void)
 {
ddekit_pci_init();
-
-   // TODO it's a temporary solution to handle 2 buses.
-   // we need to find a way to detect buses.
-   pci_bus = pci_create_bus(NULL, 0, &dde_pcibus_ops, NULL);
-   Assert(pci_bus);
-
-   pci_do_scan_bus(pci_bus);
-
-   pci_bus1 = pci_create_bus(NULL, 2, &dde_pcibus_ops, NULL);
-   Assert(pci_bus1);
-
-   pci_do_scan_bus(pci_bus1);
+   int nr;
+   char found[256] = { };
+   int bus, slot, func;
+
+   for (nr = 0; ; nr++) {
+   if (ddekit_pci_get_device(nr, &bus, &slot, &func) != 0)
+   break;
+   if (!found[bus]) {
+   struct pci_bus *pci_bus = pci_create_bus(NULL, bus, 
&dde_pcibus_ops, NULL);
+   Assert(pci_bus);
+   pci_do_scan_bus(pci_bus);
+
+   found[bus] = 1;
+   }
+   }
 
INITIALIZE_INITVAR(dde26_pci);
 }