Support for VIA Esther (From FreeBSD)

This commit is contained in:
christos 2007-07-03 17:07:54 +00:00
parent 06b3ace137
commit 2d14013f2c
3 changed files with 32 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: identcpu.c,v 1.70 2007/07/01 20:12:36 xtraeme Exp $ */
/* $NetBSD: identcpu.c,v 1.71 2007/07/03 17:07:54 christos Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.70 2007/07/01 20:12:36 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.71 2007/07/03 17:07:54 christos Exp $");
#include "opt_cputype.h"
#include "opt_enhanced_speedstep.h"
@ -480,7 +480,7 @@ const struct cpu_cpuid_nameclass i386_cpuid_cpus[] = {
{
0, 0, 0, 0, 0, 0, "C3 Samuel",
"C3 Samuel 2/Ezra", "C3 Ezra-T",
"C3 Nehemiah", 0, 0, 0, 0, 0, 0,
"C3 Nehemiah", "C7 Esther", 0, 0, 0, 0, 0,
"C3" /* Default */
},
NULL,
@ -672,12 +672,14 @@ via_cpu_probe(struct cpu_info *ci)
/* Nehemiah or Esther */
CPUID(0xc0000000, descs[0], descs[1], descs[2], descs[3]);
lfunc = descs[0];
if (lfunc == 0xc0000001) {
CPUID(lfunc, descs[0], descs[1], descs[2], descs[3]);
if (lfunc >= 0xc0000001) {
CPUID(0xc0000001, descs[0], descs[1], descs[2],
descs[3]);
lfunc = descs[3];
if (model > 0x9 || stepping >= 8) { /* ACE */
if ((lfunc & 0xc0) == 0xc0) {
ci->ci_padlock_flags |= CPUID_FEAT_VACE;
ci->ci_padlock_flags = lfunc;
#define VIA_ACE (CPUID_VIA_HAS_ACE|CPUID_VIA_DO_ACE)
if ((lfunc & VIA_ACE) == VIA_ACE) {
msr = rdmsr(MSR_VIA_ACE);
wrmsr(MSR_VIA_ACE,
msr | MSR_VIA_ACE_ENABLE);
@ -1474,6 +1476,12 @@ identifycpu(struct cpu_info *ci)
aprint_verbose("%s: features3 %s\n", cpuname, buf);
}
if (ci->ci_padlock_flags) {
bitmask_snprintf(ci->ci_padlock_flags,
CPUID_FLAGS_PADLOCK, buf, MAXPATHLEN);
aprint_verbose("%s: padlock features %s\n", cpuname, buf);
}
free(buf, M_TEMP);
if (*cpu_brand_string != '\0')

View File

@ -1,4 +1,4 @@
/* $NetBSD: specialreg.h,v 1.16 2007/06/04 16:21:29 xtraeme Exp $ */
/* $NetBSD: specialreg.h,v 1.17 2007/07/03 17:07:55 christos Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@ -155,11 +155,20 @@
"\0373DNOW2\0403DNOW"
/*
* "Features" that are copied from elsewhere -- not necessarily tied to
* a specific CPUID response
* Centaur Extended Feature flags
*/
#define CPUID_VIA_HAS_RNG 0x00000004 /* Random number generator */
#define CPUID_VIA_DO_RNG 0x00000008
#define CPUID_VIA_HAS_ACE 0x00000040 /* AES Encryption */
#define CPUID_VIA_DO_ACE 0x00000080
#define CPUID_VIA_HAS_ACE2 0x00000100 /* AES+CTR instructions */
#define CPUID_VIA_DO_ACE2 0x00000200
#define CPUID_VIA_HAS_PHE 0x00000400 /* SHA1+SHA256 HMAC */
#define CPUID_VIA_DO_PHE 0x00000800
#define CPUID_VIA_HAS_PMM 0x00001000 /* RSA Instructions */
#define CPUID_VIA_DO_PMM 0x00002000
#define CPUID_FEAT_VACE 0x00000002 /* VIA C3 AES Crypto Extension */
#define CPUID_FLAGS_PADLOCK "\20\3RNG\7AES\11AES/CTR\13SHA1/SHA256\15RSA"
/*
* CPUID "features" bits in %ecx

View File

@ -1,5 +1,5 @@
/* $OpenBSD: via.c,v 1.8 2006/11/17 07:47:56 tom Exp $ */
/* $NetBSD: via_padlock.c,v 1.4 2007/03/21 23:24:58 xtraeme Exp $ */
/* $NetBSD: via_padlock.c,v 1.5 2007/07/03 17:07:55 christos Exp $ */
/*-
* Copyright (c) 2003 Jason Wright
@ -20,7 +20,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.4 2007/03/21 23:24:58 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.5 2007/07/03 17:07:55 christos Exp $");
#include "opt_viapadlock.h"
@ -57,7 +57,8 @@ static __inline void via_padlock_cbc(void *, void *, void *, void *, int,
void
via_padlock_attach(void)
{
if (!(cpu_feature_padlock & CPUID_FEAT_VACE))
#define VIA_ACE (CPUID_VIA_HAS_ACE|CPUID_VIA_DO_ACE)
if ((cpu_feature_padlock & VIA_ACE) != VIA_ACE)
return;
struct via_padlock_softc *vp_sc;