static unsigned long *
lookup_fit(int nasid)
{
	unsigned long *fitp;
	unsigned long fit_paddr;
	unsigned long *fit_vaddr;

#ifdef CONFIG_IA64_SGI_SN_SIM
	if (IS_RUNNING_ON_SIMULATOR())
		return fakefit;
#endif

	fitp = (void *)GLOBAL_MMR_ADDR(nasid, LB_PROM_SPACE - 32);
	DPRINTK("pointer to fit at %p\n", (void *)fitp);
	fit_paddr = readq(fitp);
	DPRINTK("fit pointer contains %lx\n", fit_paddr);
	/* snag just the node-relative offset */
	fit_paddr &= ~0ul >> (63-35);
	/* the pointer to the FIT is relative to IA-64 compatibility
	 * space.  However, the PROM is mapped at a different offset
	 * in MMR space (both local and global)
	 */
	fit_paddr += 0x700000000;
	fit_vaddr = (void *)GLOBAL_MMR_ADDR(nasid, fit_paddr);
	DPRINTK("fit at %p\n", (void *)fit_vaddr);
	return fit_vaddr;
}
Beispiel #2
0
/*
 * hubspc_init
 * Registration of the hubspc devices with the hub manager
 */
void
hubspc_init(void)
{
    /*
     * Register with the hub manager
     */

    /* The reference counters */
    hubdev_register(mem_refcnt_attach);

    /* Prom space */
    hubdev_register(cpuprom_attach);

#if defined(CONFIG_SERIAL_SGI_L1_PROTOCOL)
    /* L1 system controller link */
    if ( !IS_RUNNING_ON_SIMULATOR() ) {
        /* initialize the L1 link */
        void l1_cons_init( l1sc_t *sc );
        elsc_t *get_elsc(void);

        l1_cons_init((l1sc_t *)get_elsc());
    }
#endif

#ifdef	HUBSPC_DEBUG
    printf("hubspc_init: Completed\n");
#endif	/* HUBSPC_DEBUG */
    /* Initialize spinlocks */
    mutex_spinlock_init(&cpuprom_spinlock);
}
nasid_t
snia_get_console_nasid(void)
{
	extern nasid_t console_nasid;
	extern nasid_t master_baseio_nasid;

	if (console_nasid < 0) {
		console_nasid = ia64_sn_get_console_nasid();
		if (console_nasid < 0) {
// ZZZ What do we do if we don't get a console nasid on the hardware????
			if (IS_RUNNING_ON_SIMULATOR() )
				console_nasid = master_baseio_nasid;
		}
	} 
	return console_nasid;
}
Beispiel #4
0
/*
 * snia64_pci_find_bios - SNIA64 pci_find_bios() platform specific code.
 */
