Mon Aug 16 20:20:44 2010 UTC ()
Fix comments.


(jruoho)
diff -r1.25 -r1.26 src/sys/dev/acpi/acpi_cpu_pstate.c

cvs diff -r1.25 -r1.26 src/sys/dev/acpi/acpi_cpu_pstate.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_cpu_pstate.c 2010/08/16 20:07:57 1.25
+++ src/sys/dev/acpi/acpi_cpu_pstate.c 2010/08/16 20:20:44 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_cpu_pstate.c,v 1.25 2010/08/16 20:07:57 jruoho Exp $ */ 1/* $NetBSD: acpi_cpu_pstate.c,v 1.26 2010/08/16 20:20:44 jruoho Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi> 4 * Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.25 2010/08/16 20:07:57 jruoho Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.26 2010/08/16 20:20:44 jruoho Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/evcnt.h> 33#include <sys/evcnt.h>
34#include <sys/kmem.h> 34#include <sys/kmem.h>
35#include <sys/once.h> 35#include <sys/once.h>
36 36
37#include <dev/acpi/acpireg.h> 37#include <dev/acpi/acpireg.h>
38#include <dev/acpi/acpivar.h> 38#include <dev/acpi/acpivar.h>
39#include <dev/acpi/acpi_cpu.h> 39#include <dev/acpi/acpi_cpu.h>
40 40
41#define _COMPONENT ACPI_BUS_COMPONENT 41#define _COMPONENT ACPI_BUS_COMPONENT
42ACPI_MODULE_NAME ("acpi_cpu_pstate") 42ACPI_MODULE_NAME ("acpi_cpu_pstate")
43 43
@@ -660,30 +660,26 @@ acpicpu_pstate_pct(struct acpicpu_softc  @@ -660,30 +660,26 @@ acpicpu_pstate_pct(struct acpicpu_softc
660 rv = AE_AML_BAD_RESOURCE_VALUE; 660 rv = AE_AML_BAD_RESOURCE_VALUE;
661 goto out; 661 goto out;
662 } 662 }
663 663
664 if (width != 8 && width != 16 && width != 32) { 664 if (width != 8 && width != 16 && width != 32) {
665 rv = AE_AML_BAD_RESOURCE_VALUE; 665 rv = AE_AML_BAD_RESOURCE_VALUE;
666 goto out; 666 goto out;
667 } 667 }
668 668
669 break; 669 break;
670 670
671 case ACPI_ADR_SPACE_FIXED_HARDWARE: 671 case ACPI_ADR_SPACE_FIXED_HARDWARE:
672 672
673 /* 
674 * With XPSS the _PCT registers incorporate 
675 * the addresses of the appropriate MSRs. 
676 */ 
677 if ((sc->sc_flags & ACPICPU_FLAG_P_XPSS) != 0) { 673 if ((sc->sc_flags & ACPICPU_FLAG_P_XPSS) != 0) {
678 674
679 if (reg[i]->reg_bitwidth != 64) { 675 if (reg[i]->reg_bitwidth != 64) {
680 rv = AE_AML_BAD_RESOURCE_VALUE; 676 rv = AE_AML_BAD_RESOURCE_VALUE;
681 goto out; 677 goto out;
682 } 678 }
683 679
684 if (reg[i]->reg_bitoffset != 0) { 680 if (reg[i]->reg_bitoffset != 0) {
685 rv = AE_AML_BAD_RESOURCE_VALUE; 681 rv = AE_AML_BAD_RESOURCE_VALUE;
686 goto out; 682 goto out;
687 } 683 }
688 684
689 break; 685 break;
@@ -705,28 +701,28 @@ acpicpu_pstate_pct(struct acpicpu_softc  @@ -705,28 +701,28 @@ acpicpu_pstate_pct(struct acpicpu_softc
705 if (reg[0]->reg_spaceid != reg[1]->reg_spaceid) { 701 if (reg[0]->reg_spaceid != reg[1]->reg_spaceid) {
706 rv = AE_AML_INVALID_SPACE_ID; 702 rv = AE_AML_INVALID_SPACE_ID;
707 goto out; 703 goto out;
708 } 704 }
709 705
710 (void)memcpy(&sc->sc_pstate_control, reg[0], size); 706 (void)memcpy(&sc->sc_pstate_control, reg[0], size);
711 (void)memcpy(&sc->sc_pstate_status, reg[1], size); 707 (void)memcpy(&sc->sc_pstate_status, reg[1], size);
712 708
713 if ((sc->sc_flags & ACPICPU_FLAG_P_XPSS) == 0) 709 if ((sc->sc_flags & ACPICPU_FLAG_P_XPSS) == 0)
714 goto out; 710 goto out;
715 711
716 /* 712 /*
717 * In XPSS the control address can not be zero, 713 * In XPSS the control address can not be zero,
718 * but the status address may be. Comparable to 714 * but the status address may be. In this case,
719 * T-states, in this we can ignore the status 715 * comparable to T-states, we can ignore the status
720 * check during the P-state (FFH) transition. 716 * check during the P-state (FFH) transition.
721 */ 717 */
722 if (sc->sc_pstate_control.reg_addr == 0) { 718 if (sc->sc_pstate_control.reg_addr == 0) {
723 rv = AE_AML_BAD_RESOURCE_LENGTH; 719 rv = AE_AML_BAD_RESOURCE_LENGTH;
724 goto out; 720 goto out;
725 } 721 }
726 722
727 /* 723 /*
728 * If XPSS is present, copy the MSR addresses 724 * If XPSS is present, copy the MSR addresses
729 * to the P-state structures for convenience. 725 * to the P-state structures for convenience.
730 */ 726 */
731 for (i = 0; i < sc->sc_pstate_count; i++) { 727 for (i = 0; i < sc->sc_pstate_count; i++) {
732 728