2 #include "../port/lib.h"
13 mpscan(uchar *addr, int len)
19 for(p = addr; p < e; p += sizeof(_MP_)){
20 if(memcmp(p, "_MP_", 4))
23 for(i = 0; i < sizeof(_MP_); i++)
39 * Search for the MP Floating Pointer Structure:
40 * 1) in the first KB of the EBDA;
41 * 2) in the last KB of system base memory;
42 * 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
45 if((p = (bda[0x0F]<<8)|bda[0x0E])){
46 if(mp = mpscan(KADDR(p<<4), 1024))
50 p = ((bda[0x14]<<8)|bda[0x13])*1024;
51 if(mp = mpscan(KADDR(p-1024), 1024))
54 return mpscan(KADDR(0xF0000), 0x10000);
57 static int identify(void);
64 .intrenable= mpintrenable,
66 .introff= lapicintroff,
67 .fastclock= i8253read,
68 .timerset= lapictimerset,
79 if((cp = getconf("*nomp")) != nil && strtol(cp, 0, 0) != 0)
83 * Search for an MP configuration table. For now,
84 * don't accept the default configurations (physaddr == 0).
85 * Check for correct signature, calculate the checksum and,
86 * if correct, check the version.
87 * To do: check extended table checksum.
89 if((_mp_ = mpsearch()) == 0 || _mp_->physaddr == 0)
92 pcmp = KADDR(_mp_->physaddr);
93 if(memcmp(pcmp, "PCMP", 4))
96 length = pcmp->length;
98 for(p = (uchar*)pcmp; length; length--)
101 if(sum || (pcmp->version != 1 && pcmp->version != 4))
104 if(cpuserver && m->havetsc)
105 archmp.fastclock = tscticks;
116 if(arch->fastclock != tscticks)
123 x = MACHP(0)->tscticks;
124 while(x == MACHP(0)->tscticks)
126 wrmsr(0x10, MACHP(0)->tscticks);
127 cycles(&m->tscticks);
137 cycles(&m->tscticks); /* Uses the rdtsc instruction */