Deleted Added
full compact
if_ic.c (147611) if_ic.c (148887)
1/*-
2 * Copyright (c) 1998, 2001 Nicolas Souchu
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) 1998, 2001 Nicolas Souchu
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/iicbus/if_ic.c 147611 2005-06-26 18:11:11Z dwmalone $");
28__FBSDID("$FreeBSD: head/sys/dev/iicbus/if_ic.c 148887 2005-08-09 10:20:02Z rwatson $");
29
30/*
31 * I2C bus IP driver
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/mbuf.h>

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

177 case SIOCSIFDSTADDR:
178 case SIOCAIFADDR:
179 case SIOCSIFADDR:
180 if (ifa->ifa_addr->sa_family != AF_INET)
181 return EAFNOSUPPORT;
182 ifp->if_flags |= IFF_UP;
183 /* FALLTHROUGH */
184 case SIOCSIFFLAGS:
29
30/*
31 * I2C bus IP driver
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/mbuf.h>

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

177 case SIOCSIFDSTADDR:
178 case SIOCAIFADDR:
179 case SIOCSIFADDR:
180 if (ifa->ifa_addr->sa_family != AF_INET)
181 return EAFNOSUPPORT;
182 ifp->if_flags |= IFF_UP;
183 /* FALLTHROUGH */
184 case SIOCSIFFLAGS:
185 if ((!(ifp->if_flags & IFF_UP)) && (ifp->if_flags & IFF_RUNNING)) {
185 if ((!(ifp->if_flags & IFF_UP)) &&
186 (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
186
187 /* XXX disable PCF */
187
188 /* XXX disable PCF */
188 ifp->if_flags &= ~IFF_RUNNING;
189 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
189
190 /* IFF_UP is not set, try to release the bus anyway */
191 iicbus_release_bus(parent, icdev);
192 break;
193 }
190
191 /* IFF_UP is not set, try to release the bus anyway */
192 iicbus_release_bus(parent, icdev);
193 break;
194 }
194 if (((ifp->if_flags & IFF_UP)) && (!(ifp->if_flags & IFF_RUNNING))) {
195 if (((ifp->if_flags & IFF_UP)) &&
196 (!(ifp->if_drv_flags & IFF_DRV_RUNNING))) {
195
196 if ((error = iicbus_request_bus(parent, icdev, IIC_WAIT|IIC_INTR)))
197 return (error);
198
199 sc->ic_obuf = malloc(sc->ic_ifp->if_mtu + ICHDRLEN,
200 M_DEVBUF, M_WAITOK);
201 if (!sc->ic_obuf) {
202 iicbus_release_bus(parent, icdev);

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

207 M_DEVBUF, M_WAITOK);
208 if (!sc->ic_ifbuf) {
209 iicbus_release_bus(parent, icdev);
210 return ENOBUFS;
211 }
212
213 iicbus_reset(parent, IIC_FASTEST, 0, NULL);
214
197
198 if ((error = iicbus_request_bus(parent, icdev, IIC_WAIT|IIC_INTR)))
199 return (error);
200
201 sc->ic_obuf = malloc(sc->ic_ifp->if_mtu + ICHDRLEN,
202 M_DEVBUF, M_WAITOK);
203 if (!sc->ic_obuf) {
204 iicbus_release_bus(parent, icdev);

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

209 M_DEVBUF, M_WAITOK);
210 if (!sc->ic_ifbuf) {
211 iicbus_release_bus(parent, icdev);
212 return ENOBUFS;
213 }
214
215 iicbus_reset(parent, IIC_FASTEST, 0, NULL);
216
215 ifp->if_flags |= IFF_RUNNING;
217 ifp->if_drv_flags |= IFF_DRV_RUNNING;
216 }
217 break;
218
219 case SIOCSIFMTU:
220 /* save previous buffers */
221 iptr = sc->ic_ifbuf;
222 optr = sc->ic_obuf;
223

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

377 u_int32_t hdr;
378
379 /* BPF writes need to be handled specially. */
380 if (dst->sa_family == AF_UNSPEC)
381 bcopy(dst->sa_data, &hdr, sizeof(hdr));
382 else
383 hdr = dst->sa_family;
384
218 }
219 break;
220
221 case SIOCSIFMTU:
222 /* save previous buffers */
223 iptr = sc->ic_ifbuf;
224 optr = sc->ic_obuf;
225

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

379 u_int32_t hdr;
380
381 /* BPF writes need to be handled specially. */
382 if (dst->sa_family == AF_UNSPEC)
383 bcopy(dst->sa_data, &hdr, sizeof(hdr));
384 else
385 hdr = dst->sa_family;
386
385 ifp->if_flags |= IFF_RUNNING;
387 ifp->if_drv_flags |= IFF_DRV_RUNNING;
386
387 s = splhigh();
388
389 /* already sending? */
390 if (sc->ic_sending) {
391 ifp->if_oerrors ++;
392 goto error;
393 }

--- 51 unchanged lines hidden ---
388
389 s = splhigh();
390
391 /* already sending? */
392 if (sc->ic_sending) {
393 ifp->if_oerrors ++;
394 goto error;
395 }

--- 51 unchanged lines hidden ---