xref: /titanic_44/usr/src/psm/promif/ieee1275/sun4u/prom_sunfire.c (revision 2b24ab6b3865caeede9eeb9db6b83e1d89dcd1ea)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1994-1998, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <sys/promif.h>
30 #include <sys/promimpl.h>
31 
32 /* SunFire only */
33 int
34 prom_sunfire_cpu_off(void)
35 {
36 	cell_t ci[3];
37 
38 	/* Service name */
39 	ci[0] = p1275_ptr2cell("SUNW,Ultra-Enterprise,cpu-off");
40 	ci[1] = (cell_t)0;			/* #argument cells */
41 	ci[2] = (cell_t)0;			/* #result cells */
42 
43 	/*
44 	 * This is an unlocked entry into the prom.
45 	 *
46 	 * promif_preprom(), ... will be called by the controlling
47 	 * cpu.  The controlling cpu handles prom contention
48 	 * while the victim is in transition.
49 	 */
50 	(void) p1275_cif_handler(&ci);
51 
52 	return (0);
53 }
54 
55 /*
56  * These interfaces allow the client to attach/detach board.
57  */
58 int
59 prom_sunfire_attach_board(u_int board)
60 {
61 	cell_t ci[5];
62 	int rv;
63 
64 	ci[0] = p1275_ptr2cell("SUNW,Ultra-Enterprise,add-brd"); /* name */
65 	ci[1] = (cell_t)1;				/* #argument cells */
66 	ci[2] = (cell_t)1;				/* #result cells */
67 	ci[3] = p1275_uint2cell(board);
68 
69 	promif_preprom();
70 	rv = p1275_cif_handler(&ci);
71 	promif_postprom();
72 
73 	if (rv != 0)
74 		return (rv);
75 	if (p1275_cell2int(ci[4]) != 0)			/* Res1: Catch result */
76 		return (-1);
77 
78 	return (0);
79 }
80 
81 int
82 prom_sunfire_detach_board(u_int board)
83 {
84 	cell_t ci[5];
85 	int rv;
86 
87 	ci[0] = p1275_ptr2cell("SUNW,Ultra-Enterprise,rm-brd");	/* name */
88 	ci[1] = (cell_t)1;				/* #argument cells */
89 	ci[2] = (cell_t)1;				/* #result cells */
90 	ci[3] = p1275_uint2cell(board);
91 
92 	promif_preprom();
93 	rv = p1275_cif_handler(&ci);
94 	promif_postprom();
95 
96 	if (rv != 0)
97 		return (rv);
98 	if (p1275_cell2int(ci[4]) != 0)			/* Res1: Catch result */
99 		return (-1);
100 
101 	return (0);
102 }
103