#endif /* CONFIG_PMAC_PBOOK */ 
#endif /* CONFIG_PMAC_MEDIABAY */ 
pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif){	struct device_node *np = pmif->node;	int *bidp, i;	pmif->cable_80 = 0;	pmif->broken_dma = pmif->broken_dma_warn = 0;	if (device_is_compatible(np, "shasta-ata"))		pmif->kind = controller_sh_ata6;	else if (device_is_compatible(np, "kauai-ata"))		pmif->kind = controller_un_ata6;	else if (device_is_compatible(np, "K2-UATA"))		pmif->kind = controller_k2_ata6;	else if (device_is_compatible(np, "keylargo-ata")) {		if (strcmp(np->name, "ata-4") == 0)			pmif->kind = controller_kl_ata4;		else			pmif->kind = controller_kl_ata3;	} else if (device_is_compatible(np, "heathrow-ata"))		pmif->kind = controller_heathrow;	else {		pmif->kind = controller_ohare;		pmif->broken_dma = 1;	}	bidp = (int *)get_property(np, "AAPL,bus-id", NULL);	pmif->aapl_bus_id =  bidp ? *bidp : 0;	/* Get cable type from device-tree */	if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6	    || pmif->kind == controller_k2_ata6	    || pmif->kind == controller_sh_ata6) {		char* cable = get_property(np, "cable-type", NULL);		if (cable && !strncmp(cable, "80-", 3))			pmif->cable_80 = 1;	}	/* G5's seem to have incorrect cable type in device-tree. Let's assume	 * they have a 80 conductor cable, this seem to be always the case unless	 * the user mucked around	 */	if (device_is_compatible(np, "K2-UATA") ||	    device_is_compatible(np, "shasta-ata"))		pmif->cable_80 = 1;	/* On Kauai-type controllers, we make sure the FCR is correct */	if (pmif->kauai_fcr)		writel(KAUAI_FCR_UATA_MAGIC |		       KAUAI_FCR_UATA_RESET_N |		       KAUAI_FCR_UATA_ENABLE, pmif->kauai_fcr);	pmif->mediabay = 0;		/* Make sure we have sane timings */	sanitize_timings(pmif);#ifndef CONFIG_PPC64	/* XXX FIXME: Media bay stuff need re-organizing */	if (np->parent && np->parent->name	    && strcasecmp(np->parent->name, "media-bay") == 0) {#ifdef CONFIG_PMAC_PBOOK		media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index);#endif /* CONFIG_PMAC_PBOOK */		pmif->mediabay = 1;		if (!bidp)			pmif->aapl_bus_id = 1;	} else if (pmif->kind == controller_ohare) {		/* The code below is having trouble on some ohare machines		 * (timing related ?). Until I can put my hand on one of these		 * units, I keep the old way		 */		ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, 0, 1);	} else#endif	{ 		/* This is necessary to enable IDE when net-booting */		ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);		ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);		msleep(10);		ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 0);		msleep(jiffies_to_msecs(IDE_WAKEUP_DELAY));	}	/* Setup MMIO ops */	default_hwif_mmiops(hwif);       	hwif->OUTBSYNC = pmac_outbsync;	/* Tell common code _not_ to mess with resources */	hwif->mmio = 2;	hwif->hwif_data = pmif;	pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq);	memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));	hwif->chipset = ide_pmac;	hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay;	hwif->hold = pmif->mediabay;	hwif->udma_four = pmif->cable_80;	hwif->drives[0].unmask = 1;	hwif->drives[1].unmask = 1;	hwif->tuneproc = pmac_ide_tuneproc;	if (pmif->kind == controller_un_ata6	    || pmif->kind == controller_k2_ata6	    || pmif->kind == controller_sh_ata6)		hwif->selectproc = pmac_ide_kauai_selectproc;	else		hwif->selectproc = pmac_ide_selectproc;	hwif->speedproc = pmac_ide_tune_chipset;#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK	pmu_ide_blink_enabled = pmu_hd_blink_init();	if (pmu_ide_blink_enabled)		hwif->led_act = pmu_hd_kick_blink;#endif	printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n",	       hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,	       pmif->mediabay ? " (mediabay)" : "", hwif->irq);			#ifdef CONFIG_PMAC_PBOOK	if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0)		hwif->noprobe = 0;#endif /* CONFIG_PMAC_PBOOK */	hwif->sg_max_nents = MAX_DCMDS;#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC	/* has a DBDMA controller channel */	if (pmif->dma_regs)		pmac_ide_setup_dma(pmif, hwif);#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */	/* We probe the hwif now */	probe_hwif_init(hwif);	/* The code IDE code will have set hwif->present if we have devices attached,	 * if we don't, the discard the interface except if we are on a media bay slot	 */	if (!hwif->present && !pmif->mediabay) {		printk(KERN_INFO "ide%d: Bus empty, interface released.\n",			hwif->index);		default_hwif_iops(hwif);		for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i)			hwif->io_ports[i] = 0;		hwif->chipset = ide_unknown;		hwif->noprobe = 1;		return -ENODEV;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8c8709334cec803368a432a33e0f2e116d48fe07/pmac.c/buggy/drivers/ide/ppc/pmac.c