Chameleon

Chameleon Svn Source Tree

Root/branches/meklortOld/i386/libsaio/pci_root.c

Source at commit 1146 created 12 years 10 months ago.
By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing).
1/*
2 * Copyright 2009 netkas
3 */
4
5#include "libsaio.h"
6#include "boot.h"
7#include "bootstruct.h"
8
9#ifndef DEBUG_PCIROOT
10#define DEBUG_PCIROOT 1
11#endif
12
13#if DEBUG_PCIROOT
14#define DBG(x...) printf(x)
15#else
16#define DBG(x...)
17#endif
18
19static int rootuid = 10; //value means function wasnt ran yet
20
21int getPciRootUID(void)
22{
23const char *val;
24int len;
25extern int search_and_get_acpi_fd(const char *, const char **);
26
27if (rootuid < 10) return rootuid;
28rootuid = 0;/* default uid = 0 */
29
30if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->bootConfig)) {
31if (isdigit(val[0])) rootuid = val[0] - '0';
32}
33/* Chameleon compatibility */
34else if (getValueForKey("PciRoot", &val, &len, &bootInfo->bootConfig)) {
35if (isdigit(val[0])) rootuid = val[0] - '0';
36}
37/* PCEFI compatibility */
38else if (getValueForKey("-pci0", &val, &len, &bootInfo->bootConfig)) {
39rootuid = 0;
40}
41else if (getValueForKey("-pci1", &val, &len, &bootInfo->bootConfig)) {
42rootuid = 1;
43}
44
45verbose("Using PCI-Root-UID value: %d\n", rootuid);
46return rootuid;
47}
48

Archive Download this file

Revision: 1146