From owner-freebsd-current@FreeBSD.ORG Tue Nov 11 13:26:26 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 085F216A4CE; Tue, 11 Nov 2003 13:26:26 -0800 (PST) Received: from lewis.lclark.edu (lclark.edu [149.175.1.5]) by mx1.FreeBSD.org (Postfix) with SMTP id 8D24743FCB; Tue, 11 Nov 2003 13:26:24 -0800 (PST) (envelope-from eta@lclark.edu) Received: from [149.175.34.27] ([149.175.34.27]) by lewis.lclark.edu (SAVSMTP 3.1.1.32) with SMTP id M2003111113261409098 ; Tue, 11 Nov 2003 13:26:14 -0800 From: Eric Anholt To: Bjoern Fischer In-Reply-To: <20031110215053.GA2641@frolic.no-support.loc> References: <20031110215053.GA2641@frolic.no-support.loc> Content-Type: multipart/mixed; boundary="=-xFIDOydUaBg9BGT3zk1L" Message-Id: <1068585984.686.123.camel@leguin> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Tue, 11 Nov 2003 13:26:25 -0800 cc: current@freebsd.org cc: John Baldwin Subject: Re: -CURRENT and -STABLE fails on IBM R30 in agp_ali.c X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2003 21:26:26 -0000 --=-xFIDOydUaBg9BGT3zk1L Content-Type: text/plain Content-Transfer-Encoding: 7bit On Mon, 2003-11-10 at 13:50, Bjoern Fischer wrote: > Hello, > > there is a problem in ali_agp.c (both, -CURRENT and -STABLE): If I > boot the generic kernel, it panics in agp_ali.c, when it tries to > allocate memory for the gatt. Some simlpe tests showed, that the > initial aperture size is reported as zero by the device: > > static int > agp_ali_attach(device_t dev) > { > struct agp_ali_softc *sc = device_get_softc(dev); > struct agp_gatt *gatt; > int error; > > error = agp_generic_attach(dev); > if (error) > return error; > > sc->initial_aperture = AGP_GET_APERTURE(dev); > > This is zero---------------------^^^^^^ > > for (;;) { > gatt = agp_alloc_gatt(dev); > if (gatt) > break; > > /* > * Probably contigmalloc failure. Try reducing the > * aperture so that the gatt size reduces. > */ > if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) { > agp_generic_detach(dev); > return ENOMEM; > } > } > sc->gatt = gatt; > > /* Install the gatt. */ > > Since I don't have a machine ready running -CURRENT, I can't really > debug this. How can I disable agp0 on boot time? Would this be appropriate to commit to AGP, to disable the ali agp in case it reports 0 size (perhaps something in the BIOS has disabled it?) and to have agp_alloc_gatt() just fail instead of panicing in contigmalloc if the aperture size is 0? -- Eric Anholt eta@lclark.edu http://people.freebsd.org/~anholt/ anholt@FreeBSD.org --=-xFIDOydUaBg9BGT3zk1L Content-Disposition: attachment; filename=agp-alifix.diff Content-Type: text/x-patch; name=agp-alifix.diff; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Index: agp.c =================================================================== RCS file: /home/ncvs/src/sys/pci/agp.c,v retrieving revision 1.33 diff -u -r1.33 agp.c --- agp.c 23 Oct 2003 18:08:56 -0000 1.33 +++ agp.c 11 Nov 2003 20:21:08 -0000 @@ -175,6 +175,11 @@ "allocating GATT for aperture of size %dM\n", apsize / (1024*1024)); + if (entries == 0) { + device_printf(dev, "bad aperture size\n"); + return NULL; + } + gatt = malloc(sizeof(struct agp_gatt), M_AGP, M_NOWAIT); if (!gatt) return 0; Index: agp_ali.c =================================================================== RCS file: /home/ncvs/src/sys/pci/agp_ali.c,v retrieving revision 1.8 diff -u -r1.8 agp_ali.c --- agp_ali.c 22 Aug 2003 07:13:20 -0000 1.8 +++ agp_ali.c 11 Nov 2003 20:21:10 -0000 @@ -102,6 +102,10 @@ return error; sc->initial_aperture = AGP_GET_APERTURE(dev); + if (sc->initial_aperture == 0) { + device_printf(dev, "bad initial aperture size, disabling\n"); + return ENXIO; + } for (;;) { gatt = agp_alloc_gatt(dev); --=-xFIDOydUaBg9BGT3zk1L--