Deleted Added
full compact
ipmi_smic.c (163034) ipmi_smic.c (163035)
1/*-
2 * Copyright (c) 2006 IronPort Systems Inc. <ambrisko@ironport.com>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 IronPort Systems Inc. <ambrisko@ironport.com>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/ipmi/ipmi_smic.c 163034 2006-10-05 15:35:11Z jhb $");
28__FBSDID("$FreeBSD: head/sys/dev/ipmi/ipmi_smic.c 163035 2006-10-05 15:38:59Z jhb $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/condvar.h>
34#include <sys/eventhandler.h>
35#include <sys/kernel.h>
36#include <sys/kthread.h>

--- 85 unchanged lines hidden (view full) ---

122 * Write a byte in the middle of the message (either the command or one of
123 * the data bytes) using a WR_NEXT transaction.
124 */
125static int
126smic_write_next(struct ipmi_softc *sc, u_char data)
127{
128 u_char error, status;
129
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/condvar.h>
34#include <sys/eventhandler.h>
35#include <sys/kernel.h>
36#include <sys/kthread.h>

--- 85 unchanged lines hidden (view full) ---

122 * Write a byte in the middle of the message (either the command or one of
123 * the data bytes) using a WR_NEXT transaction.
124 */
125static int
126smic_write_next(struct ipmi_softc *sc, u_char data)
127{
128 u_char error, status;
129
130 OUTB(sc, SMIC_CTL_STS, SMIC_CC_SMS_WR_NEXT);
131 smic_wait_for_tx_okay(sc);
130 smic_wait_for_tx_okay(sc);
131 OUTB(sc, SMIC_CTL_STS, SMIC_CC_SMS_WR_NEXT);
132 OUTB(sc, SMIC_DATA, data);
133 smic_set_busy(sc);
134 smic_wait_for_not_busy(sc);
135 status = INB(sc, SMIC_CTL_STS);
136 if (status != SMIC_SC_SMS_WR_NEXT) {
137 error = INB(sc, SMIC_DATA);
138 device_printf(sc->ipmi_dev, "SMIC: Write did not next %02x\n",
139 error);

--- 6 unchanged lines hidden (view full) ---

146 * Write the last byte of a transfer to end the write phase via a WR_END
147 * transaction.
148 */
149static int
150smic_write_last(struct ipmi_softc *sc, u_char data)
151{
152 u_char error, status;
153
132 OUTB(sc, SMIC_DATA, data);
133 smic_set_busy(sc);
134 smic_wait_for_not_busy(sc);
135 status = INB(sc, SMIC_CTL_STS);
136 if (status != SMIC_SC_SMS_WR_NEXT) {
137 error = INB(sc, SMIC_DATA);
138 device_printf(sc->ipmi_dev, "SMIC: Write did not next %02x\n",
139 error);

--- 6 unchanged lines hidden (view full) ---

146 * Write the last byte of a transfer to end the write phase via a WR_END
147 * transaction.
148 */
149static int
150smic_write_last(struct ipmi_softc *sc, u_char data)
151{
152 u_char error, status;
153
154 OUTB(sc, SMIC_CTL_STS, SMIC_CC_SMS_WR_END);
155 smic_wait_for_tx_okay(sc);
154 smic_wait_for_tx_okay(sc);
155 OUTB(sc, SMIC_CTL_STS, SMIC_CC_SMS_WR_END);
156 OUTB(sc, SMIC_DATA, data);
157 smic_set_busy(sc);
158 smic_wait_for_not_busy(sc);
159 status = INB(sc, SMIC_CTL_STS);
160 if (status != SMIC_SC_SMS_WR_END) {
161 error = INB(sc, SMIC_DATA);
162 device_printf(sc->ipmi_dev, "SMIC: Write did not end %02x\n",
163 error);

--- 7 unchanged lines hidden (view full) ---

171 */
172static int
173smic_start_read(struct ipmi_softc *sc, u_char *data)
174{
175 u_char error, status;
176
177 smic_wait_for_not_busy(sc);
178
156 OUTB(sc, SMIC_DATA, data);
157 smic_set_busy(sc);
158 smic_wait_for_not_busy(sc);
159 status = INB(sc, SMIC_CTL_STS);
160 if (status != SMIC_SC_SMS_WR_END) {
161 error = INB(sc, SMIC_DATA);
162 device_printf(sc->ipmi_dev, "SMIC: Write did not end %02x\n",
163 error);

--- 7 unchanged lines hidden (view full) ---

171 */
172static int
173smic_start_read(struct ipmi_softc *sc, u_char *data)
174{
175 u_char error, status;
176
177 smic_wait_for_not_busy(sc);
178
179 OUTB(sc, SMIC_CTL_STS, SMIC_CC_SMS_RD_START);
180 smic_wait_for_rx_okay(sc);
179 smic_wait_for_rx_okay(sc);
180 OUTB(sc, SMIC_CTL_STS, SMIC_CC_SMS_RD_START);
181 smic_set_busy(sc);
182 smic_wait_for_not_busy(sc);
183 status = INB(sc, SMIC_CTL_STS);
184 if (status != SMIC_SC_SMS_RD_START) {
185 error = INB(sc, SMIC_DATA);
186 device_printf(sc->ipmi_dev, "SMIC: Read did not start %02x\n",
187 error);
188 return (0);

--- 6 unchanged lines hidden (view full) ---

195 * Read a byte via a RD_NEXT transaction. If this was the last byte, return
196 * 2 rather than 1.
197 */
198static int
199smic_read_byte(struct ipmi_softc *sc, u_char *data)
200{
201 u_char error, status;
202
181 smic_set_busy(sc);
182 smic_wait_for_not_busy(sc);
183 status = INB(sc, SMIC_CTL_STS);
184 if (status != SMIC_SC_SMS_RD_START) {
185 error = INB(sc, SMIC_DATA);
186 device_printf(sc->ipmi_dev, "SMIC: Read did not start %02x\n",
187 error);
188 return (0);

--- 6 unchanged lines hidden (view full) ---

195 * Read a byte via a RD_NEXT transaction. If this was the last byte, return
196 * 2 rather than 1.
197 */
198static int
199smic_read_byte(struct ipmi_softc *sc, u_char *data)
200{
201 u_char error, status;
202
203 OUTB(sc, SMIC_CTL_STS, SMIC_SC_SMS_RD_NEXT);
204 smic_wait_for_rx_okay(sc);
203 smic_wait_for_rx_okay(sc);
204 OUTB(sc, SMIC_CTL_STS, SMIC_SC_SMS_RD_NEXT);
205 smic_set_busy(sc);
206 smic_wait_for_not_busy(sc);
207 status = INB(sc, SMIC_CTL_STS);
208 if (status != SMIC_SC_SMS_RD_NEXT &&
209 status != SMIC_SC_SMS_RD_END) {
210 error = INB(sc, SMIC_DATA);
211 device_printf(sc->ipmi_dev, "SMIC: Read did not next %02x\n",
212 error);

--- 195 unchanged lines hidden ---
205 smic_set_busy(sc);
206 smic_wait_for_not_busy(sc);
207 status = INB(sc, SMIC_CTL_STS);
208 if (status != SMIC_SC_SMS_RD_NEXT &&
209 status != SMIC_SC_SMS_RD_END) {
210 error = INB(sc, SMIC_DATA);
211 device_printf(sc->ipmi_dev, "SMIC: Read did not next %02x\n",
212 error);

--- 195 unchanged lines hidden ---