kernels/linux-2.4.0/drivers/ide/ide-pmac.c
/* Note: We support only master drives for now. This will have to be
 * improved if we want to handle sleep on the iMacDV where the CD-ROM
 * is a slave
 */
We support only master drives for now. This will have to be
improved if we want to handle sleep on the iMacDV where the CD-ROM
is a slave
We support only master drives for now . This will have to be improved if we want to handle sleep on the iMacDV where the CD - ROM is a slave
static int idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when)
{
	int i, ret;
	unsigned long base;
	switch (when) {
	case PBOOK_SLEEP_REQUEST:
		break;
	case PBOOK_SLEEP_REJECT:
		break;
	case PBOOK_SLEEP_NOW:
		for (i = 0; i < pmac_ide_count; ++i) {
			if ((base = pmac_ide[i].regbase) == 0)
				continue;
			disable_irq(pmac_ide[i].irq);
			ret = check_media_bay_by_base(base, MB_CD);
			if ((ret == -ENODEV) && ide_hwifs[i].drives[0].present)
				idepmac_sleep_disk(i, base);
		}
		break;
	case PBOOK_WAKE:
		for (i = 0; i < pmac_ide_count; ++i) {
			ide_hwif_t *hwif;
			if ((base = pmac_ide[i].regbase) == 0)
				continue;
			hwif = &ide_hwifs[i];
			ret = check_media_bay_by_base(base, MB_CD);
			if ((ret == -ENODEV) && ide_hwifs[i].drives[0].present)
				idepmac_wake_disk(i, base);
			else if (ret == 0)
				idepmac_wake_bay(i, base);
			enable_irq(pmac_ide[i].irq);
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
			if (hwif->drives[0].present && hwif->drives[0].using_dma)
				pmac_ide_dma_onoff(&hwif->drives[0], 1);
#endif				
		}
		break;
	}
	return PBOOK_SLEEP_OK;
}
static int idepmac_notify_sleep ( struct pmu_sleep_notifier * self , int when ) { int i , ret ; unsigned long base ; switch ( when ) { case PBOOK_SLEEP_REQUEST : break ; case PBOOK_SLEEP_REJECT : break ; case PBOOK_SLEEP_NOW : for ( i = 0 ; i < pmac_ide_count ; ++ i ) { if ( ( base = pmac_ide [ i ] . regbase ) == 0 ) continue ; disable_irq ( pmac_ide [ i ] . irq ) ; ret = check_media_bay_by_base ( base , MB_CD ) ; if ( ( ret == - ENODEV ) && ide_hwifs [ i ] . drives [ 0 ] . present ) idepmac_sleep_disk ( i , base ) ; } break ; case PBOOK_WAKE : for ( i = 0 ; i < pmac_ide_count ; ++ i ) { ide_hwif_t * hwif ; if ( ( base = pmac_ide [ i ] . regbase ) == 0 ) continue ; hwif = & ide_hwifs [ i ] ; ret = check_media_bay_by_base ( base , MB_CD ) ; if ( ( ret == - ENODEV ) && ide_hwifs [ i ] . drives [ 0 ] . present ) idepmac_wake_disk ( i , base ) ; else if ( ret == 0 ) idepmac_wake_bay ( i , base ) ; enable_irq ( pmac_ide [ i ] . irq ) ; #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC if ( hwif -> drives [ 0 ] . present && hwif -> drives [ 0 ] . using_dma ) pmac_ide_dma_onoff ( & hwif -> drives [ 0 ] , 1 ) ; #endif } break ; } return PBOOK_SLEEP_OK ; }
Note: We support only master drives for now.
Note : We support only master drives for now .
/* Disable irq during sleep */ /* not media bay - put the disk to sleep */ /* We don't handle media bay devices this way */