Wed Jun 11 13:15:44 2014 UTC ()
Fix sense of conditional for GTTMMADR size.


(riastradh)
diff -r1.86 -r1.87 src/sys/dev/pci/agp_i810.c

cvs diff -r1.86 -r1.87 src/sys/dev/pci/agp_i810.c (expand / switch to unified diff)

--- src/sys/dev/pci/agp_i810.c 2014/06/10 22:02:58 1.86
+++ src/sys/dev/pci/agp_i810.c 2014/06/11 13:15:44 1.87
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: agp_i810.c,v 1.86 2014/06/10 22:02:58 riastradh Exp $ */ 1/* $NetBSD: agp_i810.c,v 1.87 2014/06/11 13:15:44 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000 Doug Rabson 4 * Copyright (c) 2000 Doug Rabson
5 * Copyright (c) 2000 Ruslan Ermilov 5 * Copyright (c) 2000 Ruslan Ermilov
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 * 28 *
29 * $FreeBSD$ 29 * $FreeBSD$
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.86 2014/06/10 22:02:58 riastradh Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.87 2014/06/11 13:15:44 riastradh Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/malloc.h> 37#include <sys/malloc.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/proc.h> 39#include <sys/proc.h>
40#include <sys/device.h> 40#include <sys/device.h>
41#include <sys/conf.h> 41#include <sys/conf.h>
42#include <sys/xcall.h> 42#include <sys/xcall.h>
43 43
44#include <dev/pci/pcivar.h> 44#include <dev/pci/pcivar.h>
45#include <dev/pci/pcireg.h> 45#include <dev/pci/pcireg.h>
46#include <dev/pci/pcidevs.h> 46#include <dev/pci/pcidevs.h>
@@ -474,32 +474,32 @@ agp_i810_attach(device_t parent, device_ @@ -474,32 +474,32 @@ agp_i810_attach(device_t parent, device_
474 * of VGA chip registers 474 * of VGA chip registers
475 */ 475 */
476 agp_i810_vga_regbase = mmadr; 476 agp_i810_vga_regbase = mmadr;
477 agp_i810_vga_bsh = isc->bsh; 477 agp_i810_vga_bsh = isc->bsh;
478 478
479 /* Initialize the chipset. */ 479 /* Initialize the chipset. */
480 error = agp_i810_init(sc); 480 error = agp_i810_init(sc);
481 if (error) 481 if (error)
482 goto fail3; 482 goto fail3;
483 483
484 /* Map the GTT, from either part of the MMIO region or its own BAR. */ 484 /* Map the GTT, from either part of the MMIO region or its own BAR. */
485 if (gtt_bar == 0) { 485 if (gtt_bar == 0) {
486 isc->gtt_bst = isc->bst; 486 isc->gtt_bst = isc->bst;
487 if (isc->gtt_size < (mmadr_size - gtt_off)) { 487 if ((mmadr_size - gtt_off) < isc->gtt_size) {
488 aprint_error_dev(self, "GTTMMADR too small for GTT" 488 aprint_error_dev(self, "GTTMMADR too small for GTT"
489 ": %"PRIxMAX" < (%"PRIxMAX" - %"PRIxMAX")\n", 489 ": (%"PRIxMAX" - %"PRIxMAX") < %"PRIxMAX"\n",
490 (uintmax_t)isc->gtt_size, 
491 (uintmax_t)mmadr_size, 490 (uintmax_t)mmadr_size,
492 (uintmax_t)gtt_off); 491 (uintmax_t)gtt_off,
 492 (uintmax_t)isc->gtt_size);
493 error = ENXIO; 493 error = ENXIO;
494 goto fail4; 494 goto fail4;
495 } 495 }
496 error = bus_space_map(isc->gtt_bst, (mmadr + gtt_off), 496 error = bus_space_map(isc->gtt_bst, (mmadr + gtt_off),
497 isc->gtt_size, mmadr_flags, &isc->gtt_bsh); 497 isc->gtt_size, mmadr_flags, &isc->gtt_bsh);
498 if (error) { 498 if (error) {
499 aprint_error_dev(self, "can't map GTT: %d\n", error); 499 aprint_error_dev(self, "can't map GTT: %d\n", error);
500 error = ENXIO; 500 error = ENXIO;
501 goto fail4; 501 goto fail4;
502 } 502 }
503 } else { 503 } else {
504 bus_size_t gtt_bar_size; 504 bus_size_t gtt_bar_size;
505 /* 505 /*