Chameleon

Chameleon Svn Source Tree

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

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

Archive Download this file

Revision: 1146