
From: Pat Gefre <pfg@sgi.com>

arch/ia64/sn/io/io.c@1.12
    misc code cleanup
    no parens on returns
    remove __psunsigned_t

arch/ia64/sn/io/sn2/ml_iograph.c@1.18
    no parens on returns

arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c@1.25
    no parens on returns
    use -errno

arch/ia64/sn/io/sn2/pcibr/pcibr_hints.c@1.8
    no parens on returns

arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c@1.15
    no parens on returns
    unsigned to unsigned int

arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c@1.13
    no parens on returns
    use -errno

arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c@1.18
    no parens on returns
    use -errno

arch/ia64/sn/io/sn2/pciio.c@1.14
    oom handling
    removed ASSERT and funcs not needed

arch/ia64/sn/io/sn2/pic.c@1.13
    use -errno

arch/ia64/sn/io/sn2/shuberror.c@1.12
    add delay.h

arch/ia64/sn/io/sn2/xbow.c@1.10
    include file clean up

arch/ia64/sn/io/sn2/xtalk.c@1.9
    misc code cleanup
    no parens on returns

arch/ia64/sn/io/xswitch.c@1.11
    misc code cleanup

arch/ia64/sn/kernel/bte.c@1.5
    include file clean up

arch/ia64/sn/kernel/mca.c@1.8
    include file clean up

arch/ia64/sn/kernel/probe.c@1.5
    include file clean up

arch/ia64/sn/kernel/sn2/prominfo_proc.c@1.3
    include file clean up

arch/ia64/sn/kernel/sn2/sn2_smp.c@1.9
    include file clean up

arch/ia64/sn/kernel/sn2/sn_proc_fs.c@1.4
    include file clean up

drivers/char/sn_serial.c@1.3
    include file clean up

include/asm-ia64/sn/addrs.h@1.8
    include file clean up
    remove __psunsigned_t

include/asm-ia64/sn/alenlist.h@1.8
    unsigned to unsigned int

include/asm-ia64/sn/arch.h@1.7
    include file clean up

include/asm-ia64/sn/bte.h@1.6
    include file clean up

include/asm-ia64/sn/clksupport.h@1.8
    include file clean up

include/asm-ia64/sn/driver.h@1.5
    remove __psunsigned_t

include/asm-ia64/sn/hcl.h@1.13
    include file clean up

include/asm-ia64/sn/hcl_util.h@1.7
    include file clean up

include/asm-ia64/sn/hwgfs.h@1.5
    include file clean up

include/asm-ia64/sn/iograph.h@1.9
    include file clean up

include/asm-ia64/sn/klconfig.h@1.14
    remove __psunsigned_t

include/asm-ia64/sn/kldir.h@1.5
    remove __psunsigned_t
    include file clean up

include/asm-ia64/sn/module.h@1.12
    include file clean up

include/asm-ia64/sn/nodepda.h@1.14
    include file clean up

include/asm-ia64/sn/pci/bridge.h@1.13
    uchar_t to unsigned char

include/asm-ia64/sn/pci/pcibr_private.h@1.20
    move PVnnnnnn's

include/asm-ia64/sn/pci/pciio.h@1.14
    unsigned to unsigned int

include/asm-ia64/sn/pci/pciio_private.h@1.10
    unsigned to unsigned int

include/asm-ia64/sn/pda.h@1.9
    include file clean up

include/asm-ia64/sn/pio.h@1.7
    include file clean up
    ulong to unsigned long

include/asm-ia64/sn/sgi.h@1.11
    include file clean up
    move PVnnnnnn's to here

include/asm-ia64/sn/sn2/arch.h@1.6
    include file clean up

include/asm-ia64/sn/sn2/sn_private.h@1.12
    include file clean up
    remove __psunsigned_t

include/asm-ia64/sn/sn_cpuid.h@1.8
    include file clean up

include/asm-ia64/sn/sn_private.h@1.6
    include file clean up

include/asm-ia64/sn/types.h@1.6
    include file clean up
    remove __psunsigned_t

include/asm-ia64/sn/vector.h@1.6
    include file clean up

include/asm-ia64/sn/xtalk/xbow.h@1.9
    include file clean up
    misc code cleanup

include/asm-ia64/sn/xtalk/xtalk.h@1.12
    unsigned to unsigned int

include/asm-ia64/sn/xtalk/xwidget.h@1.8
    unsigned to unsigned int



---

 arch/ia64/sn/io/io.c                    |   42 ++++++++--------
 arch/ia64/sn/io/sn2/ml_iograph.c        |    7 +-
 arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c   |   38 ++++++--------
 arch/ia64/sn/io/sn2/pcibr/pcibr_hints.c |    7 +-
 arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c  |    8 +--
 arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c   |   12 ++--
 arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c  |   82 ++++++++++++++++----------------
 arch/ia64/sn/io/sn2/pciio.c             |   12 +---
 arch/ia64/sn/io/sn2/pic.c               |    6 +-
 arch/ia64/sn/io/sn2/shuberror.c         |    1 
 arch/ia64/sn/io/sn2/xbow.c              |    4 +
 arch/ia64/sn/io/sn2/xtalk.c             |   18 ++-----
 arch/ia64/sn/io/xswitch.c               |   10 ++-
 arch/ia64/sn/kernel/bte.c               |    2 
 arch/ia64/sn/kernel/mca.c               |    1 
 arch/ia64/sn/kernel/probe.c             |    1 
 arch/ia64/sn/kernel/sn2/prominfo_proc.c |    1 
 arch/ia64/sn/kernel/sn2/sn2_smp.c       |    1 
 arch/ia64/sn/kernel/sn2/sn_proc_fs.c    |    1 
 drivers/char/sn_serial.c                |    1 
 include/asm-ia64/sn/addrs.h             |    4 -
 include/asm-ia64/sn/alenlist.h          |   18 +++----
 include/asm-ia64/sn/arch.h              |    7 --
 include/asm-ia64/sn/bte.h               |    3 -
 include/asm-ia64/sn/clksupport.h        |    2 
 include/asm-ia64/sn/driver.h            |    2 
 include/asm-ia64/sn/hcl.h               |    2 
 include/asm-ia64/sn/hcl_util.h          |    2 
 include/asm-ia64/sn/hwgfs.h             |    3 +
 include/asm-ia64/sn/iograph.h           |    1 
 include/asm-ia64/sn/klconfig.h          |    8 +--
 include/asm-ia64/sn/kldir.h             |    4 -
 include/asm-ia64/sn/module.h            |    2 
 include/asm-ia64/sn/nodepda.h           |    4 -
 include/asm-ia64/sn/pci/bridge.h        |   16 +++---
 include/asm-ia64/sn/pci/pcibr_private.h |   15 -----
 include/asm-ia64/sn/pci/pciio.h         |   20 +++----
 include/asm-ia64/sn/pci/pciio_private.h |    6 +-
 include/asm-ia64/sn/pda.h               |    3 -
 include/asm-ia64/sn/pio.h               |    6 --
 include/asm-ia64/sn/sgi.h               |   17 +++++-
 include/asm-ia64/sn/sn2/arch.h          |    3 -
 include/asm-ia64/sn/sn2/sn_private.h    |   12 +---
 include/asm-ia64/sn/sn_cpuid.h          |    6 --
 include/asm-ia64/sn/sn_private.h        |    5 -
 include/asm-ia64/sn/types.h             |    8 ---
 include/asm-ia64/sn/vector.h            |    2 
 include/asm-ia64/sn/xtalk/xbow.h        |   19 -------
 include/asm-ia64/sn/xtalk/xtalk.h       |   16 +++---
 include/asm-ia64/sn/xtalk/xwidget.h     |   26 +++++-----
 50 files changed, 230 insertions(+), 267 deletions(-)

diff -puN arch/ia64/sn/io/io.c~altix-02 arch/ia64/sn/io/io.c
--- 25/arch/ia64/sn/io/io.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/io.c	2004-02-02 23:19:38.000000000 -0800
@@ -6,9 +6,9 @@
  * Copyright (C) 1992-1997, 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/slab.h>
+#include <linux/sched.h>
 #include <asm/sn/types.h>
 #include <asm/sn/sgi.h>
 #include <asm/sn/driver.h>
@@ -123,7 +123,7 @@ hub_piomap_alloc(vertex_hdl_t dev,	/* se
 
 	/* sanity check */
 	if (byte_count_max > byte_count)
-		return(NULL);
+		return NULL;
 
 	hubinfo_get(hubv, &hubinfo);
 
@@ -152,7 +152,7 @@ hub_piomap_alloc(vertex_hdl_t dev,	/* se
 	 * For now, reject requests that span big windows.
 	 */
 	if ((xtalk_addr % BWIN_SIZE) + byte_count > BWIN_SIZE)
-		return(NULL);
+		return NULL;
 
 
 	/* Round xtalk address down for big window alignement */
@@ -184,7 +184,7 @@ tryagain:
 		     widget == bw_piomap->hpio_xtalk_info.xp_target) {
 			bw_piomap->hpio_holdcnt++;
 			spin_unlock(&hubinfo->h_bwlock);
-			return(bw_piomap);
+			return bw_piomap;
 		}
 	}
 
@@ -264,7 +264,7 @@ tryagain:
 
 done:
 	spin_unlock(&hubinfo->h_bwlock);
-	return(bw_piomap);
+	return bw_piomap;
 }
 
 /*
@@ -330,18 +330,18 @@ hub_piomap_addr(hub_piomap_t hub_piomap,
 {
 	/* Verify that range can be mapped using the specified piomap */
 	if (xtalk_addr < hub_piomap->hpio_xtalk_info.xp_xtalk_addr)
-		return(0);
+		return 0;
 
 	if (xtalk_addr + byte_count > 
 		( hub_piomap->hpio_xtalk_info.xp_xtalk_addr + 
 			hub_piomap->hpio_xtalk_info.xp_mapsz))
-		return(0);
+		return 0;
 
 	if (hub_piomap->hpio_flags & HUB_PIOMAP_IS_VALID)
-		return(hub_piomap->hpio_xtalk_info.xp_kvaddr + 
-			(xtalk_addr % hub_piomap->hpio_xtalk_info.xp_mapsz));
+		return hub_piomap->hpio_xtalk_info.xp_kvaddr + 
+			(xtalk_addr % hub_piomap->hpio_xtalk_info.xp_mapsz);
 	else
-		return(0);
+		return 0;
 }
 
 
