From 11b5f41beac4542db8456ad35e02e9a1d89d2291 Mon Sep 17 00:00:00 2001 From: jkim Date: Fri, 11 Aug 2006 19:16:50 +0000 Subject: Explicitly set v3 mode only when it is requested. Don't bother otherwise. --- sys/dev/agp/agp.c | 7 ++++++- sys/pci/agp.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index b4ef386..92426ae 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -312,12 +312,14 @@ agp_v3_enable(device_t dev, device_t mdev, u_int32_t mode) pci_write_config(dev, agp_find_caps(dev) + AGP_COMMAND, 0, 4); /* Construct the new mode word and tell the hardware */ + command = 0; command = AGP_MODE_SET_RQ(0, rq); command = AGP_MODE_SET_ARQSZ(command, arqsz); command = AGP_MODE_SET_CAL(command, cal); command = AGP_MODE_SET_SBA(command, sba); command = AGP_MODE_SET_FW(command, fw); command = AGP_MODE_SET_RATE(command, rate); + command = AGP_MODE_SET_MODE_3(command, 1); command = AGP_MODE_SET_AGP(command, 1); pci_write_config(dev, agp_find_caps(dev) + AGP_COMMAND, command, 4); pci_write_config(mdev, agp_find_caps(mdev) + AGP_COMMAND, command, 4); @@ -366,6 +368,7 @@ agp_v2_enable(device_t dev, device_t mdev, u_int32_t mode) device_printf(dev, "Setting AGP v2 mode %d\n", rate); /* Construct the new mode word and tell the hardware */ + command = 0; command = AGP_MODE_SET_RQ(0, rq); command = AGP_MODE_SET_SBA(command, sba); command = AGP_MODE_SET_FW(command, fw); @@ -399,7 +402,9 @@ agp_generic_enable(device_t dev, u_int32_t mode) * but should work fine for a classic single AGP slot system * with AGP v3. */ - if (AGP_MODE_GET_MODE_3(tstatus) && AGP_MODE_GET_MODE_3(mstatus)) + if (AGP_MODE_GET_MODE_3(mode) && + AGP_MODE_GET_MODE_3(tstatus) && + AGP_MODE_GET_MODE_3(mstatus)) return (agp_v3_enable(dev, mdev, mode)); else return (agp_v2_enable(dev, mdev, mode)); diff --git a/sys/pci/agp.c b/sys/pci/agp.c index b4ef386..92426ae 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -312,12 +312,14 @@ agp_v3_enable(device_t dev, device_t mdev, u_int32_t mode) pci_write_config(dev, agp_find_caps(dev) + AGP_COMMAND, 0, 4); /* Construct the new mode word and tell the hardware */ + command = 0; command = AGP_MODE_SET_RQ(0, rq); command = AGP_MODE_SET_ARQSZ(command, arqsz); command = AGP_MODE_SET_CAL(command, cal); command = AGP_MODE_SET_SBA(command, sba); command = AGP_MODE_SET_FW(command, fw); command = AGP_MODE_SET_RATE(command, rate); + command = AGP_MODE_SET_MODE_3(command, 1); command = AGP_MODE_SET_AGP(command, 1); pci_write_config(dev, agp_find_caps(dev) + AGP_COMMAND, command, 4); pci_write_config(mdev, agp_find_caps(mdev) + AGP_COMMAND, command, 4); @@ -366,6 +368,7 @@ agp_v2_enable(device_t dev, device_t mdev, u_int32_t mode) device_printf(dev, "Setting AGP v2 mode %d\n", rate); /* Construct the new mode word and tell the hardware */ + command = 0; command = AGP_MODE_SET_RQ(0, rq); command = AGP_MODE_SET_SBA(command, sba); command = AGP_MODE_SET_FW(command, fw); @@ -399,7 +402,9 @@ agp_generic_enable(device_t dev, u_int32_t mode) * but should work fine for a classic single AGP slot system * with AGP v3. */ - if (AGP_MODE_GET_MODE_3(tstatus) && AGP_MODE_GET_MODE_3(mstatus)) + if (AGP_MODE_GET_MODE_3(mode) && + AGP_MODE_GET_MODE_3(tstatus) && + AGP_MODE_GET_MODE_3(mstatus)) return (agp_v3_enable(dev, mdev, mode)); else return (agp_v2_enable(dev, mdev, mode)); -- cgit v1.1