From: Pat Gefre <pfg@sgi.com>

General xtalk.c clean up



---

 25-akpm/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c |   12 ----
 25-akpm/arch/ia64/sn/io/sn2/pciio.c           |   12 ----
 25-akpm/arch/ia64/sn/io/sn2/pic.c             |    1 
 25-akpm/arch/ia64/sn/io/sn2/xtalk.c           |   75 ++++++++++++--------------
 25-akpm/include/asm-ia64/sn/pci/pcibr.h       |    2 
 25-akpm/include/asm-ia64/sn/pci/pciio.h       |    5 -
 25-akpm/include/asm-ia64/sn/sn2/shubio.h      |    1 
 25-akpm/include/asm-ia64/sn/xtalk/xtalk.h     |    4 -
 8 files changed, 37 insertions(+), 75 deletions(-)

diff -puN arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c~sn24 arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c
--- 25/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	Thu Jan  8 15:18:57 2004
@@ -3782,20 +3782,8 @@ pciio_provider_t        pcibr_provider =
     (pciio_driver_reg_callback_f *) 0,
     (pciio_driver_unreg_callback_f *) 0,
     (pciio_device_unregister_f 	*) pcibr_device_unregister,
-    (pciio_dma_enabled_f		*) pcibr_dma_enabled,
 };
 
-int
-pcibr_dma_enabled(vertex_hdl_t pconn_vhdl)
-{
-    pciio_info_t            pciio_info = pciio_info_get(pconn_vhdl);
-    pcibr_soft_t            pcibr_soft = (pcibr_soft_t) pciio_info_mfast_get(pciio_info);
-	
-
-    return xtalk_dma_enabled(pcibr_soft->bs_conn);
-}
-
-
 /*
  * pcibr_debug() is used to print pcibr debug messages to the console.  A
  * user enables tracing by setting the following global variables:
diff -puN arch/ia64/sn/io/sn2/pciio.c~sn24 arch/ia64/sn/io/sn2/pciio.c
--- 25/arch/ia64/sn/io/sn2/pciio.c~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/pciio.c	Thu Jan  8 15:18:57 2004
@@ -91,12 +91,6 @@ get_master_baseio_nasid(void)
 }
 
 int
-hub_dma_enabled(vertex_hdl_t xconn_vhdl)
-{
-	return(0);
-}
-
-int
 hub_error_devenable(vertex_hdl_t xconn_vhdl, int devnum, int error_code)
 {
 	return(0);
@@ -1390,12 +1384,6 @@ pciio_slot_inuse(vertex_hdl_t pconn_vhdl
 }
 
 int
-pciio_dma_enabled(vertex_hdl_t pconn_vhdl)
-{
-	return DEV_FUNC(pconn_vhdl, dma_enabled)(pconn_vhdl);
-}
-
-int
 pciio_info_type1_get(pciio_info_t pci_info)
 {
 	return(0);
diff -puN arch/ia64/sn/io/sn2/pic.c~sn24 arch/ia64/sn/io/sn2/pic.c
--- 25/arch/ia64/sn/io/sn2/pic.c~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/pic.c	Thu Jan  8 15:18:57 2004
@@ -272,5 +272,4 @@ pciio_provider_t        pci_pic_provider
     (pciio_driver_reg_callback_f *) pcibr_driver_reg_callback,
     (pciio_driver_unreg_callback_f *) pcibr_driver_unreg_callback,
     (pciio_device_unregister_f 	*) pcibr_device_unregister,
-    (pciio_dma_enabled_f		*) pcibr_dma_enabled,
 };
diff -puN arch/ia64/sn/io/sn2/xtalk.c~sn24 arch/ia64/sn/io/sn2/xtalk.c
--- 25/arch/ia64/sn/io/sn2/xtalk.c~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/xtalk.c	Thu Jan  8 15:18:57 2004
@@ -21,9 +21,9 @@
 #include <asm/sn/xtalk/xtalk_private.h>
 
 /*
- * Implement crosstalk provider operations.  The xtalk* layer provides a
- * platform-independent interface for crosstalk devices.  This layer
- * switches among the possible implementations of a crosstalk adapter.
+ * Implement io channel provider operations.  The xtalk* layer provides a
+ * platform-independent interface for io channel devices.  This layer
+ * switches among the possible implementations of a io channel adapter.
  *
  * On platforms with only one possible xtalk provider, macros can be
  * set up at the top that cause the table lookups and indirections to
@@ -35,11 +35,6 @@
 
 char                    widget_info_fingerprint[] = "widget_info";
 
-#define	DEV_FUNC(dev,func)	hub_##func
-#define	CAST_PIOMAP(x)		((hub_piomap_t)(x))
-#define	CAST_DMAMAP(x)		((hub_dmamap_t)(x))
-#define	CAST_INTR(x)		((hub_intr_t)(x))
-
 /* =====================================================================
  *            Function Table of Contents
  */
