4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1994-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/promif.h>
30 #include <sys/promimpl.h>
33 * This service converts the given physical address into a text string,
34 * representing the name of the field-replacable part for the given
35 * physical address. In other words, it tells the kernel which chip got
36 * the (un)correctable ECC error, which info is hopefully relayed to the user!
39 prom_get_unum(int syn_code
, unsigned long long physaddr
, char *buf
,
40 uint_t buflen
, int *ustrlen
)
44 ihandle_t imemory
= prom_memory_ihandle();
47 if ((imemory
== (ihandle_t
)-1))
50 ci
[0] = p1275_ptr2cell("call-method"); /* Service name */
51 ci
[1] = (cell_t
)7; /* #argument cells */
52 ci
[2] = (cell_t
)2; /* #result cells */
53 ci
[3] = p1275_ptr2cell("SUNW,get-unumber"); /* Arg1: Method name */
54 ci
[4] = p1275_ihandle2cell(imemory
); /* Arg2: mem. ihandle */
55 ci
[5] = p1275_uint2cell(buflen
); /* Arg3: buflen */
56 ci
[6] = p1275_ptr2cell(buf
); /* Arg4: buf */
57 ci
[7] = p1275_ull2cell_high(physaddr
); /* Arg5: physhi */
58 ci
[8] = p1275_ull2cell_low(physaddr
); /* Arg6: physlo */
59 ci
[9] = p1275_int2cell(syn_code
); /* Arg7: bit # */
60 ci
[10] = (cell_t
)-1; /* ret1: catch result */
61 ci
[11] = (cell_t
)-1; /* ret2: length */
64 rv
= p1275_cif_handler(&ci
);
69 if (p1275_cell2int(ci
[10]) != 0) /* Res1: catch result */
70 return (-1); /* "SUNW,get-unumber" failed */
71 *ustrlen
= p1275_cell2uint(ci
[11]); /* Res2: unum str length */