Module Name:    src
Committed By:   riastradh
Date:           Thu Sep 22 14:42:29 UTC 2022

Modified Files:
        src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h

Log Message:
ichlpcib(4), tco(4): Rename iot -> pmt, ioh -> pmh.

Makes it clearer that this is specifically about the power management
controller (PMC) registers relative to PMBASE.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.57 src/sys/arch/x86/pci/ichlpcib.c:1.58
--- src/sys/arch/x86/pci/ichlpcib.c:1.57	Thu Sep 22 14:42:09 2022
+++ src/sys/arch/x86/pci/ichlpcib.c	Thu Sep 22 14:42:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.58 2022/09/22 14:42:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.58 2022/09/22 14:42:29 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -85,8 +85,8 @@ struct lpcib_softc {
 	pcireg_t		sc_rcba_reg;
 
 	/* Power management variables. */
-	bus_space_tag_t		sc_iot;
-	bus_space_handle_t	sc_ioh;
+	bus_space_tag_t		sc_pmt;
+	bus_space_handle_t	sc_pmh;
 	bus_size_t		sc_iosize;
 
 	/* HPET variables. */
@@ -339,10 +339,10 @@ lpcibattach(device_t parent, device_t se
 	 * than LPCIB_PCI_PM_SIZE. It makes impossible to use
 	 * pci_mapreg_submap() because the function does range check.
 	 */
-	sc->sc_iot = pa->pa_iot;
+	sc->sc_pmt = pa->pa_iot;
 	pmbase = pci_conf_read(pa->pa_pc, pa->pa_tag, LPCIB_PCI_PMBASE);
-	if (bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(pmbase),
-	    LPCIB_PCI_PM_SIZE, 0, &sc->sc_ioh) != 0) {
+	if (bus_space_map(sc->sc_pmt, PCI_MAPREG_IO_ADDR(pmbase),
+	    LPCIB_PCI_PM_SIZE, 0, &sc->sc_pmh) != 0) {
 		aprint_error_dev(self,
 	    	"can't map power management i/o space\n");
 		return;
@@ -517,7 +517,7 @@ lpcibdetach(device_t self, int flags)
 	if (sc->sc_has_rcba)
 		bus_space_unmap(sc->sc_rcbat, sc->sc_rcbah, LPCIB_RCBA_SIZE);
 
-	bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_iosize);
+	bus_space_unmap(sc->sc_pmt, sc->sc_pmh, sc->sc_iosize);
 
 	return pcibdetach(self, flags);
 }
@@ -606,7 +606,7 @@ pmtimer_configure(device_t self)
 	}
 
 	/* Attach our PM timer with the generic acpipmtimer function */
-	sc->sc_pmtimer = acpipmtimer_attach(self, sc->sc_iot, sc->sc_ioh,
+	sc->sc_pmtimer = acpipmtimer_attach(self, sc->sc_pmt, sc->sc_pmh,
 	    PMC_PM1_TMR, 0);
 }
 
@@ -639,8 +639,8 @@ tcotimer_configure(device_t self)
 		arg.ta_version = TCO_VERSION_RCBA;
 	else
 		arg.ta_version = TCO_VERSION_PCIB;
-	arg.ta_iot = sc->sc_iot;
-	arg.ta_ioh = sc->sc_ioh;
+	arg.ta_pmt = sc->sc_pmt;
+	arg.ta_pmh = sc->sc_pmh;
 	arg.ta_rcbat = sc->sc_rcbat;
 	arg.ta_rcbah = sc->sc_rcbah;
 	arg.ta_pcib = &sc->sc_pcib;
@@ -667,9 +667,9 @@ tcotimer_unconfigure(device_t self, int 
  * Intel ICH SpeedStep support.
  */
 #define SS_READ(sc, reg) \
-	bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (reg))
+	bus_space_read_1((sc)->sc_pmt, (sc)->sc_pmh, (reg))
 #define SS_WRITE(sc, reg, val) \
-	bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
+	bus_space_write_1((sc)->sc_pmt, (sc)->sc_pmh, (reg), (val))
 
 /*
  * Linux driver says that SpeedStep on older chipsets cause

Index: src/sys/arch/x86/pci/tco.c
diff -u src/sys/arch/x86/pci/tco.c:1.6 src/sys/arch/x86/pci/tco.c:1.7
--- src/sys/arch/x86/pci/tco.c:1.6	Thu Sep 22 14:42:09 2022
+++ src/sys/arch/x86/pci/tco.c	Thu Sep 22 14:42:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $	*/
+/*	$NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -55,8 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.6 
 
 struct tco_softc {
 	struct sysmon_wdog	sc_smw;
-	bus_space_tag_t		sc_iot;
-	bus_space_handle_t	sc_ioh;
+	bus_space_tag_t		sc_pmt;
+	bus_space_handle_t	sc_pmh;
 	bus_space_tag_t		sc_rcbat;
 	bus_space_handle_t	sc_rcbah;
 	struct pcib_softc *	sc_pcib;
@@ -90,7 +90,7 @@ tco_match(device_t parent, cfdata_t matc
 {
 	struct tco_attach_args *ta = aux;
 
-	if (ta->ta_iot == 0)
+	if (ta->ta_pmt == 0)
 		return 0;
 
 	switch (ta->ta_version) {
@@ -113,8 +113,8 @@ tco_attach(device_t parent, device_t sel
 
 	/* Retrieve bus info shared with parent/siblings */
 	sc->sc_version = ta->ta_version;
-	sc->sc_iot = ta->ta_iot;
-	sc->sc_ioh = ta->ta_ioh;
+	sc->sc_pmt = ta->ta_pmt;
+	sc->sc_pmh = ta->ta_pmh;
 	sc->sc_rcbat = ta->ta_rcbat;
 	sc->sc_rcbah = ta->ta_rcbah;
 	sc->sc_pcib = ta->ta_pcib;
