small agp update
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -326,6 +326,7 @@ typedef struct {
|
|||||||
used (pre 3.x or 3.x) */
|
used (pre 3.x or 3.x) */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32 magic; /* magic number to make sure the caller groks us */
|
uint32 magic; /* magic number to make sure the caller groks us */
|
||||||
|
bool agp_bus;/* indicates if we have access to the AGP busmanager */
|
||||||
uint8 index; /* device index in list of devices found */
|
uint8 index; /* device index in list of devices found */
|
||||||
bool exist; /* we got AGP device info */
|
bool exist; /* we got AGP device info */
|
||||||
agp_info agpi; /* AGP interface info of a device */
|
agp_info agpi; /* AGP interface info of a device */
|
||||||
@@ -334,6 +335,7 @@ typedef struct {
|
|||||||
/* Execute an AGP command */
|
/* Execute an AGP command */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32 magic; /* magic number to make sure the caller groks us */
|
uint32 magic; /* magic number to make sure the caller groks us */
|
||||||
|
bool agp_bus;/* indicates if we have access to the AGP busmanager */
|
||||||
uint32 cmd; /* actual command to execute */
|
uint32 cmd; /* actual command to execute */
|
||||||
} nv_cmd_agp;
|
} nv_cmd_agp;
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ status_t nv_agp_setup(void)
|
|||||||
nv_nth_agp_info nai;
|
nv_nth_agp_info nai;
|
||||||
nv_cmd_agp nca;
|
nv_cmd_agp nca;
|
||||||
uint8 index;
|
uint8 index;
|
||||||
uint8 nv_index = 0xff;
|
agp_info nv_ai;
|
||||||
agp_info ai[8];
|
|
||||||
bool agp = false;
|
bool agp = false;
|
||||||
|
|
||||||
/* first try to enable FW support on our card if user requested this
|
/* first try to enable FW support on our card if user requested this
|
||||||
@@ -46,28 +45,37 @@ status_t nv_agp_setup(void)
|
|||||||
/* get nth AGP device info */
|
/* get nth AGP device info */
|
||||||
nai.index = index;
|
nai.index = index;
|
||||||
ioctl(fd, NV_GET_NTH_AGP_INFO, &nai, sizeof(nai));
|
ioctl(fd, NV_GET_NTH_AGP_INFO, &nai, sizeof(nai));
|
||||||
/* exit if we didn't get one */
|
|
||||||
|
/* 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 (!nai.exist)
|
||||||
{
|
{
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
LOG(4,("AGP: end of AGP capable devices list.\n"));
|
LOG(4,("AGP: end of AGP capable devices list.\n"));
|
||||||
else
|
else
|
||||||
LOG(4,("AGP: no AGP busmanager or no AGP capable devices found.\n"));
|
LOG(4,("AGP: no AGP capable devices found.\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(4,("AGP: AGP capable device #%d:\n", (index + 1)));
|
LOG(4,("AGP: AGP capable device #%d:\n", (index + 1)));
|
||||||
|
|
||||||
/* remember the info we got */
|
|
||||||
ai[index] = nai.agpi;
|
|
||||||
|
|
||||||
/* see if we are this one */
|
/* see if we are this one */
|
||||||
if (((((uint32)(nai.agpi.device_id)) << 16) | nai.agpi.vendor_id) == CFGR(DEVID))
|
if (((((uint32)(nai.agpi.device_id)) << 16) | nai.agpi.vendor_id) == CFGR(DEVID))
|
||||||
{
|
{
|
||||||
LOG(4,("AGP: (this is the device this accelerant controls)\n"));
|
LOG(4,("AGP: (this is the device this accelerant controls)\n"));
|
||||||
agp = true;
|
agp = true;
|
||||||
/* remember where we are */
|
/* remember our info */
|
||||||
nv_index = index;
|
nv_ai = nai.agpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* log capabilities */
|
/* log capabilities */
|
||||||
@@ -83,7 +91,7 @@ status_t nv_agp_setup(void)
|
|||||||
* We rely on the AGP busmanager to iterate trough this list for us. */
|
* We rely on the AGP busmanager to iterate trough this list for us. */
|
||||||
if (!agp)
|
if (!agp)
|
||||||
{
|
{
|
||||||
LOG(4,("AGP: assuming 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 the card is in PCI mode if it's an AGP type after all */
|
||||||
CFGW(AGPCMD, 0x00000000);
|
CFGW(AGPCMD, 0x00000000);
|
||||||
@@ -108,7 +116,7 @@ status_t nv_agp_setup(void)
|
|||||||
/* let the AGP busmanager worry about what mode to set.. */
|
/* let the AGP busmanager worry about what mode to set.. */
|
||||||
nca.cmd = (0xfffffff7);
|
nca.cmd = (0xfffffff7);
|
||||||
/* ..but we do need to select the right speed scheme fetched from our card */
|
/* ..but we do need to select the right speed scheme fetched from our card */
|
||||||
if (ai[nv_index].interface.agp_stat & AGP_rate_rev) nca.cmd |= AGP_rate_rev;
|
if (nv_ai.interface.agp_stat & AGP_rate_rev) nca.cmd |= AGP_rate_rev;
|
||||||
ioctl(fd, NV_ENABLE_AGP, &nca, sizeof(nca));
|
ioctl(fd, NV_ENABLE_AGP, &nca, sizeof(nca));
|
||||||
|
|
||||||
/* list mode now activated */
|
/* list mode now activated */
|
||||||
|
|||||||
@@ -989,7 +989,9 @@ control_hook (void* dev, uint32 msg, void *buf, size_t len) {
|
|||||||
nv_nth_agp_info *nai = (nv_nth_agp_info *)buf;
|
nv_nth_agp_info *nai = (nv_nth_agp_info *)buf;
|
||||||
if (nai->magic == NV_PRIVATE_DATA_MAGIC) {
|
if (nai->magic == NV_PRIVATE_DATA_MAGIC) {
|
||||||
nai->exist = false;
|
nai->exist = false;
|
||||||
|
nai->agp_bus = false;
|
||||||
if (agp_bus) {
|
if (agp_bus) {
|
||||||
|
nai->agp_bus = true;
|
||||||
if ((*agp_bus->get_nth_agp_info)(nai->index, &(nai->agpi)) == B_NO_ERROR) {
|
if ((*agp_bus->get_nth_agp_info)(nai->index, &(nai->agpi)) == B_NO_ERROR) {
|
||||||
nai->exist = true;
|
nai->exist = true;
|
||||||
}
|
}
|
||||||
@@ -1001,8 +1003,10 @@ control_hook (void* dev, uint32 msg, void *buf, size_t len) {
|
|||||||
nv_cmd_agp *nca = (nv_cmd_agp *)buf;
|
nv_cmd_agp *nca = (nv_cmd_agp *)buf;
|
||||||
if (nca->magic == NV_PRIVATE_DATA_MAGIC) {
|
if (nca->magic == NV_PRIVATE_DATA_MAGIC) {
|
||||||
if (agp_bus) {
|
if (agp_bus) {
|
||||||
|
nca->agp_bus = true;
|
||||||
(*agp_bus->enable_agp)(&(nca->cmd));
|
(*agp_bus->enable_agp)(&(nca->cmd));
|
||||||
} else {
|
} else {
|
||||||
|
nca->agp_bus = false;
|
||||||
nca->cmd = 0;
|
nca->cmd = 0;
|
||||||
}
|
}
|
||||||
result = B_OK;
|
result = B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user