summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-15 19:56:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-15 19:56:49 +0000
commitc51f2c1be7f15860a9c5bce9b205e51292c3a932 (patch)
tree4b55e5d384c0456e43f6d91fce37b71593302b22 /sys
parent0c58d5b0133ee22395bc5043e5b9c62e0ee6cf54 (diff)
spacing
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/powernow-k7.c19
-rw-r--r--sys/arch/i386/i386/powernow-k8.c34
2 files changed, 29 insertions, 24 deletions
diff --git a/sys/arch/i386/i386/powernow-k7.c b/sys/arch/i386/i386/powernow-k7.c
index ca008915b0f..706384f2005 100644
--- a/sys/arch/i386/i386/powernow-k7.c
+++ b/sys/arch/i386/i386/powernow-k7.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: powernow-k7.c,v 1.9 2005/11/28 17:48:02 mickey Exp $ */
+/* $OpenBSD: powernow-k7.c,v 1.10 2006/03/15 19:56:48 deraadt Exp $ */
+
/*
* Copyright (c) 2004 Martin Végiard.
* All rights reserved.
@@ -153,10 +154,10 @@ struct k7pnow_cpu_state {
};
struct psb_s {
- char signature[10]; /* AMDK7PNOW! */
+ char signature[10]; /* AMDK7PNOW! */
uint8_t version;
uint8_t flags;
- uint16_t ttime; /* Min Settling time */
+ uint16_t ttime; /* Min Settling time */
uint8_t reserved;
uint8_t n_pst;
};
@@ -309,7 +310,7 @@ k7pnow_states(struct k7pnow_cpu_state *cstate, uint32_t cpusig,
if (cpusig == pst->signature && fid == pst->fid
&& vid == pst->vid) {
- switch(pst->signature) {
+ switch (pst->signature) {
case 0x760:
case 0x761:
case 0x762:
@@ -327,8 +328,8 @@ k7pnow_states(struct k7pnow_cpu_state *cstate, uint32_t cpusig,
continue;
cstate->n_states = pst->n_states;
return (k7pnow_decode_pst(cstate,
- p + sizeof(struct pst_s),
- cstate->n_states));
+ p + sizeof(struct pst_s),
+ cstate->n_states));
}
p += sizeof(struct pst_s) + (2 * pst->n_states);
}
@@ -383,14 +384,14 @@ k7_powernow_init(void)
}
if (k7pnow_states(cstate, ci->ci_signature, maxfid, startvid)) {
if (cstate->n_states) {
- printf("%s: AMD %s: available states ",
+ printf("%s: AMD %s: available states ",
ci->ci_dev.dv_xname, techname);
- for(i = 0; i < cstate->n_states; i++) {
+ for (i = 0; i < cstate->n_states; i++) {
state = &cstate->state_table[i];
printf("%c%d", i==0 ? '(' : ',',
((state->freq / 100000)+1)*100);
}
- printf(")\n");
+ printf(")\n");
k7pnow_current_state[cpu_number()] = cstate;
cpu_setperf = k7_powernow_setperf;
}
diff --git a/sys/arch/i386/i386/powernow-k8.c b/sys/arch/i386/i386/powernow-k8.c
index 4ee4d61811c..a8d4ed0acb8 100644
--- a/sys/arch/i386/i386/powernow-k8.c
+++ b/sys/arch/i386/i386/powernow-k8.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: powernow-k8.c,v 1.4 2006/03/08 03:33:21 uwe Exp $ */
+/* $OpenBSD: powernow-k8.c,v 1.5 2006/03/15 19:56:48 deraadt Exp $ */
+
/*
* Copyright (c) 2004 Martin Végiard.
* All rights reserved.
@@ -133,10 +134,10 @@ struct k8pnow_cpu_state {
};
struct psb_s {
- char signature[10]; /* AMDK7PNOW! */
+ char signature[10]; /* AMDK7PNOW! */
uint8_t version;
uint8_t flags;
- uint16_t ttime; /* Min Settling time */
+ uint16_t ttime; /* Min Settling time */
uint8_t reserved;
uint8_t n_pst;
};
@@ -149,7 +150,7 @@ struct pst_s {
uint8_t n_states;
};
-struct k8pnow_cpu_state *k8pnow_current_state = NULL;
+struct k8pnow_cpu_state *k8pnow_current_state = NULL;
/*
* Prototypes
@@ -159,9 +160,12 @@ int k8pnow_decode_pst(struct k8pnow_cpu_state *, uint8_t *);
int k8pnow_states(struct k8pnow_cpu_state *, uint32_t, unsigned int,
unsigned int);
-int k8pnow_read_pending_wait(uint64_t * status) {
+int
+k8pnow_read_pending_wait(uint64_t *status)
+{
unsigned int i = 1000;
- while(i--) {
+
+ while (i--) {
*status = rdmsr(MSR_AMDK7_FIDVID_STATUS);
if (!PN8_STA_PENDING(*status))
return 0;
@@ -176,8 +180,7 @@ k8_powernow_setperf(int level)
{
unsigned int i, low, high, freq;
uint64_t status;
- int cfid, cvid, fid = 0, vid = 0;
- int rvo;
+ int cfid, cvid, fid = 0, vid = 0, rvo;
u_int val;
struct k8pnow_cpu_state *cstate;
@@ -291,14 +294,15 @@ k8pnow_decode_pst(struct k8pnow_cpu_state *cstate, uint8_t *p)
{
int i, j, n;
struct k8pnow_state state;
+
for (n = 0, i = 0; i < cstate->n_states; i++) {
state.fid = *p++;
state.vid = *p++;
-
- /*
+
+ /*
* The minimum supported frequency per the data sheet is 800MHz
- * The maximum supported frequency is 5000MHz.
- */
+ * The maximum supported frequency is 5000MHz.
+ */
state.freq = 800 + state.fid * 100;
j = n;
while (j > 0 && cstate->state_table[j - 1].freq > state.freq) {
@@ -337,7 +341,7 @@ k8pnow_states(struct k8pnow_cpu_state *cstate, uint32_t cpusig,
cstate->low = PN8_PSB_TO_BATT(psb->reserved);
p+= sizeof(struct psb_s);
- for(i = 0; i < psb->n_pst; ++i) {
+ for (i = 0; i < psb->n_pst; ++i) {
pst = (struct pst_s *) p;
cstate->pll = pst->pll;
@@ -367,7 +371,7 @@ k8_powernow_init(void)
char * techname = NULL;
ci = curcpu();
- if(k8pnow_current_state)
+ if (k8pnow_current_state)
return;
cstate = malloc(sizeof(struct k8pnow_cpu_state), M_DEVBUF, M_NOWAIT);
@@ -392,7 +396,7 @@ k8_powernow_init(void)
if (cstate->n_states) {
printf("%s: AMD %s available states ",
ci->ci_dev.dv_xname, techname);
- for(i= 0; i < cstate->n_states; i++) {
+ for (i= 0; i < cstate->n_states; i++) {
state = &cstate->state_table[i];
printf("%c%d", i==0 ? '(' : ',',
state->freq);