@@ -388,9 +388,9 @@ hub_piotrans_addr(	vertex_hdl_t dev,	/* 
 			addr = (caddr_t)iaddr;
 		}
 #endif
-		return(addr);
+		return addr;
 	} else
-		return(0);
+		return 0;
 }
 
 
@@ -425,7 +425,7 @@ hub_dmamap_alloc(	vertex_hdl_t dev,	/* s
  	if (flags & XTALK_FIXED)
 		dmamap->hdma_flags |= HUB_DMAMAP_IS_FIXED;
 
-	return(dmamap);
+	return dmamap;
 }
 
 /*
@@ -467,7 +467,7 @@ hub_dmamap_addr(	hub_dmamap_t dmamap,	/*
 	}
 
 	/* There isn't actually any DMA mapping hardware on the hub. */
-        return( (PHYS_TO_DMA(paddr)) );
+        return (PHYS_TO_DMA(paddr));
 }
 
 /*
@@ -497,7 +497,7 @@ hub_dmamap_list(hub_dmamap_t hub_dmamap,
 	}
 
 	/* There isn't actually any DMA mapping hardware on the hub.  */
-	return(palenlist);
+	return palenlist;
 }
 
 /*
@@ -532,7 +532,7 @@ hub_dmatrans_addr(	vertex_hdl_t dev,	/* 
 			size_t byte_count,	/* length */
 			unsigned flags)		/* defined in dma.h */
 {
-	return( (PHYS_TO_DMA(paddr)) );
+	return (PHYS_TO_DMA(paddr));
 }
 
 /*
@@ -549,7 +549,7 @@ hub_dmatrans_list(	vertex_hdl_t dev,	/* 
 {
 	BUG();
 	/* no translation needed */
-	return(palenlist);
+	return palenlist;
 }
 
 /*ARGSUSED*/
@@ -609,8 +609,8 @@ hub_check_is_widget0(void *addr)
 {
 	nasid_t nasid = NASID_GET(addr);
 
-	if (((__psunsigned_t)addr >= RAW_NODE_SWIN_BASE(nasid, 0)) &&
-	    ((__psunsigned_t)addr < RAW_NODE_SWIN_BASE(nasid, 1)))
+	if (((unsigned long)addr >= RAW_NODE_SWIN_BASE(nasid, 0)) &&
+	    ((unsigned long)addr < RAW_NODE_SWIN_BASE(nasid, 1)))
 		return 1;
 	return 0;
 }
@@ -626,8 +626,8 @@ hub_check_window_equiv(void *addra, void
 		return 1;
 
 	/* XXX - Assume this is really a small window address */
-	if (WIDGETID_GET((__psunsigned_t)addra) ==
-	    WIDGETID_GET((__psunsigned_t)addrb))
+	if (WIDGETID_GET((unsigned long)addra) ==
+	    WIDGETID_GET((unsigned long)addrb))
 		return 1;
 
 	return 0;
diff -puN arch/ia64/sn/io/sn2/ml_iograph.c~altix-02 arch/ia64/sn/io/sn2/ml_iograph.c
--- 25/arch/ia64/sn/io/sn2/ml_iograph.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/ml_iograph.c	2004-02-02 23:19:38.000000000 -0800
@@ -46,8 +46,9 @@ xswitch_vertex_init(vertex_hdl_t xswitch
 	int rc;
 
 	xvolinfo = kmalloc(sizeof(struct xswitch_vol_s), GFP_KERNEL);
-	if (xvolinfo <= 0 ) {
-		printk("xswitch_vertex_init: out of memory\n");
+	if (!xvolinfo) {
+		printk(KERN_WARNING "xswitch_vertex_init(): Unable to "
+			"allocate memory\n");
 		return;
 	}
        	memset(xvolinfo, 0, sizeof(struct xswitch_vol_s));
@@ -763,7 +764,7 @@ io_brick_map_widget(int brick_type, int 
         /* 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 io_brick_tab[i].ibm_map_wid[widget_num];
         }
 
         return 0;
diff -puN arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c~altix-02 arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c
--- 25/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	2004-02-02 23:19:38.000000000 -0800
@@ -37,7 +37,7 @@ static int	   pcibr_debug_slot = -1;		/*
 
 
 #if PCIBR_SOFT_LIST
-pcibr_list_p            pcibr_list = 0;
+pcibr_list_p            pcibr_list;
 #endif
 
 extern char *pci_space[];
@@ -402,7 +402,7 @@ pcibr_mmap(struct file * file, struct vm
         error = io_remap_page_range(vma, phys_addr, vma->vm_start,
 				    vma->vm_end - vma->vm_start,
 				    vma->vm_page_prot);
-	return(error);
+	return error;
 }
 
 /*
@@ -594,7 +594,7 @@ pcibr_device_unregister(vertex_hdl_t pco
     if (error_call)
         error = error_call;
 
-    return(error);
+    return error;
     
 }
 
@@ -694,7 +694,7 @@ pcibr_detach(vertex_hdl_t xconn)
 
     /* Get the bridge vertex from its xtalk connection point */
     if (hwgraph_traverse(xconn, EDGE_LBL_PCI, &pcibr_vhdl) != GRAPH_SUCCESS)
-	return(1);
+	return 1;
 
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
@@ -728,12 +728,8 @@ pcibr_detach(vertex_hdl_t xconn)
 
     /* Remove the Bridge revision labelled info */
     (void)hwgraph_info_remove_LBL(pcibr_vhdl, INFO_LBL_PCIBR_ASIC_REV, NULL);
-    /* Remove the character device associated with this bridge */
-    hwgraph_edge_remove(pcibr_vhdl, EDGE_LBL_CONTROLLER, NULL);
-    /* Remove the PCI bridge vertex */
-    hwgraph_edge_remove(xconn, EDGE_LBL_PCI, NULL);
 
-    return(0);
+    return 0;
 }
 
 
@@ -1317,7 +1313,7 @@ pcibr_piomap_addr(pcibr_piomap_t pcibr_p
                 "pcibr_piomap_addr: map=0x%lx, addr=0x%lx\n", 
 		pcibr_piomap, addr));
 
-    return(addr);
+    return addr;
 }
 
 /*ARGSUSED */
@@ -1358,7 +1354,7 @@ pcibr_piotrans_addr(vertex_hdl_t pconn_v
     PCIBR_DEBUG((PCIBR_DEBUG_PIODIR, pconn_vhdl,
 		"pcibr_piotrans_addr: xio_addr=0x%lx, addr=0x%lx\n",
 		xio_addr, addr));
-    return(addr);
+    return addr;
 }
 
 /*
@@ -1624,7 +1620,7 @@ pcibr_flags_to_d64(unsigned flags, pcibr
 	attributes &= (PCI64_ATTR_BAR | PCI64_ATTR_SWAP);
     }
 
-    return (attributes);
+    return attributes;
 }
 
 /*ARGSUSED */
@@ -2090,7 +2086,7 @@ pcibr_get_dmatrans_node(vertex_hdl_t pco
 	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(NASID_TO_COMPACT_NODEID(NASID_GET(pcibr_soft->bs_dir_xbase)));
+	return NASID_TO_COMPACT_NODEID(NASID_GET(pcibr_soft->bs_dir_xbase));
 }
 
 /*ARGSUSED */
@@ -2179,7 +2175,7 @@ pcibr_dmatrans_addr(vertex_hdl_t pconn_v
 			"pcibr_dmatrans_addr:  wanted paddr [0x%lx..0x%lx], "
 			"xio_port=0x%x, direct64: pci_addr=0x%lx\n",
 			paddr, paddr + req_size - 1, xio_addr, pci_addr));
-	    return (pci_addr);
+	    return pci_addr;
 	}
 	if (!pcibr_try_set_device(pcibr_soft, pciio_slot, flags, BRIDGE_DEV_D64_BITS)) {
 	    pci_addr = pcibr_flags_to_d64(flags, pcibr_soft);
@@ -2210,7 +2206,7 @@ pcibr_dmatrans_addr(vertex_hdl_t pconn_v
 			"xio_port=0x%x, direct64: pci_addr=0x%lx, "
 			"new flags: 0x%x\n", paddr, paddr + req_size - 1,
 			xio_addr, pci_addr, (uint64_t) flags));
-	    return (pci_addr);
+	    return pci_addr;
 	}
 
 	PCIBR_DEBUG((PCIBR_DEBUG_DMADIR, pconn_vhdl,
@@ -2263,7 +2259,7 @@ pcibr_dmatrans_addr(vertex_hdl_t pconn_v
                             " xio_port=0x%x, direct32: pci_addr=0x%lx\n",
                             paddr, paddr + req_size - 1, xio_addr, pci_addr));
 
-		return (pci_addr);
+		return pci_addr;
 	    }
 	    if (!pcibr_try_set_device(pcibr_soft, pciio_slot, flags, BRIDGE_DEV_D32_BITS)) {
 
@@ -2292,7 +2288,7 @@ pcibr_dmatrans_addr(vertex_hdl_t pconn_v
 			    "new flags: 0x%x\n", paddr, paddr + req_size - 1,
 			    xio_addr, pci_addr, (uint64_t) flags));
 
-		return (pci_addr);
+		return pci_addr;
 	    }
 	    /* our flags conflict with Device(x).
 	     */
@@ -2349,7 +2345,7 @@ pcibr_dmalist_drain(vertex_hdl_t pconn_v
 iopaddr_t
 pcibr_dmamap_pciaddr_get(pcibr_dmamap_t pcibr_dmamap)
 {
-    return (pcibr_dmamap->bd_pci_addr);
+    return pcibr_dmamap->bd_pci_addr;
 }
 
 /* =====================================================================
@@ -2486,7 +2482,7 @@ pcibr_device_flags_set(vertex_hdl_t pcon
 		    "pcibr_device_flags_set: Device(%d): 0x%x\n",
 		    pciio_slot, devreg));
     }
-    return (1);
+    return 1;
 }
 
 /*
@@ -2529,10 +2525,10 @@ pcibr_pcix_rbars_calc(pcibr_soft_t pcibr
 	    percent_allowed=(percent_allowed > 100) ? 100 : percent_allowed+1;
 	}
     } else {
-	return(ENODEV);
+	return -ENODEV;
     }
 
-    return(percent_allowed);
+    return percent_allowed;
 }
 
 /*
diff -puN arch/ia64/sn/io/sn2/pcibr/pcibr_hints.c~altix-02 arch/ia64/sn/io/sn2/pcibr/pcibr_hints.c
--- 25/arch/ia64/sn/io/sn2/pcibr/pcibr_hints.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/pcibr/pcibr_hints.c	2004-02-02 23:19:38.000000000 -0800
@@ -33,8 +33,11 @@ pcibr_hints_get(vertex_hdl_t xconn_vhdl,
     if (alloc && (rv != GRAPH_SUCCESS)) {
 
 	hint = kmalloc(sizeof (*(hint)), GFP_KERNEL);
-	if ( !hint )
+	if ( !hint ) {
+		printk(KERN_WARNING "pcibr_hints_get(): unable to allocate "
+			"memory\n");
 		goto abnormal_exit;
+	}
 	memset(hint, 0, sizeof (*(hint)));
 
 	hint->rrb_alloc_funct = NULL;
@@ -57,7 +60,7 @@ pcibr_hints_get(vertex_hdl_t xconn_vhdl,
 
 abnormal_exit:
     kfree(hint);
-    return(NULL);
+    return NULL;
 
 }
 
diff -puN arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c~altix-02 arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c
--- 25/arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c	2004-02-02 23:19:38.000000000 -0800
@@ -25,14 +25,14 @@ compare_and_swap_ptr(void **location, vo
 	/* FIXME - compare_and_swap_ptr NOT ATOMIC */
 	if (*location == old_ptr) {
 		*location = new_ptr;
-		return(1);
+		return 1;
 	}
 	else
-		return(0);
+		return 0;
 }
 #endif
 