@@ -119,6 +114,7 @@ char			*xwidget_name_get(vertex_hdl_t);
 #define	CAST_PIOMAP(x)		((xtalk_piomap_t)(x))
 #define	CAST_DMAMAP(x)		((xtalk_dmamap_t)(x))
 #define	CAST_INTR(x)		((xtalk_intr_t)(x))
+xtalk_provider_t * xwidget_info_pops_get(xwidget_info_t info);
 
 static xtalk_provider_t *
 xwidget_to_provider_fns(vertex_hdl_t xconn)
@@ -134,6 +130,17 @@ xwidget_to_provider_fns(vertex_hdl_t xco
 
     return (provider_fns);
 }
+
+xtalk_provider_t *
+xwidget_info_pops_get(xwidget_info_t info) {
+	vertex_hdl_t master = info->w_master;
+	xtalk_provider_t *provider_fns;
+
+	provider_fns = xtalk_provider_fns_get(master);
+
+	ASSERT(provider_fns != NULL);
+	return provider_fns;
+}
 #endif
 
 /*
@@ -271,13 +278,13 @@ xtalk_set_early_piotrans_addr(xtalk_earl
 }
 
 /* xtalk_early_piotrans_addr:
- * figure out a PIO address for the "nth" crosstalk widget that
+ * figure out a PIO address for the "nth" io channel widget that
  * matches the specified part and mfgr number. Returns NULL if
  * there is no such widget, or if the requested mapping can not
  * be constructed.
- * Limitations on which crosstalk slots (and busses) are
+ * Limitations on which io channel slots (and busses) are
  * checked, and definitions of the ordering of the search across
- * the crosstalk slots, are defined by the platform.
+ * the io channel slots, are defined by the platform.
  */
 caddr_t
 xtalk_early_piotrans_addr(xwidget_part_num_t part_num,
@@ -316,7 +323,7 @@ null_xtalk_early_piotrans_addr(xwidget_p
 /* =====================================================================
  *                    DMA MANAGEMENT
  *
- *      For mapping from crosstalk space to system
+ *      For mapping from io channel space to system
  *      physical space.
  */
 
@@ -413,7 +420,7 @@ xtalk_dmalist_drain(vertex_hdl_t dev, al
 /* =====================================================================
  *                    INTERRUPT MANAGEMENT
  *
- *      Allow crosstalk devices to establish interrupts
+ *      Allow io channel devices to establish interrupts
  */
 
 /*
@@ -508,8 +515,8 @@ xtalk_intr_cpu_get(xtalk_intr_t intr_hdl
  * This routine plays two roles during error delivery
  * to most widgets: first, the external agent (heart,
  * hub, or whatever) calls in with the error and the
- * connect point representing the crosstalk switch,
- * or whatever crosstalk device is directly connected
+ * connect point representing the io channel switch,
+ * or whatever io channel device is directly connected
  * to the agent.
  *
  * If there is a switch, it will generally look at the
@@ -526,6 +533,8 @@ xtalk_error_handler(
 		       ioerror_t *ioerror)
 {
     xwidget_info_t          xwidget_info;
+    char		    name[MAXDEVNAME];
+
 
     xwidget_info = xwidget_info_get(xconn);
     /* Make sure that xwidget_info is a valid pointer before derefencing it.
@@ -546,12 +555,7 @@ xtalk_error_handler(
 	(mode == MODE_DEVREENABLE))
 	return IOERROR_HANDLED;
 
-#if defined(SUPPORT_PRINTING_V_FORMAT)
-    printk(KERN_WARNING "Xbow at %v encountered Fatal error", xconn);
-#else
-    printk(KERN_WARNING "Xbow at 0x%p encountered Fatal error", (void *)xconn);
-#endif
-    ioerror_dump("xtalk", error_code, mode, ioerror);
+    printk(KERN_WARNING "Xbow at %s encountered Fatal error", vertex_to_name(xconn, name, MAXDEVNAME));
 
     return IOERROR_UNHANDLED;
 }
@@ -568,24 +572,22 @@ xtalk_error_devenable(vertex_hdl_t xconn
  */
 
 /*
- * Startup a crosstalk provider
+ * Startup an io channel provider
  */
 void
 xtalk_provider_startup(vertex_hdl_t xtalk_provider)
 {
-    DEV_FUNC(xtalk_provider, provider_startup)
-	(xtalk_provider);
+    ((xtalk_provider_t *) hwgraph_fastinfo_get(xtalk_provider))->provider_startup(xtalk_provider);
 }
 
 
 /*
- * Shutdown a crosstalk provider
+ * Shutdown an io channel provider
  */
 void
 xtalk_provider_shutdown(vertex_hdl_t xtalk_provider)
 {
-    DEV_FUNC(xtalk_provider, provider_shutdown)
-	(xtalk_provider);
+    ((xtalk_provider_t *) hwgraph_fastinfo_get(xtalk_provider))->provider_shutdown(xtalk_provider);
 }
 
 /* 
@@ -606,17 +608,12 @@ xtalk_widgetdev_shutdown(vertex_hdl_t xc
 	return;
 }
 
-int
-xtalk_dma_enabled(vertex_hdl_t xconn_vhdl)
-{
-    return DEV_FUNC(xconn_vhdl, dma_enabled) (xconn_vhdl);
-}
 /*
- * Generic crosstalk functions, for use with all crosstalk providers
- * and all crosstalk devices.
+ * Generic io channel functions, for use with all io channel providers
+ * and all io channel devices.
  */
 
-/****** Generic crosstalk interrupt interfaces ******/
+/* Generic io channel interrupt interfaces */
 vertex_hdl_t
 xtalk_intr_dev_get(xtalk_intr_t xtalk_intr)
 {
@@ -647,7 +644,7 @@ xtalk_intr_sfarg_get(xtalk_intr_t xtalk_
     return (xtalk_intr->xi_sfarg);
 }
 
-/****** Generic crosstalk pio interfaces ******/
+/* Generic io channel pio interfaces */
 vertex_hdl_t
 xtalk_pio_dev_get(xtalk_piomap_t xtalk_piomap)
 {
@@ -679,7 +676,7 @@ xtalk_pio_kvaddr_get(xtalk_piomap_t xtal
 }
 
 
-/****** Generic crosstalk dma interfaces ******/
+/* Generic io channel dma interfaces */
 vertex_hdl_t
 xtalk_dma_dev_get(xtalk_dmamap_t xtalk_dmamap)
 {
@@ -693,7 +690,7 @@ xtalk_dma_target_get(xtalk_dmamap_t xtal
 }
 
 
-/****** Generic crosstalk widget information interfaces ******/
+/* Generic io channel widget information interfaces */
 
 /* xwidget_info_chk:
  * check to see if this vertex is a widget;
@@ -795,7 +792,7 @@ xwidget_info_name_get(xwidget_info_t xwi
 	panic("xwidget_info_name_get: null xwidget_info");
     return(xwidget_info->w_name);
 }
-/****** Generic crosstalk initialization interfaces ******/
+/* Generic io channel initialization interfaces */
 
 /*
  * Associate a set of xtalk_provider functions with a vertex.
diff -puN include/asm-ia64/sn/pci/pcibr.h~sn24 include/asm-ia64/sn/pci/pcibr.h
--- 25/include/asm-ia64/sn/pci/pcibr.h~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/include/asm-ia64/sn/pci/pcibr.h	Thu Jan  8 15:18:57 2004
@@ -237,7 +237,7 @@ void			pcibr_set_rrb_callback(vertex_hdl
 					       rrb_alloc_funct_f *func);
 
 extern int		pcibr_device_unregister(vertex_hdl_t);
-extern int		pcibr_dma_enabled(vertex_hdl_t);
+
 /*
  * Bridge-specific flags that can be set via pcibr_device_flags_set
  * and cleared via pcibr_device_flags_clear.  Other flags are
diff -puN include/asm-ia64/sn/pci/pciio.h~sn24 include/asm-ia64/sn/pci/pciio.h
--- 25/include/asm-ia64/sn/pci/pciio.h~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/include/asm-ia64/sn/pci/pciio.h	Thu Jan  8 15:18:57 2004
@@ -451,9 +451,6 @@ pciio_driver_unreg_callback_f	(vertex_hd
 typedef int
 pciio_device_unregister_f	(vertex_hdl_t conn);
 
-typedef int
-pciio_dma_enabled_f		(vertex_hdl_t conn);
-
 /*
  * Adapters that provide a PCI interface adhere to this software interface.
  */
@@ -502,7 +499,6 @@ typedef struct pciio_provider_s {
     pciio_driver_reg_callback_f *driver_reg_callback;
     pciio_driver_unreg_callback_f *driver_unreg_callback;
     pciio_device_unregister_f 	*device_unregister;
-    pciio_dma_enabled_f		*dma_enabled;
 } pciio_provider_t;
 
 /* PCI devices use these standard PCI provider interfaces */
@@ -702,7 +698,6 @@ extern iopaddr_t	pciio_info_rom_base_get
 extern size_t		pciio_info_rom_size_get(pciio_info_t);
 extern int		pciio_info_type1_get(pciio_info_t);
 extern int              pciio_error_handler(vertex_hdl_t, int, ioerror_mode_t, ioerror_t *);
-extern int		pciio_dma_enabled(vertex_hdl_t);
 
 /**
  * sn_pci_set_vchan - Set the requested Virtual Channel bits into the mapped DMA
diff -puN include/asm-ia64/sn/sn2/shubio.h~sn24 include/asm-ia64/sn/sn2/shubio.h
--- 25/include/asm-ia64/sn/sn2/shubio.h~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/include/asm-ia64/sn/sn2/shubio.h	Thu Jan  8 15:18:57 2004
@@ -3626,7 +3626,6 @@ extern int hub_ioerror_handler(vertex_hd
 extern int kl_ioerror_handler(cnodeid_t, cnodeid_t, cpuid_t,
                               int, paddr_t, caddr_t, ioerror_mode_t);
 extern int hub_error_devenable(vertex_hdl_t, int, int);
-extern int  hub_dma_enabled(vertex_hdl_t);
 
 #endif /* __ASSEMBLY__ */
 #endif /* _KERNEL */
diff -puN include/asm-ia64/sn/xtalk/xtalk.h~sn24 include/asm-ia64/sn/xtalk/xtalk.h
--- 25/include/asm-ia64/sn/xtalk/xtalk.h~sn24	Thu Jan  8 15:18:57 2004
+++ 25-akpm/include/asm-ia64/sn/xtalk/xtalk.h	Thu Jan  8 15:18:57 2004
@@ -234,9 +234,6 @@ xtalk_widgetdev_enable_f (vertex_hdl_t, 
 typedef void
 xtalk_widgetdev_shutdown_f (vertex_hdl_t, int);
 
-typedef int
-xtalk_dma_enabled_f (vertex_hdl_t);
-
 /* Error Management */
 
 typedef int
@@ -317,7 +314,6 @@ extern xtalk_provider_startup_f xtalk_pr
 extern xtalk_provider_shutdown_f xtalk_provider_shutdown;
 extern xtalk_widgetdev_enable_f xtalk_widgetdev_enable;
 extern xtalk_widgetdev_shutdown_f xtalk_widgetdev_shutdown;
-extern xtalk_dma_enabled_f xtalk_dma_enabled;
 extern xtalk_error_devenable_f xtalk_error_devenable;
 extern xtalk_early_piotrans_addr_f xtalk_early_piotrans_addr;
 

_