Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hostb(4) and vgapci(4) patch

6 views
Skip to first unread message

John Baldwin

unread,
Dec 14, 2005, 5:22:35 PM12/14/05
to cur...@freebsd.org, anh...@freebsd.org
I have a patch that is an attempt to untangle a few things in relation to
Host-PCI bridges and VGA PCI devices. Basically, the change is to create a
more "real" hostb driver as well as a new vgapci driver and to change agp,
drm, and acpi_video to attach to these drivers. This means among other
things:

- In theory you can now kldload agp after boot since it still has a place to
attach to.
- i830/915 drm is no longer a child of agp, instead both become children of
vgapci0.
- You can now use acpi_video with drm as both attach as children of vgapci0.
- This provides a way for us to possibly solve the DPMS problem for
suspend/resume (including a cleaner way to do the hack dpms patch I posted to
acpi@ a long while ago that several people still use).

Some other details include:

- agp devices no longer map the _entire_ aperture into contiguous KVA meaning
that it might be possible now to use a 256 MB aperture without panicing
- I've added a new pci_if.m method for locating a specific capability for a
PCI device.

I have tested this on my laptop and verified that dri still works, but it
needs some wider testing, especially the i830/i915 case is slightly more
complicated. Also, this is not going to work with the nvidia-driver
currently, but that's something that can be fixed in the future. If the agp
non-mapping does fix the 256 MB aperture issues then I will probably MFC that
part to RELENG_6.

http://www.FreeBSD.org/~jhb/patches/agp_cvs.patch

--
John Baldwin <j...@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
_______________________________________________
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-curre...@freebsd.org"

Eric Anderson

unread,
Dec 14, 2005, 10:34:44 PM12/14/05
to John Baldwin, anh...@freebsd.org, cur...@freebsd.org
John Baldwin wrote:

cc -c -O2 -pipe -fno-strict-aliasing -march=pentiumpro -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual
-fformat-extensions -std=c99 -g -nostdinc -I- -I. -I/usr/src/sys
-I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS
-include opt_global.h -fno-common -finline-limit=8000 --param
inline-unit-growth=100 --param large-function-growth=1000
-mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx
-mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -Werror
/usr/src/sys/pci/agp_i810.c
/usr/src/sys/pci/agp_i810.c: In function `agp_i810_detach':
/usr/src/sys/pci/agp_i810.c:463: warning: unused variable `child'
*** Error code 1

Stop in /usr/obj/usr/src/sys/NEUTRINO.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.


7.0-CURRENT #48: Tue Dec 13 08:47:11 CST 2005

Anything else you would like?

Eric

--
------------------------------------------------------------------------
Eric Anderson Sr. Systems Administrator Centaur Technology
Anything that works is better than anything that doesn't.
------------------------------------------------------------------------

Anish Mistry

unread,
Dec 15, 2005, 12:32:06 AM12/15/05
to John Baldwin, freebsd...@freebsd.org
Thank you! It seems to work as advertised. I'm running mach64 DRM
with the DPMS patch acpi_video and they both work. :)
One small problem though. When I unload the acpi_video module and
reload it I get the following:
littleguy# kldload acpi_video
acpi_video0: <ACPI video extension> on vgapci0
acpi_video1: <ACPI video extension> on vgapci0
littleguy# kldunload acpi_video
acpi_video0: detached
acpi_video1: detached
littleguy# kldunload acpi_video
kldunload: can't find file acpi_video: No such file or directory
littleguy# kldload acpi_video
acpi_video0: <ACPI video extension> on vgapci0
acpi_video1: <ACPI video extension> on vgapci0
acpi_video2: <ACPI video extension> on vgapci0
littleguy#
It also created multiple sysctls with subsequent loads:
hw.acpi.video.crt0.active: 1
hw.acpi.video.lcd0.active: 1
hw.acpi.video.tv0.active: 0
hw.acpi.video.crt1.active: 1
hw.acpi.video.lcd1.active: 1
hw.acpi.video.tv1.active: 0
hw.acpi.video.crt2.active: 1
hw.acpi.video.lcd2.active: 1
hw.acpi.video.tv2.active: 0


--
Anish Mistry

John Baldwin

unread,
Dec 15, 2005, 1:06:58 PM12/15/05
to Anish Mistry, freebsd...@freebsd.org

Ok, I can work around that for now. There really should be a
driver_unidentify routine that gets called during bus_generic_detach() to
clean these up.

--
John Baldwin <j...@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org

John Baldwin

unread,
Dec 15, 2005, 1:08:55 PM12/15/05
to Eric Anderson, anh...@freebsd.org, cur...@freebsd.org

If you delete this line to fix the warning does it work ok?

--
John Baldwin <j...@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org

Eric Anderson

unread,
Dec 15, 2005, 2:42:58 PM12/15/05
to John Baldwin, anh...@freebsd.org, cur...@freebsd.org
John Baldwin wrote:

Yep - I'll report anything else I see.

Thanks!
Eric

--
------------------------------------------------------------------------
Eric Anderson Sr. Systems Administrator Centaur Technology
Anything that works is better than anything that doesn't.
------------------------------------------------------------------------

_______________________________________________

John Baldwin

unread,
Dec 15, 2005, 4:32:08 PM12/15/05
to Anish Mistry, freebsd...@freebsd.org
On Thursday 15 December 2005 12:32 am, Anish Mistry wrote:

Revert just the changes to acpi_video.c and then apply the attached patch to
see if it fixes the multiple load issue.

agp_acpi.patch

Anish Mistry

unread,
Dec 15, 2005, 9:32:22 PM12/15/05
to John Baldwin, freebsd...@freebsd.org
Yes. The patch corrects the problem.

Thanks,

--
Anish Mistry

Ulrich Spoerlein

unread,
Dec 16, 2005, 6:19:50 AM12/16/05
to John Baldwin, cur...@freebsd.org
John Baldwin wrote:
> I have a patch that is an attempt to untangle a few things in relation to
> Host-PCI bridges and VGA PCI devices. Basically, the change is to create a
> more "real" hostb driver as well as a new vgapci driver and to change agp,
> drm, and acpi_video to attach to these drivers. This means among other
> things:
>
> - You can now use acpi_video with drm as both attach as children of vgapci0.
>
> http://www.FreeBSD.org/~jhb/patches/agp_cvs.patch

Hi,

I'm eager to try this patch on RELENG_6 with a Radeon Mobility card,
however the patch wont compile on RELENG_6. Could you please provide a
diff against RELENG_6? That would be great, thanks!

/usr/src/sys/dev/pci/pci.c: In function `pci_find_extcap_method':
/usr/src/sys/dev/pci/pci.c:509: error: `PCIR_CAP_PTR_2' undeclared (first use in this function)
/usr/src/sys/dev/pci/pci.c:509: error: (Each undeclared identifier is reported only once
/usr/src/sys/dev/pci/pci.c:509: error: for each function it appears in.)

Ulrich Spoerlein
--
PGP Key ID: F0DB9F44 Encrypted mail welcome!
Fingerprint: F1CE D062 0CA9 ADE3 349B 2FE8 980A C6B5 F0DB 9F44
Ok, which part of "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."
didn't you understand?

John Baldwin

unread,
Dec 16, 2005, 3:23:38 PM12/16/05
to Anish Mistry, freebsd...@freebsd.org

Actually, can you try a simpler one just to be sure? Thanks.

agp_acpi.patch

John Baldwin

unread,
Dec 16, 2005, 3:25:31 PM12/16/05
to Ulrich Spoerlein, cur...@freebsd.org
On Friday 16 December 2005 06:18 am, Ulrich Spoerlein wrote:
> John Baldwin wrote:
> > I have a patch that is an attempt to untangle a few things in relation to
> > Host-PCI bridges and VGA PCI devices. Basically, the change is to create
> > a more "real" hostb driver as well as a new vgapci driver and to change
> > agp, drm, and acpi_video to attach to these drivers. This means among
> > other things:
> >
> > - You can now use acpi_video with drm as both attach as children of
> > vgapci0.
> >
> > http://www.FreeBSD.org/~jhb/patches/agp_cvs.patch
>
> Hi,
>
> I'm eager to try this patch on RELENG_6 with a Radeon Mobility card,
> however the patch wont compile on RELENG_6. Could you please provide a
> diff against RELENG_6? That would be great, thanks!
>
> /usr/src/sys/dev/pci/pci.c: In function `pci_find_extcap_method':
> /usr/src/sys/dev/pci/pci.c:509: error: `PCIR_CAP_PTR_2' undeclared (first
> use in this function) /usr/src/sys/dev/pci/pci.c:509: error: (Each
> undeclared identifier is reported only once /usr/src/sys/dev/pci/pci.c:509:
> error: for each function it appears in.)

Hmm, for now I want to get it working against 7.0. I will probably not be
able to MFC much of it at all (perhaps the one part to stop mapping the AGP
aperture into KVA) since it would break existing agp and drm drivers for 6.x.

--
John Baldwin <j...@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org

Anish Mistry

unread,
Dec 16, 2005, 4:12:22 PM12/16/05
to John Baldwin, freebsd...@freebsd.org
I just enabled witness for my previous problem and got LOR #155, but
the lines numbers are slightly different, probably just normal
updates. I tried to reproduce it with the old patch, but I couldn't.
So it seems that something else triggered it during the kldunload.

The current patch works fine.

--
Anish Mistry

0 new messages