PRINT(KERN_ERR, "IR legacy activated"); 
DBGMSG("IR legacy activated"); 
static int ohci_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg){	struct ti_ohci *ohci = host->hostdata;	int retval = 0;	unsigned long flags;	int phy_reg;	switch (cmd) {	case RESET_BUS:		switch (arg) {		case SHORT_RESET:			phy_reg = get_phy_reg(ohci, 5);			phy_reg |= 0x40;			set_phy_reg(ohci, 5, phy_reg); /* set ISBR */			break;		case LONG_RESET:			phy_reg = get_phy_reg(ohci, 1);			phy_reg |= 0x40;			set_phy_reg(ohci, 1, phy_reg); /* set IBR */			break;		case SHORT_RESET_NO_FORCE_ROOT:			phy_reg = get_phy_reg(ohci, 1);			if (phy_reg & 0x80) {				phy_reg &= ~0x80;				set_phy_reg(ohci, 1, phy_reg); /* clear RHB */			}			phy_reg = get_phy_reg(ohci, 5);			phy_reg |= 0x40;			set_phy_reg(ohci, 5, phy_reg); /* set ISBR */			break;		case LONG_RESET_NO_FORCE_ROOT:			phy_reg = get_phy_reg(ohci, 1);			phy_reg &= ~0x80;			phy_reg |= 0x40;			set_phy_reg(ohci, 1, phy_reg); /* clear RHB, set IBR */			break;		case SHORT_RESET_FORCE_ROOT:			phy_reg = get_phy_reg(ohci, 1);			if (!(phy_reg & 0x80)) {				phy_reg |= 0x80;				set_phy_reg(ohci, 1, phy_reg); /* set RHB */			}			phy_reg = get_phy_reg(ohci, 5);			phy_reg |= 0x40;			set_phy_reg(ohci, 5, phy_reg); /* set ISBR */			break;		case LONG_RESET_FORCE_ROOT:			phy_reg = get_phy_reg(ohci, 1);			phy_reg |= 0xc0;			set_phy_reg(ohci, 1, phy_reg); /* set RHB and IBR */			break;		default:			retval = -1;		}		break;	case GET_CYCLE_COUNTER:		retval = reg_read(ohci, OHCI1394_IsochronousCycleTimer);		break;	case SET_CYCLE_COUNTER:		reg_write(ohci, OHCI1394_IsochronousCycleTimer, arg);		break;	case SET_BUS_ID:		PRINT(KERN_ERR, "devctl command SET_BUS_ID err");		break;	case ACT_CYCLE_MASTER:		if (arg) {			/* check if we are root and other nodes are present */			u32 nodeId = reg_read(ohci, OHCI1394_NodeID);			if ((nodeId & (1<<30)) && (nodeId & 0x3f)) {				/*				 * enable cycleTimer, cycleMaster				 */				DBGMSG("Cycle master enabled");				reg_write(ohci, OHCI1394_LinkControlSet,					  OHCI1394_LinkControl_CycleTimerEnable |					  OHCI1394_LinkControl_CycleMaster);			}		} else {			/* disable cycleTimer, cycleMaster, cycleSource */			reg_write(ohci, OHCI1394_LinkControlClear,				  OHCI1394_LinkControl_CycleTimerEnable |				  OHCI1394_LinkControl_CycleMaster |				  OHCI1394_LinkControl_CycleSource);		}		break;	case CANCEL_REQUESTS:		DBGMSG("Cancel request received");		dma_trm_reset(&ohci->at_req_context);		dma_trm_reset(&ohci->at_resp_context);		break;	case ISO_LISTEN_CHANNEL:        {		u64 mask;		struct dma_rcv_ctx *d = &ohci->ir_legacy_context;		int ir_legacy_active;		if (arg<0 || arg>63) {			PRINT(KERN_ERR,			      "%s: IS0 listen channel %d is out of range",			      __FUNCTION__, arg);			return -EFAULT;		}		mask = (u64)0x1<<arg;                spin_lock_irqsave(&ohci->IR_channel_lock, flags);		if (ohci->ISO_channel_usage & mask) {			PRINT(KERN_ERR,			      "%s: IS0 listen channel %d is already used",			      __FUNCTION__, arg);			spin_unlock_irqrestore(&ohci->IR_channel_lock, flags);			return -EFAULT;		}		ir_legacy_active = ohci->ir_legacy_channels;		ohci->ISO_channel_usage |= mask;		ohci->ir_legacy_channels |= mask;                spin_unlock_irqrestore(&ohci->IR_channel_lock, flags);		if (!ir_legacy_active) {			if (ohci1394_register_iso_tasklet(ohci,					  &ohci->ir_legacy_tasklet) < 0) {				PRINT(KERN_ERR, "No IR DMA context available");				return -EBUSY;			}			/* the IR context can be assigned to any DMA context			 * by ohci1394_register_iso_tasklet */			d->ctx = ohci->ir_legacy_tasklet.context;			d->ctrlSet = OHCI1394_IsoRcvContextControlSet +				32*d->ctx;			d->ctrlClear = OHCI1394_IsoRcvContextControlClear +				32*d->ctx;			d->cmdPtr = OHCI1394_IsoRcvCommandPtr + 32*d->ctx;			d->ctxtMatch = OHCI1394_IsoRcvContextMatch + 32*d->ctx;			initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1);			if (printk_ratelimit())				PRINT(KERN_ERR, "IR legacy activated");		}                spin_lock_irqsave(&ohci->IR_channel_lock, flags);		if (arg>31)			reg_write(ohci, OHCI1394_IRMultiChanMaskHiSet,				  1<<(arg-32));		else			reg_write(ohci, OHCI1394_IRMultiChanMaskLoSet,				  1<<arg);                spin_unlock_irqrestore(&ohci->IR_channel_lock, flags);                DBGMSG("Listening enabled on channel %d", arg);                break;        }	case ISO_UNLISTEN_CHANNEL:        {		u64 mask;		if (arg<0 || arg>63) {			PRINT(KERN_ERR,			      "%s: IS0 unlisten channel %d is out of range",			      __FUNCTION__, arg);			return -EFAULT;		}		mask = (u64)0x1<<arg;                spin_lock_irqsave(&ohci->IR_channel_lock, flags);		if (!(ohci->ISO_channel_usage & mask)) {			PRINT(KERN_ERR,			      "%s: IS0 unlisten channel %d is not used",			      __FUNCTION__, arg);			spin_unlock_irqrestore(&ohci->IR_channel_lock, flags);			return -EFAULT;		}		ohci->ISO_channel_usage &= ~mask;		ohci->ir_legacy_channels &= ~mask;		if (arg>31)			reg_write(ohci, OHCI1394_IRMultiChanMaskHiClear,				  1<<(arg-32));		else			reg_write(ohci, OHCI1394_IRMultiChanMaskLoClear,				  1<<arg);                spin_unlock_irqrestore(&ohci->IR_channel_lock, flags);                DBGMSG("Listening disabled on channel %d", arg);		if (ohci->ir_legacy_channels == 0) {			stop_dma_rcv_ctx(&ohci->ir_legacy_context);			DBGMSG("ISO legacy receive context stopped");		}                break;        }	default:		PRINT_G(KERN_ERR, "ohci_devctl cmd %d not implemented yet",			cmd);		break;	}	return retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/32e7a04faa29f50f65e06d43a9029bb607743e76/ohci1394.c/buggy/drivers/ieee1394/ohci1394.c