Commit c03b9444 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Altix update: io changes

From: Pat Gefre <pfg@sgi.com>

arch/ia64/sn/io/platform_init/sgi_io_init.c
   use numionodes instead of numnodes

arch/ia64/sn/io/sn2/klconflib.c
    find_lboard changes - generalized a number of the interface funcs

arch/ia64/sn/io/sn2/klgraph.c
    call the more general find_lboard funcs

arch/ia64/sn/io/sn2/ml_iograph.c
    call the more general lboard funcs

arch/ia64/sn/io/sn2/module.c
    lboard changes
    mod for headless/memless nodes

arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c
    isIO9 mod

arch/ia64/sn/kernel/setup.c
    headless/memless mod

include/asm-ia64/sn/klconfig.h
    generalized find_lboard funs
parent f1128252
...@@ -131,7 +131,7 @@ sgi_master_io_infr_init(void) ...@@ -131,7 +131,7 @@ sgi_master_io_infr_init(void)
klhwg_add_all_modules(hwgraph_root); klhwg_add_all_modules(hwgraph_root);
klhwg_add_all_nodes(hwgraph_root); klhwg_add_all_nodes(hwgraph_root);
for (cnode = 0; cnode < numnodes; cnode++) { for (cnode = 0; cnode < numionodes; cnode++) {
extern void per_hub_init(cnodeid_t); extern void per_hub_init(cnodeid_t);
per_hub_init(cnode); per_hub_init(cnode);
} }
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define DBG(x...) #define DBG(x...)
#endif /* DEBUG_KLGRAPH */ #endif /* DEBUG_KLGRAPH */
extern int numionodes;
lboard_t *root_lboard[MAX_COMPACT_NODES]; lboard_t *root_lboard[MAX_COMPACT_NODES];
static int hasmetarouter; static int hasmetarouter;
...@@ -38,12 +40,31 @@ static int hasmetarouter; ...@@ -38,12 +40,31 @@ static int hasmetarouter;
char brick_types[MAX_BRICK_TYPES + 1] = "crikxdpn%#=vo^34567890123456789..."; char brick_types[MAX_BRICK_TYPES + 1] = "crikxdpn%#=vo^34567890123456789...";
lboard_t * lboard_t *
find_lboard(lboard_t *start, unsigned char brd_type) find_lboard_any(lboard_t *start, unsigned char brd_type)
{ {
/* Search all boards stored on this node. */ /* Search all boards stored on this node. */
while (start) { while (start) {
if (start->brd_type == brd_type) if (start->brd_type == brd_type)
return start; return start;
start = KLCF_NEXT_ANY(start);
}
/* Didn't find it. */
return (lboard_t *)NULL;
}
lboard_t *
find_lboard_nasid(lboard_t *start, nasid_t nasid, unsigned char brd_type)
{
while (start) {
if ((start->brd_type == brd_type) &&
(start->brd_nasid == nasid))
return start;
if (numionodes == numnodes)
start = KLCF_NEXT_ANY(start);
else
start = KLCF_NEXT(start); start = KLCF_NEXT(start);
} }
...@@ -52,12 +73,31 @@ find_lboard(lboard_t *start, unsigned char brd_type) ...@@ -52,12 +73,31 @@ find_lboard(lboard_t *start, unsigned char brd_type)
} }
lboard_t * lboard_t *
find_lboard_class(lboard_t *start, unsigned char brd_type) find_lboard_class_any(lboard_t *start, unsigned char brd_type)
{ {
/* Search all boards stored on this node. */ /* Search all boards stored on this node. */
while (start) { while (start) {
if (KLCLASS(start->brd_type) == KLCLASS(brd_type)) if (KLCLASS(start->brd_type) == KLCLASS(brd_type))
return start; return start;
start = KLCF_NEXT_ANY(start);
}
/* Didn't find it. */
return (lboard_t *)NULL;
}
lboard_t *
find_lboard_class_nasid(lboard_t *start, nasid_t nasid, unsigned char brd_type)
{
/* Search all boards stored on this node. */
while (start) {
if (KLCLASS(start->brd_type) == KLCLASS(brd_type) &&
(start->brd_nasid == nasid))
return start;
if (numionodes == numnodes)
start = KLCF_NEXT_ANY(start);
else
start = KLCF_NEXT(start); start = KLCF_NEXT(start);
} }
...@@ -65,6 +105,8 @@ find_lboard_class(lboard_t *start, unsigned char brd_type) ...@@ -65,6 +105,8 @@ find_lboard_class(lboard_t *start, unsigned char brd_type)
return (lboard_t *)NULL; return (lboard_t *)NULL;
} }
klinfo_t * klinfo_t *
find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type) find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type)
{ {
...@@ -116,20 +158,6 @@ find_lboard_modslot(lboard_t *start, geoid_t geoid) ...@@ -116,20 +158,6 @@ find_lboard_modslot(lboard_t *start, geoid_t geoid)
return (lboard_t *)NULL; return (lboard_t *)NULL;
} }
lboard_t *
find_lboard_module(lboard_t *start, geoid_t geoid)
{
/* Search all boards stored on this node. */
while (start) {
if (geo_cmp(start->brd_geoid, geoid))
return start;
start = KLCF_NEXT(start);
}
/* Didn't find it. */
return (lboard_t *)NULL;
}
/* /*
* Convert a NIC name to a name for use in the hardware graph. * Convert a NIC name to a name for use in the hardware graph.
*/ */
...@@ -218,7 +246,7 @@ xbow_port_io_enabled(nasid_t nasid, int link) ...@@ -218,7 +246,7 @@ xbow_port_io_enabled(nasid_t nasid, int link)
/* /*
* look for boards that might contain an xbow or xbridge * look for boards that might contain an xbow or xbridge
*/ */
brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IOBRICK_XBOW); brd = find_lboard_nasid((lboard_t *)KL_CONFIG_INFO(nasid), nasid, KLTYPE_IOBRICK_XBOW);
if (brd == NULL) return 0; if (brd == NULL) return 0;
if ((xbow_p = (klxbow_t *)find_component(brd, NULL, KLSTRUCT_XBOW)) if ((xbow_p = (klxbow_t *)find_component(brd, NULL, KLSTRUCT_XBOW))
...@@ -285,40 +313,6 @@ board_to_path(lboard_t *brd, char *path) ...@@ -285,40 +313,6 @@ board_to_path(lboard_t *brd, char *path)
#define MHZ 1000000 #define MHZ 1000000
/* Get the canonical hardware graph name for the given pci component
* on the given io board.
*/
void
device_component_canonical_name_get(lboard_t *brd,
klinfo_t *component,
char *name)
{
slotid_t slot;
char board_name[20];
ASSERT(brd);
/* Convert the [ CLASS | TYPE ] kind of slotid
* into a string
*/
slot = brd->brd_slot;
/* Get the io board name */
if (!brd || (brd->brd_sversion < 2)) {
strcpy(name, EDGE_LBL_XWIDGET);
} else {
nic_name_convert(brd->brd_name, board_name);
}
/* Give out the canonical name of the pci device*/
sprintf(name,
"/dev/hw/"EDGE_LBL_MODULE "/%x/"EDGE_LBL_SLAB"/%d/"
EDGE_LBL_SLOT"/%s/"EDGE_LBL_PCI"/%d",
geo_module(brd->brd_geoid), geo_slab(brd->brd_geoid),
board_name, KLCF_BRIDGE_W_ID(component));
}
/* /*
* Get the serial number of the main component of a board * Get the serial number of the main component of a board
* Returns 0 if a valid serial number is found * Returns 0 if a valid serial number is found
...@@ -506,7 +500,7 @@ void ...@@ -506,7 +500,7 @@ void
format_module_id(char *buffer, moduleid_t m, int fmt) format_module_id(char *buffer, moduleid_t m, int fmt)
{ {
int rack, position; int rack, position;
char brickchar; unsigned char brickchar;
rack = MODULE_GET_RACK(m); rack = MODULE_GET_RACK(m);
ASSERT(MODULE_GET_BTYPE(m) < MAX_BRICK_TYPES); ASSERT(MODULE_GET_BTYPE(m) < MAX_BRICK_TYPES);
...@@ -560,112 +554,21 @@ format_module_id(char *buffer, moduleid_t m, int fmt) ...@@ -560,112 +554,21 @@ format_module_id(char *buffer, moduleid_t m, int fmt)
} }
/*
* Parse a module id, in either brief or long form.
* Returns < 0 on error.
* The long form does not include a brick type, so it defaults to 0 (CBrick)
*/
int
parse_module_id(char *buffer)
{
unsigned int v, rack, bay, type, form;
moduleid_t m;
char c;
if (strstr(buffer, EDGE_LBL_RACK "/") == buffer) {
form = MODULE_FORMAT_LONG;
buffer += strlen(EDGE_LBL_RACK "/");
/* A long module ID must be exactly 5 non-template chars. */
if (strlen(buffer) != strlen("/" EDGE_LBL_RPOS "/") + 5)
return -1;
}
else {
form = MODULE_FORMAT_BRIEF;
/* A brief module id must be exactly 6 characters */
if (strlen(buffer) != 6)
return -2;
}
/* The rack number must be exactly 3 digits */
if (!(isdigit(buffer[0]) && isdigit(buffer[1]) && isdigit(buffer[2])))
return -3;
rack = 0;
v = *buffer++ - '0';
if (v > RACK_CLASS_MASK(rack) >> RACK_CLASS_SHFT(rack))
return -4;
RACK_ADD_CLASS(rack, v);
v = *buffer++ - '0';
if (v > RACK_GROUP_MASK(rack) >> RACK_GROUP_SHFT(rack))
return -5;
RACK_ADD_GROUP(rack, v);
v = *buffer++ - '0';
/* rack numbers are 1-based */
if (v-1 > RACK_NUM_MASK(rack) >> RACK_NUM_SHFT(rack))
return -6;
RACK_ADD_NUM(rack, v);
if (form == MODULE_FORMAT_BRIEF) {
/* Next should be a module type character. Accept ucase or lcase. */
c = *buffer++;
if (!isalpha(c))
return -7;
/* strchr() returns a pointer into brick_types[], or NULL */
type = (unsigned int)(strchr(brick_types, tolower(c)) - brick_types);
if (type > MODULE_BTYPE_MASK >> MODULE_BTYPE_SHFT)
return -8;
}
else {
/* Hardcode the module type, and skip over the boilerplate */
type = MODULE_CBRICK;
if (strstr(buffer, "/" EDGE_LBL_RPOS "/") != buffer)
return -9;
buffer += strlen("/" EDGE_LBL_RPOS "/");
}
/* The bay number is last. Make sure it's exactly two digits */
if (!(isdigit(buffer[0]) && isdigit(buffer[1]) && !buffer[2]))
return -10;
bay = 10 * (buffer[0] - '0') + (buffer[1] - '0');
if (bay > MODULE_BPOS_MASK >> MODULE_BPOS_SHFT)
return -11;
m = RBT_TO_MODULE(rack, bay, type);
/* avoid sign extending the moduleid_t */
return (int)(unsigned short)m;
}
int int
cbrick_type_get_nasid(nasid_t nasid) cbrick_type_get_nasid(nasid_t nasid)
{ {
lboard_t *brd;
moduleid_t module; moduleid_t module;
uint type;
int t; int t;
brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA); module = iomoduleid_get(nasid);
module = geo_module(brd->brd_geoid); if (module < 0 ) {
type = (module & MODULE_BTYPE_MASK) >> MODULE_BTYPE_SHFT; return MODULE_CBRICK;
/* convert brick_type to lower case */
if ((type >= 'A') && (type <= 'Z'))
type = type - 'A' + 'a';
/* convert to a module.h brick type */
for( t = 0; t < MAX_BRICK_TYPES; t++ ) {
if( brick_types[t] == type ) {
return t;
} }
t = MODULE_GET_BTYPE(module);
if ((char)t == 'o') {
return MODULE_OPUSBRICK;
} else {
return MODULE_CBRICK;
} }
return -1; return -1;
} }
...@@ -124,7 +124,8 @@ klhwg_add_xbow(cnodeid_t cnode, nasid_t nasid) ...@@ -124,7 +124,8 @@ klhwg_add_xbow(cnodeid_t cnode, nasid_t nasid)
/*REFERENCED*/ /*REFERENCED*/
graph_error_t err; graph_error_t err;
if ((brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IOBRICK_XBOW)) == NULL) if (!(brd = find_lboard_nasid((lboard_t *)KL_CONFIG_INFO(nasid),
nasid, KLTYPE_IOBRICK_XBOW)))
return; return;
if (KL_CONFIG_DUPLICATE_BOARD(brd)) if (KL_CONFIG_DUPLICATE_BOARD(brd))
...@@ -200,7 +201,7 @@ klhwg_add_node(vertex_hdl_t hwgraph_root, cnodeid_t cnode) ...@@ -200,7 +201,7 @@ klhwg_add_node(vertex_hdl_t hwgraph_root, cnodeid_t cnode)
vertex_hdl_t cpu_dir; vertex_hdl_t cpu_dir;
nasid = COMPACT_TO_NASID_NODEID(cnode); nasid = COMPACT_TO_NASID_NODEID(cnode);
brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA); brd = find_lboard_any((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA);
ASSERT(brd); ASSERT(brd);
/* Generate a hardware graph path for this board. */ /* Generate a hardware graph path for this board. */
...@@ -280,7 +281,7 @@ klhwg_add_all_routers(vertex_hdl_t hwgraph_root) ...@@ -280,7 +281,7 @@ klhwg_add_all_routers(vertex_hdl_t hwgraph_root)
for (cnode = 0; cnode < numnodes; cnode++) { for (cnode = 0; cnode < numnodes; cnode++) {
nasid = COMPACT_TO_NASID_NODEID(cnode); nasid = COMPACT_TO_NASID_NODEID(cnode);
brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid), brd = find_lboard_class_any((lboard_t *)KL_CONFIG_INFO(nasid),
KLTYPE_ROUTER); KLTYPE_ROUTER);
if (!brd) if (!brd)
...@@ -307,7 +308,7 @@ klhwg_add_all_routers(vertex_hdl_t hwgraph_root) ...@@ -307,7 +308,7 @@ klhwg_add_all_routers(vertex_hdl_t hwgraph_root)
HWGRAPH_DEBUG((__FILE__, __FUNCTION__, __LINE__, node_vertex, NULL, "Created router path.\n")); HWGRAPH_DEBUG((__FILE__, __FUNCTION__, __LINE__, node_vertex, NULL, "Created router path.\n"));
/* Find the rest of the routers stored on this node. */ /* Find the rest of the routers stored on this node. */
} while ( (brd = find_lboard_class(KLCF_NEXT(brd), } while ( (brd = find_lboard_class_any(KLCF_NEXT_ANY(brd),
KLTYPE_ROUTER)) ); KLTYPE_ROUTER)) );
} }
...@@ -414,7 +415,7 @@ klhwg_connect_routers(vertex_hdl_t hwgraph_root) ...@@ -414,7 +415,7 @@ klhwg_connect_routers(vertex_hdl_t hwgraph_root)
for (cnode = 0; cnode < numnodes; cnode++) { for (cnode = 0; cnode < numnodes; cnode++) {
nasid = COMPACT_TO_NASID_NODEID(cnode); nasid = COMPACT_TO_NASID_NODEID(cnode);
brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid), brd = find_lboard_class_any((lboard_t *)KL_CONFIG_INFO(nasid),
KLTYPE_ROUTER); KLTYPE_ROUTER);
if (!brd) if (!brd)
...@@ -428,7 +429,7 @@ klhwg_connect_routers(vertex_hdl_t hwgraph_root) ...@@ -428,7 +429,7 @@ klhwg_connect_routers(vertex_hdl_t hwgraph_root)
cnode, nasid); cnode, nasid);
/* Find the rest of the routers stored on this node. */ /* Find the rest of the routers stored on this node. */
} while ( (brd = find_lboard_class(KLCF_NEXT(brd), KLTYPE_ROUTER)) ); } while ( (brd = find_lboard_class_any(KLCF_NEXT_ANY(brd), KLTYPE_ROUTER)) );
} }
} }
...@@ -452,8 +453,7 @@ klhwg_connect_hubs(vertex_hdl_t hwgraph_root) ...@@ -452,8 +453,7 @@ klhwg_connect_hubs(vertex_hdl_t hwgraph_root)
for (cnode = 0; cnode < numionodes; cnode++) { for (cnode = 0; cnode < numionodes; cnode++) {
nasid = COMPACT_TO_NASID_NODEID(cnode); nasid = COMPACT_TO_NASID_NODEID(cnode);
brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA); brd = find_lboard_any((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA);
ASSERT(brd);
hub = (klhub_t *)find_first_component(brd, KLSTRUCT_HUB); hub = (klhub_t *)find_first_component(brd, KLSTRUCT_HUB);
ASSERT(hub); ASSERT(hub);
...@@ -511,69 +511,6 @@ klhwg_connect_hubs(vertex_hdl_t hwgraph_root) ...@@ -511,69 +511,6 @@ klhwg_connect_hubs(vertex_hdl_t hwgraph_root)
} }
} }
/* Store the pci/vme disabled board information as extended administrative
* hints which can later be used by the drivers using the device/driver
* admin interface.
*/
static void __init
klhwg_device_disable_hints_add(void)
{
cnodeid_t cnode; /* node we are looking at */
nasid_t nasid; /* nasid of the node */
lboard_t *board; /* board we are looking at */
int comp_index; /* component index */
klinfo_t *component; /* component in the board we are
* looking at
*/
char device_name[MAXDEVNAME];
for(cnode = 0; cnode < numnodes; cnode++) {
nasid = COMPACT_TO_NASID_NODEID(cnode);
board = (lboard_t *)KL_CONFIG_INFO(nasid);
/* Check out all the board info stored on a node */
while(board) {
/* No need to look at duplicate boards or non-io
* boards
*/
if (KL_CONFIG_DUPLICATE_BOARD(board) ||
KLCLASS(board->brd_type) != KLCLASS_IO) {
board = KLCF_NEXT(board);
continue;
}
/* Check out all the components of a board */
for (comp_index = 0;
comp_index < KLCF_NUM_COMPS(board);
comp_index++) {
component = KLCF_COMP(board,comp_index);
/* If the component is enabled move on to
* the next component
*/
if (KLCONFIG_INFO_ENABLED(component))
continue;
/* NOTE : Since the prom only supports
* the disabling of pci devices the following
* piece of code makes sense.
* Make sure that this assumption is valid
*/
/* This component is disabled. Store this
* hint in the extended device admin table
*/
/* Get the canonical name of the pci device */
device_component_canonical_name_get(board,
component,
device_name);
#ifdef DEBUG
printf("%s DISABLED\n",device_name);
#endif
}
/* go to the next board info stored on this
* node
*/
board = KLCF_NEXT(board);
}
}
}
void __init void __init
klhwg_add_all_modules(vertex_hdl_t hwgraph_root) klhwg_add_all_modules(vertex_hdl_t hwgraph_root)
{ {
...@@ -637,10 +574,4 @@ klhwg_add_all_nodes(vertex_hdl_t hwgraph_root) ...@@ -637,10 +574,4 @@ klhwg_add_all_nodes(vertex_hdl_t hwgraph_root)
klhwg_add_all_routers(hwgraph_root); klhwg_add_all_routers(hwgraph_root);
klhwg_connect_routers(hwgraph_root); klhwg_connect_routers(hwgraph_root);
klhwg_connect_hubs(hwgraph_root); klhwg_connect_hubs(hwgraph_root);
/* Go through the entire system's klconfig
* to figure out which pci components have been disabled
*/
klhwg_device_disable_hints_add();
} }
...@@ -345,13 +345,12 @@ io_xswitch_widget_init(vertex_hdl_t xswitchv, ...@@ -345,13 +345,12 @@ io_xswitch_widget_init(vertex_hdl_t xswitchv,
return; return;
} }
board = find_lboard_class( board = find_lboard_class_nasid( (lboard_t *)KL_CONFIG_INFO(nasid),
(lboard_t *)KL_CONFIG_INFO(nasid), nasid, KLCLASS_IOBRICK);
KLCLASS_IOBRICK);
if (!board && NODEPDA(cnode)->xbow_peer != INVALID_NASID) { if (!board && NODEPDA(cnode)->xbow_peer != INVALID_NASID) {
board = find_lboard_class( board = find_lboard_class_nasid(
(lboard_t *)KL_CONFIG_INFO( NODEPDA(cnode)->xbow_peer), (lboard_t *)KL_CONFIG_INFO( NODEPDA(cnode)->xbow_peer),
KLCLASS_IOBRICK); NODEPDA(cnode)->xbow_peer, KLCLASS_IOBRICK);
} }
if (board) { if (board) {
...@@ -366,7 +365,7 @@ io_xswitch_widget_init(vertex_hdl_t xswitchv, ...@@ -366,7 +365,7 @@ io_xswitch_widget_init(vertex_hdl_t xswitchv,
{ {
lboard_t *brd; lboard_t *brd;
brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA); brd = find_lboard_any((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA);
if ( brd != (lboard_t *)0 ) { if ( brd != (lboard_t *)0 ) {
board->brd_geoid = brd->brd_geoid; board->brd_geoid = brd->brd_geoid;
} }
......
...@@ -139,7 +139,7 @@ module_probe_snum(module_t *m, nasid_t host_nasid, nasid_t nasid) ...@@ -139,7 +139,7 @@ module_probe_snum(module_t *m, nasid_t host_nasid, nasid_t nasid)
/* /*
* record brick serial number * record brick serial number
*/ */
board = find_lboard((lboard_t *) KL_CONFIG_INFO(host_nasid), KLTYPE_SNIA); board = find_lboard_nasid((lboard_t *) KL_CONFIG_INFO(host_nasid), host_nasid, KLTYPE_SNIA);
if (! board || KL_CONFIG_DUPLICATE_BOARD(board)) if (! board || KL_CONFIG_DUPLICATE_BOARD(board))
{ {
...@@ -152,8 +152,8 @@ module_probe_snum(module_t *m, nasid_t host_nasid, nasid_t nasid) ...@@ -152,8 +152,8 @@ module_probe_snum(module_t *m, nasid_t host_nasid, nasid_t nasid)
m->snum_valid = 1; m->snum_valid = 1;
} }
board = find_lboard((lboard_t *) KL_CONFIG_INFO(nasid), board = find_lboard_nasid((lboard_t *) KL_CONFIG_INFO(nasid),
KLTYPE_IOBRICK_XBOW); nasid, KLTYPE_IOBRICK_XBOW);
if (! board || KL_CONFIG_DUPLICATE_BOARD(board)) if (! board || KL_CONFIG_DUPLICATE_BOARD(board))
return 0; return 0;
...@@ -185,6 +185,7 @@ io_module_init(void) ...@@ -185,6 +185,7 @@ io_module_init(void)
nasid_t nasid; nasid_t nasid;
int nserial; int nserial;
module_t *m; module_t *m;
extern int numionodes;
DPRINTF("*******module_init\n"); DPRINTF("*******module_init\n");
...@@ -196,8 +197,7 @@ io_module_init(void) ...@@ -196,8 +197,7 @@ io_module_init(void)
*/ */
for (node = 0; node < numnodes; node++) { for (node = 0; node < numnodes; node++) {
nasid = COMPACT_TO_NASID_NODEID(node); nasid = COMPACT_TO_NASID_NODEID(node);
board = find_lboard_nasid((lboard_t *) KL_CONFIG_INFO(nasid), nasid, KLTYPE_SNIA);
board = find_lboard((lboard_t *) KL_CONFIG_INFO(nasid), KLTYPE_SNIA);
ASSERT(board); ASSERT(board);
HWGRAPH_DEBUG((__FILE__, __FUNCTION__, __LINE__, NULL, NULL, "Found Shub lboard 0x%lx nasid 0x%x cnode 0x%x \n", (unsigned long)board, (int)nasid, (int)node)); HWGRAPH_DEBUG((__FILE__, __FUNCTION__, __LINE__, NULL, NULL, "Found Shub lboard 0x%lx nasid 0x%x cnode 0x%x \n", (unsigned long)board, (int)nasid, (int)node));
...@@ -206,4 +206,31 @@ io_module_init(void) ...@@ -206,4 +206,31 @@ io_module_init(void)
if (! m->snum_valid && module_probe_snum(m, nasid, nasid)) if (! m->snum_valid && module_probe_snum(m, nasid, nasid))
nserial++; nserial++;
} }
/*
* Second scan, look for headless/memless board hosted by compute nodes.
*/
for (node = numnodes; node < numionodes; node++) {
nasid_t nasid;
char serial_number[16];
nasid = COMPACT_TO_NASID_NODEID(node);
board = find_lboard_nasid((lboard_t *) KL_CONFIG_INFO(nasid),
nasid, KLTYPE_SNIA);
ASSERT(board);
HWGRAPH_DEBUG((__FILE__, __FUNCTION__, __LINE__, NULL, NULL, "Found headless/memless lboard 0x%lx node %d nasid %d cnode %d\n", (unsigned long)board, node, (int)nasid, (int)node));
m = module_add_node(board->brd_geoid, node);
/*
* Get and initialize the serial number.
*/
board_serial_number_get( board, serial_number );
if( serial_number[0] != '\0' ) {
encode_str_serial( serial_number, m->snum.snum_str );
m->snum_valid = 1;
nserial++;
}
}
} }
...@@ -2638,13 +2638,17 @@ pcibr_bridge_ptr_get(vertex_hdl_t widget_vhdl, int bus_num) ...@@ -2638,13 +2638,17 @@ pcibr_bridge_ptr_get(vertex_hdl_t widget_vhdl, int bus_num)
int int
isIO9(nasid_t nasid) { isIO9(nasid_t nasid)
{
lboard_t *brd = (lboard_t *)KL_CONFIG_INFO(nasid); lboard_t *brd = (lboard_t *)KL_CONFIG_INFO(nasid);
while (brd) { while (brd) {
if (brd->brd_flags & LOCAL_MASTER_IO6) { if (brd->brd_flags & LOCAL_MASTER_IO6) {
return 1; return 1;
} }
if (numionodes == numnodes)
brd = KLCF_NEXT_ANY(brd);
else
brd = KLCF_NEXT(brd); brd = KLCF_NEXT(brd);
} }
/* if it's dual ported, check the peer also */ /* if it's dual ported, check the peer also */
...@@ -2655,7 +2659,11 @@ isIO9(nasid_t nasid) { ...@@ -2655,7 +2659,11 @@ isIO9(nasid_t nasid) {
if (brd->brd_flags & LOCAL_MASTER_IO6) { if (brd->brd_flags & LOCAL_MASTER_IO6) {
return 1; return 1;
} }
if (numionodes == numnodes)
brd = KLCF_NEXT_ANY(brd);
else
brd = KLCF_NEXT(brd); brd = KLCF_NEXT(brd);
} }
return 0; return 0;
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -71,7 +72,6 @@ u64 sn_partition_serial_number; ...@@ -71,7 +72,6 @@ u64 sn_partition_serial_number;
short physical_node_map[MAX_PHYSNODE_ID]; short physical_node_map[MAX_PHYSNODE_ID];
int numionodes; int numionodes;
/* /*
* This is the address of the RRegs in the HSpace of the global * This is the address of the RRegs in the HSpace of the global
* master. It is used by a hack in serial.c (serial_[in|out], * master. It is used by a hack in serial.c (serial_[in|out],
...@@ -340,7 +340,7 @@ sn_init_pdas(char **cmdline_p) ...@@ -340,7 +340,7 @@ sn_init_pdas(char **cmdline_p)
/* /*
* Now copy the array of nodepda pointers to each nodepda. * Now copy the array of nodepda pointers to each nodepda.
*/ */
for (cnode=0; cnode < numnodes; cnode++) for (cnode=0; cnode < numionodes; cnode++)
memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr, sizeof(nodepdaindr)); memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr, sizeof(nodepdaindr));
...@@ -437,8 +437,10 @@ sn_cpu_init(void) ...@@ -437,8 +437,10 @@ sn_cpu_init(void)
*/ */
void void
scan_for_ionodes(void) { scan_for_ionodes(void)
{
int nasid = 0; int nasid = 0;
lboard_t *brd;
/* Setup ionodes with memory */ /* Setup ionodes with memory */
for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid +=2) { for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid +=2) {
...@@ -458,4 +460,29 @@ scan_for_ionodes(void) { ...@@ -458,4 +460,29 @@ scan_for_ionodes(void) {
((kl_config_hdr_t *)(klgraph_header))-> ((kl_config_hdr_t *)(klgraph_header))->
ch_board_info); ch_board_info);
} }
/* Scan headless/memless IO Nodes. */
for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid +=2) {
/* if there's no nasid, don't try to read the klconfig on the node */
if (physical_node_map[nasid] == -1) continue;
brd = find_lboard_any((lboard_t *)root_lboard[nasid_to_cnodeid(nasid)], KLTYPE_SNIA);
if (brd) {
brd = KLCF_NEXT_ANY(brd); /* Skip this node's lboard */
if (!brd)
continue;
}
brd = find_lboard_any(brd, KLTYPE_SNIA);
while (brd) {
pda->cnodeid_to_nasid_table[numionodes] = brd->brd_nasid;
physical_node_map[brd->brd_nasid] = numionodes;
root_lboard[numionodes] = brd;
numionodes++;
brd = KLCF_NEXT_ANY(brd);
if (!brd)
break;
brd = find_lboard_any(brd, KLTYPE_SNIA);
}
}
} }
...@@ -672,18 +672,19 @@ typedef union kldev_s { /* for device structure allocation */ ...@@ -672,18 +672,19 @@ typedef union kldev_s { /* for device structure allocation */
/* external declarations of Linux kernel functions. */ /* external declarations of Linux kernel functions. */
extern lboard_t *root_lboard[]; extern lboard_t *root_lboard[];
extern lboard_t *find_lboard(lboard_t *start, unsigned char type); extern lboard_t *find_lboard_any(lboard_t *start, unsigned char type);
extern lboard_t *find_lboard_nasid(lboard_t *start, nasid_t, unsigned char type);
extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type); extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type); extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int); extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
extern lboard_t *find_gfxpipe(int pipenum); extern lboard_t *find_gfxpipe(int pipenum);
extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class); extern lboard_t *find_lboard_class_any(lboard_t *start, unsigned char brd_class);
extern lboard_t *find_lboard_class_nasid(lboard_t *start, nasid_t, unsigned char brd_class);
extern lboard_t *find_nic_lboard(lboard_t *, nic_t); extern lboard_t *find_nic_lboard(lboard_t *, nic_t);
extern lboard_t *find_nic_type_lboard(nasid_t, unsigned char, nic_t); extern lboard_t *find_nic_type_lboard(nasid_t, unsigned char, nic_t);
extern lboard_t *find_lboard_modslot(lboard_t *start, geoid_t geoid); extern lboard_t *find_lboard_modslot(lboard_t *start, geoid_t geoid);
extern lboard_t *find_lboard_module(lboard_t *start, geoid_t geoid);
extern int config_find_nic_router(nasid_t, nic_t, lboard_t **, klrou_t**); extern int config_find_nic_router(nasid_t, nic_t, lboard_t **, klrou_t**);
extern int config_find_nic_hub(nasid_t, nic_t, lboard_t **, klhub_t**); extern int config_find_nic_hub(nasid_t, nic_t, lboard_t **, klhub_t**);
extern int config_find_xbow(nasid_t, lboard_t **, klxbow_t**); extern int config_find_xbow(nasid_t, lboard_t **, klxbow_t**);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment