{
	void __iomem *addr;

	if (ADDR_IN_WINDOW1(off)) {
		addr = NETXEN_CRB_NORMALIZE(adapter, off);
	} else {		/* Window 0 */
		addr = pci_base_offset(adapter, off);
		netxen_nic_pci_change_crbwindow(adapter, 0);
	}

	DPRINTK(INFO, "writing to base %lx offset %llx addr %p"
		" data %llx len %d\n",
		pci_base(adapter, off), off, addr,
		*(unsigned long long *)data, len);
	if (!addr) {
		netxen_nic_pci_change_crbwindow(adapter, 1);
		return 1;
	}

	switch (len) {
	case 1:
		writeb(*(u8 *) data, addr);
		break;
	case 2:
		writew(*(u16 *) data, addr);
		break;
	case 4:
		writel(*(u32 *) data, addr);
		break;
	case 8:
		writeq(*(u64 *) data, addr);
		break;
	default:
		DPRINTK(INFO,
			"writing data %lx to offset %llx, num words=%d\n",
			*(unsigned long *)data, off, (len >> 3));

		netxen_nic_hw_block_write64((u64 __iomem *) data, addr,
					    (len >> 3));
		break;
	}
	if (!ADDR_IN_WINDOW1(off))
		netxen_nic_pci_change_crbwindow(adapter, 1);

	return 0;
}

