Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/pci



On Wednesday 05 November 2003 04:03 pm, Frank van der Linden wrote:
> Module Name:  src
> Committed By: fvdl
> Date:         Wed Nov  5 16:03:28 UTC 2003
>
> Modified Files:
>       src/sys/dev/pci: amr.c
>
> Log Message:
> Apparently, Dell PERC 4/Di controllers can have two memory BARs, with the
> second one empty. The previous revision made it pick the empty one.
> Reinstate the BAR size check.

Using PCI_MAPREG_*_SIZE() this way is definitely not correct.  It does not do 
what you expect.

I believe the attached patch is a correct "fix".  And I note that cac, mlx and 
mly all have similar code that should be adjusted.
Index: amr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/amr.c,v
retrieving revision 1.19
diff -u -r1.19 amr.c
--- amr.c       5 Nov 2003 16:03:27 -0000       1.19
+++ amr.c       16 Nov 2003 19:44:13 -0000
@@ -269,17 +269,15 @@
 
        memreg = ioreg = 0;
        for (i = 0x10; i <= 0x14; i += 4) {
-               reg = pci_conf_read(pc, pa->pa_tag, i);
+               if (pci_mapreg_probe(pc, pa->pa_tag, i, &reg) == 0)
+                       continue;
                switch (PCI_MAPREG_TYPE(reg)) {
                case PCI_MAPREG_TYPE_MEM:
-                       if (PCI_MAPREG_MEM_SIZE(reg) != 0)
-                               memreg = i;
+                       memreg = i;
                        break;
                case PCI_MAPREG_TYPE_IO:
-                       if (PCI_MAPREG_IO_SIZE(reg) != 0)
-                               ioreg = i;
+                       ioreg = i;
                        break;
-
                }
        }
 


Home | Main Index | Thread Index | Old Index