device.c (dca3a783400a18e2bf4503b1d4a85c4d0ca1a7e4) | device.c (188561a462d3b82451d6ba09e2e32c9ba2c9938c) |
---|---|
1/* 2 * bus driver for ccw devices 3 * 4 * Copyright IBM Corp. 2002, 2008 5 * Author(s): Arnd Bergmann (arndb@de.ibm.com) 6 * Cornelia Huck (cornelia.huck@de.ibm.com) 7 * Martin Schwidefsky (schwidefsky@de.ibm.com) 8 */ --- 5 unchanged lines hidden (view full) --- 14#include <linux/init.h> 15#include <linux/spinlock.h> 16#include <linux/errno.h> 17#include <linux/err.h> 18#include <linux/slab.h> 19#include <linux/list.h> 20#include <linux/device.h> 21#include <linux/workqueue.h> | 1/* 2 * bus driver for ccw devices 3 * 4 * Copyright IBM Corp. 2002, 2008 5 * Author(s): Arnd Bergmann (arndb@de.ibm.com) 6 * Cornelia Huck (cornelia.huck@de.ibm.com) 7 * Martin Schwidefsky (schwidefsky@de.ibm.com) 8 */ --- 5 unchanged lines hidden (view full) --- 14#include <linux/init.h> 15#include <linux/spinlock.h> 16#include <linux/errno.h> 17#include <linux/err.h> 18#include <linux/slab.h> 19#include <linux/list.h> 20#include <linux/device.h> 21#include <linux/workqueue.h> |
22#include <linux/delay.h> |
|
22#include <linux/timer.h> 23#include <linux/kernel_stat.h> 24 25#include <asm/ccwdev.h> 26#include <asm/cio.h> 27#include <asm/param.h> /* HZ */ 28#include <asm/cmb.h> 29#include <asm/isc.h> --- 1577 unchanged lines hidden (view full) --- 1607 sch->driver = &io_subchannel_driver; 1608 /* Initialize the ccw_device structure. */ 1609 cdev->dev.parent= &sch->dev; 1610 sch_set_cdev(sch, cdev); 1611 io_subchannel_recog(cdev, sch); 1612 /* Now wait for the async. recognition to come to an end. */ 1613 spin_lock_irq(cdev->ccwlock); 1614 while (!dev_fsm_final_state(cdev)) | 23#include <linux/timer.h> 24#include <linux/kernel_stat.h> 25 26#include <asm/ccwdev.h> 27#include <asm/cio.h> 28#include <asm/param.h> /* HZ */ 29#include <asm/cmb.h> 30#include <asm/isc.h> --- 1577 unchanged lines hidden (view full) --- 1608 sch->driver = &io_subchannel_driver; 1609 /* Initialize the ccw_device structure. */ 1610 cdev->dev.parent= &sch->dev; 1611 sch_set_cdev(sch, cdev); 1612 io_subchannel_recog(cdev, sch); 1613 /* Now wait for the async. recognition to come to an end. */ 1614 spin_lock_irq(cdev->ccwlock); 1615 while (!dev_fsm_final_state(cdev)) |
1615 wait_cons_dev(); | 1616 ccw_device_wait_idle(cdev); 1617 |
1616 rc = -EIO; 1617 if (cdev->private->state != DEV_STATE_OFFLINE) 1618 goto out_unlock; 1619 ccw_device_online(cdev); 1620 while (!dev_fsm_final_state(cdev)) | 1618 rc = -EIO; 1619 if (cdev->private->state != DEV_STATE_OFFLINE) 1620 goto out_unlock; 1621 ccw_device_online(cdev); 1622 while (!dev_fsm_final_state(cdev)) |
1621 wait_cons_dev(); | 1623 ccw_device_wait_idle(cdev); 1624 |
1622 if (cdev->private->state != DEV_STATE_ONLINE) 1623 goto out_unlock; 1624 rc = 0; 1625out_unlock: 1626 spin_unlock_irq(cdev->ccwlock); 1627 return rc; 1628} 1629 --- 20 unchanged lines hidden (view full) --- 1650 cio_release_console(); 1651 console_cdev_in_use = 0; 1652 return ERR_PTR(ret); 1653 } 1654 console_cdev.online = 1; 1655 return &console_cdev; 1656} 1657 | 1625 if (cdev->private->state != DEV_STATE_ONLINE) 1626 goto out_unlock; 1627 rc = 0; 1628out_unlock: 1629 spin_unlock_irq(cdev->ccwlock); 1630 return rc; 1631} 1632 --- 20 unchanged lines hidden (view full) --- 1653 cio_release_console(); 1654 console_cdev_in_use = 0; 1655 return ERR_PTR(ret); 1656 } 1657 console_cdev.online = 1; 1658 return &console_cdev; 1659} 1660 |
1661/** 1662 * ccw_device_wait_idle() - busy wait for device to become idle 1663 * @cdev: ccw device 1664 * 1665 * Poll until activity control is zero, that is, no function or data 1666 * transfer is pending/active. 1667 * Called with device lock being held. 1668 */ 1669void ccw_device_wait_idle(struct ccw_device *cdev) 1670{ 1671 struct subchannel *sch = to_subchannel(cdev->dev.parent); 1672 1673 while (1) { 1674 cio_tsch(sch); 1675 if (sch->schib.scsw.cmd.actl == 0) 1676 break; 1677 udelay_simple(100); 1678 } 1679} 1680 |
|
1658static int ccw_device_pm_restore(struct device *dev); 1659 1660int ccw_device_force_console(void) 1661{ 1662 if (!console_cdev_in_use) 1663 return -ENODEV; 1664 return ccw_device_pm_restore(&console_cdev.dev); 1665} --- 475 unchanged lines hidden --- | 1681static int ccw_device_pm_restore(struct device *dev); 1682 1683int ccw_device_force_console(void) 1684{ 1685 if (!console_cdev_in_use) 1686 return -ENODEV; 1687 return ccw_device_pm_restore(&console_cdev.dev); 1688} --- 475 unchanged lines hidden --- |