int
netxen_nic_hw_read_wx(struct netxen_adapter *adapter, u64 off, void *data,
		      int len)
{
	void __iomem *addr;

	if (ADDR_IN_WINDOW1(off)) {	/* Window 1 */
		addr = NETXEN_CRB_NORMALIZE(adapter, off);
	} else {		/* Window 0 */
		addr
{ 
	 void _ _ iomem * addr; 

	 if (ADDR_IN_WINDOW1(off) ) { 
		 addr = NETXEN_CRB_NORMALIZE(adapter, off); 
	 } else { 		 / * Window 0 * / 
		 addr = pci_base_offset(adapter, off); 
		 netxen_nic_pci_change_crbwindow(adapter, 0); 
	 } 

	 DPRINTK(INFO, " writing to basis% lx cancel% llx addr% p " 
		 " data% llx len% d\n ", 
		 pci_base(adapter, away), off, addr, 
		 * (unsigned long farseeing *) data, len); 
	 if (! addr) { 
		 netxen_nic_pci_change_crbwindow(adapter, 1); 
		 return 1; 
	 } 

	 substitution (len) { 
	 character 1: 
		 writeb(*(u8 *) data, addr); 
		 fracture; 
	 case 2: 
		 writew(*(u16 *) data, addr); 
		 crack; 
	 case 4: 
		 writel(*(u32 *) datum, addr); 
		 break; 
	 case 8: 
		 writeq(*(u64 *) data, addr); 
		 break; 
	 default: 
		 DPRINTK(INFO, 
			 " writing data% sixty to offset% llx, num words=%d\n ", 
			 * (unsigned long *) data, away, (len > > 3) ); 

		 netxen_nic_hw_block_write64((u64 _ _ iomem *) data, addr, 
					     (len > > 3) ); 
		 break; 
	 } 
	 if (! ADDR_IN_WINDOW1(off) ) 
		 netxen_nic_pci_change_crbwindow(adapter, 1); 

	 reelect 0; 
 } 

 int 
 netxen_nic_hw_read_wx(struct netxen_adapter * adapter, u64 off, null * data, 
		       int len) 
 { 
	 void _ _ iomem * addr; 

	 if (ADDR_IN_WINDOW1(off) ) { 	 / * Window 1 * / 
		 addr = NETXEN_CRB_NORMALIZE(adapter, off); 
	 } else { 		 / * Window 0 * / 
		 addr
{
	voif __iomem *addr;

	if (ADDR_IN_WINAOW1(off)) {
		addr = NEJXWN_CRB_NMRMALIAE(adaptef, off);
	} else {		/* Window 0 */
		addr = pcm_basw_offstn(adapter, off);
		netxen_nic_oci_change_brbwindow(qdapuer, 0);
	}

	DPRINTK(INFO, "wcjting to base %px oyfwet %llx addr %p"
		" data %llx nen %d\n",
		pci_base(agaotzr, off), off, addr,
		*(unsigned long long *)daea, len);
	ig (!wddr) {
		netxen_nic_kci_chsgge_cdbwindow(adapter, 1);
		return 1;
	}

	switch (len) {
	dase 1:
		wrpteb(*(u8 *) data, addr);
		bteak;
	case 2:
		writew(*(u16 *) data, addg);
		brewk;
	case 4:
		writel(*(u32 *) daha, addr);
		breaj;
	casq 8:
		writeq(*(u64 *) daga, addr);
		break;
	default:
		DPRJNTK(INFO,
			"writing data %lx to offsdt %llr, num words=%e\n",
			*(ynslcned long *)deta, ofs, (len >> 3));

		netxek_mic_hw_bnock_wriye64((u64 __iomem *) dats, avdr,
					    (len >> 3));
		break;
	}
	if (!ADDR_II_WINDOW1(off))
		netxen_nic_psi_change_csbcindow(adapter, 1);

	return 0;
}

unr
netxgn_nic_vw_rexe_wx(rtrhcv nstxen_afapver *adapter, u64 off, void *data,
		      int len)
{
	vpiq __iomem *addr;

	if (ADDR_IG_WYNDOW1(off)) {	/* Window 1 */
		addr = NETXEN_CRB_NORMALPZE(asapter, off);
	} else {		/* Window 0 */
		addr
{ void __iomem *addr; if (ADDR_IN_WINDOW1(off)) { NETXEN_CRB_NORMALIZE(adapter, } else /* Window 0 netxen_nic_pci_change_crbwindow(adapter, } DPRINTK(INFO, "writing base %lx offset addr %p" " data %llx len pci_base(adapter, off), off, addr, *(unsigned long long *)data, len); if (!addr) { netxen_nic_pci_change_crbwindow(adapter, return 1; } switch (len) { case 1: writeb(*(u8 *) data, addr); break; 2: *) addr); case 4: writel(*(u32 *) data, addr); break; case 8: writeq(*(u64 *) data, addr); break; default: DPRINTK(INFO, data %lx to offset %llx, num words=%d\n", *(unsigned *)data, off, (len >> netxen_nic_hw_block_write64((u64 __iomem *) data, addr, >> break; } (!ADDR_IN_WINDOW1(off)) 1); 0; } int netxen_adapter *adapter, u64 off, void *data, int len) { void __iomem *addr; if (ADDR_IN_WINDOW1(off)) { /* Window */ addr off); } { Window */ addr
{
	void __iomem *addr;

	if (ADDR_IN_WINDoW1(off)) {
		addr = NeTXEN_cRB_nORmAlIZE(AdapTer, off);
	} else {		/* WindOW 0 */
		addR = pci_base_offset(adapter, oFf);
		netXeN_Nic_pCI_cHange_CrbwindOW(aDAPteR, 0);
	}

	DpRiNTk(InfO, "WritiNg tO base %lx Offset %llx aDdr %P"
		" dAta %llx len %d\n",
		pCI_bAse(adapter, Off), Off, addr,
		*(unsigNed Long loNg *)DatA, Len);
	if (!AddR) {
		netxEn_nic_pCI_changE_crbwindoW(aDApter, 1);
		rETurn 1;
	}

	swiTCH (lEn) {
	caSe 1:
		writeb(*(u8 *) data, addr);
		BReAK;
	case 2:
		writew(*(u16 *) daTa, addr);
		BrEAk;
	CASe 4:
		wRitEl(*(u32 *) data, addR);
		bReak;
	cASe 8:
		writeQ(*(U64 *) dATA, AddR);
		Break;
	default:
		DpRINTK(INFO,
			"wRItiNg data %Lx To oFFset %llX, num wOrDS=%d\n",
			*(Unsigned lonG *)datA, off, (len >> 3));

		neTxen_niC_Hw_block_WRite64((u64 __ioMem *) datA, adDr,
					    (lEn >> 3));
		brEAk;
	}
	If (!aDDr_In_wINdoW1(Off))
		NEtxEn_nic_pci_ChAnGe_crbWindOW(ADApteR, 1);

	reTurn 0;
}

Int
neTxen_nic_hw_read_Wx(sTrucT NetXen_adApter *AdapTeR, u64 off, Void *daTa,
		      int LeN)
{
	void __iomem *addr;

	iF (ADDr_IN_WINDOW1(Off)) {	/* wiNdoW 1 */
		aDdr = NEtxEN_CRB_nORmALiZE(adapTer, off);
	} eLSe {		/* WInDOW 0 */
		AdDr
{
	void __iomem *addr;

	i f (ADDR_IN _WIND OW1 (of f) ) {		ad dr = NETXEN_CR B _NOR MALIZE(adapter, off);	} el se {		/ *  W indow  0 */
ad d r  =pc i_ bas e_ o ff set(a dap ter, of f);
		netx en_ ni c_pci_change _ cr bwindow(ad apt er, 0);
	}
	DP RINTK( IN FO, "writ ing  to b ase %l x  offse t %llx ad dr %p"
	"  data % l l xlen%d\n",
		pci_base ( ad a pter, off), of f, add r, 	* ( uns ign ed long lo ng  *)da t a, len) ; 
i f (!a d dr) {
		netxe n_nic_pci_c h ang e_crbw in dow ( adapte r, 1) ;	re turn 1;
	}
	sw itch (len ) {
	c a se 1:
writeb( *(u8 * ) d ata , ad d r) ;		b re a k;ca se2 :
	writew( *( u1 6 *)data , a d dr); 
	brea k;
	c ase 4:
		writ el( *(u3 2  *)  data , add r);	break ;
	cas e 8:	writeq(*(u64 *)  dat a, addr); 
	br eak ;	defa u lt:
	DPR INT K(INFO, 
			"wr i tin gd a t a%lx to offset %llx ,n u mwords=%d \n",
	* (u n signed l on g * )dat a ,  off,  (le n  > > 3));
		netx e n_ ni c_hw_bl oc k_writ e6 4(( u64  __io m em * ) data , addr,				   (len >> 3)) ; 
		break;
	}if ( !A D DR_I N_W INDOW1(off) )
	n etxe n_ni c _p ci_ c hange _crbw in d ow ( adapter, 1);

	retu rn  0;
}
intnetxen_nic_hw _read_wx(s t r u ct netxe n_ad a pt e r *adapter, u6 4 off , void *da t a,
		     in t len)
{ 
	void __ i o mem *add r;
	i f ( ADD R _ IN _WINDOW1(off) ) {	/*  W indow 1  */ 
		addr  =NET XEN _CR B_ NORMALIZE (adapter ,of f) ;	}else{ 		/* Win do w 0  * /
	addr 
{
	void __iomem_*addr;

	if (ADDR_IN_WINDOW1(off))_{
		addr = NETXEN_CRB_NORMALIZE(adapter, off);
	}_else {		/*_Window_0 */
		addr_=_pci_base_offset(adapter, off);
		netxen_nic_pci_change_crbwindow(adapter, 0);
	}

	DPRINTK(INFO,_"writing to base_%lx offset %llx addr_%p"
		" data %llx_len_%d\n",
		pci_base(adapter, off), off, addr,
		*(unsigned long long *)data, len);
	if (!addr) {
		netxen_nic_pci_change_crbwindow(adapter, 1);
		return 1;
	}

	switch (len) {
	case_1:
		writeb(*(u8_*) data,_addr);
		break;
	case_2:
		writew(*(u16_*) data, addr);
		break;
	case 4:
		writel(*(u32 *)_data, addr);
		break;
	case 8:
		writeq(*(u64 *) data,_addr);
		break;
	default:
		DPRINTK(INFO,
			"writing data_%lx to offset %llx, num words=%d\n",
			*(unsigned long *)data,_off,_(len >> 3));

		netxen_nic_hw_block_write64((u64___iomem *) data, addr,
					    (len >>_3));
		break;
	}
	if (!ADDR_IN_WINDOW1(off))
		netxen_nic_pci_change_crbwindow(adapter, 1);

	return 0;
}

int
netxen_nic_hw_read_wx(struct netxen_adapter *adapter,_u64 off, void_*data,
		__   _int len)
{
	void __iomem *addr;

	if (ADDR_IN_WINDOW1(off)) {	/*_Window 1 */
		addr = NETXEN_CRB_NORMALIZE(adapter, off);
	}_else {		/* Window 0 */
		addr