-unsigned		pcibr_intr_bits(pciio_info_t info, pciio_intr_line_t lines, int nslots);
+unsigned int		pcibr_intr_bits(pciio_info_t info, pciio_intr_line_t lines, int nslots);
 pcibr_intr_t            pcibr_intr_alloc(vertex_hdl_t, device_desc_t, pciio_intr_line_t, vertex_hdl_t);
 void                    pcibr_intr_free(pcibr_intr_t);
 void              pcibr_setpciint(xtalk_intr_t);
@@ -49,7 +49,7 @@ extern pcibr_info_t      pcibr_info_get(
  *    INTERRUPT MANAGEMENT
  */
 
-unsigned
+unsigned int
 pcibr_intr_bits(pciio_info_t info,
 		pciio_intr_line_t lines, int nslots)
 {
diff -puN arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c~altix-02 arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c
--- 25/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c	2004-02-02 23:19:38.000000000 -0800
@@ -427,7 +427,7 @@ pcibr_wrb_flush(vertex_hdl_t pconn_vhdl)
 
     pcireg_wrb_flush_get(pcibr_soft, pciio_slot);
 
-    return(0);
+    return 0;
 }
 
 /*
@@ -710,10 +710,10 @@ pcibr_slot_initial_rrb_alloc(vertex_hdl_
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
     if (!pcibr_soft)
-	return(-EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(-EINVAL);
+	return -EINVAL;
 
     /* How many RRBs are on this slot? */
     vchan_total = NUMBER_VCHANNELS;
@@ -747,7 +747,7 @@ pcibr_slot_initial_rrb_alloc(vertex_hdl_
 
         pcibr_soft->bs_rrb_valid[slot][3] = chan[3];
 
-        return(-ENODEV);
+        return -ENODEV;
     }
 
     if ((pcibr_info->f_vendor == PCIIO_VENDOR_ID_NONE) &&
@@ -758,13 +758,13 @@ pcibr_slot_initial_rrb_alloc(vertex_hdl_
 	for (vchan = 0; vchan < vchan_total; vchan++) 
 	    pcibr_soft->bs_rrb_valid[slot][vchan] = 0;
 
-	return(-ENODEV);
+	return -ENODEV;
     }
 
     for (vchan = 0; vchan < vchan_total; vchan++)
         pcibr_soft->bs_rrb_valid[slot][vchan] = chan[vchan];
 
-    return(0);
+    return 0;
 }
 
 
diff -puN arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c~altix-02 arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c
--- 25/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c	2004-02-02 23:19:38.000000000 -0800
@@ -95,23 +95,23 @@ pcibr_slot_info_init(vertex_hdl_t 	pcibr
     /* Get the basic software information required to proceed */
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
     if (!pcibr_soft)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     /* If we have a host slot (eg:- IOC3 has 2 PCI slots and the initialization
      * is done by the host slot then we are done.
      */
     if (pcibr_soft->bs_slot[slot].has_host) {
-	return(0);    
+	return 0;
     }
 
     /* Try to read the device-id/vendor-id from the config space */
     cfgw = pcibr_slot_config_addr(pcibr_soft, slot, 0);
 
     if (pcibr_probe_slot(pcibr_soft, cfgw, &idword)) 
-	return(ENODEV);
+	return -ENODEV;
 
     slotp = &pcibr_soft->bs_slot[slot];
     slotp->slot_status |= SLOT_POWER_UP;
@@ -127,7 +127,7 @@ pcibr_slot_info_init(vertex_hdl_t 	pcibr
      * and we are done.
      */
     if (vendor == 0xFFFF) 
-	return(ENODEV);			
+	return -ENODEV;
     
     htype = do_pcibr_config_get(cfgw, PCI_CFG_HEADER_TYPE, 1);
     nfunc = 1;
@@ -158,7 +158,7 @@ pcibr_slot_info_init(vertex_hdl_t 	pcibr
     }
     pcibr_infoh = kmalloc(nfunc*sizeof (*(pcibr_infoh)), GFP_KERNEL);
     if ( !pcibr_infoh ) {
-	return ENOMEM;
+	return -ENOMEM;
     }
     memset(pcibr_infoh, 0, nfunc*sizeof (*(pcibr_infoh)));
     
@@ -428,7 +428,7 @@ pcibr_slot_info_init(vertex_hdl_t 	pcibr
 	}				/* next win */
     }				/* next func */
 
-    return(0);
+    return 0;
 }					
 
 /*
@@ -447,7 +447,7 @@ pcibr_find_capability(cfg_p	cfgw,
 
     /* Check to see if there is a capabilities pointer in the cfg header */
     if (!(do_pcibr_config_get(cfgw, PCI_CFG_STATUS, 2) & PCI_STAT_CAP_LIST)) {
-	return (NULL);
+	return NULL;
     }
 
     /*
@@ -462,13 +462,13 @@ pcibr_find_capability(cfg_p	cfgw,
     while (cap_nxt && (defend_against_circular_linkedlist <= 48)) {
 	cap_id = do_pcibr_config_get(cfgw, cap_nxt, 1);
 	if (cap_id == capability) {
-	    return ((cfg_p)((char *)cfgw + cap_nxt));
+	    return (cfg_p)((char *)cfgw + cap_nxt);
 	}
 	cap_nxt = (do_pcibr_config_get(cfgw, cap_nxt+1, 1) & 0xfc);
 	defend_against_circular_linkedlist++;
     }
 
-    return (NULL);
+    return NULL;
 }
 
 /*
@@ -487,10 +487,10 @@ pcibr_slot_info_free(vertex_hdl_t pcibr_
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
     if (!pcibr_soft)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     nfunc = pcibr_soft->bs_slot[slot].bss_ninfo;
 
@@ -500,7 +500,7 @@ pcibr_slot_info_free(vertex_hdl_t pcibr_
     kfree(pcibr_infoh);
     pcibr_soft->bs_slot[slot].bss_ninfo = 0;
 
-    return(0);
+    return 0;
 }
 
 /*
@@ -517,13 +517,13 @@ pcibr_slot_pcix_rbar_init(pcibr_soft_t p
     int			 func;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     if ((nfunc = pcibr_soft->bs_slot[slot].bss_ninfo) < 1)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!(pcibr_infoh = pcibr_soft->bs_slot[slot].bss_infos))
-	return(EINVAL);
+	return -EINVAL;
 
     PCIBR_DEBUG_ALWAYS((PCIBR_DEBUG_RBAR, pcibr_soft->bs_vhdl,
 		"pcibr_slot_pcix_rbar_init for slot %d\n", 
@@ -595,7 +595,7 @@ pcibr_slot_pcix_rbar_init(pcibr_soft_t p
 		pcibr_soft->bs_pcix_rbar_inuse,
 		pcibr_soft->bs_pcix_rbar_avail));
     }
-    return(0);
+    return 0;
 }
 
 int as_debug = 0;
@@ -623,26 +623,26 @@ pcibr_slot_addr_space_init(vertex_hdl_t 
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
     if (!pcibr_soft)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     /* allocate address space,
      * for windows that have not been
      * previously assigned.
      */
     if (pcibr_soft->bs_slot[slot].has_host) {
-	return(0);
+	return 0;
     }
 
     nfunc = pcibr_soft->bs_slot[slot].bss_ninfo;
     if (nfunc < 1)
-	return(EINVAL);
+	return -EINVAL;
 
     pcibr_infoh = pcibr_soft->bs_slot[slot].bss_infos;
     if (!pcibr_infoh)
-	return(EINVAL);
+	return -EINVAL;
 
     /*
      * Try to make the DevIO windows not
@@ -827,7 +827,7 @@ pcibr_slot_addr_space_init(vertex_hdl_t 
 	    do_pcibr_config_set(cfgw, PCI_CFG_COMMAND, 4, 
 				pci_cfg_cmd_reg | pci_cfg_cmd_reg_add);
     }				/* next func */
-    return(rc);
+    return rc;
 }
 
 /*
@@ -845,10 +845,10 @@ pcibr_slot_device_init(vertex_hdl_t pcib
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
     if (!pcibr_soft)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     /*
      * Adjustments to Device(x) and init of bss_device shadow
@@ -878,7 +878,7 @@ pcibr_slot_device_init(vertex_hdl_t pcib
     PCIBR_DEBUG_ALWAYS((PCIBR_DEBUG_DEVREG, pcibr_vhdl,
 		"pcibr_slot_device_init: Device(%d): 0x%x\n",
 		slot, devreg));
-    return(0);
+    return 0;
 }
 
 /*
@@ -897,10 +897,10 @@ pcibr_slot_guest_info_init(vertex_hdl_t 
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
     if (!pcibr_soft)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     slotp = &pcibr_soft->bs_slot[slot];
 
@@ -912,7 +912,7 @@ pcibr_slot_guest_info_init(vertex_hdl_t 
     if (pcibr_soft->bs_slot[slot].bss_ninfo < 1) {
 	pcibr_infoh = kmalloc(sizeof (*(pcibr_infoh)), GFP_KERNEL);
 	if ( !pcibr_infoh ) {
-		return ENOMEM;
+		return -ENOMEM;
 	}
 	memset(pcibr_infoh, 0, sizeof (*(pcibr_infoh)));
 
@@ -950,7 +950,7 @@ pcibr_slot_guest_info_init(vertex_hdl_t 
 			 EDGE_LBL_GUEST);
     }
 
-    return(0);
+    return 0;
 }
 
 
@@ -977,13 +977,13 @@ pcibr_slot_call_device_attach(vertex_hdl
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
     if (!pcibr_soft)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     if (pcibr_soft->bs_slot[slot].has_host) {
-        return(EPERM);
+        return -EPERM;
     }
     
     xconn_vhdl = pcibr_soft->bs_conn;
@@ -1029,7 +1029,7 @@ pcibr_slot_call_device_attach(vertex_hdl
         pcibr_soft->bs_slot[slot].slot_status |= SLOT_STARTUP_CMPLT;
     }
         
-    return(error);
+    return error;
 }
 
 /*
@@ -1055,13 +1055,13 @@ pcibr_slot_call_device_detach(vertex_hdl
     pcibr_soft = pcibr_soft_get(pcibr_vhdl);
 
     if (!pcibr_soft)
-	return(EINVAL);
+	return -EINVAL;
 
     if (!PCIBR_VALID_SLOT(pcibr_soft, slot))
-	return(EINVAL);
+	return -EINVAL;
 
     if (pcibr_soft->bs_slot[slot].has_host)
-        return(EPERM);
+        return -EPERM;
 
     nfunc = pcibr_soft->bs_slot[slot].bss_ninfo;
     pcibr_infoh = pcibr_soft->bs_slot[slot].bss_infos;
@@ -1116,7 +1116,7 @@ pcibr_slot_call_device_detach(vertex_hdl
         pcibr_soft->bs_slot[slot].slot_status |= SLOT_SHUTDOWN_CMPLT;
     }
         
-    return(error);
+    return error;
 }
 
 /*
@@ -1141,7 +1141,7 @@ pcibr_slot_detach(vertex_hdl_t pcibr_vhd
             *sub_errorp = error;       
 	if (l1_msg)
 	    ;
-        return(PCI_SLOT_DRV_DETACH_ERR);
+        return PCI_SLOT_DRV_DETACH_ERR;
     }
 
     /* Recalculate the RBARs for all the devices on the bus since we've
@@ -1160,7 +1160,7 @@ pcibr_slot_detach(vertex_hdl_t pcibr_vhd
             (void)pcibr_slot_pcix_rbar_init(pcibr_soft, tmp_slot);
     }
 
-    return (0);
+    return 0;
 
 }
 
@@ -1350,7 +1350,7 @@ pcibr_bus_addr_alloc(pcibr_soft_t pcibr_
 				  ? &win_info_p->w_win_alloc
 				  : NULL,
 				  start, size, align);
-    return(iopaddr);
+    return iopaddr;
 }
 
 
diff -puN arch/ia64/sn/io/sn2/pciio.c~altix-02 arch/ia64/sn/io/sn2/pciio.c
--- 25/arch/ia64/sn/io/sn2/pciio.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/pciio.c	2004-02-02 23:19:38.000000000 -0800
@@ -768,9 +768,12 @@ pciio_device_info_new(
 	pciio_info = kmalloc(sizeof (*(pciio_info)), GFP_KERNEL);
 	if ( pciio_info )
 		memset(pciio_info, 0, sizeof (*(pciio_info)));
+	else {
+		printk(KERN_WARNING "pciio_device_info_new(): Unable to "
+ 			"allocate memory\n");
+ 		return NULL;
+	}
     }
-    ASSERT(pciio_info != NULL);
-
     pciio_info->c_slot = slot;
     pciio_info->c_func = func;
     pciio_info->c_vendor = vendor_id;
@@ -835,13 +838,8 @@ pciio_device_info_unregister(vertex_hdl_
 			    pciio_info->c_slot,
 			    pciio_info->c_func);
 
-    hwgraph_edge_remove(connectpt,name,&pconn);
     pciio_info_set(pconn,0);
 
-    /* Remove the link to our pci provider */
-    hwgraph_edge_remove(pconn, EDGE_LBL_MASTER, NULL);
-
-
     hwgraph_vertex_unref(pconn);
     hwgraph_vertex_destroy(pconn);
     