void __init
sn1_pci_find_bios(void)
{
	extern struct pci_ops pci_conf;
	/*
	 * Go initialize our IO Infrastructure ..
	 */
	extern void sgi_master_io_infr_init(void);

	sgi_master_io_infr_init();

#ifdef BRINGUP
	if ( IS_RUNNING_ON_SIMULATOR() )
		return;
#endif
	/* sn1_io_infrastructure_init(); */
	pci_conf = snia64_pci_ops;
}
Beispiel #5
0
void
klgraph_hack_init(void)
{

	u64     *temp;

#ifdef CONFIG_IA64_SGI_SN1
	/*
	 * We need to know whether we are booting from PROM or 
	 * boot from disk.
	 */
	linux_klcfg = (kl_config_hdr_t *)0xe000000000030000;
	if (linux_klcfg->ch_magic == 0xbeedbabe) {
		return;
	} else {
		panic("klgraph_hack_init: Unable to locate KLCONFIG TABLE\n");
	}

	convert(0x0000000000030000, 0x00000000beedbabe, 0x0000004800000000);

#else

	if (IS_RUNNING_ON_SIMULATOR()) {
		printk("Creating FAKE Klconfig Structure for Embeded Kernel\n");
		klgraph_addr[0] = 0xe000003000030000;

        /*
         * klconfig entries initialization - mankato
         */
        convert(0xe000003000030000, 0x00000000beedbabe, 0x0000004800000000);
        convert(0xe000003000030010, 0x0003007000000018, 0x800002000f820178);
        convert(0xe000003000030020, 0x80000a000f024000, 0x800002000f800000);
        convert(0xe000003000030030, 0x0300fafa00012580, 0x00000000040f0000);
        convert(0xe000003000030040, 0x0000000000000000, 0x0003097000030070);
        convert(0xe000003000030050, 0x00030970000303b0, 0x0003181000033f70);
        convert(0xe000003000030060, 0x0003d51000037570, 0x0000000000038330);
        convert(0xe000003000030070, 0x0203110100030140, 0x0001000000000101);
        convert(0xe000003000030080, 0x0900000000000000, 0x000000004e465e67);
        convert(0xe000003000030090, 0x0003097000000000, 0x00030b1000030a40);
        convert(0xe0000030000300a0, 0x00030cb000030be0, 0x000315a0000314d0);
        convert(0xe0000030000300b0, 0x0003174000031670, 0x0000000000000000);
        convert(0xe000003000030100, 0x000000000000001a, 0x3350490000000000);
        convert(0xe000003000030110, 0x0000000000000037, 0x0000000000000000);
        convert(0xe000003000030140, 0x0002420100030210, 0x0001000000000101);
        convert(0xe000003000030150, 0x0100000000000000, 0xffffffffffffffff);
        convert(0xe000003000030160, 0x00030d8000000000, 0x0000000000030e50);
        convert(0xe0000030000301c0, 0x0000000000000000, 0x0000000000030070);
        convert(0xe0000030000301d0, 0x0000000000000025, 0x424f490000000000);
        convert(0xe0000030000301e0, 0x000000004b434952, 0x0000000000000000);
        convert(0xe000003000030210, 0x00027101000302e0, 0x00010000000e4101);
        convert(0xe000003000030220, 0x0200000000000000, 0xffffffffffffffff);
        convert(0xe000003000030230, 0x00030f2000000000, 0x0000000000030ff0);
        convert(0xe000003000030290, 0x0000000000000000, 0x0000000000030140);
        convert(0xe0000030000302a0, 0x0000000000000026, 0x7262490000000000);
        convert(0xe0000030000302b0, 0x00000000006b6369, 0x0000000000000000);
        convert(0xe0000030000302e0, 0x0002710100000000, 0x00010000000f3101);
        convert(0xe0000030000302f0, 0x0500000000000000, 0xffffffffffffffff);
        convert(0xe000003000030300, 0x000310c000000000, 0x0003126000031190);
        convert(0xe000003000030310, 0x0003140000031330, 0x0000000000000000);
        convert(0xe000003000030360, 0x0000000000000000, 0x0000000000030140);
        convert(0xe000003000030370, 0x0000000000000029, 0x7262490000000000);
        convert(0xe000003000030380, 0x00000000006b6369, 0x0000000000000000);
        convert(0xe000003000030970, 0x0000000002010102, 0x0000000000000000);
        convert(0xe000003000030980, 0x000000004e465e67, 0xffffffff00000000);
        /* convert(0x00000000000309a0, 0x0000000000037570, 0x0000000100000000); */
        convert(0xe0000030000309a0, 0x0000000000037570, 0xffffffff00000000);
        convert(0xe0000030000309b0, 0x0000000000030070, 0x0000000000000000);
        convert(0xe0000030000309c0, 0x000000000003f420, 0x0000000000000000);
        convert(0xe000003000030a40, 0x0000000002010125, 0x0000000000000000);
        convert(0xe000003000030a50, 0xffffffffffffffff, 0xffffffff00000000);
        convert(0xe000003000030a70, 0x0000000000037b78, 0x0000000000000000);
        convert(0xe000003000030b10, 0x0000000002010125, 0x0000000000000000);
        convert(0xe000003000030b20, 0xffffffffffffffff, 0xffffffff00000000);
        convert(0xe000003000030b40, 0x0000000000037d30, 0x0000000000000001);
        convert(0xe000003000030be0, 0x00000000ff010203, 0x0000000000000000);
        convert(0xe000003000030bf0, 0xffffffffffffffff, 0xffffffff000000ff);
        convert(0xe000003000030c10, 0x0000000000037ee8, 0x0100010000000200);
        convert(0xe000003000030cb0, 0x00000000ff310111, 0x0000000000000000);
        convert(0xe000003000030cc0, 0xffffffffffffffff, 0x0000000000000000);
        convert(0xe000003000030d80, 0x0000000002010104, 0x0000000000000000);
        convert(0xe000003000030d90, 0xffffffffffffffff, 0x00000000000000ff);
        convert(0xe000003000030db0, 0x0000000000037f18, 0x0000000000000000);
        convert(0xe000003000030dc0, 0x0000000000000000, 0x0003007000060000);
        convert(0xe000003000030de0, 0x0000000000000000, 0x0003021000050000);
        convert(0xe000003000030df0, 0x000302e000050000, 0x0000000000000000);
        convert(0xe000003000030e30, 0x0000000000000000, 0x000000000000000a);
        convert(0xe000003000030e50, 0x00000000ff00011a, 0x0000000000000000);
        convert(0xe000003000030e60, 0xffffffffffffffff, 0x0000000000000000);
        convert(0xe000003000030e80, 0x0000000000037fe0, 0x9e6e9e9e9e9e9e9e);
        convert(0xe000003000030e90, 0x000000000000bc6e, 0x0000000000000000);
        convert(0xe000003000030f20, 0x0000000002010205, 0x00000000d0020000);
        convert(0xe000003000030f30, 0xffffffffffffffff, 0x0000000e0000000e);
        convert(0xe000003000030f40, 0x000000000000000e, 0x0000000000000000);
        convert(0xe000003000030f50, 0x0000000000038010, 0x00000000000007ff);
        convert(0xe000003000030f70, 0x0000000000000000, 0x0000000022001077);
        convert(0xe000003000030fa0, 0x0000000000000000, 0x000000000003f4a8);
        convert(0xe000003000030ff0, 0x0000000000310120, 0x0000000000000000);
        convert(0xe000003000031000, 0xffffffffffffffff, 0xffffffff00000002);
        convert(0xe000003000031010, 0x000000000000000e, 0x0000000000000000);
        convert(0xe000003000031020, 0x0000000000038088, 0x0000000000000000);
        convert(0xe0000030000310c0, 0x0000000002010205, 0x00000000d0020000);
        convert(0xe0000030000310d0, 0xffffffffffffffff, 0x0000000f0000000f);
        convert(0xe0000030000310e0, 0x000000000000000f, 0x0000000000000000);
        convert(0xe0000030000310f0, 0x00000000000380b8, 0x00000000000007ff);
        convert(0xe000003000031120, 0x0000000022001077, 0x00000000000310a9);
        convert(0xe000003000031130, 0x00000000580211c1, 0x000000008009104c);
        convert(0xe000003000031140, 0x0000000000000000, 0x000000000003f4c0);
        convert(0xe000003000031190, 0x0000000000310120, 0x0000000000000000);
        convert(0xe0000030000311a0, 0xffffffffffffffff, 0xffffffff00000003);
        convert(0xe0000030000311b0, 0x000000000000000f, 0x0000000000000000);
        convert(0xe0000030000311c0, 0x0000000000038130, 0x0000000000000000);
        convert(0xe000003000031260, 0x0000000000110106, 0x0000000000000000);
        convert(0xe000003000031270, 0xffffffffffffffff, 0xffffffff00000004);
        convert(0xe000003000031270, 0xffffffffffffffff, 0xffffffff00000004);
        convert(0xe000003000031280, 0x000000000000000f, 0x0000000000000000);
        convert(0xe0000030000312a0, 0x00000000ff110013, 0x0000000000000000);
        convert(0xe0000030000312b0, 0xffffffffffffffff, 0xffffffff00000000);
        convert(0xe0000030000312c0, 0x000000000000000f, 0x0000000000000000);
        convert(0xe0000030000312e0, 0x0000000000110012, 0x0000000000000000);
        convert(0xe0000030000312f0, 0xffffffffffffffff, 0xffffffff00000000);
        convert(0xe000003000031300, 0x000000000000000f, 0x0000000000000000);
        convert(0xe000003000031310, 0x0000000000038160, 0x0000000000000000);
        convert(0xe000003000031330, 0x00000000ff310122, 0x0000000000000000);
        convert(0xe000003000031340, 0xffffffffffffffff, 0xffffffff00000005);
        convert(0xe000003000031350, 0x000000000000000f, 0x0000000000000000);
        convert(0xe000003000031360, 0x0000000000038190, 0x0000000000000000);
        convert(0xe000003000031400, 0x0000000000310121, 0x0000000000000000);
        convert(0xe000003000031400, 0x0000000000310121, 0x0000000000000000);
        convert(0xe000003000031410, 0xffffffffffffffff, 0xffffffff00000006);
        convert(0xe000003000031420, 0x000000000000000f, 0x0000000000000000);
        convert(0xe000003000031430, 0x00000000000381c0, 0x0000000000000000);
        convert(0xe0000030000314d0, 0x00000000ff010201, 0x0000000000000000);
        convert(0xe0000030000314e0, 0xffffffffffffffff, 0xffffffff00000000);
        convert(0xe000003000031500, 0x00000000000381f0, 0x000030430000ffff);
        convert(0xe000003000031510, 0x000000000000ffff, 0x0000000000000000);
        convert(0xe0000030000315a0, 0x00000020ff000201, 0x0000000000000000);
        convert(0xe0000030000315b0, 0xffffffffffffffff, 0xffffffff00000001);
        convert(0xe0000030000315d0, 0x0000000000038240, 0x00003f3f0000ffff);
        convert(0xe0000030000315e0, 0x000000000000ffff, 0x0000000000000000);
        convert(0xe000003000031670, 0x00000000ff010201, 0x0000000000000000);
        convert(0xe000003000031680, 0xffffffffffffffff, 0x0000000100000002);
        convert(0xe0000030000316a0, 0x0000000000038290, 0x000030430000ffff);
        convert(0xe0000030000316b0, 0x000000000000ffff, 0x0000000000000000);
        convert(0xe000003000031740, 0x00000020ff000201, 0x0000000000000000);
        convert(0xe000003000031750, 0xffffffffffffffff, 0x0000000500000003);
        convert(0xe000003000031770, 0x00000000000382e0, 0x00003f3f0000ffff);
        convert(0xe000003000031780, 0x000000000000ffff, 0x0000000000000000);
}

#endif

}
Beispiel #6
0
static void __init scan_for_ionodes(void)
{
	int nasid = 0;
	lboard_t *brd;

	/* Setup ionodes with memory */
	for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) {
		char *klgraph_header;
		cnodeid_t cnodeid;

		if (physical_node_map[nasid] == -1)
			continue;

		cnodeid = -1;
		klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid));
		if (!klgraph_header) {
			if (IS_RUNNING_ON_SIMULATOR())
				continue;
			BUG();	/* All nodes must have klconfig tables! */
		}
		cnodeid = nasid_to_cnodeid(nasid);
		root_lboard[cnodeid] = (lboard_t *)
		    NODE_OFFSET_TO_LBOARD((nasid),
					  ((kl_config_hdr_t
					    *) (klgraph_header))->
					  ch_board_info);
	}

	/* Scan headless/memless IO Nodes. */
	for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) {
		/* if there's no nasid, don't try to read the klconfig on the node */
		if (physical_node_map[nasid] == -1)
			continue;
		brd = find_lboard_any((lboard_t *)
				      root_lboard[nasid_to_cnodeid(nasid)],
				      KLTYPE_SNIA);
		if (brd) {
			brd = KLCF_NEXT_ANY(brd);	/* Skip this node's lboard */
			if (!brd)
				continue;
		}

		brd = find_lboard_any(brd, KLTYPE_SNIA);

		while (brd) {
			pda->cnodeid_to_nasid_table[numionodes] =
			    brd->brd_nasid;
			physical_node_map[brd->brd_nasid] = numionodes;
			root_lboard[numionodes] = brd;
			numionodes++;
			brd = KLCF_NEXT_ANY(brd);
			if (!brd)
				break;

			brd = find_lboard_any(brd, KLTYPE_SNIA);
		}
	}

	/* Scan for TIO nodes. */
	for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) {
		/* if there's no nasid, don't try to read the klconfig on the node */
		if (physical_node_map[nasid] == -1)
			continue;
		brd = find_lboard_any((lboard_t *)
				      root_lboard[nasid_to_cnodeid(nasid)],
				      KLTYPE_TIO);
		while (brd) {
			pda->cnodeid_to_nasid_table[numionodes] =
			    brd->brd_nasid;
			physical_node_map[brd->brd_nasid] = numionodes;
			root_lboard[numionodes] = brd;
			numionodes++;
			brd = KLCF_NEXT_ANY(brd);
			if (!brd)
				break;

			brd = find_lboard_any(brd, KLTYPE_TIO);
		}
	}

}
/*
 * init_hcl() - Boot time initialization.  Ensure that it is called 
 *	after devfs has been initialized.
 *
 * For now this routine is being called out of devfs/base.c.  Actually 
 * Not a bad place to be ..
 *
 */
int __init init_hcl(void)
{
	extern void string_table_init(struct string_table *);
	extern struct string_table label_string_table;
	extern int init_ifconfig_net(void);
	extern int init_ioconfig_bus(void);
	int status = 0;
	int rv = 0;

	if (IS_RUNNING_ON_SIMULATOR()) {
		extern u64 klgraph_addr[];
		klgraph_addr[0] = 0xe000003000030000;
	}

	/*
	 * Create the hwgraph_root on devfs.
	 */
	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);

	status = devfs_set_flags (hwgraph_root, DEVFS_FL_HIDE);

	/*
	 * Create the hcl driver to support inventory entry manipulations.
	 * By default, it is expected that devfs is mounted on /dev.
	 *
	 */
	hcl_handle = hwgraph_register(hwgraph_root, ".hcl",
			0, DEVFS_FL_AUTO_DEVNUM,
			0, 0,
			S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP, 0, 0,
			&hcl_fops, NULL);

	if (hcl_handle == NULL) {
		panic("HCL: Unable to create HCL Driver in init_hcl().\n");
		return(0);
	}

	/*
	 * Initialize the HCL string table.
	 */
	string_table_init(&label_string_table);

	/*
	 * Create the directory that links Linux bus numbers to our Xwidget.
	 */
	rv = hwgraph_path_add(hwgraph_root, EDGE_LBL_LINUX_BUS, &linux_busnum);
	if (linux_busnum == NULL) {
		panic("HCL: Unable to create %s\n", EDGE_LBL_LINUX_BUS);
		return(0);
	}

	pci_bus_cvlink_init();

	/*
	 * Initialize the ifconfgi_net driver that does network devices 
	 * Persistent Naming.
	 */
	init_ifconfig_net();
	init_ioconfig_bus();

	return(0);

}
Beispiel #8
0
/*
 * sn_pci_fixup() - This routine is called when platform_pci_fixup() is 
 *	invoked at the end of pcibios_init() to link the Linux pci 
 *	infrastructure to SGI IO Infrasturcture - ia64/kernel/pci.c
 *
 *	Other platform specific fixup can also be done here.
 */
