2 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
3 * Copyright (C) 1999, 2000 Silcon Graphics, Inc.
4 * Copyright (C) 2004 Christoph Hellwig.
5 * Released under GPL v2.
7 * Generic XTALK initialization code
10 #include <linux/kernel.h>
11 #include <linux/smp.h>
12 #include <asm/sn/types.h>
13 #include <asm/sn/klconfig.h>
14 #include <asm/sn/hub.h>
15 #include <asm/pci/bridge.h>
16 #include <asm/xtalk/xtalk.h>
19 #define XBOW_WIDGET_PART_NUM 0x0
20 #define XXBOW_WIDGET_PART_NUM 0xd000 /* Xbow in Xbridge */
21 #define BASE_XBOW_PORT 8 /* Lowest external port */
23 extern int bridge_probe(nasid_t nasid
, int widget
, int masterwid
);
25 static int probe_one_port(nasid_t nasid
, int widget
, int masterwid
)
27 widgetreg_t widget_id
;
28 xwidget_part_num_t partnum
;
30 widget_id
= *(volatile widgetreg_t
*)
31 (RAW_NODE_SWIN_BASE(nasid
, widget
) + WIDGET_ID
);
32 partnum
= XWIDGET_PART_NUM(widget_id
);
34 printk(KERN_INFO
"Cpu %d, Nasid 0x%x, widget 0x%x (partnum 0x%x) is ",
35 smp_processor_id(), nasid
, widget
, partnum
);
38 case BRIDGE_WIDGET_PART_NUM
:
39 case XBRIDGE_WIDGET_PART_NUM
:
40 bridge_probe(nasid
, widget
, masterwid
);
49 static int xbow_probe(nasid_t nasid
)
53 unsigned masterwid
, i
;
58 * found xbow, so may have multiple bridges
61 brd
= find_lboard((lboard_t
*)KL_CONFIG_INFO(nasid
), KLTYPE_MIDPLANE8
);
65 xbow_p
= (klxbow_t
*)find_component(brd
, NULL
, KLSTRUCT_XBOW
);
70 * Okay, here's a xbow. Lets arbitrate and find
71 * out if we should initialize it. Set enabled
72 * hub connected at highest or lowest widget as
76 i
= HUB_WIDGET_ID_MAX
+ 1;
79 } while ((!XBOW_PORT_TYPE_HUB(xbow_p
, i
)) ||
80 (!XBOW_PORT_IS_ENABLED(xbow_p
, i
)));
82 i
= HUB_WIDGET_ID_MIN
- 1;
85 } while ((!XBOW_PORT_TYPE_HUB(xbow_p
, i
)) ||
86 (!XBOW_PORT_IS_ENABLED(xbow_p
, i
)));
90 if (nasid
!= XBOW_PORT_NASID(xbow_p
, i
))
93 for (i
= HUB_WIDGET_ID_MIN
; i
<= HUB_WIDGET_ID_MAX
; i
++) {
94 if (XBOW_PORT_IS_ENABLED(xbow_p
, i
) &&
95 XBOW_PORT_TYPE_IO(xbow_p
, i
))
96 probe_one_port(nasid
, i
, masterwid
);
102 void xtalk_probe_node(cnodeid_t nid
)
106 xwidget_part_num_t partnum
;
107 widgetreg_t widget_id
;
109 nasid
= COMPACT_TO_NASID_NODEID(nid
);
110 hubreg
= REMOTE_HUB_L(nasid
, IIO_LLP_CSR
);
112 /* check whether the link is up */
113 if (!(hubreg
& IIO_LLP_CSR_IS_UP
))
116 widget_id
= *(volatile widgetreg_t
*)
117 (RAW_NODE_SWIN_BASE(nasid
, 0x0) + WIDGET_ID
);
118 partnum
= XWIDGET_PART_NUM(widget_id
);
120 printk(KERN_INFO
"Cpu %d, Nasid 0x%x: partnum 0x%x is ",
121 smp_processor_id(), nasid
, partnum
);
124 case BRIDGE_WIDGET_PART_NUM
:
125 bridge_probe(nasid
, 0x8, 0xa);
127 case XBOW_WIDGET_PART_NUM
:
128 case XXBOW_WIDGET_PART_NUM
:
132 printk(" unknown widget??\n");