ofw_autoconf.c revision 1.2.6.4 1 1.2.6.4 yamt /* $NetBSD: ofw_autoconf.c,v 1.2.6.4 2008/01/21 09:38:24 yamt Exp $ */
2 1.2.6.2 yamt /*
3 1.2.6.2 yamt * Copyright (C) 1995, 1996 Wolfgang Solfrank.
4 1.2.6.2 yamt * Copyright (C) 1995, 1996 TooLs GmbH.
5 1.2.6.2 yamt * All rights reserved.
6 1.2.6.2 yamt *
7 1.2.6.2 yamt * Redistribution and use in source and binary forms, with or without
8 1.2.6.2 yamt * modification, are permitted provided that the following conditions
9 1.2.6.2 yamt * are met:
10 1.2.6.2 yamt * 1. Redistributions of source code must retain the above copyright
11 1.2.6.2 yamt * notice, this list of conditions and the following disclaimer.
12 1.2.6.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
13 1.2.6.2 yamt * notice, this list of conditions and the following disclaimer in the
14 1.2.6.2 yamt * documentation and/or other materials provided with the distribution.
15 1.2.6.2 yamt * 3. All advertising materials mentioning features or use of this software
16 1.2.6.2 yamt * must display the following acknowledgement:
17 1.2.6.2 yamt * This product includes software developed by TooLs GmbH.
18 1.2.6.2 yamt * 4. The name of TooLs GmbH may not be used to endorse or promote products
19 1.2.6.2 yamt * derived from this software without specific prior written permission.
20 1.2.6.2 yamt *
21 1.2.6.2 yamt * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
22 1.2.6.2 yamt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.2.6.2 yamt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.2.6.2 yamt * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 1.2.6.2 yamt * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 1.2.6.2 yamt * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 1.2.6.2 yamt * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 1.2.6.2 yamt * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 1.2.6.2 yamt * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 1.2.6.2 yamt * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.2.6.2 yamt */
32 1.2.6.2 yamt
33 1.2.6.2 yamt #include <sys/cdefs.h>
34 1.2.6.4 yamt __KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.2.6.4 2008/01/21 09:38:24 yamt Exp $");
35 1.2.6.2 yamt
36 1.2.6.2 yamt #include <sys/param.h>
37 1.2.6.2 yamt #include <sys/conf.h>
38 1.2.6.2 yamt #include <sys/device.h>
39 1.2.6.2 yamt #include <sys/reboot.h>
40 1.2.6.2 yamt #include <sys/systm.h>
41 1.2.6.2 yamt
42 1.2.6.2 yamt #include <uvm/uvm_extern.h>
43 1.2.6.2 yamt
44 1.2.6.2 yamt #include <machine/autoconf.h>
45 1.2.6.2 yamt #include <machine/bus.h>
46 1.2.6.2 yamt #include <machine/stdarg.h>
47 1.2.6.2 yamt
48 1.2.6.2 yamt #include <dev/ofw/openfirm.h>
49 1.2.6.4 yamt #include <dev/pci/pcireg.h>
50 1.2.6.2 yamt #include <dev/pci/pcivar.h>
51 1.2.6.2 yamt #include <dev/scsipi/scsi_all.h>
52 1.2.6.2 yamt #include <dev/scsipi/scsipi_all.h>
53 1.2.6.2 yamt #include <dev/scsipi/scsiconf.h>
54 1.2.6.2 yamt #include <dev/ata/atavar.h>
55 1.2.6.2 yamt #include <dev/ic/wdcvar.h>
56 1.2.6.2 yamt
57 1.2.6.2 yamt extern char bootpath[256];
58 1.2.6.2 yamt char cbootpath[256];
59 1.2.6.2 yamt int console_node = 0, console_instance = 0;
60 1.2.6.2 yamt
61 1.2.6.2 yamt static void canonicalize_bootpath(void);
62 1.2.6.2 yamt
63 1.2.6.2 yamt /*
64 1.2.6.2 yamt * Determine device configuration for a machine.
65 1.2.6.2 yamt */
66 1.2.6.2 yamt void
67 1.2.6.2 yamt cpu_configure(void)
68 1.2.6.2 yamt {
69 1.2.6.2 yamt init_interrupt();
70 1.2.6.2 yamt canonicalize_bootpath();
71 1.2.6.2 yamt
72 1.2.6.2 yamt if (config_rootfound("mainbus", NULL) == NULL)
73 1.2.6.2 yamt panic("configure: mainbus not configured");
74 1.2.6.2 yamt
75 1.2.6.2 yamt genppc_cpu_configure();
76 1.2.6.2 yamt }
77 1.2.6.2 yamt
78 1.2.6.2 yamt static void
79 1.2.6.2 yamt canonicalize_bootpath(void)
80 1.2.6.2 yamt {
81 1.2.6.2 yamt int node;
82 1.2.6.2 yamt char *p, *lastp;
83 1.2.6.2 yamt char last[32];
84 1.2.6.2 yamt
85 1.2.6.2 yamt /*
86 1.2.6.2 yamt * If the bootpath doesn't start with a / then it isn't
87 1.2.6.2 yamt * an OFW path and probably is an alias, so look up the alias
88 1.2.6.2 yamt * and regenerate the full bootpath so device_register will work.
89 1.2.6.2 yamt */
90 1.2.6.2 yamt if (bootpath[0] != '/' && bootpath[0] != '\0') {
91 1.2.6.2 yamt int aliases = OF_finddevice("/aliases");
92 1.2.6.2 yamt char tmpbuf[100];
93 1.2.6.2 yamt char aliasbuf[256];
94 1.2.6.2 yamt if (aliases != 0) {
95 1.2.6.2 yamt char *cp1, *cp2, *cp;
96 1.2.6.2 yamt char saved_ch = '\0';
97 1.2.6.2 yamt int len;
98 1.2.6.2 yamt cp1 = strchr(bootpath, ':');
99 1.2.6.2 yamt cp2 = strchr(bootpath, ',');
100 1.2.6.2 yamt cp = cp1;
101 1.2.6.2 yamt if (cp1 == NULL || (cp2 != NULL && cp2 < cp1))
102 1.2.6.2 yamt cp = cp2;
103 1.2.6.2 yamt tmpbuf[0] = '\0';
104 1.2.6.2 yamt if (cp != NULL) {
105 1.2.6.2 yamt strcpy(tmpbuf, cp);
106 1.2.6.2 yamt saved_ch = *cp;
107 1.2.6.2 yamt *cp = '\0';
108 1.2.6.2 yamt }
109 1.2.6.2 yamt len = OF_getprop(aliases, bootpath, aliasbuf,
110 1.2.6.2 yamt sizeof(aliasbuf));
111 1.2.6.2 yamt if (len > 0) {
112 1.2.6.2 yamt if (aliasbuf[len-1] == '\0')
113 1.2.6.2 yamt len--;
114 1.2.6.2 yamt memcpy(bootpath, aliasbuf, len);
115 1.2.6.2 yamt strcpy(&bootpath[len], tmpbuf);
116 1.2.6.2 yamt } else {
117 1.2.6.2 yamt *cp = saved_ch;
118 1.2.6.2 yamt }
119 1.2.6.2 yamt }
120 1.2.6.2 yamt }
121 1.2.6.2 yamt
122 1.2.6.2 yamt /*
123 1.2.6.2 yamt * Strip kernel name. bootpath contains "OF-path"/"kernel".
124 1.2.6.2 yamt *
125 1.2.6.2 yamt * for example:
126 1.2.6.2 yamt * /bandit@F2000000/gc@10/53c94@10000/sd@0,0/netbsd (OF-1.x)
127 1.2.6.2 yamt * /pci/mac-io/ata-3@2000/disk@0:0/netbsd.new (OF-3.x)
128 1.2.6.2 yamt */
129 1.2.6.2 yamt strcpy(cbootpath, bootpath);
130 1.2.6.2 yamt while ((node = OF_finddevice(cbootpath)) == -1) {
131 1.2.6.2 yamt if ((p = strrchr(cbootpath, '/')) == NULL)
132 1.2.6.2 yamt break;
133 1.2.6.2 yamt *p = '\0';
134 1.2.6.2 yamt }
135 1.2.6.2 yamt
136 1.2.6.4 yamt printf("bootpath: %s\n", bootpath);
137 1.2.6.2 yamt if (node == -1) {
138 1.2.6.2 yamt /* Cannot canonicalize... use bootpath anyway. */
139 1.2.6.2 yamt strcpy(cbootpath, bootpath);
140 1.2.6.2 yamt
141 1.2.6.2 yamt return;
142 1.2.6.2 yamt }
143 1.2.6.2 yamt
144 1.2.6.2 yamt /*
145 1.2.6.2 yamt * cbootpath is a valid OF path. Use package-to-path to
146 1.2.6.2 yamt * canonicalize pathname.
147 1.2.6.2 yamt */
148 1.2.6.2 yamt
149 1.2.6.2 yamt /* Back up the last component for later use. */
150 1.2.6.2 yamt if ((p = strrchr(cbootpath, '/')) != NULL)
151 1.2.6.2 yamt strcpy(last, p + 1);
152 1.2.6.2 yamt else
153 1.2.6.2 yamt last[0] = '\0';
154 1.2.6.2 yamt
155 1.2.6.2 yamt memset(cbootpath, 0, sizeof(cbootpath));
156 1.2.6.2 yamt OF_package_to_path(node, cbootpath, sizeof(cbootpath) - 1);
157 1.2.6.2 yamt
158 1.2.6.2 yamt /*
159 1.2.6.2 yamt * OF_1.x (at least) always returns addr == 0 for
160 1.2.6.2 yamt * SCSI disks (i.e. "/bandit (at) .../.../sd@0,0").
161 1.2.6.2 yamt */
162 1.2.6.2 yamt lastp = strrchr(cbootpath, '/');
163 1.2.6.2 yamt if (lastp != NULL) {
164 1.2.6.2 yamt lastp++;
165 1.2.6.2 yamt if (strncmp(lastp, "sd@", 3) == 0
166 1.2.6.2 yamt && strncmp(last, "sd@", 3) == 0)
167 1.2.6.2 yamt strcpy(lastp, last);
168 1.2.6.2 yamt } else {
169 1.2.6.2 yamt lastp = cbootpath;
170 1.2.6.2 yamt }
171 1.2.6.2 yamt
172 1.2.6.2 yamt /*
173 1.2.6.2 yamt * At this point, cbootpath contains like:
174 1.2.6.2 yamt * "/pci@80000000/mac-io@10/ata-3@20000/disk"
175 1.2.6.2 yamt *
176 1.2.6.2 yamt * The last component may have no address... so append it.
177 1.2.6.2 yamt */
178 1.2.6.2 yamt if (strchr(lastp, '@') == NULL) {
179 1.2.6.2 yamt /* Append it. */
180 1.2.6.2 yamt if ((p = strrchr(last, '@')) != NULL)
181 1.2.6.2 yamt strcat(cbootpath, p);
182 1.2.6.2 yamt }
183 1.2.6.2 yamt
184 1.2.6.2 yamt if ((p = strrchr(lastp, ':')) != NULL) {
185 1.2.6.2 yamt *p++ = '\0';
186 1.2.6.2 yamt /* booted_partition = *p - '0'; XXX correct? */
187 1.2.6.2 yamt }
188 1.2.6.2 yamt }
189 1.2.6.2 yamt
190 1.2.6.2 yamt /*
191 1.2.6.2 yamt * device_register is called from config_attach as each device is
192 1.2.6.2 yamt * attached. We use it to find the NetBSD device corresponding to the
193 1.2.6.2 yamt * known OF boot device.
194 1.2.6.2 yamt */
195 1.2.6.2 yamt void
196 1.2.6.2 yamt device_register(dev, aux)
197 1.2.6.2 yamt struct device *dev;
198 1.2.6.2 yamt void *aux;
199 1.2.6.2 yamt {
200 1.2.6.2 yamt static struct device *parent;
201 1.2.6.2 yamt static char *bp = bootpath + 1, *cp = cbootpath;
202 1.2.6.4 yamt unsigned long addr, addr2;
203 1.2.6.2 yamt char *p;
204 1.2.6.2 yamt
205 1.2.6.2 yamt /* Skip over devices not represented in the OF tree. */
206 1.2.6.2 yamt if (device_is_a(dev, "mainbus")) {
207 1.2.6.2 yamt parent = dev;
208 1.2.6.2 yamt return;
209 1.2.6.2 yamt }
210 1.2.6.2 yamt if (device_is_a(dev, "atapibus") || device_is_a(dev, "pci") ||
211 1.2.6.2 yamt device_is_a(dev, "scsibus") || device_is_a(dev, "atabus"))
212 1.2.6.2 yamt return;
213 1.2.6.2 yamt
214 1.2.6.2 yamt if (device_is_a(device_parent(dev), "pci")) {
215 1.2.6.2 yamt struct pci_attach_args *pa = aux;
216 1.2.6.2 yamt prop_dictionary_t dict;
217 1.2.6.4 yamt prop_bool_t b;
218 1.2.6.3 yamt int node;
219 1.2.6.3 yamt char name[32];
220 1.2.6.2 yamt
221 1.2.6.2 yamt dict = device_properties(dev);
222 1.2.6.2 yamt node = pcidev_to_ofdev(pa->pa_pc, pa->pa_tag);
223 1.2.6.2 yamt
224 1.2.6.4 yamt /* enable configuration of irq 14/15 for VIA native IDE */
225 1.2.6.4 yamt if (device_is_a(dev, "viaide") &&
226 1.2.6.4 yamt strncmp(model_name, "Pegasos", 7) == 0) {
227 1.2.6.4 yamt b = prop_bool_create(true);
228 1.2.6.4 yamt KASSERT(b != NULL);
229 1.2.6.4 yamt (void)prop_dictionary_set(dict,
230 1.2.6.4 yamt "use-compat-native-irq", b);
231 1.2.6.4 yamt prop_object_release(b);
232 1.2.6.4 yamt }
233 1.2.6.4 yamt
234 1.2.6.3 yamt if (node != 0) {
235 1.2.6.4 yamt int pci_class = 0;
236 1.2.6.4 yamt
237 1.2.6.3 yamt prop_dictionary_set_uint32(dict, "device_node", node);
238 1.2.6.2 yamt
239 1.2.6.4 yamt /* see if this is going to be console */
240 1.2.6.3 yamt memset(name, 0, sizeof(name));
241 1.2.6.3 yamt OF_getprop(node, "device_type", name, sizeof(name));
242 1.2.6.4 yamt
243 1.2.6.4 yamt OF_getprop(node, "class-code", &pci_class,
244 1.2.6.4 yamt sizeof pci_class);
245 1.2.6.4 yamt pci_class = (pci_class >> 16) & 0xff;
246 1.2.6.4 yamt
247 1.2.6.4 yamt if (strcmp(name, "display") == 0 ||
248 1.2.6.4 yamt pci_class == PCI_CLASS_DISPLAY) {
249 1.2.6.3 yamt /* setup display properties for fb driver */
250 1.2.6.3 yamt prop_dictionary_set_bool(dict, "is_console", 0);
251 1.2.6.3 yamt copy_disp_props(dev, node, dict);
252 1.2.6.2 yamt }
253 1.2.6.2 yamt }
254 1.2.6.2 yamt }
255 1.2.6.2 yamt
256 1.2.6.3 yamt if (booted_device)
257 1.2.6.3 yamt return;
258 1.2.6.3 yamt
259 1.2.6.4 yamt /*
260 1.2.6.4 yamt * Skip over devices that are really just layers of NetBSD
261 1.2.6.4 yamt * autoconf(9) we should just skip as they do not have any
262 1.2.6.4 yamt * OFW devices.
263 1.2.6.4 yamt */
264 1.2.6.2 yamt if (device_is_a(device_parent(dev), "atapibus") ||
265 1.2.6.2 yamt device_is_a(device_parent(dev), "atabus") ||
266 1.2.6.2 yamt device_is_a(device_parent(dev), "pci") ||
267 1.2.6.2 yamt device_is_a(device_parent(dev), "scsibus")) {
268 1.2.6.2 yamt if (device_parent(device_parent(dev)) != parent)
269 1.2.6.2 yamt return;
270 1.2.6.2 yamt } else {
271 1.2.6.2 yamt if (device_parent(dev) != parent)
272 1.2.6.2 yamt return;
273 1.2.6.2 yamt }
274 1.2.6.2 yamt
275 1.2.6.4 yamt /*
276 1.2.6.4 yamt * Get the address part of the current path component. The
277 1.2.6.2 yamt * last component of the canonical bootpath may have no
278 1.2.6.2 yamt * address (eg, "disk"), in which case we need to get the
279 1.2.6.2 yamt * address from the original bootpath instead.
280 1.2.6.2 yamt */
281 1.2.6.2 yamt p = strchr(cp, '@');
282 1.2.6.2 yamt if (!p) {
283 1.2.6.2 yamt if (bp)
284 1.2.6.2 yamt p = strchr(bp, '@');
285 1.2.6.2 yamt if (!p)
286 1.2.6.2 yamt addr = 0;
287 1.2.6.4 yamt else
288 1.2.6.4 yamt addr = strtoul(p + 1, &p, 16);
289 1.2.6.2 yamt } else
290 1.2.6.2 yamt addr = strtoul(p + 1, &p, 16);
291 1.2.6.2 yamt
292 1.2.6.4 yamt /* if the current path has more address, grab that too */
293 1.2.6.4 yamt if (p && *p == ',')
294 1.2.6.4 yamt addr2 = strtoul(p + 1, &p, 16);
295 1.2.6.4 yamt else
296 1.2.6.4 yamt addr2 = 0;
297 1.2.6.4 yamt
298 1.2.6.2 yamt if (device_is_a(device_parent(dev), "mainbus")) {
299 1.2.6.2 yamt struct confargs *ca = aux;
300 1.2.6.2 yamt
301 1.2.6.2 yamt if (strcmp(ca->ca_name, "ofw") == 0) /* XXX */
302 1.2.6.2 yamt return;
303 1.2.6.2 yamt if (addr != ca->ca_reg[0])
304 1.2.6.2 yamt return;
305 1.2.6.2 yamt } else if (device_is_a(device_parent(dev), "pci")) {
306 1.2.6.2 yamt struct pci_attach_args *pa = aux;
307 1.2.6.2 yamt
308 1.2.6.4 yamt if (addr != pa->pa_device ||
309 1.2.6.4 yamt addr2 != pa->pa_function)
310 1.2.6.2 yamt return;
311 1.2.6.2 yamt } else if (device_is_a(device_parent(dev), "obio")) {
312 1.2.6.2 yamt struct confargs *ca = aux;
313 1.2.6.2 yamt
314 1.2.6.2 yamt if (addr != ca->ca_reg[0])
315 1.2.6.2 yamt return;
316 1.2.6.2 yamt } else if (device_is_a(device_parent(dev), "scsibus") ||
317 1.2.6.2 yamt device_is_a(device_parent(dev), "atapibus")) {
318 1.2.6.2 yamt struct scsipibus_attach_args *sa = aux;
319 1.2.6.2 yamt
320 1.2.6.2 yamt /* periph_target is target for scsi, drive # for atapi */
321 1.2.6.2 yamt if (addr != sa->sa_periph->periph_target)
322 1.2.6.2 yamt return;
323 1.2.6.4 yamt } else if (device_is_a(device_parent(device_parent(dev)), "pciide") ||
324 1.2.6.4 yamt device_is_a(device_parent(device_parent(dev)), "viaide") ||
325 1.2.6.4 yamt device_is_a(device_parent(device_parent(dev)), "slide")) {
326 1.2.6.2 yamt struct ata_device *adev = aux;
327 1.2.6.2 yamt
328 1.2.6.4 yamt if (addr != adev->adev_channel ||
329 1.2.6.4 yamt addr2 != adev->adev_drv_data->drive)
330 1.2.6.2 yamt return;
331 1.2.6.2 yamt } else if (device_is_a(device_parent(device_parent(dev)), "wdc")) {
332 1.2.6.2 yamt struct ata_device *adev = aux;
333 1.2.6.2 yamt
334 1.2.6.2 yamt if (addr != adev->adev_drv_data->drive)
335 1.2.6.2 yamt return;
336 1.2.6.2 yamt } else
337 1.2.6.2 yamt return;
338 1.2.6.2 yamt
339 1.2.6.2 yamt /* If we reach this point, then dev is a match for the current
340 1.2.6.2 yamt * path component.
341 1.2.6.2 yamt */
342 1.2.6.2 yamt
343 1.2.6.2 yamt if (p && *p) {
344 1.2.6.2 yamt parent = dev;
345 1.2.6.2 yamt cp = p;
346 1.2.6.2 yamt bp = strchr(bp, '/');
347 1.2.6.2 yamt if (bp)
348 1.2.6.2 yamt bp++;
349 1.2.6.2 yamt return;
350 1.2.6.2 yamt } else {
351 1.2.6.2 yamt booted_device = dev;
352 1.2.6.2 yamt booted_partition = 0; /* XXX -- should be extracted from bootpath */
353 1.2.6.2 yamt return;
354 1.2.6.2 yamt }
355 1.2.6.2 yamt }
356 1.2.6.2 yamt
357 1.2.6.2 yamt /*
358 1.2.6.2 yamt * Setup root device.
359 1.2.6.2 yamt * Configure swap area.
360 1.2.6.2 yamt */
361 1.2.6.2 yamt void
362 1.2.6.2 yamt cpu_rootconf()
363 1.2.6.2 yamt {
364 1.2.6.2 yamt printf("boot device: %s\n",
365 1.2.6.2 yamt booted_device ? booted_device->dv_xname : "<unknown>");
366 1.2.6.2 yamt
367 1.2.6.2 yamt setroot(booted_device, booted_partition);
368 1.2.6.2 yamt }
369 1.2.6.2 yamt
370 1.2.6.2 yamt /*
371 1.2.6.2 yamt * Find OF-device corresponding to the PCI device.
372 1.2.6.2 yamt */
373 1.2.6.2 yamt int
374 1.2.6.2 yamt pcidev_to_ofdev(pci_chipset_tag_t pc, pcitag_t tag)
375 1.2.6.2 yamt {
376 1.2.6.2 yamt int bus, dev, func;
377 1.2.6.2 yamt u_int reg[5];
378 1.2.6.2 yamt int p, q;
379 1.2.6.2 yamt int l, b, d, f;
380 1.2.6.2 yamt
381 1.2.6.2 yamt pci_decompose_tag(pc, tag, &bus, &dev, &func);
382 1.2.6.2 yamt
383 1.2.6.2 yamt for (q = OF_peer(0); q; q = p) {
384 1.2.6.2 yamt l = OF_getprop(q, "assigned-addresses", reg, sizeof(reg));
385 1.2.6.2 yamt if (l > 4) {
386 1.2.6.2 yamt b = (reg[0] >> 16) & 0xff;
387 1.2.6.2 yamt d = (reg[0] >> 11) & 0x1f;
388 1.2.6.2 yamt f = (reg[0] >> 8) & 0x07;
389 1.2.6.2 yamt
390 1.2.6.2 yamt if (b == bus && d == dev && f == func)
391 1.2.6.2 yamt return q;
392 1.2.6.2 yamt }
393 1.2.6.2 yamt if ((p = OF_child(q)))
394 1.2.6.2 yamt continue;
395 1.2.6.2 yamt while (q) {
396 1.2.6.2 yamt if ((p = OF_peer(q)))
397 1.2.6.2 yamt break;
398 1.2.6.2 yamt q = OF_parent(q);
399 1.2.6.2 yamt }
400 1.2.6.2 yamt }
401 1.2.6.2 yamt return 0;
402 1.2.6.2 yamt }
403