Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/trunkGraphicsEnablerModules/i386/modules/GraphicsEnabler/AMDGraphicsEnabler/AMDGraphicsEnabler.c

1/*
2 *AMDGraphicsEnabler Module
3 *Enables many AMD/ATI HD cards to be used out of the box in OS X.
4 *This was converted from boot2 code ( > r784) to a boot2 module.
5 *
6 */
7
8#include "saio_internal.h"
9#include "bootstruct.h"
10#include "pci.h"
11#include "modules.h"
12
13#define kGraphicsEnablerKey "GraphicsEnabler"
14
15extern bool setup_ati_devprop(pci_dt_t *ati_dev);
16void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4);
17
18
19void AMDGraphicsEnabler_start()
20{
21register_hook_callback("PCIDevice", &GraphicsEnabler_hook);
22}
23
24void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4)
25{
26pci_dt_t* current = arg1;
27
28if (current->class_id != PCI_CLASS_DISPLAY_VGA) return;
29
30char *devicepath = get_pci_dev_path(current);
31
32bool do_gfx_devprop = true;
33getBoolForKey(kGraphicsEnablerKey, &do_gfx_devprop, &bootInfo->chameleonConfig);
34
35if (do_gfx_devprop && (current->vendor_id == PCI_VENDOR_ID_ATI))
36{
37verbose("AMD/ATI VGA Controller [%04x:%04x] :: %s \n",
38current->vendor_id, current->device_id, devicepath);
39setup_ati_devprop(current);
40}
41else
42verbose("[%04x:%04x] :: %s, is not a AMD/ATI VGA Controller.\n",
43current->vendor_id, current->device_id, devicepath);
44}
45

Archive Download this file

Revision: 1146