1 /* $OpenBSD: mii_physubr.c,v 1.36 2009/07/22 23:51:43 sthen Exp $ */
2 /* $NetBSD: mii_physubr.c,v 1.20 2001/04/13 23:30:09 thorpej Exp $ */
3
4 /*-
5 * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
10 * NASA Ames Research Center.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 /*
35 * Subroutines common to all PHYs.
36 */
37
38 #include <sys/param.h>
39 #include <sys/device.h>
40 #include <sys/systm.h>
41 #include <sys/kernel.h>
42 #include <sys/socket.h>
43 #include <sys/errno.h>
44 #include <sys/proc.h>
45
46 #include <net/if.h>
47 #include <net/if_media.h>
48
49 #include <dev/mii/mii.h>
50 #include <dev/mii/miivar.h>
51
52 /*
53 * Media to register setting conversion table. Order matters.
54 * XXX 802.3 doesn't specify ANAR or ANLPAR bits for 1000base.
55 */
56 const struct mii_media mii_media_table[] = {
57 /* None */
58 { BMCR_ISO, ANAR_CSMA, 0 },
59 /* 10baseT */
60 { BMCR_S10, ANAR_CSMA|ANAR_10, 0 },
61 /* 10baseT-FDX */
62 { BMCR_S10|BMCR_FDX, ANAR_CSMA|ANAR_10_FD, 0 },
63 /* 100baseT4 */
64 { BMCR_S100, ANAR_CSMA|ANAR_T4, 0 },
65 /* 100baseTX */
66 { BMCR_S100, ANAR_CSMA|ANAR_TX, 0 },
67 /* 100baseTX-FDX */
68 { BMCR_S100|BMCR_FDX, ANAR_CSMA|ANAR_TX_FD, 0 },
69 /* 1000baseX */
70 { BMCR_S1000, ANAR_CSMA, 0 },
71 /* 1000baseX-FDX */
72 { BMCR_S1000|BMCR_FDX, ANAR_CSMA, 0 },
73 /* 1000baseT */
74 { BMCR_S1000, ANAR_CSMA, GTCR_ADV_1000THDX },
75 /* 1000baseT-FDX */
76 { BMCR_S1000|BMCR_FDX, ANAR_CSMA, GTCR_ADV_1000TFDX },
77 };
78
79 void
mii_phy_setmedia(struct mii_softc * sc)80 mii_phy_setmedia(struct mii_softc *sc)
81 {
82 struct mii_data *mii = sc->mii_pdata;
83 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
84 int bmcr, anar, gtcr;
85
86 if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
87 if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0 ||
88 (sc->mii_flags & MIIF_FORCEANEG))
89 (void) mii_phy_auto(sc, 1);
90 return;
91 }
92
93 /*
94 * Table index is stored in the media entry.
95 */
96 #ifdef DIAGNOSTIC
97 if (ife->ifm_data < 0 || ife->ifm_data >= MII_NMEDIA)
98 panic("mii_phy_setmedia");
99 #endif
100
101 anar = mii_media_table[ife->ifm_data].mm_anar;
102 bmcr = mii_media_table[ife->ifm_data].mm_bmcr;
103 gtcr = mii_media_table[ife->ifm_data].mm_gtcr;
104
105 if (mii->mii_media.ifm_media & IFM_ETH_MASTER) {
106 switch (IFM_SUBTYPE(ife->ifm_media)) {
107 case IFM_1000_T:
108 gtcr |= GTCR_MAN_MS|GTCR_ADV_MS;
109 break;
110
111 default:
112 panic("mii_phy_setmedia: MASTER on wrong media");
113 }
114 }
115
116 if (ife->ifm_media & IFM_LOOP)
117 bmcr |= BMCR_LOOP;
118
119 PHY_WRITE(sc, MII_ANAR, anar);
120 PHY_WRITE(sc, MII_BMCR, bmcr);
121 if (sc->mii_flags & MIIF_HAVE_GTCR)
122 PHY_WRITE(sc, MII_100T2CR, gtcr);
123 }
124
125 int
mii_phy_auto(struct mii_softc * sc,int waitfor)126 mii_phy_auto(struct mii_softc *sc, int waitfor)
127 {
128 int bmsr, i;
129
130 if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
131 /*
132 * Check for 1000BASE-X. Autonegotiation is a bit
133 * different on such devices.
134 */
135 if (sc->mii_flags & MIIF_IS_1000X) {
136 uint16_t anar = 0;
137
138 if (sc->mii_extcapabilities & EXTSR_1000XFDX)
139 anar |= ANAR_X_FD;
140 if (sc->mii_extcapabilities & EXTSR_1000XHDX)
141 anar |= ANAR_X_HD;
142
143 if (sc->mii_flags & MIIF_DOPAUSE &&
144 sc->mii_extcapabilities & EXTSR_1000XFDX)
145 anar |= ANAR_X_PAUSE_TOWARDS;
146
147 PHY_WRITE(sc, MII_ANAR, anar);
148 } else {
149 uint16_t anar;
150
151 anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) |
152 ANAR_CSMA;
153 /*
154 * Most 100baseTX PHY's only support symmetric
155 * PAUSE, so we don't advertise asymmetric
156 * PAUSE unless we also have 1000baseT capability.
157 */
158 if (sc->mii_flags & MIIF_DOPAUSE) {
159 if (sc->mii_capabilities & BMSR_100TXFDX)
160 anar |= ANAR_FC;
161 if (sc->mii_extcapabilities & EXTSR_1000TFDX)
162 anar |= ANAR_PAUSE_TOWARDS;
163 }
164 PHY_WRITE(sc, MII_ANAR, anar);
165 if (sc->mii_flags & MIIF_HAVE_GTCR) {
166 uint16_t gtcr = 0;
167
168 if (sc->mii_extcapabilities & EXTSR_1000TFDX)
169 gtcr |= GTCR_ADV_1000TFDX;
170 if (sc->mii_extcapabilities & EXTSR_1000THDX)
171 gtcr |= GTCR_ADV_1000THDX;
172
173 PHY_WRITE(sc, MII_100T2CR, gtcr);
174 }
175 }
176 PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG);
177 }
178
179 if (waitfor) {
180 /* Wait 500ms for it to complete. */
181 for (i = 0; i < 500; i++) {
182 if ((bmsr = PHY_READ(sc, MII_BMSR)) & BMSR_ACOMP)
183 return (0);
184 delay(1000);
185 }
186
187 /*
188 * Don't need to worry about clearing MIIF_DOINGAUTO.
189 * If that's set, a timeout is pending, and it will
190 * clear the flag.
191 */
192 return (EIO);
193 }
194
195 /*
196 * Just let it finish asynchronously. This is for the benefit of
197 * the tick handler driving autonegotiation. Don't want 500ms
198 * delays all the time while the system is running!
199 */
200 if (sc->mii_flags & MIIF_AUTOTSLEEP) {
201 sc->mii_flags |= MIIF_DOINGAUTO;
202 tsleep(&sc->mii_flags, PZERO, "miiaut", hz >> 1);
203 mii_phy_auto_timeout(sc);
204 } else if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
205 sc->mii_flags |= MIIF_DOINGAUTO;
206 timeout_set(&sc->mii_phy_timo, mii_phy_auto_timeout, sc);
207 timeout_add(&sc->mii_phy_timo, hz / 2);
208 }
209 return (EJUSTRETURN);
210 }
211
212 void
mii_phy_auto_timeout(void * arg)213 mii_phy_auto_timeout(void *arg)
214 {
215 struct mii_softc *sc = arg;
216 int s, bmsr;
217
218 if ((sc->mii_dev.dv_flags & DVF_ACTIVE) == 0)
219 return;
220
221 s = splnet();
222 sc->mii_flags &= ~MIIF_DOINGAUTO;
223 bmsr = PHY_READ(sc, MII_BMSR);
224
225 /* Update the media status. */
226 (void) PHY_SERVICE(sc, sc->mii_pdata, MII_POLLSTAT);
227 splx(s);
228 }
229
230 int
mii_phy_tick(struct mii_softc * sc)231 mii_phy_tick(struct mii_softc *sc)
232 {
233 struct mii_data *mii = sc->mii_pdata;
234 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
235 int reg;
236
237 /* Just bail now if the interface is down. */
238 if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
239 return (EJUSTRETURN);
240
241 /*
242 * If we're not doing autonegotiation, we don't need to do
243 * any extra work here. However, we need to check the link
244 * status so we can generate an announcement if the status
245 * changes.
246 */
247 if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
248 return (0);
249
250 /* Read the status register twice; BMSR_LINK is latch-low. */
251 reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
252 if (reg & BMSR_LINK) {
253 /*
254 * See above.
255 */
256 return (0);
257 }
258
259 /*
260 * Only retry autonegotiation every mii_anegticks seconds.
261 */
262 if (!sc->mii_anegticks)
263 sc->mii_anegticks = MII_ANEGTICKS;
264
265 if (++sc->mii_ticks <= sc->mii_anegticks)
266 return (EJUSTRETURN);
267
268 sc->mii_ticks = 0;
269 PHY_RESET(sc);
270
271 if (mii_phy_auto(sc, 0) == EJUSTRETURN)
272 return (EJUSTRETURN);
273
274 /*
275 * Might need to generate a status message if autonegotiation
276 * failed.
277 */
278 return (0);
279 }
280
281 void
mii_phy_reset(struct mii_softc * sc)282 mii_phy_reset(struct mii_softc *sc)
283 {
284 int reg, i;
285
286 if (sc->mii_flags & MIIF_NOISOLATE)
287 reg = BMCR_RESET;
288 else
289 reg = BMCR_RESET | BMCR_ISO;
290 PHY_WRITE(sc, MII_BMCR, reg);
291
292 /*
293 * It is best to allow a little time for the reset to settle
294 * in before we start polling the BMCR again. Notably, the
295 * DP83840A manual states that there should be a 500us delay
296 * between asserting software reset and attempting MII serial
297 * operations. Also, a DP83815 can get into a bad state on
298 * cable removal and reinsertion if we do not delay here.
299 */
300 delay(500);
301
302 /* Wait another 100ms for it to complete. */
303 for (i = 0; i < 100; i++) {
304 reg = PHY_READ(sc, MII_BMCR);
305 if ((reg & BMCR_RESET) == 0)
306 break;
307 delay(1000);
308 }
309
310 if (sc->mii_inst != 0 && ((sc->mii_flags & MIIF_NOISOLATE) == 0))
311 PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
312 }
313
314 void
mii_phy_down(struct mii_softc * sc)315 mii_phy_down(struct mii_softc *sc)
316 {
317 if (sc->mii_flags & MIIF_DOINGAUTO) {
318 sc->mii_flags &= ~MIIF_DOINGAUTO;
319 timeout_del(&sc->mii_phy_timo);
320 }
321 }
322
323
324 void
mii_phy_status(struct mii_softc * sc)325 mii_phy_status(struct mii_softc *sc)
326 {
327 PHY_STATUS(sc);
328 }
329
330 void
mii_phy_update(struct mii_softc * sc,int cmd)331 mii_phy_update(struct mii_softc *sc, int cmd)
332 {
333 struct mii_data *mii = sc->mii_pdata;
334 struct ifnet *ifp = mii->mii_ifp;
335 int announce, s;
336
337 if (sc->mii_media_active != mii->mii_media_active ||
338 sc->mii_media_status != mii->mii_media_status ||
339 cmd == MII_MEDIACHG) {
340 announce = mii_phy_statusmsg(sc);
341 (*mii->mii_statchg)(sc->mii_dev.dv_parent);
342 sc->mii_media_active = mii->mii_media_active;
343 sc->mii_media_status = mii->mii_media_status;
344
345 if (announce) {
346 s = splnet();
347 if_link_state_change(ifp);
348 splx(s);
349 }
350 }
351 }
352
353 int
mii_phy_statusmsg(struct mii_softc * sc)354 mii_phy_statusmsg(struct mii_softc *sc)
355 {
356 struct mii_data *mii = sc->mii_pdata;
357 struct ifnet *ifp = mii->mii_ifp;
358 u_int64_t baudrate;
359 int link_state, announce = 0;
360
361 if (mii->mii_media_status & IFM_AVALID) {
362 if (mii->mii_media_status & IFM_ACTIVE) {
363 link_state = LINK_STATE_UP;
364 } else
365 link_state = LINK_STATE_DOWN;
366 } else
367 link_state = LINK_STATE_UNKNOWN;
368
369 baudrate = ifmedia_baudrate(mii->mii_media_active);
370
371 if (link_state != ifp->if_link_state) {
372 ifp->if_link_state = link_state;
373 /*
374 * XXX Right here we'd like to notify protocols
375 * XXX that the link status has changed, so that
376 * XXX e.g. Duplicate Address Detection can restart.
377 */
378 announce = 1;
379 }
380
381 if (baudrate != ifp->if_baudrate) {
382 ifp->if_baudrate = baudrate;
383 announce = 1;
384 }
385
386 return (announce);
387 }
388
389 /*
390 * Initialize generic PHY media based on BMSR, called when a PHY is
391 * attached.
392 */
393 void
mii_phy_add_media(struct mii_softc * sc)394 mii_phy_add_media(struct mii_softc *sc)
395 {
396 struct mii_data *mii = sc->mii_pdata;
397
398 #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
399
400 if ((sc->mii_flags & MIIF_NOISOLATE) == 0)
401 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
402 MII_MEDIA_NONE);
403
404 if (sc->mii_capabilities & BMSR_10THDX) {
405 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst),
406 MII_MEDIA_10_T);
407 }
408 if (sc->mii_capabilities & BMSR_10TFDX) {
409 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst),
410 MII_MEDIA_10_T_FDX);
411 }
412 if (sc->mii_capabilities & BMSR_100TXHDX) {
413 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst),
414 MII_MEDIA_100_TX);
415 }
416 if (sc->mii_capabilities & BMSR_100TXFDX) {
417 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst),
418 MII_MEDIA_100_TX_FDX);
419 }
420 if (sc->mii_capabilities & BMSR_100T4) {
421 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst),
422 MII_MEDIA_100_T4);
423 }
424 if (sc->mii_extcapabilities & EXTSR_MEDIAMASK) {
425 /*
426 * XXX Right now only handle 1000SX and 1000TX. Need
427 * XXX to handle 1000LX and 1000CX some how.
428 */
429 if (sc->mii_extcapabilities & EXTSR_1000XHDX) {
430 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
431 sc->mii_flags |= MIIF_IS_1000X;
432 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0,
433 sc->mii_inst), MII_MEDIA_1000_X);
434 }
435 if (sc->mii_extcapabilities & EXTSR_1000XFDX) {
436 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
437 sc->mii_flags |= MIIF_IS_1000X;
438 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX,
439 sc->mii_inst), MII_MEDIA_1000_X_FDX);
440 }
441
442 /*
443 * 1000baseT media needs to be able to manipulate
444 * master/slave mode. We set IFM_ETH_MASTER in
445 * the "don't care mask" and filter it out when
446 * the media is set.
447 *
448 * All 1000baseT PHYs have a 1000baseT control register.
449 */
450 if (sc->mii_extcapabilities & EXTSR_1000THDX) {
451 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
452 sc->mii_flags |= MIIF_HAVE_GTCR;
453 mii->mii_media.ifm_mask |= IFM_ETH_MASTER;
454 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0,
455 sc->mii_inst), MII_MEDIA_1000_T);
456 }
457 if (sc->mii_extcapabilities & EXTSR_1000TFDX) {
458 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
459 sc->mii_flags |= MIIF_HAVE_GTCR;
460 mii->mii_media.ifm_mask |= IFM_ETH_MASTER;
461 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX,
462 sc->mii_inst), MII_MEDIA_1000_T_FDX);
463 }
464 }
465
466 if (sc->mii_capabilities & BMSR_ANEG) {
467 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst),
468 MII_NMEDIA); /* intentionally invalid index */
469 }
470 #undef ADD
471 }
472
473 void
mii_phy_delete_media(struct mii_softc * sc)474 mii_phy_delete_media(struct mii_softc *sc)
475 {
476 struct mii_data *mii = sc->mii_pdata;
477
478 ifmedia_delete_instance(&mii->mii_media, sc->mii_inst);
479 }
480
481 int
mii_phy_activate(struct device * self,enum devact act)482 mii_phy_activate(struct device *self, enum devact act)
483 {
484 int rv = 0;
485
486 switch (act) {
487 case DVACT_ACTIVATE:
488 rv = EOPNOTSUPP;
489 break;
490
491 case DVACT_DEACTIVATE:
492 /* Nothing special to do. */
493 break;
494 }
495
496 return (rv);
497 }
498
499 int
mii_phy_detach(struct device * self,int flags)500 mii_phy_detach(struct device *self, int flags)
501 {
502 struct mii_softc *sc = (void *) self;
503
504 if (sc->mii_flags & MIIF_DOINGAUTO)
505 timeout_del(&sc->mii_phy_timo);
506
507 mii_phy_delete_media(sc);
508
509 return (0);
510 }
511
512 const struct mii_phydesc *
mii_phy_match(const struct mii_attach_args * ma,const struct mii_phydesc * mpd)513 mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd)
514 {
515
516 for (; mpd->mpd_name != NULL; mpd++) {
517 if (MII_OUI(ma->mii_id1, ma->mii_id2) == mpd->mpd_oui &&
518 MII_MODEL(ma->mii_id2) == mpd->mpd_model)
519 return (mpd);
520 }
521 return (NULL);
522 }
523
524 /*
525 * Return the flow control status flag from MII_ANAR & MII_ANLPAR.
526 */
527 int
mii_phy_flowstatus(struct mii_softc * sc)528 mii_phy_flowstatus(struct mii_softc *sc)
529 {
530 int anar, anlpar;
531
532 if ((sc->mii_flags & MIIF_DOPAUSE) == 0)
533 return (0);
534
535 anar = PHY_READ(sc, MII_ANAR);
536 anlpar = PHY_READ(sc, MII_ANLPAR);
537
538 /* For 1000baseX, the bits are in a different location. */
539 if (sc->mii_flags & MIIF_IS_1000X) {
540 anar <<= 3;
541 anlpar <<= 3;
542 }
543
544 if ((anar & ANAR_PAUSE_SYM) & (anlpar & ANLPAR_PAUSE_SYM))
545 return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE);
546
547 if ((anar & ANAR_PAUSE_SYM) == 0) {
548 if ((anar & ANAR_PAUSE_ASYM) &&
549 ((anlpar & ANLPAR_PAUSE_TOWARDS) == ANLPAR_PAUSE_TOWARDS))
550 return (IFM_FLOW|IFM_ETH_TXPAUSE);
551 else
552 return (0);
553 }
554
555 if ((anar & ANAR_PAUSE_ASYM) == 0) {
556 if (anlpar & ANLPAR_PAUSE_SYM)
557 return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE);
558 else
559 return (0);
560 }
561
562 switch ((anlpar & ANLPAR_PAUSE_TOWARDS)) {
563 case ANLPAR_PAUSE_NONE:
564 return (0);
565
566 case ANLPAR_PAUSE_ASYM:
567 return (IFM_FLOW|IFM_ETH_RXPAUSE);
568
569 default:
570 return (IFM_FLOW|IFM_ETH_RXPAUSE|IFM_ETH_TXPAUSE);
571 }
572 /* NOTREACHED */
573 }
574
575 /*
576 * Given an ifmedia word, return the corresponding ANAR value.
577 */
578 int
mii_anar(int media)579 mii_anar(int media)
580 {
581 int rv;
582
583 switch (media & (IFM_TMASK|IFM_NMASK|IFM_FDX)) {
584 case IFM_ETHER|IFM_10_T:
585 rv = ANAR_10|ANAR_CSMA;
586 break;
587 case IFM_ETHER|IFM_10_T|IFM_FDX:
588 rv = ANAR_10_FD|ANAR_CSMA;
589 break;
590 case IFM_ETHER|IFM_100_TX:
591 rv = ANAR_TX|ANAR_CSMA;
592 break;
593 case IFM_ETHER|IFM_100_TX|IFM_FDX:
594 rv = ANAR_TX_FD|ANAR_CSMA;
595 break;
596 case IFM_ETHER|IFM_100_T4:
597 rv = ANAR_T4|ANAR_CSMA;
598 break;
599 default:
600 rv = 0;
601 break;
602 }
603
604 return (rv);
605 }
606