Lines Matching refs:link

113 static void pcnet_config(dev_link_t *link);
127 static int setup_shmem_window(dev_link_t *link, int start_pg,
129 static int setup_dma_config(dev_link_t *link, int start_pg,
231 dev_link_t link; member
253 dev_link_t *link, *next; in flush_stale_links() local
254 for (link = dev_list; link; link = next) { in flush_stale_links()
255 next = link->next; in flush_stale_links()
256 if (link->state & DEV_STALE_LINK) in flush_stale_links()
257 pcnet_detach(link); in flush_stale_links()
292 dev_link_t *link; in pcnet_attach() local
304 link = &info->link; dev = &info->dev; in pcnet_attach()
305 link->priv = info; in pcnet_attach()
307 init_timer(&link->release); in pcnet_attach()
308 link->release.function = &pcnet_release; in pcnet_attach()
309 link->release.data = (u_long)link; in pcnet_attach()
310 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; in pcnet_attach()
311 link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; in pcnet_attach()
313 link->irq.IRQInfo2 = irq_mask; in pcnet_attach()
316 link->irq.IRQInfo2 |= 1 << irq_list[i]; in pcnet_attach()
317 link->conf.Attributes = CONF_ENABLE_IRQ; in pcnet_attach()
318 link->conf.IntType = INT_MEMORY_AND_IO; in pcnet_attach()
327 link->next = dev_list; in pcnet_attach()
328 dev_list = link; in pcnet_attach()
337 client_reg.event_callback_args.client_data = link; in pcnet_attach()
338 ret = CardServices(RegisterClient, &link->handle, &client_reg); in pcnet_attach()
340 cs_error(link->handle, RegisterClient, ret); in pcnet_attach()
341 pcnet_detach(link); in pcnet_attach()
345 return link; in pcnet_attach()
357 static void pcnet_detach(dev_link_t *link) in pcnet_detach() argument
359 pcnet_dev_t *info = link->priv; in pcnet_detach()
362 DEBUG(0, "pcnet_detach(0x%p)\n", link); in pcnet_detach()
366 if (*linkp == link) break; in pcnet_detach()
370 del_timer(&link->release); in pcnet_detach()
371 if (link->state & DEV_CONFIG) { in pcnet_detach()
372 pcnet_release((u_long)link); in pcnet_detach()
373 if (link->state & DEV_STALE_CONFIG) { in pcnet_detach()
374 link->state |= DEV_STALE_LINK; in pcnet_detach()
379 if (link->handle) in pcnet_detach()
380 CardServices(DeregisterClient, link->handle); in pcnet_detach()
383 *linkp = link->next; in pcnet_detach()
384 if (link->dev) in pcnet_detach()
397 static hw_info_t *get_hwinfo(dev_link_t *link) in get_hwinfo() argument
399 struct net_device *dev = link->priv; in get_hwinfo()
409 link->win = (window_handle_t)link->handle; in get_hwinfo()
410 i = CardServices(RequestWindow, &link->win, &req); in get_hwinfo()
412 cs_error(link->handle, RequestWindow, i); in get_hwinfo()
420 CardServices(MapMemPage, link->win, &mem); in get_hwinfo()
433 j = CardServices(ReleaseWindow, link->win); in get_hwinfo()
435 cs_error(link->handle, ReleaseWindow, j); in get_hwinfo()
447 static hw_info_t *get_prom(dev_link_t *link) in get_prom() argument
449 struct net_device *dev = link->priv; in get_prom()
501 static hw_info_t *get_dl10019(dev_link_t *link) in get_dl10019() argument
503 struct net_device *dev = link->priv; in get_dl10019()
523 static hw_info_t *get_ax88190(dev_link_t *link) in get_ax88190() argument
525 struct net_device *dev = link->priv; in get_ax88190()
530 if (link->conf.ConfigBase != 0x03c0) in get_ax88190()
556 static hw_info_t *get_hwired(dev_link_t *link) in get_hwired() argument
558 struct net_device *dev = link->priv; in get_hwired()
586 static int try_io_port(dev_link_t *link) in try_io_port() argument
589 if (link->io.NumPorts1 == 32) { in try_io_port()
590 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; in try_io_port()
591 if (link->io.NumPorts2 > 0) { in try_io_port()
593 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; in try_io_port()
594 link->irq.Attributes = in try_io_port()
599 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; in try_io_port()
600 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; in try_io_port()
602 if (link->io.BasePort1 == 0) { in try_io_port()
603 link->io.IOAddrLines = 16; in try_io_port()
605 link->io.BasePort1 = j ^ 0x300; in try_io_port()
606 link->io.BasePort2 = (j ^ 0x300) + 0x10; in try_io_port()
607 ret = CardServices(RequestIO, link->handle, &link->io); in try_io_port()
612 return CardServices(RequestIO, link->handle, &link->io); in try_io_port()
616 static void pcnet_config(dev_link_t *link) in pcnet_config() argument
618 client_handle_t handle = link->handle; in pcnet_config()
619 pcnet_dev_t *info = link->priv; in pcnet_config()
629 DEBUG(0, "pcnet_config(0x%p)\n", link); in pcnet_config()
639 link->conf.ConfigBase = parse.config.base; in pcnet_config()
640 link->conf.Present = parse.config.rmask[0]; in pcnet_config()
643 link->state |= DEV_CONFIG; in pcnet_config()
647 link->conf.Vcc = conf.Vcc; in pcnet_config()
669 link->conf.ConfigIndex = cfg->index; in pcnet_config()
674 link->io.BasePort2 = io->win[1-i].base; in pcnet_config()
675 link->io.NumPorts2 = io->win[1-i].len; in pcnet_config()
677 i = link->io.NumPorts2 = 0; in pcnet_config()
681 link->io.BasePort1 = io->win[i].base; in pcnet_config()
682 link->io.NumPorts1 = io->win[i].len; in pcnet_config()
683 link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; in pcnet_config()
684 if (link->io.NumPorts1 + link->io.NumPorts2 >= 32) { in pcnet_config()
685 last_ret = try_io_port(link); in pcnet_config()
696 CS_CHECK(RequestIRQ, handle, &link->irq); in pcnet_config()
698 if (link->io.NumPorts2 == 8) { in pcnet_config()
699 link->conf.Attributes |= CONF_ENABLE_SPKR; in pcnet_config()
700 link->conf.Status = CCSR_AUDIO_ENA; in pcnet_config()
704 link->conf.ConfigIndex |= 0x10; in pcnet_config()
706 CS_CHECK(RequestConfiguration, handle, &link->conf); in pcnet_config()
707 dev->irq = link->irq.AssignedIRQ; in pcnet_config()
708 dev->base_addr = link->io.BasePort1; in pcnet_config()
722 hw_info = get_hwinfo(link); in pcnet_config()
724 hw_info = get_prom(link); in pcnet_config()
726 hw_info = get_dl10019(link); in pcnet_config()
728 hw_info = get_ax88190(link); in pcnet_config()
730 hw_info = get_hwired(link); in pcnet_config()
762 (setup_shmem_window(link, start_pg, stop_pg, cm_offset) != 0)) in pcnet_config()
763 setup_dma_config(link, start_pg, stop_pg); in pcnet_config()
770 link->dev = &info->node; in pcnet_config()
794 link->state &= ~DEV_CONFIG_PENDING; in pcnet_config()
798 cs_error(link->handle, last_fn, last_ret); in pcnet_config()
800 pcnet_release((u_long)link); in pcnet_config()
801 link->state &= ~DEV_CONFIG_PENDING; in pcnet_config()
815 dev_link_t *link = (dev_link_t *)arg; in pcnet_release() local
816 pcnet_dev_t *info = link->priv; in pcnet_release()
818 DEBUG(0, "pcnet_release(0x%p)\n", link); in pcnet_release()
820 if (link->open) { in pcnet_release()
823 link->state |= DEV_STALE_CONFIG; in pcnet_release()
829 CardServices(ReleaseWindow, link->win); in pcnet_release()
831 CardServices(ReleaseConfiguration, link->handle); in pcnet_release()
832 CardServices(ReleaseIO, link->handle, &link->io); in pcnet_release()
833 CardServices(ReleaseIRQ, link->handle, &link->irq); in pcnet_release()
835 link->state &= ~DEV_CONFIG; in pcnet_release()
851 dev_link_t *link = args->client_data; in pcnet_event() local
852 pcnet_dev_t *info = link->priv; in pcnet_event()
858 link->state &= ~DEV_PRESENT; in pcnet_event()
859 if (link->state & DEV_CONFIG) { in pcnet_event()
861 mod_timer(&link->release, jiffies + HZ/20); in pcnet_event()
865 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; in pcnet_event()
866 pcnet_config(link); in pcnet_event()
869 link->state |= DEV_SUSPEND; in pcnet_event()
872 if (link->state & DEV_CONFIG) { in pcnet_event()
873 if (link->open) in pcnet_event()
875 CardServices(ReleaseConfiguration, link->handle); in pcnet_event()
879 link->state &= ~DEV_SUSPEND; in pcnet_event()
882 if (link->state & DEV_CONFIG) { in pcnet_event()
883 CardServices(RequestConfiguration, link->handle, &link->conf); in pcnet_event()
884 if (link->open) { in pcnet_event()
1122 dev_link_t *link = &info->link; in pcnet_open() local
1126 if (!DEV_OK(link)) in pcnet_open()
1129 link->open++; in pcnet_open()
1150 dev_link_t *link = &info->link; in pcnet_close() local
1157 link->open--; in pcnet_close()
1160 if (link->state & DEV_STALE_CONFIG) in pcnet_close()
1161 mod_timer(&link->release, jiffies + HZ/20); in pcnet_close()
1233 u_short link; in ei_watchdog() local
1257 link = mdio_read(mii_addr, info->phy_id, 1); in ei_watchdog()
1258 if (!link || (link == 0xffff)) { in ei_watchdog()
1268 link &= 0x0004; in ei_watchdog()
1269 if (link != info->link_status) { in ei_watchdog()
1272 (link) ? "found" : "lost"); in ei_watchdog()
1273 if (link && (info->flags & IS_DL10022)) { in ei_watchdog()
1276 } else if (link && (info->flags & IS_DL10019)) { in ei_watchdog()
1280 if (link) { in ei_watchdog()
1293 info->link_status = link; in ei_watchdog()
1296 link = mdio_read(mii_addr, info->eth_phy, 1) & 0x0004; in ei_watchdog()
1297 if (((info->phy_id == info->pna_phy) && link) || in ei_watchdog()
1298 ((info->phy_id != info->pna_phy) && !link)) { in ei_watchdog()
1529 static int setup_dma_config(dev_link_t *link, int start_pg, in setup_dma_config() argument
1532 struct net_device *dev = link->priv; in setup_dma_config()
1629 static int setup_shmem_window(dev_link_t *link, int start_pg, in setup_shmem_window() argument
1632 struct net_device *dev = link->priv; in setup_shmem_window()
1633 pcnet_dev_t *info = link->priv; in setup_shmem_window()
1651 link->win = (window_handle_t)link->handle; in setup_shmem_window()
1652 CS_CHECK(RequestWindow, &link->win, &req); in setup_shmem_window()
1658 CS_CHECK(MapMemPage, link->win, &mem); in setup_shmem_window()
1670 CardServices(ReleaseWindow, link->win); in setup_shmem_window()
1671 info->base = NULL; link->win = NULL; in setup_shmem_window()
1692 cs_error(link->handle, last_fn, last_ret); in setup_shmem_window()