17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate /*
23*fa9e4066Sahrens * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24*fa9e4066Sahrens * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gate #include <sys/promif.h>
307c478bd9Sstevel@tonic-gate #include <sys/promimpl.h>
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate /* All Serengeti only promif routines */
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gate char *
prom_serengeti_set_console_input(char * new_value)357c478bd9Sstevel@tonic-gate prom_serengeti_set_console_input(char *new_value)
367c478bd9Sstevel@tonic-gate {
377c478bd9Sstevel@tonic-gate cell_t ci[5];
387c478bd9Sstevel@tonic-gate int rv;
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate ci[0] = p1275_ptr2cell("SUNW,set-console-input");
417c478bd9Sstevel@tonic-gate ci[1] = (cell_t)1; /* #argument cells */
427c478bd9Sstevel@tonic-gate ci[2] = (cell_t)1; /* #return cells */
437c478bd9Sstevel@tonic-gate ci[3] = p1275_ptr2cell(new_value);
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate promif_preprom();
467c478bd9Sstevel@tonic-gate rv = p1275_cif_handler(&ci);
477c478bd9Sstevel@tonic-gate promif_postprom();
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gate if (rv != 0)
507c478bd9Sstevel@tonic-gate return (NULL);
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate return (p1275_cell2ptr(ci[4]));
537c478bd9Sstevel@tonic-gate }
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate * These interfaces allow the client to attach/detach board.
577c478bd9Sstevel@tonic-gate */
587c478bd9Sstevel@tonic-gate int
prom_serengeti_attach_board(uint_t node,uint_t board)597c478bd9Sstevel@tonic-gate prom_serengeti_attach_board(uint_t node, uint_t board)
607c478bd9Sstevel@tonic-gate {
617c478bd9Sstevel@tonic-gate cell_t ci[6];
627c478bd9Sstevel@tonic-gate int rv;
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate ci[0] = p1275_ptr2cell("SUNW,Serengeti,add-board"); /* name */
657c478bd9Sstevel@tonic-gate ci[1] = (cell_t)2; /* #argument cells */
667c478bd9Sstevel@tonic-gate ci[2] = (cell_t)1; /* #result cells */
677c478bd9Sstevel@tonic-gate ci[3] = p1275_uint2cell(board);
687c478bd9Sstevel@tonic-gate ci[4] = p1275_uint2cell(node);
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate promif_preprom();
717c478bd9Sstevel@tonic-gate rv = p1275_cif_handler(&ci);
727c478bd9Sstevel@tonic-gate promif_postprom();
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate if (rv != 0)
757c478bd9Sstevel@tonic-gate return (rv);
767c478bd9Sstevel@tonic-gate if (p1275_cell2int(ci[5]) != 0) /* Res1: Catch result */
777c478bd9Sstevel@tonic-gate return (-1);
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gate return (0);
807c478bd9Sstevel@tonic-gate }
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gate int
prom_serengeti_detach_board(uint_t node,uint_t board)837c478bd9Sstevel@tonic-gate prom_serengeti_detach_board(uint_t node, uint_t board)
847c478bd9Sstevel@tonic-gate {
857c478bd9Sstevel@tonic-gate cell_t ci[6];
867c478bd9Sstevel@tonic-gate int rv;
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate ci[0] = p1275_ptr2cell("SUNW,Serengeti,remove-board"); /* name */
897c478bd9Sstevel@tonic-gate ci[1] = (cell_t)2; /* #argument cells */
907c478bd9Sstevel@tonic-gate ci[2] = (cell_t)1; /* #result cells */
917c478bd9Sstevel@tonic-gate ci[3] = p1275_uint2cell(board);
927c478bd9Sstevel@tonic-gate ci[4] = p1275_uint2cell(node);
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate promif_preprom();
957c478bd9Sstevel@tonic-gate rv = p1275_cif_handler(&ci);
967c478bd9Sstevel@tonic-gate promif_postprom();
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate if (rv != 0)
997c478bd9Sstevel@tonic-gate return (rv);
1007c478bd9Sstevel@tonic-gate if (p1275_cell2int(ci[5]) != 0) /* Res1: Catch result */
1017c478bd9Sstevel@tonic-gate return (-1);
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate return (0);
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate int
prom_serengeti_tunnel_switch(uint_t node,uint_t board)1077c478bd9Sstevel@tonic-gate prom_serengeti_tunnel_switch(uint_t node, uint_t board)
1087c478bd9Sstevel@tonic-gate {
1097c478bd9Sstevel@tonic-gate cell_t ci[6];
1107c478bd9Sstevel@tonic-gate int rv;
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gate ci[0] = p1275_ptr2cell("SUNW,Serengeti,switch-tunnel"); /* name */
1137c478bd9Sstevel@tonic-gate ci[1] = (cell_t)2; /* #argument cells */
1147c478bd9Sstevel@tonic-gate ci[2] = (cell_t)1; /* #result cells */
1157c478bd9Sstevel@tonic-gate ci[3] = p1275_uint2cell(board);
1167c478bd9Sstevel@tonic-gate ci[4] = p1275_uint2cell(node);
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gate promif_preprom();
1197c478bd9Sstevel@tonic-gate rv = p1275_cif_handler(&ci);
1207c478bd9Sstevel@tonic-gate promif_postprom();
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gate if (rv != 0)
1237c478bd9Sstevel@tonic-gate return (rv);
1247c478bd9Sstevel@tonic-gate if (p1275_cell2int(ci[5]) != 0) /* Res1: Catch result */
1257c478bd9Sstevel@tonic-gate return (-1);
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate return (0);
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gate int
prom_serengeti_cpu_off(pnode_t node)131*fa9e4066Sahrens prom_serengeti_cpu_off(pnode_t node)
1327c478bd9Sstevel@tonic-gate {
1337c478bd9Sstevel@tonic-gate cell_t ci[5];
1347c478bd9Sstevel@tonic-gate int rv;
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate ci[0] = p1275_ptr2cell("SUNW,Serengeti,park-cpu");
1377c478bd9Sstevel@tonic-gate ci[1] = (cell_t)1; /* #argument cells */
1387c478bd9Sstevel@tonic-gate ci[2] = (cell_t)1; /* #return cells */
1397c478bd9Sstevel@tonic-gate ci[3] = p1275_dnode2cell(node);
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gate promif_preprom();
1427c478bd9Sstevel@tonic-gate rv = p1275_cif_handler(&ci);
1437c478bd9Sstevel@tonic-gate promif_postprom();
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate if (rv != 0)
1467c478bd9Sstevel@tonic-gate return (-1);
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gate return (p1275_cell2int(ci[4]));
1497c478bd9Sstevel@tonic-gate }
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gate /*
1527c478bd9Sstevel@tonic-gate * This service converts the given physical address into a text string,
1537c478bd9Sstevel@tonic-gate * representing the name of the field-replacable part for the given
1547c478bd9Sstevel@tonic-gate * physical address. In other words, it tells the kernel which ecache
1557c478bd9Sstevel@tonic-gate * module got the (un)correctable ECC error.
1567c478bd9Sstevel@tonic-gate */
1577c478bd9Sstevel@tonic-gate int
prom_serengeti_get_ecacheunum(int cpuid,unsigned long long physaddr,char * buf,uint_t buflen,int * ustrlen)1587c478bd9Sstevel@tonic-gate prom_serengeti_get_ecacheunum(int cpuid, unsigned long long physaddr, char *buf,
1597c478bd9Sstevel@tonic-gate uint_t buflen, int *ustrlen)
1607c478bd9Sstevel@tonic-gate {
1617c478bd9Sstevel@tonic-gate cell_t ci[12];
1627c478bd9Sstevel@tonic-gate int rv;
1637c478bd9Sstevel@tonic-gate ihandle_t imemory = prom_memory_ihandle();
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate *ustrlen = -1;
1667c478bd9Sstevel@tonic-gate if ((imemory == (ihandle_t)-1))
1677c478bd9Sstevel@tonic-gate return (-1);
1687c478bd9Sstevel@tonic-gate
1697c478bd9Sstevel@tonic-gate if (prom_test_method("SUNW,Serengeti,get-ecache-unum",
1707c478bd9Sstevel@tonic-gate prom_getphandle(imemory)) != 0)
1717c478bd9Sstevel@tonic-gate return (-1);
1727c478bd9Sstevel@tonic-gate
1737c478bd9Sstevel@tonic-gate ci[0] = p1275_ptr2cell("call-method"); /* Service name */
1747c478bd9Sstevel@tonic-gate ci[1] = (cell_t)7; /* #argument cells */
1757c478bd9Sstevel@tonic-gate ci[2] = (cell_t)2; /* #result cells */
1767c478bd9Sstevel@tonic-gate ci[3] = p1275_ptr2cell("SUNW,Serengeti,get-ecache-unum");
1777c478bd9Sstevel@tonic-gate /* Arg1: Method name */
1787c478bd9Sstevel@tonic-gate ci[4] = p1275_ihandle2cell(imemory); /* Arg2: mem. ihandle */
1797c478bd9Sstevel@tonic-gate ci[5] = p1275_uint2cell(buflen); /* Arg3: buflen */
1807c478bd9Sstevel@tonic-gate ci[6] = p1275_ptr2cell(buf); /* Arg4: buf */
1817c478bd9Sstevel@tonic-gate ci[7] = p1275_ull2cell_high(physaddr); /* Arg5: physhi */
1827c478bd9Sstevel@tonic-gate ci[8] = p1275_ull2cell_low(physaddr); /* Arg6: physlo */
1837c478bd9Sstevel@tonic-gate ci[9] = p1275_int2cell(cpuid); /* Arg7: cpuid */
1847c478bd9Sstevel@tonic-gate ci[10] = (cell_t)-1; /* ret1: catch result */
1857c478bd9Sstevel@tonic-gate ci[11] = (cell_t)-1; /* ret2: length */
1867c478bd9Sstevel@tonic-gate
1877c478bd9Sstevel@tonic-gate promif_preprom();
1887c478bd9Sstevel@tonic-gate rv = p1275_cif_handler(&ci);
1897c478bd9Sstevel@tonic-gate promif_postprom();
1907c478bd9Sstevel@tonic-gate
1917c478bd9Sstevel@tonic-gate if (rv != 0)
1927c478bd9Sstevel@tonic-gate return (rv);
1937c478bd9Sstevel@tonic-gate if (p1275_cell2int(ci[10]) != 0) /* Res1: catch result */
1947c478bd9Sstevel@tonic-gate return (-1); /* "SUNW,Serengeti,get-ecache-unum" failed */
1957c478bd9Sstevel@tonic-gate *ustrlen = p1275_cell2uint(ci[11]); /* Res2: unum str length */
1967c478bd9Sstevel@tonic-gate return (0);
1977c478bd9Sstevel@tonic-gate }
1987c478bd9Sstevel@tonic-gate
1997c478bd9Sstevel@tonic-gate int
prom_serengeti_wakeupcpu(pnode_t node)200*fa9e4066Sahrens prom_serengeti_wakeupcpu(pnode_t node)
2017c478bd9Sstevel@tonic-gate {
2027c478bd9Sstevel@tonic-gate cell_t ci[5];
2037c478bd9Sstevel@tonic-gate int rv;
2047c478bd9Sstevel@tonic-gate
2057c478bd9Sstevel@tonic-gate ci[0] = p1275_ptr2cell("SUNW,Serengeti,wakeup-cpu"); /* Service name */
2067c478bd9Sstevel@tonic-gate ci[1] = (cell_t)1; /* #argument cells */
2077c478bd9Sstevel@tonic-gate ci[2] = (cell_t)1; /* #result cells */
2087c478bd9Sstevel@tonic-gate ci[3] = p1275_dnode2cell(node); /* Arg1: nodeid to wakeup */
2097c478bd9Sstevel@tonic-gate
2107c478bd9Sstevel@tonic-gate promif_preprom();
2117c478bd9Sstevel@tonic-gate rv = p1275_cif_handler(&ci);
2127c478bd9Sstevel@tonic-gate promif_postprom();
2137c478bd9Sstevel@tonic-gate
2147c478bd9Sstevel@tonic-gate if (rv != 0)
2157c478bd9Sstevel@tonic-gate return (rv);
2167c478bd9Sstevel@tonic-gate else
2177c478bd9Sstevel@tonic-gate return (p1275_cell2int(ci[4])); /* Res1: Catch result */
2187c478bd9Sstevel@tonic-gate }
219