xref: /freebsd/sys/dev/imcsmb/imcsmb_reg.h (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org)
5  *
6  * Copyright (c) 2017-2018 Panasas
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
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
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
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
27  * SUCH DAMAGE.
28  */
29 
30 #ifndef _DEV__IMCSMB__IMCSMB_REG_H_
31 #define _DEV__IMCSMB__IMCSMB_REG_H_
32 
33 #include <sys/param.h>
34 #include <sys/systm.h>
35 #include <sys/kernel.h>
36 #include <sys/module.h>
37 #include <sys/endian.h>
38 #include <sys/errno.h>
39 #include <sys/lock.h>
40 #include <sys/mutex.h>
41 #include <sys/syslog.h>
42 #include <sys/bus.h>
43 
44 #include <machine/bus.h>
45 #include <machine/atomic.h>
46 
47 #include <dev/pci/pcivar.h>
48 #include <dev/pci/pcireg.h>
49 
50 #include <dev/smbus/smbconf.h>
51 
52 /* Intel (Sandy,Ivy)bridge and (Has,Broad)well CPUs have integrated memory
53  * controllers (iMCs), each of which having up to two SMBus controllers. They
54  * are programmed via sets of registers in the same PCI device, which are
55  * identical other than the register numbers.
56  *
57  * The full documentation for these registers can be found in volume two of the
58  * datasheets for the CPUs. Refer to the links in imcsmb_pci.c
59  */
60 
61 #define	IMCSMB_REG_STATUS0			0x0180
62 #define	IMCSMB_REG_STATUS1			0x0190
63 #define		IMCSMB_STATUS_BUSY_BIT		0x10000000
64 #define		IMCSMB_STATUS_BUS_ERROR_BIT	0x20000000
65 #define		IMCSMB_STATUS_WRITE_DATA_DONE	0x40000000
66 #define		IMCSMB_STATUS_READ_DATA_VALID	0x80000000
67 
68 #define	IMCSMB_REG_COMMAND0			0x0184
69 #define	IMCSMB_REG_COMMAND1			0x0194
70 #define		IMCSMB_CMD_WORD_ACCESS		0x20000000
71 #define		IMCSMB_CMD_WRITE_BIT		0x08000000
72 #define		IMCSMB_CMD_TRIGGER_BIT		0x80000000
73 
74 #define	IMCSMB_REG_CONTROL0			0x0188
75 #define	IMCSMB_REG_CONTROL1			0x0198
76 #define		IMCSMB_CNTL_POLL_EN		0x00000100
77 #define		IMCSMB_CNTL_CLK_OVERRIDE	0x08000000
78 #define		IMCSMB_CNTL_DTI_MASK		0xf0000000
79 #define		IMCSMB_CNTL_WRITE_DISABLE_BIT	0x04000000
80 
81 #endif /* _DEV__IMCSMB__IMCSMB_REG_H_ */
82 
83 /* vi: set ts=8 sw=4 sts=8 noet: */
84