2001-02-08 15:34:59

by Petr Vandrovec

[permalink] [raw]
Subject: 2.4.x, drm, g400 and pci_set_master

Hi,
friend of mine bought g400 on my recommendation, and unfortunately,
mga drm driver did not worked for me. I tracked it down to missing
pci_enable_device and pci_set_master in mga* driver. But even after
looking more than hour into that code I have no idea where I should
place this call, as it looks like that mga driver is completely
shielded from seeing pcidev structure :-(
Does anybody know where I should place pci_enable_device and
pci_set_master into mga code? I worked around pci_enable_device by
using matroxfb, but pci_set_master is not invoked by matroxfb, and
adding this call into matroxfb just to get mga drm driver to work does
not look correctly to me - although it is what I had done just now.
Thanks,
Petr Vandrovec
[email protected]


01:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G400 AGP (rev 04) (prog-if 00 [VGA])
Subsystem: Matrox Graphics, Inc. Millennium G400 Dual Head Max
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64 (4000ns min, 8000ns max), cache line size 08
Interrupt: pin A routed to IRQ 5
Region 0: Memory at f4000000 (32-bit, prefetchable) [size=32M]
Region 1: Memory at fcffc000 (32-bit, non-prefetchable) [size=16K]
Region 2: Memory at fc000000 (32-bit, non-prefetchable) [size=8M]
Expansion ROM at 80000000 [disabled] [size=64K]
Capabilities: [dc] Power Management version 2
Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [f0] AGP version 2.0
Status: RQ=31 SBA+ 64bit- FW- Rate=x1,x2
Command: RQ=31 SBA+ AGP+ 64bit- FW- Rate=x1


Linux version 2.4.1 (root@jenik) (gcc version 2.95.2 20000220 (Debian GNU/Linux)) #1 +t ?no 6 18:14:01 CET 2001
BIOS-provided physical RAM map:
BIOS-e820: 00000000000a0000 @ 0000000000000000 (usable)
BIOS-e820: 0000000000010000 @ 00000000000f0000 (reserved)
BIOS-e820: 000000000fe9e000 @ 0000000000100000 (usable)
BIOS-e820: 0000000000062000 @ 000000000ff9e000 (reserved)
BIOS-e820: 0000000000500000 @ 00000000ffb00000 (reserved)
BIOS-e820: 0000000000010000 @ 00000000fec00000 (reserved)
BIOS-e820: 0000000000010000 @ 00000000fee00000 (reserved)
...
Linux agpgart interface v0.99 (c) Jeff Hartmann
agpgart: Maximum main memory to use for agp memory: 203M
agpgart: Trying generic Intel routines for device id: 2500
agpgart: AGP aperture is 64M @ 0xf0000000
[drm] AGP 0.99 on Intel @ 0xf0000000 64MB
[drm] Initialized mga 2.0.1 20000928 on minor 63


2001-02-08 16:41:34

by Alex Deucher

[permalink] [raw]
Subject: Re: 2.4.x, drm, g400 and pci_set_master

I'm not sure about the mga source, but you can enable busmaster manually
as root. See the dri-devel list for more. I can't remember the exact
message off hand. THere was also some discussion of this last week I
think.

Alex


----------------------------

Hi,
friend of mine bought g400 on my recommendation, and unfortunately,
mga drm driver did not worked for me. I tracked it down to missing
pci_enable_device and pci_set_master in mga* driver. But even after
looking more than hour into that code I have no idea where I should
place this call, as it looks like that mga driver is completely
shielded from seeing pcidev structure :-(
Does anybody know where I should place pci_enable_device and
pci_set_master into mga code? I worked around pci_enable_device by
using matroxfb, but pci_set_master is not invoked by matroxfb, and
adding this call into matroxfb just to get mga drm driver to work does
not look correctly to me - although it is what I had done just now.
Thanks,
Petr Vandrovec
[email protected]

2001-02-08 17:08:48

by Jeff Hartmann

[permalink] [raw]
Subject: Re: 2.4.x, drm, g400 and pci_set_master

Alex Deucher wrote:

> I'm not sure about the mga source, but you can enable busmaster manually
> as root. See the dri-devel list for more. I can't remember the exact
> message off hand. THere was also some discussion of this last week I
> think.
>
> Alex
>
>
> ----------------------------
>
> Hi,
> friend of mine bought g400 on my recommendation, and unfortunately,
> mga drm driver did not worked for me. I tracked it down to missing
> pci_enable_device and pci_set_master in mga* driver. But even after
> looking more than hour into that code I have no idea where I should
> place this call, as it looks like that mga driver is completely
> shielded from seeing pcidev structure :-(
> Does anybody know where I should place pci_enable_device and
> pci_set_master into mga code? I worked around pci_enable_device by
> using matroxfb, but pci_set_master is not invoked by matroxfb, and
> adding this call into matroxfb just to get mga drm driver to work does
> not look correctly to me - although it is what I had done just now.
> Thanks,
> Petr Vandrovec
> [email protected]
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> Please read the FAQ at http://www.tux.org/lkml/
>

The DRM drivers don't know about the pcidev structure at all. All this
is done in the XFree86 ddx driver. You can probably add something like
this to MGAPreInit (after pMga->PciTag is set, in my copy its
mga_driver.c:1232 yours might be at a slightly different line number
depending on the version your using):

{
CARD32 temp;
temp = pciReadLong(pMga->PciTag, PCI_CMD_STAT_REG);
pciWriteLong(pMga->PciTag, PCI_CMD_STAT_REG, temp |
PCI_CMD_MASTER_ENABLE);
}

-Jeff

2001-02-08 17:18:08

by Alex Deucher

[permalink] [raw]
Subject: Re: 2.4.x, drm, g400 and pci_set_master

I wasn't talking about the drm driver I was talking about programming
the PCI controller directly using setpci 1.0.0 .... or some such
command, I can't remember off hand. Which turns on busmastering if it
is off for a particular device.

Alex

Jeff Hartmann wrote:
>
> Alex Deucher wrote:
>
> > I'm not sure about the mga source, but you can enable busmaster manually
> > as root. See the dri-devel list for more. I can't remember the exact
> > message off hand. THere was also some discussion of this last week I
> > think.
> >
> > Alex
> >
> >
> > ----------------------------
> >
> > Hi,
> > friend of mine bought g400 on my recommendation, and unfortunately,
> > mga drm driver did not worked for me. I tracked it down to missing
> > pci_enable_device and pci_set_master in mga* driver. But even after
> > looking more than hour into that code I have no idea where I should
> > place this call, as it looks like that mga driver is completely
> > shielded from seeing pcidev structure :-(
> > Does anybody know where I should place pci_enable_device and
> > pci_set_master into mga code? I worked around pci_enable_device by
> > using matroxfb, but pci_set_master is not invoked by matroxfb, and
> > adding this call into matroxfb just to get mga drm driver to work does
> > not look correctly to me - although it is what I had done just now.
> > Thanks,
> > Petr Vandrovec
> > [email protected]
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to [email protected]
> > Please read the FAQ at http://www.tux.org/lkml/
> >
>
> The DRM drivers don't know about the pcidev structure at all. All this
> is done in the XFree86 ddx driver. You can probably add something like
> this to MGAPreInit (after pMga->PciTag is set, in my copy its
> mga_driver.c:1232 yours might be at a slightly different line number
> depending on the version your using):
>
> {
> CARD32 temp;
> temp = pciReadLong(pMga->PciTag, PCI_CMD_STAT_REG);
> pciWriteLong(pMga->PciTag, PCI_CMD_STAT_REG, temp |
> PCI_CMD_MASTER_ENABLE);
> }
>
> -Jeff

2001-02-08 17:38:34

by Petr Vandrovec

[permalink] [raw]
Subject: Re: 2.4.x, drm, g400 and pci_set_master

On 8 Feb 01 at 12:15, Alex Deucher wrote:

> I wasn't talking about the drm driver I was talking about programming
> the PCI controller directly using setpci 1.0.0 .... or some such
> command, I can't remember off hand. Which turns on busmastering if it
> is off for a particular device.

OK.

> Jeff Hartmann wrote:
> >
> > The DRM drivers don't know about the pcidev structure at all. All this
> > is done in the XFree86 ddx driver. You can probably add something like
> > this to MGAPreInit (after pMga->PciTag is set, in my copy its
> > mga_driver.c:1232 yours might be at a slightly different line number
> > depending on the version your using):
> >
> > {
> > CARD32 temp;
> > temp = pciReadLong(pMga->PciTag, PCI_CMD_STAT_REG);
> > pciWriteLong(pMga->PciTag, PCI_CMD_STAT_REG, temp |
> > PCI_CMD_MASTER_ENABLE);
> > }

Jeff, do you say that drm code does not use dynamic DMA mapping, which is
specified as only busmastering interface for kernels 2.4.x, at all? Now
I understand what had one friend in the mind when he laughed when I said
that it must be easy to get it to work on Alpha...
Thanks anyway for all suggestions,
Petr Vandrovec
[email protected]

2001-02-08 17:47:35

by Jeff Hartmann

[permalink] [raw]
Subject: Re: 2.4.x, drm, g400 and pci_set_master

Petr Vandrovec wrote:

> On 8 Feb 01 at 12:15, Alex Deucher wrote:
>
>> I wasn't talking about the drm driver I was talking about programming
>> the PCI controller directly using setpci 1.0.0 .... or some such
>> command, I can't remember off hand. Which turns on busmastering if it
>> is off for a particular device.
>
>
> OK.
>
>> Jeff Hartmann wrote:
>>
>>> The DRM drivers don't know about the pcidev structure at all. All this
>>> is done in the XFree86 ddx driver. You can probably add something like
>>> this to MGAPreInit (after pMga->PciTag is set, in my copy its
>>> mga_driver.c:1232 yours might be at a slightly different line number
>>> depending on the version your using):
>>>
>>> {
>>> CARD32 temp;
>>> temp = pciReadLong(pMga->PciTag, PCI_CMD_STAT_REG);
>>> pciWriteLong(pMga->PciTag, PCI_CMD_STAT_REG, temp |
>>> PCI_CMD_MASTER_ENABLE);
>>> }
>>
>
> Jeff, do you say that drm code does not use dynamic DMA mapping, which is
> specified as only busmastering interface for kernels 2.4.x, at all? Now
> I understand what had one friend in the mind when he laughed when I said
> that it must be easy to get it to work on Alpha...
> Thanks anyway for all suggestions,
> Petr Vandrovec
> [email protected]
>
>
It does not use dynamic DMA mapping, because it doesn't do PCI DMA at
all. It uses AGP DMA. Actually, it shouldn't be too hard to get it to
work on the Alpha (just a few 32/64 bit issues probably.) Someone just
needs to get agpgart working on the Alpha, thats the big step.

-Jeff


2001-02-08 18:16:29

by Alex Deucher

[permalink] [raw]
Subject: Re: 2.4.x, drm, g400 and pci_set_master



Jeff Hartmann wrote:
>
> Petr Vandrovec wrote:
>
> > On 8 Feb 01 at 12:15, Alex Deucher wrote:
> >
> >> I wasn't talking about the drm driver I was talking about programming
> >> the PCI controller directly using setpci 1.0.0 .... or some such
> >> command, I can't remember off hand. Which turns on busmastering if it
> >> is off for a particular device.
> >
> >
> > OK.
> >
> >> Jeff Hartmann wrote:
> >>
> >>> The DRM drivers don't know about the pcidev structure at all. All this
> >>> is done in the XFree86 ddx driver. You can probably add something like
> >>> this to MGAPreInit (after pMga->PciTag is set, in my copy its
> >>> mga_driver.c:1232 yours might be at a slightly different line number
> >>> depending on the version your using):
> >>>
> >>> {
> >>> CARD32 temp;
> >>> temp = pciReadLong(pMga->PciTag, PCI_CMD_STAT_REG);
> >>> pciWriteLong(pMga->PciTag, PCI_CMD_STAT_REG, temp |
> >>> PCI_CMD_MASTER_ENABLE);
> >>> }
> >>
> >
> > Jeff, do you say that drm code does not use dynamic DMA mapping, which is
> > specified as only busmastering interface for kernels 2.4.x, at all? Now
> > I understand what had one friend in the mind when he laughed when I said
> > that it must be easy to get it to work on Alpha...
> > Thanks anyway for all suggestions,
> > Petr Vandrovec
> > [email protected]
> >
> >
> It does not use dynamic DMA mapping, because it doesn't do PCI DMA at
> all. It uses AGP DMA. Actually, it shouldn't be too hard to get it to
> work on the Alpha (just a few 32/64 bit issues probably.) Someone just
> needs to get agpgart working on the Alpha, thats the big step.
>
> -Jeff


That shouldn't be too hard since many (all?) AGP alpha boards (UP1000's
anyway) are based on the AMD 751 Northbridge? And there is already
support for that in the kernel for x86.

Alex