2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (c) 1992-1997,2000-2003 Silicon Graphics, Inc. All rights reserved.
9 #include <linux/types.h>
10 #include <linux/slab.h>
11 #include <asm/sn/sgi.h>
12 #include <asm/sn/io.h>
13 #include <asm/sn/iograph.h>
14 #include <asm/sn/hcl.h>
15 #include <asm/sn/hcl_util.h>
16 #include <asm/sn/labelcl.h>
17 #include <asm/sn/router.h>
18 #include <asm/sn/module.h>
19 #include <asm/sn/ksys/l1.h>
20 #include <asm/sn/nodepda.h>
21 #include <asm/sn/clksupport.h>
22 #include <asm/sn/sn_cpuid.h>
23 #include <asm/sn/sn_sal.h>
24 #include <linux/ctype.h>
26 /* elsc_display_line writes up to 12 characters to either the top or bottom
27 * line of the L1 display. line points to a buffer containing the message
28 * to be displayed. The zero-based line number is specified by lnum (so
29 * lnum == 0 specifies the top line and lnum == 1 specifies the bottom).
30 * Lines longer than 12 characters, or line numbers not less than
31 * L1_DISPLAY_LINES, cause elsc_display_line to return an error.
33 int elsc_display_line(nasid_t nasid, char *line, int lnum)
43 /* iobrick_rack_bay_type_get fills in the three int * arguments with the
44 * rack number, bay number and brick type of the L1 being addressed. Note
45 * that if the L1 operation fails and this function returns an error value,
46 * garbage may be written to brick_type.
50 int iobrick_rack_bay_type_get( nasid_t nasid, uint *rack,
51 uint *bay, uint *brick_type )
55 if ( ia64_sn_sysctl_iobrick_module_get(nasid, &result) )
56 return( ELSC_ERROR_CMD_SEND );
58 *rack = (result & MODULE_RACK_MASK) >> MODULE_RACK_SHFT;
59 *bay = (result & MODULE_BPOS_MASK) >> MODULE_BPOS_SHFT;
60 *brick_type = (result & MODULE_BTYPE_MASK) >> MODULE_BTYPE_SHFT;
65 int iomoduleid_get(nasid_t nasid)
69 if ( ia64_sn_sysctl_iobrick_module_get(nasid, &result) )
70 return( ELSC_ERROR_CMD_SEND );
76 iobrick_type_get_nasid(nasid_t nasid)
80 extern char brick_types[];
82 if ((ret = iobrick_rack_bay_type_get(nasid, &rack, &bay, &type)) < 0) {
86 /* convert brick_type to lower case */
87 if ((type >= 'A') && (type <= 'Z'))
88 type = type - 'A' + 'a';
90 /* convert to a module.h brick type */
91 for( t = 0; t < MAX_BRICK_TYPES; t++ ) {
92 if( brick_types[t] == type ) {
97 return -1; /* unknown brick */
101 * given a L1 bricktype, return a bricktype string. This string is the
102 * string that will be used in the hwpath for I/O bricks
105 iobrick_L1bricktype_to_name(int type)
112 case L1_BRICKTYPE_PX:
113 return(EDGE_LBL_PXBRICK);
115 case L1_BRICKTYPE_OPUS:
116 return(EDGE_LBL_OPUSBRICK);
118 case L1_BRICKTYPE_IX:
119 return(EDGE_LBL_IXBRICK);
127 case L1_BRICKTYPE_CHI_CG:
128 return(EDGE_LBL_CGBRICK);