From owner-freebsd-i386@FreeBSD.ORG Sat Aug 21 08:10:19 2004 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6488316A4CE for ; Sat, 21 Aug 2004 08:10:19 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 40AAD43D1D for ; Sat, 21 Aug 2004 08:10:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i7L8AJpo071746 for ; Sat, 21 Aug 2004 08:10:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i7L8AJQj071742; Sat, 21 Aug 2004 08:10:19 GMT (envelope-from gnats) Date: Sat, 21 Aug 2004 08:10:19 GMT Message-Id: <200408210810.i7L8AJQj071742@freefall.freebsd.org> To: freebsd-i386@FreeBSD.org From: Eric Anholt Subject: Re: i386/59854 X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Eric Anholt List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2004 08:10:19 -0000 The following reply was made to PR i386/59854; it has been noted by GNATS. From: Eric Anholt To: gnats Cc: green@FreeBSD.org Subject: Re: i386/59854 Date: Sat, 21 Aug 2004 01:02:02 -0700 --=-jFP6IGiskqaP/oBwf8Wv Content-Type: text/plain Content-Transfer-Encoding: 7bit Attached is a patch that may help with AMD AGP issues. It was improperly handling aperture sizes of 512M or higher, and the shutdown function (called as part of rebooting) may have been broken enough to confuse the hardware. If people could give it a try and tell me if it improves the situation at all, that would be great. I'm still doubtful it'll fix this PR, but it's a step. -- Eric Anholt eta@lclark.edu http://people.freebsd.org/~anholt/ anholt@FreeBSD.org --=-jFP6IGiskqaP/oBwf8Wv Content-Disposition: attachment; filename=agp-amd.diff Content-Type: text/x-patch; name=agp-amd.diff; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Index: agp_amd.c =================================================================== RCS file: /home/ncvs/src/sys/pci/agp_amd.c,v retrieving revision 1.21 diff -u -u -r1.21 agp_amd.c --- agp_amd.c 16 Aug 2004 12:23:53 -0000 1.21 +++ agp_amd.c 21 Aug 2004 07:48:31 -0000 @@ -269,6 +269,12 @@ /* Enable the TLB and flush */ WRITE2(AGP_AMD751_STATUS, READ2(AGP_AMD751_STATUS) | AGP_AMD751_STATUS_GCE); + + /* Setting bit 0 is required for the size to be valid. */ + pci_write_config(dev, + AGP_AMD751_APCTRL, + pci_read_config(dev, AGP_AMD751_APCTRL, 1) | 1, 1); + AGP_FLUSH_TLB(dev); return 0; @@ -313,7 +319,7 @@ /* * The aperture size is equal to 32M<> 1; + vas = (pci_read_config(dev, AGP_AMD751_APCTRL, 1) & 0x0e) >> 1; return (32*1024*1024) << vas; } @@ -321,6 +327,7 @@ agp_amd_set_aperture(device_t dev, u_int32_t aperture) { int vas; + u_int32_t apctrl; /* * Check for a power of two and make sure its within the @@ -331,15 +338,15 @@ || aperture > 2U*1024*1024*1024) return EINVAL; - vas = ffs(aperture / 32*1024*1024) - 1; + vas = ffs(aperture / (32*1024*1024)) - 1; /* * While the size register is bits 1-3 of APCTRL, bit 0 must be * set for the size value to be 'valid' */ + apctrl = pci_read_config(dev, AGP_AMD751_APCTRL, 1); pci_write_config(dev, AGP_AMD751_APCTRL, - (((pci_read_config(dev, AGP_AMD751_APCTRL, 1) & ~0x06) - | ((vas << 1) | 1))), 1); + (apctrl & ~0x0e) | (vas << 1) | 1, 1); return 0; } --=-jFP6IGiskqaP/oBwf8Wv--