This commit is contained in:
cinap_lenrek 2011-04-25 21:33:04 +00:00
commit e50b5178c1
3 changed files with 52 additions and 3 deletions

View file

@ -5,3 +5,4 @@ monitor=ask
vgasize=ask vgasize=ask
cdboot=yes cdboot=yes
bootfile=/386/9pcf bootfile=/386/9pcf
*nomp=1

View file

@ -22,7 +22,7 @@
typedef struct Ctlr Ctlr; typedef struct Ctlr Ctlr;
struct Ctlr { struct Ctlr {
Lock txlock; Lock txlock, imlock;
Ctlr *link; Ctlr *link;
Pcidev *pdev; Pcidev *pdev;
ulong *nic, *status; ulong *nic, *status;
@ -404,6 +404,7 @@ bcminterrupt(Ureg*, void *arg)
edev = arg; edev = arg;
ctlr = edev->ctlr; ctlr = edev->ctlr;
ilock(&ctlr->imlock);
dummyread(csr32(ctlr, InterruptMailbox)); dummyread(csr32(ctlr, InterruptMailbox));
csr32(ctlr, InterruptMailbox) = 1; csr32(ctlr, InterruptMailbox) = 1;
status = ctlr->status[0]; status = ctlr->status[0];
@ -416,6 +417,7 @@ bcminterrupt(Ureg*, void *arg)
bcmtransclean(edev); bcmtransclean(edev);
bcmtransmit(edev); bcmtransmit(edev);
csr32(ctlr, InterruptMailbox) = tag << 24; csr32(ctlr, InterruptMailbox) = tag << 24;
iunlock(&ctlr->imlock);
} }
static void static void
@ -664,5 +666,5 @@ bcmpnp(Ether* edev)
void void
etherbcmlink(void) etherbcmlink(void)
{ {
addethercard("BCM57xx", bcmpnp); addethercard("BCM5755", bcmpnp);
} }

View file

@ -154,6 +154,8 @@ mkioapic(PCMPioapic* p)
return 0; return 0;
apic = &mpapic[apicno]; apic = &mpapic[apicno];
if(apic->flags != 0)
print("mkioapic: APIC ID conflict at %d\n", p->apicno);
apic->type = PcmpIOAPIC; apic->type = PcmpIOAPIC;
apic->apicno = apicno; apic->apicno = apicno;
apic->addr = va; apic->addr = va;
@ -484,6 +486,46 @@ mpstartap(Apic* apic)
nvramwrite(0x0F, 0x00); nvramwrite(0x0F, 0x00);
} }
static void
dumpmp(uchar *p, uchar *e)
{
int i;
for(i = 0; p < e; p++) {
if((i % 16) == 0) print("*mp%d=", i/16);
print("%.2x ", *p);
if((++i % 16) == 0) print("\n");
}
if((i % 16) != 0) print("\n");
}
static void
mpoverride(uchar** newp, uchar** e)
{
int size, i, j;
char buf[20];
uchar* p;
char* s;
size = atoi(getconf("*mp"));
if(size == 0) panic("mpoverride: invalid size in *mp");
*newp = p = malloc(size);
if(p == nil) panic("mpoverride: can't allocate memory");
*e = p + size;
for(i = 0; ; i++){
snprint(buf, sizeof buf, "*mp%d", i);
s = getconf(buf);
if(s == nil) break;
while(*s){
j = strtol(s, &s, 16);
if(*s && *s != ' ' || j < 0 || j > 0xff) panic("mpoverride: invalid entry in %s", buf);
if(p >= *e) panic("mpoverride: overflow in %s", buf);
*p++ = j;
}
}
if(p != *e) panic("mpoverride: size doesn't match");
}
void void
mpinit(void) mpinit(void)
{ {
@ -518,6 +560,10 @@ mpinit(void)
*/ */
p = ((uchar*)pcmp)+sizeof(PCMP); p = ((uchar*)pcmp)+sizeof(PCMP);
e = ((uchar*)pcmp)+pcmp->length; e = ((uchar*)pcmp)+pcmp->length;
if(getconf("*dumpmp") != nil)
dumpmp(p, e);
if(getconf("*mp") != nil)
mpoverride(&p, &e);
while(p < e) switch(*p){ while(p < e) switch(*p){
default: default:
@ -683,7 +729,7 @@ mpintrenablex(Vctl* v, int tbdf)
break; break;
} }
if(bus == nil){ if(bus == nil){
print("ioapicirq: can't find bus type %d\n", type); print("ioapicirq: can't find bus type %d, number %d\n", type, bno);
return -1; return -1;
} }