snd_printk("AC'97 space ioremap problem\n"); 
snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); 
static int __devinit snd_intel8x0_create(snd_card_t * card,					 struct pci_dev *pci,					 unsigned long device_type,					 intel8x0_t ** r_intel8x0){	intel8x0_t *chip;	int err;	unsigned int i;	unsigned int int_sta_masks;	ichdev_t *ichdev;	static snd_device_ops_t ops = {		.dev_free =	snd_intel8x0_dev_free,	};	static unsigned int bdbars[] = {		3, /* DEVICE_INTEL */		6, /* DEVICE_INTEL_ICH4 */		3, /* DEVICE_SIS */		6, /* DEVICE_ALI */		4, /* DEVICE_NFORCE */	};	static struct ich_reg_info intel_regs[6] = {		{ ICH_PIINT, 0 },		{ ICH_POINT, 0x10 },		{ ICH_MCINT, 0x20 },		{ ICH_M2INT, 0x40 },		{ ICH_P2INT, 0x50 },		{ ICH_SPINT, 0x60 },	};	static struct ich_reg_info nforce_regs[4] = {		{ ICH_PIINT, 0 },		{ ICH_POINT, 0x10 },		{ ICH_MCINT, 0x20 },		{ ICH_NVSPINT, 0x70 },	};	static struct ich_reg_info ali_regs[6] = {		{ ALI_INT_PCMIN, 0x40 },		{ ALI_INT_PCMOUT, 0x50 },		{ ALI_INT_MICIN, 0x60 },		{ ALI_INT_CODECSPDIFOUT, 0x70 },		{ ALI_INT_SPDIFIN, 0xa0 },		{ ALI_INT_SPDIFOUT, 0xb0 },	};	struct ich_reg_info *tbl;	*r_intel8x0 = NULL;	if ((err = pci_enable_device(pci)) < 0)		return err;	chip = kzalloc(sizeof(*chip), GFP_KERNEL);	if (chip == NULL) {		pci_disable_device(pci);		return -ENOMEM;	}	spin_lock_init(&chip->reg_lock);	chip->device_type = device_type;	chip->card = card;	chip->pci = pci;	chip->irq = -1;	/* module parameters */	chip->buggy_irq = buggy_irq;	chip->buggy_semaphore = buggy_semaphore;	if (xbox)		chip->xbox = 1;	if (pci->vendor == PCI_VENDOR_ID_INTEL &&	    pci->device == PCI_DEVICE_ID_INTEL_440MX)		chip->fix_nocache = 1; /* enable workaround */	/* some Nforce[2] and ICH boards have problems with IRQ handling.	 * Needs to return IRQ_HANDLED for unknown irqs.	 */	if (device_type == DEVICE_NFORCE)		chip->buggy_irq = 1;	if ((err = pci_request_regions(pci, card->shortname)) < 0) {		kfree(chip);		pci_disable_device(pci);		return err;	}	if (device_type == DEVICE_ALI) {		/* ALI5455 has no ac97 region */		chip->bmaddr = pci_resource_start(pci, 0);		goto port_inited;	}	if (pci_resource_flags(pci, 2) & IORESOURCE_MEM) {	/* ICH4 and Nforce */		chip->mmio = 1;		chip->addr = pci_resource_start(pci, 2);		chip->remap_addr = ioremap_nocache(chip->addr,						   pci_resource_len(pci, 2));		if (chip->remap_addr == NULL) {			snd_printk("AC'97 space ioremap problem\n");			snd_intel8x0_free(chip);			return -EIO;		}	} else {		chip->addr = pci_resource_start(pci, 0);	}	if (pci_resource_flags(pci, 3) & IORESOURCE_MEM) {	/* ICH4 */		chip->bm_mmio = 1;		chip->bmaddr = pci_resource_start(pci, 3);		chip->remap_bmaddr = ioremap_nocache(chip->bmaddr,						     pci_resource_len(pci, 3));		if (chip->remap_bmaddr == NULL) {			snd_printk("Controller space ioremap problem\n");			snd_intel8x0_free(chip);			return -EIO;		}	} else {		chip->bmaddr = pci_resource_start(pci, 1);	} port_inited:	if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) {		snd_printk("unable to grab IRQ %d\n", pci->irq);		snd_intel8x0_free(chip);		return -EBUSY;	}	chip->irq = pci->irq;	pci_set_master(pci);	synchronize_irq(chip->irq);	chip->bdbars_count = bdbars[device_type];	/* initialize offsets */	switch (device_type) {	case DEVICE_NFORCE:		tbl = nforce_regs;		break;	case DEVICE_ALI:		tbl = ali_regs;		break;	default:		tbl = intel_regs;		break;	}	for (i = 0; i < chip->bdbars_count; i++) {		ichdev = &chip->ichd[i];		ichdev->ichd = i;		ichdev->reg_offset = tbl[i].offset;		ichdev->int_sta_mask = tbl[i].int_sta_mask;		if (device_type == DEVICE_SIS) {			/* SiS 7012 swaps the registers */			ichdev->roff_sr = ICH_REG_OFF_PICB;			ichdev->roff_picb = ICH_REG_OFF_SR;		} else {			ichdev->roff_sr = ICH_REG_OFF_SR;			ichdev->roff_picb = ICH_REG_OFF_PICB;		}		if (device_type == DEVICE_ALI)			ichdev->ali_slot = (ichdev->reg_offset - 0x40) / 0x10;		/* SIS7012 handles the pcm data in bytes, others are in samples */		ichdev->pos_shift = (device_type == DEVICE_SIS) ? 0 : 1;	}	/* allocate buffer descriptor lists */	/* the start of each lists must be aligned to 8 bytes */	if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),				chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2,				&chip->bdbars) < 0) {		snd_intel8x0_free(chip);		snd_printk(KERN_ERR "intel8x0: cannot allocate buffer descriptors\n");		return -ENOMEM;	}	/* tables must be aligned to 8 bytes here, but the kernel pages	   are much bigger, so we don't care (on i386) */	/* workaround for 440MX */	if (chip->fix_nocache)		fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1);	int_sta_masks = 0;	for (i = 0; i < chip->bdbars_count; i++) {		ichdev = &chip->ichd[i];		ichdev->bdbar = ((u32 *)chip->bdbars.area) + (i * ICH_MAX_FRAGS * 2);		ichdev->bdbar_addr = chip->bdbars.addr + (i * sizeof(u32) * ICH_MAX_FRAGS * 2);		int_sta_masks |= ichdev->int_sta_mask;	}	chip->int_sta_reg = device_type == DEVICE_ALI ? ICH_REG_ALI_INTERRUPTSR : ICH_REG_GLOB_STA;	chip->int_sta_mask = int_sta_masks;	if ((err = snd_intel8x0_chip_init(chip, 1)) < 0) {		snd_intel8x0_free(chip);		return err;	}	snd_card_set_pm_callback(card, intel8x0_suspend, intel8x0_resume, chip);	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {		snd_intel8x0_free(chip);		return err;	}	snd_card_set_dev(card, &pci->dev);	*r_intel8x0 = chip;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/99b359ba10a582148c6725f428a33ba5356dd993/intel8x0.c/clean/sound/pci/intel8x0.c