📄 ml_iograph.c
字号:
*/ DBG("io_init_node: Found XBOW widget_partnum= 0x%x\n", widget_partnum); npdap->basew_id = 0; } else { npdap->basew_id = (((*(volatile int32_t *)(NODE_SWIN_BASE(COMPACT_TO_NASID_NODEID(cnodeid), 0) + BRIDGE_WID_CONTROL))) & WIDGET_WIDGET_ID); panic(" ****io_init_node: Unknown Widget Part Number 0x%x Widget ID 0x%x attached to Hubv 0x%p ****\n", widget_partnum, npdap->basew_id, (void *)hubv); /*NOTREACHED*/ } { char widname[10]; sprintf(widname, "%x", npdap->basew_id); (void)hwgraph_path_add(switchv, widname, &widgetv); DBG("io_init_node: Created '%s' to '..node/xtalk/' vertex 0x%p\n", widname, widgetv); ASSERT(widgetv != GRAPH_VERTEX_NONE); } nodepda->basew_xc = widgetv; is_xswitch = xwidget_hwid_is_xswitch(&hwid); /* * Try to become the master of the widget. If this is an xswitch * with multiple hubs connected, only one will succeed. Mastership * of an xswitch is used only when touching registers on that xswitch. * The slave xwidgets connected to the xswitch can be owned by various * masters. */ if (device_master_set(widgetv, hubv) == 0) { /* Only one hub (thread) per Crosstalk device or switch makes * it to here. */ /* * Initialize whatever xwidget is hanging off our hub. * Whatever it is, it's accessible through widgetnum 0. */ hubinfo_get(hubv, &hubinfo); (void)xwidget_register(&hwid, widgetv, npdap->basew_id, hubv, hubinfo->h_widgetid); if (!is_xswitch) { /* io_init_done takes cpu cookie as 2nd argument * to do a restorenoderun for the setnoderun done * at the start of this thread */ io_init_done(cnodeid,c); /* NOTREACHED */ } /* * Special handling for Crosstalk Switches (e.g. xbow). * We need to do things in roughly the following order: * 1) Initialize xswitch hardware (done above) * 2) Determine which hubs are available to be widget masters * 3) Discover which links are active from the xswitch * 4) Assign xwidgets hanging off the xswitch to hubs * 5) Initialize all xwidgets on the xswitch */ DBG("call volunteer_for_widgets\n"); volunteer_for_widgets(switchv, hubv); /* If there's someone else on this crossbow, recognize him */ if (npdap->xbow_peer != INVALID_NASID) { nodepda_t *peer_npdap = NODEPDA(NASID_TO_COMPACT_NODEID(npdap->xbow_peer)); peer_sema = &peer_npdap->xbow_sema; DBG("call volunteer_for_widgets again\n"); volunteer_for_widgets(switchv, peer_npdap->node_vertex); } assign_widgets_to_volunteers(switchv, hubv); /* Signal that we're done */ if (peer_sema) { up(peer_sema); } } else { /* Wait 'til master is done assigning widgets. */ down(&npdap->xbow_sema); }#ifdef PROBE_TEST if ((cnodeid == 1) || (cnodeid == 2)) { int index; for (index = 0; index < 500; index++) DBG("Interfering with device probing!!!\n"); }#endif /* Now both nodes can safely inititialize widgets */ io_init_xswitch_widgets(switchv, cnodeid); io_link_xswitch_widgets(switchv, cnodeid); /* io_init_done takes cpu cookie as 2nd argument * to do a restorenoderun for the setnoderun done * at the start of this thread */ io_init_done(cnodeid,c); DBG("\nio_init_node: DONE INITIALIZED ALL I/O FOR CNODEID %d\n\n", cnodeid);}#define IOINIT_STKSZ (16 * 1024)#define __DEVSTR1 "/../.master/"#define __DEVSTR2 "/target/"#define __DEVSTR3 "/lun/0/disk/partition/"#define __DEVSTR4 "/../ef"/* * ioconfig starts numbering SCSI's at NUM_BASE_IO_SCSI_CTLR. */#define NUM_BASE_IO_SCSI_CTLR 6/* * This tells ioconfig where it can start numbering scsi controllers. * Below this base number, platform-specific handles the numbering. * XXX Irix legacy..controller numbering should be part of devfsd's job */int num_base_io_scsi_ctlr = 2; /* used by syssgi */vertex_hdl_t base_io_scsi_ctlr_vhdl[NUM_BASE_IO_SCSI_CTLR];#include <asm/sn/ioerror_handling.h>/* #endif *//* * Initialize all I/O devices. Starting closest to nodes, probe and * initialize outward. */voidinit_all_devices(void){ /* Governor on init threads..bump up when safe * (beware many devfs races) */ cnodeid_t cnodeid, active; active = 0; for (cnodeid = 0; cnodeid < numnodes; cnodeid++) { DBG("init_all_devices: Calling io_init_node() for cnode %d\n", cnodeid); io_init_node(cnodeid); DBG("init_all_devices: Done io_init_node() for cnode %d\n", cnodeid); } for (cnodeid = 0; cnodeid < numnodes; cnodeid++) /* * Update information generated by IO init. */ update_node_information(cnodeid);#if HWG_PRINT hwgraph_print();#endif}#define toint(x) ((int)(x) - (int)('0'))voiddevnamefromarcs(char *devnm){ int val; char tmpnm[MAXDEVNAME]; char *tmp1, *tmp2; val = strncmp(devnm, "dks", 3); if (val != 0) return; tmp1 = devnm + 3; if (!isdigit(*tmp1)) return; val = 0; while (isdigit(*tmp1)) { val = 10*val+toint(*tmp1); tmp1++; } if(*tmp1 != 'd') return; else tmp1++; if ((val < 0) || (val >= num_base_io_scsi_ctlr)) { int i; int viable_found = 0; DBG("Only controller numbers 0..%d are supported for\n", NUM_BASE_IO_SCSI_CTLR-1); DBG("prom \"root\" variables of the form dksXdXsX.\n"); DBG("To use another disk you must use the full hardware graph path\n\n"); DBG("Possible controller numbers for use in 'dksXdXsX' on this system: "); for (i=0; i<NUM_BASE_IO_SCSI_CTLR; i++) { if (base_io_scsi_ctlr_vhdl[i] != GRAPH_VERTEX_NONE) { DBG("%d ", i); viable_found=1; } } if (viable_found) DBG("\n"); else DBG("none found!\n"); udelay(15000000); //prom_reboot(); panic("FIXME: devnamefromarcs: should call prom_reboot here.\n"); /* NOTREACHED */ } ASSERT(base_io_scsi_ctlr_vhdl[val] != GRAPH_VERTEX_NONE); vertex_to_name(base_io_scsi_ctlr_vhdl[val], tmpnm, MAXDEVNAME); tmp2 = tmpnm + strlen(tmpnm); strcpy(tmp2, __DEVSTR2); tmp2 += strlen(__DEVSTR2); while (*tmp1 != 's') { if((*tmp2++ = *tmp1++) == '\0') return; } tmp1++; strcpy(tmp2, __DEVSTR3); tmp2 += strlen(__DEVSTR3); while ( (*tmp2++ = *tmp1++) ) ; tmp2--; *tmp2++ = '/'; strcpy(tmp2, EDGE_LBL_BLOCK); strcpy(devnm,tmpnm);}staticstruct io_brick_map_s io_brick_tab[] = {/* Ibrick widget number to PCI bus number map */ { MODULE_IBRICK, /* Ibrick type */ /* PCI Bus # Widget # */ { 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0 - 0x7 */ 0, /* 0x8 */ 0, /* 0x9 */ 0, 0, /* 0xa - 0xb */ 0, /* 0xc */ 0, /* 0xd */ 2, /* 0xe */ 1 /* 0xf */ } },/* Pbrick widget number to PCI bus number map */ { MODULE_PBRICK, /* Pbrick type */ /* PCI Bus # Widget # */ { 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0 - 0x7 */ 2, /* 0x8 */ 1, /* 0x9 */ 0, 0, /* 0xa - 0xb */ 5, /* 0xc */ 6, /* 0xd */ 4, /* 0xe */ 3 /* 0xf */ } },/* PXbrick widget number to PCI bus number map */ { MODULE_PXBRICK, /* PXbrick type */ /* PCI Bus # Widget # */ { 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0 - 0x7 */ 0, /* 0x8 */ 0, /* 0x9 */ 0, 0, /* 0xa - 0xb */ 1, /* 0xc */ 5, /* 0xd */ 0, /* 0xe */ 3 /* 0xf */ } },/* OPUSbrick widget number to PCI bus number map */ { MODULE_OPUSBRICK, /* OPUSbrick type */ /* PCI Bus # Widget # */ { 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0 - 0x7 */ 0, /* 0x8 */ 0, /* 0x9 */ 0, 0, /* 0xa - 0xb */ 0, /* 0xc */ 0, /* 0xd */ 0, /* 0xe */ 1 /* 0xf */ } },/* IXbrick widget number to PCI bus number map */ { MODULE_IXBRICK, /* IXbrick type */ /* PCI Bus # Widget # */ { 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0 - 0x7 */ 0, /* 0x8 */ 0, /* 0x9 */ 0, 0, /* 0xa - 0xb */ 1, /* 0xc */ 5, /* 0xd */ 0, /* 0xe */ 3 /* 0xf */ } },/* Xbrick widget to XIO slot map */ { MODULE_XBRICK, /* Xbrick type */ /* XIO Slot # Widget # */ { 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0 - 0x7 */ 1, /* 0x8 */ 3, /* 0x9 */ 0, 0, /* 0xa - 0xb */ 2, /* 0xc */ 4, /* 0xd */ 0, /* 0xe */ 0 /* 0xf */ } },/* CG brick widget number to PCI bus number map */ { MODULE_CGBRICK, /* CG brick */ /* PCI Bus # Widget # */ { 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0 - 0x7 */ 0, /* 0x8 */ 0, /* 0x9 */ 0, 1, /* 0xa - 0xb */ 0, /* 0xc */ 0, /* 0xd */ 0, /* 0xe */ 0 /* 0xf */ } }};/* * Use the brick's type to map a widget number to a meaningful int */intio_brick_map_widget(int brick_type, int widget_num){ int num_bricks, i; /* Calculate number of bricks in table */ num_bricks = sizeof(io_brick_tab)/sizeof(io_brick_tab[0]); /* Look for brick prefix in table */ for (i = 0; i < num_bricks; i++) { if (brick_type == io_brick_tab[i].ibm_type) return(io_brick_tab[i].ibm_map_wid[widget_num]); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -