Modified:
/devsata.c
=======================================
--- /devsata.c Sun Sep 5 06:50:48 2010
+++ /devsata.c Sun Sep 5 06:55:51 2010
@@ -776,35 +776,6 @@
poperror();
sataunclaim();
}
-
-static void
-atadump(void)
-{
- ulong n;
- char *buf, *p, *e;
- AtaReg *a = ATA1REG;
-
- n = 2048;
- p = buf = smalloc(n);
- e = p+n;
-
- p = seprint(p, e, "ata:\n");
- p = seprint(p, e, " data %04lux\n", a->data);
- p = seprint(p, e, " feat/error %02lux\n", a->feat);
- p = seprint(p, e, " sectors %02lux\n", a->sectors);
- p = seprint(p, e, " lbalow %02lux\n", a->lbalow);
- p = seprint(p, e, " lbamid %02lux\n", a->lbamid);
- p = seprint(p, e, " lbahigh %02lux\n", a->lbahigh);
- p = seprint(p, e, " dev %02lux\n", a->dev);
- p = seprint(p, e, " status/cmd %02lux\n", a->cmd);
- p = seprint(p, e, " altstatus/ctl %02lux\n", a->ctl);
- USED(p);
-
- dprint("%s", buf);
-
- free(buf);
-}
-
static void
satareset(void)
@@ -996,197 +967,6 @@
kproc("satastart", satastart, nil, 0);
satakick(StartReset);
}
-
-static char *dets[] = {"none", "dev", nil, "devphy", "nophy"};
-static struct {
- ulong v;
- char *s;
-} serrors[] = {
- {EM, "M"},
- {EN, "N"},
- {EW, "W"},
- {EB, "B"},
- {ED, "D"},
- {EC, "C"},
- {EH, "H"},
- {ES, "S"},
- {ET, "T"},
- {EX, "X"},
-};
-
-/* yuck, remove later */
-static ulong
-satadump(char *dst, long n, vlong off)
-{
- char *buf, *p, *e, *s;
- SataReg *sr = SATA1REG;
- SatahcReg *hr = SATAHCREG;
- AtaReg *a = ATA1REG;
- ulong v;
- int i;
- ulong *w;
-
- USED(a);
-
- p = buf = smalloc(2048);
- e = p+n;
-
- p = seprint(p, e, "hc cfg %#lux\n", hr->cfg);
-
- v = hr->intr;
- p = seprint(p, e, "hc intr %#lux\n", v);
- if(v & Idma1done) p = seprint(p, e, " dma1done");
- if(v & Iintrcoalesc) p = seprint(p, e, " intrcoalesc");
- if(v & Idevintr1) p = seprint(p, e, " dev1intr");
- v &= ~(Idma1done|Iintrcoalesc|Idevintr1);
- if(v) p = seprint(p, e, " other: %#lux", v);
- p = seprint(p, e, "\n");
-
- v = hr->intrmain;
- p = seprint(p, e, "hc intrmain %#lux, ena %#lux\n", v, hr->intrmainena);
- if(v & Sata1err) p = seprint(p, e, " sata1err");
- if(v & Sata1done) p = seprint(p, e, " sata1done");
- if(v & Sata1dmadone) p = seprint(p, e, " sata1dmadone");
- if(v & Satacoaldone) p = seprint(p, e, " satacoaldone");
- v &= ~(Sata1err|Sata1done|Sata1dmadone|Satacoaldone);
- if(v) p = seprint(p, e, " other: %#lux", v);
- p = seprint(p, e, "\n");
-
- p = seprint(p, e, "ncqdone %#lux\n", sr->edma.ncqdone);
-
- v = sr->ifc.ifccfg;
- p = seprint(p, e, "ifccfg %#lux\n", v);
- if(v & SSC) p = seprint(p, e, " ssc");
- if(v & Gen2) p = seprint(p, e, " gen2en");
- if(v & Comm) p = seprint(p, e, " comm");
- if(v & Physhutdown) p = seprint(p, e, " physhutdown");
- if(v & Emphadj) p = seprint(p, e, " emphadj");
- if(v & Emphtx) p = seprint(p, e, " emphtx");
- if(v & Emphpre) p = seprint(p, e, " emphpre");
- p = seprint(p, e, "\n");
-
- v = sr->edma.cfg;
- p = seprint(p, e, "cfg %#lux", v);
- if(v & ECFGncq) p = seprint(p, e, " (ncq)");
- if(v & ECFGqueue) p = seprint(p, e, " (queued)");
- p = seprint(p, e, "\n");
-
- v = sr->edma.intre;
- p = seprint(p, e, "intre %#lux, enabled %#lux\n", v,
sr->edma.intreena);
- if(v) {
- if(v & Edeverr) p = seprint(p, e, " deverr");
- if(v & Edevdis) p = seprint(p, e, " devdis");
- if(v & Edevcon) p = seprint(p, e, " devcon");
- if(v & Eserror) p = seprint(p, e, " serror");
- if(v & Eselfdis) p = seprint(p, e, " selfdis");
- if(v & Etransint) p = seprint(p, e, " transint");
- if(v & Eiordy) p = seprint(p, e, " iordy");
- if(v & (1<<31)) p = seprint(p, e, " transerr");
- p = seprint(p, e, " rx %#lux %#lux, tx %#lux %#lux", (v>>13)&0xf,
(v>>17)&0xf, (v>>21)&0xf, (v>>26)&0xf);
- p = seprint(p, e, "\n");
- }
-
- v = sr->edma.cmd;
- p = seprint(p, e, "cmd %#lux\n", v);
- if(v & EdmaEnable) p = seprint(p, e, " edma enable\n");
-
- v = sr->edma.status;
- p = seprint(p, e, "status %#lux\n", v);
-
- p = seprint(p, e, "req %#lux %#lux\n", sr->edma.reqin,
sr->edma.reqout);
- p = seprint(p, e, "resp %#lux %#lux\n", sr->edma.respin,
sr->edma.respout);
-
- v = sr->ifc.sstatus;
- p = seprint(p, e, "sstatus %#lux\n", v);
- s = "unknown";
- switch(v&0xf) {
- case SDETnone:
- case SDETdev:
- case SDETdevphy:
- case SDETnophy:
- if((v&0xf) < nelem(dets))
- s = dets[v&0xf];
- break;
- }
- p = seprint(p, e, " det: %s", s);
- p = seprint(p, e, " speed:");
- if(v & SSPDgen1) p = seprint(p, e, " gen1");
- if(v & SSPDgen2) p = seprint(p, e, " gen2");
- p = seprint(p, e, " ipm: %#lux\n", (v>>8)&0xf);
-
- v = sr->ifc.serror;
- p = seprint(p, e, "serror %#lux ", v);
- for(i = 0; i < nelem(serrors); i++)
- if(v & serrors[i].v)
- p = seprint(p, e, "%s", serrors[i].s);
- p = seprint(p, e, "\n");
-
- p = seprint(p, e, "scontrol %#lux\n", sr->ifc.scontrol);
-
- p = seprint(p, e, "ifcctl %#lux\n", sr->ifc.ifcctl);
- p = seprint(p, e, "ifctestctl %#lux\n", sr->ifc.ifctestctl);
- v = sr->ifc.ifcstatus;
- p = seprint(p, e, "ifcstatus %#lux\n", v);
- p = seprint(p, e, " fistype %#lux, pmrx %#lux, transfsm %#lux\n",
v&0xff, (v>>8)&0xf, (v>>24)&0xf);
- if(v & (1<<12)) p = seprint(p, e, " vendoruqdn");
- if(v & (1<<13)) p = seprint(p, e, " vendoruqerr");
- if(v & (1<<14)) p = seprint(p, e, " mbistrdy");
- if(v & (1<<15)) p = seprint(p, e, " mbistfail");
- if(v & (1<<16)) p = seprint(p, e, " abortcmd");
- if(v & (1<<17)) p = seprint(p, e, " lbpass");
- if(v & (1<<18)) p = seprint(p, e, " dmaact");
- if(v & (1<<19)) p = seprint(p, e, " pioact");
- if(v & (1<<20)) p = seprint(p, e, " rxhdact");
- if(v & (1<<21)) p = seprint(p, e, " txhdact");
- if(v & (1<<22)) p = seprint(p, e, " plugin");
- if(v & (1<<23)) p = seprint(p, e, " linkdown");
- if(v & (1<<30)) p = seprint(p, e, " rxbist");
- if(v & (1<<31)) p = seprint(p, e, " N");
- p = seprint(p, e, "\n");
-
- p = seprint(p, e, "fiscfg %#lux\n", sr->ifc.fiscfg);
- p = seprint(p, e, "fisintr %#lux, ena %#lux\n", sr->ifc.fisintr,
sr->ifc.fisintrena);
- w = sr->ifc.fis;
- p = seprint(p, e, "fis[7] %#lux %#lux %#lux %#lux %#lux %#lux %#lux\n",
- w[0], w[1], w[2], w[3], w[4], w[5], w[6]);
-
-if(0) {
- p = seprint(p, e, "pll 0x%08lux\n", sr->ifc.pllcfg);
- p = seprint(p, e, "ltmode 0x%08lux\n", sr->ifc.ltmode);
- p = seprint(p, e, "phym3 0x%08lux\n", sr->ifc.phym3);
- p = seprint(p, e, "phym4 0x%08lux\n", sr->ifc.phym4);
- p = seprint(p, e, "phym1 0x%08lux\n", sr->ifc.phym1);
- p = seprint(p, e, "phym2 0x%08lux\n", sr->ifc.phym2);
- p = seprint(p, e, "bistctl 0x%08lux\n", sr->ifc.bistctl);
- p = seprint(p, e, "bist1 0x%08lux\n", sr->ifc.bist1);
- p = seprint(p, e, "bist2 0x%08lux\n", sr->ifc.bist2);
- p = seprint(p, e, "vendor 0x%08lux\n", sr->ifc.vendor);
- p = seprint(p, e, "phym9g2 0x%08lux\n", sr->ifc.phym9g2);
- p = seprint(p, e, "phym9g1 0x%08lux\n", sr->ifc.phym9g1);
- p = seprint(p, e, "phycfg 0x%08lux\n", sr->ifc.phycfg);
- p = seprint(p, e, "phytctl 0x%08lux\n", sr->ifc.phytctl);
- p = seprint(p, e, "phym10 0x%08lux\n", sr->ifc.phym10);
- p = seprint(p, e, "phym12 0x%08lux\n", sr->ifc.phym12);
-}
-
-if(1) {
- p = seprint(p, e, "ata:\n");
- p = seprint(p, e, " data %04lux\n", a->data);
- p = seprint(p, e, " feat/error %02lux\n", a->feat);
- p = seprint(p, e, " sectors %02lux\n", a->sectors);
- p = seprint(p, e, " lbalow %02lux\n", a->lbalow);
- p = seprint(p, e, " lbamid %02lux\n", a->lbamid);
- p = seprint(p, e, " lbahigh %02lux\n", a->lbahigh);
- p = seprint(p, e, " dev %02lux\n", a->dev);
- p = seprint(p, e, " cmd/status %02lux\n", a->cmd);
- p = seprint(p, e, " ctl %02lux\n", a->ctl);
-}
-
- USED(p);
- n = readstr(off, dst, n, buf);
- free(buf);
- return n;
-}
static void
prdfill(Prd *prd, uchar *buf, long n)