@@ -129,7 +129,7 @@ tco_attach(device_t parent, device_t sel
 	 * Enable TCO timeout SMI only if the hardware reset does not
 	 * work. We don't know what the SMBIOS does.
 	 */
-	ioreg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, PMC_SMI_EN);
+	ioreg = bus_space_read_4(sc->sc_pmt, sc->sc_pmh, PMC_SMI_EN);
 	ioreg &= ~PMC_SMI_EN_TCO_EN;
 
 	/*
@@ -140,7 +140,7 @@ tco_attach(device_t parent, device_t sel
 		ioreg |= PMC_SMI_EN_TCO_EN;
 	}
 	if ((ioreg & PMC_SMI_EN_GBL_SMI_EN) != 0) {
-		bus_space_write_4(sc->sc_iot, sc->sc_ioh, PMC_SMI_EN, ioreg);
+		bus_space_write_4(sc->sc_pmt, sc->sc_pmh, PMC_SMI_EN, ioreg);
 	}
 
 	/* Reset the watchdog status registers. */
@@ -243,18 +243,18 @@ tcotimer_setmode(struct sysmon_wdog *smw
 		switch (sc->sc_version) {
 		case TCO_VERSION_RCBA:
 			/* ICH6 or newer */
-			ich6period = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
+			ich6period = bus_space_read_2(sc->sc_pmt, sc->sc_pmh,
 			    PMC_TCO_TMR2);
 			ich6period &= 0xfc00;
-			bus_space_write_2(sc->sc_iot, sc->sc_ioh,
+			bus_space_write_2(sc->sc_pmt, sc->sc_pmh,
 			    PMC_TCO_TMR2, ich6period | period);
 			break;
 		case TCO_VERSION_PCIB:
 			/* ICH5 or older */
-			ich5period = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
+			ich5period = bus_space_read_1(sc->sc_pmt, sc->sc_pmh,
 			    PMC_TCO_TMR);
 			ich5period &= 0xc0;
-			bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+			bus_space_write_1(sc->sc_pmt, sc->sc_pmh,
 			    PMC_TCO_TMR, ich5period | period);
 			break;
 		}
@@ -275,10 +275,10 @@ tcotimer_tickle(struct sysmon_wdog *smw)
 	/* any value is allowed */
 	switch (sc->sc_version) {
 	case TCO_VERSION_RCBA:
-		bus_space_write_2(sc->sc_iot, sc->sc_ioh, PMC_TCO_RLD, 1);
+		bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO_RLD, 1);
 		break;
 	case TCO_VERSION_PCIB:
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh, PMC_TCO_RLD, 1);
+		bus_space_write_1(sc->sc_pmt, sc->sc_pmh, PMC_TCO_RLD, 1);
 		break;
 	}
 
@@ -290,9 +290,9 @@ tcotimer_stop(struct tco_softc *sc)
 {
 	uint16_t ioreg;
 
-	ioreg = bus_space_read_2(sc->sc_iot, sc->sc_ioh, PMC_TCO1_CNT);
+	ioreg = bus_space_read_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT);
 	ioreg |= PMC_TCO1_CNT_TCO_TMR_HLT;
-	bus_space_write_2(sc->sc_iot, sc->sc_ioh, PMC_TCO1_CNT, ioreg);
+	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT, ioreg);
 }
 
 static void
@@ -300,19 +300,19 @@ tcotimer_start(struct tco_softc *sc)
 {
 	uint16_t ioreg;
 
-	ioreg = bus_space_read_2(sc->sc_iot, sc->sc_ioh, PMC_TCO1_CNT);
+	ioreg = bus_space_read_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT);
 	ioreg &= ~PMC_TCO1_CNT_TCO_TMR_HLT;
-	bus_space_write_2(sc->sc_iot, sc->sc_ioh, PMC_TCO1_CNT, ioreg);
+	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT, ioreg);
 }
 
 static void
 tcotimer_status_reset(struct tco_softc *sc)
 {
-	bus_space_write_2(sc->sc_iot, sc->sc_ioh, PMC_TCO1_STS,
+	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_STS,
 	    PMC_TCO1_STS_TIMEOUT);
-	bus_space_write_2(sc->sc_iot, sc->sc_ioh, PMC_TCO2_STS,
+	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO2_STS,
 	    PMC_TCO2_STS_BOOT_STS);
-	bus_space_write_2(sc->sc_iot, sc->sc_ioh, PMC_TCO2_STS,
+	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO2_STS,
 	    PMC_TCO2_STS_SECONDS_TO_STS);
 }
 

Index: src/sys/arch/x86/pci/tco.h
diff -u src/sys/arch/x86/pci/tco.h:1.3 src/sys/arch/x86/pci/tco.h:1.4
--- src/sys/arch/x86/pci/tco.h:1.3	Thu Sep 22 14:41:49 2022
+++ src/sys/arch/x86/pci/tco.h	Thu Sep 22 14:42:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.h,v 1.3 2022/09/22 14:41:49 riastradh Exp $	*/
+/*	$NetBSD: tco.h,v 1.4 2022/09/22 14:42:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -41,8 +41,8 @@ struct tco_attach_args {
 		TCO_VERSION_PCIB = 0,
 		TCO_VERSION_RCBA = 1,
 	}			ta_version;
-	bus_space_tag_t		ta_iot;
-	bus_space_handle_t	ta_ioh;
+	bus_space_tag_t		ta_pmt;
+	bus_space_handle_t	ta_pmh;
 	bus_space_tag_t		ta_rcbat;
 	bus_space_handle_t	ta_rcbah;
 	struct pcib_softc *	ta_pcib;

Reply via email to