Rudolf Cornelissen 6/2004-9/2004
*/
#define MODULE_BIT 0x00000100
#include <unistd.h>
#include "std.h"
status_t
eng_agp_setup(void)
{
eng_nth_agp_info nai;
eng_cmd_agp nca;
uint8 index;
agp_info eng_ai;
bool agp = false;
eng_ai.interface.status = 0;
nca.magic = nai.magic = VIA_PRIVATE_DATA_MAGIC;
for (index = 0; index < 8; index++) {
nai.index = index;
ioctl(fd, ENG_GET_NTH_AGP_INFO, &nai, sizeof(nai));
if (!nai.agp_bus) {
LOG(4,("AGP: no AGP busmanager found.\n"));
* touching it anyway might 'hang' the graphics card! */
return B_ERROR;
}
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)));
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;
eng_ai = nai.agpi;
}
}
* We have to iterate through the capability list as specified in the PCI spec
* one way or the other, otherwise we cannot distinquish between PCI and
* AGP type cards as PCI cards still might 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"));
return B_ERROR;
}
if (si->settings.force_pci) {
LOG(4,("AGP: forcing PCI mode (specified in via.settings)\n"));
* (the AGP speed scheme is of no consequence now) */
nca.cmd = 0x00000000;
ioctl(fd, ENG_ENABLE_AGP, &nca, sizeof(nca));
} else {
LOG(4,("AGP: activating AGP mode...\n"));
nca.cmd = 0xfffffff7;
if (eng_ai.interface.status & AGP_3_MODE)
nca.cmd |= AGP_3_MODE;
ioctl(fd, ENG_ENABLE_AGP, &nca, sizeof(nca));
}
return B_OK;
}