amrctl.c revision 1.3.2.1 1 /* $NetBSD: amrctl.c,v 1.3.2.1 2012/05/23 10:07:34 yamt Exp $ */
2
3 /*-
4 * Copyright (c) 2002, Pierre David <Pierre.David (at) crc.u-strasbg.fr>
5 * Copyright (c) 2006, Jung-uk Kim <jkim (at) FreeBSD.org>
6 * All rights reserved.
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 unmodified, this list of conditions, and the following
13 * disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #include <sys/cdefs.h>
31 #ifndef lint
32 __RCSID("$NetBSD: amrctl.c,v 1.3.2.1 2012/05/23 10:07:34 yamt Exp $");
33 #endif
34
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #include <fcntl.h>
39 #include <err.h>
40 #include <errno.h>
41 #include <unistd.h>
42
43 #include <sys/ioctl.h>
44
45 #include <machine/param.h>
46
47 #include <dev/pci/amrio.h>
48 #include <dev/pci/amrreg.h>
49
50 #define NATTEMPTS 5
51 #define SLEEPTIME 100000 /* microseconds */
52
53 static int nattempts = NATTEMPTS; /* # of attempts before giving up */
54 static int sleeptime = SLEEPTIME; /* between attempts, in ms */
55
56 #define AMR_BUFSIZE 1024
57
58 static int enq_result = AMR_STATUS_FAILED;
59 static char enq_buffer[AMR_BUFSIZE];
60
61 #define AMR_MAX_NCTRLS 16
62 #define AMR_MAX_NSDEVS 16
63
64 static uint8_t nschan = 0;
65
66 /*
67 * Include lookup tables, and a function to match a code to a string.
68 *
69 * XXX Lookup tables cannot be included, since they require symbols from
70 * amrreg.h which need in turn the _KERNEL define.
71 */
72
73 /* #define AMR_DEFINE_TABLES */
74 /* #include "amr_tables.h" */
75
76 static int amr_ioctl_enquiry(int, uint8_t, uint8_t, uint8_t);
77 __dead static void usage(const char *);
78 static int describe_card(int, int, int);
79 static char * describe_property(uint8_t, char *);
80 static const char * describe_state(int, uint8_t);
81 static void describe_battery(int, int, int, int, int);
82 static void describe_one_volume(int, int, uint32_t, uint8_t, uint8_t);
83 static void describe_one_drive(int, int, uint8_t);
84 static void describe_drive(int, int, int, int, int);
85
86 /*
87 * Offsets in an amr_user_ioctl.au_cmd [] array See amrio.h
88 */
89
90 #define MB_COMMAND 0
91 #define MB_CHANNEL 1
92 #define MB_PARAM 2
93 #define MB_PAD 3
94 #define MB_DRIVE 4
95
96 #define FIRMWARE_40LD 1
97 #define FIRMWARE_8LD 2
98
99 static const struct {
100 const char *product;
101 const uint32_t signature;
102 } prodtable[] = {
103 { "Series 431", AMR_SIG_431 },
104 { "Series 438", AMR_SIG_438 },
105 { "Series 762", AMR_SIG_762 },
106 { "Integrated HP NetRAID (T5)", AMR_SIG_T5 },
107 { "Series 466", AMR_SIG_466 },
108 { "Series 467", AMR_SIG_467 },
109 { "Integrated HP NetRAID (T7)", AMR_SIG_T7 },
110 { "Series 490", AMR_SIG_490 }
111 };
112
113 static const struct {
114 const int code;
115 const char *ifyes, *ifno;
116 } proptable[] = {
117 { AMR_DRV_WRITEBACK,
118 "writeback", "write-through" },
119 { AMR_DRV_READHEAD,
120 "read-ahead", "no-read-ahead" },
121 { AMR_DRV_ADAPTIVE,
122 "adaptative-io", "no-adaptative-io" }
123 };
124
125 static const struct {
126 const int code;
127 const char *status;
128 } statetable[] = {
129 { AMR_DRV_OFFLINE, "offline" },
130 { AMR_DRV_DEGRADED, "degraded" },
131 { AMR_DRV_OPTIMAL, "optimal" },
132 { AMR_DRV_ONLINE, "online" },
133 { AMR_DRV_FAILED, "failed" },
134 { AMR_DRV_REBUILD, "rebuild" },
135 { AMR_DRV_HOTSPARE, "hotspare" }
136 };
137
138 static const struct {
139 const uint8_t code;
140 const char *status;
141 } battable[] = {
142 { AMR_BATT_MODULE_MISSING, "not present" },
143 { AMR_BATT_LOW_VOLTAGE, "low voltage" },
144 { AMR_BATT_TEMP_HIGH, "high temperature" },
145 { AMR_BATT_PACK_MISSING, "pack missing" },
146 { AMR_BATT_CYCLES_EXCEEDED, "cycle exceeded" }
147 };
148
149 static const struct {
150 const uint8_t code;
151 const char *status;
152 } bcstatble[] = {
153 { AMR_BATT_CHARGE_DONE, "charge done" },
154 { AMR_BATT_CHARGE_INPROG, "charge in progress" },
155 { AMR_BATT_CHARGE_FAIL, "charge failed" }
156 };
157
158 static int
159 amr_ioctl_enquiry(int fd, uint8_t cmd, uint8_t cmdsub, uint8_t cmdqual)
160 {
161 struct amr_user_ioctl am;
162 int r, i;
163
164 am.au_cmd[MB_COMMAND] = cmd;
165 am.au_cmd[MB_CHANNEL] = cmdsub;
166 am.au_cmd[MB_PARAM] = cmdqual;
167 am.au_cmd[MB_PAD] = 0;
168 am.au_cmd[MB_DRIVE] = 0;
169
170 am.au_buffer = enq_buffer;
171 am.au_length = AMR_BUFSIZE;
172 am.au_direction = AMR_IO_READ;
173 am.au_status = 0;
174
175 i = 0;
176 r = -1;
177 while (i < nattempts && r == -1) {
178 r = ioctl(fd, AMR_IO_COMMAND, &am);
179 if (r == -1) {
180 if (errno != EBUSY) {
181 warn("ioctl enquiry");
182 return -1;
183 } else
184 usleep(sleeptime);
185 }
186 i++;
187 }
188 return am.au_status;
189 }
190
191 static void
192 usage(const char *prog)
193 {
194 fprintf(stderr, "usage: %s stat [-a num] [-b] "
195 "[-c ctlr|-f dev] [-g] [-l vol]\n\t\t"
196 "[-p drive|-s bus[:target]] [-t usec] [-v]\n\n\t"
197 "-a num\t\tnumber of retries\n\t"
198 "-b\t\tbattery status\n\t"
199 "-c ctrl\t\tcontroller ID\n\t"
200 "-f dev\t\tdevice path\n\t"
201 "-g\t\tprint global parameters\n\t"
202 "-l vol\t\tlogical volume ID\n\t"
203 "-p drive\tphysical drive ID\n\t"
204 "-s bus[:target]\tSCSI bus (and optinal target)\n\t"
205 "-t usec\t\tsleep time between retries\n\t"
206 "-v\t\tverbose output\n",
207 prog);
208 exit(1);
209 }
210
211 /******************************************************************************
212 * Card description
213 */
214
215 static int
216 describe_card(int fd, int verbosity, int globalparam)
217 {
218 struct amr_enquiry *ae;
219 uint32_t cardtype;
220
221 /*
222 * Try the 40LD firmware interface
223 */
224
225 enq_result = amr_ioctl_enquiry(fd, AMR_CMD_CONFIG,
226 AMR_CONFIG_PRODUCT_INFO, 0);
227 if (enq_result == AMR_STATUS_SUCCESS) {
228 struct amr_prodinfo *ap;
229
230 ap = (struct amr_prodinfo *)enq_buffer;
231 nschan = ap->ap_nschan;
232 if (globalparam) {
233 printf("Product\t\t\t<%.80s>\n", ap->ap_product);
234 printf("Firmware\t\t%.16s\n", ap->ap_firmware);
235 printf("BIOS\t\t\t%.16s\n", ap->ap_bios);
236 printf("SCSI channels\t\t%d\n", ap->ap_nschan);
237 printf("Fibre loops\t\t%d\n", ap->ap_fcloops);
238 printf("Memory size\t\t%d MB\n", ap->ap_memsize);
239 if (verbosity >= 1) {
240 printf("Ioctl\t\t\t%d (%s)\n", FIRMWARE_40LD,
241 "40LD");
242 printf("Signature\t\t0x%08x\n",
243 ap->ap_signature);
244 printf("Configsig\t\t0x%08x\n",
245 ap->ap_configsig);
246 printf("Subsystem\t\t0x%04x\n",
247 ap->ap_subsystem);
248 printf("Subvendor\t\t0x%04x\n",
249 ap->ap_subvendor);
250 printf("Notify counters\t\t%d\n",
251 ap->ap_numnotifyctr);
252 }
253 }
254 return FIRMWARE_40LD;
255 }
256 /*
257 * Try the 8LD firmware interface
258 */
259
260 enq_result = amr_ioctl_enquiry(fd, AMR_CMD_EXT_ENQUIRY2, 0, 0);
261 ae = (struct amr_enquiry *)enq_buffer;
262 if (enq_result == AMR_STATUS_SUCCESS) {
263 cardtype = ae->ae_signature;
264 } else {
265 enq_result = amr_ioctl_enquiry(fd, AMR_CMD_ENQUIRY, 0, 0);
266 cardtype = 0;
267 }
268
269 if (enq_result == AMR_STATUS_SUCCESS) {
270
271 if (globalparam) {
272 const char *product = NULL;
273 char bios[100], firmware[100];
274 size_t i;
275
276 for (i = 0; i < __arraycount(prodtable); i++) {
277 if (cardtype == prodtable[i].signature) {
278 product = prodtable[i].product;
279 break;
280 }
281 }
282 if (product == NULL)
283 product = "unknown card signature";
284
285 /*
286 * HP NetRaid controllers have a special encoding of
287 * the firmware and BIOS versions. The AMI version
288 * seems to have it as strings whereas the HP version
289 * does it with a leading uppercase character and two
290 * binary numbers.
291 */
292
293 if (ae->ae_adapter.aa_firmware[2] >= 'A' &&
294 ae->ae_adapter.aa_firmware[2] <= 'Z' &&
295 ae->ae_adapter.aa_firmware[1] < ' ' &&
296 ae->ae_adapter.aa_firmware[0] < ' ' &&
297 ae->ae_adapter.aa_bios[2] >= 'A' &&
298 ae->ae_adapter.aa_bios[2] <= 'Z' &&
299 ae->ae_adapter.aa_bios[1] < ' ' &&
300 ae->ae_adapter.aa_bios[0] < ' ') {
301
302 /*
303 * looks like we have an HP NetRaid version
304 * of the MegaRaid
305 */
306
307 if (cardtype == AMR_SIG_438) {
308 /*
309 * the AMI 438 is a NetRaid 3si in
310 * HP-land
311 */
312 product = "HP NetRaid 3si";
313 }
314 sprintf(firmware, "%c.%02d.%02d",
315 ae->ae_adapter.aa_firmware[2],
316 ae->ae_adapter.aa_firmware[1],
317 ae->ae_adapter.aa_firmware[0]);
318 sprintf(bios, "%c.%02d.%02d",
319 ae->ae_adapter.aa_bios[2],
320 ae->ae_adapter.aa_bios[1],
321 ae->ae_adapter.aa_bios[0]);
322 } else {
323 sprintf(firmware, "%.4s",
324 ae->ae_adapter.aa_firmware);
325 sprintf(bios, "%.4s", ae->ae_adapter.aa_bios);
326 }
327
328 printf("Ioctl = %d (%s)\n", FIRMWARE_8LD, "8LD");
329 printf("Product =\t<%s>\n", product);
330 printf("Firmware =\t%s\n", firmware);
331 printf("BIOS =\t%s\n", bios);
332 /* printf ("SCSI Channels =\t%d\n", ae->ae_nschan); */
333 /* printf ("Fibre Loops =\t%d\n", ae->ae_fcloops); */
334 printf("Memory size =\t%d MB\n",
335 ae->ae_adapter.aa_memorysize);
336 /*
337 * printf ("Notify counters =\t%d\n",
338 * ae->ae_numnotifyctr) ;
339 */
340 }
341 return FIRMWARE_8LD;
342 }
343 /*
344 * Neither firmware interface succeeded. Abort.
345 */
346
347 fprintf(stderr, "Firmware interface not supported\n");
348 exit(1);
349
350 }
351
352 static char *
353 describe_property(uint8_t prop, char *buffer)
354 {
355 size_t i;
356
357 strcpy(buffer, "<");
358 for (i = 0; i < __arraycount(proptable); i++) {
359 if (i > 0)
360 strcat(buffer, ",");
361 if (prop & proptable[i].code)
362 strcat(buffer, proptable[i].ifyes);
363 else
364 strcat(buffer, proptable[i].ifno);
365 }
366 strcat(buffer, ">");
367
368 return buffer;
369 }
370
371 static const char *
372 describe_state(int verbosity, uint8_t state)
373 {
374 size_t i;
375
376 if ((AMR_DRV_PREVSTATE(state) == AMR_DRV_CURSTATE(state)) &&
377 (AMR_DRV_CURSTATE(state) == AMR_DRV_OFFLINE) && verbosity == 0)
378 return NULL;
379
380 for (i = 0; i < __arraycount(statetable); i++)
381 if (AMR_DRV_CURSTATE(state) == statetable[i].code)
382 return (statetable[i].status);
383
384 return NULL;
385 }
386
387 /******************************************************************************
388 * Battery status
389 */
390 static void
391 describe_battery(int fd, int verbosity, int fwint, int bflags, int globalparam)
392 {
393 uint8_t batt_status;
394 size_t i;
395
396 if (fwint == FIRMWARE_40LD) {
397 enq_result = amr_ioctl_enquiry(fd, AMR_CMD_CONFIG,
398 AMR_CONFIG_ENQ3, AMR_CONFIG_ENQ3_SOLICITED_FULL);
399 if (enq_result == AMR_STATUS_SUCCESS) {
400 struct amr_enquiry3 *ae3;
401
402 ae3 = (struct amr_enquiry3 *)enq_buffer;
403 if (bflags || globalparam) {
404 batt_status = ae3->ae_batterystatus;
405 printf("Battery status\t\t");
406 for (i = 0; i < __arraycount(battable); i++) {
407 if (batt_status & battable[i].code)
408 printf("%s, ", battable[i].status);
409 }
410 if (!(batt_status &
411 (AMR_BATT_MODULE_MISSING|AMR_BATT_PACK_MISSING))) {
412 for (i = 0;
413 i < __arraycount(bcstatble); i++)
414 if (bcstatble[i].code ==
415 (batt_status & AMR_BATT_CHARGE_MASK))
416 printf("%s", bcstatble[i].status);
417 } else
418 printf("charge unknown");
419 if (verbosity)
420 printf(" (0x%02x)", batt_status);
421 printf("\n");
422 }
423 }
424 } else if (fwint == FIRMWARE_8LD) {
425 /* Nothing to do here. */
426 return;
427 } else {
428 fprintf(stderr, "Firmware interface not supported.\n");
429 exit(1);
430 }
431
432 return;
433 }
434
435 /******************************************************************************
436 * Logical volumes
437 */
438
439 static void
440 describe_one_volume(int ldrv, int verbosity,
441 uint32_t size, uint8_t state, uint8_t prop)
442 {
443 float szgb;
444 int raid_level;
445 char propstr[MAXPATHLEN];
446 const char *statestr;
447
448 szgb = ((float)size) / (1024 * 1024 * 2); /* size in GB */
449
450 raid_level = prop & AMR_DRV_RAID_MASK;
451
452 printf("Logical volume %d\t", ldrv);
453 statestr = describe_state(verbosity, state);
454 printf("%s ", statestr);
455 printf("(%.2f GB, RAID%d", szgb, raid_level);
456 if (verbosity >= 1) {
457 describe_property(prop, propstr);
458 printf(" %s", propstr);
459 }
460 printf(")\n");
461 }
462
463 /******************************************************************************
464 * Physical drives
465 */
466
467 static void
468 describe_one_drive(int pdrv, int verbosity, uint8_t state)
469 {
470 const char *statestr;
471
472 statestr = describe_state(verbosity, state);
473 if (statestr) {
474 if (nschan > 0)
475 printf("Physical drive %d:%d\t%s\n",
476 pdrv / AMR_MAX_NSDEVS, pdrv % AMR_MAX_NSDEVS,
477 statestr);
478 else
479 printf("Physical drive %d:\t%s\n", pdrv, statestr);
480 }
481 }
482
483 static void
484 describe_drive(int verbosity, int fwint, int ldrv, int sbus, int sdev)
485 {
486 int drv, pdrv = -1;
487
488 if (sbus > -1 && sdev > -1)
489 pdrv = (sbus * AMR_MAX_NSDEVS) + sdev;
490 if (nschan != 0) {
491 if (sbus > -1 && sbus >= nschan) {
492 fprintf(stderr, "SCSI channel %d does not exist.\n", sbus);
493 exit(1);
494 } else if (sdev > -1 && sdev >= AMR_MAX_NSDEVS) {
495 fprintf(stderr, "SCSI device %d:%d does not exist.\n",
496 sbus, sdev);
497 exit(1);
498 }
499 }
500 if (fwint == FIRMWARE_40LD) {
501 if (enq_result == AMR_STATUS_SUCCESS) {
502 struct amr_enquiry3 *ae3;
503
504 ae3 = (struct amr_enquiry3 *)enq_buffer;
505 if ((ldrv < 0 && sbus < 0) || ldrv >= 0) {
506 if (ldrv >= ae3->ae_numldrives) {
507 fprintf(stderr, "Logical volume %d "
508 "does not exist.\n", ldrv);
509 exit(1);
510 }
511 if (ldrv < 0) {
512 for (drv = 0;
513 drv < ae3->ae_numldrives;
514 drv++)
515 describe_one_volume(drv,
516 verbosity,
517 ae3->ae_drivesize[drv],
518 ae3->ae_drivestate[drv],
519 ae3->ae_driveprop[drv]);
520 } else {
521 describe_one_volume(ldrv,
522 verbosity,
523 ae3->ae_drivesize[ldrv],
524 ae3->ae_drivestate[ldrv],
525 ae3->ae_driveprop[ldrv]);
526 }
527 }
528 if ((ldrv < 0 && sbus < 0) || sbus >= 0) {
529 if (pdrv >= AMR_40LD_MAXPHYSDRIVES ||
530 (nschan != 0 && pdrv >= (nschan * AMR_MAX_NSDEVS))) {
531 fprintf(stderr, "Physical drive %d "
532 "is out of range.\n", pdrv);
533 exit(1);
534 }
535 if (sbus < 0) {
536 for (drv = 0;
537 drv < AMR_40LD_MAXPHYSDRIVES;
538 drv++) {
539 if (nschan != 0 &&
540 drv >= (nschan * AMR_MAX_NSDEVS))
541 break;
542 describe_one_drive(drv,
543 verbosity,
544 ae3->ae_pdrivestate[drv]);
545 }
546 } else if (sdev < 0) {
547 for (drv = sbus * AMR_MAX_NSDEVS;
548 drv < ((sbus + 1) * AMR_MAX_NSDEVS);
549 drv++) {
550 if (nschan != 0 &&
551 drv >= (nschan * AMR_MAX_NSDEVS))
552 break;
553 describe_one_drive(drv,
554 verbosity,
555 ae3->ae_pdrivestate[drv]);
556 }
557 } else {
558 if (nschan != 0 &&
559 pdrv < (nschan * AMR_MAX_NSDEVS))
560 describe_one_drive(pdrv, 1,
561 ae3->ae_pdrivestate[pdrv]);
562 }
563 }
564 }
565 } else if (fwint == FIRMWARE_8LD) {
566 /* Nothing to do here. */
567 return;
568 } else {
569 fprintf(stderr, "Firmware interface not supported.\n");
570 exit(1);
571 }
572 }
573
574 /******************************************************************************
575 * Main function
576 */
577
578 int
579 main(int argc, char *argv[])
580 {
581 int i;
582 int fd = -1;
583 int globalparam = 0, verbosity = 0;
584 int bflags = 0, fflags = 0, sflags = 0;
585 int lvolno = -1, physno = -1;
586 int sbusno = -1, targetno = -1;
587 char filename[MAXPATHLEN];
588 char sdev[MAXPATHLEN];
589 char *pdev;
590
591 extern char *optarg;
592 extern int optind;
593
594 /*
595 * Parse arguments
596 */
597 if (argc < 2)
598 usage(argv[0]);
599 if (strcmp(argv[1], "stat") != 0) /* only stat implemented for now */
600 usage(argv[0]);
601
602 optind = 2;
603 while ((i = getopt(argc, argv, "a:bc:f:gl:p:s:t:v")) != -1)
604 switch (i) {
605 case 'a':
606 nattempts = atoi(optarg);
607 break;
608 case 'b':
609 bflags++;
610 break;
611 case 'f':
612 snprintf(filename, MAXPATHLEN, "%s", optarg);
613 filename[MAXPATHLEN - 1] = '\0';
614 fflags++;
615 break;
616 case 'g':
617 globalparam = 1;
618 break;
619 case 'l':
620 lvolno = atoi(optarg);
621 break;
622 case 'p':
623 physno = atoi(optarg);
624 break;
625 case 's':
626 snprintf(sdev, MAXPATHLEN, "%s", optarg);
627 sdev[MAXPATHLEN - 1] = '\0';
628 sflags++;
629 break;
630 case 't':
631 sleeptime = atoi(optarg);
632 break;
633 case 'v':
634 verbosity++;
635 break;
636 case '?':
637 default:
638 usage(argv[0]);
639 }
640 argc -= optind;
641 argv += optind;
642
643 if (argc != 0)
644 usage(argv[0]);
645
646 if (!fflags) {
647 snprintf(filename, MAXPATHLEN, "/dev/amr0");
648 }
649
650 fd = open(filename, O_RDONLY);
651 if (fd == -1) {
652 err(EXIT_FAILURE, "open");
653 }
654 if (ioctl(fd, AMR_IO_VERSION, &i) == -1) {
655 err(EXIT_FAILURE, "ioctl version");
656 }
657
658 if (sflags) {
659 if(physno > -1)
660 usage(argv[0]);
661 else {
662 sbusno = atoi(sdev);
663 if ((pdev = index(sdev, ':')))
664 targetno = atoi(++pdev);
665 }
666 } else if (physno > -1) {
667 sbusno = physno / AMR_MAX_NSDEVS;
668 targetno = physno % AMR_MAX_NSDEVS;
669 }
670
671 if (globalparam && verbosity >= 1)
672 printf("Version\t\t\t%d\n", i);
673 #if 0
674 if (i != 1) {
675 fprintf(stderr, "Driver version (%d) not supported\n", i);
676 exit(1);
677 }
678 #endif
679
680 i = describe_card(fd, verbosity, globalparam);
681 describe_battery(fd, verbosity, i, bflags, globalparam);
682 if (!bflags || lvolno > -1 || physno > -1 || sbusno > -1 || targetno > -1)
683 describe_drive(verbosity, i, lvolno, sbusno, targetno);
684
685 return 0;
686 }
687