Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci - Read SB800_SMB_HOSTC correctly. This register ...



details:   https://anonhg.NetBSD.org/src/rev/e1224a8b9e1a
branches:  trunk
changeset: 1005889:e1224a8b9e1a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Dec 23 23:41:43 2019 +0000

description:
- Read SB800_SMB_HOSTC correctly. This register is not in the PCI config space
  but in the I/O space.
- The bit 0 of SB800_SMB_HOSTC is 0 on SMI or 1 on IRQ, so invert the check.
- Modify comment.
- Whitespace fix.

diffstat:

 sys/dev/pci/piixpm.c    |  15 ++++++---------
 sys/dev/pci/piixpmreg.h |  15 +++++++++------
 2 files changed, 15 insertions(+), 15 deletions(-)

diffs (87 lines):

diff -r e9abbb011d86 -r e1224a8b9e1a sys/dev/pci/piixpm.c
--- a/sys/dev/pci/piixpm.c      Mon Dec 23 23:31:23 2019 +0000
+++ b/sys/dev/pci/piixpm.c      Mon Dec 23 23:41:43 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.57 2019/12/23 23:31:23 msaitoh Exp $ */
+/* $NetBSD: piixpm.c,v 1.58 2019/12/23 23:41:43 msaitoh Exp $ */
 /*     $OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $  */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.57 2019/12/23 23:31:23 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.58 2019/12/23 23:41:43 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -231,12 +231,9 @@
        if (PIIXPM_IS_FCHGRP(sc) || PIIXPM_IS_SB800GRP(sc)) {
                if (piixpm_sb800_init(sc) == 0) {
                        /* Read configuration */
-                       conf = pci_conf_read(pa->pa_pc, pa->pa_tag,
-                           SB800_SMB_HOSTC);
-                       DPRINTF(("%s: conf 0x%08x\n", device_xname(self),
-                               conf));
-
-                       usesmi = conf & SB800_SMB_HOSTC_SMI;
+                       conf = bus_space_read_1(sc->sc_iot,
+                           sc->sc_smb_ioh, SB800_SMB_HOSTC);
+                       usesmi = ((conf & SB800_SMB_HOSTC_IRQ) == 0);
                        goto setintr;
                }
                aprint_normal_dev(self, "SMBus initialization failed\n");
@@ -444,7 +441,7 @@
        aprint_debug_dev(sc->sc_dev, "SMBus @ 0x%04x\n", base_addr);
 
        if (bus_space_map(iot, PCI_MAPREG_IO_ADDR(base_addr),
-           PIIX_SMB_SIZE, 0, &sc->sc_smb_ioh)) {
+           SB800_SMB_SIZE, 0, &sc->sc_smb_ioh)) {
                aprint_error_dev(sc->sc_dev, "can't map smbus I/O space\n");
                return EBUSY;
        }
diff -r e9abbb011d86 -r e1224a8b9e1a sys/dev/pci/piixpmreg.h
--- a/sys/dev/pci/piixpmreg.h   Mon Dec 23 23:31:23 2019 +0000
+++ b/sys/dev/pci/piixpmreg.h   Mon Dec 23 23:41:43 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpmreg.h,v 1.8 2019/07/13 09:24:17 msaitoh Exp $ */
+/* $NetBSD: piixpmreg.h,v 1.9 2019/12/23 23:41:43 msaitoh Exp $ */
 /*     $OpenBSD: piixreg.h,v 1.3 2006/01/03 22:39:03 grange Exp $      */
 
 /*-
@@ -66,7 +66,7 @@
 #define PIIX_SMB_HOSTC 0xd0            /* SMBus host configuration */
 #define PIIX_SMB_HOSTC_HSTEN   (1 << 16)       /* enable host controller */
 #define PIIX_SMB_HOSTC_SMI     (0 << 17)       /* SMI */
-#define PIIX_SMB_HOSTC_IRQ     (4 << 17)       /* IRQ */
+#define PIIX_SMB_HOSTC_IRQ     (4 << 17)       /* IRQ 9 */
 #define PIIX_SMB_HOSTC_INTMASK (7 << 17)
 
 /* SMBus I/O registers */
@@ -113,18 +113,21 @@
 #define SB800_INDIRECTIO_SIZE  2 
 #define SB800_INDIRECTIO_INDEX 0
 #define SB800_INDIRECTIO_DATA  1
- 
+
 #define SB800_PM_SMBUS0EN_LO   0x2c
 #define SB800_PM_SMBUS0EN_HI   0x2d
 #define SB800_PM_SMBUS0SEL     0x2e 
 #define SB800_PM_SMBUS0SELEN   0x2f 
-                                      
+
 #define SB800_PM_SMBUS0EN_ENABLE 0x0001
 #define SB800_PM_SMBUS0EN_BADDR        0xffe0
 
-/* In the PCI config space */
+/* In the SMBus I/O space */
 #define SB800_SMB_HOSTC                0x10    /* I2C bus configuration */
-#define SB800_SMB_HOSTC_SMI    (1 << 0)        /* SMI */
+#define SB800_SMB_HOSTC_IRQ    (1 << 0)        /* 0:SMI 1:IRQ */
+
+/* Misc */
+#define SB800_SMB_SIZE 0x11            /* SMBus I/O space size */
 
 /*
  * Newer FCH registers in the PMIO space.



Home | Main Index | Thread Index | Old Index