if (NULL == (void *) pdir_base) panic("sba_ioc_init() could not allocate I/O Page Table\n"); 
if (NULL == (void *) pdir_base)	{ panic("%s() could not allocate I/O Page Table\n", __FUNCTION__); } 
sba_alloc_pdir(unsigned int pdir_size){        unsigned long pdir_base;	unsigned long pdir_order = get_order(pdir_size);	pdir_base = __get_free_pages(GFP_KERNEL, pdir_order);	if (NULL == (void *) pdir_base)		panic("sba_ioc_init() could not allocate I/O Page Table\n");	/* If this is not PA8700 (PCX-W2)	**	OR newer than ver 2.2	**	OR in a system that doesn't need VINDEX bits from SBA,	**	** then we aren't exposed to the HW bug.	*/	if ( ((boot_cpu_data.pdc.cpuid >> 5) & 0x7f) != 0x13			|| (boot_cpu_data.pdc.versions > 0x202)			|| (boot_cpu_data.pdc.capabilities & 0x08L) )		return (void *) pdir_base;	/*	 * PA8700 (PCX-W2, aka piranha) silent data corruption fix	 *	 * An interaction between PA8700 CPU (Ver 2.2 or older) and	 * Ike/Astro can cause silent data corruption. This is only	 * a problem if the I/O PDIR is located in memory such that	 * (little-endian)  bits 17 and 18 are on and bit 20 is off.	 *	 * Since the max IO Pdir size is 2MB, by cleverly allocating the	 * right physical address, we can either avoid (IOPDIR <= 1MB)	 * or minimize (2MB IO Pdir) the problem if we restrict the	 * IO Pdir to a maximum size of 2MB-128K (1902K).	 *	 * Because we always allocate 2^N sized IO pdirs, either of the	 * "bad" regions will be the last 128K if at all. That's easy	 * to test for.	 * 	 */	if (pdir_order <= (19-12)) {		if (((virt_to_phys(pdir_base)+pdir_size-1) & PIRANHA_ADDR_MASK) == PIRANHA_ADDR_VAL) {			/* allocate a new one on 512k alignment */			unsigned long new_pdir = __get_free_pages(GFP_KERNEL, (19-12));			/* release original */			free_pages(pdir_base, pdir_order);			pdir_base = new_pdir;			/* release excess */			while (pdir_order < (19-12)) {				new_pdir += pdir_size;				free_pages(new_pdir, pdir_order);				pdir_order +=1;				pdir_size <<=1;			}		}	} else {		/*		** 1MB or 2MB Pdir		** Needs to be aligned on an "odd" 1MB boundary.		*/		unsigned long new_pdir = __get_free_pages(GFP_KERNEL, pdir_order+1); /* 2 or 4MB */		/* release original */		free_pages( pdir_base, pdir_order);		/* release first 1MB */		free_pages(new_pdir, 20-12);		pdir_base = new_pdir + 1024*1024;		if (pdir_order > (20-12)) {			/*			** 2MB Pdir.			**			** Flag tells init_bitmap() to mark bad 128k as used			** and to reduce the size by 128k.			*/			piranha_bad_128k = 1;			new_pdir += 3*1024*1024;			/* release last 1MB */			free_pages(new_pdir, 20-12);			/* release unusable 128KB */			free_pages(new_pdir - 128*1024 , 17-12);			pdir_size -= 128*1024;		}	}	memset((void *) pdir_base, 0, pdir_size);	return (void *) pdir_base;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/64908ad95c34f25849412d6d4735ac10f8fb6575/sba_iommu.c/buggy/drivers/parisc/sba_iommu.c