Chameleon

Chameleon Commit Details

Date:2011-09-15 14:26:03 (7 years 10 months ago)
Author:armel cadet-petit
Commit:1527
Parents: 1526
Message:improved AMD (cpu) support
Changes:
M/branches/cparm/i386/libsaio/cpu.c
M/branches/cparm/i386/libsaio/misc.c
M/branches/cparm/CHANGES

File differences

branches/cparm/CHANGES
1
12
23
34
......
7172
7273
7374
74
75
7576
7677
7778
- Improved detection of nb of core(s) and thread(s) for AMD processors
- Updated keymapper ...
- Applied scorpius's patch (to get an unstretched boot screen for nVidia cards on DVI) in boot0.s , disabled by default,
see - http://forum.voodooprojects.org/index.php/topic,2158.msg10345/boardseen.html#new - for more info.
- Added Slice's smbios_patcher fix
- Increased Booter Log size according to the chameleon trunck (thanck to Azimutz)
- Added BSD support (Credits to: nawcom, valv)
- Added BSD (OpenBSD and FreeBSD) support (Credits to: nawcom, valv)
- moved hibernation and ramdisk into modules
- Added a keyboard mapper module
- Added CPUFreq module (Credits to: valv, cparm)
branches/cparm/i386/libsaio/cpu.c
426426
427427
428428
429
430
429
430
431431
432432
433433
434434
435
435
436
436437
437438
438
439
440
439441
440442
441
443
442444
443
444445
445446
446447
......
506507
507508
508509
509
510
511
510
511
512
512513
513514
514515
515516
516517
517518
518
519
519520
520521
521522
......
535536
536537
537538
539
540
541
542
543
544
545
546
547
548
549
538550
539551
540552
......
595607
596608
597609
610
611
612
613
614
615
616
617
618
598619
599620
600621
......
694715
695716
696717
697
718
719
720
721
722
723
724
725
726
727
728
729
698730
699731
700732
......
881913
882914
883915
884
885
916
917
886918
887919
888920
uint64_tmsr;
uint8_tmaxcoef = 0, maxdiv = 0, currcoef = 0, currdiv = 0;
uint32_treg[4];
uint32_t cores_per_package;
uint32_t logical_per_package;
uint32_t cores_per_package = 0;
uint32_t logical_per_package = 0;
do_cpuid(0, reg);
p->CPU.Vendor= reg[ebx];
p->CPU.cpuid_max_basic = reg[eax];
#ifndef AMD_SUPPORT
do_cpuid2(0x00000004, 0, reg);
cores_per_package= bitfield(reg[eax], 31, 26) + 1;
#endif
/* get extended cpuid results */
do_cpuid(0x80000000, reg);
p->CPU.cpuid_max_ext = reg[eax];
p->CPU.cpuid_max_ext = reg[eax];
/* Begin of Copyright: from Apple's XNU cpuid.c */
/* get brand string (if supported) */
logical_per_package =
bitfield(reg[ebx], 23, 16);
else
logical_per_package = 1;
if (p->CPU.cpuid_max_ext >= 0x80000001)
logical_per_package = 1;
if (p->CPU.cpuid_max_ext >= 0x80000001)
{
do_cpuid(0x80000001, reg);
p->CPU.ExtFeatures =
quad(reg[ecx], reg[edx]);
}
if (p->CPU.cpuid_max_ext >= 0x80000007)
{
do_cpuid(0x80000007, reg);
#endif
}
#ifdef AMD_SUPPORT
if (p->CPU.cpuid_max_ext >= 0x80000008)
{
if (p->CPU.Features & CPUID_FEATURE_HTT)
{
do_cpuid(0x80000008, reg);
cores_per_package= bitfield(reg[ecx], 7 , 0) + 1; // NC + 1
}
}
#endif
if (p->CPU.cpuid_max_basic >= 0x5) {
/*
* Extract the Monitor/Mwait Leaf info:
#endif
if (p->CPU.NoCores == 0)
{
#ifdef AMD_SUPPORT
if (!cores_per_package) {
//legacy method
if ((p->CPU.ExtFeatures & _HBit(1)/* CmpLegacy */) && ( p->CPU.Features & CPUID_FEATURE_HTT) )
cores_per_package = logical_per_package;
else
cores_per_package = 1;
}
#endif
p->CPU.NoThreads = logical_per_package;
p->CPU.NoCores = cores_per_package ? cores_per_package : 1 ;
}
}
}
}
}
// NOTE: This is not the approved method,
// the method provided by AMD is:
// if ((PowerNow == enabled (p->CPU.cpuid_max_ext >= 0x80000007)) && (StartupFID(??) != MaxFID(??))) then "mobile processor present"
if (strstr(p->CPU.BrandString, "obile"))
p->CPU.isMobile = true;
else
p->CPU.isMobile = false;
DBG("%s platform detected.\n", p->CPU.isMobile?"Mobile":"Desktop");
#else
if ((p->CPU.Vendor == 0x756E6547 /* Intel */) &&
((p->CPU.Family == 0x06) ||
p->CPU.isMobile = (rdmsr64(0x17) & (1 << 28));
break;
}
// TODO: this part of code seems to work very well for the intel platforms, need to find the equivalent for AMD
DBG("%s platform found.\n", p->CPU.isMobile?"Mobile":"Desktop");
DBG("%s platform detected.\n", p->CPU.isMobile?"Mobile":"Desktop");
}
#endif
if (!cpuFrequency) cpuFrequency = tscFrequency;
branches/cparm/i386/libsaio/misc.c
107107
108108
109109
110
110
111111
112112
113113
......
118118
119119
120120
121
121122
122
123123
124124
125125
/* wait until done */
flushKeyboardInputBuffer();
}
#if UNUSED
void turnOffFloppy(void)
{
/*
*/
outb(0x3F2, 0x00);
}
#endif
//==========================================================================
// Return the platform name for this hardware.
//

Archive Download the corresponding diff file

Revision: 1527