Home | History | Annotate | Line # | Download | only in ic
i82801lpcreg.h revision 1.1
      1  1.1  minoura /*	$NetBSD: i82801lpcreg.h,v 1.1 2004/03/14 08:04:38 minoura Exp $	*/
      2  1.1  minoura 
      3  1.1  minoura /*-
      4  1.1  minoura  * Copyright (c) 2004 The NetBSD Foundation, Inc.
      5  1.1  minoura  * All rights reserved.
      6  1.1  minoura  *
      7  1.1  minoura  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  minoura  * by Minoura Makoto.
      9  1.1  minoura  *
     10  1.1  minoura  * Redistribution and use in source and binary forms, with or without
     11  1.1  minoura  * modification, are permitted provided that the following conditions
     12  1.1  minoura  * are met:
     13  1.1  minoura  * 1. Redistributions of source code must retain the above copyright
     14  1.1  minoura  *    notice, this list of conditions and the following disclaimer.
     15  1.1  minoura  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  minoura  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  minoura  *    documentation and/or other materials provided with the distribution.
     18  1.1  minoura  * 3. All advertising materials mentioning features or use of this software
     19  1.1  minoura  *    must display the following acknowledgement:
     20  1.1  minoura  *        This product includes software developed by the NetBSD
     21  1.1  minoura  *        Foundation, Inc. and its contributors.
     22  1.1  minoura  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  minoura  *    contributors may be used to endorse or promote products derived
     24  1.1  minoura  *    from this software without specific prior written permission.
     25  1.1  minoura  *
     26  1.1  minoura  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  minoura  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  minoura  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  minoura  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  minoura  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  minoura  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  minoura  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  minoura  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  minoura  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  minoura  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  minoura  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  minoura  */
     38  1.1  minoura 
     39  1.1  minoura /*
     40  1.1  minoura  * Intel 82801 Series I/O Controller Hub (ICH) -- LPC Interface Bridge part
     41  1.1  minoura  *   register definitions.
     42  1.1  minoura  */
     43  1.1  minoura /*
     44  1.1  minoura  * Currently only necessory part is defined (specifically TCO timer function).
     45  1.1  minoura  */
     46  1.1  minoura 
     47  1.1  minoura /*
     48  1.1  minoura  * PCI configuration registers
     49  1.1  minoura  */
     50  1.1  minoura #define LPCIB_PCI_PMBASE	0x40
     51  1.1  minoura #define LPCIB_PCI_ACPI_CNTL	0x44
     52  1.1  minoura #define LPCIB_PCI_BIOS_CNTL	0x4e
     53  1.1  minoura #define LPCIB_PCI_TCO_CNTL	0x54
     54  1.1  minoura #define LPCIB_PCI_GPIO_BASE	0x58
     55  1.1  minoura #define LPCIB_PCI_GPIO_CNTL	0x5c
     56  1.1  minoura #define LPCIB_PCI_PIRQA_ROUT	0x60
     57  1.1  minoura #define LPCIB_PCI_PIRQB_ROUT	0x61
     58  1.1  minoura #define LPCIB_PCI_PIRQC_ROUT	0x62
     59  1.1  minoura #define LPCIB_PCI_PIRQD_ROUT	0x63
     60  1.1  minoura #define LPCIB_PCI_SIRQ_CNTL	0x64
     61  1.1  minoura #define LPCIB_PCI_PIRQE_ROUT	0x68
     62  1.1  minoura #define LPCIB_PCI_PIRQF_ROUT	0x69
     63  1.1  minoura #define LPCIB_PCI_PIRQG_ROUT	0x6a
     64  1.1  minoura #define LPCIB_PCI_PIRQH_ROUT	0x6b
     65  1.1  minoura #define LPCIB_PCI_D31_ERR_CFG	0x88
     66  1.1  minoura #define LPCIB_PCI_D31_ERR_STS	0x8a
     67  1.1  minoura #define LPCIB_PCI_PCI_DMA_C	0x90
     68  1.1  minoura #define LPCIB_PCI_GEN_PMCON_1	0xa0
     69  1.1  minoura #define LPCIB_PCI_GEN_PMCON_2	0xa2
     70  1.1  minoura #define LPCIB_PCI_GEN_PMCON_3	0xa4
     71  1.1  minoura #define LPCIB_PCI_STPCLK_DEL	0xa8
     72  1.1  minoura #define LPCIB_PCI_GPI_ROUT	0xb8
     73  1.1  minoura #define LPCIB_PCI_TRP_FWD_EN	0xc0
     74  1.1  minoura #define LPCIB_PCI_MON4_TRP_RNG	0xc4
     75  1.1  minoura #define LPCIB_PCI_MON5_TRP_RNG	0xc5
     76  1.1  minoura #define LPCIB_PCI_MON6_TRP_RNG	0xc6
     77  1.1  minoura #define LPCIB_PCI_MON7_TRP_RNG	0xc7
     78  1.1  minoura #define LPCIB_PCI_MON_TRP_MSK	oxcc
     79  1.1  minoura #define LPCIB_PCI_GEN_CNTL	0xd0
     80  1.1  minoura #define LPCIB_PCI_GEN_STA	0xd4
     81  1.1  minoura # define LPCIB_PCI_GEN_STA_SAFE_MODE	(1<<2)
     82  1.1  minoura # define LPCIB_PCI_GEN_STA_NO_REBOOT	(1<<1)
     83  1.1  minoura #define LPCIB_PCI_BACK_CNTL	0xd5
     84  1.1  minoura #define LPCIB_PCI_RTC_CONF	0xd8
     85  1.1  minoura #define LPCIB_PCI_COM_DEC	0xe0
     86  1.1  minoura #define LPCIB_PCI_LPCFDD_DEC	0xe1
     87  1.1  minoura #define LPCIB_PCI_SND_DEC	0xe2
     88  1.1  minoura #define LPCIB_PCI_FWH_DEC_EN1	0xe3
     89  1.1  minoura #define LPCIB_PCI_GEN1_DEC	0xe4
     90  1.1  minoura #define LPCIB_PCI_LPC_EN	0xe6
     91  1.1  minoura #define LPCIB_PCI_FWH_SEL1	0xe8
     92  1.1  minoura #define LPCIB_PCI_GEN2_DEC	0xec
     93  1.1  minoura #define LPCIB_PCI_FWH_SEL2	0xee
     94  1.1  minoura #define LPCIB_PCI_FWH_DEC_EN2	0xf0
     95  1.1  minoura #define LPCIB_PCI_FUNC_DIS	0xf2
     96  1.1  minoura 
     97  1.1  minoura /*
     98  1.1  minoura  * Power management I/O registers
     99  1.1  minoura  *  (offset from PMBASE)
    100  1.1  minoura  */
    101  1.1  minoura #define LPCIB_PM1_STS		0x00 /* ACPI PM1a_EVT_BLK fixed event status */
    102  1.1  minoura #define LPCIB_PM1_EN		0x02 /* ACPI PM1a_EVT_BLK fixed event enable */
    103  1.1  minoura #define LPCIB_PM1_CNT		0x04 /* ACPI PM1a_CNT_BLK */
    104  1.1  minoura #define LPCIB_PM1_TMR		0x08 /* ACPI PMTMR_BLK power mgmt timer */
    105  1.1  minoura #define LPCIB_PROC_CNT		0x10 /* ACPI P_BLK processor control */
    106  1.1  minoura #define LPCIB_LV2		0x14 /* ACPI P_BLK processor C2 control */
    107  1.1  minoura #define LPCIB_GPE0_STS		0x28 /* ACPI GPE0_BLK GPE0 status */
    108  1.1  minoura #define LPCIB_GPE0_EN		0x2c /* ACPI GPE0_BLK GPE0 enable */
    109  1.1  minoura #define LPCIB_SMI_EN		0x30
    110  1.1  minoura # define LPCIB_SMI_EN_INTEL_USB2_EN	(1 << 18)
    111  1.1  minoura # define LPCIB_SMI_EN_LEGACY_USB2_EN	(1 << 17)
    112  1.1  minoura # define LPCIB_SMI_EN_PERIODIC_EN	(1 << 14)
    113  1.1  minoura # define LPCIB_SMI_EN_TCO_EN		(1 << 13)
    114  1.1  minoura # define LPCIB_SMI_EN_MCSMI_EN		(1 << 11)
    115  1.1  minoura # define LPCIB_SMI_EN_BIOS_RLS		(1 << 7)
    116  1.1  minoura # define LPCIB_SMI_EN_SWSMI_TMR_EN	(1 << 6)
    117  1.1  minoura # define LPCIB_SMI_EN_APMC_EN		(1 << 5)
    118  1.1  minoura # define LPCIB_SMI_EN_SLP_SMI_EN	(1 << 4)
    119  1.1  minoura # define LPCIB_SMI_EN_LEGACY_USB_EN	(1 << 3)
    120  1.1  minoura # define LPCIB_SMI_EN_BIOS_EN		(1 << 2)
    121  1.1  minoura # define LPCIB_SMI_EN_EOS		(1 << 1)
    122  1.1  minoura # define LPCIB_SMI_EN_GBL_SMI_EN	(1 << 0)
    123  1.1  minoura #define LPCIB_SMI_STS		0x34
    124  1.1  minoura #define LPCIB_ALT_GP_SMI_EN	0x38
    125  1.1  minoura #define LPCIB_ALT_GP_SMI_STS	0x3a
    126  1.1  minoura #define LPCIB_MON_SMI		0x40
    127  1.1  minoura #define LPCIB_DEVACT_STS	0x44
    128  1.1  minoura #define LPCIB_DEVTRAP_EN	0x48
    129  1.1  minoura #define LPCIB_BUS_ADDR_TRACK	0x4c
    130  1.1  minoura #define LPCIB_BUS_CYC_TRACK	0x4e
    131  1.1  minoura 
    132  1.1  minoura /*
    133  1.1  minoura  * System management TCO registers
    134  1.1  minoura  *  (offset from PMBASE)
    135  1.1  minoura  */
    136  1.1  minoura #define LPCIB_TCO_BASE		0x60
    137  1.1  minoura #define LPCIB_TCO_RLD		(LPCIB_TCO_BASE+0x00)
    138  1.1  minoura #define LPCIB_TCO_TMR		(LPCIB_TCO_BASE+0x01)
    139  1.1  minoura # define LPCIB_TCO_TMR_MASK		0x3f
    140  1.1  minoura #define LPCIB_TCO_DAT_IN	(LPCIB_TCO_BASE+0x02)
    141  1.1  minoura #define LPCIB_TCO_DAT_OUT	(LPCIB_TCO_BASE+0x03)
    142  1.1  minoura #define LPCIB_TCO1_STS		(LPCIB_TCO_BASE+0x04)
    143  1.1  minoura #define LPCIB_TCO2_STS		(LPCIB_TCO_BASE+0x06)
    144  1.1  minoura #define LPCIB_TCO1_CNT		(LPCIB_TCO_BASE+0x08)
    145  1.1  minoura # define LPCIB_TCO1_CNT_TCO_TMR_HLT	(1 << 11)
    146  1.1  minoura # define LPCIB_TCO1_CNT_SEND_NOW	(1 << 10)
    147  1.1  minoura # define LPCIB_TCO1_CNT_NMI2SMI_EN	(1 << 9)
    148  1.1  minoura # define LPCIB_TCO1_CNT_NMI_NOW		(1 << 8)
    149  1.1  minoura #define LPCIB_TCO2_CNT		(LPCIB_TCO_BASE+0x0a)
    150  1.1  minoura #define LPCIB_TCO_MESSAGE1	(LPCIB_TCO_BASE+0x0c)
    151  1.1  minoura #define LPCIB_TCO_MESSAGE2	(LPCIB_TCO_BASE+0x0d)
    152  1.1  minoura #define LPCIB_TCO_WDSTATUS	(LPCIB_TCO_BASE+0x0e)
    153  1.1  minoura #define LPCIB_SW_IRQ_GEN	(LPCIB_TCO_BASE+0x10)
    154  1.1  minoura 
    155  1.1  minoura /*
    156  1.1  minoura  * TCO timer tick.  ICH datasheets say:
    157  1.1  minoura  *  - The timer is clocked at approximately 0.6 seconds
    158  1.1  minoura  *  - 6 bit; values of 0-3 will be ignored and should not be attempted
    159  1.1  minoura  */
    160  1.1  minoura static inline int
    161  1.1  minoura lpcib_tcotimer_tick_to_second(int tick)
    162  1.1  minoura {
    163  1.1  minoura 	return tick * 6 / 10;
    164  1.1  minoura }
    165  1.1  minoura 
    166  1.1  minoura static inline int
    167  1.1  minoura lpcib_tcotimer_second_to_tick(int tick)
    168  1.1  minoura {
    169  1.1  minoura 	return tick * 10 / 6;
    170  1.1  minoura }
    171  1.1  minoura #define LPCIB_TCOTIMER_MIN_TICK	4
    172  1.1  minoura #define LPCIB_TCOTIMER_MAX_TICK	0x3f
    173