From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Haertel Message-Id: <200110220754.f9M7sg509636@ducky.net> To: 9fans@cse.psu.edu Subject: [9fans] Alpha success (w/ clock.c bugfix and ether2114x.c update) Date: Mon, 22 Oct 2001 00:54:42 -0700 Topicbox-Message-UUID: 0b465220-eaca-11e9-9e20-41e7f4b1d025 Ok, nobody replied to my previous query, so I was on my own. In order to get my Alpha working, I fixed two things. 1. Fixed a bug in the clock interrupt handler. term% diff 9/alphapc/clock.c 9.new/alphapc/clock.c 137,140c137,141 < lock(&clock0lock); < for(lp = clock0link; lp; lp = lp->link) < lp->clock(); < unlock(&clock0lock); --- > if (canlock(&clock0lock)) { > for(lp = clock0link; lp; lp = lp->link) > lp->clock(); > unlock(&clock0lock); > } 2. Added (very minimal) support for the DEC DE-500 (and perhaps other 21143-based cards that use SYM media controllers) to ether2114x.c. I based my work on the more up-to-date driver in the PC platform port of Plan 9. Therefore, to apply this patch, do two steps: a) copy /sys/src/9/pc/ether2114x.c to /sys/src/9/alphapc 2) apply the following diffs Note that the portion of the diffs from line 978 onwards can also be applied to /sys/src/9/pc/ether2114x.c to add support for 21143 cards with SYM media controllers on PC platforms. By the way, I think it would be a big win to share PCI drivers between platforms. The only difference between the Alpha and PCI versions of ether2114x.c were use of PCIWADDR instead of PADDR, and one use of xspanalloc instead of malloc. With just a little work I'm sure many drivers could be platform-independent. term% diff 9/pc/ether2114x.c 9.new/alphapc/ether21114x.c 388c388 < des->addr = PADDR(bp->rp); --- > des->addr = PCIWADDR(bp->rp); 473c473 < des->addr = PADDR(bp->rp); --- > des->addr = PCIWADDR(bp->rp); 577c577 < ctlr->rdr = malloc(ctlr->nrdr*sizeof(Des)); --- > ctlr->rdr = xspanalloc(ctlr->nrdr*sizeof(Des), 8*sizeof(ulong), 0); 582c582 < des->addr = PADDR(des->bp->rp); --- > des->addr = PCIWADDR(des->bp->rp); 586c586 < csr32w(ctlr, 3, PADDR(ctlr->rdr)); --- > csr32w(ctlr, 3, PCIWADDR(ctlr->rdr)); 592c592 < csr32w(ctlr, 4, PADDR(ctlr->tdr)); --- > csr32w(ctlr, 4, PCIWADDR(ctlr->tdr)); 978a979,998 > typesymmode(Ctlr *ctlr, uchar *block, int wait) > { > uint gpmode, gpdata, command; > > USED(wait); > gpmode = block[3] | ((uint) block[4] << 8); > gpdata = block[5] | ((uint) block[6] << 8); > command = (block[7] | ((uint) block[8] << 8)) & 0x71; > if (command & 0x8000) { > print("ether2114x.c: FIXME: handle type 4 mode blocks where cmd.active_invalid != 0\n"); > return -1; > } > csr32w(ctlr, 15, gpmode); > csr32w(ctlr, 15, gpdata); > ctlr->csr6 = (command & 0x71) << 18; > csr32w(ctlr, 6, ctlr->csr6); > return 0; > } > > static int 1070a1091,1094 > return 0; > break; > case 4: > if(typesymmode(ctlr, block, wait))