示例#1
0
文件: amd.cpp 项目: AmirAbrams/haiku
static status_t
amd_stdops(int32 op, ...)
{
	switch (op) {
		case B_MODULE_INIT:
			return amd_init();
		case B_MODULE_UNINIT:
			return B_OK;
	}

	return B_ERROR;
}
示例#2
0
// returns 0 for success or negative for failure
//int kern_pmc_init(struct pmc_info *info)
int kern_pmc_init(void)
{
	int status = STATUS_UNKNOWN_CPU_INIT;
	struct pmc_info info;
   ULONG64 cr4;

	if (!cpu_id(&info)) return STATUS_NO_CPUID;

	// we need to at least support MSR registers, RDTSC, & RDPMC
	if(!(info.features & MSR)) return STATUS_NO_MSR;
	if(!(info.features & TSC)) return STATUS_NO_TSC;
	if(!(info.features & MMX)) return STATUS_NO_MMX;	// assume MMX tracks RDPMC

	if (!strncmp(info.vendor, "GenuineIntel", 12)) status = intel_init(info.family,info.stepping,info.model);
	else if (!strncmp(info.vendor, "AuthenticAMD", 12)) status = amd_init(info.family);
// we really don't need to claim support for Cyrix, do we?
// else if (!strncmp(info.vendor, "CyrixInstead", 12)) status = cyrix_init(info.family);

	if(status == STATUS_SUCCESS) set_cr4_pce();

	return status;
}