am79c950.c revision 1.29 1 /* $NetBSD: am79c950.c,v 1.29 2010/04/05 07:19:30 joerg Exp $ */
2
3 /*-
4 * Copyright (c) 1997 David Huang <khym (at) bga.com>
5 * All rights reserved.
6 *
7 * Portions of this code are based on code by Denton Gentry <denny1 (at) home.com>,
8 * Charles M. Hannum, Yanagisawa Takeshi <yanagisw (at) aa.ap.titech.ac.jp>, and
9 * Jason R. Thorpe.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 */
31
32 /*
33 * Driver for the AMD Am79C940 (MACE) ethernet chip, used for onboard
34 * ethernet on the Centris/Quadra 660av and Quadra 840av.
35 */
36
37 #include <sys/cdefs.h>
38 __KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.29 2010/04/05 07:19:30 joerg Exp $");
39
40 #include "opt_inet.h"
41
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/mbuf.h>
45 #include <sys/buf.h>
46 #include <sys/protosw.h>
47 #include <sys/socket.h>
48 #include <sys/syslog.h>
49 #include <sys/ioctl.h>
50 #include <sys/errno.h>
51 #include <sys/device.h>
52
53 #include <uvm/uvm_extern.h>
54
55 #include <net/if.h>
56 #include <net/if_dl.h>
57 #include <net/if_ether.h>
58 #include <net/if_media.h>
59
60 #ifdef INET
61 #include <netinet/in.h>
62 #include <netinet/if_inarp.h>
63 #include <netinet/in_systm.h>
64 #include <netinet/in_var.h>
65 #include <netinet/ip.h>
66 #endif
67
68 #include <net/bpf.h>
69 #include <net/bpfdesc.h>
70
71 #include <machine/bus.h>
72
73 #include <macppc/dev/am79c950reg.h>
74 #include <macppc/dev/if_mcvar.h>
75
76 hide void mcwatchdog(struct ifnet *);
77 hide int mcinit(struct mc_softc *sc);
78 hide int mcstop(struct mc_softc *sc);
79 hide int mcioctl(struct ifnet *ifp, u_long cmd, void *data);
80 hide void mcstart(struct ifnet *ifp);
81 hide void mcreset(struct mc_softc *sc);
82
83 integrate u_int maceput(struct mc_softc *sc, struct mbuf *m0);
84 integrate void mc_tint(struct mc_softc *sc);
85 integrate void mace_read(struct mc_softc *, uint8_t *, int);
86 integrate struct mbuf *mace_get(struct mc_softc *, uint8_t *, int);
87 static void mace_calcladrf(struct ethercom *ac, u_int8_t *af);
88 static inline u_int16_t ether_cmp(void *, void *);
89 static int mc_mediachange(struct ifnet *);
90 static void mc_mediastatus(struct ifnet *, struct ifmediareq *);
91
92 /*
93 * Compare two Ether/802 addresses for equality, inlined and
94 * unrolled for speed. Use this like memcmp().
95 *
96 * XXX: Add <machine/inlines.h> for stuff like this?
97 * XXX: or maybe add it to libkern.h instead?
98 *
99 * "I'd love to have an inline assembler version of this."
100 * XXX: Who wanted that? mycroft? I wrote one, but this
101 * version in C is as good as hand-coded assembly. -gwr
102 *
103 * Please do NOT tweak this without looking at the actual
104 * assembly code generated before and after your tweaks!
105 */
106 static inline u_int16_t
107 ether_cmp(void *one, void *two)
108 {
109 register u_int16_t *a = (u_short *) one;
110 register u_int16_t *b = (u_short *) two;
111 register u_int16_t diff;
112
113 #ifdef m68k
114 /*
115 * The post-increment-pointer form produces the best
116 * machine code for m68k. This was carefully tuned
117 * so it compiles to just 8 short (2-byte) op-codes!
118 */
119 diff = *a++ - *b++;
120 diff |= *a++ - *b++;
121 diff |= *a++ - *b++;
122 #else
123 /*
124 * Most modern CPUs do better with a single expresion.
125 * Note that short-cut evaluation is NOT helpful here,
126 * because it just makes the code longer, not faster!
127 */
128 diff = (a[0] - b[0]) | (a[1] - b[1]) | (a[2] - b[2]);
129 #endif
130
131 return (diff);
132 }
133
134 #define ETHER_CMP ether_cmp
135
136 /*
137 * Interface exists: make available by filling in network interface
138 * record. System will initialize the interface when it is ready
139 * to accept packets.
140 */
141 int
142 mcsetup(struct mc_softc *sc, u_int8_t *lladdr)
143 {
144 struct ifnet *ifp = &sc->sc_if;
145
146 /* reset the chip and disable all interrupts */
147 NIC_PUT(sc, MACE_BIUCC, SWRST);
148 DELAY(100);
149 NIC_PUT(sc, MACE_IMR, ~0);
150
151 memcpy(sc->sc_enaddr, lladdr, ETHER_ADDR_LEN);
152 printf(": address %s\n", ether_sprintf(lladdr));
153
154 memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
155 ifp->if_softc = sc;
156 ifp->if_ioctl = mcioctl;
157 ifp->if_start = mcstart;
158 ifp->if_flags =
159 IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
160 ifp->if_watchdog = mcwatchdog;
161
162 /* initialize ifmedia structures */
163 ifmedia_init(&sc->sc_media, 0, mc_mediachange, mc_mediastatus);
164 ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL);
165 ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL);
166
167 if_attach(ifp);
168 ether_ifattach(ifp, lladdr);
169
170 return (0);
171 }
172
173 hide int
174 mcioctl(struct ifnet *ifp, u_long cmd, void *data)
175 {
176 struct mc_softc *sc = ifp->if_softc;
177 struct ifaddr *ifa;
178 struct ifreq *ifr;
179
180 int s = splnet(), err = 0;
181
182 switch (cmd) {
183
184 case SIOCINITIFADDR:
185 ifa = (struct ifaddr *)data;
186 ifp->if_flags |= IFF_UP;
187 mcinit(sc);
188 switch (ifa->ifa_addr->sa_family) {
189 #ifdef INET
190 case AF_INET:
191 arp_ifinit(ifp, ifa);
192 break;
193 #endif
194 default:
195 break;
196 }
197 break;
198
199 case SIOCSIFFLAGS:
200 if ((err = ifioctl_common(ifp, cmd, data)) != 0)
201 break;
202 /* XXX see the comment in ed_ioctl() about code re-use */
203 if ((ifp->if_flags & IFF_UP) == 0 &&
204 (ifp->if_flags & IFF_RUNNING) != 0) {
205 /*
206 * If interface is marked down and it is running,
207 * then stop it.
208 */
209 mcstop(sc);
210 ifp->if_flags &= ~IFF_RUNNING;
211 } else if ((ifp->if_flags & IFF_UP) != 0 &&
212 (ifp->if_flags & IFF_RUNNING) == 0) {
213 /*
214 * If interface is marked up and it is stopped,
215 * then start it.
216 */
217 (void)mcinit(sc);
218 } else {
219 /*
220 * reset the interface to pick up any other changes
221 * in flags
222 */
223 mcreset(sc);
224 mcstart(ifp);
225 }
226 break;
227
228 case SIOCADDMULTI:
229 case SIOCDELMULTI:
230 if ((err = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
231 /*
232 * Multicast list has changed; set the hardware
233 * filter accordingly. But remember UP flag!
234 */
235 if (ifp->if_flags & IFF_RUNNING)
236 mcreset(sc);
237 err = 0;
238 }
239 break;
240
241 case SIOCGIFMEDIA:
242 case SIOCSIFMEDIA:
243 ifr = (struct ifreq *) data;
244 err = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
245 break;
246
247 default:
248 err = ether_ioctl(ifp, cmd, data);
249 break;
250 }
251 splx(s);
252 return (err);
253 }
254
255 /*
256 * Encapsulate a packet of type family for the local net.
257 */
258 hide void
259 mcstart(struct ifnet *ifp)
260 {
261 struct mc_softc *sc = ifp->if_softc;
262 struct mbuf *m;
263
264 if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
265 return;
266
267 while (1) {
268 if (ifp->if_flags & IFF_OACTIVE)
269 return;
270
271 IF_DEQUEUE(&ifp->if_snd, m);
272 if (m == 0)
273 return;
274
275 /*
276 * If bpf is listening on this interface, let it
277 * see the packet before we commit it to the wire.
278 */
279 bpf_mtap(ifp, m);
280
281 /*
282 * Copy the mbuf chain into the transmit buffer.
283 */
284 ifp->if_flags |= IFF_OACTIVE;
285 maceput(sc, m);
286
287 ifp->if_opackets++; /* # of pkts */
288 }
289 }
290
291 /*
292 * reset and restart the MACE. Called in case of fatal
293 * hardware/software errors.
294 */
295 hide void
296 mcreset(struct mc_softc *sc)
297 {
298 mcstop(sc);
299 mcinit(sc);
300 }
301
302 hide int
303 mcinit(struct mc_softc *sc)
304 {
305 int s;
306 u_int8_t maccc, ladrf[8];
307
308 if (sc->sc_if.if_flags & IFF_RUNNING)
309 /* already running */
310 return (0);
311
312 s = splnet();
313
314 NIC_PUT(sc, MACE_BIUCC, sc->sc_biucc);
315 NIC_PUT(sc, MACE_FIFOCC, sc->sc_fifocc);
316 NIC_PUT(sc, MACE_IMR, ~0); /* disable all interrupts */
317 NIC_PUT(sc, MACE_PLSCC, sc->sc_plscc);
318
319 NIC_PUT(sc, MACE_UTR, RTRD); /* disable reserved test registers */
320
321 /* set MAC address */
322 NIC_PUT(sc, MACE_IAC, ADDRCHG);
323 while (NIC_GET(sc, MACE_IAC) & ADDRCHG)
324 ;
325 NIC_PUT(sc, MACE_IAC, PHYADDR);
326 bus_space_write_multi_1(sc->sc_regt, sc->sc_regh, MACE_REG(MACE_PADR),
327 sc->sc_enaddr, ETHER_ADDR_LEN);
328
329 /* set logical address filter */
330 mace_calcladrf(&sc->sc_ethercom, ladrf);
331
332 NIC_PUT(sc, MACE_IAC, ADDRCHG);
333 while (NIC_GET(sc, MACE_IAC) & ADDRCHG)
334 ;
335 NIC_PUT(sc, MACE_IAC, LOGADDR);
336 bus_space_write_multi_1(sc->sc_regt, sc->sc_regh, MACE_REG(MACE_LADRF),
337 ladrf, 8);
338
339 NIC_PUT(sc, MACE_XMTFC, APADXMT);
340 /*
341 * No need to autostrip padding on receive... Ethernet frames
342 * don't have a length field, unlike 802.3 frames, so the MACE
343 * can't figure out the length of the packet anyways.
344 */
345 NIC_PUT(sc, MACE_RCVFC, 0);
346
347 maccc = ENXMT | ENRCV;
348 if (sc->sc_if.if_flags & IFF_PROMISC)
349 maccc |= PROM;
350
351 NIC_PUT(sc, MACE_MACCC, maccc);
352
353 if (sc->sc_bus_init)
354 (*sc->sc_bus_init)(sc);
355
356 /*
357 * Enable all interrupts except receive, since we use the DMA
358 * completion interrupt for that.
359 */
360 NIC_PUT(sc, MACE_IMR, RCVINTM);
361
362 /* flag interface as "running" */
363 sc->sc_if.if_flags |= IFF_RUNNING;
364 sc->sc_if.if_flags &= ~IFF_OACTIVE;
365
366 splx(s);
367 return (0);
368 }
369
370 /*
371 * close down an interface and free its buffers
372 * Called on final close of device, or if mcinit() fails
373 * part way through.
374 */
375 hide int
376 mcstop(struct mc_softc *sc)
377 {
378 int s = splnet();
379
380 NIC_PUT(sc, MACE_BIUCC, SWRST);
381 DELAY(100);
382
383 sc->sc_if.if_timer = 0;
384 sc->sc_if.if_flags &= ~IFF_RUNNING;
385
386 splx(s);
387 return (0);
388 }
389
390 /*
391 * Called if any Tx packets remain unsent after 5 seconds,
392 * In all cases we just reset the chip, and any retransmission
393 * will be handled by higher level protocol timeouts.
394 */
395 hide void
396 mcwatchdog(struct ifnet *ifp)
397 {
398 struct mc_softc *sc = ifp->if_softc;
399
400 printf("mcwatchdog: resetting chip\n");
401 mcreset(sc);
402 }
403
404 /*
405 * stuff packet into MACE (at splnet)
406 */
407 integrate u_int
408 maceput(struct mc_softc *sc, struct mbuf *m)
409 {
410 struct mbuf *n;
411 u_int len, totlen = 0;
412 u_char *buff;
413
414 buff = sc->sc_txbuf;
415
416 for (; m; m = n) {
417 u_char *data = mtod(m, u_char *);
418 len = m->m_len;
419 totlen += len;
420 memcpy(buff, data, len);
421 buff += len;
422 MFREE(m, n);
423 }
424
425 if (totlen > PAGE_SIZE)
426 panic("%s: maceput: packet overflow", sc->sc_dev.dv_xname);
427
428 #if 0
429 if (totlen < ETHERMIN + sizeof(struct ether_header)) {
430 int pad = ETHERMIN + sizeof(struct ether_header) - totlen;
431 memset(sc->sc_txbuf + totlen, 0, pad);
432 totlen = ETHERMIN + sizeof(struct ether_header);
433 }
434 #endif
435
436 (*sc->sc_putpacket)(sc, totlen);
437
438 sc->sc_if.if_timer = 5; /* 5 seconds to watch for failing to transmit */
439 return (totlen);
440 }
441
442 int
443 mcintr(void *arg)
444 {
445 struct mc_softc *sc = arg;
446 u_int8_t ir;
447
448 ir = NIC_GET(sc, MACE_IR) & ~NIC_GET(sc, MACE_IMR);
449 if (ir == 0)
450 return 0;
451
452 if (ir & JAB) {
453 #ifdef MCDEBUG
454 printf("%s: jabber error\n", sc->sc_dev.dv_xname);
455 #endif
456 sc->sc_if.if_oerrors++;
457 }
458
459 if (ir & BABL) {
460 #ifdef MCDEBUG
461 printf("%s: babble\n", sc->sc_dev.dv_xname);
462 #endif
463 sc->sc_if.if_oerrors++;
464 }
465
466 if (ir & CERR) {
467 printf("%s: collision error\n", sc->sc_dev.dv_xname);
468 sc->sc_if.if_collisions++;
469 }
470
471 /*
472 * Pretend we have carrier; if we don't this will be cleared
473 * shortly.
474 */
475 sc->sc_havecarrier = 1;
476
477 if (ir & XMTINT)
478 mc_tint(sc);
479
480 if (ir & RCVINT)
481 mc_rint(sc);
482
483 return 1;
484 }
485
486 integrate void
487 mc_tint(struct mc_softc *sc)
488 {
489 u_int8_t xmtrc, xmtfs;
490
491 xmtrc = NIC_GET(sc, MACE_XMTRC);
492 xmtfs = NIC_GET(sc, MACE_XMTFS);
493
494 if ((xmtfs & XMTSV) == 0)
495 return;
496
497 if (xmtfs & UFLO) {
498 printf("%s: underflow\n", sc->sc_dev.dv_xname);
499 mcreset(sc);
500 return;
501 }
502
503 if (xmtfs & LCOL) {
504 printf("%s: late collision\n", sc->sc_dev.dv_xname);
505 sc->sc_if.if_oerrors++;
506 sc->sc_if.if_collisions++;
507 }
508
509 if (xmtfs & MORE)
510 /* Real number is unknown. */
511 sc->sc_if.if_collisions += 2;
512 else if (xmtfs & ONE)
513 sc->sc_if.if_collisions++;
514 else if (xmtfs & RTRY) {
515 sc->sc_if.if_collisions += 16;
516 sc->sc_if.if_oerrors++;
517 }
518
519 if (xmtfs & LCAR) {
520 sc->sc_havecarrier = 0;
521 printf("%s: lost carrier\n", sc->sc_dev.dv_xname);
522 sc->sc_if.if_oerrors++;
523 }
524
525 sc->sc_if.if_flags &= ~IFF_OACTIVE;
526 sc->sc_if.if_timer = 0;
527 mcstart(&sc->sc_if);
528 }
529
530 void
531 mc_rint(struct mc_softc *sc)
532 {
533 #define rxf sc->sc_rxframe
534 u_int len;
535
536 len = (rxf.rx_rcvcnt | ((rxf.rx_rcvsts & 0xf) << 8)) - 4;
537
538 #ifdef MCDEBUG
539 if (rxf.rx_rcvsts & 0xf0)
540 printf("%s: rcvcnt %02x rcvsts %02x rntpc 0x%02x rcvcc 0x%02x\n",
541 sc->sc_dev.dv_xname, rxf.rx_rcvcnt, rxf.rx_rcvsts,
542 rxf.rx_rntpc, rxf.rx_rcvcc);
543 #endif
544
545 if (rxf.rx_rcvsts & OFLO) {
546 printf("%s: receive FIFO overflow\n", sc->sc_dev.dv_xname);
547 sc->sc_if.if_ierrors++;
548 return;
549 }
550
551 if (rxf.rx_rcvsts & CLSN)
552 sc->sc_if.if_collisions++;
553
554 if (rxf.rx_rcvsts & FRAM) {
555 #ifdef MCDEBUG
556 printf("%s: framing error\n", sc->sc_dev.dv_xname);
557 #endif
558 sc->sc_if.if_ierrors++;
559 return;
560 }
561
562 if (rxf.rx_rcvsts & FCS) {
563 #ifdef MCDEBUG
564 printf("%s: frame control checksum error\n", sc->sc_dev.dv_xname);
565 #endif
566 sc->sc_if.if_ierrors++;
567 return;
568 }
569
570 mace_read(sc, rxf.rx_frame, len);
571 #undef rxf
572 }
573
574 integrate void
575 mace_read(struct mc_softc *sc, uint8_t *pkt, int len)
576 {
577 struct ifnet *ifp = &sc->sc_if;
578 struct mbuf *m;
579
580 if (len <= sizeof(struct ether_header) ||
581 len > ETHERMTU + sizeof(struct ether_header)) {
582 #ifdef MCDEBUG
583 printf("%s: invalid packet size %d; dropping\n",
584 sc->sc_dev.dv_xname, len);
585 #endif
586 ifp->if_ierrors++;
587 return;
588 }
589
590 m = mace_get(sc, pkt, len);
591 if (m == NULL) {
592 ifp->if_ierrors++;
593 return;
594 }
595
596 ifp->if_ipackets++;
597
598 /* Pass this up to any BPF listeners. */
599 bpf_mtap(ifp, m);
600
601 /* Pass the packet up. */
602 (*ifp->if_input)(ifp, m);
603 }
604
605 /*
606 * Pull data off an interface.
607 * Len is length of data, with local net header stripped.
608 * We copy the data into mbufs. When full cluster sized units are present
609 * we copy into clusters.
610 */
611 integrate struct mbuf *
612 mace_get(struct mc_softc *sc, uint8_t *pkt, int totlen)
613 {
614 register struct mbuf *m;
615 struct mbuf *top, **mp;
616 int len;
617
618 MGETHDR(m, M_DONTWAIT, MT_DATA);
619 if (m == 0)
620 return (0);
621 m->m_pkthdr.rcvif = &sc->sc_if;
622 m->m_pkthdr.len = totlen;
623 len = MHLEN;
624 top = 0;
625 mp = ⊤
626
627 while (totlen > 0) {
628 if (top) {
629 MGET(m, M_DONTWAIT, MT_DATA);
630 if (m == 0) {
631 m_freem(top);
632 return 0;
633 }
634 len = MLEN;
635 }
636 if (totlen >= MINCLSIZE) {
637 MCLGET(m, M_DONTWAIT);
638 if ((m->m_flags & M_EXT) == 0) {
639 m_free(m);
640 m_freem(top);
641 return 0;
642 }
643 len = MCLBYTES;
644 }
645 m->m_len = len = min(totlen, len);
646 memcpy(mtod(m, void *), pkt, len);
647 pkt += len;
648 totlen -= len;
649 *mp = m;
650 mp = &m->m_next;
651 }
652
653 return (top);
654 }
655
656 /*
657 * Go through the list of multicast addresses and calculate the logical
658 * address filter.
659 */
660 void
661 mace_calcladrf(struct ethercom *ac, u_int8_t *af)
662 {
663 struct ifnet *ifp = &ac->ec_if;
664 struct ether_multi *enm;
665 register u_char *cp, c;
666 register u_int32_t crc;
667 register int i, len;
668 struct ether_multistep step;
669
670 /*
671 * Set up multicast address filter by passing all multicast addresses
672 * through a crc generator, and then using the high order 6 bits as an
673 * index into the 64 bit logical address filter. The high order bit
674 * selects the word, while the rest of the bits select the bit within
675 * the word.
676 */
677
678 *((u_int32_t *)af) = *((u_int32_t *)af + 1) = 0;
679
680 ETHER_FIRST_MULTI(step, ac, enm);
681 while (enm != NULL) {
682 if (ETHER_CMP(enm->enm_addrlo, enm->enm_addrhi)) {
683 /*
684 * We must listen to a range of multicast addresses.
685 * For now, just accept all multicasts, rather than
686 * trying to set only those filter bits needed to match
687 * the range. (At this time, the only use of address
688 * ranges is for IP multicast routing, for which the
689 * range is big enough to require all bits set.)
690 */
691 goto allmulti;
692 }
693
694 cp = enm->enm_addrlo;
695 crc = 0xffffffff;
696 for (len = sizeof(enm->enm_addrlo); --len >= 0;) {
697 c = *cp++;
698 for (i = 8; --i >= 0;) {
699 if ((crc & 0x01) ^ (c & 0x01)) {
700 crc >>= 1;
701 crc ^= 0xedb88320;
702 } else
703 crc >>= 1;
704 c >>= 1;
705 }
706 }
707 /* Just want the 6 most significant bits. */
708 crc >>= 26;
709
710 /* Set the corresponding bit in the filter. */
711 af[crc >> 3] |= 1 << (crc & 7);
712
713 ETHER_NEXT_MULTI(step, enm);
714 }
715 ifp->if_flags &= ~IFF_ALLMULTI;
716 return;
717
718 allmulti:
719 ifp->if_flags |= IFF_ALLMULTI;
720 *((u_int32_t *)af) = *((u_int32_t *)af + 1) = 0xffffffff;
721 }
722
723 int
724 mc_mediachange(struct ifnet *ifp)
725 {
726 return EINVAL;
727 }
728
729 void
730 mc_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
731 {
732 struct mc_softc *sc = ifp->if_softc;
733
734 if ((ifp->if_flags & IFF_UP) == 0)
735 return;
736
737 if (sc->sc_havecarrier)
738 ifmr->ifm_status |= IFM_ACTIVE;
739 }
740