Lines Matching refs:link
96 static void fmvj18x_config(dev_link_t *link);
97 static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id);
98 static int fmvj18x_setup_mfc(dev_link_t *link);
134 dev_link_t link; member
258 dev_link_t *link, *next; in flush_stale_links() local
259 for (link = dev_list; link; link = next) { in flush_stale_links()
260 next = link->next; in flush_stale_links()
261 if (link->state & DEV_STALE_LINK) in flush_stale_links()
262 fmvj18x_detach(link); in flush_stale_links()
279 dev_link_t *link; in fmvj18x_attach() local
291 link = &lp->link; dev = &lp->dev; in fmvj18x_attach()
292 link->priv = dev->priv = link->irq.Instance = lp; in fmvj18x_attach()
294 link->release.function = &fmvj18x_release; in fmvj18x_attach()
295 link->release.data = (u_long)link; in fmvj18x_attach()
298 link->io.NumPorts1 = 32; in fmvj18x_attach()
299 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; in fmvj18x_attach()
300 link->io.IOAddrLines = 5; in fmvj18x_attach()
303 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; in fmvj18x_attach()
304 link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; in fmvj18x_attach()
306 link->irq.IRQInfo2 = irq_mask; in fmvj18x_attach()
309 link->irq.IRQInfo2 |= 1 << irq_list[i]; in fmvj18x_attach()
310 link->irq.Handler = &fjn_interrupt; in fmvj18x_attach()
313 link->conf.Attributes = CONF_ENABLE_IRQ; in fmvj18x_attach()
314 link->conf.Vcc = 50; in fmvj18x_attach()
315 link->conf.IntType = INT_MEMORY_AND_IO; in fmvj18x_attach()
332 link->next = dev_list; in fmvj18x_attach()
333 dev_list = link; in fmvj18x_attach()
342 client_reg.event_callback_args.client_data = link; in fmvj18x_attach()
343 ret = CardServices(RegisterClient, &link->handle, &client_reg); in fmvj18x_attach()
345 cs_error(link->handle, RegisterClient, ret); in fmvj18x_attach()
346 fmvj18x_detach(link); in fmvj18x_attach()
350 return link; in fmvj18x_attach()
355 static void fmvj18x_detach(dev_link_t *link) in fmvj18x_detach() argument
357 local_info_t *lp = link->priv; in fmvj18x_detach()
360 DEBUG(0, "fmvj18x_detach(0x%p)\n", link); in fmvj18x_detach()
364 if (*linkp == link) break; in fmvj18x_detach()
368 del_timer_sync(&link->release); in fmvj18x_detach()
369 if (link->state & DEV_CONFIG) { in fmvj18x_detach()
370 fmvj18x_release((u_long)link); in fmvj18x_detach()
371 if (link->state & DEV_STALE_CONFIG) { in fmvj18x_detach()
372 link->state |= DEV_STALE_LINK; in fmvj18x_detach()
378 if (link->handle) in fmvj18x_detach()
379 CardServices(DeregisterClient, link->handle); in fmvj18x_detach()
382 *linkp = link->next; in fmvj18x_detach()
383 if (link->dev) in fmvj18x_detach()
394 static int mfc_try_io_port(dev_link_t *link) in mfc_try_io_port() argument
400 link->io.BasePort2 = serial_base[i]; in mfc_try_io_port()
401 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; in mfc_try_io_port()
402 if (link->io.BasePort2 == 0) { in mfc_try_io_port()
403 link->io.NumPorts2 = 0; in mfc_try_io_port()
406 ret = CardServices(RequestIO, link->handle, &link->io); in mfc_try_io_port()
412 static int ungermann_try_io_port(dev_link_t *link) in ungermann_try_io_port() argument
421 link->io.BasePort1 = ioaddr; in ungermann_try_io_port()
422 ret = CardServices(RequestIO, link->handle, &link->io); in ungermann_try_io_port()
425 link->conf.ConfigIndex = in ungermann_try_io_port()
426 ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; in ungermann_try_io_port()
433 static void fmvj18x_config(dev_link_t *link) in fmvj18x_config() argument
435 client_handle_t handle = link->handle; in fmvj18x_config()
436 local_info_t *lp = link->priv; in fmvj18x_config()
447 DEBUG(0, "fmvj18x_config(0x%p)\n", link); in fmvj18x_config()
462 link->state |= DEV_CONFIG; in fmvj18x_config()
464 link->conf.ConfigBase = parse.config.base; in fmvj18x_config()
465 link->conf.Present = parse.config.rmask[0]; in fmvj18x_config()
475 link->conf.ConfigIndex = parse.cftable_entry.index; in fmvj18x_config()
488 link->conf.Vcc = 33; /* inserted in 3.3V slot */ in fmvj18x_config()
491 link->conf.ConfigBase = 0x800; in fmvj18x_config()
492 link->conf.ConfigIndex = 0x47; in fmvj18x_config()
493 link->io.NumPorts2 = 8; in fmvj18x_config()
523 link->conf.ConfigIndex = 0x20; in fmvj18x_config()
526 link->conf.ConfigIndex = 1; in fmvj18x_config()
534 link->conf.ConfigIndex = 1; in fmvj18x_config()
538 if (link->io.NumPorts2 != 0) { in fmvj18x_config()
539 link->irq.Attributes = in fmvj18x_config()
541 ret = mfc_try_io_port(link); in fmvj18x_config()
544 ret = ungermann_try_io_port(link); in fmvj18x_config()
547 CS_CHECK(RequestIO, link->handle, &link->io); in fmvj18x_config()
549 CS_CHECK(RequestIRQ, link->handle, &link->irq); in fmvj18x_config()
550 CS_CHECK(RequestConfiguration, link->handle, &link->conf); in fmvj18x_config()
551 dev->irq = link->irq.AssignedIRQ; in fmvj18x_config()
552 dev->base_addr = link->io.BasePort1; in fmvj18x_config()
558 if (link->io.BasePort2 != 0) in fmvj18x_config()
559 fmvj18x_setup_mfc(link); in fmvj18x_config()
616 if (fmvj18x_get_hwinfo(link, tuple.TupleData) == -1) { in fmvj18x_config()
636 link->dev = &lp->node; in fmvj18x_config()
646 link->state &= ~DEV_CONFIG_PENDING; in fmvj18x_config()
651 cs_error(link->handle, last_fn, last_ret); in fmvj18x_config()
653 fmvj18x_release((u_long)link); in fmvj18x_config()
654 link->state &= ~DEV_CONFIG_PENDING; in fmvj18x_config()
659 static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id) in fmvj18x_get_hwinfo() argument
670 link->win = (window_handle_t)link->handle; in fmvj18x_get_hwinfo()
671 i = CardServices(RequestWindow, &link->win, &req); in fmvj18x_get_hwinfo()
673 cs_error(link->handle, RequestWindow, i); in fmvj18x_get_hwinfo()
680 CardServices(MapMemPage, link->win, &mem); in fmvj18x_get_hwinfo()
705 j = CardServices(ReleaseWindow, link->win); in fmvj18x_get_hwinfo()
707 cs_error(link->handle, ReleaseWindow, j); in fmvj18x_get_hwinfo()
713 static int fmvj18x_setup_mfc(dev_link_t *link) in fmvj18x_setup_mfc() argument
719 local_info_t *lp = link->priv; in fmvj18x_setup_mfc()
727 link->win = (window_handle_t)link->handle; in fmvj18x_setup_mfc()
728 i = CardServices(RequestWindow, &link->win, &req); in fmvj18x_setup_mfc()
730 cs_error(link->handle, RequestWindow, i); in fmvj18x_setup_mfc()
737 CardServices(MapMemPage, link->win, &mem); in fmvj18x_setup_mfc()
750 j = CardServices(ReleaseWindow, link->win); in fmvj18x_setup_mfc()
752 cs_error(link->handle, ReleaseWindow, j); in fmvj18x_setup_mfc()
760 dev_link_t *link = (dev_link_t *)arg; in fmvj18x_release() local
762 DEBUG(0, "fmvj18x_release(0x%p)\n", link); in fmvj18x_release()
768 if (link->open) { in fmvj18x_release()
770 "still open\n", link->dev->dev_name); in fmvj18x_release()
771 link->state |= DEV_STALE_CONFIG; in fmvj18x_release()
776 CardServices(ReleaseWindow, link->win); in fmvj18x_release()
777 CardServices(ReleaseConfiguration, link->handle); in fmvj18x_release()
778 CardServices(ReleaseIO, link->handle, &link->io); in fmvj18x_release()
779 CardServices(ReleaseIRQ, link->handle, &link->irq); in fmvj18x_release()
781 link->state &= ~DEV_CONFIG; in fmvj18x_release()
790 dev_link_t *link = args->client_data; in fmvj18x_event() local
791 local_info_t *lp = link->priv; in fmvj18x_event()
798 link->state &= ~DEV_PRESENT; in fmvj18x_event()
799 if (link->state & DEV_CONFIG) { in fmvj18x_event()
801 mod_timer(&link->release, jiffies + HZ/20); in fmvj18x_event()
805 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; in fmvj18x_event()
806 fmvj18x_config(link); in fmvj18x_event()
809 link->state |= DEV_SUSPEND; in fmvj18x_event()
812 if (link->state & DEV_CONFIG) { in fmvj18x_event()
813 if (link->open) in fmvj18x_event()
815 CardServices(ReleaseConfiguration, link->handle); in fmvj18x_event()
819 link->state &= ~DEV_SUSPEND; in fmvj18x_event()
822 if (link->state & DEV_CONFIG) { in fmvj18x_event()
823 CardServices(RequestConfiguration, link->handle, &link->conf); in fmvj18x_event()
824 if (link->open) { in fmvj18x_event()
1245 dev_link_t *link = &lp->link; in fjn_open() local
1249 if (!DEV_OK(link)) in fjn_open()
1252 link->open++; in fjn_open()
1272 dev_link_t *link = &lp->link; in fjn_close() local
1295 link->open--; in fjn_close()
1296 if (link->state & DEV_STALE_CONFIG) in fjn_close()
1297 mod_timer(&link->release, jiffies + HZ/20); in fjn_close()