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) 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 file contains the implementations of all Starcat-specific promif
34 * routines. Refer to FWARC case 2000/420 for the definitions of the
35 * platform-specific interfaces provided by Starcat OBP.
38 static char *switch_tunnel_cmd
= "SUNW,Starcat,switch-tunnel";
39 static char *iosram_read_cmd
= "SUNW,Starcat,iosram-read";
40 static char *iosram_write_cmd
= "SUNW,Starcat,iosram-write";
43 * Given the portid of the IOB to which the tunnel should be moved and the type
44 * of move that should be performed, ask OBP to switch the IOSRAM tunnel from
45 * its current host IOB to a new location. If the move type is 0, OBP will
46 * coordinate the change with SMS and will copy data from the current location
47 * to the new location. If the move type is 1, OBP will simply mark the new
48 * location valid and start using it, without doing any data copying and without
49 * communicating with SMS. Return 0 on success, non-zero on failure.
52 prom_starcat_switch_tunnel(uint_t portid
, uint_t msgtype
)
54 static uint8_t warned
= 0;
59 * Make sure we have the necessary support in OBP.
61 if (prom_test(switch_tunnel_cmd
) == 0) {
62 ci
[0] = p1275_ptr2cell(switch_tunnel_cmd
); /* name */
67 "Warning: No prom support for switch-tunnel!\n");
73 * Set up the arguments and call into OBP.
75 ci
[1] = (cell_t
)2; /* #argument cells */
76 ci
[2] = (cell_t
)1; /* #result cells */
77 ci
[3] = p1275_uint2cell(portid
);
78 ci
[4] = p1275_uint2cell(msgtype
);
81 rv
= p1275_cif_handler(&ci
);
85 * p1275_cif_handler will return 0 on success, non-zero on failure. If
86 * it fails, the return cell from OBP is meaningless, because the OBP
87 * client interface probably wasn't even invoked. OBP will return 0 on
88 * failure and non-zero on success for this interface.
92 } else if (p1275_cell2int(ci
[5]) == 0) {
100 * Request that OBP read 'len' bytes, starting at 'offset' in the IOSRAM chunk
101 * associated with 'key', into the memory indicated by 'buf'. Although there is
102 * a driver that provides this functionality, there are certain cases where the
103 * OS requires access to IOSRAM before the driver is loaded. Return 0 on
104 * success, non-zero on failure.
107 prom_starcat_iosram_read(uint32_t key
, uint32_t offset
, uint32_t len
,
110 static uint8_t warned
= 0;
115 * Make sure we have the necessary support in OBP.
117 if (prom_test(iosram_read_cmd
) == 0) {
118 ci
[0] = p1275_ptr2cell(iosram_read_cmd
); /* name */
123 "Warning: No prom support for iosram-read!\n");
129 * Set up the arguments and call into OBP. Note that the argument order
130 * needs to be reversed to accomodate OBP. The order must remain as it
131 * is in the function prototype to maintain intercompatibility with the
132 * IOSRAM driver's equivalent routine.
134 ci
[1] = (cell_t
)4; /* #argument cells */
135 ci
[2] = (cell_t
)1; /* #result cells */
136 ci
[3] = p1275_ptr2cell(buf
);
137 ci
[4] = p1275_uint2cell(len
);
138 ci
[5] = p1275_uint2cell(offset
);
139 ci
[6] = p1275_uint2cell(key
);
142 rv
= p1275_cif_handler(&ci
);
146 * p1275_cif_handler will return 0 on success, non-zero on failure. If
147 * it fails, the return cell from OBP is meaningless, because the OBP
148 * client interface probably wasn't even invoked. OBP will return 0 on
149 * success and non-zero on failure for this interface.
153 } else if (p1275_cell2int(ci
[7]) == 0) {
161 * Request that OBP write 'len' bytes from the memory indicated by 'buf' into
162 * the IOSRAM chunk associated with 'key', starting at 'offset'. Although there
163 * is a driver that provides this functionality, there are certain cases where
164 * the OS requires access to IOSRAM before the driver is loaded. Return 0 on
165 * success, non-zero on failure.
168 prom_starcat_iosram_write(uint32_t key
, uint32_t offset
, uint32_t len
,
171 static uint8_t warned
= 0;
176 * Make sure we have the necessary support in OBP.
178 if (prom_test(iosram_write_cmd
) == 0) {
179 ci
[0] = p1275_ptr2cell(iosram_write_cmd
); /* name */
184 "Warning: No prom support for iosram-write!\n");
190 * Set up the arguments and call into OBP. Note that the argument order
191 * needs to be reversed to accomodate OBP. The order must remain as it
192 * is in the function prototype to maintain intercompatibility with the
193 * IOSRAM driver's equivalent routine.
195 ci
[1] = (cell_t
)4; /* #argument cells */
196 ci
[2] = (cell_t
)1; /* #result cells */
197 ci
[3] = p1275_ptr2cell(buf
);
198 ci
[4] = p1275_uint2cell(len
);
199 ci
[5] = p1275_uint2cell(offset
);
200 ci
[6] = p1275_uint2cell(key
);
203 rv
= p1275_cif_handler(&ci
);
207 * p1275_cif_handler will return 0 on success, non-zero on failure. If
208 * it fails, the return cell from OBP is meaningless, because the OBP
209 * client interface probably wasn't even invoked. OBP will return 0 on
210 * success and non-zero on failure for this interface.
214 } else if (p1275_cell2int(ci
[7]) == 0) {