fixed force_pci switch: could hang system before if AGP was pre-enabled

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8403 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen
2004-07-15 16:19:16 +00:00
parent 3989a673ba
commit 91c56b1c29
+19 -19
View File
@@ -50,9 +50,8 @@ status_t nv_agp_setup(void)
if (!nai.agp_bus) if (!nai.agp_bus)
{ {
LOG(4,("AGP: no AGP busmanager found.\n")); LOG(4,("AGP: no AGP busmanager found.\n"));
/* don't touch AGP command register, we don't know what has been setup:
/* make sure the card is in PCI mode if it's an AGP type after all */ * touching it anyway might 'hang' the graphics card! */
CFGW(AGPCMD, 0x00000000);
return B_ERROR; return B_ERROR;
} }
@@ -97,32 +96,33 @@ status_t nv_agp_setup(void)
{ {
LOG(4,("AGP: the graphicscard this accelerant controls is PCI type.\n")); LOG(4,("AGP: the graphicscard this accelerant controls is PCI type.\n"));
/* make sure the card is in PCI mode if it's an AGP type after all */ /* make sure card is set for PCI access */
CFGW(AGPCMD, 0x00000000); CFGW(AGPCMD, 0x00000000);
return B_ERROR; return B_ERROR;
} }
/* abort if specified by user in nv.settings */
//fixme: should probably be removed now... or updated to work via the busmanager.
if (si->settings.force_pci) if (si->settings.force_pci)
{ {
/* user specified not to use AGP */ /* set PCI mode if specified by user in nv.settings */
LOG(4,("AGP: forcing PCI mode (specified in nv.settings).\n")); LOG(4,("AGP: forcing PCI mode (specified in nv.settings)\n"));
/* program card for PCI access */
CFGW(AGPCMD, 0x00000000);
return B_ERROR; /* let the AGP busmanager setup PCI mode.
* (the AGP speed scheme is of no consequence now) */
nca.cmd = 0x00000000;
ioctl(fd, NV_ENABLE_AGP, &nca, sizeof(nca));
} }
else
{
/* activate AGP mode */
LOG(4,("AGP: activating AGP mode...\n"));
/* activate AGP mode */ /* let the AGP busmanager worry about what mode to set.. */
LOG(4,("AGP: activating AGP mode...\n")); nca.cmd = 0xfffffff7;
/* ..but we do need to select the right speed scheme fetched from our card */
/* let the AGP busmanager worry about what mode to set.. */ if (nv_ai.interface.agp_stat & AGP_rate_rev) nca.cmd |= AGP_rate_rev;
nca.cmd = (0xfffffff7); ioctl(fd, NV_ENABLE_AGP, &nca, sizeof(nca));
/* ..but we do need to select the right speed scheme fetched from our card */ }
if (nv_ai.interface.agp_stat & AGP_rate_rev) nca.cmd |= AGP_rate_rev;
ioctl(fd, NV_ENABLE_AGP, &nca, sizeof(nca));
/* list mode now activated */ /* list mode now activated */
nv_agp_list_active(nca.cmd); nv_agp_list_active(nca.cmd);