Subject: Re: Re: Powernow support?
To: TAMURA Kent <kent@NetBSD.org>
From: Joel CARNAT <joel@carnat.net>
List: port-amd64
Date: 07/31/2006 12:35:21
--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Mon, Jul 31 2006 - 17:30, TAMURA Kent wrote:
>=20
> > Anyone wants to review the patch or try to fix the code if something is=
wrong?
> > http://www.xtrarom.org/~juan/powernow_k8.patch
>=20
> I moved powernow_k8.c into sys/arch/x86/x86, modified some files
> for i386, and tested it. Unfortunately, it didn't work because
> the BIOS of my machine doesn't provide AMDK7PNOW! PSB entry. I
> guess the machine provides such information just via ACPI.
>=20
> The following patch fixes uninitialized cstate->n_states
> dereference and syctl_createv() failures.
>=20
I added this patch to my i386 source tree (3.99.23) and it still don't
show anything either :(
I tested OpenBSD 3.9 a few weeks ago and it noticed Cool'n'Quiet.
Plus 3 or 4 frequencies in sysctl. For what it's worth knowing it ;)
> --=20
> TAMURA Kent <kent_2006 at hauN.org> <kent at NetBSD.org>
>=20
>=20
> --- arch/amd64/amd64/powernow_k8.c 2006-07-31 17:20:19.000000000 +0900
> +++ arch/x86/x86/powernow_k8.c 2006-07-31 17:21:15.000000000 +0900
> @@ -415,7 +415,7 @@
> {
> uint64_t status;
> u_int maxfid, maxvid, i;
> - const struct sysctlnode *node, *pnownode, *freqnode;
> + const struct sysctlnode *node, *pnownode;
> struct k8pnow_cpu_state *cstate;
> struct k8pnow_state *state;
> struct cpu_info *ci;
> @@ -448,18 +448,6 @@
> else
> techname =3D "Cool`n'Quiet";
> =20
> - freq_names_len =3D cstate->n_states *(sizeof("9999 ")-1) + 1;
> - freq_names =3D malloc(freq_names_len, M_SYSCTLDATA, M_WAITOK);
> -
> - if (freq_names =3D=3D NULL)
> - panic("%s: freq_names alloc not possible", __func__);
> -
> - freq_table =3D malloc(sizeof(struct k8pnow_state) *=20
> - cstate->n_states , M_TEMP, M_WAITOK);
> -
> - if (freq_table =3D=3D NULL)
> - panic("%s: freq_table alloc not possible", __func__);
> -
> if (k8pnow_states(cstate, ci->ci_signature, maxfid, maxvid)) {
> if (cstate->n_states) {
> for (i =3D cstate->n_states; i > 0; i--) {
> @@ -476,6 +464,19 @@
> cstate->n_states);
> }
> }
> + if (k8pnow_current_state =3D=3D NULL) {
> + return;
> + }
> +
> + freq_names_len =3D cstate->n_states *(sizeof("9999 ")-1) + 1;
> + freq_names =3D malloc(freq_names_len, M_SYSCTLDATA, M_WAITOK);
> + if (freq_names =3D=3D NULL)
> + panic("%s: freq_names alloc not possible", __func__);
> +
> + freq_table =3D malloc(sizeof(struct k8pnow_state) *=20
> + cstate->n_states , M_TEMP, M_WAITOK);
> + if (freq_table =3D=3D NULL)
> + panic("%s: freq_table alloc not possible", __func__);
> =20
> /* Create sysctl machdep.powernow.frequency. */
> if ((rc =3D sysctl_createv(SYSCTLLOG, 0, NULL, &node,
> @@ -492,7 +493,7 @@
> CTL_CREATE, CTL_EOL)) !=3D 0)
> goto err;
> =20
> - if ((rc =3D sysctl_createv(SYSCTLLOG, 0, &freqnode, &node,
> + if ((rc =3D sysctl_createv(SYSCTLLOG, 0, &pnownode, &node,
> CTLFLAG_READWRITE,
> CTLTYPE_INT, "target", NULL,
> powernow_sysctl_helper, 0, NULL, 0,
> @@ -501,7 +502,7 @@
> =20
> powernow_node_target =3D node->sysctl_num;
> =20
> - if ((rc =3D sysctl_createv(SYSCTLLOG, 0, &freqnode, &node,
> + if ((rc =3D sysctl_createv(SYSCTLLOG, 0, &pnownode, &node,
> 0,
> CTLTYPE_INT, "current", NULL,
> powernow_sysctl_helper, 0, NULL, 0,
> @@ -510,7 +511,7 @@
> =20
> powernow_node_current =3D node->sysctl_num;
> =20
> - if ((rc =3D sysctl_createv(SYSCTLLOG, 0, &freqnode, &node,
> + if ((rc =3D sysctl_createv(SYSCTLLOG, 0, &pnownode, &node,
> 0,
> CTLTYPE_STRING, "available", NULL,
> NULL, 0, freq_names, freq_names_len,
>=20
--7JfCtLOvnd9MIVvH
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)
iD8DBQFEzdzp0/VH7L7F7Y4RAgmeAJ0fJ6pAZTup563lPIvfU8+LnOJ1awCfb5VU
3Rdv4d724rSGDjr2OSx5RpE=
=cfMP
-----END PGP SIGNATURE-----
--7JfCtLOvnd9MIVvH--