pc/pc64: move common code to pc/devarch.c
This commit is contained in:
parent
c3028fb924
commit
6a55790197
|
@ -1133,3 +1133,62 @@ timerset(Tval x)
|
|||
if(doi8253set)
|
||||
(*arch->timerset)(x);
|
||||
}
|
||||
|
||||
/*
|
||||
* put the processor in the halt state if we've no processes to run.
|
||||
* an interrupt will get us going again.
|
||||
*
|
||||
* halting in an smp system can result in a startup latency for
|
||||
* processes that become ready.
|
||||
* if idle_spin is zero, we care more about saving energy
|
||||
* than reducing this latency.
|
||||
*
|
||||
* the performance loss with idle_spin == 0 seems to be slight
|
||||
* and it reduces lock contention (thus system time and real time)
|
||||
* on many-core systems with large values of NPROC.
|
||||
*/
|
||||
void
|
||||
idlehands(void)
|
||||
{
|
||||
extern int nrdy, idle_spin;
|
||||
|
||||
if(conf.nmach == 1)
|
||||
halt();
|
||||
else if(m->cpuidcx & Monitor)
|
||||
mwait(&nrdy);
|
||||
else if(idle_spin == 0)
|
||||
halt();
|
||||
}
|
||||
|
||||
int
|
||||
isaconfig(char *class, int ctlrno, ISAConf *isa)
|
||||
{
|
||||
char cc[32], *p;
|
||||
int i;
|
||||
|
||||
snprint(cc, sizeof cc, "%s%d", class, ctlrno);
|
||||
p = getconf(cc);
|
||||
if(p == nil)
|
||||
return 0;
|
||||
|
||||
isa->type = "";
|
||||
isa->nopt = tokenize(p, isa->opt, NISAOPT);
|
||||
for(i = 0; i < isa->nopt; i++){
|
||||
p = isa->opt[i];
|
||||
if(cistrncmp(p, "type=", 5) == 0)
|
||||
isa->type = p + 5;
|
||||
else if(cistrncmp(p, "port=", 5) == 0)
|
||||
isa->port = strtoul(p+5, &p, 0);
|
||||
else if(cistrncmp(p, "irq=", 4) == 0)
|
||||
isa->irq = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "dma=", 4) == 0)
|
||||
isa->dma = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "mem=", 4) == 0)
|
||||
isa->mem = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "size=", 5) == 0)
|
||||
isa->size = strtoul(p+5, &p, 0);
|
||||
else if(cistrncmp(p, "freq=", 5) == 0)
|
||||
isa->freq = strtoul(p+5, &p, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1000,109 +1000,3 @@ exit(int ispanic)
|
|||
shutdown(ispanic);
|
||||
arch->reset();
|
||||
}
|
||||
|
||||
int
|
||||
isaconfig(char *class, int ctlrno, ISAConf *isa)
|
||||
{
|
||||
char cc[32], *p;
|
||||
int i;
|
||||
|
||||
snprint(cc, sizeof cc, "%s%d", class, ctlrno);
|
||||
p = getconf(cc);
|
||||
if(p == nil)
|
||||
return 0;
|
||||
|
||||
isa->type = "";
|
||||
isa->nopt = tokenize(p, isa->opt, NISAOPT);
|
||||
for(i = 0; i < isa->nopt; i++){
|
||||
p = isa->opt[i];
|
||||
if(cistrncmp(p, "type=", 5) == 0)
|
||||
isa->type = p + 5;
|
||||
else if(cistrncmp(p, "port=", 5) == 0)
|
||||
isa->port = strtoul(p+5, &p, 0);
|
||||
else if(cistrncmp(p, "irq=", 4) == 0)
|
||||
isa->irq = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "dma=", 4) == 0)
|
||||
isa->dma = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "mem=", 4) == 0)
|
||||
isa->mem = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "size=", 5) == 0)
|
||||
isa->size = strtoul(p+5, &p, 0);
|
||||
else if(cistrncmp(p, "freq=", 5) == 0)
|
||||
isa->freq = strtoul(p+5, &p, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
cistrcmp(char *a, char *b)
|
||||
{
|
||||
int ac, bc;
|
||||
|
||||
for(;;){
|
||||
ac = *a++;
|
||||
bc = *b++;
|
||||
|
||||
if(ac >= 'A' && ac <= 'Z')
|
||||
ac = 'a' + (ac - 'A');
|
||||
if(bc >= 'A' && bc <= 'Z')
|
||||
bc = 'a' + (bc - 'A');
|
||||
ac -= bc;
|
||||
if(ac)
|
||||
return ac;
|
||||
if(bc == 0)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cistrncmp(char *a, char *b, int n)
|
||||
{
|
||||
unsigned ac, bc;
|
||||
|
||||
while(n > 0){
|
||||
ac = *a++;
|
||||
bc = *b++;
|
||||
n--;
|
||||
|
||||
if(ac >= 'A' && ac <= 'Z')
|
||||
ac = 'a' + (ac - 'A');
|
||||
if(bc >= 'A' && bc <= 'Z')
|
||||
bc = 'a' + (bc - 'A');
|
||||
|
||||
ac -= bc;
|
||||
if(ac)
|
||||
return ac;
|
||||
if(bc == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* put the processor in the halt state if we've no processes to run.
|
||||
* an interrupt will get us going again.
|
||||
*
|
||||
* halting in an smp system can result in a startup latency for
|
||||
* processes that become ready.
|
||||
* if idle_spin is zero, we care more about saving energy
|
||||
* than reducing this latency.
|
||||
*
|
||||
* the performance loss with idle_spin == 0 seems to be slight
|
||||
* and it reduces lock contention (thus system time and real time)
|
||||
* on many-core systems with large values of NPROC.
|
||||
*/
|
||||
void
|
||||
idlehands(void)
|
||||
{
|
||||
extern int nrdy;
|
||||
|
||||
if(conf.nmach == 1)
|
||||
halt();
|
||||
else if(m->cpuidcx & Monitor)
|
||||
mwait(&nrdy);
|
||||
else if(idle_spin == 0)
|
||||
halt();
|
||||
}
|
||||
|
|
|
@ -479,19 +479,6 @@ reboot(void*, void*, ulong)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
idlehands(void)
|
||||
{
|
||||
extern int nrdy;
|
||||
|
||||
if(conf.nmach == 1)
|
||||
halt();
|
||||
else if(m->cpuidcx & Monitor)
|
||||
mwait(&nrdy);
|
||||
else if(idle_spin == 0)
|
||||
halt();
|
||||
}
|
||||
|
||||
/*
|
||||
* SIMD Floating Point.
|
||||
* Assembler support to get at the individual instructions
|
||||
|
@ -760,36 +747,3 @@ procsave(Proc *p)
|
|||
*/
|
||||
mmuflushtlb();
|
||||
}
|
||||
|
||||
int
|
||||
isaconfig(char *class, int ctlrno, ISAConf *isa)
|
||||
{
|
||||
char cc[32], *p;
|
||||
int i;
|
||||
|
||||
snprint(cc, sizeof cc, "%s%d", class, ctlrno);
|
||||
p = getconf(cc);
|
||||
if(p == nil)
|
||||
return 0;
|
||||
|
||||
isa->type = "";
|
||||
isa->nopt = tokenize(p, isa->opt, NISAOPT);
|
||||
for(i = 0; i < isa->nopt; i++){
|
||||
p = isa->opt[i];
|
||||
if(cistrncmp(p, "type=", 5) == 0)
|
||||
isa->type = p + 5;
|
||||
else if(cistrncmp(p, "port=", 5) == 0)
|
||||
isa->port = strtoul(p+5, &p, 0);
|
||||
else if(cistrncmp(p, "irq=", 4) == 0)
|
||||
isa->irq = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "dma=", 4) == 0)
|
||||
isa->dma = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "mem=", 4) == 0)
|
||||
isa->mem = strtoul(p+4, &p, 0);
|
||||
else if(cistrncmp(p, "size=", 5) == 0)
|
||||
isa->size = strtoul(p+5, &p, 0);
|
||||
else if(cistrncmp(p, "freq=", 5) == 0)
|
||||
isa->freq = strtoul(p+5, &p, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue