xref: /dflybsd-src/sys/dev/misc/amdsbwd/amd_chipset.h (revision 15879860c659954f48d1fc199a8543cf110382ec)
1*15879860SMatthew Dillon /*-
2*15879860SMatthew Dillon  * Copyright (c) 2016 Andriy Gapon <avg@FreeBSD.org>
3*15879860SMatthew Dillon  * All rights reserved.
4*15879860SMatthew Dillon  *
5*15879860SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
6*15879860SMatthew Dillon  * modification, are permitted provided that the following conditions
7*15879860SMatthew Dillon  * are met:
8*15879860SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
9*15879860SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
10*15879860SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
11*15879860SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
12*15879860SMatthew Dillon  *    documentation and/or other materials provided with the distribution.
13*15879860SMatthew Dillon  *
14*15879860SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*15879860SMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*15879860SMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*15879860SMatthew Dillon  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*15879860SMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*15879860SMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*15879860SMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*15879860SMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*15879860SMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*15879860SMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*15879860SMatthew Dillon  * SUCH DAMAGE.
25*15879860SMatthew Dillon  *
26*15879860SMatthew Dillon  * $FreeBSD$
27*15879860SMatthew Dillon  */
28*15879860SMatthew Dillon 
29*15879860SMatthew Dillon /*
30*15879860SMatthew Dillon  * The following registers, bits and magic values are defined in Register
31*15879860SMatthew Dillon  * Reference Guide documents for SB600, SB7x0, SB8x0, SB9x0 southbridges and
32*15879860SMatthew Dillon  * various versions of Fusion Controller Hubs (FCHs).  FCHs integrated into
33*15879860SMatthew Dillon  * CPUs are documented in BIOS and Kernel Development Guide documents for
34*15879860SMatthew Dillon  * the corresponding processor families.
35*15879860SMatthew Dillon  *
36*15879860SMatthew Dillon  * At present there are three classes of supported chipsets:
37*15879860SMatthew Dillon  * - SB600 and S7x0 southbridges where the SMBus controller device has
38*15879860SMatthew Dillon  *   a PCI Device ID of 0x43851002 and a revision less than 0x40
39*15879860SMatthew Dillon  * - several types of southbridges and FCHs:
40*15879860SMatthew Dillon  *   o SB8x0, SB9x0 southbridges where the SMBus controller device has a PCI
41*15879860SMatthew Dillon  *     Device ID of 0x43851002 and a revision greater than or equal to 0x40
42*15879860SMatthew Dillon  *   o FCHs where the controller has an ID of 0x780b1022 and a revision less
43*15879860SMatthew Dillon  *     than 0x41 (various variants of "Hudson" and "Bolton" as well as FCHs
44*15879860SMatthew Dillon  *     integrated into processors, e.g. "Kabini")
45*15879860SMatthew Dillon  *   o FCHs where the controller has an ID of 0x790b1022 and a revision less
46*15879860SMatthew Dillon  *     than 0x49
47*15879860SMatthew Dillon  * - several types of FCHs:
48*15879860SMatthew Dillon  *   o FCHs where the SMBus controller device has a PCI Device ID of 0x780b1022
49*15879860SMatthew Dillon  *     and a revision greater than or equal to 0x41 (integrated into "Mullins"
50*15879860SMatthew Dillon  *     processors, code named "ML")
51*15879860SMatthew Dillon  *   o FCHs where the controller has an ID of 0x790b1022 and a revision greater
52*15879860SMatthew Dillon  *     than or equal to 0x49 (integrated into "Carrizo" processors, code named
53*15879860SMatthew Dillon  *     "KERNCZ" or "CZ")
54*15879860SMatthew Dillon  *
55*15879860SMatthew Dillon  * The register definitions are compatible within the classes and may be
56*15879860SMatthew Dillon  * incompatible accross them.
57*15879860SMatthew Dillon  */
58*15879860SMatthew Dillon 
59*15879860SMatthew Dillon /*
60*15879860SMatthew Dillon  * IO registers for accessing the PMIO space.
61*15879860SMatthew Dillon  * See SB7xx RRG 2.3.3.1.1, for instance.
62*15879860SMatthew Dillon  */
63*15879860SMatthew Dillon #define	AMDSB_PMIO_INDEX		0xcd6
64*15879860SMatthew Dillon #define	AMDSB_PMIO_DATA			(PMIO_INDEX + 1)
65*15879860SMatthew Dillon #define	AMDSB_PMIO_WIDTH		2
66*15879860SMatthew Dillon 
67*15879860SMatthew Dillon /*
68*15879860SMatthew Dillon  * SB7x0 and compatible registers in the PMIO space.
69*15879860SMatthew Dillon  * See SB7xx RRG 2.3.3.2.
70*15879860SMatthew Dillon  */
71*15879860SMatthew Dillon #define	AMDSB_PM_RESET_STATUS0		0x44
72*15879860SMatthew Dillon #define	AMDSB_PM_RESET_STATUS1		0x45
73*15879860SMatthew Dillon #define		AMDSB_WD_RST_STS	0x02
74*15879860SMatthew Dillon #define	AMDSB_PM_WDT_CTRL		0x69
75*15879860SMatthew Dillon #define		AMDSB_WDT_DISABLE	0x01
76*15879860SMatthew Dillon #define		AMDSB_WDT_RES_MASK	(0x02 | 0x04)
77*15879860SMatthew Dillon #define		AMDSB_WDT_RES_32US	0x00
78*15879860SMatthew Dillon #define		AMDSB_WDT_RES_10MS	0x02
79*15879860SMatthew Dillon #define		AMDSB_WDT_RES_100MS	0x04
80*15879860SMatthew Dillon #define		AMDSB_WDT_RES_1S	0x06
81*15879860SMatthew Dillon #define	AMDSB_PM_WDT_BASE_LSB		0x6c
82*15879860SMatthew Dillon #define	AMDSB_PM_WDT_BASE_MSB		0x6f
83*15879860SMatthew Dillon 
84*15879860SMatthew Dillon /*
85*15879860SMatthew Dillon  * SB8x0 and compatible registers in the PMIO space.
86*15879860SMatthew Dillon  * See SB8xx RRG 2.3.3, for instance.
87*15879860SMatthew Dillon  */
88*15879860SMatthew Dillon #define	AMDSB8_PM_SMBUS_EN		0x2c
89*15879860SMatthew Dillon #define		AMDSB8_SMBUS_EN		0x01
90*15879860SMatthew Dillon #define		AMDSB8_SMBUS_ADDR_MASK	0xffe0u
91*15879860SMatthew Dillon #define	AMDSB8_PM_WDT_EN		0x48
92*15879860SMatthew Dillon #define		AMDSB8_WDT_DEC_EN	0x01
93*15879860SMatthew Dillon #define		AMDSB8_WDT_DISABLE	0x02
94*15879860SMatthew Dillon #define	AMDSB8_PM_WDT_CTRL		0x4c
95*15879860SMatthew Dillon #define		AMDSB8_WDT_32KHZ	0x00
96*15879860SMatthew Dillon #define		AMDSB8_WDT_1HZ		0x03
97*15879860SMatthew Dillon #define		AMDSB8_WDT_RES_MASK	0x03
98*15879860SMatthew Dillon #define	AMDSB8_PM_RESET_STATUS		0xc0	/* 32 bit wide */
99*15879860SMatthew Dillon #define		AMDSB8_WD_RST_STS	0x2000000
100*15879860SMatthew Dillon #define	AMDSB8_PM_RESET_CTRL		0xc4
101*15879860SMatthew Dillon #define		AMDSB8_RST_STS_DIS	0x04
102*15879860SMatthew Dillon 
103*15879860SMatthew Dillon /*
104*15879860SMatthew Dillon  * Newer FCH registers in the PMIO space.
105*15879860SMatthew Dillon  * See BKDG for Family 16h Models 30h-3Fh 3.26.13 PMx00 and PMx04.
106*15879860SMatthew Dillon  */
107*15879860SMatthew Dillon #define AMDFCH41_PM_DECODE_EN0		0x00
108*15879860SMatthew Dillon #define		AMDFCH41_SMBUS_EN	0x10
109*15879860SMatthew Dillon #define		AMDFCH41_WDT_EN		0x80
110*15879860SMatthew Dillon #define AMDFCH41_PM_DECODE_EN1		0x01
111*15879860SMatthew Dillon #define	AMDFCH41_PM_DECODE_EN3		0x03
112*15879860SMatthew Dillon #define		AMDFCH41_WDT_RES_MASK	0x03
113*15879860SMatthew Dillon #define		AMDFCH41_WDT_RES_32US	0x00
114*15879860SMatthew Dillon #define		AMDFCH41_WDT_RES_10MS	0x01
115*15879860SMatthew Dillon #define		AMDFCH41_WDT_RES_100MS	0x02
116*15879860SMatthew Dillon #define		AMDFCH41_WDT_RES_1S	0x03
117*15879860SMatthew Dillon #define		AMDFCH41_WDT_EN_MASK	0x0c
118*15879860SMatthew Dillon #define		AMDFCH41_WDT_ENABLE	0x00
119*15879860SMatthew Dillon #define	AMDFCH41_PM_ISA_CTRL		0x04
120*15879860SMatthew Dillon #define		AMDFCH41_MMIO_EN	0x02
121*15879860SMatthew Dillon 
122*15879860SMatthew Dillon /*
123*15879860SMatthew Dillon  * Fixed MMIO addresses for accessing Watchdog and SMBus registers.
124*15879860SMatthew Dillon  * See BKDG for Family 16h Models 30h-3Fh 3.26.13 PMx00 and PMx04.
125*15879860SMatthew Dillon  */
126*15879860SMatthew Dillon #define	AMDFCH41_WDT_FIXED_ADDR		0xfeb00000u
127*15879860SMatthew Dillon #define	AMDFCH41_MMIO_ADDR		0xfed80000u
128*15879860SMatthew Dillon #define AMDFCH41_MMIO_SMBUS_OFF		0x0a00
129*15879860SMatthew Dillon #define AMDFCH41_MMIO_WDT_OFF		0x0b00
130*15879860SMatthew Dillon 
131*15879860SMatthew Dillon /*
132*15879860SMatthew Dillon  * PCI Device IDs and revisions.
133*15879860SMatthew Dillon  * SB600 RRG 2.3.1.1,
134*15879860SMatthew Dillon  * SB7xx RRG 2.3.1.1,
135*15879860SMatthew Dillon  * SB8xx RRG 2.3.1,
136*15879860SMatthew Dillon  * BKDG for Family 15h Models 60h-6Fh 3.26.6.1,
137*15879860SMatthew Dillon  * BKDG for Family 15h Models 70h-7Fh 3.26.6.1,
138*15879860SMatthew Dillon  * BKDG for Family 16h Models 00h-0Fh 3.26.7.1,
139*15879860SMatthew Dillon  * BKDG for Family 16h Models 30h-3Fh 3.26.7.1.
140*15879860SMatthew Dillon  * Also, see i2c-piix4 aka piix4_smbus Linux driver.
141*15879860SMatthew Dillon  */
142*15879860SMatthew Dillon #define	AMDSB_SMBUS_DEVID		0x43851002
143*15879860SMatthew Dillon #define	AMDSB8_SMBUS_REVID		0x40
144*15879860SMatthew Dillon #define	AMDFCH_SMBUS_DEVID		0x780b1022
145*15879860SMatthew Dillon #define	AMDFCH41_SMBUS_REVID		0x41
146*15879860SMatthew Dillon #define	AMDCZ_SMBUS_DEVID		0x790b1022
147*15879860SMatthew Dillon #define	AMDCZ49_SMBUS_REVID		0x49
148