search for ATI Radeon card instead of hardcoding a PCI handle

This commit is contained in:
Markus Fröschle
2016-10-23 16:31:20 +00:00
parent 744eacb6b2
commit 0259755f06

View File

@@ -143,8 +143,14 @@ void do_tests(struct pci_native_driver_interface *pci)
struct pci_rd *rd;
int flags;
handle = 0xa0;
/*
* look for an ATI Radeon video card
*/
// handle = 0xd8;
handle = (*pci->pci_find_device)(0x5159, 0x1002, 0);
if (handle > 0)
{
rd = (*pci->pci_get_resource)(handle); /* get resource descriptor for ATI graphics card */
if (rd != NULL)
{
@@ -173,12 +179,12 @@ void do_tests(struct pci_native_driver_interface *pci)
{
hexdump((uint8_t *) rd->start + rd->offset, 64);
memset((uint8_t *) rd-> start + rd->offset, 0, 128 * MB);
memset((uint8_t *) rd-> start + rd->offset, 0, 64 * MB);
printf("memory cleared\r\n");
hexdump((uint8_t *) rd->start + rd->offset, 64);
memset((uint8_t *) rd->start + rd->offset, 0xaa, 128 * MB);
memset((uint8_t *) rd->start + rd->offset, 0xaa, 64 * MB);
hexdump((uint8_t *) rd->start + rd->offset, 64);
}
@@ -189,6 +195,9 @@ void do_tests(struct pci_native_driver_interface *pci)
{
printf("resource descriptor for handle 0x%02x not found\r\n", handle);
}
}
else
fprintf(stderr, "card not found\r\n");
printf("\r\n...finished\r\n");
}