diff -Naurp -X /home/jbarnes/dontdiff 110-kill-endian-stuff.patch/arch/ia64/sn/io/hwgfs/hcl.c 120-hwgfs-update.patch/arch/ia64/sn/io/hwgfs/hcl.c --- 110-kill-endian-stuff.patch/arch/ia64/sn/io/hwgfs/hcl.c Mon Jan 5 21:09:20 2004 +++ 120-hwgfs-update.patch/arch/ia64/sn/io/hwgfs/hcl.c Tue Jan 6 12:19:19 2004 @@ -23,41 +23,16 @@ #include #include #include -#include #include #include #include -#define HCL_NAME "SGI-HWGRAPH COMPATIBILITY DRIVER" -#define HCL_TEMP_NAME "HCL_TEMP_NAME_USED_FOR_HWGRAPH_VERTEX_CREATE" -#define HCL_TEMP_NAME_LEN 44 -#define HCL_VERSION "1.0" - #define vertex_hdl_t hwgfs_handle_t + vertex_hdl_t hwgraph_root; vertex_hdl_t linux_busnum; - extern void pci_bus_cvlink_init(void); - -/* - * Debug flag definition. - */ -#define OPTION_NONE 0x00 -#define HCL_DEBUG_NONE 0x00000 -#define HCL_DEBUG_ALL 0x0ffff -#if defined(CONFIG_HCL_DEBUG) -static unsigned int hcl_debug_init __initdata = HCL_DEBUG_NONE; -#endif -static unsigned int hcl_debug = HCL_DEBUG_NONE; -#if defined(CONFIG_HCL_DEBUG) && !defined(MODULE) -static unsigned int boot_options = OPTION_NONE; -#endif - -invplace_t invplace_none = { - GRAPH_VERTEX_NONE, - GRAPH_VERTEX_PLACE_NONE, - NULL -}; +unsigned long hwgraph_debug_mask; /* * init_hcl() - Boot time initialization. @@ -71,11 +46,6 @@ int __init init_hcl(void) extern int init_hwgfs_fs(void); int rv = 0; - if (IS_RUNNING_ON_SIMULATOR()) { - extern u64 klgraph_addr[]; - klgraph_addr[0] = 0xe000003000030000; - } - init_hwgfs_fs(); /* @@ -83,7 +53,7 @@ int __init init_hcl(void) */ rv = hwgraph_path_add(NULL, EDGE_LBL_HW, &hwgraph_root); if (rv) - printk ("WARNING: init_hcl: Failed to create hwgraph_root. Error = %d.\n", rv); + panic("init_hcl: Failed to create hwgraph_root.\n"); /* * Initialize the HCL string table. @@ -103,7 +73,6 @@ int __init init_hcl(void) pci_bus_cvlink_init(); /* - * Initialize the ifconfgi_net driver that does network devices * Persistent Naming. */ init_ioconfig_bus(); @@ -112,50 +81,6 @@ int __init init_hcl(void) } - -/* - * hcl_setup() - Process boot time parameters if given. - * "hcl=" - * This routine gets called only if "hcl=" is given in the - * boot line and before init_hcl(). - * - * We currently do not have any boot options .. when we do, - * functionalities can be added here. - * - */ -static int __init hcl_setup(char *str) -{ - while ( (*str != '\0') && !isspace (*str) ) - { -#ifdef CONFIG_HCL_DEBUG - if (strncmp (str, "all", 3) == 0) { - hcl_debug_init |= HCL_DEBUG_ALL; - str += 3; - } else - return 0; -#endif - if (*str != ',') return 0; - ++str; - } - - return 1; - -} - -__setup("hcl=", hcl_setup); - - -/* - * Set device specific "fast information". - * - */ -void -hwgraph_fastinfo_set(vertex_hdl_t de, arbitrary_info_t fastinfo) -{ - labelcl_info_replace_IDX(de, HWGRAPH_FASTINFO, fastinfo, NULL); -} - - /* * Get device specific "fast information". * @@ -181,25 +106,6 @@ hwgraph_fastinfo_get(vertex_hdl_t de) /* - * hwgraph_connectpt_set - Sets the connect point handle in de to the - * given connect_de handle. By default, the connect point of the - * node is the parent. This effectively changes this assumption. - */ -int -hwgraph_connectpt_set(vertex_hdl_t de, vertex_hdl_t connect_de) -{ - int rv; - - if (!de) - return(-1); - - rv = labelcl_info_connectpt_set(de, connect_de); - - return(rv); -} - - -/* * hwgraph_connectpt_get: Returns the entry's connect point. * */ @@ -403,39 +309,6 @@ hwgraph_vertex_destroy(vertex_hdl_t de) return(0); } -#if 0 -/* - * hwgraph_edge_add - This routines has changed from the original conext. - * All it does now is to create a symbolic link from "from" to "to". - */ -/* ARGSUSED */ -int -hwgraph_edge_add(vertex_hdl_t from, vertex_hdl_t to, char *name) -{ - - char *path, *link; - vertex_hdl_t handle = NULL; - int rv, i; - - handle = hwgfs_find_handle(from, name, 0, 0, 0, 1); - if (handle) { - return(0); - } - - path = kmalloc(1024, GFP_KERNEL); - memset(path, 0x0, 1024); - link = kmalloc(1024, GFP_KERNEL); - memset(path, 0x0, 1024); - i = hwgfs_generate_path (to, link, 1024); - rv = hwgfs_mk_symlink (from, (const char *)name, - DEVFS_FL_DEFAULT, link, - &handle, NULL); - return(0); - - -} -#endif - int hwgraph_edge_add(vertex_hdl_t from, vertex_hdl_t to, char *name) { @@ -448,8 +321,14 @@ hwgraph_edge_add(vertex_hdl_t from, vert int i, count; path = kmalloc(1024, GFP_KERNEL); + if (!path) + return -ENOMEM; memset((char *)path, 0x0, 1024); link = kmalloc(1024, GFP_KERNEL); + if (!link) { + kfree(path); + return -ENOMEM; + } memset((char *)link, 0x0, 1024); i = hwgfs_generate_path (from, path, 1024); @@ -683,6 +562,28 @@ hwgraph_info_unexport_LBL(vertex_hdl_t d } /* + * hwgraph_path_lookup - return the handle for the given path. + * + */ +int +hwgraph_path_lookup(vertex_hdl_t start_vertex_handle, + char *lookup_path, + vertex_hdl_t *vertex_handle_ptr, + char **remainder) +{ + *vertex_handle_ptr = hwgfs_find_handle(start_vertex_handle, /* start dir */ + lookup_path, /* path */ + 0, /* major */ + 0, /* minor */ + 0, /* char | block */ + 1); /* traverse symlinks */ + if (*vertex_handle_ptr == NULL) + return(-1); + else + return(0); +} + +/* * hwgraph_traverse - Find and return the handle starting from de. * */ @@ -706,39 +607,6 @@ hwgraph_traverse(vertex_hdl_t de, char * } /* - * hwgraph_path_to_vertex - Return the entry handle for the given - * pathname .. assume traverse symlinks too!. - */ -vertex_hdl_t -hwgraph_path_to_vertex(char *path) -{ - return(hwgfs_find_handle(NULL, /* start dir */ - path, /* path */ - 0, /* major */ - 0, /* minor */ - 0, /* char | block */ - 1)); /* traverse symlinks */ -} - -/* - * hwgraph_inventory_remove - Removes an inventory entry. - * - * Remove an inventory item associated with a vertex. It is the caller's - * responsibility to make sure that there are no races between removing - * inventory from a vertex and simultaneously removing that vertex. -*/ -int -hwgraph_inventory_remove( vertex_hdl_t de, - int class, - int type, - major_t controller, - minor_t unit, - int state) -{ - return(0); /* Just a Stub for IRIX code. */ -} - -/* * Find the canonical name for a given vertex by walking back through * connectpt's until we hit the hwgraph root vertex (or until we run * out of buffer space or until something goes wrong). @@ -787,32 +655,56 @@ hwgraph_vertex_name_get(vertex_hdl_t vhd char * vertex_to_name(vertex_hdl_t vhdl, char *buf, uint buflen) { - if (hwgraph_vertex_name_get(vhdl, buf, buflen) == GRAPH_SUCCESS) - return(buf); - else - return(DEVNAME_UNKNOWN); + if (hwgraph_vertex_name_get(vhdl, buf, buflen) == GRAPH_SUCCESS) + return(buf); + else + return(DEVNAME_UNKNOWN); } -graph_error_t -hwgraph_edge_remove(vertex_hdl_t from, char *name, vertex_hdl_t *toptr) -{ - return(GRAPH_ILLEGAL_REQUEST); -} -graph_error_t -hwgraph_vertex_unref(vertex_hdl_t vhdl) +void +hwgraph_debug(char *file, char * function, int line, vertex_hdl_t vhdl1, vertex_hdl_t vhdl2, char *format, ...) { - return(GRAPH_ILLEGAL_REQUEST); -} + int pos; + char *hwpath; + va_list ap; + + if ( !hwgraph_debug_mask ) + return; + + hwpath = kmalloc(MAXDEVNAME, GFP_KERNEL); + if (!hwpath) + BUG(); + + printk("HWGRAPH_DEBUG %s %s %d : ", file, function, line); + + if (vhdl1){ + memset(hwpath, 0, MAXDEVNAME); + pos = hwgfs_generate_path(vhdl1, hwpath, MAXDEVNAME); + printk("vhdl1 = %s : ", &hwpath[pos]); + } + + if (vhdl2){ + memset(hwpath, 0, MAXDEVNAME); + pos = hwgfs_generate_path(vhdl2, hwpath, MAXDEVNAME); + printk("vhdl2 = %s :", &hwpath[pos]); + } + + memset(hwpath, 0, MAXDEVNAME); + va_start(ap, format); + vsnprintf(hwpath, 500, format, ap); + va_end(ap); + hwpath[MAXDEVNAME -1] = (char)0; /* Just in case. */ + printk(" %s", hwpath); + kfree(hwpath); +} EXPORT_SYMBOL(hwgraph_mk_dir); EXPORT_SYMBOL(hwgraph_path_add); EXPORT_SYMBOL(hwgraph_register); EXPORT_SYMBOL(hwgraph_vertex_destroy); EXPORT_SYMBOL(hwgraph_fastinfo_get); -EXPORT_SYMBOL(hwgraph_fastinfo_set); -EXPORT_SYMBOL(hwgraph_connectpt_set); EXPORT_SYMBOL(hwgraph_connectpt_get); EXPORT_SYMBOL(hwgraph_info_add_LBL); EXPORT_SYMBOL(hwgraph_info_remove_LBL); @@ -822,5 +714,6 @@ EXPORT_SYMBOL(hwgraph_info_get_exported_ EXPORT_SYMBOL(hwgraph_info_get_next_LBL); EXPORT_SYMBOL(hwgraph_info_export_LBL); EXPORT_SYMBOL(hwgraph_info_unexport_LBL); +EXPORT_SYMBOL(hwgraph_path_lookup); EXPORT_SYMBOL(hwgraph_traverse); EXPORT_SYMBOL(hwgraph_vertex_name_get); diff -Naurp -X /home/jbarnes/dontdiff 110-kill-endian-stuff.patch/arch/ia64/sn/io/hwgfs/hcl_util.c 120-hwgfs-update.patch/arch/ia64/sn/io/hwgfs/hcl_util.c --- 110-kill-endian-stuff.patch/arch/ia64/sn/io/hwgfs/hcl_util.c Mon Jan 5 21:08:40 2004 +++ 120-hwgfs-update.patch/arch/ia64/sn/io/hwgfs/hcl_util.c Tue Jan 6 12:19:19 2004 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. @@ -14,10 +13,8 @@ #include #include #include -#include #include #include -#include #include #include @@ -102,25 +99,19 @@ extern int maxcpus; void mark_cpuvertex_as_cpu(vertex_hdl_t vhdl, cpuid_t cpuid) { + char cpuid_buffer[10]; + if (cpuid == CPU_NONE) return; - (void)labelcl_info_add_LBL(vhdl, INFO_LBL_CPUID, INFO_DESC_EXPORT, - (arbitrary_info_t)cpuid); - { - char cpuid_buffer[10]; - - if (hwgraph_all_cpuids == GRAPH_VERTEX_NONE) { - (void)hwgraph_path_add( hwgraph_root, - EDGE_LBL_CPUNUM, - &hwgraph_all_cpuids); - } - - sprintf(cpuid_buffer, "%ld", cpuid); - (void)hwgraph_edge_add( hwgraph_all_cpuids, - vhdl, - cpuid_buffer); + if (hwgraph_all_cpuids == GRAPH_VERTEX_NONE) { + (void)hwgraph_path_add( hwgraph_root, + EDGE_LBL_CPUNUM, + &hwgraph_all_cpuids); } + + sprintf(cpuid_buffer, "%ld", cpuid); + (void)hwgraph_edge_add( hwgraph_all_cpuids, vhdl, cpuid_buffer); } /* @@ -161,25 +152,11 @@ mark_nodevertex_as_node(vertex_hdl_t vhd (void)hwgraph_edge_add( hwgraph_all_cnodes, vhdl, cnodeid_buffer); + HWGRAPH_DEBUG((__FILE__, __FUNCTION__, __LINE__, hwgraph_all_cnodes, NULL, "Creating path vhdl1\n")); } } /* -** If the specified device represents a CPU, return its cpuid; -** otherwise, return CPU_NONE. -*/ -cpuid_t -cpuvertex_to_cpuid(vertex_hdl_t vhdl) -{ - arbitrary_info_t cpuid = CPU_NONE; - - (void)labelcl_info_get_LBL(vhdl, INFO_LBL_CPUID, NULL, &cpuid); - - return((cpuid_t)cpuid); -} - - -/* ** dev_to_name converts a vertex_hdl_t into a canonical name. If the vertex_hdl_t ** represents a vertex in the hardware graph, it is converted in the ** normal way for vertices. If the vertex_hdl_t is an old vertex_hdl_t (one which @@ -197,4 +174,3 @@ dev_to_name(vertex_hdl_t dev, char *buf, return(vertex_to_name(dev, buf, buflen)); } - diff -Naurp -X /home/jbarnes/dontdiff 110-kill-endian-stuff.patch/arch/ia64/sn/io/hwgfs/interface.c 120-hwgfs-update.patch/arch/ia64/sn/io/hwgfs/interface.c --- 110-kill-endian-stuff.patch/arch/ia64/sn/io/hwgfs/interface.c Mon Jan 5 21:10:43 2004 +++ 120-hwgfs-update.patch/arch/ia64/sn/io/hwgfs/interface.c Tue Jan 6 12:19:19 2004 @@ -1,36 +1,12 @@ /* - * Copyright (c) 2003 Silicon Graphics, Inc. All Rights Reserved. + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. * * Portions based on Adam Richter's smalldevfs and thus * Copyright 2002-2003 Yggdrasil Computing, Inc. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + * Copyright (C) 2003 Silicon Graphics, Inc. All rights reserved. */ #include