rem: LOG(4,("AGP: forcing PCI mode (specified in nv.settings).\n"));  CFGW(AGPCMD, 0x00000000);
add: LOG(4,("AGP: forcing PCI mode (specified in nv.settings)\n"));
context: status_t nv_agp_setup(void){	nv_nth_agp_info nai;	nv_cmd_agp nca;	uint8 index;	agp_info nv_ai;	bool agp = false;	/* first try to enable FW support on our card if user requested this	 * ('unsupported' tweak!)	 * This has no effect on PCI cards. */	if (si->settings.unhide_fw)	{		uint32 reg;		LOG(4, ("AGP: STRAPINFO2 contains $%08x\n", NV_REG32(NV32_NVSTRAPINFO2)));		LOG(4, ("AGP: attempting to enable fastwrite support..\n"));		/* 'force' FW support */		reg = (NV_REG32(NV32_NVSTRAPINFO2) & ~0x00000800);		/* enable strapinfo overwrite */		NV_REG32(NV32_NVSTRAPINFO2) = (reg | 0x80000000);		LOG(4, ("AGP: STRAPINFO2 now contains $%08x\n", NV_REG32(NV32_NVSTRAPINFO2)));	}	/* set the magic number so the nvidia kerneldriver knows we're for real */	nca.magic = nai.magic = NV_PRIVATE_DATA_MAGIC;	/* contact driver and get a pointer to the registers and shared data */	for (index = 0; index < 8; index++)	{		/* get nth AGP device info */		nai.index = index;		ioctl(fd, NV_GET_NTH_AGP_INFO, &nai, sizeof(nai));		/* abort if no agp busmanager found */		if (!nai.agp_bus)		{			LOG(4,("AGP: no AGP busmanager found.\n"));			/* make sure the card is in PCI mode if it's an AGP type after all */			CFGW(AGPCMD, 0x00000000);			return B_ERROR;		}		/* exit if we didn't get device info for this index */		if (!nai.exist)		{			if (index != 0)				LOG(4,("AGP: end of AGP capable devices list.\n"));			else				LOG(4,("AGP: no AGP capable devices found.\n"));			break;		}		LOG(4,("AGP: AGP capable device #%d:\n", (index + 1)));		/* see if we are this one */		if ((nai.agpi.device_id == si->device_id) &&			(nai.agpi.vendor_id == si->vendor_id) &&			(nai.agpi.bus == si->bus) &&			(nai.agpi.device == si->device) &&			(nai.agpi.function == si->function))		{			LOG(4,("AGP: (this is the device this accelerant controls)\n"));			agp = true;			/* remember our info */			nv_ai = nai.agpi;		}		/* log capabilities */		nv_agp_list_info(nai.agpi);	}	/* if our card is not an AGP type, abort here */	/* Note:	 * We have to iterate through the capability list as specified in the PCI spec	 * one way or the other, otherwise we cannot distinquish between nVidia PCI and	 * AGP type cards as nVidia PCI cards still have AGP registers that pretend to	 * support AGP.	 * We rely on the AGP busmanager to iterate trough this list for us. */	if (!agp)	{		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 */		CFGW(AGPCMD, 0x00000000);		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)	{		/* user specified not to use AGP */		LOG(4,("AGP: forcing PCI mode (specified in nv.settings).\n"));		/* program card for PCI access */		CFGW(AGPCMD, 0x00000000);		return B_ERROR;	}	/* activate AGP mode */	LOG(4,("AGP: activating AGP mode...\n"));	/* let the AGP busmanager worry about what mode to set.. */	nca.cmd = (0xfffffff7);	/* ..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 */	nv_agp_list_active(nca.cmd);	/* extra check */	LOG(4,("AGP: graphics card AGPCMD register readback $%08x\n", CFGR(AGPCMD)));	return B_OK;}