diff -puN arch/ia64/sn/io/sn2/pic.c~altix-02 arch/ia64/sn/io/sn2/pic.c
--- 25/arch/ia64/sn/io/sn2/pic.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/pic.c	2004-02-02 23:19:38.000000000 -0800
@@ -76,7 +76,7 @@ pic_bus1_widget_info_dup(vertex_hdl_t co
 			(arbitrary_info_t *)&widget_info) == GRAPH_SUCCESS) {
 		peer_widget_info = kmalloc(sizeof (*(peer_widget_info)), GFP_KERNEL);
 		if ( !peer_widget_info ) {
-			return 0;
+			return -ENOMEM;
 		}
 		memset(peer_widget_info, 0, sizeof (*(peer_widget_info)));
 
@@ -336,12 +336,12 @@ pic_attach2(vertex_hdl_t xconn_vhdl, voi
      */
     pcibr_soft = kmalloc(sizeof (*(pcibr_soft)), GFP_KERNEL);
     if ( !pcibr_soft )
-	return -1;
+	return -ENOMEM;
 
     self = kmalloc(sizeof (*(self)), GFP_KERNEL);
     if ( !self ) {
 	kfree(pcibr_soft);
-	return -1;
+	return -ENOMEM;
     }
     memset(pcibr_soft, 0, sizeof (*(pcibr_soft)));
     memset(self, 0, sizeof (*(self)));
diff -puN arch/ia64/sn/io/sn2/shuberror.c~altix-02 arch/ia64/sn/io/sn2/shuberror.c
--- 25/arch/ia64/sn/io/sn2/shuberror.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/shuberror.c	2004-02-02 23:19:38.000000000 -0800
@@ -13,6 +13,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/smp.h>
+#include <asm/delay.h>
 #include <asm/sn/sgi.h>
 #include <asm/sn/io.h>
 #include <asm/sn/iograph.h>
diff -puN arch/ia64/sn/io/sn2/xbow.c~altix-02 arch/ia64/sn/io/sn2/xbow.c
--- 25/arch/ia64/sn/io/sn2/xbow.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/xbow.c	2004-02-02 23:19:38.000000000 -0800
@@ -9,11 +9,15 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/mm.h>
+#include <linux/delay.h>
+#include <asm/sn/sgi.h>
 #include <asm/sn/sn2/sn_private.h>
 #include <asm/sn/iograph.h>
 #include <asm/sn/simulator.h>
 #include <asm/sn/hcl.h>
 #include <asm/sn/hcl_util.h>
+#include <asm/sn/pci/pcibr_private.h>
 
 /* #define DEBUG		1 */
 /* #define XBOW_DEBUG	1 */
diff -puN arch/ia64/sn/io/sn2/xtalk.c~altix-02 arch/ia64/sn/io/sn2/xtalk.c
--- 25/arch/ia64/sn/io/sn2/xtalk.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/sn2/xtalk.c	2004-02-02 23:19:38.000000000 -0800
@@ -30,9 +30,6 @@
  * completely disappear.
  */
 
-#define	NEW(ptr)	(ptr = kmalloc(sizeof (*(ptr)), GFP_KERNEL))
-#define	DEL(ptr)	(kfree(ptr))
-
 char                    widget_info_fingerprint[] = "widget_info";
 
 /* =====================================================================
@@ -855,7 +852,9 @@ xwidget_register(xwidget_hwid_t hwid,		/
     char		    *s,devnm[MAXDEVNAME];
 
     /* Allocate widget_info and associate it with widget vertex */
-    NEW(widget_info);
+    widget_info = kmalloc(sizeof(*widget_info), GFP_KERNEL);
+     if (!widget_info)
+ 	return - ENOMEM;
 
     /* Initialize widget_info */
     widget_info->w_vertex = widget;
@@ -898,16 +897,13 @@ xwidget_unregister(vertex_hdl_t widget)
 
     /* Make sure that we have valid widget information initialized */
     if (!(widget_info = xwidget_info_get(widget)))
-	return(1);
+	return 1;
 
     hwid = &(widget_info->w_hwid);
 
-    /* Clean out the xwidget information */
-    (void)kfree(widget_info->w_name);
-    memset((void *)widget_info, 0, sizeof(widget_info));
-    DEL(widget_info);
-    
-    return(0);
+    kfree(widget_info->w_name);
+    kfree(widget_info);
+    return 0;
 }
 
 void
diff -puN arch/ia64/sn/io/xswitch.c~altix-02 arch/ia64/sn/io/xswitch.c
--- 25/arch/ia64/sn/io/xswitch.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/xswitch.c	2004-02-02 23:19:38.000000000 -0800
@@ -8,6 +8,7 @@
 
 #include <linux/types.h>
 #include <linux/slab.h>
+#include <asm/errno.h>
 #include <asm/sn/sgi.h>
 #include <asm/sn/driver.h>
 #include <asm/sn/iograph.h>
@@ -18,8 +19,6 @@
 #include <asm/sn/xtalk/xwidget.h>
 #include <asm/sn/xtalk/xtalk_private.h>
 
-#define	NEW(ptr)	(ptr = kmalloc(sizeof (*(ptr)), GFP_KERNEL))
-#define	DEL(ptr)	(kfree(ptr))
 
 /*
  * This file provides generic support for Crosstalk
@@ -118,7 +117,12 @@ xswitch_info_new(vertex_hdl_t xwidget)
     if (xswitch_info == NULL) {
 	int                     port;
 
-	NEW(xswitch_info);
+	xswitch_info = kmalloc(sizeof(*xswitch_info), GFP_KERNEL);
+	if (!xswitch_info) {
+		printk(KERN_WARNING "xswitch_info_new(): Unable to "
+			"allocate memory\n");
+		return NULL;
+	}
 	xswitch_info->census = 0;
 	for (port = 0; port <= XSWITCH_CENSUS_PORT_MAX; port++) {
 	    xswitch_info_vhdl_set(xswitch_info, port,
diff -puN arch/ia64/sn/kernel/bte.c~altix-02 arch/ia64/sn/kernel/bte.c
--- 25/arch/ia64/sn/kernel/bte.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/kernel/bte.c	2004-02-02 23:19:38.000000000 -0800
@@ -7,6 +7,7 @@
  */
 
 #include <linux/config.h>
+#include <asm/sn/sgi.h>
 #include <asm/sn/nodepda.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/arch.h>
@@ -14,6 +15,7 @@
 #include <asm/sn/pda.h>
 #include <asm/sn/sn2/shubio.h>
 #include <asm/nodedata.h>
+#include <asm/delay.h>
 
 #include <linux/bootmem.h>
 #include <linux/string.h>
diff -puN arch/ia64/sn/kernel/mca.c~altix-02 arch/ia64/sn/kernel/mca.c
--- 25/arch/ia64/sn/kernel/mca.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/kernel/mca.c	2004-02-02 23:19:38.000000000 -0800
@@ -12,6 +12,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/timer.h>
+#include <asm/sn/sgi.h>
 #include <asm/mca.h>
 #include <asm/sal.h>
 #include <asm/sn/sn_sal.h>
diff -puN arch/ia64/sn/kernel/probe.c~altix-02 arch/ia64/sn/kernel/probe.c
--- 25/arch/ia64/sn/kernel/probe.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/kernel/probe.c	2004-02-02 23:19:38.000000000 -0800
@@ -8,6 +8,7 @@
  * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All rights reserved.
  */
 
+#include <asm/sn/sgi.h>
 #include <asm/sn/sn_sal.h>
 
 /**
diff -puN arch/ia64/sn/kernel/sn2/prominfo_proc.c~altix-02 arch/ia64/sn/kernel/sn2/prominfo_proc.c
--- 25/arch/ia64/sn/kernel/sn2/prominfo_proc.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/kernel/sn2/prominfo_proc.c	2004-02-02 23:19:38.000000000 -0800
@@ -14,6 +14,7 @@
 #include <linux/proc_fs.h>
 #include <asm/system.h>
 #include <asm/io.h>
+#include <asm/sn/sn2/addrs.h>
 #include <asm/sn/simulator.h>
 
 /* to lookup nasids */
diff -puN arch/ia64/sn/kernel/sn2/sn2_smp.c~altix-02 arch/ia64/sn/kernel/sn2/sn2_smp.c
--- 25/arch/ia64/sn/kernel/sn2/sn2_smp.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/kernel/sn2/sn2_smp.c	2004-02-02 23:19:38.000000000 -0800
@@ -21,6 +21,7 @@
 
 #include <asm/processor.h>
 #include <asm/irq.h>
+#include <asm/sn/sgi.h>
 #include <asm/sal.h>
 #include <asm/system.h>
 #include <asm/delay.h>
diff -puN arch/ia64/sn/kernel/sn2/sn_proc_fs.c~altix-02 arch/ia64/sn/kernel/sn2/sn_proc_fs.c
--- 25/arch/ia64/sn/kernel/sn2/sn_proc_fs.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/arch/ia64/sn/kernel/sn2/sn_proc_fs.c	2004-02-02 23:19:38.000000000 -0800
@@ -10,6 +10,7 @@
 
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
+#include <asm/sn/sgi.h>
 #include <asm/sn/sn_sal.h>
 
 
diff -puN drivers/char/sn_serial.c~altix-02 drivers/char/sn_serial.c
--- 25/drivers/char/sn_serial.c~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/drivers/char/sn_serial.c	2004-02-02 23:19:38.000000000 -0800
@@ -22,6 +22,7 @@
 #include <linux/circ_buf.h>
 #include <linux/serial_reg.h>
 #include <asm/uaccess.h>
+#include <asm/sn/sgi.h>
 #include <asm/sn/sn_sal.h>
 #include <asm/sn/pci/pciio.h>
 #include <asm/sn/simulator.h>
diff -puN include/asm-ia64/sn/addrs.h~altix-02 include/asm-ia64/sn/addrs.h
--- 25/include/asm-ia64/sn/addrs.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/addrs.h	2004-02-02 23:19:38.000000000 -0800
@@ -9,8 +9,6 @@
 #ifndef _ASM_IA64_SN_ADDRS_H
 #define _ASM_IA64_SN_ADDRS_H
 
-#include <linux/config.h>
-
 #include <asm/sn/sn2/addrs.h>
 
 #ifndef __ASSEMBLY__
@@ -154,7 +152,7 @@
  * the base of the register space.
  */
 #define HUB_REG_PTR(_base, _off)	\
-	(HUBREG_CAST ((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
+	(HUBREG_CAST ((unsigned long)(_base) + (__psunsigned_t)(_off)))
 
 #define HUB_REG_PTR_L(_base, _off)	\
 	HUB_L(HUB_REG_PTR((_base), (_off)))
diff -puN include/asm-ia64/sn/alenlist.h~altix-02 include/asm-ia64/sn/alenlist.h
--- 25/include/asm-ia64/sn/alenlist.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/alenlist.h	2004-02-02 23:19:38.000000000 -0800
@@ -62,7 +62,7 @@ typedef struct external_alenlist *extern
 
 
 /* Create an Address/Length List, and clear it of all entries.  */
-extern alenlist_t alenlist_create(unsigned flags);
+extern alenlist_t alenlist_create(unsigned int flags);
 
 /* Grow/shrink an Address/Length List and FIX its size. */
 extern int alenlist_grow(alenlist_t, size_t npairs);
@@ -103,7 +103,7 @@ alenlist_done(alenlist_t alenlist);
 extern int alenlist_append(alenlist_t alenlist, 	/* append to this list */
 			alenaddr_t address,		/* address to append */
 			size_t length,			/* length to append */
-			unsigned flags);
+			unsigned int flags);
 
 /* 
  * Replace a Pair in the middle of a List, and return old values.
@@ -114,7 +114,7 @@ alenlist_replace(	alenlist_t alenlist, 	
 			alenlist_cursor_t cursorp,	/* inout: which item to replace */
 			alenaddr_t *addrp, 		/* inout: address */
 			size_t *lengthp,		/* inout: length */
-			unsigned flags);
+			unsigned int flags);
 
 
 /* Get the next Pair from a List */
@@ -123,7 +123,7 @@ extern int alenlist_get(alenlist_t alenl
 			size_t maxlength,		/* in: at most length */
 			alenaddr_t *addr, 		/* out: address */
 			size_t *length,			/* out: length */
-			unsigned flags);
+			unsigned int flags);
 
 
 /* Return the number of Pairs stored in this List */
@@ -135,11 +135,11 @@ extern void alenlist_concat(	alenlist_t 
 
 /* Create a copy of an Address/Length List */
 extern alenlist_t alenlist_clone(alenlist_t old,	/* clone this list */
-				 unsigned flags);
+				 unsigned int flags);
 
 
 /* Allocate and initialize an Address/Length List Cursor */
-extern alenlist_cursor_t alenlist_cursor_create(alenlist_t alenlist, unsigned flags);
+extern alenlist_cursor_t alenlist_cursor_create(alenlist_t alenlist, unsigned int flags);
 
 /* Free an Address/Length List Cursor */
 extern void alenlist_cursor_destroy(alenlist_cursor_t cursorp);
@@ -170,19 +170,19 @@ extern size_t alenlist_cursor_offset(ale
 extern alenlist_t kvaddr_to_alenlist(	alenlist_t alenlist, 
 					caddr_t kvaddr, 
 					size_t length, 
-					unsigned flags);
+					unsigned int flags);
 
 /* Convert from a User Virtual Address to a Physical Address/Length List */
 extern alenlist_t uvaddr_to_alenlist(	alenlist_t alenlist,
 					uvaddr_t vaddr, 
 					size_t length,
-					unsigned flags);
+					unsigned int flags);
 
 /* Convert from a buf struct to a Physical Address/Length List */
 struct buf;
 extern alenlist_t buf_to_alenlist(	alenlist_t alenlist, 
 					struct buf *buf, 
-					unsigned flags);
+					unsigned int flags);
 
 
 /* 
diff -puN include/asm-ia64/sn/arch.h~altix-02 include/asm-ia64/sn/arch.h
--- 25/include/asm-ia64/sn/arch.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/arch.h	2004-02-02 23:19:38.000000000 -0800
@@ -11,12 +11,9 @@
 #ifndef _ASM_IA64_SN_ARCH_H
 #define _ASM_IA64_SN_ARCH_H
 
-#include <linux/config.h>
-#include <linux/threads.h>
-#include <linux/mmzone.h>
+#include <asm/types.h>
 #include <asm/sn/types.h>
-
-#include <asm/sn/sn2/arch.h>
+#include <asm/sn/sn_cpuid.h>
 
 typedef u64	shubreg_t;
 typedef u64	hubreg_t;
diff -puN include/asm-ia64/sn/bte.h~altix-02 include/asm-ia64/sn/bte.h
--- 25/include/asm-ia64/sn/bte.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/bte.h	2004-02-02 23:19:38.000000000 -0800
@@ -13,8 +13,7 @@
 #include <linux/timer.h>
 #include <linux/spinlock.h>
 #include <linux/cache.h>
-#include <asm/sn/io.h>
-#include <asm/delay.h>
+#include <asm/sn/types.h>
 
 
 /* #define BTE_DEBUG */
diff -puN include/asm-ia64/sn/clksupport.h~altix-02 include/asm-ia64/sn/clksupport.h
--- 25/include/asm-ia64/sn/clksupport.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/clksupport.h	2004-02-02 23:19:38.000000000 -0800
@@ -23,9 +23,7 @@
 #ifndef _ASM_IA64_SN_CLKSUPPORT_H
 #define _ASM_IA64_SN_CLKSUPPORT_H
 
-#include <linux/config.h>
 #include <asm/sn/arch.h>
-#include <asm/sn/addrs.h>
 
 typedef long clkreg_t;
 
diff -puN include/asm-ia64/sn/driver.h~altix-02 include/asm-ia64/sn/driver.h
--- 25/include/asm-ia64/sn/driver.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/driver.h	2004-02-02 23:19:38.000000000 -0800
@@ -31,7 +31,7 @@ struct eframe_s;
 struct piomap;
 struct dmamap;
 
-typedef __psunsigned_t iobush_t;
+typedef unsigned long iobush_t;
 
 /* interrupt function */
 typedef void	       *intr_arg_t;
diff -puN include/asm-ia64/sn/hcl.h~altix-02 include/asm-ia64/sn/hcl.h
--- 25/include/asm-ia64/sn/hcl.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/hcl.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,6 +8,7 @@
 #ifndef _ASM_IA64_SN_HCL_H
 #define _ASM_IA64_SN_HCL_H
 
+#include <linux/fs.h>
 #include <asm/sn/sgi.h>
 
 extern vertex_hdl_t hwgraph_root;
@@ -58,7 +59,6 @@ typedef long            arb_info_desc_t;
 #define hwgraph_connectpt_set labelcl_info_connectpt_set
 #define hwgraph_generate_path hwgfs_generate_path
 #define hwgraph_path_to_vertex(a) hwgfs_find_handle(NULL, a, 0, 0, 0, 1)
-#define hwgraph_edge_remove(a,b,c)
 #define hwgraph_vertex_unref(a)
 
 /*
diff -puN include/asm-ia64/sn/hcl_util.h~altix-02 include/asm-ia64/sn/hcl_util.h
--- 25/include/asm-ia64/sn/hcl_util.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/hcl_util.h	2004-02-02 23:19:38.000000000 -0800
@@ -9,6 +9,8 @@
 #ifndef _ASM_IA64_SN_HCL_UTIL_H
 #define _ASM_IA64_SN_HCL_UTIL_H
 
+#include <asm/sn/sgi.h>
+
 extern char * dev_to_name(vertex_hdl_t, char *, unsigned int);
 extern int device_master_set(vertex_hdl_t, vertex_hdl_t);
 extern vertex_hdl_t device_master_get(vertex_hdl_t);
diff -puN include/asm-ia64/sn/hwgfs.h~altix-02 include/asm-ia64/sn/hwgfs.h
--- 25/include/asm-ia64/sn/hwgfs.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/hwgfs.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,6 +8,9 @@
  *
  * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
  */
