Current-Users archive

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

Re: Panic during agp_intel attach



Iain Hibbert wrote:
> Hi Andreas,
>             Did you find the correct solution to this? I just updated my
> sources and find the same trouble.. (also in PR kern/37824)
> 
>   It seems that Martin Husemann gave the most correct answer
> 
> On Mon, 21 Jan 2008 Martin Huseman wrote:
> > Check what the code does, use 0x90 and shift all values/constants
> > accordingly, if anythings shifts out (have yet to see that), use 0x94
> > and repeat.
> 
> I guess the below patch should be correct, certainly it gets through the
> KASSERT and I don't detect any misfeature by this..  can anybody with PCI
> knowledge confirm if thats ok to commit?
> 
> iain
> 
> - --- /usr/src/sys/dev/pci/agp_intel.c        2008-02-13 19:35:33.000000000 
> +0000
> +++ agp_intel.c       2008-02-15 11:37:46.000000000 +0000
> @@ -264,7 +264,7 @@
> 
>       default:
>               pci_conf_write(sc->as_pc, sc->as_tag,
> - -                   AGP_INTEL_ERRSTS, 0x70);
> +                     AGP_INTEL_ERRSTS, 0x7000);
>       }
> 
>       return (0);
> - --- /usr/src/sys/dev/pci/agpreg.h   2008-02-13 19:35:33.000000000 +0000
> +++ agpreg.h  2008-02-15 11:53:36.000000000 +0000
> @@ -59,7 +59,7 @@
>  #define      AGP_INTEL_I8XX_ERRSTS   0xc8
> 
>  /* Common register */
> - -#define    AGP_INTEL_ERRSTS        0x91    /* Not i8XX */
> +#define      AGP_INTEL_ERRSTS        0x90    /* Not i8XX */
>  #define AGP_INTEL_AGPCMD     0xa8
>  # define AGPCMD_SBA          (1U << 9)
>  # define AGPCMD_AGPEN                (1U << 8)

I have been meaning to commit the following change, which I think is
more consistent with the register naming in the Intel 82442BX data
sheet which calls the 8-bit register at 0x90 ERRCMD and the 16-bit
register at 0x91 ERRSTS, and safer in that it won't have the side
effect of clearing any bits that happen to be set in the ERRCMD
register.

Index: agp_intel.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/agp_intel.c,v
retrieving revision 1.27
diff -u -r1.27 agp_intel.c
--- agp_intel.c 4 Jan 2008 21:18:00 -0000       1.27
+++ agp_intel.c 15 Feb 2008 12:13:33 -0000
@@ -263,8 +263,11 @@
                break;
 
        default:
-               pci_conf_write(sc->as_pc, sc->as_tag,
-                       AGP_INTEL_ERRSTS, 0x70);
+               {
+               reg = pci_conf_read(sc->as_pc, sc->as_tag, AGP_INTEL_ERRSTS - 
1);
+               reg |= 0x7000;
+               pci_conf_write(sc->as_pc, sc->as_tag, AGP_INTEL_ERRSTS - 1, 
reg);
+               }
        }
 
        return (0);

-- 
Andreas Gustafsson, gson%gson.org@localhost


Home | Main Index | Thread Index | Old Index