void
sn_pci_fixup(int arg)
{
	struct list_head *ln;
	struct pci_bus *pci_bus = NULL;
	struct pci_dev *device_dev = NULL;
	struct sn_widget_sysdata *widget_sysdata;
	struct sn_device_sysdata *device_sysdata;
#ifdef SN_IOPORTS
	unsigned long ioport;
#endif
	pciio_intr_t intr_handle;
	int cpuid, bit;
	devfs_handle_t device_vertex;
	pciio_intr_line_t lines;
	extern void sn_pci_find_bios(void);
#ifdef CONFIG_IA64_SGI_SN2
	extern int numnodes;
	int cnode;
#endif /* CONFIG_IA64_SGI_SN2 */


	if (arg == 0) {
		sn_init_irq_desc();
		sn_pci_find_bios();
#ifdef CONFIG_IA64_SGI_SN2
		for (cnode = 0; cnode < numnodes; cnode++) {
				extern void intr_init_vecblk(nodepda_t *npda, cnodeid_t, int);
				intr_init_vecblk(NODEPDA(cnode), cnode, 0);
		} 
#endif /* CONFIG_IA64_SGI_SN2 */
		return;
	}

#if 0
{
        devfs_handle_t  bridge_vhdl = pci_bus_to_vertex(0);
        pcibr_soft_t    pcibr_soft = (pcibr_soft_t) hwgraph_fastinfo_get(bridge_vhdl);
	bridge_t        *bridge = pcibr_soft->bs_base;
        printk("pci_fixup_ioc3: Before devreg fixup\n");
        printk("pci_fixup_ioc3: Devreg 0 0x%x\n", bridge->b_device[0].reg);
        printk("pci_fixup_ioc3: Devreg 1 0x%x\n", bridge->b_device[1].reg);
        printk("pci_fixup_ioc3: Devreg 2 0x%x\n", bridge->b_device[2].reg);
        printk("pci_fixup_ioc3: Devreg 3 0x%x\n", bridge->b_device[3].reg);
        printk("pci_fixup_ioc3: Devreg 4 0x%x\n", bridge->b_device[4].reg);
        printk("pci_fixup_ioc3: Devreg 5 0x%x\n", bridge->b_device[5].reg);
        printk("pci_fixup_ioc3: Devreg 6 0x%x\n", bridge->b_device[6].reg);
        printk("pci_fixup_ioc3: Devreg 7 0x%x\n", bridge->b_device[7].reg);
}
#endif
	done_probing = 1;

	/*
	 * Initialize the pci bus vertex in the pci_bus struct.
	 */
	for( ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
		pci_bus = pci_bus_b(ln);
		widget_sysdata = kmalloc(sizeof(struct sn_widget_sysdata), 
					GFP_KERNEL);
		widget_sysdata->vhdl = pci_bus_to_vertex(pci_bus->number);
		pci_bus->sysdata = (void *)widget_sysdata;
	}

	/*
 	 * set the root start and end so that drivers calling check_region()
	 * won't see a conflict
	 */
#ifdef SN_IOPORTS
	ioport_resource.start  = sn_ioport_num;
	ioport_resource.end = 0xffff;
#else
#if defined(CONFIG_IA64_SGI_SN1)
	if ( IS_RUNNING_ON_SIMULATOR() ) {
		/*
		 * IDE legacy IO PORTs are supported in Medusa.
		 * Just open up IO PORTs from 0 .. ioport_resource.end.
		 */
		ioport_resource.start = 0;
	} else {
		/*
		 * We do not support Legacy IO PORT numbers.
		 */
		ioport_resource.start |= IO_SWIZ_BASE | __IA64_UNCACHED_OFFSET;
	}
	ioport_resource.end |= (HSPEC_SWIZ_BASE-1) | __IA64_UNCACHED_OFFSET;
#else
	// Need something here for sn2.... ZXZXZX
#endif
#endif

	/*
	 * Set the root start and end for Mem Resource.
	 */
	iomem_resource.start = 0;
	iomem_resource.end = 0xffffffffffffffff;

	/*
	 * Initialize the device vertex in the pci_dev struct.
	 */
	pci_for_each_dev(device_dev) {
		unsigned int irq;
		int idx;
		u16 cmd;
		devfs_handle_t vhdl;
		unsigned long size;
		extern int bit_pos_to_irq(int);

		if (device_dev->vendor == PCI_VENDOR_ID_SGI &&
				device_dev->device == PCI_DEVICE_ID_SGI_IOC3) {
			extern void pci_fixup_ioc3(struct pci_dev *d);
			pci_fixup_ioc3(device_dev);
		}

		/* Set the device vertex */

		device_sysdata = kmalloc(sizeof(struct sn_device_sysdata),
					GFP_KERNEL);
		device_sysdata->vhdl = devfn_to_vertex(device_dev->bus->number, device_dev->devfn);
		device_sysdata->isa64 = 0;
		/*
		 * Set the xbridge Device(X) Write Buffer Flush and Xbow Flush 
		 * register addresses.
		 */
		(void) set_flush_addresses(device_dev, device_sysdata);

		device_dev->sysdata = (void *) device_sysdata;
		set_sn_pci64(device_dev);
		pci_read_config_word(device_dev, PCI_COMMAND, &cmd);

		/*
		 * Set the resources address correctly.  The assumption here 
		 * is that the addresses in the resource structure has been
		 * read from the card and it was set in the card by our
		 * Infrastructure ..
		 */
		vhdl = device_sysdata->vhdl;
		for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
			size = 0;
			size = device_dev->resource[idx].end -
				device_dev->resource[idx].start;
			if (size) {
				device_dev->resource[idx].start = (unsigned long)pciio_pio_addr(vhdl, 0, PCIIO_SPACE_WIN(idx), 0, size, 0, PCIIO_BYTE_STREAM);
				device_dev->resource[idx].start |= __IA64_UNCACHED_OFFSET;
			}
			else
				continue;

			device_dev->resource[idx].end = 
				device_dev->resource[idx].start + size;

#ifdef CONFIG_IA64_SGI_SN1
			/*
			 * Adjust the addresses to go to the SWIZZLE ..
			 */
			device_dev->resource[idx].start = 
				device_dev->resource[idx].start & 0xfffff7ffffffffff;
			device_dev->resource[idx].end = 
				device_dev->resource[idx].end & 0xfffff7ffffffffff;
#endif

			if (device_dev->resource[idx].flags & IORESOURCE_IO) {
				cmd |= PCI_COMMAND_IO;
#ifdef SN_IOPORTS
				ioport = sn_allocate_ioports(device_dev->resource[idx].start);
				if (ioport < 0) {
					printk("sn_pci_fixup: PCI Device 0x%x on PCI Bus %d not mapped to IO PORTs .. IO PORTs exhausted\n", device_dev->devfn, device_dev->bus->number);
					continue;
				}
				pciio_config_set(vhdl, (unsigned) PCI_BASE_ADDRESS_0 + (idx * 4), 4, (res + (ioport & 0xfff)));

printk("sn_pci_fixup: ioport number %d mapped to pci address 0x%lx\n", ioport, (res + (ioport & 0xfff)));

				device_dev->resource[idx].start = ioport;
				device_dev->resource[idx].end = ioport + SN_IOPORTS_UNIT;
#endif
			}
			if (device_dev->resource[idx].flags & IORESOURCE_MEM)
				cmd |= PCI_COMMAND_MEMORY;
		}
		/*
		 * Now handle the ROM resource ..
		 */
		size = device_dev->resource[PCI_ROM_RESOURCE].end -
			device_dev->resource[PCI_ROM_RESOURCE].start;

		if (size) {
			device_dev->resource[PCI_ROM_RESOURCE].start =
			(unsigned long) pciio_pio_addr(vhdl, 0, PCIIO_SPACE_ROM, 0, 
				size, 0, PCIIO_BYTE_STREAM);
			device_dev->resource[PCI_ROM_RESOURCE].start |= __IA64_UNCACHED_OFFSET;
			device_dev->resource[PCI_ROM_RESOURCE].end =
			device_dev->resource[PCI_ROM_RESOURCE].start + size;

#ifdef CONFIG_IA64_SGI_SN1
                	/*
                 	 * go through synergy swizzled space
                 	 */
			device_dev->resource[PCI_ROM_RESOURCE].start &= 0xfffff7ffffffffffUL;
			device_dev->resource[PCI_ROM_RESOURCE].end   &= 0xfffff7ffffffffffUL;
#endif

		}

		/*
		 * Update the Command Word on the Card.
		 */
		cmd |= PCI_COMMAND_MASTER; /* If the device doesn't support */
					   /* bit gets dropped .. no harm */
		pci_write_config_word(device_dev, PCI_COMMAND, cmd);

		pci_read_config_byte(device_dev, PCI_INTERRUPT_PIN, (unsigned char *)&lines);
		if (device_dev->vendor == PCI_VENDOR_ID_SGI &&
			device_dev->device == PCI_DEVICE_ID_SGI_IOC3 ) {
				lines = 1;
		}
 
		device_sysdata = (struct sn_device_sysdata *)device_dev->sysdata;
		device_vertex = device_sysdata->vhdl;
 
		intr_handle = pciio_intr_alloc(device_vertex, NULL, lines, device_vertex);

		bit = intr_handle->pi_irq;
		cpuid = intr_handle->pi_cpu;
#ifdef CONFIG_IA64_SGI_SN1
		irq = bit_pos_to_irq(bit);
#else /* SN2 */
		irq = bit;
#endif
		irq = irq + (cpuid << 8);
		pciio_intr_connect(intr_handle);
		device_dev->irq = irq;
#ifdef ajmtestintr
		{
			int slot = PCI_SLOT(device_dev->devfn);
			static int timer_set = 0;
			pcibr_intr_t	pcibr_intr = (pcibr_intr_t)intr_handle;
			pcibr_soft_t	pcibr_soft = pcibr_intr->bi_soft;
			extern void intr_test_handle_intr(int, void*, struct pt_regs *);

			if (!timer_set) {
				intr_test_set_timer();
				timer_set = 1;
			}
			intr_test_register_irq(irq, pcibr_soft, slot);
			request_irq(irq, intr_test_handle_intr,0,NULL, NULL);
		}
#endif

	}

