acpi: work arround missing _BBN, check _HID
This commit is contained in:
parent
89efb07d4f
commit
69470de37d
|
@ -281,24 +281,50 @@ Foundbus:
|
|||
bus->aintr = ai;
|
||||
}
|
||||
|
||||
static char*
|
||||
eisaid(void *v)
|
||||
{
|
||||
static char id[8];
|
||||
ulong b, l;
|
||||
int i;
|
||||
|
||||
if(amltag(v) == 's')
|
||||
return v;
|
||||
b = amlint(v);
|
||||
for(l = 0, i=24; i>=0; i -= 8, b >>= 8)
|
||||
l |= (b & 0xFF) << i;
|
||||
id[7] = 0;
|
||||
for(i=6; i>=3; i--, l >>= 4)
|
||||
id[i] = "0123456789ABCDEF"[l & 0xF];
|
||||
for(i=2; i>=0; i--, l >>= 5)
|
||||
id[i] = '@' + (l & 0x1F);
|
||||
return id;
|
||||
}
|
||||
|
||||
static int
|
||||
pcibusno(void *dot)
|
||||
{
|
||||
int bno, adr, tbdf;
|
||||
Pcidev *pdev;
|
||||
void *p, *x;
|
||||
char *id;
|
||||
|
||||
p = nil;
|
||||
if(x = amlwalk(dot, "^_BBN")){
|
||||
if(amleval(x, "", &p) < 0)
|
||||
return -1;
|
||||
return amlint(p);
|
||||
id = nil;
|
||||
if(x = amlwalk(dot, "^_HID")){
|
||||
p = nil;
|
||||
if(amleval(x, "", &p) == 0)
|
||||
id = eisaid(p);
|
||||
}
|
||||
if((x = amlwalk(dot, "^_ADR")) == nil)
|
||||
return -1;
|
||||
if((x = amlwalk(dot, "^_BBN")) == nil)
|
||||
if((x = amlwalk(dot, "^_ADR")) == nil)
|
||||
return -1;
|
||||
p = nil;
|
||||
if(amleval(x, "", &p) < 0)
|
||||
return -1;
|
||||
adr = amlint(p);
|
||||
/* if root bridge, then we are done here */
|
||||
if(id && (strcmp(id, "PNP0A03")==0 || strcmp(id, "PNP0A08")==0))
|
||||
return adr;
|
||||
x = amlwalk(dot, "^");
|
||||
if(x == nil || x == dot)
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue