Change k8_powernow_init to accept a struct cpu_info * as argument,

so that in the informative messages it prints the correct cpu
and not curcpu().

This fixes the first part of PR kern/35676.
This commit is contained in:
xtraeme 2007-03-18 04:41:03 +00:00
parent c1a1692e09
commit 5ec1f7a202
5 changed files with 15 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: identcpu.c,v 1.14 2007/03/16 18:52:03 xtraeme Exp $ */
/* $NetBSD: identcpu.c,v 1.15 2007/03/18 04:41:03 xtraeme Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.14 2007/03/16 18:52:03 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.15 2007/03/18 04:41:03 xtraeme Exp $");
#include "opt_powernow_k8.h"
@ -131,7 +131,7 @@ identifycpu(struct cpu_info *ci)
if (CPUID2FAMILY(ci->ci_signature) == 15 &&
(cpu_model[0] == 'A' || cpu_model[0] == 'O') &&
powernow_probe(ci))
k8_powernow_init();
k8_powernow_init(ci);
#endif
x86_errata(ci, vendor);

View File

@ -1,4 +1,4 @@
/* $NetBSD: identcpu.c,v 1.60 2007/03/15 00:28:58 xtraeme Exp $ */
/* $NetBSD: identcpu.c,v 1.61 2007/03/18 04:41:03 xtraeme 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.60 2007/03/15 00:28:58 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.61 2007/03/18 04:41:03 xtraeme Exp $");
#include "opt_cputype.h"
#include "opt_enhanced_speedstep.h"
@ -1786,7 +1786,7 @@ identifycpu(struct cpu_info *ci)
#endif
#ifdef POWERNOW_K8
case 15:
k8_powernow_init();
k8_powernow_init(ci);
break;
#endif
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: powernow.h,v 1.6 2006/10/04 13:18:10 cube Exp $ */
/* $NetBSD: powernow.h,v 1.7 2007/03/18 04:41:03 xtraeme Exp $ */
/*-
* Copyright (c) 2004 Martin Végiard.
@ -175,14 +175,14 @@ struct powernow_pst_s {
uint8_t n_states;
};
int powernow_probe(struct cpu_info *);
int powernow_probe(struct cpu_info *);
/* i386/i386/powernow_k7.c */
void k7_powernow_init(void);
void k7_powernow_destroy(void);
/* x86/x86/powernow_k8.c */
void k8_powernow_init(void);
void k8_powernow_init(struct cpu_info *);
void k8_powernow_destroy(void);
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: powernow_k8.c,v 1.7 2006/09/03 04:55:30 christos Exp $ */
/* $NetBSD: powernow_k8.c,v 1.8 2007/03/18 04:41:03 xtraeme Exp $ */
/* $OpenBSD: powernow-k8.c,v 1.8 2006/06/16 05:58:50 gwk Exp $ */
/*-
@ -66,7 +66,7 @@
/* AMD POWERNOW K8 driver */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: powernow_k8.c,v 1.7 2006/09/03 04:55:30 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: powernow_k8.c,v 1.8 2007/03/18 04:41:03 xtraeme Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -327,19 +327,16 @@ k8pnow_states(struct powernow_cpu_state *cstate, uint32_t cpusig,
}
void
k8_powernow_init(void)
k8_powernow_init(struct cpu_info *ci)
{
uint64_t status;
uint32_t maxfid, maxvid, i;
const struct sysctlnode *freqnode, *node, *pnownode;
struct powernow_cpu_state *cstate;
struct cpu_info *ci;
char *cpuname;
const char *techname;
size_t len;
ci = curcpu();
freq_names_len = 0;
cpuname = ci->ci_dev->dv_xname;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lkminit_powernow.c,v 1.8 2006/10/04 21:47:56 cube Exp $ */
/* $NetBSD: lkminit_powernow.c,v 1.9 2007/03/18 04:41:03 xtraeme Exp $ */
/*
* Derived from:
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lkminit_powernow.c,v 1.8 2006/10/04 21:47:56 cube Exp $");
__KERNEL_RCSID(0, "$NetBSD: lkminit_powernow.c,v 1.9 2007/03/18 04:41:03 xtraeme Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -66,7 +66,6 @@ static uint32_t pn_family = 0;
static int
powernow_mod_handle(struct lkm_table *lkmtp, int cmd)
{
struct cpu_info *ci;
int err = 0; /* default = success */
switch (cmd) {
@ -77,14 +76,12 @@ powernow_mod_handle(struct lkm_table *lkmtp, int cmd)
if (lkmexists(lkmtp))
return EEXIST;
ci = curcpu();
if (powernow_probe(ci)) {
pn_family = CPUID2FAMILY(ci->ci_signature);
if (pn_family == 6)
k7_powernow_init();
else if (pn_family == 15)
k8_powernow_init();
k8_powernow_init(curcpu());
else
err = ENODEV;
} else