#if 0

{
        devfs_handle_t  bridge_vhdl = pci_bus_to_vertex(0);
        pcibr_soft_t    pcibr_soft = (pcibr_soft_t) hwgraph_fastinfo_get(bridge_vhdl);
        bridge_t        *bridge = pcibr_soft->bs_base;

        printk("pci_fixup_ioc3: Before devreg fixup\n");
        printk("pci_fixup_ioc3: Devreg 0 0x%x\n", bridge->b_device[0].reg);
        printk("pci_fixup_ioc3: Devreg 1 0x%x\n", bridge->b_device[1].reg);
        printk("pci_fixup_ioc3: Devreg 2 0x%x\n", bridge->b_device[2].reg);
        printk("pci_fixup_ioc3: Devreg 3 0x%x\n", bridge->b_device[3].reg);
        printk("pci_fixup_ioc3: Devreg 4 0x%x\n", bridge->b_device[4].reg);
        printk("pci_fixup_ioc3: Devreg 5 0x%x\n", bridge->b_device[5].reg);
        printk("pci_fixup_ioc3: Devreg 6 0x%x\n", bridge->b_device[6].reg);
        printk("pci_fixup_ioc3: Devreg 7 0x%x\n", bridge->b_device[7].reg);
}

printk("testing Big Window: 0xC0000200c0000000 %p\n", *( (volatile uint64_t *)0xc0000200a0000000));
printk("testing Big Window: 0xC0000200c0000008 %p\n", *( (volatile uint64_t *)0xc0000200a0000008));

#endif

}