rem: if (acquire_sem_etc(bus->sync_wait_sem, 1, B_RELATIVE_TIMEOUT, 1000) == B_TIMED_OUT) {
add: if (acquire_sem_etc(bus->sync_wait_sem, 1, B_RELATIVE_TIMEOUT, 100000) == B_TIMED_OUT) {
context: scan_device_int(ide_device_info *device, bool atapi){	ide_bus_info *bus = device->bus;	int status;	FAST_LOG1(bus->log, ev_ide_scan_device_int, (uint32)atapi);	device->tf_param_mask = 0;	device->tf.write.command = atapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE		: IDE_CMD_IDENTIFY_DEVICE;	// initialize device selection flags,	// this is the only place where this bit gets initialized in the task file	if (bus->controller->read_command_block_regs(bus->channel, &device->tf,			ide_mask_device_head) != B_OK) 		return false;	device->tf.lba.device = device->is_device1;	if (!send_command(device, NULL, atapi ? false : true, 20, ide_state_sync_waiting)) {		FAST_LOG0(bus->log, ev_ide_scan_device_int_cant_send);		return false;	}	// do a short wait first - if there's no device at all we could wait forever	if (acquire_sem_etc(bus->sync_wait_sem, 1, B_RELATIVE_TIMEOUT, 1000/*100000*/) == B_TIMED_OUT) {		bool cont;		SHOW_FLOW0( 3, "no fast response to inquiry" );		// check the busy flag - if it's still set, there's probably no device			IDE_LOCK(bus);		status = bus->controller->get_altstatus(bus->channel);		SHOW_FLOW(3, "status=%x", (int)status);		cont = (status & ide_status_bsy) == ide_status_bsy;		IDE_UNLOCK(bus);		if (!cont) {			SHOW_FLOW0( 3, "no busy bit set after 100ms - probably noone there" );			// no reaction -> abort waiting			cancel_irq_timeout(bus);			// timeout or irq may have been fired, reset semaphore just is case			acquire_sem_etc(bus->sync_wait_sem, 1, B_RELATIVE_TIMEOUT, 0);			FAST_LOG0(bus->log, ev_ide_scan_device_int_keeps_busy);			return false;		}		SHOW_FLOW0( 3, "busy bit set, give device more time" );		// there is something, so wait for it		acquire_sem(bus->sync_wait_sem);	}	// cancel the timeout manually; usuall this is done by wait_for_sync(), but	// we've used the wait semaphore directly		cancel_irq_timeout(bus);	if (bus->sync_wait_timeout)		return false;	ide_wait(device, ide_status_drq, ide_status_bsy, true, 1000);	status = bus->controller->get_altstatus(bus->channel);	if ((status & ide_status_err) != 0) {		// if there's no device, all bits including the error bit are set		SHOW_FLOW( 3, "err set - no device or wrong type (status: %x)", status );		return false;	}	// get the infoblock			bus->controller->read_pio(bus->channel, (uint16 *)&device->infoblock, 		sizeof(device->infoblock) / sizeof(uint16), false);	if (!wait_for_drqdown(device))		return false;	SHOW_FLOW0( 3, "device found" );	FAST_LOG0(bus->log, ev_ide_scan_device_int_found);	prep_infoblock(device);	return true;	}