From a1d640f23766184cc55889ba76b967f0f85ec66c Mon Sep 17 00:00:00 2001
From: Dave Jones <davej@tetrachloride.(none)>
Date: Mon, 10 Feb 2003 15:53:02 -0100
Subject: [PATCH] [AGPGART] VIA KT400 Aperture size is 12 bit in AGP3 mode.

---
 drivers/char/agp/via-kt400.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/char/agp/via-kt400.c b/drivers/char/agp/via-kt400.c
index 44a36c4b32bd..97fef32749a8 100644
--- a/drivers/char/agp/via-kt400.c
+++ b/drivers/char/agp/via-kt400.c
@@ -17,15 +17,17 @@
 static int via_fetch_size(void)
 {
 	int i;
-	u8 temp;
+	u16 temp;
 	struct aper_size_info_16 *values;
 
 	values = A_SIZE_16(agp_bridge.aperture_sizes);
-	pci_read_config_byte(agp_bridge.dev, VIA_AGP3_APSIZE, &temp);
+	pci_read_config_word(agp_bridge.dev, VIA_AGP3_APSIZE, &temp);
+	temp &= 0xfff;
+
 	for (i = 0; i < agp_bridge.num_aperture_sizes; i++) {
 		if (temp == values[i].size_value) {
 			agp_bridge.previous_size =
-			agp_bridge.current_size = (void *) (values + i);
+				agp_bridge.current_size = (void *) (values + i);
 			agp_bridge.aperture_size_idx = i;
 			return values[i].size;
 		}
-- 
2.30.9