+
+#include <asm/types.h>
+
 typedef struct dentry *hwgfs_handle_t;
 
 extern hwgfs_handle_t hwgfs_register(hwgfs_handle_t dir, const char *name,
diff -puN include/asm-ia64/sn/iograph.h~altix-02 include/asm-ia64/sn/iograph.h
--- 25/include/asm-ia64/sn/iograph.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/iograph.h	2004-02-02 23:19:38.000000000 -0800
@@ -144,6 +144,7 @@
 void init_all_devices(void);
 #endif /* __KERNEL__ */
 
+#include <asm/sn/sgi.h>
 #include <asm/sn/xtalk/xbow.h>	/* For get MAX_PORT_NUM */
 
 int io_brick_map_widget(int, int);
diff -puN include/asm-ia64/sn/klconfig.h~altix-02 include/asm-ia64/sn/klconfig.h
--- 25/include/asm-ia64/sn/klconfig.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/klconfig.h	2004-02-02 23:19:38.000000000 -0800
@@ -92,9 +92,9 @@ typedef s32 klconf_off_t;
 
 
 typedef struct console_s {
-	__psunsigned_t 	uart_base;
-	__psunsigned_t 	config_base;
-	__psunsigned_t 	memory_base;
+	unsigned long 	uart_base;
+	unsigned long 	config_base;
+	unsigned long 	memory_base;
 	short		baud;
 	short		flag;
 	int		type;
@@ -134,7 +134,7 @@ typedef struct kl_config_hdr {
 /* --- New Macros for the changed kl_config_hdr_t structure --- */
 
 #define PTR_CH_CONS_INFO(_k)	((console_t *)\
-			((__psunsigned_t)_k + (_k->ch_cons_off)))
+			((unsigned long)_k + (_k->ch_cons_off)))
 
 #define KL_CONFIG_CH_CONS_INFO(_n)   PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
 
diff -puN include/asm-ia64/sn/kldir.h~altix-02 include/asm-ia64/sn/kldir.h
--- 25/include/asm-ia64/sn/kldir.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/kldir.h	2004-02-02 23:19:38.000000000 -0800
@@ -11,7 +11,7 @@
 #ifndef _ASM_IA64_SN_KLDIR_H
 #define _ASM_IA64_SN_KLDIR_H
 
-#include <asm/sn/sgi.h>
+#include <linux/types.h>
 
 /*
  * The kldir memory area resides at a fixed place in each node's memory and
@@ -136,7 +136,7 @@
 typedef struct kldir_ent_s {
 	u64		magic;		/* Indicates validity of entry      */
 	off_t		offset;		/* Offset from start of node space  */
-	__psunsigned_t	pointer;	/* Pointer to area in some cases    */
+	unsigned long	pointer;	/* Pointer to area in some cases    */
 	size_t		size;		/* Size in bytes 		    */
 	u64		count;		/* Repeat count if array, 1 if not  */
 	size_t		stride;		/* Stride if array, 0 if not        */
diff -puN include/asm-ia64/sn/module.h~altix-02 include/asm-ia64/sn/module.h
--- 25/include/asm-ia64/sn/module.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/module.h	2004-02-02 23:19:38.000000000 -0800
@@ -13,7 +13,7 @@ extern "C" {
 #endif
 
 
-#include <linux/config.h>
+#include <asm/semaphore.h>
 #include <asm/sn/klconfig.h>
 #include <asm/sn/ksys/elsc.h>
 
diff -puN include/asm-ia64/sn/nodepda.h~altix-02 include/asm-ia64/sn/nodepda.h
--- 25/include/asm-ia64/sn/nodepda.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/nodepda.h	2004-02-02 23:19:38.000000000 -0800
@@ -9,14 +9,14 @@
 #define _ASM_IA64_SN_NODEPDA_H
 
 
-#include <linux/config.h>
-#include <asm/sn/sgi.h>
+#include <asm/semaphore.h>
 #include <asm/irq.h>
 #include <asm/sn/intr.h>
 #include <asm/sn/router.h>
 #include <asm/sn/pda.h>
 #include <asm/sn/module.h>
 #include <asm/sn/bte.h>
+#include <asm/sn/sn2/arch.h>
 
 /*
  * NUMA Node-Specific Data structures are defined in this file.
diff -puN include/asm-ia64/sn/pci/bridge.h~altix-02 include/asm-ia64/sn/pci/bridge.h
--- 25/include/asm-ia64/sn/pci/bridge.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/pci/bridge.h	2004-02-02 23:19:38.000000000 -0800
@@ -533,12 +533,12 @@ typedef volatile struct bridge_s {
 
     /* 0x020000-0x027FFF -- PCI Device Configuration Spaces */
     union {				/* make all access sizes available. */
-	uchar_t		    c[0x1000 / 1];	    /* 0x02{0000,,,7FFF} */
+	unsigned char		    c[0x1000 / 1];	    /* 0x02{0000,,,7FFF} */
 	uint16_t	    s[0x1000 / 2];	    /* 0x02{0000,,,7FFF} */
 	uint32_t	    l[0x1000 / 4];	    /* 0x02{0000,,,7FFF} */
 	uint64_t	    d[0x1000 / 8];	    /* 0x02{0000,,,7FFF} */
 	union {
-	    uchar_t	    c[0x100 / 1];
+	    unsigned char	    c[0x100 / 1];
 	    uint16_t	    s[0x100 / 2];
 	    uint32_t	    l[0x100 / 4];
 	    uint64_t	    d[0x100 / 8];
@@ -547,12 +547,12 @@ typedef volatile struct bridge_s {
 
     /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */
     union {				/* make all access sizes available. */
-	uchar_t		    c[0x1000 / 1];
+	unsigned char		    c[0x1000 / 1];
 	uint16_t	    s[0x1000 / 2];
 	uint32_t	    l[0x1000 / 4];
 	uint64_t	    d[0x1000 / 8];
         union {
-            uchar_t         c[0x100 / 1];
+            unsigned char         c[0x100 / 1];
             uint16_t        s[0x100 / 2];
             uint32_t        l[0x100 / 4];
             uint64_t        d[0x100 / 8];
@@ -563,13 +563,13 @@ typedef volatile struct bridge_s {
 
     /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */
     union {
-	uchar_t		    c[8 / 1];
+	unsigned char		    c[8 / 1];
 	uint16_t	    s[8 / 2];
 	uint32_t	    l[8 / 4];
 	uint64_t	    d[8 / 8];
     } b_pci_iack;				    /* 0x030000-0x030007 */
 
-    uchar_t		    _pad_030007[0x04fff8];  /* 0x030008-0x07FFFF */
+    unsigned char		    _pad_030007[0x04fff8];  /* 0x030008-0x07FFFF */
 
     /* 0x080000-0x0FFFFF -- External Address Translation Entry RAM */
     bridge_ate_t	    b_ext_ate_ram[0x10000];
@@ -579,7 +579,7 @@ typedef volatile struct bridge_s {
 
     /* 0x200000-0xBFFFFF -- PCI/GIO Device Spaces */
     union {				/* make all access sizes available. */
-	uchar_t		    c[0x100000 / 1];
+	unsigned char		    c[0x100000 / 1];
 	uint16_t	    s[0x100000 / 2];
 	uint32_t	    l[0x100000 / 4];
 	uint64_t	    d[0x100000 / 8];
@@ -593,7 +593,7 @@ typedef volatile struct bridge_s {
 
     /* 0xC00000-0xFFFFFF -- External Flash Proms 1,0 */
     union {				/* make all access sizes available. */
-	uchar_t		    c[0x400000 / 1];	/* read-only */
+	unsigned char		    c[0x400000 / 1];	/* read-only */
 	uint16_t	    s[0x400000 / 2];	/* read-write */
 	uint32_t	    l[0x400000 / 4];	/* read-only */
 	uint64_t	    d[0x400000 / 8];	/* read-only */
diff -puN include/asm-ia64/sn/pci/pcibr_private.h~altix-02 include/asm-ia64/sn/pci/pcibr_private.h
--- 25/include/asm-ia64/sn/pci/pcibr_private.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/pci/pcibr_private.h	2004-02-02 23:19:38.000000000 -0800
@@ -395,21 +395,6 @@ struct pcibr_intr_wrap_s {
  */
 #define PCIBR_WAR_ENABLED(pv, pcibr_soft) \
 	((1 << XWIDGET_PART_REV_NUM_REV(pcibr_soft->bs_rev_num)) & pv)
-/*
- * Defines for individual WARs. Each is a bitmask of applicable
- * part revision numbers. (1 << 1) == rev A, (1 << 2) == rev B,
- * (3 << 1) == (rev A or rev B), etc
- */
-#define PV854697 (~0)     /* PIC: write 64bit regs as 64bits. permanent */
-#define PV854827 (~0)     /* PIC: fake widget 0xf presence bit. permanent */
-#define PV855271 (1 << 1) /* PIC: use virt chan iff 64-bit device. */
-#define PV878674 (~0)     /* PIC: Dont allow 64bit PIOs.  permanent */
-#define PV855272 (1 << 1) /* PIC: runaway interrupt WAR */
-#define PV856155 (1 << 1) /* PIC: arbitration WAR */
-#define PV856864 (1 << 1) /* PIC: lower timeout to free TNUMs quicker */
-#define PV856866 (1 << 1) /* PIC: avoid rrb's 0/1/8/9. */
-#define PV862253 (1 << 1) /* PIC: don't enable write req RAM parity checking */
-#define PV867308 (3 << 1) /* PIC: make LLP error interrupts FATAL for PIC */
 
 /* defines for pcibr_soft_s->bs_bridge_mode */
 #define PCIBR_BRIDGEMODE_PCI_33		0x0
diff -puN include/asm-ia64/sn/pci/pciio.h~altix-02 include/asm-ia64/sn/pci/pciio.h
--- 25/include/asm-ia64/sn/pci/pciio.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/pci/pciio.h	2004-02-02 23:19:38.000000000 -0800
@@ -321,7 +321,7 @@ pciio_piomap_alloc_f    (vertex_hdl_t de
 			 iopaddr_t pcipio_addr,		/* starting address */
 			 size_t byte_count,
 			 size_t byte_count_max,		/* maximum size of a mapping */
-			 unsigned flags);	/* defined in sys/pio.h */
+			 unsigned int flags);	/* defined in sys/pio.h */
 
 typedef void
 pciio_piomap_free_f     (pciio_piomap_t pciio_piomap);
@@ -340,7 +340,7 @@ pciio_piotrans_addr_f   (vertex_hdl_t de
 			 pciio_space_t space,	/* which address space */
 			 iopaddr_t pciio_addr,	/* starting address */
 			 size_t byte_count,	/* map this many bytes */
-			 unsigned flags);
+			 unsigned int flags);
 
 typedef caddr_t
 pciio_pio_addr_f        (vertex_hdl_t dev,	/* translate for this device */
@@ -349,7 +349,7 @@ pciio_pio_addr_f        (vertex_hdl_t de
 			 iopaddr_t pciio_addr,	/* starting address */
 			 size_t byte_count,	/* map this many bytes */
 			 pciio_piomap_t *mapp,	/* in case a piomap was needed */
-			 unsigned flags);
+			 unsigned int flags);
 
 typedef iopaddr_t
 pciio_piospace_alloc_f  (vertex_hdl_t dev,	/* PIO space for this device */
@@ -370,7 +370,7 @@ typedef pciio_dmamap_t
 pciio_dmamap_alloc_f    (vertex_hdl_t dev,	/* set up mappings for this device */
 			 device_desc_t dev_desc,	/* device descriptor */
 			 size_t byte_count_max,		/* max size of a mapping */
-			 unsigned flags);	/* defined in dma.h */
+			 unsigned int flags);	/* defined in dma.h */
 
 typedef void
 pciio_dmamap_free_f     (pciio_dmamap_t dmamap);
@@ -388,7 +388,7 @@ pciio_dmatrans_addr_f   (vertex_hdl_t de
 			 device_desc_t dev_desc,	/* device descriptor */
 			 paddr_t paddr,	/* system physical address */
 			 size_t byte_count,	/* length */
-			 unsigned flags);	/* defined in dma.h */
+			 unsigned int flags);	/* defined in dma.h */
 
 typedef void
 pciio_dmamap_drain_f	(pciio_dmamap_t map);
@@ -440,13 +440,13 @@ pciio_endian_set_f      (vertex_hdl_t de
 
 typedef uint64_t
 pciio_config_get_f	(vertex_hdl_t conn,	/* pci connection point */
-			 unsigned reg,		/* register byte offset */
-			 unsigned size);	/* width in bytes (1..4) */
+			 unsigned int reg,		/* register byte offset */
+			 unsigned int size);	/* width in bytes (1..4) */
 
 typedef void
 pciio_config_set_f	(vertex_hdl_t conn,	/* pci connection point */
-			 unsigned reg,		/* register byte offset */
-			 unsigned size,		/* width in bytes (1..4) */
+			 unsigned int reg,		/* register byte offset */
+			 unsigned int size,		/* width in bytes (1..4) */
 			 uint64_t value);	/* value to store */
 
 typedef pciio_slot_t
@@ -578,7 +578,7 @@ extern int
 pciio_driver_register  (pciio_vendor_id_t vendor_id,	/* card's vendor number */
 			pciio_device_id_t device_id,	/* card's device number */
 			char *driver_prefix,	/* driver prefix */
-			unsigned flags);
+			unsigned int flags);
 
 extern void
 pciio_error_register   (vertex_hdl_t pconn,	/* which slot */
diff -puN include/asm-ia64/sn/pci/pciio_private.h~altix-02 include/asm-ia64/sn/pci/pciio_private.h
--- 25/include/asm-ia64/sn/pci/pciio_private.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/pci/pciio_private.h	2004-02-02 23:19:38.000000000 -0800
@@ -20,7 +20,7 @@
  * All PCI providers set up PIO using this information.
  */
 struct pciio_piomap_s {
-    unsigned                pp_flags;	/* PCIIO_PIOMAP flags */
+    unsigned int            pp_flags;	/* PCIIO_PIOMAP flags */
     vertex_hdl_t            pp_dev;	/* associated pci card */
     pciio_slot_t            pp_slot;	/* which slot the card is in */
     pciio_space_t           pp_space;	/* which address space */
@@ -33,7 +33,7 @@ struct pciio_piomap_s {
  * All PCI providers set up DMA using this information.
  */
 struct pciio_dmamap_s {
-    unsigned                pd_flags;	/* PCIIO_DMAMAP flags */
+    unsigned int            pd_flags;	/* PCIIO_DMAMAP flags */
     vertex_hdl_t            pd_dev;	/* associated pci card */
     pciio_slot_t            pd_slot;	/* which slot the card is in */
 };
@@ -43,7 +43,7 @@ struct pciio_dmamap_s {
  */
 
 struct pciio_intr_s {
-    unsigned                pi_flags;	/* PCIIO_INTR flags */
+    unsigned int            pi_flags;	/* PCIIO_INTR flags */
     vertex_hdl_t            pi_dev;	/* associated pci card */
     device_desc_t	    pi_dev_desc;	/* override device descriptor */
     pciio_intr_line_t       pi_lines;	/* which interrupt line(s) */
diff -puN include/asm-ia64/sn/pda.h~altix-02 include/asm-ia64/sn/pda.h
--- 25/include/asm-ia64/sn/pda.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/pda.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,12 +8,9 @@
 #ifndef _ASM_IA64_SN_PDA_H
 #define _ASM_IA64_SN_PDA_H
 
-#include <linux/config.h>
 #include <linux/cache.h>
 #include <asm/percpu.h>
 #include <asm/system.h>
-#include <asm/processor.h>
-#include <asm/page.h>
 #include <asm/sn/bte.h>
 
 
diff -puN include/asm-ia64/sn/pio.h~altix-02 include/asm-ia64/sn/pio.h
--- 25/include/asm-ia64/sn/pio.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/pio.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,9 +8,7 @@
 #ifndef _ASM_IA64_SN_PIO_H
 #define _ASM_IA64_SN_PIO_H
 
-#include <linux/types.h>
-#include <asm/sn/sgi.h>
-#include <asm/sn/driver.h>
+#include <asm/sn/types.h>
 
 /*
  * pioaddr_t	- The kernel virtual address that a PIO can be done upon.
@@ -18,7 +16,7 @@
  *		  to long mostly, just cast for other sizes.
  */
 
-typedef volatile ulong*	pioaddr_t;
+typedef volatile unsigned long*	pioaddr_t;
 
 /*
  * iopaddr_t	- the physical io space relative address (e.g. VME A16S 0x0800).
diff -puN include/asm-ia64/sn/sgi.h~altix-02 include/asm-ia64/sn/sgi.h
--- 25/include/asm-ia64/sn/sgi.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/sgi.h	2004-02-02 23:19:38.000000000 -0800
@@ -14,8 +14,6 @@
 
 #include <asm/sn/types.h>
 #include <asm/uaccess.h>		/* for copy_??_user */
-#include <linux/mm.h>
-#include <linux/fs.h>
 #include <asm/sn/hwgfs.h>
 
 typedef hwgfs_handle_t vertex_hdl_t;
@@ -44,6 +42,21 @@ typedef enum graph_error_e {
 #define CPU_NONE		(-1)
 #define GRAPH_VERTEX_NONE ((vertex_hdl_t)-1)
 
+/*
+ * Defines for individual WARs. Each is a bitmask of applicable
+ * part revision numbers. (1 << 1) == rev A, (1 << 2) == rev B,
+ * (3 << 1) == (rev A or rev B), etc
+ */
+#define PV854697 (~0)     /* PIC: write 64bit regs as 64bits. permanent */
+#define PV854827 (~0UL)   /* PIC: fake widget 0xf presence bit. permanent */
+#define PV855271 (1 << 1) /* PIC: use virt chan iff 64-bit device. */
+#define PV878674 (~0)     /* PIC: Dont allow 64bit PIOs.  permanent */
+#define PV855272 (1 << 1) /* PIC: runaway interrupt WAR */
+#define PV856155 (1 << 1) /* PIC: arbitration WAR */
+#define PV856864 (1 << 1) /* PIC: lower timeout to free TNUMs quicker */
+#define PV856866 (1 << 1) /* PIC: avoid rrb's 0/1/8/9. */
+#define PV862253 (1 << 1) /* PIC: don't enable write req RAM parity checking */
+#define PV867308 (3 << 1) /* PIC: make LLP error interrupts FATAL for PIC */
 
 /*
  * No code is complete without an Assertion macro
diff -puN include/asm-ia64/sn/sn2/arch.h~altix-02 include/asm-ia64/sn/sn2/arch.h
--- 25/include/asm-ia64/sn/sn2/arch.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/sn2/arch.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,9 +8,6 @@
 #ifndef _ASM_IA64_SN_SN2_ARCH_H
 #define _ASM_IA64_SN_SN2_ARCH_H
 
-#include <asm/types.h>
-
-
 #define CPUS_PER_NODE           4       /* CPUs on a single hub */
 #define CPUS_PER_SUBNODE        4       /* CPUs on a single hub PI */
 
diff -puN include/asm-ia64/sn/sn2/sn_private.h~altix-02 include/asm-ia64/sn/sn2/sn_private.h
--- 25/include/asm-ia64/sn/sn2/sn_private.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/sn2/sn_private.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,6 +8,7 @@
 #ifndef _ASM_IA64_SN_SN2_SN_PRIVATE_H
 #define _ASM_IA64_SN_SN2_SN_PRIVATE_H
 
+#include <linux/wait.h>
 #include <asm/sn/nodepda.h>
 #include <asm/sn/io.h>
 #include <asm/sn/xtalk/xwidget.h>
@@ -20,7 +21,7 @@ extern void he_arcs_set_vectors(void);
 extern void mem_init(void);
 extern void cpu_unenable(cpuid_t);
 extern nasid_t get_lowest_nasid(void);
-extern __psunsigned_t get_master_bridge_base(void);
+extern unsigned long get_master_bridge_base(void);
 extern int check_nasid_equiv(nasid_t, nasid_t);
 extern char get_console_pcislot(void);
 
@@ -28,7 +29,7 @@ extern int is_master_baseio_nasid_widget
 					 xwidgetnum_t test_wid);
 
 /* memsupport.c */
-extern void poison_state_alter_range(__psunsigned_t start, int len, int poison);
+extern void poison_state_alter_range(unsigned long start, int len, int poison);
 extern int memory_present(paddr_t);
 extern int memory_read_accessible(paddr_t);
 extern int memory_write_accessible(paddr_t);
@@ -86,7 +87,7 @@ void install_klidbg_functions(void);
 
 /* klnuma.c */
 extern void replicate_kernel_text(int numnodes);
-extern __psunsigned_t get_freemem_start(cnodeid_t cnode);
+extern unsigned long get_freemem_start(cnodeid_t cnode);
 extern void setup_replication_mask(int maxnodes);
 
 /* init.c */
@@ -109,7 +110,7 @@ extern int check_ni_errors(void);
 /* Used for debugger to signal upper software a breakpoint has taken place */
 
 extern void *debugger_update;
-extern __psunsigned_t debugger_stopped;
+extern unsigned long debugger_stopped;
 
 /* 
  * piomap, created by shub_pio_alloc.
@@ -234,9 +235,6 @@ extern void sysctlr_keepalive(void);
 #define paddr_cnode(_pa)	(NASID_TO_COMPACT_NODEID(NASID_GET(_pa)))
 extern void membank_pathname_get(paddr_t, char *);
 
-/* To redirect the output into the error buffer */
-#define errbuf_print(_s)	printf("#%s",_s)
-
 extern void crbx(nasid_t nasid, void (*pf) (char *, ...));
 void bootstrap(void);
 
diff -puN include/asm-ia64/sn/sn_cpuid.h~altix-02 include/asm-ia64/sn/sn_cpuid.h
--- 25/include/asm-ia64/sn/sn_cpuid.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/sn_cpuid.h	2004-02-02 23:19:38.000000000 -0800
@@ -13,12 +13,8 @@
 
 #include <linux/config.h>
 #include <linux/smp.h>
-#include <linux/sched.h>
-#include <linux/mmzone.h>
-#include <asm/sn/types.h>
-#include <asm/current.h>
-#include <asm/nodedata.h>
 #include <asm/sn/pda.h>
+#include <asm/intrinsics.h>
 
 
 /*
diff -puN include/asm-ia64/sn/sn_private.h~altix-02 include/asm-ia64/sn/sn_private.h
--- 25/include/asm-ia64/sn/sn_private.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/sn_private.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,11 +8,6 @@
 #ifndef _ASM_IA64_SN_SN_PRIVATE_H
 #define _ASM_IA64_SN_SN_PRIVATE_H
 
-#include <linux/config.h>
-#include <asm/sn/nodepda.h>
-#include <asm/sn/xtalk/xwidget.h>
-#include <asm/sn/xtalk/xtalk_private.h>
-
 #include <asm/sn/sn2/sn_private.h>
 
 #endif /* _ASM_IA64_SN_SN_PRIVATE_H */
diff -puN include/asm-ia64/sn/types.h~altix-02 include/asm-ia64/sn/types.h
--- 25/include/asm-ia64/sn/types.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/types.h	2004-02-02 23:19:38.000000000 -0800
@@ -9,21 +9,15 @@
 #ifndef _ASM_IA64_SN_TYPES_H
 #define _ASM_IA64_SN_TYPES_H
 
-#include <linux/config.h>
-#include <linux/types.h>
-
 typedef unsigned long 	cpuid_t;
 typedef signed short	nasid_t;	/* node id in numa-as-id space */
 typedef signed char	partid_t;	/* partition ID type */
 typedef unsigned int    moduleid_t;     /* user-visible module number type */
 typedef unsigned int    cmoduleid_t;    /* kernel compact module id type */
-typedef signed char slabid_t;
+typedef signed char     slabid_t;
 typedef unsigned char	clusterid_t;	/* Clusterid of the cell */
 
-typedef uint64_t __psunsigned_t;
-
 typedef unsigned long iopaddr_t;
-typedef unsigned char uchar_t;
 typedef unsigned long paddr_t;
 typedef unsigned long pfn_t;
 typedef short cnodeid_t;
diff -puN include/asm-ia64/sn/vector.h~altix-02 include/asm-ia64/sn/vector.h
--- 25/include/asm-ia64/sn/vector.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/vector.h	2004-02-02 23:19:38.000000000 -0800
@@ -8,8 +8,6 @@
 #ifndef _ASM_IA64_SN_VECTOR_H
 #define _ASM_IA64_SN_VECTOR_H
 
-#include <linux/config.h>
-
 #define NET_VEC_NULL            ((net_vec_t)  0)
 #define NET_VEC_BAD             ((net_vec_t) -1)
 
diff -puN include/asm-ia64/sn/xtalk/xbow.h~altix-02 include/asm-ia64/sn/xtalk/xbow.h
--- 25/include/asm-ia64/sn/xtalk/xbow.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/xtalk/xbow.h	2004-02-02 23:19:38.000000000 -0800
@@ -12,7 +12,7 @@
  * xbow.h - header file for crossbow chip and xbow section of xbridge
  */
 
-#include <linux/config.h>
+#include <asm/types.h>
 #include <asm/sn/xtalk/xtalk.h>
 #include <asm/sn/xtalk/xwidget.h>
 #include <asm/sn/xtalk/xswitch.h>
@@ -55,12 +55,6 @@
 #ifndef __ASSEMBLY__
 typedef uint32_t      xbowreg_t;
 
-#define XBOWCONST	(xbowreg_t)
-
-/* Generic xbow register, given base and offset */
-#define XBOW_REG_PTR(base, offset) ((volatile xbowreg_t*) \
-	((__psunsigned_t)(base) + (__psunsigned_t)(offset)))
-
 /* Register set for each xbow link */
 typedef volatile struct xb_linkregs_s {
 /* 
@@ -224,14 +218,6 @@ typedef struct xbow_cfg_s {
 /*              of the widget0 address space (before 0xf4) */
 #define	XBOW_WID_UNDEF		0xe4
 
-/* pointer to link arbitration register, given xbow base, dst and src widget id */
-#define XBOW_PRIO_ARBREG_PTR(base, dst_wid, src_wid) \
-	XBOW_REG_PTR(XBOW_PRIO_LINKREGS_PTR(base, dst_wid), XBOW_ARB_OFF(src_wid))
-
-/* pointer to link registers base, given xbow base and destination widget id */
-#define XBOW_PRIO_LINKREGS_PTR(base, dst_wid) (xb_linkregs_t*) \
-	XBOW_REG_PTR(base, XB_LINK_REG_BASE(dst_wid))
-
 /* xbow link register set base, legal value for x is 0x8..0xf */
 #define	XB_LINK_BASE		0x100
 #define	XB_LINK_OFFSET		0x40
@@ -356,9 +342,6 @@ typedef struct xbow_cfg_s {
                         XWIDGET_MFG_NUM(wid) == XXBOW_WIDGET_MFGR_NUM)
 
 #define XBOW_WAR_ENABLED(pv, widid) ((1 << XWIDGET_REV_NUM(widid)) & pv)
-#define PV854827 (~0)     /* PIC: fake widget 0xf presence bit. permanent */
-#define PV863579 (1 << 1) /* PIC: PIO to PIC register */
-
 
 #ifndef __ASSEMBLY__
 /*
diff -puN include/asm-ia64/sn/xtalk/xtalk.h~altix-02 include/asm-ia64/sn/xtalk/xtalk.h
--- 25/include/asm-ia64/sn/xtalk/xtalk.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/xtalk/xtalk.h	2004-02-02 23:19:38.000000000 -0800
@@ -94,7 +94,7 @@ xtalk_piomap_alloc_f    (vertex_hdl_t de
 			 iopaddr_t xtalk_addr,	/* map for this xtalk_addr range */
 			 size_t byte_count,
 			 size_t byte_count_max,		/* maximum size of a mapping */
-			 unsigned flags);	/* defined in sys/pio.h */
+			 unsigned int flags);	/* defined in sys/pio.h */
 typedef void
 xtalk_piomap_free_f     (xtalk_piomap_t xtalk_piomap);
 
@@ -111,7 +111,7 @@ xtalk_piotrans_addr_f   (vertex_hdl_t de
 			 device_desc_t dev_desc,	/* device descriptor */
 			 iopaddr_t xtalk_addr,	/* Crosstalk address */
 			 size_t byte_count,	/* map this many bytes */
-			 unsigned flags);	/* (currently unused) */
+			 unsigned int flags);	/* (currently unused) */
 
 extern caddr_t
 xtalk_pio_addr		(vertex_hdl_t dev,	/* translate for this device */
@@ -119,7 +119,7 @@ xtalk_pio_addr		(vertex_hdl_t dev,	/* tr
 			 iopaddr_t xtalk_addr,	/* Crosstalk address */
 			 size_t byte_count,	/* map this many bytes */
 			 xtalk_piomap_t *xtalk_piomapp,	/* RETURNS mapping resources */
-			 unsigned flags);	/* (currently unused) */
+			 unsigned int flags);	/* (currently unused) */
 
 /* DMA MANAGEMENT */
 
@@ -129,7 +129,7 @@ typedef xtalk_dmamap_t
 xtalk_dmamap_alloc_f    (vertex_hdl_t dev,	/* set up mappings for this device */
 			 device_desc_t dev_desc,	/* device descriptor */
 			 size_t byte_count_max,		/* max size of a mapping */
-			 unsigned flags);	/* defined in dma.h */
+			 unsigned int flags);	/* defined in dma.h */
 
 typedef void
 xtalk_dmamap_free_f     (xtalk_dmamap_t dmamap);
@@ -142,7 +142,7 @@ xtalk_dmamap_addr_f     (xtalk_dmamap_t 
 typedef alenlist_t
 xtalk_dmamap_list_f     (xtalk_dmamap_t dmamap,		/* use these mapping resources */
 			 alenlist_t alenlist,	/* map this address/length list */
-			 unsigned flags);
+			 unsigned int flags);
 
 typedef void
 xtalk_dmamap_done_f     (xtalk_dmamap_t dmamap);
@@ -152,13 +152,13 @@ xtalk_dmatrans_addr_f   (vertex_hdl_t de
 			 device_desc_t dev_desc,	/* device descriptor */
 			 paddr_t paddr,		/* system physical address */
 			 size_t byte_count,	/* length */
-			 unsigned flags);
+			 unsigned int flags);
 
 typedef alenlist_t
 xtalk_dmatrans_list_f   (vertex_hdl_t dev,	/* translate for this device */
 			 device_desc_t dev_desc,	/* device descriptor */
 			 alenlist_t palenlist,	/* system address/length list */
-			 unsigned flags);
+			 unsigned int flags);
 
 typedef void
 xtalk_dmamap_drain_f	(xtalk_dmamap_t map);	/* drain this map's channel */
@@ -243,7 +243,7 @@ xtalk_early_piotrans_addr_f (xwidget_par
 			     int which,
 			     iopaddr_t xtalk_addr,
 			     size_t byte_count,
-			     unsigned flags);
+			     unsigned int flags);
 
 /*
  * Adapters that provide a crosstalk interface adhere to this software interface.
diff -puN include/asm-ia64/sn/xtalk/xwidget.h~altix-02 include/asm-ia64/sn/xtalk/xwidget.h
--- 25/include/asm-ia64/sn/xtalk/xwidget.h~altix-02	2004-02-02 23:19:38.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/xtalk/xwidget.h	2004-02-02 23:19:38.000000000 -0800
@@ -139,17 +139,17 @@ typedef volatile struct widget_cfg {
 } widget_cfg_t;
 
 typedef struct {
-    unsigned                other:8;
-    unsigned                bo:1;
-    unsigned                error:1;
-    unsigned                vbpm:1;
-    unsigned                gbr:1;
-    unsigned                ds:2;
-    unsigned                ct:1;
-    unsigned                tnum:5;
-    unsigned                pactyp:4;
-    unsigned                sidn:4;
-    unsigned                didn:4;
+    unsigned int            other:8;
+    unsigned int            bo:1;
+    unsigned int            error:1;
+    unsigned int            vbpm:1;
+    unsigned int            gbr:1;
+    unsigned int            ds:2;
+    unsigned int            ct:1;
+    unsigned int            tnum:5;
+    unsigned int            pactyp:4;
+    unsigned int            sidn:4;
+    unsigned int            didn:4;
 } w_err_cmd_word_f;
 
 typedef union {
@@ -188,7 +188,7 @@ typedef struct xwidget_hwid_s {
 extern int              xwidget_driver_register(xwidget_part_num_t part_num,
 						xwidget_mfg_num_t mfg_num,
 						char *driver_prefix,
-						unsigned flags);
+						unsigned int flags);
 
 extern void             xwidget_driver_unregister(char *driver_prefix);
 
@@ -230,7 +230,7 @@ extern xwidgetnum_t hub_widget_id(nasid_
  * However, since nobody looks inside ...
  */
 typedef struct v_widget_s {
-    unsigned                v_widget_s_is_really_empty;
+    unsigned int                v_widget_s_is_really_empty;
 #define	v_widget_s_is_really_empty	and using this would be a syntax error.
 } v_widget_t;
 #endif				/* _KERNEL */

_
