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/init.h>
11 #include <linux/kernel.h>
12 #include <linux/smp.h>
13 #include <asm/sn/types.h>
14 #include <asm/sn/klconfig.h>
15 #include <asm/sn/hub.h>
16 #include <asm/pci/bridge.h>
17 #include <asm/xtalk/xtalk.h>
20 #define XBOW_WIDGET_PART_NUM 0x0
21 #define XXBOW_WIDGET_PART_NUM 0xd000 /* Xbow in Xbridge */
22 #define BASE_XBOW_PORT 8 /* Lowest external port */
24 extern int bridge_probe(nasid_t nasid
, int widget
, int masterwid
);
26 static int probe_one_port(nasid_t nasid
, int widget
, int masterwid
)
28 widgetreg_t widget_id
;
29 xwidget_part_num_t partnum
;
31 widget_id
= *(volatile widgetreg_t
*)
32 (RAW_NODE_SWIN_BASE(nasid
, widget
) + WIDGET_ID
);
33 partnum
= XWIDGET_PART_NUM(widget_id
);
35 printk(KERN_INFO
"Cpu %d, Nasid 0x%x, widget 0x%x (partnum 0x%x) is ",
36 smp_processor_id(), nasid
, widget
, partnum
);
39 case BRIDGE_WIDGET_PART_NUM
:
40 case XBRIDGE_WIDGET_PART_NUM
:
41 bridge_probe(nasid
, widget
, masterwid
);
50 static int xbow_probe(nasid_t nasid
)
54 unsigned masterwid
, i
;
59 * found xbow, so may have multiple bridges
62 brd
= find_lboard((lboard_t
*)KL_CONFIG_INFO(nasid
), KLTYPE_MIDPLANE8
);
66 xbow_p
= (klxbow_t
*)find_component(brd
, NULL
, KLSTRUCT_XBOW
);
71 * Okay, here's a xbow. Lets arbitrate and find
72 * out if we should initialize it. Set enabled
73 * hub connected at highest or lowest widget as
77 i
= HUB_WIDGET_ID_MAX
+ 1;
80 } while ((!XBOW_PORT_TYPE_HUB(xbow_p
, i
)) ||
81 (!XBOW_PORT_IS_ENABLED(xbow_p
, i
)));
83 i
= HUB_WIDGET_ID_MIN
- 1;
86 } while ((!XBOW_PORT_TYPE_HUB(xbow_p
, i
)) ||
87 (!XBOW_PORT_IS_ENABLED(xbow_p
, i
)));
91 if (nasid
!= XBOW_PORT_NASID(xbow_p
, i
))
94 for (i
= HUB_WIDGET_ID_MIN
; i
<= HUB_WIDGET_ID_MAX
; i
++) {
95 if (XBOW_PORT_IS_ENABLED(xbow_p
, i
) &&
96 XBOW_PORT_TYPE_IO(xbow_p
, i
))
97 probe_one_port(nasid
, i
, masterwid
);
103 void xtalk_probe_node(cnodeid_t nid
)
107 xwidget_part_num_t partnum
;
108 widgetreg_t widget_id
;
110 nasid
= COMPACT_TO_NASID_NODEID(nid
);
111 hubreg
= REMOTE_HUB_L(nasid
, IIO_LLP_CSR
);
113 /* check whether the link is up */
114 if (!(hubreg
& IIO_LLP_CSR_IS_UP
))
117 widget_id
= *(volatile widgetreg_t
*)
118 (RAW_NODE_SWIN_BASE(nasid
, 0x0) + WIDGET_ID
);
119 partnum
= XWIDGET_PART_NUM(widget_id
);
121 printk(KERN_INFO
"Cpu %d, Nasid 0x%x: partnum 0x%x is ",
122 smp_processor_id(), nasid
, partnum
);
125 case BRIDGE_WIDGET_PART_NUM
:
126 bridge_probe(nasid
, 0x8, 0xa);
128 case XBOW_WIDGET_PART_NUM
:
129 case XXBOW_WIDGET_PART_NUM
:
133 printk(" unknown widget??\n");