Beispiel #1
0
static void qlogic_detach(struct pcmcia_device *link)
{
	dev_dbg(&link->dev, "qlogic_detach\n");

	qlogic_release(link);
	kfree(link->priv);

}				/* qlogic_detach */
Beispiel #2
0
static void qlogic_detach(struct pcmcia_device *link)
{
	DEBUG(0, "qlogic_detach(0x%p)\n", link);

	qlogic_release(link);
	kfree(link->priv);

}				/* qlogic_detach */
static int qlogic_event(event_t event, int priority, event_callback_args_t * args)
{
	dev_link_t *link = args->client_data;

	DEBUG(1, "qlogic_event(0x%06x)\n", event);

	switch (event) {
	case CS_EVENT_CARD_REMOVAL:
		link->state &= ~DEV_PRESENT;
		if (link->state & DEV_CONFIG)
			qlogic_release(link);
		break;
	case CS_EVENT_CARD_INSERTION:
		link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
		qlogic_config(link);
		break;
	case CS_EVENT_PM_SUSPEND:
		link->state |= DEV_SUSPEND;
		/* Fall through... */
	case CS_EVENT_RESET_PHYSICAL:
		if (link->state & DEV_CONFIG)
			pcmcia_release_configuration(link->handle);
		break;
	case CS_EVENT_PM_RESUME:
		link->state &= ~DEV_SUSPEND;
		/* Fall through... */
	case CS_EVENT_CARD_RESET:
		if (link->state & DEV_CONFIG) {
			scsi_info_t *info = link->priv;
			pcmcia_request_configuration(link->handle, &link->conf);
			if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) {
				outb(0x80, link->io.BasePort1 + 0xd);
				outb(0x24, link->io.BasePort1 + 0x9);
				outb(0x04, link->io.BasePort1 + 0xd);
			}
			/* Ugggglllyyyy!!! */
			qlogicfas408_bus_reset(NULL);
		}
		break;
	}
	return 0;
}				/* qlogic_event */
static void qlogic_detach(dev_link_t * link)
{
	dev_link_t **linkp;

	DEBUG(0, "qlogic_detach(0x%p)\n", link);

	/* Locate device structure */
	for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
		if (*linkp == link)
			break;
	if (*linkp == NULL)
		return;

	if (link->state & DEV_CONFIG)
		qlogic_release(link);

	if (link->handle)
		pcmcia_deregister_client(link->handle);

	/* Unlink device structure, free bits */
	*linkp = link->next;
	kfree(link->priv);

}				/* qlogic_detach */
Beispiel #5
0
static void qlogic_config(dev_link_t * link)
{
	client_handle_t handle = link->handle;
	scsi_info_t *info = link->priv;
	tuple_t tuple;
	cisparse_t parse;
	int i, last_ret, last_fn;
	unsigned short tuple_data[32];
	struct Scsi_Host *host;

	DEBUG(0, "qlogic_config(0x%p)\n", link);

	tuple.TupleData = (cisdata_t *) tuple_data;
	tuple.TupleDataMax = 64;
	tuple.TupleOffset = 0;
	tuple.DesiredTuple = CISTPL_CONFIG;
	CS_CHECK(GetFirstTuple, handle, &tuple);
	CS_CHECK(GetTupleData, handle, &tuple);
	CS_CHECK(ParseTuple, handle, &tuple, &parse);
	link->conf.ConfigBase = parse.config.base;

	tuple.DesiredTuple = CISTPL_MANFID;
	if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) && (CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS))
		info->manf_id = le16_to_cpu(tuple.TupleData[0]);

	/* Configure card */
	link->state |= DEV_CONFIG;

	tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
	CS_CHECK(GetFirstTuple, handle, &tuple);
	while (1) {
		CFG_CHECK(GetTupleData, handle, &tuple);
		CFG_CHECK(ParseTuple, handle, &tuple, &parse);
		link->conf.ConfigIndex = parse.cftable_entry.index;
		link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
		link->io.NumPorts1 = parse.cftable_entry.io.win[0].len;
		if (link->io.BasePort1 != 0) {
			i = CardServices(RequestIO, handle, &link->io);
			if (i == CS_SUCCESS)
				break;
		}
	      next_entry:
		CS_CHECK(GetNextTuple, handle, &tuple);
	}

	CS_CHECK(RequestIRQ, handle, &link->irq);
	CS_CHECK(RequestConfiguration, handle, &link->conf);

	if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) {
		/* set ATAcmd */
		outb(0xb4, link->io.BasePort1 + 0xd);
		outb(0x24, link->io.BasePort1 + 0x9);
		outb(0x04, link->io.BasePort1 + 0xd);
	}

	/* A bad hack... */
	release_region(link->io.BasePort1, link->io.NumPorts1);

	/* The KXL-810AN has a bigger IO port window */
	if (link->io.NumPorts1 == 32)
		qlogicfas_preset(link->io.BasePort1 + 16, link->irq.AssignedIRQ);
	else
		qlogicfas_preset(link->io.BasePort1, link->irq.AssignedIRQ);

	host = __qlogicfas_detect(&qlogicfas_driver_template);
	if (!host) {
		printk(KERN_INFO "qlogic_cs: no SCSI devices found\n");
		goto out;
	}

	sprintf(info->node.dev_name, "scsi%d", host->host_no);
	link->dev = &info->node;
	info->host = host;

	scsi_add_host(host, NULL); /* XXX handle failure */
	scsi_scan_host(host);

out:
	link->state &= ~DEV_CONFIG_PENDING;
	return;

cs_failed:
	cs_error(link->handle, last_fn, last_ret);
	qlogic_release(link);
	return;

}				/* qlogic_config */