M boot/boot.c => boot/boot.c +1 -11
@@ 18,16 18,6 @@ int bargc;
static void swapproc(void);
static Method *rootserver(char*);
-static int
-rconv(Fmt* fp)
-{
- char s[ERRMAX];
-
- s[0] = '\0';
- errstr(s, sizeof s);
- return fmtstrcpy(fp, s);
-}
-
void
boot(int argc, char *argv[])
{
@@ 41,7 31,7 @@ boot(int argc, char *argv[])
char buf[32];
AuthInfo *ai;
- fmtinstall('r', rconv);
+ fmtinstall('r', errfmt);
open("#c/cons", OREAD);
open("#c/cons", OWRITE);
M ip/ipaux.c => ip/ipaux.c +11 -7
@@ 135,13 135,16 @@ eipfmt(Fmt *f)
switch(f->r) {
case 'E': /* Ethernet address */
p = va_arg(f->args, uchar*);
- return fmtprint(f, efmt, p[0], p[1], p[2], p[3], p[4], p[5]);
+ snprint(buf, sizeof buf, efmt, p[0], p[1], p[2], p[3], p[4], p[5]);
+ return fmtstrcpy(f, buf);
case 'I': /* Ip address */
p = va_arg(f->args, uchar*);
common:
- if(memcmp(p, v4prefix, 12) == 0)
- return fmtprint(f, ifmt, p[12], p[13], p[14], p[15]);
+ if(memcmp(p, v4prefix, 12) == 0){
+ snprint(buf, sizeof buf, ifmt, p[12], p[13], p[14], p[15]);
+ return fmtstrcpy(f, buf);
+ }
/* find longest elision */
eln = eli = -1;
@@ 179,7 182,8 @@ common:
case 'V': /* v4 ip address */
p = va_arg(f->args, uchar*);
- return fmtprint(f, ifmt, p[0], p[1], p[2], p[3]);
+ snprint(buf, sizeof buf, ifmt, p[0], p[1], p[2], p[3]);
+ return fmtstrcpy(f, buf);
case 'M': /* ip mask */
p = va_arg(f->args, uchar*);
@@ 199,10 203,10 @@ common:
n = 8*16;
/* got one, use /xx format */
- return fmtprint(f, "/%d", n);
-
+ snprint(buf, sizeof buf, "/%d", n);
+ return fmtstrcpy(f, buf);
}
- return fmtprint(f, "(eipfmt)");
+ return fmtstrcpy(f, "(eipfmt)");
}
#define CLASS(p) ((*(uchar*)(p))>>6)
M ip/ipifc.c => ip/ipifc.c +10 -12
@@ 882,31 882,29 @@ out:
}
static char *stformat = "%-32.32I %2.2d %4.4s\n";
-enum
-{
- Nstformat= 41,
-};
long
ipselftabread(Fs *f, char *cp, ulong offset, int n)
{
- int i, m, nifc;
+ int i, m, nifc, off;
Ipself *p;
Iplink *link;
char state[8];
m = 0;
+ off = offset;
qlock(f->self);
for(i = 0; i < NHASH && m < n; i++){
for(p = f->self->hash[i]; p != nil && m < n; p = p->next){
- if(offset == 0){
- nifc = 0;
- for(link = p->link; link; link = link->selflink)
- nifc++;
- routetype(p->type, state);
- m += snprint(cp + m, n - m, stformat, p->a, nifc, state);
+ nifc = 0;
+ for(link = p->link; link; link = link->selflink)
+ nifc++;
+ routetype(p->type, state);
+ m += snprint(cp + m, n - m, stformat, p->a, nifc, state);
+ if(off > 0){
+ off -= m;
+ m = 0;
}
- offset -= Nstformat;
}
}
qunlock(f->self);
M pc/dat.h => pc/dat.h +1 -1
@@ 185,7 185,7 @@ struct Mach
int loopconst;
int cpumhz;
- int cpuhz;
+ vlong cpuhz;
int cpuidax;
int cpuiddx;
char cpuidid[16];
M pc/devarch.c => pc/devarch.c +2 -0
@@ 546,11 546,13 @@ static X86type x86intel[] =
{ 6, 6, 16, "Celeron", },
{ 6, 7, 16, "PentiumIII/Xeon", },
{ 6, 8, 16, "PentiumIII/Xeon", },
+ { 0xF, 1, 16, "P4", }, /* P4 */
{ 3, -1, 32, "386", }, /* family defaults */
{ 4, -1, 22, "486", },
{ 5, -1, 23, "P5", },
{ 6, -1, 16, "P6", },
+ { 0xF, -1, 16, "P4", }, /* P4 */
{ -1, -1, 23, "unknown", }, /* total default */
};
M pc/devpccard.c => pc/devpccard.c +61 -14
@@ 13,6 13,7 @@
enum {
TI_vid = 0x104c,
+ TI_1131_did = 0xAC15,
TI_1250_did = 0xAC16,
TI_1450_did = 0xAC1B,
TI_1251A_did = 0xAC1D,
@@ 28,6 29,19 @@ enum {
LegacyAddr = 0x3e0,
NUMEVENTS = 10,
+
+ TI1131xSC = 0x80, // system control
+ TI122X_SC_INTRTIE = 1 << 29,
+ TI12xxIM = 0x8c, //
+ TI1131xCC = 0x91, // card control
+ TI113X_CC_RIENB = 1 << 7,
+ TI113X_CC_ZVENABLE = 1 << 6,
+ TI113X_CC_PCI_IRQ_ENA = 1 << 5,
+ TI113X_CC_PCI_IREQ = 1 << 4,
+ TI113X_CC_PCI_CSC = 1 << 3,
+ TI113X_CC_SPKROUTEN = 1 << 1,
+ TI113X_CC_IFG = 1 << 0,
+ TI1131xDC = 0x92, // device control
};
typedef struct {
@@ 39,6 53,7 @@ typedef struct {
static Variant variant[] = {
{ Ricoh_vid, Ricoh_476_did, "Ricoh 476 PCI/Cardbus bridge", },
{ Ricoh_vid, Ricoh_478_did, "Ricoh 478 PCI/Cardbus bridge", },
+{ TI_vid, TI_1131_did, "TI PCI-1131 Cardbus Controller", },
{ TI_vid, TI_1250_did, "TI PCI-1250 Cardbus Controller", },
{ TI_vid, TI_1450_did, "TI PCI-1450 Cardbus Controller", },
{ TI_vid, TI_1251A_did, "TI PCI-1251A Cardbus Controller", },
@@ 446,7 461,7 @@ processevents(void *)
}
static void
-interrupt(Ureg *, void *)
+cbinterrupt(Ureg *, void *)
{
int i;
@@ 529,14 544,18 @@ devpccardlink(void)
cb->cb_pci = pci;
cb->cb_variant = &variant[i];
- pcicfgw32(pci, PciCBMBR0, 0xffffffff);
- pcicfgw32(pci, PciCBMLR0, 0);
- pcicfgw32(pci, PciCBMBR1, 0xffffffff);
- pcicfgw32(pci, PciCBMLR1, 0);
- pcicfgw32(pci, PciCBIBR0, 0xffffffff);
- pcicfgw32(pci, PciCBILR0, 0);
- pcicfgw32(pci, PciCBIBR1, 0xffffffff);
- pcicfgw32(pci, PciCBILR1, 0);
+ if (pci->vid != TI_vid) {
+ // Gross hack, needs a fix. Inherit the mappings from 9load
+ // for the TIs (pb)
+ pcicfgw32(pci, PciCBMBR0, 0xffffffff);
+ pcicfgw32(pci, PciCBMLR0, 0);
+ pcicfgw32(pci, PciCBMBR1, 0xffffffff);
+ pcicfgw32(pci, PciCBMLR1, 0);
+ pcicfgw32(pci, PciCBIBR0, 0xffffffff);
+ pcicfgw32(pci, PciCBILR0, 0);
+ pcicfgw32(pci, PciCBIBR1, 0xffffffff);
+ pcicfgw32(pci, PciCBILR1, 0);
+ }
// Set up PCI bus numbers if needed.
if (pcicfgr8(pci, PciSBN) == 0) {
@@ 556,8 575,36 @@ devpccardlink(void)
if (pci->intl == 0xff || pci->intl == 0)
print("#Y%d: No interrupt?\n", (int)(cb - cbslots));
}
+
+ // Don't you love standards!
+ if (pci->vid == TI_vid) {
+ if (pci->did <= TI_1131_did) {
+ uchar cc;
+
+ cc = pcicfgr8(pci, TI1131xCC);
+ cc &= ~(TI113X_CC_PCI_IRQ_ENA |
+ TI113X_CC_PCI_IREQ |
+ TI113X_CC_PCI_CSC |
+ TI113X_CC_ZVENABLE);
+ cc |= TI113X_CC_PCI_IRQ_ENA |
+ TI113X_CC_PCI_IREQ |
+ TI113X_CC_SPKROUTEN;
+ pcicfgw8(pci, TI1131xCC, cc);
+
+ // PCI interrupts only
+ pcicfgw8(pci, TI1131xDC,
+ pcicfgr8(pci, TI1131xDC) & ~6);
+
+ // CSC ints to PCI bus.
+ wrreg(cb, Rigc, rdreg(cb, Rigc) | 0x10);
+ }
+ else if (pci->did == TI_1250_did) {
+ print("No support yet for the TI_1250_did, prod pb\n");
+ }
+ }
+
if (intl != -1 && intl != pci->intl)
- intrenable(pci->intl, interrupt, cb, pci->tbdf, "cardbus");
+ intrenable(pci->intl, cbinterrupt, cb, pci->tbdf, "cardbus");
intl = pci->intl;
if ((baddr = pcicfgr32(cb->cb_pci, PciBAR0)) == 0) {
@@ 1277,11 1324,11 @@ pccardread(Chan *c, void *a, long n, vlong offset)
for (i = 0; i != Nbars; i++)
if (pci->mem[i].size)
p = seprint(p, e,
- "\tmem[%d] %.8uX (%.8uX)\n",
+ "\tmem[%d] %.8ulX (%.8uX)\n",
i, pci->mem[i].bar,
pci->mem[i].size);
if (pci->rom.size)
- p = seprint(p, e, "\tROM %.8uX (%.8uX)\n", i,
+ p = seprint(p, e, "\tROM %.8ulX (%.8uX)\n",
pci->rom.bar, pci->rom.size);
pci = pci->list;
}
@@ 1301,12 1348,12 @@ pccardread(Chan *c, void *a, long n, vlong offset)
ct = &pi->pi_ctab[n];
p = seprint(p, e,
- "\tconfiguration[%d] irqs %.4X; vpp %d, %d; %s\n",
+ "\tconfiguration[%ld] irqs %.4uX; vpp %d, %d; %s\n",
n, ct->irqs, ct->vpp1, ct->vpp2,
(ct == pi->pi_defctab)? "(default);": "");
for (i = 0; i != ct->nio; i++)
if (ct->io[i].len > 0)
- p = seprint(p, e, "\t\tio[%d] %.8lX %d\n",
+ p = seprint(p, e, "\t\tio[%d] %.8ulX %uld\n",
i, ct->io[i].start, ct->io[i].len);
}
}
M pc/devusb.c => pc/devusb.c +1 -1
@@ 832,7 832,7 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
error(Ebadarg);
}
i = strtoul(cb->f[5], nil, 0);
- if(i >= 1 && i <= 100000){
+ if(i >= 1 && i*e->samplesz <= 12*1000*1000){
/* Hz */
e->hz = i;
e->remain = 0;
M pc/i8253.c => pc/i8253.c +1 -1
@@ 259,7 259,7 @@ i8253enable(void)
{
i8253.when = fastticks(nil);
i8253.fastperiod = (m->cpuhz + HZ/2) / HZ;
- i8253.fast2freq = (vlong)m->cpuhz * FreqMul / Freq;
+ i8253.fast2freq = m->cpuhz * FreqMul / Freq;
i8253.enabled = 1;
intrenable(IrqCLOCK, clockintr0, 0, BUSUNKNOWN, "clock");
}
M pc/usbuhci.c => pc/usbuhci.c +1 -0
@@ 965,6 965,7 @@ cleaniso(Endpt *e, int frnum)
return;
id = (e->x<<7)|(e->dev->x&0x7F);
do {
+//shut up!
if (td->status & AnyError)
iprint("usbisoerror 0x%lux\n", td->status);
n = (td->status + 1) & 0x3ff;
M port/auth.c => port/auth.c +3 -4
@@ 119,11 119,10 @@ hostownerwrite(char *a, int n)
if(!iseve())
error(Eperm);
- if(n >= sizeof buf)
- error(Ebadarg);
- strncpy(buf, a, n+1);
- if(buf[0] == '\0')
+ if(n <= 0 || n >= sizeof buf)
error(Ebadarg);
+ memmove(buf, a, n);
+ buf[n] = 0;
renameuser(eve, buf);
kstrdup(&eve, buf);