MCPcopy Create free account
hub / github.com/coreboot/coreboot / get_device

Function get_device

util/vgabios/testbios.c:50–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50static unsigned short get_device(char *arg_val)
51{
52 unsigned short devfn=0;
53 long bus=0,dev=0,fn=0,need_pack=0;
54 char *tok;
55
56 tok = strsep(&arg_val,":");
57 if (arg_val != NULL) {
58 bus = strtol(tok,0,16);
59 need_pack = 1;
60 }
61 else {
62 arg_val = tok;
63 }
64
65 tok = strsep(&arg_val,".");
66 if (arg_val != NULL) {
67 dev = strtol(tok,0,16);
68 fn = strtol(arg_val,0,16);
69 need_pack = 1;
70 }
71 else {
72 if (need_pack ==1 && (strlen(tok))) {
73 dev = strtol(tok,0,16);
74 }
75 }
76
77 if ( need_pack == 1) {
78 devfn = bus<<8 | (dev<<3) | fn;
79 }
80 else {
81 devfn = strtol(tok, 0, 0);
82 }
83
84 return devfn;
85}
86
87int printk(int msg_level, const char *fmt, ...)
88{

Callers 1

mainFunction · 0.85

Calls 3

strsepFunction · 0.85
strlenFunction · 0.85
strtolFunction · 0.50

Tested by

no test coverage detected