Root/
Source at commit 1078 created 13 years 1 month ago. By azimutz, Put back message removed by mistake on r1061. | |
---|---|
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 | ␊ |
19 | static int rootuid = 10; //value means function wasnt ran yet␊ |
20 | ␊ |
21 | int getPciRootUID(void)␊ |
22 | {␊ |
23 | ␉const char *val;␊ |
24 | ␉int len;␊ |
25 | ␉extern int search_and_get_acpi_fd(const char *, const char **);␊ |
26 | ␊ |
27 | ␉if (rootuid < 10) return rootuid;␊ |
28 | ␉rootuid = 0;␉/* default uid = 0 */␊ |
29 | ␊ |
30 | ␉if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->bootConfig)) {␊ |
31 | ␉␉if (isdigit(val[0])) rootuid = val[0] - '0';␊ |
32 | ␉}␊ |
33 | ␉/* Chameleon compatibility */␊ |
34 | ␉else if (getValueForKey("PciRoot", &val, &len, &bootInfo->bootConfig)) {␊ |
35 | ␉␉if (isdigit(val[0])) rootuid = val[0] - '0';␊ |
36 | ␉}␊ |
37 | ␉/* PCEFI compatibility */␊ |
38 | ␉else if (getValueForKey("-pci0", &val, &len, &bootInfo->bootConfig)) {␊ |
39 | ␉␉rootuid = 0;␊ |
40 | ␉}␊ |
41 | ␉else if (getValueForKey("-pci1", &val, &len, &bootInfo->bootConfig)) {␊ |
42 | ␉␉rootuid = 1;␊ |
43 | ␉}␊ |
44 | ␊ |
45 | ␉verbose("Using PCI-Root-UID value: %d\n", rootuid);␊ |
46 | ␉return rootuid;␊ |
47 | }␊ |
48 |