Pull networking merge from David Miller: "1) Move ixgbe driver over to purely page based buffering on receive. From Alexander Duyck. 2) Add receive packet steering support to e1000e, from Bruce Allan. 3) Convert TCP MD5 support over to RCU, from Eric Dumazet. 4) Reduce cpu usage in handling out-of-order TCP packets on modern systems, also from Eric Dumazet. 5) Support the IP{,V6}_UNICAST_IF socket options, making the wine folks happy, from Erich Hoover. 6) Support VLAN trunking from guests in hyperv driver, from Haiyang Zhang. 7) Support byte-queue-limtis in r8169, from Igor Maravic. 8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but was never properly implemented, Jiri Benc fixed that. 9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang. 10) Support kernel side dump filtering by ctmark in netfilter ctnetlink, from Pablo Neira Ayuso. 11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker. 12) Add new peek socket options to assist with socket migration, from Pavel Emelyanov. 13) Add sch_plug packet scheduler whose queue is controlled by userland daemons using explicit freeze and release commands. From Shriram Rajagopalan. 14) Fix FCOE checksum offload handling on transmit, from Yi Zou." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits) Fix pppol2tp getsockname() Remove printk from rds_sendmsg ipv6: fix incorrent ipv6 ipsec packet fragment cpsw: Hook up default ndo_change_mtu. net: qmi_wwan: fix build error due to cdc-wdm dependecy netdev: driver: ethernet: Add TI CPSW driver netdev: driver: ethernet: add cpsw address lookup engine support phy: add am79c874 PHY support mlx4_core: fix race on comm channel bonding: send igmp report for its master fs_enet: Add MPC5125 FEC support and PHY interface selection net: bpf_jit: fix BPF_S_LDX_B_MSH compilation net: update the usage of CHECKSUM_UNNECESSARY fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso ixgbe: Fix issues with SR-IOV loopback when flow control is disabled net/hyperv: Fix the code handling tx busy ixgbe: fix namespace issues when FCoE/DCB is not enabled rtlwifi: Remove unused ETH_ADDR_LEN defines igbvf: Use ETH_ALEN ... Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.
Unified · Split
| @@ -65,6 +65,13 @@ Description: · 64 unmodified lines | |||
| 65 | Defines the penalty which will be applied to an | 65 | Defines the penalty which will be applied to an |
| 66 | originator message's tq-field on every hop. | 66 | originator message's tq-field on every hop. |
| 67 | 67 | ||
| 68 | What: /sys/class/net/<mesh_iface>/mesh/routing_algo | ||
| 69 | Date: Dec 2011 | ||
| 70 | Contact: Marek Lindner <lindner_marek@yahoo.de> | ||
| 71 | Description: | ||
| 72 | Defines the routing procotol this mesh instance | ||
| 73 | uses to find the optimal paths through the mesh. | ||
| 74 | |||
| 68 | What: /sys/class/net/<mesh_iface>/mesh/vis_mode | 75 | What: /sys/class/net/<mesh_iface>/mesh/vis_mode |
| 69 | Date: May 2010 | 76 | Date: May 2010 |
| 70 | Contact: Marek Lindner <lindner_marek@yahoo.de> | 77 | Contact: Marek Lindner <lindner_marek@yahoo.de> |
| @@ -129,7 +129,6 @@ · 128 unmodified lines | |||
| 129 | !Finclude/net/cfg80211.h cfg80211_pmksa | 129 | !Finclude/net/cfg80211.h cfg80211_pmksa |
| 130 | !Finclude/net/cfg80211.h cfg80211_send_rx_auth | 130 | !Finclude/net/cfg80211.h cfg80211_send_rx_auth |
| 131 | !Finclude/net/cfg80211.h cfg80211_send_auth_timeout | 131 | !Finclude/net/cfg80211.h cfg80211_send_auth_timeout |
| 132 | !Finclude/net/cfg80211.h __cfg80211_auth_canceled | ||
| 133 | !Finclude/net/cfg80211.h cfg80211_send_rx_assoc | 132 | !Finclude/net/cfg80211.h cfg80211_send_rx_assoc |
| 134 | !Finclude/net/cfg80211.h cfg80211_send_assoc_timeout | 133 | !Finclude/net/cfg80211.h cfg80211_send_assoc_timeout |
| 135 | !Finclude/net/cfg80211.h cfg80211_send_deauth | 134 | !Finclude/net/cfg80211.h cfg80211_send_deauth |
| @@ -0,0 +1,28 @@ | |||
| 1 | * STMicroelectronics 10/100/1000 Ethernet driver (GMAC) | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: Should be "st,spear600-gmac" | ||
| 5 | - reg: Address and length of the register set for the device | ||
| 6 | - interrupt-parent: Should be the phandle for the interrupt controller | ||
| 7 | that services interrupts for this device | ||
| 8 | - interrupts: Should contain the STMMAC interrupts | ||
| 9 | - interrupt-names: Should contain the interrupt names "macirq" | ||
| 10 | "eth_wake_irq" if this interrupt is supported in the "interrupts" | ||
| 11 | property | ||
| 12 | - phy-mode: String, operation mode of the PHY interface. | ||
| 13 | Supported values are: "mii", "rmii", "gmii", "rgmii". | ||
| 14 | |||
| 15 | Optional properties: | ||
| 16 | - mac-address: 6 bytes, mac address | ||
| 17 | |||
| 18 | Examples: | ||
| 19 | |||
| 20 | gmac0: ethernet@e0800000 { | ||
| 21 | compatible = "st,spear600-gmac"; | ||
| 22 | reg = <0xe0800000 0x8000>; | ||
| 23 | interrupt-parent = <&vic1>; | ||
| 24 | interrupts = <24 23>; | ||
| 25 | interrupt-names = "macirq", "eth_wake_irq"; | ||
| 26 | mac-address = [000000000000]; /* Filled in by U-Boot */ | ||
| 27 | phy-mode = "gmii"; | ||
| 28 | }; | ||
| @@ -255,7 +255,7 @@ Code Seq#(hex) Include File Comments · 254 unmodified lines | |||
| 255 | linux/ixjuser.h <http://web.archive.org/web/*/http://www.quicknet.net> | 255 | linux/ixjuser.h <http://web.archive.org/web/*/http://www.quicknet.net> |
| 256 | 'r' 00-1F linux/msdos_fs.h and fs/fat/dir.c | 256 | 'r' 00-1F linux/msdos_fs.h and fs/fat/dir.c |
| 257 | 's' all linux/cdk.h | 257 | 's' all linux/cdk.h |
| 258 | 't' 00-7F linux/if_ppp.h | 258 | 't' 00-7F linux/ppp-ioctl.h |
| 259 | 't' 80-8F linux/isdn_ppp.h | 259 | 't' 80-8F linux/isdn_ppp.h |
| 260 | 't' 90 linux/toshiba.h | 260 | 't' 90 linux/toshiba.h |
| 261 | 'u' 00-1F linux/smb_fs.h gone | 261 | 'u' 00-1F linux/smb_fs.h gone |
| @@ -89,7 +89,7 @@ TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h · 88 unmodified lines | |||
| 89 | MGSLPC_MAGIC 0x5402 mgslpc_info drivers/char/pcmcia/synclink_cs.c | 89 | MGSLPC_MAGIC 0x5402 mgslpc_info drivers/char/pcmcia/synclink_cs.c |
| 90 | TTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.h | 90 | TTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.h |
| 91 | USB_SERIAL_MAGIC 0x6702 usb_serial drivers/usb/serial/usb-serial.h | 91 | USB_SERIAL_MAGIC 0x6702 usb_serial drivers/usb/serial/usb-serial.h |
| 92 | FULL_DUPLEX_MAGIC 0x6969 drivers/net/tulip/de2104x.c | 92 | FULL_DUPLEX_MAGIC 0x6969 drivers/net/ethernet/dec/tulip/de2104x.c |
| 93 | USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c | 93 | USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c |
| 94 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c | 94 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c |
| 95 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h | 95 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h |
| @@ -1,46 +1,288 @@ | |||
| 1 | Copyright (c) 2003-2008 QLogic Corporation | 1 | Copyright (c) 2003-2011 QLogic Corporation |
| 2 | QLogic Linux Networking HBA Driver | 2 | QLogic Linux qlge NIC Driver |
| 3 | 3 | ||
| 4 | This program includes a device driver for Linux 2.6 that may be | ||
| 5 | distributed with QLogic hardware specific firmware binary file. | ||
| 6 | You may modify and redistribute the device driver code under the | 4 | You may modify and redistribute the device driver code under the |
| 7 | GNU General Public License as published by the Free Software | 5 | GNU General Public License (a copy of which is attached hereto as |
| 8 | Foundation (version 2 or a later version). | 6 | Exhibit A) published by the Free Software Foundation (version 2). |
| 9 | |||
| 10 | You may redistribute the hardware specific firmware binary file | ||
| 11 | under the following terms: | ||
| 12 | |||
| 13 | 1. Redistribution of source code (only if applicable), | ||
| 14 | must retain the above copyright notice, this list of | ||
| 15 | conditions and the following disclaimer. | ||
| 16 | |||
| 17 | 2. Redistribution in binary form must reproduce the above | ||
| 18 | copyright notice, this list of conditions and the | ||
| 19 | following disclaimer in the documentation and/or other | ||
| 20 | materials provided with the distribution. | ||
| 21 | |||
| 22 | 3. The name of QLogic Corporation may not be used to | ||
| 23 | endorse or promote products derived from this software | ||
| 24 | without specific prior written permission | ||
| 25 | |||
| 26 | REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE, | ||
| 27 | THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY | ||
| 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
| 30 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR | ||
| 31 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| 32 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
| 33 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
| 35 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 36 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 37 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 38 | POSSIBILITY OF SUCH DAMAGE. | ||
| 39 | |||
| 40 | USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT | ||
| 41 | CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR | ||
| 42 | OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT, | ||
| 43 | TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN | ||
| 44 | ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN | ||
| 45 | COMBINATION WITH THIS PROGRAM. | ||
| 46 | 7 | ||
| 8 | |||
| 9 | EXHIBIT A | ||
| 10 | |||
| 11 | GNU GENERAL PUBLIC LICENSE | ||
| 12 | Version 2, June 1991 | ||
| 13 | |||
| 14 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. | ||
| 15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 16 | Everyone is permitted to copy and distribute verbatim copies | ||
| 17 | of this license document, but changing it is not allowed. | ||
| 18 | |||
| 19 | Preamble | ||
| 20 | |||
| 21 | The licenses for most software are designed to take away your | ||
| 22 | freedom to share and change it. By contrast, the GNU General Public | ||
| 23 | License is intended to guarantee your freedom to share and change free | ||
| 24 | software--to make sure the software is free for all its users. This | ||
| 25 | General Public License applies to most of the Free Software | ||
| 26 | Foundation's software and to any other program whose authors commit to | ||
| 27 | using it. (Some other Free Software Foundation software is covered by | ||
| 28 | the GNU Lesser General Public License instead.) You can apply it to | ||
| 29 | your programs, too. | ||
| 30 | |||
| 31 | When we speak of free software, we are referring to freedom, not | ||
| 32 | price. Our General Public Licenses are designed to make sure that you | ||
| 33 | have the freedom to distribute copies of free software (and charge for | ||
| 34 | this service if you wish), that you receive source code or can get it | ||
| 35 | if you want it, that you can change the software or use pieces of it | ||
| 36 | in new free programs; and that you know you can do these things. | ||
| 37 | |||
| 38 | To protect your rights, we need to make restrictions that forbid | ||
| 39 | anyone to deny you these rights or to ask you to surrender the rights. | ||
| 40 | These restrictions translate to certain responsibilities for you if you | ||
| 41 | distribute copies of the software, or if you modify it. | ||
| 42 | |||
| 43 | For example, if you distribute copies of such a program, whether | ||
| 44 | gratis or for a fee, you must give the recipients all the rights that | ||
| 45 | you have. You must make sure that they, too, receive or can get the | ||
| 46 | source code. And you must show them these terms so they know their | ||
| 47 | rights. | ||
| 48 | |||
| 49 | We protect your rights with two steps: (1) copyright the software, and | ||
| 50 | (2) offer you this license which gives you legal permission to copy, | ||
| 51 | distribute and/or modify the software. | ||
| 52 | |||
| 53 | Also, for each author's protection and ours, we want to make certain | ||
| 54 | that everyone understands that there is no warranty for this free | ||
| 55 | software. If the software is modified by someone else and passed on, we | ||
| 56 | want its recipients to know that what they have is not the original, so | ||
| 57 | that any problems introduced by others will not reflect on the original | ||
| 58 | authors' reputations. | ||
| 59 | |||
| 60 | Finally, any free program is threatened constantly by software | ||
| 61 | patents. We wish to avoid the danger that redistributors of a free | ||
| 62 | program will individually obtain patent licenses, in effect making the | ||
| 63 | program proprietary. To prevent this, we have made it clear that any | ||
| 64 | patent must be licensed for everyone's free use or not licensed at all. | ||
| 65 | |||
| 66 | The precise terms and conditions for copying, distribution and | ||
| 67 | modification follow. | ||
| 68 | |||
| 69 | GNU GENERAL PUBLIC LICENSE | ||
| 70 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
| 71 | |||
| 72 | 0. This License applies to any program or other work which contains | ||
| 73 | a notice placed by the copyright holder saying it may be distributed | ||
| 74 | under the terms of this General Public License. The "Program", below, | ||
| 75 | refers to any such program or work, and a "work based on the Program" | ||
| 76 | means either the Program or any derivative work under copyright law: | ||
| 77 | that is to say, a work containing the Program or a portion of it, | ||
| 78 | either verbatim or with modifications and/or translated into another | ||
| 79 | language. (Hereinafter, translation is included without limitation in | ||
| 80 | the term "modification".) Each licensee is addressed as "you". | ||
| 81 | |||
| 82 | Activities other than copying, distribution and modification are not | ||
| 83 | covered by this License; they are outside its scope. The act of | ||
| 84 | running the Program is not restricted, and the output from the Program | ||
| 85 | is covered only if its contents constitute a work based on the | ||
| 86 | Program (independent of having been made by running the Program). | ||
| 87 | Whether that is true depends on what the Program does. | ||
| 88 | |||
| 89 | 1. You may copy and distribute verbatim copies of the Program's | ||
| 90 | source code as you receive it, in any medium, provided that you | ||
| 91 | conspicuously and appropriately publish on each copy an appropriate | ||
| 92 | copyright notice and disclaimer of warranty; keep intact all the | ||
| 93 | notices that refer to this License and to the absence of any warranty; | ||
| 94 | and give any other recipients of the Program a copy of this License | ||
| 95 | along with the Program. | ||
| 96 | |||
| 97 | You may charge a fee for the physical act of transferring a copy, and | ||
| 98 | you may at your option offer warranty protection in exchange for a fee. | ||
| 99 | |||
| 100 | 2. You may modify your copy or copies of the Program or any portion | ||
| 101 | of it, thus forming a work based on the Program, and copy and | ||
| 102 | distribute such modifications or work under the terms of Section 1 | ||
| 103 | above, provided that you also meet all of these conditions: | ||
| 104 | |||
| 105 | a) You must cause the modified files to carry prominent notices | ||
| 106 | stating that you changed the files and the date of any change. | ||
| 107 | |||
| 108 | b) You must cause any work that you distribute or publish, that in | ||
| 109 | whole or in part contains or is derived from the Program or any | ||
| 110 | part thereof, to be licensed as a whole at no charge to all third | ||
| 111 | parties under the terms of this License. | ||
| 112 | |||
| 113 | c) If the modified program normally reads commands interactively | ||
| 114 | when run, you must cause it, when started running for such | ||
| 115 | interactive use in the most ordinary way, to print or display an | ||
| 116 | announcement including an appropriate copyright notice and a | ||
| 117 | notice that there is no warranty (or else, saying that you provide | ||
| 118 | a warranty) and that users may redistribute the program under | ||
| 119 | these conditions, and telling the user how to view a copy of this | ||
| 120 | License. (Exception: if the Program itself is interactive but | ||
| 121 | does not normally print such an announcement, your work based on | ||
| 122 | the Program is not required to print an announcement.) | ||
| 123 | |||
| 124 | These requirements apply to the modified work as a whole. If | ||
| 125 | identifiable sections of that work are not derived from the Program, | ||
| 126 | and can be reasonably considered independent and separate works in | ||
| 127 | themselves, then this License, and its terms, do not apply to those | ||
| 128 | sections when you distribute them as separate works. But when you | ||
| 129 | distribute the same sections as part of a whole which is a work based | ||
| 130 | on the Program, the distribution of the whole must be on the terms of | ||
| 131 | this License, whose permissions for other licensees extend to the | ||
| 132 | entire whole, and thus to each and every part regardless of who wrote it. | ||
| 133 | |||
| 134 | Thus, it is not the intent of this section to claim rights or contest | ||
| 135 | your rights to work written entirely by you; rather, the intent is to | ||
| 136 | exercise the right to control the distribution of derivative or | ||
| 137 | collective works based on the Program. | ||
| 138 | |||
| 139 | In addition, mere aggregation of another work not based on the Program | ||
| 140 | with the Program (or with a work based on the Program) on a volume of | ||
| 141 | a storage or distribution medium does not bring the other work under | ||
| 142 | the scope of this License. | ||
| 143 | |||
| 144 | 3. You may copy and distribute the Program (or a work based on it, | ||
| 145 | under Section 2) in object code or executable form under the terms of | ||
| 146 | Sections 1 and 2 above provided that you also do one of the following: | ||
| 147 | |||
| 148 | a) Accompany it with the complete corresponding machine-readable | ||
| 149 | source code, which must be distributed under the terms of Sections | ||
| 150 | 1 and 2 above on a medium customarily used for software interchange; or, | ||
| 151 | |||
| 152 | b) Accompany it with a written offer, valid for at least three | ||
| 153 | years, to give any third party, for a charge no more than your | ||
| 154 | cost of physically performing source distribution, a complete | ||
| 155 | machine-readable copy of the corresponding source code, to be | ||
| 156 | distributed under the terms of Sections 1 and 2 above on a medium | ||
| 157 | customarily used for software interchange; or, | ||
| 158 | |||
| 159 | c) Accompany it with the information you received as to the offer | ||
| 160 | to distribute corresponding source code. (This alternative is | ||
| 161 | allowed only for noncommercial distribution and only if you | ||
| 162 | received the program in object code or executable form with such | ||
| 163 | an offer, in accord with Subsection b above.) | ||
| 164 | |||
| 165 | The source code for a work means the preferred form of the work for | ||
| 166 | making modifications to it. For an executable work, complete source | ||
| 167 | code means all the source code for all modules it contains, plus any | ||
| 168 | associated interface definition files, plus the scripts used to | ||
| 169 | control compilation and installation of the executable. However, as a | ||
| 170 | special exception, the source code distributed need not include | ||
| 171 | anything that is normally distributed (in either source or binary | ||
| 172 | form) with the major components (compiler, kernel, and so on) of the | ||
| 173 | operating system on which the executable runs, unless that component | ||
| 174 | itself accompanies the executable. | ||
| 175 | |||
| 176 | If distribution of executable or object code is made by offering | ||
| 177 | access to copy from a designated place, then offering equivalent | ||
| 178 | access to copy the source code from the same place counts as | ||
| 179 | distribution of the source code, even though third parties are not | ||
| 180 | compelled to copy the source along with the object code. | ||
| 181 | |||
| 182 | 4. You may not copy, modify, sublicense, or distribute the Program | ||
| 183 | except as expressly provided under this License. Any attempt | ||
| 184 | otherwise to copy, modify, sublicense or distribute the Program is | ||
| 185 | void, and will automatically terminate your rights under this License. | ||
| 186 | However, parties who have received copies, or rights, from you under | ||
| 187 | this License will not have their licenses terminated so long as such | ||
| 188 | parties remain in full compliance. | ||
| 189 | |||
| 190 | 5. You are not required to accept this License, since you have not | ||
| 191 | signed it. However, nothing else grants you permission to modify or | ||
| 192 | distribute the Program or its derivative works. These actions are | ||
| 193 | prohibited by law if you do not accept this License. Therefore, by | ||
| 194 | modifying or distributing the Program (or any work based on the | ||
| 195 | Program), you indicate your acceptance of this License to do so, and | ||
| 196 | all its terms and conditions for copying, distributing or modifying | ||
| 197 | the Program or works based on it. | ||
| 198 | |||
| 199 | 6. Each time you redistribute the Program (or any work based on the | ||
| 200 | Program), the recipient automatically receives a license from the | ||
| 201 | original licensor to copy, distribute or modify the Program subject to | ||
| 202 | these terms and conditions. You may not impose any further | ||
| 203 | restrictions on the recipients' exercise of the rights granted herein. | ||
| 204 | You are not responsible for enforcing compliance by third parties to | ||
| 205 | this License. | ||
| 206 | |||
| 207 | 7. If, as a consequence of a court judgment or allegation of patent | ||
| 208 | infringement or for any other reason (not limited to patent issues), | ||
| 209 | conditions are imposed on you (whether by court order, agreement or | ||
| 210 | otherwise) that contradict the conditions of this License, they do not | ||
| 211 | excuse you from the conditions of this License. If you cannot | ||
| 212 | distribute so as to satisfy simultaneously your obligations under this | ||
| 213 | License and any other pertinent obligations, then as a consequence you | ||
| 214 | may not distribute the Program at all. For example, if a patent | ||
| 215 | license would not permit royalty-free redistribution of the Program by | ||
| 216 | all those who receive copies directly or indirectly through you, then | ||
| 217 | the only way you could satisfy both it and this License would be to | ||
| 218 | refrain entirely from distribution of the Program. | ||
| 219 | |||
| 220 | If any portion of this section is held invalid or unenforceable under | ||
| 221 | any particular circumstance, the balance of the section is intended to | ||
| 222 | apply and the section as a whole is intended to apply in other | ||
| 223 | circumstances. | ||
| 224 | |||
| 225 | It is not the purpose of this section to induce you to infringe any | ||
| 226 | patents or other property right claims or to contest validity of any | ||
| 227 | such claims; this section has the sole purpose of protecting the | ||
| 228 | integrity of the free software distribution system, which is | ||
| 229 | implemented by public license practices. Many people have made | ||
| 230 | generous contributions to the wide range of software distributed | ||
| 231 | through that system in reliance on consistent application of that | ||
| 232 | system; it is up to the author/donor to decide if he or she is willing | ||
| 233 | to distribute software through any other system and a licensee cannot | ||
| 234 | impose that choice. | ||
| 235 | |||
| 236 | This section is intended to make thoroughly clear what is believed to | ||
| 237 | be a consequence of the rest of this License. | ||
| 238 | |||
| 239 | 8. If the distribution and/or use of the Program is restricted in | ||
| 240 | certain countries either by patents or by copyrighted interfaces, the | ||
| 241 | original copyright holder who places the Program under this License | ||
| 242 | may add an explicit geographical distribution limitation excluding | ||
| 243 | those countries, so that distribution is permitted only in or among | ||
| 244 | countries not thus excluded. In such case, this License incorporates | ||
| 245 | the limitation as if written in the body of this License. | ||
| 246 | |||
| 247 | 9. The Free Software Foundation may publish revised and/or new versions | ||
| 248 | of the General Public License from time to time. Such new versions will | ||
| 249 | be similar in spirit to the present version, but may differ in detail to | ||
| 250 | address new problems or concerns. | ||
| 251 | |||
| 252 | Each version is given a distinguishing version number. If the Program | ||
| 253 | specifies a version number of this License which applies to it and "any | ||
| 254 | later version", you have the option of following the terms and conditions | ||
| 255 | either of that version or of any later version published by the Free | ||
| 256 | Software Foundation. If the Program does not specify a version number of | ||
| 257 | this License, you may choose any version ever published by the Free Software | ||
| 258 | Foundation. | ||
| 259 | |||
| 260 | 10. If you wish to incorporate parts of the Program into other free | ||
| 261 | programs whose distribution conditions are different, write to the author | ||
| 262 | to ask for permission. For software which is copyrighted by the Free | ||
| 263 | Software Foundation, write to the Free Software Foundation; we sometimes | ||
| 264 | make exceptions for this. Our decision will be guided by the two goals | ||
| 265 | of preserving the free status of all derivatives of our free software and | ||
| 266 | of promoting the sharing and reuse of software generally. | ||
| 267 | |||
| 268 | NO WARRANTY | ||
| 269 | |||
| 270 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | ||
| 271 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | ||
| 272 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | ||
| 273 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | ||
| 274 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 275 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | ||
| 276 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | ||
| 277 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | ||
| 278 | REPAIR OR CORRECTION. | ||
| 279 | |||
| 280 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
| 281 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | ||
| 282 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | ||
| 283 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | ||
| 284 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | ||
| 285 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | ||
| 286 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | ||
| 287 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | ||
| 288 | POSSIBILITY OF SUCH DAMAGES. | ||
| @@ -111,7 +111,7 @@ When creating PPPoL2TP sockets, the application provides information · 110 unmodified lines | |||
| 111 | to the driver about the socket in a socket connect() call. Source and | 111 | to the driver about the socket in a socket connect() call. Source and |
| 112 | destination tunnel and session ids are provided, as well as the file | 112 | destination tunnel and session ids are provided, as well as the file |
| 113 | descriptor of a UDP socket. See struct pppol2tp_addr in | 113 | descriptor of a UDP socket. See struct pppol2tp_addr in |
| 114 | include/linux/if_ppp.h. Note that zero tunnel / session ids are | 114 | include/linux/if_pppol2tp.h. Note that zero tunnel / session ids are |
| 115 | treated specially. When creating the per-tunnel PPPoL2TP management | 115 | treated specially. When creating the per-tunnel PPPoL2TP management |
| 116 | socket in Step 2 above, zero source and destination session ids are | 116 | socket in Step 2 above, zero source and destination session ids are |
| 117 | specified, which tells the driver to prepare the supplied UDP file | 117 | specified, which tells the driver to prepare the supplied UDP file |
| @@ -0,0 +1,99 @@ | |||
| 1 | # | ||
| 2 | # This outlines the Linux authentication/association and | ||
| 3 | # deauthentication/disassociation flows. | ||
| 4 | # | ||
| 5 | # This can be converted into a diagram using the service | ||
| 6 | # at http://www.websequencediagrams.com/ | ||
| 7 | # | ||
| 8 | |||
| 9 | participant userspace | ||
| 10 | participant mac80211 | ||
| 11 | participant driver | ||
| 12 | |||
| 13 | alt authentication needed (not FT) | ||
| 14 | userspace->mac80211: authenticate | ||
| 15 | |||
| 16 | alt authenticated/authenticating already | ||
| 17 | mac80211->driver: sta_state(AP, not-exists) | ||
| 18 | mac80211->driver: bss_info_changed(clear BSSID) | ||
| 19 | else associated | ||
| 20 | note over mac80211,driver | ||
| 21 | like deauth/disassoc, without sending the | ||
| 22 | BA session stop & deauth/disassoc frames | ||
| 23 | end note | ||
| 24 | end | ||
| 25 | |||
| 26 | mac80211->driver: config(channel, non-HT) | ||
| 27 | mac80211->driver: bss_info_changed(set BSSID, basic rate bitmap) | ||
| 28 | mac80211->driver: sta_state(AP, exists) | ||
| 29 | |||
| 30 | alt no probe request data known | ||
| 31 | mac80211->driver: TX directed probe request | ||
| 32 | driver->mac80211: RX probe response | ||
| 33 | end | ||
| 34 | |||
| 35 | mac80211->driver: TX auth frame | ||
| 36 | driver->mac80211: RX auth frame | ||
| 37 | |||
| 38 | alt WEP shared key auth | ||
| 39 | mac80211->driver: TX auth frame | ||
| 40 | driver->mac80211: RX auth frame | ||
| 41 | end | ||
| 42 | |||
| 43 | mac80211->driver: sta_state(AP, authenticated) | ||
| 44 | mac80211->userspace: RX auth frame | ||
| 45 | |||
| 46 | end | ||
| 47 | |||
| 48 | userspace->mac80211: associate | ||
| 49 | alt authenticated or associated | ||
| 50 | note over mac80211,driver: cleanup like for authenticate | ||
| 51 | end | ||
| 52 | |||
| 53 | alt not previously authenticated (FT) | ||
| 54 | mac80211->driver: config(channel, non-HT) | ||
| 55 | mac80211->driver: bss_info_changed(set BSSID, basic rate bitmap) | ||
| 56 | mac80211->driver: sta_state(AP, exists) | ||
| 57 | mac80211->driver: sta_state(AP, authenticated) | ||
| 58 | end | ||
| 59 | mac80211->driver: TX assoc | ||
| 60 | driver->mac80211: RX assoc response | ||
| 61 | note over mac80211: init rate control | ||
| 62 | mac80211->driver: sta_state(AP, associated) | ||
| 63 | |||
| 64 | alt not using WPA | ||
| 65 | mac80211->driver: sta_state(AP, authorized) | ||
| 66 | end | ||
| 67 | |||
| 68 | mac80211->driver: set up QoS parameters | ||
| 69 | |||
| 70 | alt is HT channel | ||
| 71 | mac80211->driver: config(channel, HT params) | ||
| 72 | end | ||
| 73 | |||
| 74 | mac80211->driver: bss_info_changed(QoS, HT, associated with AID) | ||
| 75 | mac80211->userspace: associated | ||
| 76 | |||
| 77 | note left of userspace: associated now | ||
| 78 | |||
| 79 | alt using WPA | ||
| 80 | note over userspace | ||
| 81 | do 4-way-handshake | ||
| 82 | (data frames) | ||
| 83 | end note | ||
| 84 | userspace->mac80211: authorized | ||
| 85 | mac80211->driver: sta_state(AP, authorized) | ||
| 86 | end | ||
| 87 | |||
| 88 | userspace->mac80211: deauthenticate/disassociate | ||
| 89 | mac80211->driver: stop BA sessions | ||
| 90 | mac80211->driver: TX deauth/disassoc | ||
| 91 | mac80211->driver: flush frames | ||
| 92 | mac80211->driver: sta_state(AP,associated) | ||
| 93 | mac80211->driver: sta_state(AP,authenticated) | ||
| 94 | mac80211->driver: sta_state(AP,exists) | ||
| 95 | mac80211->driver: sta_state(AP,not-exists) | ||
| 96 | mac80211->driver: turn off powersave | ||
| 97 | mac80211->driver: bss_info_changed(clear BSSID, not associated, no QoS, ...) | ||
| 98 | mac80211->driver: config(non-HT channel type) | ||
| 99 | mac80211->userspace: disconnected | ||
| @@ -152,3 +152,16 @@ NETIF_F_VLAN_CHALLENGED should be set for devices which can't cope with VLAN · 151 unmodified lines | |||
| 152 | headers. Some drivers set this because the cards can't handle the bigger MTU. | 152 | headers. Some drivers set this because the cards can't handle the bigger MTU. |
| 153 | [FIXME: Those cases could be fixed in VLAN code by allowing only reduced-MTU | 153 | [FIXME: Those cases could be fixed in VLAN code by allowing only reduced-MTU |
| 154 | VLANs. This may be not useful, though.] | 154 | VLANs. This may be not useful, though.] |
| 155 | |||
| 156 | * rx-fcs | ||
| 157 | |||
| 158 | This requests that the NIC append the Ethernet Frame Checksum (FCS) | ||
| 159 | to the end of the skb data. This allows sniffers and other tools to | ||
| 160 | read the CRC recorded by the NIC on receipt of the packet. | ||
| 161 | |||
| 162 | * rx-all | ||
| 163 | |||
| 164 | This requests that the NIC receive all possible frames, including errored | ||
| 165 | frames (such as bad FCS, etc). This can be helpful when sniffing a link with | ||
| 166 | bad packets on it. Some NICs may receive more packets if also put into normal | ||
| 167 | PROMISC mdoe. | ||
| @@ -62,7 +62,8 @@ The MDIO bus · 61 unmodified lines | |||
| 62 | 5) The bus must also be declared somewhere as a device, and registered. | 62 | 5) The bus must also be declared somewhere as a device, and registered. |
| 63 | 63 | ||
| 64 | As an example for how one driver implemented an mdio bus driver, see | 64 | As an example for how one driver implemented an mdio bus driver, see |
| 65 | drivers/net/gianfar_mii.c and arch/ppc/syslib/mpc85xx_devices.c | 65 | drivers/net/ethernet/freescale/fsl_pq_mdio.c and an associated DTS file |
| 66 | for one of the users. (e.g. "git grep fsl,.*-mdio arch/powerpc/boot/dts/") | ||
| 66 | 67 | ||
| 67 | Connecting to a PHY | 68 | Connecting to a PHY |
| 68 | 69 | ||
| @@ -342,7 +342,7 @@ an interface unit are: · 341 unmodified lines | |||
| 342 | numbers on received multilink fragments | 342 | numbers on received multilink fragments |
| 343 | SC_MP_XSHORTSEQ transmit short multilink sequence nos. | 343 | SC_MP_XSHORTSEQ transmit short multilink sequence nos. |
| 344 | 344 | ||
| 345 | The values of these flags are defined in <linux/if_ppp.h>. Note | 345 | The values of these flags are defined in <linux/ppp-ioctl.h>. Note |
| 346 | that the values of the SC_MULTILINK, SC_MP_SHORTSEQ and | 346 | that the values of the SC_MULTILINK, SC_MP_SHORTSEQ and |
| 347 | SC_MP_XSHORTSEQ bits are ignored if the CONFIG_PPP_MULTILINK option | 347 | SC_MP_XSHORTSEQ bits are ignored if the CONFIG_PPP_MULTILINK option |
| 348 | is not selected. | 348 | is not selected. |
| @@ -358,7 +358,7 @@ an interface unit are: · 9 unmodified lines | |||
| 358 | 358 | ||
| 359 | * PPPIOCSCOMPRESS sets the parameters for packet compression or | 359 | * PPPIOCSCOMPRESS sets the parameters for packet compression or |
| 360 | decompression. The argument should point to a ppp_option_data | 360 | decompression. The argument should point to a ppp_option_data |
| 361 | structure (defined in <linux/if_ppp.h>), which contains a | 361 | structure (defined in <linux/ppp-ioctl.h>), which contains a |
| 362 | pointer/length pair which should describe a block of memory | 362 | pointer/length pair which should describe a block of memory |
| 363 | containing a CCP option specifying a compression method and its | 363 | containing a CCP option specifying a compression method and its |
| 364 | parameters. The ppp_option_data struct also contains a `transmit' | 364 | parameters. The ppp_option_data struct also contains a `transmit' |
| @@ -395,7 +395,7 @@ an interface unit are: · 30 unmodified lines | |||
| 395 | 395 | ||
| 396 | * PPPIOCSNPMODE sets the network-protocol mode for a given network | 396 | * PPPIOCSNPMODE sets the network-protocol mode for a given network |
| 397 | protocol. The argument should point to an npioctl struct (defined | 397 | protocol. The argument should point to an npioctl struct (defined |
| 398 | in <linux/if_ppp.h>). The `protocol' field gives the PPP protocol | 398 | in <linux/ppp-ioctl.h>). The `protocol' field gives the PPP protocol |
| 399 | number for the protocol to be affected, and the `mode' field | 399 | number for the protocol to be affected, and the `mode' field |
| 400 | specifies what to do with packets for that protocol: | 400 | specifies what to do with packets for that protocol: |
| 401 | 401 | ||
| @@ -89,7 +89,7 @@ TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h · 88 unmodified lines | |||
| 89 | MGSLPC_MAGIC 0x5402 mgslpc_info drivers/char/pcmcia/synclink_cs.c | 89 | MGSLPC_MAGIC 0x5402 mgslpc_info drivers/char/pcmcia/synclink_cs.c |
| 90 | TTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.h | 90 | TTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.h |
| 91 | USB_SERIAL_MAGIC 0x6702 usb_serial drivers/usb/serial/usb-serial.h | 91 | USB_SERIAL_MAGIC 0x6702 usb_serial drivers/usb/serial/usb-serial.h |
| 92 | FULL_DUPLEX_MAGIC 0x6969 drivers/net/tulip/de2104x.c | 92 | FULL_DUPLEX_MAGIC 0x6969 drivers/net/ethernet/dec/tulip/de2104x.c |
| 93 | USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c | 93 | USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c |
| 94 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c | 94 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c |
| 95 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h | 95 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h |
| @@ -1405,7 +1405,7 @@ F: net/ax25/ · 1404 unmodified lines | |||
| 1405 | B43 WIRELESS DRIVER | 1405 | B43 WIRELESS DRIVER |
| 1406 | M: Stefano Brivio <stefano.brivio@polimi.it> | 1406 | M: Stefano Brivio <stefano.brivio@polimi.it> |
| 1407 | L: linux-wireless@vger.kernel.org | 1407 | L: linux-wireless@vger.kernel.org |
| 1408 | L: b43-dev@lists.infradead.org (moderated for non-subscribers) | 1408 | L: b43-dev@lists.infradead.org |
| 1409 | W: http://linuxwireless.org/en/users/Drivers/b43 | 1409 | W: http://linuxwireless.org/en/users/Drivers/b43 |
| 1410 | S: Maintained | 1410 | S: Maintained |
| 1411 | F: drivers/net/wireless/b43/ | 1411 | F: drivers/net/wireless/b43/ |
| @@ -1414,6 +1414,7 @@ B43LEGACY WIRELESS DRIVER · 2 unmodified lines | |||
| 1414 | M: Larry Finger <Larry.Finger@lwfinger.net> | 1414 | M: Larry Finger <Larry.Finger@lwfinger.net> |
| 1415 | M: Stefano Brivio <stefano.brivio@polimi.it> | 1415 | M: Stefano Brivio <stefano.brivio@polimi.it> |
| 1416 | L: linux-wireless@vger.kernel.org | 1416 | L: linux-wireless@vger.kernel.org |
| 1417 | L: b43-dev@lists.infradead.org | ||
| 1417 | W: http://linuxwireless.org/en/users/Drivers/b43 | 1418 | W: http://linuxwireless.org/en/users/Drivers/b43 |
| 1418 | S: Maintained | 1419 | S: Maintained |
| 1419 | F: drivers/net/wireless/b43legacy/ | 1420 | F: drivers/net/wireless/b43legacy/ |
| @@ -1571,7 +1572,6 @@ F: drivers/net/ethernet/broadcom/tg3.* · 151 unmodified lines | |||
| 1571 | 1572 | ||
| 1572 | BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER | 1573 | BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER |
| 1573 | M: Brett Rudley <brudley@broadcom.com> | 1574 | M: Brett Rudley <brudley@broadcom.com> |
| 1574 | M: Henry Ptasinski <henryp@broadcom.com> | ||
| 1575 | M: Roland Vossen <rvossen@broadcom.com> | 1575 | M: Roland Vossen <rvossen@broadcom.com> |
| 1576 | M: Arend van Spriel <arend@broadcom.com> | 1576 | M: Arend van Spriel <arend@broadcom.com> |
| 1577 | M: Franky (Zhenhui) Lin <frankyl@broadcom.com> | 1577 | M: Franky (Zhenhui) Lin <frankyl@broadcom.com> |
| @@ -1809,7 +1809,8 @@ F: Documentation/zh_CN/ · 231 unmodified lines | |||
| 1809 | CISCO VIC ETHERNET NIC DRIVER | 1809 | CISCO VIC ETHERNET NIC DRIVER |
| 1810 | M: Christian Benvenuti <benve@cisco.com> | 1810 | M: Christian Benvenuti <benve@cisco.com> |
| 1811 | M: Roopa Prabhu <roprabhu@cisco.com> | 1811 | M: Roopa Prabhu <roprabhu@cisco.com> |
| 1812 | M: David Wang <dwang2@cisco.com> | 1812 | M: Neel Patel <neepatel@cisco.com> |
| 1813 | M: Nishank Trivedi <nistrive@cisco.com> | ||
| 1813 | S: Supported | 1814 | S: Supported |
| 1814 | F: drivers/net/ethernet/cisco/enic/ | 1815 | F: drivers/net/ethernet/cisco/enic/ |
| 1815 | 1816 | ||
| @@ -4937,8 +4938,6 @@ F: fs/ocfs2/ · 3121 unmodified lines | |||
| 4937 | 4938 | ||
| 4938 | ORINOCO DRIVER | 4939 | ORINOCO DRIVER |
| 4939 | L: linux-wireless@vger.kernel.org | 4940 | L: linux-wireless@vger.kernel.org |
| 4940 | L: orinoco-users@lists.sourceforge.net | ||
| 4941 | L: orinoco-devel@lists.sourceforge.net | ||
| 4942 | W: http://linuxwireless.org/en/users/Drivers/orinoco | 4941 | W: http://linuxwireless.org/en/users/Drivers/orinoco |
| 4943 | W: http://www.nongnu.org/orinoco/ | 4942 | W: http://www.nongnu.org/orinoco/ |
| 4944 | S: Orphan | 4943 | S: Orphan |
| @@ -5345,6 +5344,17 @@ L: cbe-oss-dev@lists.ozlabs.org · 400 unmodified lines | |||
| 5345 | S: Maintained | 5344 | S: Maintained |
| 5346 | F: drivers/block/ps3vram.c | 5345 | F: drivers/block/ps3vram.c |
| 5347 | 5346 | ||
| 5347 | PTP HARDWARE CLOCK SUPPORT | ||
| 5348 | M: Richard Cochran <richardcochran@gmail.com> | ||
| 5349 | S: Maintained | ||
| 5350 | W: http://linuxptp.sourceforge.net/ | ||
| 5351 | F: Documentation/ABI/testing/sysfs-ptp | ||
| 5352 | F: Documentation/ptp/* | ||
| 5353 | F: drivers/net/gianfar_ptp.c | ||
| 5354 | F: drivers/net/phy/dp83640* | ||
| 5355 | F: drivers/ptp/* | ||
| 5356 | F: include/linux/ptp_cl* | ||
| 5357 | |||
| 5348 | PTRACE SUPPORT | 5358 | PTRACE SUPPORT |
| 5349 | M: Roland McGrath <roland@redhat.com> | 5359 | M: Roland McGrath <roland@redhat.com> |
| 5350 | M: Oleg Nesterov <oleg@redhat.com> | 5360 | M: Oleg Nesterov <oleg@redhat.com> |
| @@ -7501,6 +7511,12 @@ S: Supported · 2150 unmodified lines | |||
| 7501 | F: Documentation/filesystems/xfs.txt | 7511 | F: Documentation/filesystems/xfs.txt |
| 7502 | F: fs/xfs/ | 7512 | F: fs/xfs/ |
| 7503 | 7513 | ||
| 7514 | XILINX AXI ETHERNET DRIVER | ||
| 7515 | M: Ariane Keller <ariane.keller@tik.ee.ethz.ch> | ||
| 7516 | M: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch> | ||
| 7517 | S: Maintained | ||
| 7518 | F: drivers/net/ethernet/xilinx/xilinx_axienet* | ||
| 7519 | |||
| 7504 | XILINX SYSTEMACE DRIVER | 7520 | XILINX SYSTEMACE DRIVER |
| 7505 | M: Grant Likely <grant.likely@secretlab.ca> | 7521 | M: Grant Likely <grant.likely@secretlab.ca> |
| 7506 | W: http://www.secretlab.ca/ | 7522 | W: http://www.secretlab.ca/ |
| @@ -71,6 +71,10 @@ · 70 unmodified lines | |||
| 71 | 71 | ||
| 72 | #define SO_WIFI_STATUS 41 | 72 | #define SO_WIFI_STATUS 41 |
| 73 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 73 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 74 | #define SO_PEEK_OFF 42 | ||
| 75 | |||
| 76 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 77 | #define SO_NOFCS 43 | ||
| 74 | 78 | ||
| 75 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we | 79 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we |
| 76 | * have to define SOCK_NONBLOCK to a different value here. | 80 | * have to define SOCK_NONBLOCK to a different value here. |
| @@ -64,5 +64,9 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | #define SO_WIFI_STATUS 41 | 65 | #define SO_WIFI_STATUS 41 |
| 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 67 | #define SO_PEEK_OFF 42 | ||
| 68 | |||
| 69 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 70 | #define SO_NOFCS 43 | ||
| 67 | 71 | ||
| 68 | #endif /* _ASM_SOCKET_H */ | 72 | #endif /* _ASM_SOCKET_H */ |
| @@ -64,5 +64,9 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | #define SO_WIFI_STATUS 41 | 65 | #define SO_WIFI_STATUS 41 |
| 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 67 | #define SO_PEEK_OFF 42 | ||
| 68 | |||
| 69 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 70 | #define SO_NOFCS 43 | ||
| 67 | 71 | ||
| 68 | #endif /* __ASM_AVR32_SOCKET_H */ | 72 | #endif /* __ASM_AVR32_SOCKET_H */ |
| @@ -821,7 +821,7 @@ void native_machine_restart(char *cmd) · 820 unmodified lines | |||
| 821 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); | 821 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 822 | } | 822 | } |
| 823 | 823 | ||
| 824 | void bfin_get_ether_addr(char *addr) | 824 | int bfin_get_ether_addr(char *addr) |
| 825 | { | 825 | { |
| 826 | /* the MAC is stored in OTP memory page 0xDF */ | 826 | /* the MAC is stored in OTP memory page 0xDF */ |
| 827 | u32 ret; | 827 | u32 ret; |
| @@ -834,5 +834,6 @@ void bfin_get_ether_addr(char *addr) · 6 unmodified lines | |||
| 834 | for (ret = 0; ret < 6; ++ret) | 834 | for (ret = 0; ret < 6; ++ret) |
| 835 | addr[ret] = otp_mac_p[5 - ret]; | 835 | addr[ret] = otp_mac_p[5 - ret]; |
| 836 | } | 836 | } |
| 837 | return 0; | ||
| 837 | } | 838 | } |
| 838 | EXPORT_SYMBOL(bfin_get_ether_addr); | 839 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -730,9 +730,8 @@ void native_machine_restart(char *cmd) · 729 unmodified lines | |||
| 730 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); | 730 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | void bfin_get_ether_addr(char *addr) | 733 | int bfin_get_ether_addr(char *addr) |
| 734 | { | 734 | { |
| 735 | random_ether_addr(addr); | 735 | return 1; |
| 736 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); | ||
| 737 | } | 736 | } |
| 738 | EXPORT_SYMBOL(bfin_get_ether_addr); | 737 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -846,7 +846,7 @@ void native_machine_restart(char *cmd) · 845 unmodified lines | |||
| 846 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); | 846 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 847 | } | 847 | } |
| 848 | 848 | ||
| 849 | void bfin_get_ether_addr(char *addr) | 849 | int bfin_get_ether_addr(char *addr) |
| 850 | { | 850 | { |
| 851 | /* the MAC is stored in OTP memory page 0xDF */ | 851 | /* the MAC is stored in OTP memory page 0xDF */ |
| 852 | u32 ret; | 852 | u32 ret; |
| @@ -859,5 +859,6 @@ void bfin_get_ether_addr(char *addr) · 6 unmodified lines | |||
| 859 | for (ret = 0; ret < 6; ++ret) | 859 | for (ret = 0; ret < 6; ++ret) |
| 860 | addr[ret] = otp_mac_p[5 - ret]; | 860 | addr[ret] = otp_mac_p[5 - ret]; |
| 861 | } | 861 | } |
| 862 | return 0; | ||
| 862 | } | 863 | } |
| 863 | EXPORT_SYMBOL(bfin_get_ether_addr); | 864 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -983,9 +983,8 @@ void native_machine_restart(char *cmd) · 982 unmodified lines | |||
| 983 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); | 983 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 984 | } | 984 | } |
| 985 | 985 | ||
| 986 | void bfin_get_ether_addr(char *addr) | 986 | int bfin_get_ether_addr(char *addr) |
| 987 | { | 987 | { |
| 988 | random_ether_addr(addr); | 988 | return 1; |
| 989 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); | ||
| 990 | } | 989 | } |
| 991 | EXPORT_SYMBOL(bfin_get_ether_addr); | 990 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -870,7 +870,7 @@ void native_machine_restart(char *cmd) · 869 unmodified lines | |||
| 870 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); | 870 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 871 | } | 871 | } |
| 872 | 872 | ||
| 873 | void bfin_get_ether_addr(char *addr) | 873 | int bfin_get_ether_addr(char *addr) |
| 874 | { | 874 | { |
| 875 | /* the MAC is stored in OTP memory page 0xDF */ | 875 | /* the MAC is stored in OTP memory page 0xDF */ |
| 876 | u32 ret; | 876 | u32 ret; |
| @@ -883,5 +883,6 @@ void bfin_get_ether_addr(char *addr) · 6 unmodified lines | |||
| 883 | for (ret = 0; ret < 6; ++ret) | 883 | for (ret = 0; ret < 6; ++ret) |
| 884 | addr[ret] = otp_mac_p[5 - ret]; | 884 | addr[ret] = otp_mac_p[5 - ret]; |
| 885 | } | 885 | } |
| 886 | return 0; | ||
| 886 | } | 887 | } |
| 887 | EXPORT_SYMBOL(bfin_get_ether_addr); | 888 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -1311,7 +1311,7 @@ void native_machine_restart(char *cmd) · 1310 unmodified lines | |||
| 1311 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); | 1311 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 1312 | } | 1312 | } |
| 1313 | 1313 | ||
| 1314 | void bfin_get_ether_addr(char *addr) | 1314 | int bfin_get_ether_addr(char *addr) |
| 1315 | { | 1315 | { |
| 1316 | /* the MAC is stored in OTP memory page 0xDF */ | 1316 | /* the MAC is stored in OTP memory page 0xDF */ |
| 1317 | u32 ret; | 1317 | u32 ret; |
| @@ -1324,5 +1324,6 @@ void bfin_get_ether_addr(char *addr) · 6 unmodified lines | |||
| 1324 | for (ret = 0; ret < 6; ++ret) | 1324 | for (ret = 0; ret < 6; ++ret) |
| 1325 | addr[ret] = otp_mac_p[5 - ret]; | 1325 | addr[ret] = otp_mac_p[5 - ret]; |
| 1326 | } | 1326 | } |
| 1327 | return 0; | ||
| 1327 | } | 1328 | } |
| 1328 | EXPORT_SYMBOL(bfin_get_ether_addr); | 1329 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -931,7 +931,7 @@ void native_machine_restart(char *cmd) · 930 unmodified lines | |||
| 931 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); | 931 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 932 | } | 932 | } |
| 933 | 933 | ||
| 934 | void bfin_get_ether_addr(char *addr) | 934 | int bfin_get_ether_addr(char *addr) |
| 935 | { | 935 | { |
| 936 | /* the MAC is stored in OTP memory page 0xDF */ | 936 | /* the MAC is stored in OTP memory page 0xDF */ |
| 937 | u32 ret; | 937 | u32 ret; |
| @@ -945,5 +945,6 @@ void bfin_get_ether_addr(char *addr) · 7 unmodified lines | |||
| 945 | for (ret = 0; ret < 6; ++ret) | 945 | for (ret = 0; ret < 6; ++ret) |
| 946 | addr[ret] = otp_mac_p[5 - ret]; | 946 | addr[ret] = otp_mac_p[5 - ret]; |
| 947 | } | 947 | } |
| 948 | return 0; | ||
| 948 | } | 949 | } |
| 949 | EXPORT_SYMBOL(bfin_get_ether_addr); | 950 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -813,9 +813,8 @@ void __init native_machine_early_platform_add_devices(void) · 812 unmodified lines | |||
| 813 | ARRAY_SIZE(cm_bf537e_early_devices)); | 813 | ARRAY_SIZE(cm_bf537e_early_devices)); |
| 814 | } | 814 | } |
| 815 | 815 | ||
| 816 | void bfin_get_ether_addr(char *addr) | 816 | int bfin_get_ether_addr(char *addr) |
| 817 | { | 817 | { |
| 818 | random_ether_addr(addr); | 818 | return 1; |
| 819 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); | ||
| 820 | } | 819 | } |
| 821 | EXPORT_SYMBOL(bfin_get_ether_addr); | 820 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -790,9 +790,8 @@ void __init native_machine_early_platform_add_devices(void) · 789 unmodified lines | |||
| 790 | ARRAY_SIZE(cm_bf537u_early_devices)); | 790 | ARRAY_SIZE(cm_bf537u_early_devices)); |
| 791 | } | 791 | } |
| 792 | 792 | ||
| 793 | void bfin_get_ether_addr(char *addr) | 793 | int bfin_get_ether_addr(char *addr) |
| 794 | { | 794 | { |
| 795 | random_ether_addr(addr); | 795 | return 1; |
| 796 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); | ||
| 797 | } | 796 | } |
| 798 | EXPORT_SYMBOL(bfin_get_ether_addr); | 797 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -399,9 +399,10 @@ arch_initcall(dnp5370_init); · 398 unmodified lines | |||
| 399 | /* | 399 | /* |
| 400 | * Currently the MAC address is saved in Flash by U-Boot | 400 | * Currently the MAC address is saved in Flash by U-Boot |
| 401 | */ | 401 | */ |
| 402 | void bfin_get_ether_addr(char *addr) | 402 | int bfin_get_ether_addr(char *addr) |
| 403 | { | 403 | { |
| 404 | *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); | 404 | *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); |
| 405 | *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); | 405 | *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); |
| 406 | return 0; | ||
| 406 | } | 407 | } |
| 407 | EXPORT_SYMBOL(bfin_get_ether_addr); | 408 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -535,9 +535,8 @@ void __init native_machine_early_platform_add_devices(void) · 534 unmodified lines | |||
| 535 | ARRAY_SIZE(stamp_early_devices)); | 535 | ARRAY_SIZE(stamp_early_devices)); |
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | void bfin_get_ether_addr(char *addr) | 538 | int bfin_get_ether_addr(char *addr) |
| 539 | { | 539 | { |
| 540 | random_ether_addr(addr); | 540 | return 1; |
| 541 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); | ||
| 542 | } | 541 | } |
| 543 | EXPORT_SYMBOL(bfin_get_ether_addr); | 542 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -2993,9 +2993,10 @@ void native_machine_restart(char *cmd) · 2992 unmodified lines | |||
| 2993 | * Currently the MAC address is saved in Flash by U-Boot | 2993 | * Currently the MAC address is saved in Flash by U-Boot |
| 2994 | */ | 2994 | */ |
| 2995 | #define FLASH_MAC 0x203f0000 | 2995 | #define FLASH_MAC 0x203f0000 |
| 2996 | void bfin_get_ether_addr(char *addr) | 2996 | int bfin_get_ether_addr(char *addr) |
| 2997 | { | 2997 | { |
| 2998 | *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); | 2998 | *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); |
| 2999 | *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); | 2999 | *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); |
| 3000 | return 0; | ||
| 3000 | } | 3001 | } |
| 3001 | EXPORT_SYMBOL(bfin_get_ether_addr); | 3002 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -780,9 +780,8 @@ void __init native_machine_early_platform_add_devices(void) · 779 unmodified lines | |||
| 780 | ARRAY_SIZE(cm_bf537_early_devices)); | 780 | ARRAY_SIZE(cm_bf537_early_devices)); |
| 781 | } | 781 | } |
| 782 | 782 | ||
| 783 | void bfin_get_ether_addr(char *addr) | 783 | int bfin_get_ether_addr(char *addr) |
| 784 | { | 784 | { |
| 785 | random_ether_addr(addr); | 785 | return 1; |
| 786 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); | ||
| 787 | } | 786 | } |
| 788 | EXPORT_SYMBOL(bfin_get_ether_addr); | 787 | EXPORT_SYMBOL(bfin_get_ether_addr); |
| @@ -66,6 +66,10 @@ · 65 unmodified lines | |||
| 66 | 66 | ||
| 67 | #define SO_WIFI_STATUS 41 | 67 | #define SO_WIFI_STATUS 41 |
| 68 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 68 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 69 | #define SO_PEEK_OFF 42 | ||
| 70 | |||
| 71 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 72 | #define SO_NOFCS 43 | ||
| 69 | 73 | ||
| 70 | #endif /* _ASM_SOCKET_H */ | 74 | #endif /* _ASM_SOCKET_H */ |
| 71 | 75 | ||
| @@ -64,6 +64,10 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | #define SO_WIFI_STATUS 41 | 65 | #define SO_WIFI_STATUS 41 |
| 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 67 | #define SO_PEEK_OFF 42 | ||
| 68 | |||
| 69 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 70 | #define SO_NOFCS 43 | ||
| 67 | 71 | ||
| 68 | #endif /* _ASM_SOCKET_H */ | 72 | #endif /* _ASM_SOCKET_H */ |
| 69 | 73 | ||
| @@ -64,5 +64,9 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | #define SO_WIFI_STATUS 41 | 65 | #define SO_WIFI_STATUS 41 |
| 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 67 | #define SO_PEEK_OFF 42 | ||
| 68 | |||
| 69 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 70 | #define SO_NOFCS 43 | ||
| 67 | 71 | ||
| 68 | #endif /* _ASM_SOCKET_H */ | 72 | #endif /* _ASM_SOCKET_H */ |
| @@ -182,7 +182,7 @@ simeth_probe1(void) · 181 unmodified lines | |||
| 182 | unsigned char mac_addr[ETH_ALEN]; | 182 | unsigned char mac_addr[ETH_ALEN]; |
| 183 | struct simeth_local *local; | 183 | struct simeth_local *local; |
| 184 | struct net_device *dev; | 184 | struct net_device *dev; |
| 185 | int fd, i, err, rc; | 185 | int fd, err, rc; |
| 186 | 186 | ||
| 187 | /* | 187 | /* |
| 188 | * XXX Fix me | 188 | * XXX Fix me |
| @@ -223,12 +223,8 @@ simeth_probe1(void) · 34 unmodified lines | |||
| 223 | panic("%s: out of interrupt vectors!\n", __func__); | 223 | panic("%s: out of interrupt vectors!\n", __func__); |
| 224 | dev->irq = rc; | 224 | dev->irq = rc; |
| 225 | 225 | ||
| 226 | printk(KERN_INFO "%s: hosteth=%s simfd=%d, HwAddr", | 226 | printk(KERN_INFO "%s: hosteth=%s simfd=%d, HwAddr=%pm, IRQ %d\n", |
| 227 | dev->name, simeth_device, local->simfd); | 227 | dev->name, simeth_device, local->simfd, dev->dev_addr, dev->irq); |
| 228 | for(i = 0; i < ETH_ALEN; i++) { | ||
| 229 | printk(" %2.2x", dev->dev_addr[i]); | ||
| 230 | } | ||
| 231 | printk(", IRQ %d\n", dev->irq); | ||
| 232 | 228 | ||
| 233 | return 0; | 229 | return 0; |
| 234 | } | 230 | } |
| @@ -73,5 +73,9 @@ · 72 unmodified lines | |||
| 73 | 73 | ||
| 74 | #define SO_WIFI_STATUS 41 | 74 | #define SO_WIFI_STATUS 41 |
| 75 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 75 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 76 | #define SO_PEEK_OFF 42 | ||
| 77 | |||
| 78 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 79 | #define SO_NOFCS 43 | ||
| 76 | 80 | ||
| 77 | #endif /* _ASM_IA64_SOCKET_H */ | 81 | #endif /* _ASM_IA64_SOCKET_H */ |
| @@ -64,5 +64,9 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | #define SO_WIFI_STATUS 41 | 65 | #define SO_WIFI_STATUS 41 |
| 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 67 | #define SO_PEEK_OFF 42 | ||
| 68 | |||
| 69 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 70 | #define SO_NOFCS 43 | ||
| 67 | 71 | ||
| 68 | #endif /* _ASM_M32R_SOCKET_H */ | 72 | #endif /* _ASM_M32R_SOCKET_H */ |
| @@ -64,5 +64,9 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | #define SO_WIFI_STATUS 41 | 65 | #define SO_WIFI_STATUS 41 |
| 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 67 | #define SO_PEEK_OFF 42 | ||
| 68 | |||
| 69 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 70 | #define SO_NOFCS 43 | ||
| 67 | 71 | ||
| 68 | #endif /* _ASM_SOCKET_H */ | 72 | #endif /* _ASM_SOCKET_H */ |
| @@ -3,5 +3,5 @@ · 2 unmodified lines | |||
| 3 | # under Linux. | 3 | # under Linux. |
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o | 6 | obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o sprom.o |
| 7 | obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o | 7 | obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o |
| @@ -107,8 +107,7 @@ int nvram_getenv(char *name, char *val, size_t val_len) · 106 unmodified lines | |||
| 107 | value = eq + 1; | 107 | value = eq + 1; |
| 108 | if ((eq - var) == strlen(name) && | 108 | if ((eq - var) == strlen(name) && |
| 109 | strncmp(var, name, (eq - var)) == 0) { | 109 | strncmp(var, name, (eq - var)) == 0) { |
| 110 | snprintf(val, val_len, "%s", value); | 110 | return snprintf(val, val_len, "%s", value); |
| 111 | return 0; | ||
| 112 | } | 111 | } |
| 113 | } | 112 | } |
| 114 | return NVRAM_ERR_ENVNOTFOUND; | 113 | return NVRAM_ERR_ENVNOTFOUND; |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> | 3 | * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> |
| 4 | * Copyright (C) 2006 Michael Buesch <m@bues.ch> | 4 | * Copyright (C) 2006 Michael Buesch <m@bues.ch> |
| 5 | * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> | 5 | * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> |
| 6 | * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de> | 6 | * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de> |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
| @@ -85,156 +85,7 @@ static void bcm47xx_machine_halt(void) · 75 unmodified lines | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | #ifdef CONFIG_BCM47XX_SSB | 87 | #ifdef CONFIG_BCM47XX_SSB |
| 88 | #define READ_FROM_NVRAM(_outvar, name, buf) \ | 88 | static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) |
| 89 | if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\ | ||
| 90 | sprom->_outvar = simple_strtoul(buf, NULL, 0); | ||
| 91 | |||
| 92 | #define READ_FROM_NVRAM2(_outvar, name1, name2, buf) \ | ||
| 93 | if (nvram_getprefix(prefix, name1, buf, sizeof(buf)) >= 0 || \ | ||
| 94 | nvram_getprefix(prefix, name2, buf, sizeof(buf)) >= 0)\ | ||
| 95 | sprom->_outvar = simple_strtoul(buf, NULL, 0); | ||
| 96 | |||
| 97 | static inline int nvram_getprefix(const char *prefix, char *name, | ||
| 98 | char *buf, int len) | ||
| 99 | { | ||
| 100 | if (prefix) { | ||
| 101 | char key[100]; | ||
| 102 | |||
| 103 | snprintf(key, sizeof(key), "%s%s", prefix, name); | ||
| 104 | return nvram_getenv(key, buf, len); | ||
| 105 | } | ||
| 106 | |||
| 107 | return nvram_getenv(name, buf, len); | ||
| 108 | } | ||
| 109 | |||
| 110 | static u32 nvram_getu32(const char *name, char *buf, int len) | ||
| 111 | { | ||
| 112 | int rv; | ||
| 113 | char key[100]; | ||
| 114 | u16 var0, var1; | ||
| 115 | |||
| 116 | snprintf(key, sizeof(key), "%s0", name); | ||
| 117 | rv = nvram_getenv(key, buf, len); | ||
| 118 | /* return 0 here so this looks like unset */ | ||
| 119 | if (rv < 0) | ||
| 120 | return 0; | ||
| 121 | var0 = simple_strtoul(buf, NULL, 0); | ||
| 122 | |||
| 123 | snprintf(key, sizeof(key), "%s1", name); | ||
| 124 | rv = nvram_getenv(key, buf, len); | ||
| 125 | if (rv < 0) | ||
| 126 | return 0; | ||
| 127 | var1 = simple_strtoul(buf, NULL, 0); | ||
| 128 | return var1 << 16 | var0; | ||
| 129 | } | ||
| 130 | |||
| 131 | static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix) | ||
| 132 | { | ||
| 133 | char buf[100]; | ||
| 134 | u32 boardflags; | ||
| 135 | |||
| 136 | memset(sprom, 0, sizeof(struct ssb_sprom)); | ||
| 137 | |||
| 138 | sprom->revision = 1; /* Fallback: Old hardware does not define this. */ | ||
| 139 | READ_FROM_NVRAM(revision, "sromrev", buf); | ||
| 140 | if (nvram_getprefix(prefix, "il0macaddr", buf, sizeof(buf)) >= 0 || | ||
| 141 | nvram_getprefix(prefix, "macaddr", buf, sizeof(buf)) >= 0) | ||
| 142 | nvram_parse_macaddr(buf, sprom->il0mac); | ||
| 143 | if (nvram_getprefix(prefix, "et0macaddr", buf, sizeof(buf)) >= 0) | ||
| 144 | nvram_parse_macaddr(buf, sprom->et0mac); | ||
| 145 | if (nvram_getprefix(prefix, "et1macaddr", buf, sizeof(buf)) >= 0) | ||
| 146 | nvram_parse_macaddr(buf, sprom->et1mac); | ||
| 147 | READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf); | ||
| 148 | READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf); | ||
| 149 | READ_FROM_NVRAM(et0mdcport, "et0mdcport", buf); | ||
| 150 | READ_FROM_NVRAM(et1mdcport, "et1mdcport", buf); | ||
| 151 | READ_FROM_NVRAM(board_rev, "boardrev", buf); | ||
| 152 | READ_FROM_NVRAM(country_code, "ccode", buf); | ||
| 153 | READ_FROM_NVRAM(ant_available_a, "aa5g", buf); | ||
| 154 | READ_FROM_NVRAM(ant_available_bg, "aa2g", buf); | ||
| 155 | READ_FROM_NVRAM(pa0b0, "pa0b0", buf); | ||
| 156 | READ_FROM_NVRAM(pa0b1, "pa0b1", buf); | ||
| 157 | READ_FROM_NVRAM(pa0b2, "pa0b2", buf); | ||
| 158 | READ_FROM_NVRAM(pa1b0, "pa1b0", buf); | ||
| 159 | READ_FROM_NVRAM(pa1b1, "pa1b1", buf); | ||
| 160 | READ_FROM_NVRAM(pa1b2, "pa1b2", buf); | ||
| 161 | READ_FROM_NVRAM(pa1lob0, "pa1lob0", buf); | ||
| 162 | READ_FROM_NVRAM(pa1lob2, "pa1lob1", buf); | ||
| 163 | READ_FROM_NVRAM(pa1lob1, "pa1lob2", buf); | ||
| 164 | READ_FROM_NVRAM(pa1hib0, "pa1hib0", buf); | ||
| 165 | READ_FROM_NVRAM(pa1hib2, "pa1hib1", buf); | ||
| 166 | READ_FROM_NVRAM(pa1hib1, "pa1hib2", buf); | ||
| 167 | READ_FROM_NVRAM2(gpio0, "ledbh0", "wl0gpio0", buf); | ||
| 168 | READ_FROM_NVRAM2(gpio1, "ledbh1", "wl0gpio1", buf); | ||
| 169 | READ_FROM_NVRAM2(gpio2, "ledbh2", "wl0gpio2", buf); | ||
| 170 | READ_FROM_NVRAM2(gpio3, "ledbh3", "wl0gpio3", buf); | ||
| 171 | READ_FROM_NVRAM2(maxpwr_bg, "maxp2ga0", "pa0maxpwr", buf); | ||
| 172 | READ_FROM_NVRAM2(maxpwr_al, "maxp5gla0", "pa1lomaxpwr", buf); | ||
| 173 | READ_FROM_NVRAM2(maxpwr_a, "maxp5ga0", "pa1maxpwr", buf); | ||
| 174 | READ_FROM_NVRAM2(maxpwr_ah, "maxp5gha0", "pa1himaxpwr", buf); | ||
| 175 | READ_FROM_NVRAM2(itssi_bg, "itt5ga0", "pa0itssit", buf); | ||
| 176 | READ_FROM_NVRAM2(itssi_a, "itt2ga0", "pa1itssit", buf); | ||
| 177 | READ_FROM_NVRAM(tri2g, "tri2g", buf); | ||
| 178 | READ_FROM_NVRAM(tri5gl, "tri5gl", buf); | ||
| 179 | READ_FROM_NVRAM(tri5g, "tri5g", buf); | ||
| 180 | READ_FROM_NVRAM(tri5gh, "tri5gh", buf); | ||
| 181 | READ_FROM_NVRAM(txpid2g[0], "txpid2ga0", buf); | ||
| 182 | READ_FROM_NVRAM(txpid2g[1], "txpid2ga1", buf); | ||
| 183 | READ_FROM_NVRAM(txpid2g[2], "txpid2ga2", buf); | ||
| 184 | READ_FROM_NVRAM(txpid2g[3], "txpid2ga3", buf); | ||
| 185 | READ_FROM_NVRAM(txpid5g[0], "txpid5ga0", buf); | ||
| 186 | READ_FROM_NVRAM(txpid5g[1], "txpid5ga1", buf); | ||
| 187 | READ_FROM_NVRAM(txpid5g[2], "txpid5ga2", buf); | ||
| 188 | READ_FROM_NVRAM(txpid5g[3], "txpid5ga3", buf); | ||
| 189 | READ_FROM_NVRAM(txpid5gl[0], "txpid5gla0", buf); | ||
| 190 | READ_FROM_NVRAM(txpid5gl[1], "txpid5gla1", buf); | ||
| 191 | READ_FROM_NVRAM(txpid5gl[2], "txpid5gla2", buf); | ||
| 192 | READ_FROM_NVRAM(txpid5gl[3], "txpid5gla3", buf); | ||
| 193 | READ_FROM_NVRAM(txpid5gh[0], "txpid5gha0", buf); | ||
| 194 | READ_FROM_NVRAM(txpid5gh[1], "txpid5gha1", buf); | ||
| 195 | READ_FROM_NVRAM(txpid5gh[2], "txpid5gha2", buf); | ||
| 196 | READ_FROM_NVRAM(txpid5gh[3], "txpid5gha3", buf); | ||
| 197 | READ_FROM_NVRAM(rxpo2g, "rxpo2g", buf); | ||
| 198 | READ_FROM_NVRAM(rxpo5g, "rxpo5g", buf); | ||
| 199 | READ_FROM_NVRAM(rssisav2g, "rssisav2g", buf); | ||
| 200 | READ_FROM_NVRAM(rssismc2g, "rssismc2g", buf); | ||
| 201 | READ_FROM_NVRAM(rssismf2g, "rssismf2g", buf); | ||
| 202 | READ_FROM_NVRAM(bxa2g, "bxa2g", buf); | ||
| 203 | READ_FROM_NVRAM(rssisav5g, "rssisav5g", buf); | ||
| 204 | READ_FROM_NVRAM(rssismc5g, "rssismc5g", buf); | ||
| 205 | READ_FROM_NVRAM(rssismf5g, "rssismf5g", buf); | ||
| 206 | READ_FROM_NVRAM(bxa5g, "bxa5g", buf); | ||
| 207 | READ_FROM_NVRAM(cck2gpo, "cck2gpo", buf); | ||
| 208 | |||
| 209 | sprom->ofdm2gpo = nvram_getu32("ofdm2gpo", buf, sizeof(buf)); | ||
| 210 | sprom->ofdm5glpo = nvram_getu32("ofdm5glpo", buf, sizeof(buf)); | ||
| 211 | sprom->ofdm5gpo = nvram_getu32("ofdm5gpo", buf, sizeof(buf)); | ||
| 212 | sprom->ofdm5ghpo = nvram_getu32("ofdm5ghpo", buf, sizeof(buf)); | ||
| 213 | |||
| 214 | READ_FROM_NVRAM(antenna_gain.ghz24.a0, "ag0", buf); | ||
| 215 | READ_FROM_NVRAM(antenna_gain.ghz24.a1, "ag1", buf); | ||
| 216 | READ_FROM_NVRAM(antenna_gain.ghz24.a2, "ag2", buf); | ||
| 217 | READ_FROM_NVRAM(antenna_gain.ghz24.a3, "ag3", buf); | ||
| 218 | memcpy(&sprom->antenna_gain.ghz5, &sprom->antenna_gain.ghz24, | ||
| 219 | sizeof(sprom->antenna_gain.ghz5)); | ||
| 220 | |||
| 221 | if (nvram_getprefix(prefix, "boardflags", buf, sizeof(buf)) >= 0) { | ||
| 222 | boardflags = simple_strtoul(buf, NULL, 0); | ||
| 223 | if (boardflags) { | ||
| 224 | sprom->boardflags_lo = (boardflags & 0x0000FFFFU); | ||
| 225 | sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | if (nvram_getprefix(prefix, "boardflags2", buf, sizeof(buf)) >= 0) { | ||
| 229 | boardflags = simple_strtoul(buf, NULL, 0); | ||
| 230 | if (boardflags) { | ||
| 231 | sprom->boardflags2_lo = (boardflags & 0x0000FFFFU); | ||
| 232 | sprom->boardflags2_hi = (boardflags & 0xFFFF0000U) >> 16; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out) | ||
| 238 | { | 89 | { |
| 239 | char prefix[10]; | 90 | char prefix[10]; |
| 240 | 91 | ||
| @@ -251,7 +102,7 @@ int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out) · 10 unmodified lines | |||
| 251 | } | 102 | } |
| 252 | 103 | ||
| 253 | static int bcm47xx_get_invariants(struct ssb_bus *bus, | 104 | static int bcm47xx_get_invariants(struct ssb_bus *bus, |
| 254 | struct ssb_init_invariants *iv) | 105 | struct ssb_init_invariants *iv) |
| 255 | { | 106 | { |
| 256 | char buf[20]; | 107 | char buf[20]; |
| 257 | 108 | ||
| @@ -281,7 +132,7 @@ static void __init bcm47xx_register_ssb(void) · 23 unmodified lines | |||
| 281 | char buf[100]; | 132 | char buf[100]; |
| 282 | struct ssb_mipscore *mcore; | 133 | struct ssb_mipscore *mcore; |
| 283 | 134 | ||
| 284 | err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom); | 135 | err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom_ssb); |
| 285 | if (err) | 136 | if (err) |
| 286 | printk(KERN_WARNING "bcm47xx: someone else already registered" | 137 | printk(KERN_WARNING "bcm47xx: someone else already registered" |
| 287 | " a ssb SPROM callback handler (err %d)\n", err); | 138 | " a ssb SPROM callback handler (err %d)\n", err); |
| @@ -308,10 +159,41 @@ static void __init bcm47xx_register_ssb(void) · 20 unmodified lines | |||
| 308 | #endif | 159 | #endif |
| 309 | 160 | ||
| 310 | #ifdef CONFIG_BCM47XX_BCMA | 161 | #ifdef CONFIG_BCM47XX_BCMA |
| 162 | static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) | ||
| 163 | { | ||
| 164 | char prefix[10]; | ||
| 165 | struct bcma_device *core; | ||
| 166 | |||
| 167 | switch (bus->hosttype) { | ||
| 168 | case BCMA_HOSTTYPE_PCI: | ||
| 169 | snprintf(prefix, sizeof(prefix), "pci/%u/%u/", | ||
| 170 | bus->host_pci->bus->number + 1, | ||
| 171 | PCI_SLOT(bus->host_pci->devfn)); | ||
| 172 | bcm47xx_fill_sprom(out, prefix); | ||
| 173 | return 0; | ||
| 174 | case BCMA_HOSTTYPE_SOC: | ||
| 175 | bcm47xx_fill_sprom_ethernet(out, NULL); | ||
| 176 | core = bcma_find_core(bus, BCMA_CORE_80211); | ||
| 177 | if (core) { | ||
| 178 | snprintf(prefix, sizeof(prefix), "sb/%u/", | ||
| 179 | core->core_index); | ||
| 180 | bcm47xx_fill_sprom(out, prefix); | ||
| 181 | } | ||
| 182 | return 0; | ||
| 183 | default: | ||
| 184 | pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n"); | ||
| 185 | return -EINVAL; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 311 | static void __init bcm47xx_register_bcma(void) | 189 | static void __init bcm47xx_register_bcma(void) |
| 312 | { | 190 | { |
| 313 | int err; | 191 | int err; |
| 314 | 192 | ||
| 193 | err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma); | ||
| 194 | if (err) | ||
| 195 | pr_warn("bcm47xx: someone else already registered a bcma SPROM callback handler (err %d)\n", err); | ||
| 196 | |||
| 315 | err = bcma_host_soc_register(&bcm47xx_bus.bcma); | 197 | err = bcma_host_soc_register(&bcm47xx_bus.bcma); |
| 316 | if (err) | 198 | if (err) |
| 317 | panic("Failed to initialize BCMA bus (err %d)", err); | 199 | panic("Failed to initialize BCMA bus (err %d)", err); |
| @@ -0,0 +1,620 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org> | ||
| 3 | * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> | ||
| 4 | * Copyright (C) 2006 Michael Buesch <m@bues.ch> | ||
| 5 | * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> | ||
| 6 | * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
| 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
| 16 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 18 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
| 19 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
| 20 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 23 | * | ||
| 24 | * You should have received a copy of the GNU General Public License along | ||
| 25 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 26 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include <bcm47xx.h> | ||
| 30 | #include <nvram.h> | ||
| 31 | |||
| 32 | static void create_key(const char *prefix, const char *postfix, | ||
| 33 | const char *name, char *buf, int len) | ||
| 34 | { | ||
| 35 | if (prefix && postfix) | ||
| 36 | snprintf(buf, len, "%s%s%s", prefix, name, postfix); | ||
| 37 | else if (prefix) | ||
| 38 | snprintf(buf, len, "%s%s", prefix, name); | ||
| 39 | else if (postfix) | ||
| 40 | snprintf(buf, len, "%s%s", name, postfix); | ||
| 41 | else | ||
| 42 | snprintf(buf, len, "%s", name); | ||
| 43 | } | ||
| 44 | |||
| 45 | #define NVRAM_READ_VAL(type) \ | ||
| 46 | static void nvram_read_ ## type (const char *prefix, \ | ||
| 47 | const char *postfix, const char *name, \ | ||
| 48 | type *val, type allset) \ | ||
| 49 | { \ | ||
| 50 | char buf[100]; \ | ||
| 51 | char key[40]; \ | ||
| 52 | int err; \ | ||
| 53 | type var; \ | ||
| 54 | \ | ||
| 55 | create_key(prefix, postfix, name, key, sizeof(key)); \ | ||
| 56 | \ | ||
| 57 | err = nvram_getenv(key, buf, sizeof(buf)); \ | ||
| 58 | if (err < 0) \ | ||
| 59 | return; \ | ||
| 60 | err = kstrto ## type (buf, 0, &var); \ | ||
| 61 | if (err) { \ | ||
| 62 | pr_warn("can not parse nvram name %s with value %s" \ | ||
| 63 | " got %i", key, buf, err); \ | ||
| 64 | return; \ | ||
| 65 | } \ | ||
| 66 | if (allset && var == allset) \ | ||
| 67 | return; \ | ||
| 68 | *val = var; \ | ||
| 69 | } | ||
| 70 | |||
| 71 | NVRAM_READ_VAL(u8) | ||
| 72 | NVRAM_READ_VAL(s8) | ||
| 73 | NVRAM_READ_VAL(u16) | ||
| 74 | NVRAM_READ_VAL(u32) | ||
| 75 | |||
| 76 | #undef NVRAM_READ_VAL | ||
| 77 | |||
| 78 | static void nvram_read_u32_2(const char *prefix, const char *name, | ||
| 79 | u16 *val_lo, u16 *val_hi) | ||
| 80 | { | ||
| 81 | char buf[100]; | ||
| 82 | char key[40]; | ||
| 83 | int err; | ||
| 84 | u32 val; | ||
| 85 | |||
| 86 | create_key(prefix, NULL, name, key, sizeof(key)); | ||
| 87 | |||
| 88 | err = nvram_getenv(key, buf, sizeof(buf)); | ||
| 89 | if (err < 0) | ||
| 90 | return; | ||
| 91 | err = kstrtou32(buf, 0, &val); | ||
| 92 | if (err) { | ||
| 93 | pr_warn("can not parse nvram name %s with value %s got %i", | ||
| 94 | key, buf, err); | ||
| 95 | return; | ||
| 96 | } | ||
| 97 | *val_lo = (val & 0x0000FFFFU); | ||
| 98 | *val_hi = (val & 0xFFFF0000U) >> 16; | ||
| 99 | } | ||
| 100 | |||
| 101 | static void nvram_read_leddc(const char *prefix, const char *name, | ||
| 102 | u8 *leddc_on_time, u8 *leddc_off_time) | ||
| 103 | { | ||
| 104 | char buf[100]; | ||
| 105 | char key[40]; | ||
| 106 | int err; | ||
| 107 | u32 val; | ||
| 108 | |||
| 109 | create_key(prefix, NULL, name, key, sizeof(key)); | ||
| 110 | |||
| 111 | err = nvram_getenv(key, buf, sizeof(buf)); | ||
| 112 | if (err < 0) | ||
| 113 | return; | ||
| 114 | err = kstrtou32(buf, 0, &val); | ||
| 115 | if (err) { | ||
| 116 | pr_warn("can not parse nvram name %s with value %s got %i", | ||
| 117 | key, buf, err); | ||
| 118 | return; | ||
| 119 | } | ||
| 120 | |||
| 121 | if (val == 0xffff || val == 0xffffffff) | ||
| 122 | return; | ||
| 123 | |||
| 124 | *leddc_on_time = val & 0xff; | ||
| 125 | *leddc_off_time = (val >> 16) & 0xff; | ||
| 126 | } | ||
| 127 | |||
| 128 | static void nvram_read_macaddr(const char *prefix, const char *name, | ||
| 129 | u8 (*val)[6]) | ||
| 130 | { | ||
| 131 | char buf[100]; | ||
| 132 | char key[40]; | ||
| 133 | int err; | ||
| 134 | |||
| 135 | create_key(prefix, NULL, name, key, sizeof(key)); | ||
| 136 | |||
| 137 | err = nvram_getenv(key, buf, sizeof(buf)); | ||
| 138 | if (err < 0) | ||
| 139 | return; | ||
| 140 | nvram_parse_macaddr(buf, *val); | ||
| 141 | } | ||
| 142 | |||
| 143 | static void nvram_read_alpha2(const char *prefix, const char *name, | ||
| 144 | char (*val)[2]) | ||
| 145 | { | ||
| 146 | char buf[10]; | ||
| 147 | char key[40]; | ||
| 148 | int err; | ||
| 149 | |||
| 150 | create_key(prefix, NULL, name, key, sizeof(key)); | ||
| 151 | |||
| 152 | err = nvram_getenv(key, buf, sizeof(buf)); | ||
| 153 | if (err < 0) | ||
| 154 | return; | ||
| 155 | if (buf[0] == '0') | ||
| 156 | return; | ||
| 157 | if (strlen(buf) > 2) { | ||
| 158 | pr_warn("alpha2 is too long %s", buf); | ||
| 159 | return; | ||
| 160 | } | ||
| 161 | memcpy(val, buf, sizeof(val)); | ||
| 162 | } | ||
| 163 | |||
| 164 | static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, | ||
| 165 | const char *prefix) | ||
| 166 | { | ||
| 167 | nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0); | ||
| 168 | nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0); | ||
| 169 | nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff); | ||
| 170 | nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff); | ||
| 171 | nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff); | ||
| 172 | nvram_read_u8(prefix, NULL, "ledbh3", &sprom->gpio3, 0xff); | ||
| 173 | nvram_read_u8(prefix, NULL, "aa2g", &sprom->ant_available_bg, 0); | ||
| 174 | nvram_read_u8(prefix, NULL, "aa5g", &sprom->ant_available_a, 0); | ||
| 175 | nvram_read_s8(prefix, NULL, "ag0", &sprom->antenna_gain.a0, 0); | ||
| 176 | nvram_read_s8(prefix, NULL, "ag1", &sprom->antenna_gain.a1, 0); | ||
| 177 | nvram_read_alpha2(prefix, "ccode", &sprom->alpha2); | ||
| 178 | } | ||
| 179 | |||
| 180 | static void bcm47xx_fill_sprom_r12389(struct ssb_sprom *sprom, | ||
| 181 | const char *prefix) | ||
| 182 | { | ||
| 183 | nvram_read_u16(prefix, NULL, "pa0b0", &sprom->pa0b0, 0); | ||
| 184 | nvram_read_u16(prefix, NULL, "pa0b1", &sprom->pa0b1, 0); | ||
| 185 | nvram_read_u16(prefix, NULL, "pa0b2", &sprom->pa0b2, 0); | ||
| 186 | nvram_read_u8(prefix, NULL, "pa0itssit", &sprom->itssi_bg, 0); | ||
| 187 | nvram_read_u8(prefix, NULL, "pa0maxpwr", &sprom->maxpwr_bg, 0); | ||
| 188 | nvram_read_u16(prefix, NULL, "pa1b0", &sprom->pa1b0, 0); | ||
| 189 | nvram_read_u16(prefix, NULL, "pa1b1", &sprom->pa1b1, 0); | ||
| 190 | nvram_read_u16(prefix, NULL, "pa1b2", &sprom->pa1b2, 0); | ||
| 191 | nvram_read_u8(prefix, NULL, "pa1itssit", &sprom->itssi_a, 0); | ||
| 192 | nvram_read_u8(prefix, NULL, "pa1maxpwr", &sprom->maxpwr_a, 0); | ||
| 193 | } | ||
| 194 | |||
| 195 | static void bcm47xx_fill_sprom_r1(struct ssb_sprom *sprom, const char *prefix) | ||
| 196 | { | ||
| 197 | nvram_read_u16(prefix, NULL, "boardflags", &sprom->boardflags_lo, 0); | ||
| 198 | nvram_read_u8(prefix, NULL, "cc", &sprom->country_code, 0); | ||
| 199 | } | ||
| 200 | |||
| 201 | static void bcm47xx_fill_sprom_r2389(struct ssb_sprom *sprom, | ||
| 202 | const char *prefix) | ||
| 203 | { | ||
| 204 | nvram_read_u8(prefix, NULL, "opo", &sprom->opo, 0); | ||
| 205 | nvram_read_u16(prefix, NULL, "pa1lob0", &sprom->pa1lob0, 0); | ||
| 206 | nvram_read_u16(prefix, NULL, "pa1lob1", &sprom->pa1lob1, 0); | ||
| 207 | nvram_read_u16(prefix, NULL, "pa1lob2", &sprom->pa1lob2, 0); | ||
| 208 | nvram_read_u16(prefix, NULL, "pa1hib0", &sprom->pa1hib0, 0); | ||
| 209 | nvram_read_u16(prefix, NULL, "pa1hib1", &sprom->pa1hib1, 0); | ||
| 210 | nvram_read_u16(prefix, NULL, "pa1hib2", &sprom->pa1hib2, 0); | ||
| 211 | nvram_read_u8(prefix, NULL, "pa1lomaxpwr", &sprom->maxpwr_al, 0); | ||
| 212 | nvram_read_u8(prefix, NULL, "pa1himaxpwr", &sprom->maxpwr_ah, 0); | ||
| 213 | } | ||
| 214 | |||
| 215 | static void bcm47xx_fill_sprom_r2(struct ssb_sprom *sprom, const char *prefix) | ||
| 216 | { | ||
| 217 | nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo, | ||
| 218 | &sprom->boardflags_hi); | ||
| 219 | nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0); | ||
| 220 | } | ||
| 221 | |||
| 222 | static void bcm47xx_fill_sprom_r389(struct ssb_sprom *sprom, const char *prefix) | ||
| 223 | { | ||
| 224 | nvram_read_u8(prefix, NULL, "bxa2g", &sprom->bxa2g, 0); | ||
| 225 | nvram_read_u8(prefix, NULL, "rssisav2g", &sprom->rssisav2g, 0); | ||
| 226 | nvram_read_u8(prefix, NULL, "rssismc2g", &sprom->rssismc2g, 0); | ||
| 227 | nvram_read_u8(prefix, NULL, "rssismf2g", &sprom->rssismf2g, 0); | ||
| 228 | nvram_read_u8(prefix, NULL, "bxa5g", &sprom->bxa5g, 0); | ||
| 229 | nvram_read_u8(prefix, NULL, "rssisav5g", &sprom->rssisav5g, 0); | ||
| 230 | nvram_read_u8(prefix, NULL, "rssismc5g", &sprom->rssismc5g, 0); | ||
| 231 | nvram_read_u8(prefix, NULL, "rssismf5g", &sprom->rssismf5g, 0); | ||
| 232 | nvram_read_u8(prefix, NULL, "tri2g", &sprom->tri2g, 0); | ||
| 233 | nvram_read_u8(prefix, NULL, "tri5g", &sprom->tri5g, 0); | ||
| 234 | nvram_read_u8(prefix, NULL, "tri5gl", &sprom->tri5gl, 0); | ||
| 235 | nvram_read_u8(prefix, NULL, "tri5gh", &sprom->tri5gh, 0); | ||
| 236 | nvram_read_s8(prefix, NULL, "rxpo2g", &sprom->rxpo2g, 0); | ||
| 237 | nvram_read_s8(prefix, NULL, "rxpo5g", &sprom->rxpo5g, 0); | ||
| 238 | } | ||
| 239 | |||
| 240 | static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix) | ||
| 241 | { | ||
| 242 | nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo, | ||
| 243 | &sprom->boardflags_hi); | ||
| 244 | nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0); | ||
| 245 | nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0); | ||
| 246 | nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, | ||
| 247 | &sprom->leddc_off_time); | ||
| 248 | } | ||
| 249 | |||
| 250 | static void bcm47xx_fill_sprom_r4589(struct ssb_sprom *sprom, | ||
| 251 | const char *prefix) | ||
| 252 | { | ||
| 253 | nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo, | ||
| 254 | &sprom->boardflags_hi); | ||
| 255 | nvram_read_u32_2(prefix, "boardflags2", &sprom->boardflags2_lo, | ||
| 256 | &sprom->boardflags2_hi); | ||
| 257 | nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0); | ||
| 258 | nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0); | ||
| 259 | nvram_read_s8(prefix, NULL, "ag2", &sprom->antenna_gain.a2, 0); | ||
| 260 | nvram_read_s8(prefix, NULL, "ag3", &sprom->antenna_gain.a3, 0); | ||
| 261 | nvram_read_u8(prefix, NULL, "txchain", &sprom->txchain, 0xf); | ||
| 262 | nvram_read_u8(prefix, NULL, "rxchain", &sprom->rxchain, 0xf); | ||
| 263 | nvram_read_u8(prefix, NULL, "antswitch", &sprom->antswitch, 0xff); | ||
| 264 | nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, | ||
| 265 | &sprom->leddc_off_time); | ||
| 266 | } | ||
| 267 | |||
| 268 | static void bcm47xx_fill_sprom_r458(struct ssb_sprom *sprom, const char *prefix) | ||
| 269 | { | ||
| 270 | nvram_read_u16(prefix, NULL, "cck2gpo", &sprom->cck2gpo, 0); | ||
| 271 | nvram_read_u32(prefix, NULL, "ofdm2gpo", &sprom->ofdm2gpo, 0); | ||
| 272 | nvram_read_u32(prefix, NULL, "ofdm5gpo", &sprom->ofdm5gpo, 0); | ||
| 273 | nvram_read_u32(prefix, NULL, "ofdm5glpo", &sprom->ofdm5glpo, 0); | ||
| 274 | nvram_read_u32(prefix, NULL, "ofdm5ghpo", &sprom->ofdm5ghpo, 0); | ||
| 275 | nvram_read_u16(prefix, NULL, "cddpo", &sprom->cddpo, 0); | ||
| 276 | nvram_read_u16(prefix, NULL, "stbcpo", &sprom->stbcpo, 0); | ||
| 277 | nvram_read_u16(prefix, NULL, "bw40po", &sprom->bw40po, 0); | ||
| 278 | nvram_read_u16(prefix, NULL, "bwduppo", &sprom->bwduppo, 0); | ||
| 279 | nvram_read_u16(prefix, NULL, "mcs2gpo0", &sprom->mcs2gpo[0], 0); | ||
| 280 | nvram_read_u16(prefix, NULL, "mcs2gpo1", &sprom->mcs2gpo[1], 0); | ||
| 281 | nvram_read_u16(prefix, NULL, "mcs2gpo2", &sprom->mcs2gpo[2], 0); | ||
| 282 | nvram_read_u16(prefix, NULL, "mcs2gpo3", &sprom->mcs2gpo[3], 0); | ||
| 283 | nvram_read_u16(prefix, NULL, "mcs2gpo4", &sprom->mcs2gpo[4], 0); | ||
| 284 | nvram_read_u16(prefix, NULL, "mcs2gpo5", &sprom->mcs2gpo[5], 0); | ||
| 285 | nvram_read_u16(prefix, NULL, "mcs2gpo6", &sprom->mcs2gpo[6], 0); | ||
| 286 | nvram_read_u16(prefix, NULL, "mcs2gpo7", &sprom->mcs2gpo[7], 0); | ||
| 287 | nvram_read_u16(prefix, NULL, "mcs5gpo0", &sprom->mcs5gpo[0], 0); | ||
| 288 | nvram_read_u16(prefix, NULL, "mcs5gpo1", &sprom->mcs5gpo[1], 0); | ||
| 289 | nvram_read_u16(prefix, NULL, "mcs5gpo2", &sprom->mcs5gpo[2], 0); | ||
| 290 | nvram_read_u16(prefix, NULL, "mcs5gpo3", &sprom->mcs5gpo[3], 0); | ||
| 291 | nvram_read_u16(prefix, NULL, "mcs5gpo4", &sprom->mcs5gpo[4], 0); | ||
| 292 | nvram_read_u16(prefix, NULL, "mcs5gpo5", &sprom->mcs5gpo[5], 0); | ||
| 293 | nvram_read_u16(prefix, NULL, "mcs5gpo6", &sprom->mcs5gpo[6], 0); | ||
| 294 | nvram_read_u16(prefix, NULL, "mcs5gpo7", &sprom->mcs5gpo[7], 0); | ||
| 295 | nvram_read_u16(prefix, NULL, "mcs5glpo0", &sprom->mcs5glpo[0], 0); | ||
| 296 | nvram_read_u16(prefix, NULL, "mcs5glpo1", &sprom->mcs5glpo[1], 0); | ||
| 297 | nvram_read_u16(prefix, NULL, "mcs5glpo2", &sprom->mcs5glpo[2], 0); | ||
| 298 | nvram_read_u16(prefix, NULL, "mcs5glpo3", &sprom->mcs5glpo[3], 0); | ||
| 299 | nvram_read_u16(prefix, NULL, "mcs5glpo4", &sprom->mcs5glpo[4], 0); | ||
| 300 | nvram_read_u16(prefix, NULL, "mcs5glpo5", &sprom->mcs5glpo[5], 0); | ||
| 301 | nvram_read_u16(prefix, NULL, "mcs5glpo6", &sprom->mcs5glpo[6], 0); | ||
| 302 | nvram_read_u16(prefix, NULL, "mcs5glpo7", &sprom->mcs5glpo[7], 0); | ||
| 303 | nvram_read_u16(prefix, NULL, "mcs5ghpo0", &sprom->mcs5ghpo[0], 0); | ||
| 304 | nvram_read_u16(prefix, NULL, "mcs5ghpo1", &sprom->mcs5ghpo[1], 0); | ||
| 305 | nvram_read_u16(prefix, NULL, "mcs5ghpo2", &sprom->mcs5ghpo[2], 0); | ||
| 306 | nvram_read_u16(prefix, NULL, "mcs5ghpo3", &sprom->mcs5ghpo[3], 0); | ||
| 307 | nvram_read_u16(prefix, NULL, "mcs5ghpo4", &sprom->mcs5ghpo[4], 0); | ||
| 308 | nvram_read_u16(prefix, NULL, "mcs5ghpo5", &sprom->mcs5ghpo[5], 0); | ||
| 309 | nvram_read_u16(prefix, NULL, "mcs5ghpo6", &sprom->mcs5ghpo[6], 0); | ||
| 310 | nvram_read_u16(prefix, NULL, "mcs5ghpo7", &sprom->mcs5ghpo[7], 0); | ||
| 311 | } | ||
| 312 | |||
| 313 | static void bcm47xx_fill_sprom_r45(struct ssb_sprom *sprom, const char *prefix) | ||
| 314 | { | ||
| 315 | nvram_read_u8(prefix, NULL, "txpid2ga0", &sprom->txpid2g[0], 0); | ||
| 316 | nvram_read_u8(prefix, NULL, "txpid2ga1", &sprom->txpid2g[1], 0); | ||
| 317 | nvram_read_u8(prefix, NULL, "txpid2ga2", &sprom->txpid2g[2], 0); | ||
| 318 | nvram_read_u8(prefix, NULL, "txpid2ga3", &sprom->txpid2g[3], 0); | ||
| 319 | nvram_read_u8(prefix, NULL, "txpid5ga0", &sprom->txpid5g[0], 0); | ||
| 320 | nvram_read_u8(prefix, NULL, "txpid5ga1", &sprom->txpid5g[1], 0); | ||
| 321 | nvram_read_u8(prefix, NULL, "txpid5ga2", &sprom->txpid5g[2], 0); | ||
| 322 | nvram_read_u8(prefix, NULL, "txpid5ga3", &sprom->txpid5g[3], 0); | ||
| 323 | nvram_read_u8(prefix, NULL, "txpid5gla0", &sprom->txpid5gl[0], 0); | ||
| 324 | nvram_read_u8(prefix, NULL, "txpid5gla1", &sprom->txpid5gl[1], 0); | ||
| 325 | nvram_read_u8(prefix, NULL, "txpid5gla2", &sprom->txpid5gl[2], 0); | ||
| 326 | nvram_read_u8(prefix, NULL, "txpid5gla3", &sprom->txpid5gl[3], 0); | ||
| 327 | nvram_read_u8(prefix, NULL, "txpid5gha0", &sprom->txpid5gh[0], 0); | ||
| 328 | nvram_read_u8(prefix, NULL, "txpid5gha1", &sprom->txpid5gh[1], 0); | ||
| 329 | nvram_read_u8(prefix, NULL, "txpid5gha2", &sprom->txpid5gh[2], 0); | ||
| 330 | nvram_read_u8(prefix, NULL, "txpid5gha3", &sprom->txpid5gh[3], 0); | ||
| 331 | } | ||
| 332 | |||
| 333 | static void bcm47xx_fill_sprom_r89(struct ssb_sprom *sprom, const char *prefix) | ||
| 334 | { | ||
| 335 | nvram_read_u8(prefix, NULL, "tssipos2g", &sprom->fem.ghz2.tssipos, 0); | ||
| 336 | nvram_read_u8(prefix, NULL, "extpagain2g", | ||
| 337 | &sprom->fem.ghz2.extpa_gain, 0); | ||
| 338 | nvram_read_u8(prefix, NULL, "pdetrange2g", | ||
| 339 | &sprom->fem.ghz2.pdet_range, 0); | ||
| 340 | nvram_read_u8(prefix, NULL, "triso2g", &sprom->fem.ghz2.tr_iso, 0); | ||
| 341 | nvram_read_u8(prefix, NULL, "antswctl2g", &sprom->fem.ghz2.antswlut, 0); | ||
| 342 | nvram_read_u8(prefix, NULL, "tssipos5g", &sprom->fem.ghz5.tssipos, 0); | ||
| 343 | nvram_read_u8(prefix, NULL, "extpagain5g", | ||
| 344 | &sprom->fem.ghz5.extpa_gain, 0); | ||
| 345 | nvram_read_u8(prefix, NULL, "pdetrange5g", | ||
| 346 | &sprom->fem.ghz5.pdet_range, 0); | ||
| 347 | nvram_read_u8(prefix, NULL, "triso5g", &sprom->fem.ghz5.tr_iso, 0); | ||
| 348 | nvram_read_u8(prefix, NULL, "antswctl5g", &sprom->fem.ghz5.antswlut, 0); | ||
| 349 | nvram_read_u8(prefix, NULL, "tempthresh", &sprom->tempthresh, 0); | ||
| 350 | nvram_read_u8(prefix, NULL, "tempoffset", &sprom->tempoffset, 0); | ||
| 351 | nvram_read_u16(prefix, NULL, "rawtempsense", &sprom->rawtempsense, 0); | ||
| 352 | nvram_read_u8(prefix, NULL, "measpower", &sprom->measpower, 0); | ||
| 353 | nvram_read_u8(prefix, NULL, "tempsense_slope", | ||
| 354 | &sprom->tempsense_slope, 0); | ||
| 355 | nvram_read_u8(prefix, NULL, "tempcorrx", &sprom->tempcorrx, 0); | ||
| 356 | nvram_read_u8(prefix, NULL, "tempsense_option", | ||
| 357 | &sprom->tempsense_option, 0); | ||
| 358 | nvram_read_u8(prefix, NULL, "freqoffset_corr", | ||
| 359 | &sprom->freqoffset_corr, 0); | ||
| 360 | nvram_read_u8(prefix, NULL, "iqcal_swp_dis", &sprom->iqcal_swp_dis, 0); | ||
| 361 | nvram_read_u8(prefix, NULL, "hw_iqcal_en", &sprom->hw_iqcal_en, 0); | ||
| 362 | nvram_read_u8(prefix, NULL, "elna2g", &sprom->elna2g, 0); | ||
| 363 | nvram_read_u8(prefix, NULL, "elna5g", &sprom->elna5g, 0); | ||
| 364 | nvram_read_u8(prefix, NULL, "phycal_tempdelta", | ||
| 365 | &sprom->phycal_tempdelta, 0); | ||
| 366 | nvram_read_u8(prefix, NULL, "temps_period", &sprom->temps_period, 0); | ||
| 367 | nvram_read_u8(prefix, NULL, "temps_hysteresis", | ||
| 368 | &sprom->temps_hysteresis, 0); | ||
| 369 | nvram_read_u8(prefix, NULL, "measpower1", &sprom->measpower1, 0); | ||
| 370 | nvram_read_u8(prefix, NULL, "measpower2", &sprom->measpower2, 0); | ||
| 371 | nvram_read_u8(prefix, NULL, "rxgainerr2ga0", | ||
| 372 | &sprom->rxgainerr2ga[0], 0); | ||
| 373 | nvram_read_u8(prefix, NULL, "rxgainerr2ga1", | ||
| 374 | &sprom->rxgainerr2ga[1], 0); | ||
| 375 | nvram_read_u8(prefix, NULL, "rxgainerr2ga2", | ||
| 376 | &sprom->rxgainerr2ga[2], 0); | ||
| 377 | nvram_read_u8(prefix, NULL, "rxgainerr5gla0", | ||
| 378 | &sprom->rxgainerr5gla[0], 0); | ||
| 379 | nvram_read_u8(prefix, NULL, "rxgainerr5gla1", | ||
| 380 | &sprom->rxgainerr5gla[1], 0); | ||
| 381 | nvram_read_u8(prefix, NULL, "rxgainerr5gla2", | ||
| 382 | &sprom->rxgainerr5gla[2], 0); | ||
| 383 | nvram_read_u8(prefix, NULL, "rxgainerr5gma0", | ||
| 384 | &sprom->rxgainerr5gma[0], 0); | ||
| 385 | nvram_read_u8(prefix, NULL, "rxgainerr5gma1", | ||
| 386 | &sprom->rxgainerr5gma[1], 0); | ||
| 387 | nvram_read_u8(prefix, NULL, "rxgainerr5gma2", | ||
| 388 | &sprom->rxgainerr5gma[2], 0); | ||
| 389 | nvram_read_u8(prefix, NULL, "rxgainerr5gha0", | ||
| 390 | &sprom->rxgainerr5gha[0], 0); | ||
| 391 | nvram_read_u8(prefix, NULL, "rxgainerr5gha1", | ||
| 392 | &sprom->rxgainerr5gha[1], 0); | ||
| 393 | nvram_read_u8(prefix, NULL, "rxgainerr5gha2", | ||
| 394 | &sprom->rxgainerr5gha[2], 0); | ||
| 395 | nvram_read_u8(prefix, NULL, "rxgainerr5gua0", | ||
| 396 | &sprom->rxgainerr5gua[0], 0); | ||
| 397 | nvram_read_u8(prefix, NULL, "rxgainerr5gua1", | ||
| 398 | &sprom->rxgainerr5gua[1], 0); | ||
| 399 | nvram_read_u8(prefix, NULL, "rxgainerr5gua2", | ||
| 400 | &sprom->rxgainerr5gua[2], 0); | ||
| 401 | nvram_read_u8(prefix, NULL, "noiselvl2ga0", &sprom->noiselvl2ga[0], 0); | ||
| 402 | nvram_read_u8(prefix, NULL, "noiselvl2ga1", &sprom->noiselvl2ga[1], 0); | ||
| 403 | nvram_read_u8(prefix, NULL, "noiselvl2ga2", &sprom->noiselvl2ga[2], 0); | ||
| 404 | nvram_read_u8(prefix, NULL, "noiselvl5gla0", | ||
| 405 | &sprom->noiselvl5gla[0], 0); | ||
| 406 | nvram_read_u8(prefix, NULL, "noiselvl5gla1", | ||
| 407 | &sprom->noiselvl5gla[1], 0); | ||
| 408 | nvram_read_u8(prefix, NULL, "noiselvl5gla2", | ||
| 409 | &sprom->noiselvl5gla[2], 0); | ||
| 410 | nvram_read_u8(prefix, NULL, "noiselvl5gma0", | ||
| 411 | &sprom->noiselvl5gma[0], 0); | ||
| 412 | nvram_read_u8(prefix, NULL, "noiselvl5gma1", | ||
| 413 | &sprom->noiselvl5gma[1], 0); | ||
| 414 | nvram_read_u8(prefix, NULL, "noiselvl5gma2", | ||
| 415 | &sprom->noiselvl5gma[2], 0); | ||
| 416 | nvram_read_u8(prefix, NULL, "noiselvl5gha0", | ||
| 417 | &sprom->noiselvl5gha[0], 0); | ||
| 418 | nvram_read_u8(prefix, NULL, "noiselvl5gha1", | ||
| 419 | &sprom->noiselvl5gha[1], 0); | ||
| 420 | nvram_read_u8(prefix, NULL, "noiselvl5gha2", | ||
| 421 | &sprom->noiselvl5gha[2], 0); | ||
| 422 | nvram_read_u8(prefix, NULL, "noiselvl5gua0", | ||
| 423 | &sprom->noiselvl5gua[0], 0); | ||
| 424 | nvram_read_u8(prefix, NULL, "noiselvl5gua1", | ||
| 425 | &sprom->noiselvl5gua[1], 0); | ||
| 426 | nvram_read_u8(prefix, NULL, "noiselvl5gua2", | ||
| 427 | &sprom->noiselvl5gua[2], 0); | ||
| 428 | nvram_read_u8(prefix, NULL, "pcieingress_war", | ||
| 429 | &sprom->pcieingress_war, 0); | ||
| 430 | } | ||
| 431 | |||
| 432 | static void bcm47xx_fill_sprom_r9(struct ssb_sprom *sprom, const char *prefix) | ||
| 433 | { | ||
| 434 | nvram_read_u16(prefix, NULL, "cckbw202gpo", &sprom->cckbw202gpo, 0); | ||
| 435 | nvram_read_u16(prefix, NULL, "cckbw20ul2gpo", &sprom->cckbw20ul2gpo, 0); | ||
| 436 | nvram_read_u32(prefix, NULL, "legofdmbw202gpo", | ||
| 437 | &sprom->legofdmbw202gpo, 0); | ||
| 438 | nvram_read_u32(prefix, NULL, "legofdmbw20ul2gpo", | ||
| 439 | &sprom->legofdmbw20ul2gpo, 0); | ||
| 440 | nvram_read_u32(prefix, NULL, "legofdmbw205glpo", | ||
| 441 | &sprom->legofdmbw205glpo, 0); | ||
| 442 | nvram_read_u32(prefix, NULL, "legofdmbw20ul5glpo", | ||
| 443 | &sprom->legofdmbw20ul5glpo, 0); | ||
| 444 | nvram_read_u32(prefix, NULL, "legofdmbw205gmpo", | ||
| 445 | &sprom->legofdmbw205gmpo, 0); | ||
| 446 | nvram_read_u32(prefix, NULL, "legofdmbw20ul5gmpo", | ||
| 447 | &sprom->legofdmbw20ul5gmpo, 0); | ||
| 448 | nvram_read_u32(prefix, NULL, "legofdmbw205ghpo", | ||
| 449 | &sprom->legofdmbw205ghpo, 0); | ||
| 450 | nvram_read_u32(prefix, NULL, "legofdmbw20ul5ghpo", | ||
| 451 | &sprom->legofdmbw20ul5ghpo, 0); | ||
| 452 | nvram_read_u32(prefix, NULL, "mcsbw202gpo", &sprom->mcsbw202gpo, 0); | ||
| 453 | nvram_read_u32(prefix, NULL, "mcsbw20ul2gpo", &sprom->mcsbw20ul2gpo, 0); | ||
| 454 | nvram_read_u32(prefix, NULL, "mcsbw402gpo", &sprom->mcsbw402gpo, 0); | ||
| 455 | nvram_read_u32(prefix, NULL, "mcsbw205glpo", &sprom->mcsbw205glpo, 0); | ||
| 456 | nvram_read_u32(prefix, NULL, "mcsbw20ul5glpo", | ||
| 457 | &sprom->mcsbw20ul5glpo, 0); | ||
| 458 | nvram_read_u32(prefix, NULL, "mcsbw405glpo", &sprom->mcsbw405glpo, 0); | ||
| 459 | nvram_read_u32(prefix, NULL, "mcsbw205gmpo", &sprom->mcsbw205gmpo, 0); | ||
| 460 | nvram_read_u32(prefix, NULL, "mcsbw20ul5gmpo", | ||
| 461 | &sprom->mcsbw20ul5gmpo, 0); | ||
| 462 | nvram_read_u32(prefix, NULL, "mcsbw405gmpo", &sprom->mcsbw405gmpo, 0); | ||
| 463 | nvram_read_u32(prefix, NULL, "mcsbw205ghpo", &sprom->mcsbw205ghpo, 0); | ||
| 464 | nvram_read_u32(prefix, NULL, "mcsbw20ul5ghpo", | ||
| 465 | &sprom->mcsbw20ul5ghpo, 0); | ||
| 466 | nvram_read_u32(prefix, NULL, "mcsbw405ghpo", &sprom->mcsbw405ghpo, 0); | ||
| 467 | nvram_read_u16(prefix, NULL, "mcs32po", &sprom->mcs32po, 0); | ||
| 468 | nvram_read_u16(prefix, NULL, "legofdm40duppo", | ||
| 469 | &sprom->legofdm40duppo, 0); | ||
| 470 | nvram_read_u8(prefix, NULL, "sar2g", &sprom->sar2g, 0); | ||
| 471 | nvram_read_u8(prefix, NULL, "sar5g", &sprom->sar5g, 0); | ||
| 472 | } | ||
| 473 | |||
| 474 | static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom, | ||
| 475 | const char *prefix) | ||
| 476 | { | ||
| 477 | char postfix[2]; | ||
| 478 | int i; | ||
| 479 | |||
| 480 | for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) { | ||
| 481 | struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i]; | ||
| 482 | snprintf(postfix, sizeof(postfix), "%i", i); | ||
| 483 | nvram_read_u8(prefix, postfix, "maxp2ga", | ||
| 484 | &pwr_info->maxpwr_2g, 0); | ||
| 485 | nvram_read_u8(prefix, postfix, "itt2ga", | ||
| 486 | &pwr_info->itssi_2g, 0); | ||
| 487 | nvram_read_u8(prefix, postfix, "itt5ga", | ||
| 488 | &pwr_info->itssi_5g, 0); | ||
| 489 | nvram_read_u16(prefix, postfix, "pa2gw0a", | ||
| 490 | &pwr_info->pa_2g[0], 0); | ||
| 491 | nvram_read_u16(prefix, postfix, "pa2gw1a", | ||
| 492 | &pwr_info->pa_2g[1], 0); | ||
| 493 | nvram_read_u16(prefix, postfix, "pa2gw2a", | ||
| 494 | &pwr_info->pa_2g[2], 0); | ||
| 495 | nvram_read_u8(prefix, postfix, "maxp5ga", | ||
| 496 | &pwr_info->maxpwr_5g, 0); | ||
| 497 | nvram_read_u8(prefix, postfix, "maxp5gha", | ||
| 498 | &pwr_info->maxpwr_5gh, 0); | ||
| 499 | nvram_read_u8(prefix, postfix, "maxp5gla", | ||
| 500 | &pwr_info->maxpwr_5gl, 0); | ||
| 501 | nvram_read_u16(prefix, postfix, "pa5gw0a", | ||
| 502 | &pwr_info->pa_5g[0], 0); | ||
| 503 | nvram_read_u16(prefix, postfix, "pa5gw1a", | ||
| 504 | &pwr_info->pa_5g[1], 0); | ||
| 505 | nvram_read_u16(prefix, postfix, "pa5gw2a", | ||
| 506 | &pwr_info->pa_5g[2], 0); | ||
| 507 | nvram_read_u16(prefix, postfix, "pa5glw0a", | ||
| 508 | &pwr_info->pa_5gl[0], 0); | ||
| 509 | nvram_read_u16(prefix, postfix, "pa5glw1a", | ||
| 510 | &pwr_info->pa_5gl[1], 0); | ||
| 511 | nvram_read_u16(prefix, postfix, "pa5glw2a", | ||
| 512 | &pwr_info->pa_5gl[2], 0); | ||
| 513 | nvram_read_u16(prefix, postfix, "pa5ghw0a", | ||
| 514 | &pwr_info->pa_5gh[0], 0); | ||
| 515 | nvram_read_u16(prefix, postfix, "pa5ghw1a", | ||
| 516 | &pwr_info->pa_5gh[1], 0); | ||
| 517 | nvram_read_u16(prefix, postfix, "pa5ghw2a", | ||
| 518 | &pwr_info->pa_5gh[2], 0); | ||
| 519 | } | ||
| 520 | } | ||
| 521 | |||
| 522 | static void bcm47xx_fill_sprom_path_r45(struct ssb_sprom *sprom, | ||
| 523 | const char *prefix) | ||
| 524 | { | ||
| 525 | char postfix[2]; | ||
| 526 | int i; | ||
| 527 | |||
| 528 | for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) { | ||
| 529 | struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i]; | ||
| 530 | snprintf(postfix, sizeof(postfix), "%i", i); | ||
| 531 | nvram_read_u16(prefix, postfix, "pa2gw3a", | ||
| 532 | &pwr_info->pa_2g[3], 0); | ||
| 533 | nvram_read_u16(prefix, postfix, "pa5gw3a", | ||
| 534 | &pwr_info->pa_5g[3], 0); | ||
| 535 | nvram_read_u16(prefix, postfix, "pa5glw3a", | ||
| 536 | &pwr_info->pa_5gl[3], 0); | ||
| 537 | nvram_read_u16(prefix, postfix, "pa5ghw3a", | ||
| 538 | &pwr_info->pa_5gh[3], 0); | ||
| 539 | } | ||
| 540 | } | ||
| 541 | |||
| 542 | void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix) | ||
| 543 | { | ||
| 544 | nvram_read_macaddr(prefix, "et0macaddr", &sprom->et0mac); | ||
| 545 | nvram_read_u8(prefix, NULL, "et0mdcport", &sprom->et0mdcport, 0); | ||
| 546 | nvram_read_u8(prefix, NULL, "et0phyaddr", &sprom->et0phyaddr, 0); | ||
| 547 | |||
| 548 | nvram_read_macaddr(prefix, "et1macaddr", &sprom->et1mac); | ||
| 549 | nvram_read_u8(prefix, NULL, "et1mdcport", &sprom->et1mdcport, 0); | ||
| 550 | nvram_read_u8(prefix, NULL, "et1phyaddr", &sprom->et1phyaddr, 0); | ||
| 551 | |||
| 552 | nvram_read_macaddr(prefix, "macaddr", &sprom->il0mac); | ||
| 553 | nvram_read_macaddr(prefix, "il0macaddr", &sprom->il0mac); | ||
| 554 | } | ||
| 555 | |||
| 556 | void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix) | ||
| 557 | { | ||
| 558 | memset(sprom, 0, sizeof(struct ssb_sprom)); | ||
| 559 | |||
| 560 | bcm47xx_fill_sprom_ethernet(sprom, prefix); | ||
| 561 | |||
| 562 | nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0); | ||
| 563 | |||
| 564 | switch (sprom->revision) { | ||
| 565 | case 1: | ||
| 566 | bcm47xx_fill_sprom_r1234589(sprom, prefix); | ||
| 567 | bcm47xx_fill_sprom_r12389(sprom, prefix); | ||
| 568 | bcm47xx_fill_sprom_r1(sprom, prefix); | ||
| 569 | break; | ||
| 570 | case 2: | ||
| 571 | bcm47xx_fill_sprom_r1234589(sprom, prefix); | ||
| 572 | bcm47xx_fill_sprom_r12389(sprom, prefix); | ||
| 573 | bcm47xx_fill_sprom_r2389(sprom, prefix); | ||
| 574 | bcm47xx_fill_sprom_r2(sprom, prefix); | ||
| 575 | break; | ||
| 576 | case 3: | ||
| 577 | bcm47xx_fill_sprom_r1234589(sprom, prefix); | ||
| 578 | bcm47xx_fill_sprom_r12389(sprom, prefix); | ||
| 579 | bcm47xx_fill_sprom_r2389(sprom, prefix); | ||
| 580 | bcm47xx_fill_sprom_r389(sprom, prefix); | ||
| 581 | bcm47xx_fill_sprom_r3(sprom, prefix); | ||
| 582 | break; | ||
| 583 | case 4: | ||
| 584 | case 5: | ||
| 585 | bcm47xx_fill_sprom_r1234589(sprom, prefix); | ||
| 586 | bcm47xx_fill_sprom_r4589(sprom, prefix); | ||
| 587 | bcm47xx_fill_sprom_r458(sprom, prefix); | ||
| 588 | bcm47xx_fill_sprom_r45(sprom, prefix); | ||
| 589 | bcm47xx_fill_sprom_path_r4589(sprom, prefix); | ||
| 590 | bcm47xx_fill_sprom_path_r45(sprom, prefix); | ||
| 591 | break; | ||
| 592 | case 8: | ||
| 593 | bcm47xx_fill_sprom_r1234589(sprom, prefix); | ||
| 594 | bcm47xx_fill_sprom_r12389(sprom, prefix); | ||
| 595 | bcm47xx_fill_sprom_r2389(sprom, prefix); | ||
| 596 | bcm47xx_fill_sprom_r389(sprom, prefix); | ||
| 597 | bcm47xx_fill_sprom_r4589(sprom, prefix); | ||
| 598 | bcm47xx_fill_sprom_r458(sprom, prefix); | ||
| 599 | bcm47xx_fill_sprom_r89(sprom, prefix); | ||
| 600 | bcm47xx_fill_sprom_path_r4589(sprom, prefix); | ||
| 601 | break; | ||
| 602 | case 9: | ||
| 603 | bcm47xx_fill_sprom_r1234589(sprom, prefix); | ||
| 604 | bcm47xx_fill_sprom_r12389(sprom, prefix); | ||
| 605 | bcm47xx_fill_sprom_r2389(sprom, prefix); | ||
| 606 | bcm47xx_fill_sprom_r389(sprom, prefix); | ||
| 607 | bcm47xx_fill_sprom_r4589(sprom, prefix); | ||
| 608 | bcm47xx_fill_sprom_r89(sprom, prefix); | ||
| 609 | bcm47xx_fill_sprom_r9(sprom, prefix); | ||
| 610 | bcm47xx_fill_sprom_path_r4589(sprom, prefix); | ||
| 611 | break; | ||
| 612 | default: | ||
| 613 | pr_warn("Unsupported SPROM revision %d detected. Will extract" | ||
| 614 | " v1\n", sprom->revision); | ||
| 615 | sprom->revision = 1; | ||
| 616 | bcm47xx_fill_sprom_r1234589(sprom, prefix); | ||
| 617 | bcm47xx_fill_sprom_r12389(sprom, prefix); | ||
| 618 | bcm47xx_fill_sprom_r1(sprom, prefix); | ||
| 619 | } | ||
| 620 | } | ||
| @@ -44,4 +44,7 @@ union bcm47xx_bus { · 43 unmodified lines | |||
| 44 | extern union bcm47xx_bus bcm47xx_bus; | 44 | extern union bcm47xx_bus bcm47xx_bus; |
| 45 | extern enum bcm47xx_bus_type bcm47xx_bus_type; | 45 | extern enum bcm47xx_bus_type bcm47xx_bus_type; |
| 46 | 46 | ||
| 47 | void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix); | ||
| 48 | void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix); | ||
| 49 | |||
| 47 | #endif /* __ASM_BCM47XX_H */ | 50 | #endif /* __ASM_BCM47XX_H */ |
| @@ -37,7 +37,7 @@ struct nvram_header { · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | extern int nvram_getenv(char *name, char *val, size_t val_len); | 38 | extern int nvram_getenv(char *name, char *val, size_t val_len); |
| 39 | 39 | ||
| 40 | static inline void nvram_parse_macaddr(char *buf, u8 *macaddr) | 40 | static inline void nvram_parse_macaddr(char *buf, u8 macaddr[6]) |
| 41 | { | 41 | { |
| 42 | if (strchr(buf, ':')) | 42 | if (strchr(buf, ':')) |
| 43 | sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], | 43 | sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], |
| @@ -84,6 +84,10 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */ · 83 unmodified lines | |||
| 84 | 84 | ||
| 85 | #define SO_WIFI_STATUS 41 | 85 | #define SO_WIFI_STATUS 41 |
| 86 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 86 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 87 | #define SO_PEEK_OFF 42 | ||
| 88 | |||
| 89 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 90 | #define SO_NOFCS 43 | ||
| 87 | 91 | ||
| 88 | #ifdef __KERNEL__ | 92 | #ifdef __KERNEL__ |
| 89 | 93 | ||
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
| 27 | #include <linux/ssb/ssb.h> | 27 | #include <linux/ssb/ssb.h> |
| 28 | #include <linux/bcma/bcma.h> | ||
| 28 | #include <bcm47xx.h> | 29 | #include <bcm47xx.h> |
| 29 | 30 | ||
| 30 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 31 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
| @@ -32,15 +33,12 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) · 1 unmodified line | |||
| 32 | return 0; | 33 | return 0; |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
| 36 | { | ||
| 37 | #ifdef CONFIG_BCM47XX_SSB | 36 | #ifdef CONFIG_BCM47XX_SSB |
| 37 | static int bcm47xx_pcibios_plat_dev_init_ssb(struct pci_dev *dev) | ||
| 38 | { | ||
| 38 | int res; | 39 | int res; |
| 39 | u8 slot, pin; | 40 | u8 slot, pin; |
| 40 | 41 | ||
| 41 | if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB) | ||
| 42 | return 0; | ||
| 43 | |||
| 44 | res = ssb_pcibios_plat_dev_init(dev); | 42 | res = ssb_pcibios_plat_dev_init(dev); |
| 45 | if (res < 0) { | 43 | if (res < 0) { |
| 46 | printk(KERN_ALERT "PCI: Failed to init device %s\n", | 44 | printk(KERN_ALERT "PCI: Failed to init device %s\n", |
| @@ -60,6 +58,47 @@ int pcibios_plat_dev_init(struct pci_dev *dev) · 13 unmodified lines | |||
| 60 | } | 58 | } |
| 61 | 59 | ||
| 62 | dev->irq = res; | 60 | dev->irq = res; |
| 61 | return 0; | ||
| 62 | } | ||
| 63 | #endif | 63 | #endif |
| 64 | |||
| 65 | #ifdef CONFIG_BCM47XX_BCMA | ||
| 66 | static int bcm47xx_pcibios_plat_dev_init_bcma(struct pci_dev *dev) | ||
| 67 | { | ||
| 68 | int res; | ||
| 69 | |||
| 70 | res = bcma_core_pci_plat_dev_init(dev); | ||
| 71 | if (res < 0) { | ||
| 72 | printk(KERN_ALERT "PCI: Failed to init device %s\n", | ||
| 73 | pci_name(dev)); | ||
| 74 | return res; | ||
| 75 | } | ||
| 76 | |||
| 77 | res = bcma_core_pci_pcibios_map_irq(dev); | ||
| 78 | |||
| 79 | /* IRQ-0 and IRQ-1 are software interrupts. */ | ||
| 80 | if (res < 2) { | ||
| 81 | printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n", | ||
| 82 | pci_name(dev)); | ||
| 83 | return res; | ||
| 84 | } | ||
| 85 | |||
| 86 | dev->irq = res; | ||
| 64 | return 0; | 87 | return 0; |
| 65 | } | 88 | } |
| 89 | #endif | ||
| 90 | |||
| 91 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
| 92 | { | ||
| 93 | #ifdef CONFIG_BCM47XX_SSB | ||
| 94 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_SSB) | ||
| 95 | return bcm47xx_pcibios_plat_dev_init_ssb(dev); | ||
| 96 | else | ||
| 97 | #endif | ||
| 98 | #ifdef CONFIG_BCM47XX_BCMA | ||
| 99 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) | ||
| 100 | return bcm47xx_pcibios_plat_dev_init_bcma(dev); | ||
| 101 | else | ||
| 102 | #endif | ||
| 103 | return 0; | ||
| 104 | } | ||
| @@ -64,5 +64,9 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | #define SO_WIFI_STATUS 41 | 65 | #define SO_WIFI_STATUS 41 |
| 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 66 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 67 | #define SO_PEEK_OFF 42 | ||
| 68 | |||
| 69 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 70 | #define SO_NOFCS 43 | ||
| 67 | 71 | ||
| 68 | #endif /* _ASM_SOCKET_H */ | 72 | #endif /* _ASM_SOCKET_H */ |
| @@ -63,6 +63,11 @@ · 62 unmodified lines | |||
| 63 | 63 | ||
| 64 | #define SO_WIFI_STATUS 0x4022 | 64 | #define SO_WIFI_STATUS 0x4022 |
| 65 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 65 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 66 | #define SO_PEEK_OFF 0x4023 | ||
| 67 | |||
| 68 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 69 | #define SO_NOFCS 0x4024 | ||
| 70 | |||
| 66 | 71 | ||
| 67 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we | 72 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we |
| 68 | * have to define SOCK_NONBLOCK to a different value here. | 73 | * have to define SOCK_NONBLOCK to a different value here. |
| @@ -222,7 +222,7 @@ · 221 unmodified lines | |||
| 222 | 222 | ||
| 223 | EMAC0: ethernet@ef600c00 { | 223 | EMAC0: ethernet@ef600c00 { |
| 224 | device_type = "network"; | 224 | device_type = "network"; |
| 225 | compatible = "ibm,emac4sync"; | 225 | compatible = "ibm,emac-apm821xx", "ibm,emac4sync"; |
| 226 | interrupt-parent = <&EMAC0>; | 226 | interrupt-parent = <&EMAC0>; |
| 227 | interrupts = <0x0 0x1>; | 227 | interrupts = <0x0 0x1>; |
| 228 | #interrupt-cells = <1>; | 228 | #interrupt-cells = <1>; |
| @@ -71,5 +71,9 @@ · 70 unmodified lines | |||
| 71 | 71 | ||
| 72 | #define SO_WIFI_STATUS 41 | 72 | #define SO_WIFI_STATUS 41 |
| 73 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 73 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 74 | #define SO_PEEK_OFF 42 | ||
| 75 | |||
| 76 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 77 | #define SO_NOFCS 43 | ||
| 74 | 78 | ||
| 75 | #endif /* _ASM_POWERPC_SOCKET_H */ | 79 | #endif /* _ASM_POWERPC_SOCKET_H */ |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #define SIOC_QETH_ARP_FLUSH_CACHE (SIOCDEVPRIVATE + 4) | 20 | #define SIOC_QETH_ARP_FLUSH_CACHE (SIOCDEVPRIVATE + 4) |
| 21 | #define SIOC_QETH_ADP_SET_SNMP_CONTROL (SIOCDEVPRIVATE + 5) | 21 | #define SIOC_QETH_ADP_SET_SNMP_CONTROL (SIOCDEVPRIVATE + 5) |
| 22 | #define SIOC_QETH_GET_CARD_TYPE (SIOCDEVPRIVATE + 6) | 22 | #define SIOC_QETH_GET_CARD_TYPE (SIOCDEVPRIVATE + 6) |
| 23 | #define SIOC_QETH_QUERY_OAT (SIOCDEVPRIVATE + 7) | ||
| 23 | 24 | ||
| 24 | struct qeth_arp_cache_entry { | 25 | struct qeth_arp_cache_entry { |
| 25 | __u8 macaddr[6]; | 26 | __u8 macaddr[6]; |
| @@ -107,4 +108,10 @@ struct qeth_arp_query_user_data { · 81 unmodified lines | |||
| 107 | char *entries; | 108 | char *entries; |
| 108 | } __attribute__((packed)); | 109 | } __attribute__((packed)); |
| 109 | 110 | ||
| 111 | struct qeth_query_oat_data { | ||
| 112 | __u32 command; | ||
| 113 | __u32 buffer_len; | ||
| 114 | __u32 response_len; | ||
| 115 | __u64 ptr; | ||
| 116 | }; | ||
| 110 | #endif /* __ASM_S390_QETH_IOCTL_H__ */ | 117 | #endif /* __ASM_S390_QETH_IOCTL_H__ */ |
| @@ -72,5 +72,9 @@ · 71 unmodified lines | |||
| 72 | 72 | ||
| 73 | #define SO_WIFI_STATUS 41 | 73 | #define SO_WIFI_STATUS 41 |
| 74 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 74 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 75 | #define SO_PEEK_OFF 42 | ||
| 76 | |||
| 77 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 78 | #define SO_NOFCS 43 | ||
| 75 | 79 | ||
| 76 | #endif /* _ASM_SOCKET_H */ | 80 | #endif /* _ASM_SOCKET_H */ |
| @@ -60,6 +60,11 @@ · 59 unmodified lines | |||
| 60 | 60 | ||
| 61 | #define SO_WIFI_STATUS 0x0025 | 61 | #define SO_WIFI_STATUS 0x0025 |
| 62 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 62 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 63 | #define SO_PEEK_OFF 0x0026 | ||
| 64 | |||
| 65 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 66 | #define SO_NOFCS 0x0027 | ||
| 67 | |||
| 63 | 68 | ||
| 64 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 69 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
| 65 | #define SO_SECURITY_AUTHENTICATION 0x5001 | 70 | #define SO_SECURITY_AUTHENTICATION 0x5001 |
| @@ -293,7 +293,7 @@ static void uml_net_user_timer_expire(unsigned long _conn) · 292 unmodified lines | |||
| 293 | #endif | 293 | #endif |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | static void setup_etheraddr(char *str, unsigned char *addr, char *name) | 296 | static int setup_etheraddr(char *str, unsigned char *addr, char *name) |
| 297 | { | 297 | { |
| 298 | char *end; | 298 | char *end; |
| 299 | int i; | 299 | int i; |
| @@ -334,12 +334,13 @@ static void setup_etheraddr(char *str, unsigned char *addr, char *name) · 34 unmodified lines | |||
| 334 | addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], | 334 | addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], |
| 335 | addr[5]); | 335 | addr[5]); |
| 336 | } | 336 | } |
| 337 | return; | 337 | return 0; |
| 338 | 338 | ||
| 339 | random: | 339 | random: |
| 340 | printk(KERN_INFO | 340 | printk(KERN_INFO |
| 341 | "Choosing a random ethernet address for device %s\n", name); | 341 | "Choosing a random ethernet address for device %s\n", name); |
| 342 | random_ether_addr(addr); | 342 | random_ether_addr(addr); |
| 343 | return 1; | ||
| 343 | } | 344 | } |
| 344 | 345 | ||
| 345 | static DEFINE_SPINLOCK(devices_lock); | 346 | static DEFINE_SPINLOCK(devices_lock); |
| @@ -391,6 +392,7 @@ static void eth_configure(int n, void *init, char *mac, · 45 unmodified lines | |||
| 391 | struct net_device *dev; | 392 | struct net_device *dev; |
| 392 | struct uml_net_private *lp; | 393 | struct uml_net_private *lp; |
| 393 | int err, size; | 394 | int err, size; |
| 395 | int random_mac; | ||
| 394 | 396 | ||
| 395 | size = transport->private_size + sizeof(struct uml_net_private); | 397 | size = transport->private_size + sizeof(struct uml_net_private); |
| 396 | 398 | ||
| @@ -417,7 +419,7 @@ static void eth_configure(int n, void *init, char *mac, · 20 unmodified lines | |||
| 417 | */ | 419 | */ |
| 418 | snprintf(dev->name, sizeof(dev->name), "eth%d", n); | 420 | snprintf(dev->name, sizeof(dev->name), "eth%d", n); |
| 419 | 421 | ||
| 420 | setup_etheraddr(mac, device->mac, dev->name); | 422 | random_mac = setup_etheraddr(mac, device->mac, dev->name); |
| 421 | 423 | ||
| 422 | printk(KERN_INFO "Netdevice %d (%pM) : ", n, device->mac); | 424 | printk(KERN_INFO "Netdevice %d (%pM) : ", n, device->mac); |
| 423 | 425 | ||
| @@ -474,6 +476,9 @@ static void eth_configure(int n, void *init, char *mac, · 50 unmodified lines | |||
| 474 | 476 | ||
| 475 | /* don't use eth_mac_addr, it will not work here */ | 477 | /* don't use eth_mac_addr, it will not work here */ |
| 476 | memcpy(dev->dev_addr, device->mac, ETH_ALEN); | 478 | memcpy(dev->dev_addr, device->mac, ETH_ALEN); |
| 479 | if (random_mac) | ||
| 480 | dev->addr_assign_type |= NET_ADDR_RANDOM; | ||
| 481 | |||
| 477 | dev->mtu = transport->user->mtu; | 482 | dev->mtu = transport->user->mtu; |
| 478 | dev->netdev_ops = ¨_netdev_ops; | 483 | dev->netdev_ops = ¨_netdev_ops; |
| 479 | dev->ethtool_ops = ¨_net_ethtool_ops; | 484 | dev->ethtool_ops = ¨_net_ethtool_ops; |
| @@ -475,8 +475,10 @@ void bpf_jit_compile(struct sk_filter *fp) · 474 unmodified lines | |||
| 475 | case BPF_S_LD_W_ABS: | 475 | case BPF_S_LD_W_ABS: |
| 476 | func = sk_load_word; | 476 | func = sk_load_word; |
| 477 | common_load: seen |= SEEN_DATAREF; | 477 | common_load: seen |= SEEN_DATAREF; |
| 478 | if ((int)K < 0) | 478 | if ((int)K < 0) { |
| 479 | /* Abort the JIT because __load_pointer() is needed. */ | ||
| 479 | goto out; | 480 | goto out; |
| 481 | } | ||
| 480 | t_offset = func - (image + addrs[i]); | 482 | t_offset = func - (image + addrs[i]); |
| 481 | EMIT1_off32(0xbe, K); /* mov imm32,%esi */ | 483 | EMIT1_off32(0xbe, K); /* mov imm32,%esi */ |
| 482 | EMIT1_off32(0xe8, t_offset); /* call */ | 484 | EMIT1_off32(0xe8, t_offset); /* call */ |
| @@ -489,14 +491,8 @@ common_load: seen |= SEEN_DATAREF; · 6 unmodified lines | |||
| 489 | goto common_load; | 491 | goto common_load; |
| 490 | case BPF_S_LDX_B_MSH: | 492 | case BPF_S_LDX_B_MSH: |
| 491 | if ((int)K < 0) { | 493 | if ((int)K < 0) { |
| 492 | if (pc_ret0 > 0) { | 494 | /* Abort the JIT because __load_pointer() is needed. */ |
| 493 | /* addrs[pc_ret0 - 1] is the start address */ | 495 | goto out; |
| 494 | EMIT_JMP(addrs[pc_ret0 - 1] - addrs[i]); | ||
| 495 | break; | ||
| 496 | } | ||
| 497 | CLEAR_A(); | ||
| 498 | EMIT_JMP(cleanup_addr - addrs[i]); | ||
| 499 | break; | ||
| 500 | } | 496 | } |
| 501 | seen |= SEEN_DATAREF | SEEN_XREG; | 497 | seen |= SEEN_DATAREF | SEEN_XREG; |
| 502 | t_offset = sk_load_byte_msh - (image + addrs[i]); | 498 | t_offset = sk_load_byte_msh - (image + addrs[i]); |
| @@ -75,5 +75,9 @@ · 74 unmodified lines | |||
| 75 | 75 | ||
| 76 | #define SO_WIFI_STATUS 41 | 76 | #define SO_WIFI_STATUS 41 |
| 77 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 77 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
| 78 | #define SO_PEEK_OFF 42 | ||
| 79 | |||
| 80 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
| 81 | #define SO_NOFCS 43 | ||
| 78 | 82 | ||
| 79 | #endif /* _XTENSA_SOCKET_H */ | 83 | #endif /* _XTENSA_SOCKET_H */ |
| @@ -389,9 +389,13 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 388 unmodified lines | |||
| 389 | (nlh->nlmsg_flags & NLM_F_DUMP))) { | 389 | (nlh->nlmsg_flags & NLM_F_DUMP))) { |
| 390 | if (link->dump == NULL) | 390 | if (link->dump == NULL) |
| 391 | return -EINVAL; | 391 | return -EINVAL; |
| 392 | 392 | { | |
| 393 | return netlink_dump_start(crypto_nlsk, skb, nlh, | 393 | struct netlink_dump_control c = { |
| 394 | link->dump, link->done, 0); | 394 | .dump = link->dump, |
| 395 | .done = link->done, | ||
| 396 | }; | ||
| 397 | return netlink_dump_start(crypto_nlsk, skb, nlh, &c); | ||
| 398 | } | ||
| 395 | } | 399 | } |
| 396 | 400 | ||
| 397 | err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, | 401 | err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, |
| @@ -156,9 +156,6 @@ static int tx_complete = 0,dma_complete = 0,queued = 0,requeued = 0, · 155 unmodified lines | |||
| 156 | 156 | ||
| 157 | static struct atm_dev *eni_boards = NULL; | 157 | static struct atm_dev *eni_boards = NULL; |
| 158 | 158 | ||
| 159 | static u32 *cpu_zeroes = NULL; /* aligned "magic" zeroes */ | ||
| 160 | static dma_addr_t zeroes; | ||
| 161 | |||
| 162 | /* Read/write registers on card */ | 159 | /* Read/write registers on card */ |
| 163 | #define eni_in(r) readl(eni_dev->reg+(r)*4) | 160 | #define eni_in(r) readl(eni_dev->reg+(r)*4) |
| 164 | #define eni_out(v,r) writel((v),eni_dev->reg+(r)*4) | 161 | #define eni_out(v,r) writel((v),eni_dev->reg+(r)*4) |
| @@ -1138,8 +1135,10 @@ DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */ · 973 unmodified lines | |||
| 1138 | skb_shinfo(skb)->frags[i].page_offset, | 1135 | skb_shinfo(skb)->frags[i].page_offset, |
| 1139 | skb_frag_size(&skb_shinfo(skb)->frags[i])); | 1136 | skb_frag_size(&skb_shinfo(skb)->frags[i])); |
| 1140 | } | 1137 | } |
| 1141 | if (skb->len & 3) | 1138 | if (skb->len & 3) { |
| 1142 | put_dma(tx->index,eni_dev->dma,&j,zeroes,4-(skb->len & 3)); | 1139 | put_dma(tx->index, eni_dev->dma, &j, eni_dev->zero.dma, |
| 1140 | 4 - (skb->len & 3)); | ||
| 1141 | } | ||
| 1143 | /* JK for AAL5 trailer - AAL0 doesn't need it, but who cares ... */ | 1142 | /* JK for AAL5 trailer - AAL0 doesn't need it, but who cares ... */ |
| 1144 | eni_dev->dma[j++] = (((tx->tx_pos+size) & (tx->words-1)) << | 1143 | eni_dev->dma[j++] = (((tx->tx_pos+size) & (tx->words-1)) << |
| 1145 | MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) | | 1144 | MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) | |
| @@ -1728,6 +1727,7 @@ static int __devinit eni_do_init(struct atm_dev *dev) · 582 unmodified lines | |||
| 1728 | "mapping\n",dev->number); | 1727 | "mapping\n",dev->number); |
| 1729 | return error; | 1728 | return error; |
| 1730 | } | 1729 | } |
| 1730 | eni_dev->ioaddr = base; | ||
| 1731 | eni_dev->base_diff = real_base - (unsigned long) base; | 1731 | eni_dev->base_diff = real_base - (unsigned long) base; |
| 1732 | /* id may not be present in ASIC Tonga boards - check this @@@ */ | 1732 | /* id may not be present in ASIC Tonga boards - check this @@@ */ |
| 1733 | if (!eni_dev->asic) { | 1733 | if (!eni_dev->asic) { |
| @@ -1789,6 +1789,14 @@ unmap: · 55 unmodified lines | |||
| 1789 | goto out; | 1789 | goto out; |
| 1790 | } | 1790 | } |
| 1791 | 1791 | ||
| 1792 | static void eni_do_release(struct atm_dev *dev) | ||
| 1793 | { | ||
| 1794 | struct eni_dev *ed = ENI_DEV(dev); | ||
| 1795 | |||
| 1796 | dev->phy->stop(dev); | ||
| 1797 | dev->phy = NULL; | ||
| 1798 | iounmap(ed->ioaddr); | ||
| 1799 | } | ||
| 1792 | 1800 | ||
| 1793 | static int __devinit eni_start(struct atm_dev *dev) | 1801 | static int __devinit eni_start(struct atm_dev *dev) |
| 1794 | { | 1802 | { |
| @@ -1873,7 +1881,7 @@ free_list: · 78 unmodified lines | |||
| 1873 | kfree(eni_dev->free_list); | 1881 | kfree(eni_dev->free_list); |
| 1874 | 1882 | ||
| 1875 | free_irq: | 1883 | free_irq: |
| 1876 | free_irq(eni_dev->irq, eni_dev); | 1884 | free_irq(eni_dev->irq, dev); |
| 1877 | 1885 | ||
| 1878 | out: | 1886 | out: |
| 1879 | return error; | 1887 | return error; |
| @@ -2220,48 +2228,60 @@ static const struct atmdev_ops ops = { · 340 unmodified lines | |||
| 2220 | 2228 | ||
| 2221 | 2229 | ||
| 2222 | static int __devinit eni_init_one(struct pci_dev *pci_dev, | 2230 | static int __devinit eni_init_one(struct pci_dev *pci_dev, |
| 2223 | const struct pci_device_id *ent) | 2231 | const struct pci_device_id *ent) |
| 2224 | { | 2232 | { |
| 2225 | struct atm_dev *dev; | 2233 | struct atm_dev *dev; |
| 2226 | struct eni_dev *eni_dev; | 2234 | struct eni_dev *eni_dev; |
| 2227 | int error = -ENOMEM; | 2235 | struct eni_zero *zero; |
| 2236 | int rc; | ||
| 2237 | |||
| 2238 | rc = pci_enable_device(pci_dev); | ||
| 2239 | if (rc < 0) | ||
| 2240 | goto out; | ||
| 2228 | 2241 | ||
| 2229 | DPRINTK("eni_init_one\n"); | 2242 | rc = -ENOMEM; |
| 2243 | eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL); | ||
| 2244 | if (!eni_dev) | ||
| 2245 | goto err_disable; | ||
| 2230 | 2246 | ||
| 2231 | if (pci_enable_device(pci_dev)) { | 2247 | zero = &eni_dev->zero; |
| 2232 | error = -EIO; | 2248 | zero->addr = pci_alloc_consistent(pci_dev, ENI_ZEROES_SIZE, &zero->dma); |
| 2233 | goto out0; | 2249 | if (!zero->addr) |
| 2234 | } | 2250 | goto err_kfree; |
| 2235 | 2251 | ||
| 2236 | eni_dev = kmalloc(sizeof(struct eni_dev),GFP_KERNEL); | ||
| 2237 | if (!eni_dev) goto out0; | ||
| 2238 | if (!cpu_zeroes) { | ||
| 2239 | cpu_zeroes = pci_alloc_consistent(pci_dev,ENI_ZEROES_SIZE, | ||
| 2240 | &zeroes); | ||
| 2241 | if (!cpu_zeroes) goto out1; | ||
| 2242 | } | ||
| 2243 | dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &ops, -1, NULL); | 2252 | dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &ops, -1, NULL); |
| 2244 | if (!dev) goto out2; | 2253 | if (!dev) |
| 2254 | goto err_free_consistent; | ||
| 2255 | |||
| 2256 | dev->dev_data = eni_dev; | ||
| 2245 | pci_set_drvdata(pci_dev, dev); | 2257 | pci_set_drvdata(pci_dev, dev); |
| 2246 | eni_dev->pci_dev = pci_dev; | 2258 | eni_dev->pci_dev = pci_dev; |
| 2247 | dev->dev_data = eni_dev; | ||
| 2248 | eni_dev->asic = ent->driver_data; | 2259 | eni_dev->asic = ent->driver_data; |
| 2249 | error = eni_do_init(dev); | 2260 | |
| 2250 | if (error) goto out3; | 2261 | rc = eni_do_init(dev); |
| 2251 | error = eni_start(dev); | 2262 | if (rc < 0) |
| 2252 | if (error) goto out3; | 2263 | goto err_unregister; |
| 2264 | |||
| 2265 | rc = eni_start(dev); | ||
| 2266 | if (rc < 0) | ||
| 2267 | goto err_eni_release; | ||
| 2268 | |||
| 2253 | eni_dev->more = eni_boards; | 2269 | eni_dev->more = eni_boards; |
| 2254 | eni_boards = dev; | 2270 | eni_boards = dev; |
| 2255 | return 0; | 2271 | out: |
| 2256 | out3: | 2272 | return rc; |
| 2273 | |||
| 2274 | err_eni_release: | ||
| 2275 | eni_do_release(dev); | ||
| 2276 | err_unregister: | ||
| 2257 | atm_dev_deregister(dev); | 2277 | atm_dev_deregister(dev); |
| 2258 | out2: | 2278 | err_free_consistent: |
| 2259 | pci_free_consistent(eni_dev->pci_dev,ENI_ZEROES_SIZE,cpu_zeroes,zeroes); | 2279 | pci_free_consistent(pci_dev, ENI_ZEROES_SIZE, zero->addr, zero->dma); |
| 2260 | cpu_zeroes = NULL; | 2280 | err_kfree: |
| 2261 | out1: | ||
| 2262 | kfree(eni_dev); | 2281 | kfree(eni_dev); |
| 2263 | out0: | 2282 | err_disable: |
| 2264 | return error; | 2283 | pci_disable_device(pci_dev); |
| 2284 | goto out; | ||
| 2265 | } | 2285 | } |
| 2266 | 2286 | ||
| 2267 | 2287 | ||
| @@ -2273,9 +2293,17 @@ static struct pci_device_id eni_pci_tbl[] = { · 5 unmodified lines | |||
| 2273 | MODULE_DEVICE_TABLE(pci,eni_pci_tbl); | 2293 | MODULE_DEVICE_TABLE(pci,eni_pci_tbl); |
| 2274 | 2294 | ||
| 2275 | 2295 | ||
| 2276 | static void __devexit eni_remove_one(struct pci_dev *pci_dev) | 2296 | static void __devexit eni_remove_one(struct pci_dev *pdev) |
| 2277 | { | 2297 | { |
| 2278 | /* grrr */ | 2298 | struct atm_dev *dev = pci_get_drvdata(pdev); |
| 2299 | struct eni_dev *ed = ENI_DEV(dev); | ||
| 2300 | struct eni_zero *zero = &ed->zero; | ||
| 2301 | |||
| 2302 | eni_do_release(dev); | ||
| 2303 | atm_dev_deregister(dev); | ||
| 2304 | pci_free_consistent(pdev, ENI_ZEROES_SIZE, zero->addr, zero->dma); | ||
| 2305 | kfree(ed); | ||
| 2306 | pci_disable_device(pdev); | ||
| 2279 | } | 2307 | } |
| 2280 | 2308 | ||
| 2281 | 2309 | ||
| @@ -72,6 +72,7 @@ struct eni_dev { · 71 unmodified lines | |||
| 72 | u32 events; /* pending events */ | 72 | u32 events; /* pending events */ |
| 73 | /*-------------------------------- base pointers into Midway address | 73 | /*-------------------------------- base pointers into Midway address |
| 74 | space */ | 74 | space */ |
| 75 | void __iomem *ioaddr; | ||
| 75 | void __iomem *phy; /* PHY interface chip registers */ | 76 | void __iomem *phy; /* PHY interface chip registers */ |
| 76 | void __iomem *reg; /* register base */ | 77 | void __iomem *reg; /* register base */ |
| 77 | void __iomem *ram; /* RAM base */ | 78 | void __iomem *ram; /* RAM base */ |
| @@ -86,6 +87,10 @@ struct eni_dev { · 8 unmodified lines | |||
| 86 | wait_queue_head_t tx_wait; /* for close */ | 87 | wait_queue_head_t tx_wait; /* for close */ |
| 87 | int tx_bw; /* remaining bandwidth */ | 88 | int tx_bw; /* remaining bandwidth */ |
| 88 | u32 dma[TX_DMA_BUF*2]; /* DMA request scratch area */ | 89 | u32 dma[TX_DMA_BUF*2]; /* DMA request scratch area */ |
| 90 | struct eni_zero { /* aligned "magic" zeroes */ | ||
| 91 | u32 *addr; | ||
| 92 | dma_addr_t dma; | ||
| 93 | } zero; | ||
| 89 | int tx_mult; /* buffer size multiplier (percent) */ | 94 | int tx_mult; /* buffer size multiplier (percent) */ |
| 90 | /*-------------------------------- RX part */ | 95 | /*-------------------------------- RX part */ |
| 91 | u32 serv_read; /* host service read index */ | 96 | u32 serv_read; /* host service read index */ |
| @@ -1572,7 +1572,7 @@ static inline void host_vcc_unbind(struct lanai_dev *lanai, · 1571 unmodified lines | |||
| 1572 | 1572 | ||
| 1573 | static void lanai_reset(struct lanai_dev *lanai) | 1573 | static void lanai_reset(struct lanai_dev *lanai) |
| 1574 | { | 1574 | { |
| 1575 | printk(KERN_CRIT DEV_LABEL "(itf %d): *NOT* reseting - not " | 1575 | printk(KERN_CRIT DEV_LABEL "(itf %d): *NOT* resetting - not " |
| 1576 | "implemented\n", lanai->number); | 1576 | "implemented\n", lanai->number); |
| 1577 | /* TODO */ | 1577 | /* TODO */ |
| 1578 | /* The following is just a hack until we write the real | 1578 | /* The following is just a hack until we write the real |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | |||
| 13 | struct bcma_bus; | 13 | struct bcma_bus; |
| 14 | 14 | ||
| 15 | /* main.c */ | 15 | /* main.c */ |
| 16 | int bcma_bus_register(struct bcma_bus *bus); | 16 | int __devinit bcma_bus_register(struct bcma_bus *bus); |
| 17 | void bcma_bus_unregister(struct bcma_bus *bus); | 17 | void bcma_bus_unregister(struct bcma_bus *bus); |
| 18 | int __init bcma_bus_early_register(struct bcma_bus *bus, | 18 | int __init bcma_bus_early_register(struct bcma_bus *bus, |
| 19 | struct bcma_device *core_cc, | 19 | struct bcma_device *core_cc, |
| @@ -48,8 +48,12 @@ extern int __init bcma_host_pci_init(void); · 28 unmodified lines | |||
| 48 | extern void __exit bcma_host_pci_exit(void); | 48 | extern void __exit bcma_host_pci_exit(void); |
| 49 | #endif /* CONFIG_BCMA_HOST_PCI */ | 49 | #endif /* CONFIG_BCMA_HOST_PCI */ |
| 50 | 50 | ||
| 51 | /* driver_pci.c */ | ||
| 52 | u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); | ||
| 53 | |||
| 51 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | 54 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE |
| 52 | void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); | 55 | bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); |
| 56 | void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); | ||
| 53 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ | 57 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ |
| 54 | 58 | ||
| 55 | #endif | 59 | #endif |
| @@ -80,6 +80,7 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc) · 79 unmodified lines | |||
| 80 | min_msk = 0x200D; | 80 | min_msk = 0x200D; |
| 81 | max_msk = 0xFFFF; | 81 | max_msk = 0xFFFF; |
| 82 | break; | 82 | break; |
| 83 | case 0x4331: | ||
| 83 | case 43224: | 84 | case 43224: |
| 84 | case 43225: | 85 | case 43225: |
| 85 | break; | 86 | break; |
| @@ -2,8 +2,9 @@ · 1 unmodified line | |||
| 2 | * Broadcom specific AMBA | 2 | * Broadcom specific AMBA |
| 3 | * PCI Core | 3 | * PCI Core |
| 4 | * | 4 | * |
| 5 | * Copyright 2005, Broadcom Corporation | 5 | * Copyright 2005, 2011, Broadcom Corporation |
| 6 | * Copyright 2006, 2007, Michael Buesch <m@bues.ch> | 6 | * Copyright 2006, 2007, Michael Buesch <m@bues.ch> |
| 7 | * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de> | ||
| 7 | * | 8 | * |
| 8 | * Licensed under the GNU/GPL. See COPYING for details. | 9 | * Licensed under the GNU/GPL. See COPYING for details. |
| 9 | */ | 10 | */ |
| @@ -16,40 +17,41 @@ · 6 unmodified lines | |||
| 16 | * R/W ops. | 17 | * R/W ops. |
| 17 | **************************************************/ | 18 | **************************************************/ |
| 18 | 19 | ||
| 19 | static u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address) | 20 | u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address) |
| 20 | { | 21 | { |
| 21 | pcicore_write32(pc, 0x130, address); | 22 | pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address); |
| 22 | pcicore_read32(pc, 0x130); | 23 | pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR); |
| 23 | return pcicore_read32(pc, 0x134); | 24 | return pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_DATA); |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | #if 0 | 27 | #if 0 |
| 27 | static void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data) | 28 | static void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data) |
| 28 | { | 29 | { |
| 29 | pcicore_write32(pc, 0x130, address); | 30 | pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address); |
| 30 | pcicore_read32(pc, 0x130); | 31 | pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR); |
| 31 | pcicore_write32(pc, 0x134, data); | 32 | pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_DATA, data); |
| 32 | } | 33 | } |
| 33 | #endif | 34 | #endif |
| 34 | 35 | ||
| 35 | static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy) | 36 | static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy) |
| 36 | { | 37 | { |
| 37 | const u16 mdio_control = 0x128; | ||
| 38 | const u16 mdio_data = 0x12C; | ||
| 39 | u32 v; | 38 | u32 v; |
| 40 | int i; | 39 | int i; |
| 41 | 40 | ||
| 42 | v = (1 << 30); /* Start of Transaction */ | 41 | v = BCMA_CORE_PCI_MDIODATA_START; |
| 43 | v |= (1 << 28); /* Write Transaction */ | 42 | v |= BCMA_CORE_PCI_MDIODATA_WRITE; |
| 44 | v |= (1 << 17); /* Turnaround */ | 43 | v |= (BCMA_CORE_PCI_MDIODATA_DEV_ADDR << |
| 45 | v |= (0x1F << 18); | 44 | BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF); |
| 45 | v |= (BCMA_CORE_PCI_MDIODATA_BLK_ADDR << | ||
| 46 | BCMA_CORE_PCI_MDIODATA_REGADDR_SHF); | ||
| 47 | v |= BCMA_CORE_PCI_MDIODATA_TA; | ||
| 46 | v |= (phy << 4); | 48 | v |= (phy << 4); |
| 47 | pcicore_write32(pc, mdio_data, v); | 49 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v); |
| 48 | 50 | ||
| 49 | udelay(10); | 51 | udelay(10); |
| 50 | for (i = 0; i < 200; i++) { | 52 | for (i = 0; i < 200; i++) { |
| 51 | v = pcicore_read32(pc, mdio_control); | 53 | v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL); |
| 52 | if (v & 0x100 /* Trans complete */) | 54 | if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE) |
| 53 | break; | 55 | break; |
| 54 | msleep(1); | 56 | msleep(1); |
| 55 | } | 57 | } |
| @@ -57,79 +59,84 @@ static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy) · 1 unmodified line | |||
| 57 | 59 | ||
| 58 | static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u8 device, u8 address) | 60 | static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u8 device, u8 address) |
| 59 | { | 61 | { |
| 60 | const u16 mdio_control = 0x128; | ||
| 61 | const u16 mdio_data = 0x12C; | ||
| 62 | int max_retries = 10; | 62 | int max_retries = 10; |
| 63 | u16 ret = 0; | 63 | u16 ret = 0; |
| 64 | u32 v; | 64 | u32 v; |
| 65 | int i; | 65 | int i; |
| 66 | 66 | ||
| 67 | v = 0x80; /* Enable Preamble Sequence */ | 67 | /* enable mdio access to SERDES */ |
| 68 | v |= 0x2; /* MDIO Clock Divisor */ | 68 | v = BCMA_CORE_PCI_MDIOCTL_PREAM_EN; |
| 69 | pcicore_write32(pc, mdio_control, v); | 69 | v |= BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL; |
| 70 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, v); | ||
| 70 | 71 | ||
| 71 | if (pc->core->id.rev >= 10) { | 72 | if (pc->core->id.rev >= 10) { |
| 72 | max_retries = 200; | 73 | max_retries = 200; |
| 73 | bcma_pcie_mdio_set_phy(pc, device); | 74 | bcma_pcie_mdio_set_phy(pc, device); |
| 75 | v = (BCMA_CORE_PCI_MDIODATA_DEV_ADDR << | ||
| 76 | BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF); | ||
| 77 | v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF); | ||
| 78 | } else { | ||
| 79 | v = (device << BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD); | ||
| 80 | v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD); | ||
| 74 | } | 81 | } |
| 75 | 82 | ||
| 76 | v = (1 << 30); /* Start of Transaction */ | 83 | v = BCMA_CORE_PCI_MDIODATA_START; |
| 77 | v |= (1 << 29); /* Read Transaction */ | 84 | v |= BCMA_CORE_PCI_MDIODATA_READ; |
| 78 | v |= (1 << 17); /* Turnaround */ | 85 | v |= BCMA_CORE_PCI_MDIODATA_TA; |
| 79 | if (pc->core->id.rev < 10) | 86 | |
| 80 | v |= (u32)device << 22; | 87 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v); |
| 81 | v |= (u32)address << 18; | ||
| 82 | pcicore_write32(pc, mdio_data, v); | ||
| 83 | /* Wait for the device to complete the transaction */ | 88 | /* Wait for the device to complete the transaction */ |
| 84 | udelay(10); | 89 | udelay(10); |
| 85 | for (i = 0; i < max_retries; i++) { | 90 | for (i = 0; i < max_retries; i++) { |
| 86 | v = pcicore_read32(pc, mdio_control); | 91 | v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL); |
| 87 | if (v & 0x100 /* Trans complete */) { | 92 | if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE) { |
| 88 | udelay(10); | 93 | udelay(10); |
| 89 | ret = pcicore_read32(pc, mdio_data); | 94 | ret = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_DATA); |
| 90 | break; | 95 | break; |
| 91 | } | 96 | } |
| 92 | msleep(1); | 97 | msleep(1); |
| 93 | } | 98 | } |
| 94 | pcicore_write32(pc, mdio_control, 0); | 99 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0); |
| 95 | return ret; | 100 | return ret; |
| 96 | } | 101 | } |
| 97 | 102 | ||
| 98 | static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device, | 103 | static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device, |
| 99 | u8 address, u16 data) | 104 | u8 address, u16 data) |
| 100 | { | 105 | { |
| 101 | const u16 mdio_control = 0x128; | ||
| 102 | const u16 mdio_data = 0x12C; | ||
| 103 | int max_retries = 10; | 106 | int max_retries = 10; |
| 104 | u32 v; | 107 | u32 v; |
| 105 | int i; | 108 | int i; |
| 106 | 109 | ||
| 107 | v = 0x80; /* Enable Preamble Sequence */ | 110 | /* enable mdio access to SERDES */ |
| 108 | v |= 0x2; /* MDIO Clock Divisor */ | 111 | v = BCMA_CORE_PCI_MDIOCTL_PREAM_EN; |
| 109 | pcicore_write32(pc, mdio_control, v); | 112 | v |= BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL; |
| 113 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, v); | ||
| 110 | 114 | ||
| 111 | if (pc->core->id.rev >= 10) { | 115 | if (pc->core->id.rev >= 10) { |
| 112 | max_retries = 200; | 116 | max_retries = 200; |
| 113 | bcma_pcie_mdio_set_phy(pc, device); | 117 | bcma_pcie_mdio_set_phy(pc, device); |
| 118 | v = (BCMA_CORE_PCI_MDIODATA_DEV_ADDR << | ||
| 119 | BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF); | ||
| 120 | v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF); | ||
| 121 | } else { | ||
| 122 | v = (device << BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD); | ||
| 123 | v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD); | ||
| 114 | } | 124 | } |
| 115 | 125 | ||
| 116 | v = (1 << 30); /* Start of Transaction */ | 126 | v = BCMA_CORE_PCI_MDIODATA_START; |
| 117 | v |= (1 << 28); /* Write Transaction */ | 127 | v |= BCMA_CORE_PCI_MDIODATA_WRITE; |
| 118 | v |= (1 << 17); /* Turnaround */ | 128 | v |= BCMA_CORE_PCI_MDIODATA_TA; |
| 119 | if (pc->core->id.rev < 10) | ||
| 120 | v |= (u32)device << 22; | ||
| 121 | v |= (u32)address << 18; | ||
| 122 | v |= data; | 129 | v |= data; |
| 123 | pcicore_write32(pc, mdio_data, v); | 130 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v); |
| 124 | /* Wait for the device to complete the transaction */ | 131 | /* Wait for the device to complete the transaction */ |
| 125 | udelay(10); | 132 | udelay(10); |
| 126 | for (i = 0; i < max_retries; i++) { | 133 | for (i = 0; i < max_retries; i++) { |
| 127 | v = pcicore_read32(pc, mdio_control); | 134 | v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL); |
| 128 | if (v & 0x100 /* Trans complete */) | 135 | if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE) |
| 129 | break; | 136 | break; |
| 130 | msleep(1); | 137 | msleep(1); |
| 131 | } | 138 | } |
| 132 | pcicore_write32(pc, mdio_control, 0); | 139 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0); |
| 133 | } | 140 | } |
| 134 | 141 | ||
| 135 | /************************************************** | 142 | /************************************************** |
| @@ -138,72 +145,53 @@ static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device, · 2 unmodified lines | |||
| 138 | 145 | ||
| 139 | static u8 bcma_pcicore_polarity_workaround(struct bcma_drv_pci *pc) | 146 | static u8 bcma_pcicore_polarity_workaround(struct bcma_drv_pci *pc) |
| 140 | { | 147 | { |
| 141 | return (bcma_pcie_read(pc, 0x204) & 0x10) ? 0xC0 : 0x80; | 148 | u32 tmp; |
| 149 | |||
| 150 | tmp = bcma_pcie_read(pc, BCMA_CORE_PCI_PLP_STATUSREG); | ||
| 151 | if (tmp & BCMA_CORE_PCI_PLP_POLARITYINV_STAT) | ||
| 152 | return BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE | | ||
| 153 | BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY; | ||
| 154 | else | ||
| 155 | return BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE; | ||
| 142 | } | 156 | } |
| 143 | 157 | ||
| 144 | static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) | 158 | static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) |
| 145 | { | 159 | { |
| 146 | const u8 serdes_pll_device = 0x1D; | ||
| 147 | const u8 serdes_rx_device = 0x1F; | ||
| 148 | u16 tmp; | 160 | u16 tmp; |
| 149 | 161 | ||
| 150 | bcma_pcie_mdio_write(pc, serdes_rx_device, 1 /* Control */, | 162 | bcma_pcie_mdio_write(pc, BCMA_CORE_PCI_MDIODATA_DEV_RX, |
| 151 | bcma_pcicore_polarity_workaround(pc)); | 163 | BCMA_CORE_PCI_SERDES_RX_CTRL, |
| 152 | tmp = bcma_pcie_mdio_read(pc, serdes_pll_device, 1 /* Control */); | 164 | bcma_pcicore_polarity_workaround(pc)); |
| 153 | if (tmp & 0x4000) | 165 | tmp = bcma_pcie_mdio_read(pc, BCMA_CORE_PCI_MDIODATA_DEV_PLL, |
| 154 | bcma_pcie_mdio_write(pc, serdes_pll_device, 1, tmp & ~0x4000); | 166 | BCMA_CORE_PCI_SERDES_PLL_CTRL); |
| 167 | if (tmp & BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN) | ||
| 168 | bcma_pcie_mdio_write(pc, BCMA_CORE_PCI_MDIODATA_DEV_PLL, | ||
| 169 | BCMA_CORE_PCI_SERDES_PLL_CTRL, | ||
| 170 | tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); | ||
| 155 | } | 171 | } |
| 156 | 172 | ||
| 157 | /************************************************** | 173 | /************************************************** |
| 158 | * Init. | 174 | * Init. |
| 159 | **************************************************/ | 175 | **************************************************/ |
| 160 | 176 | ||
| 161 | static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) | 177 | static void __devinit bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) |
| 162 | { | 178 | { |
| 163 | bcma_pcicore_serdes_workaround(pc); | 179 | bcma_pcicore_serdes_workaround(pc); |
| 164 | } | 180 | } |
| 165 | 181 | ||
| 166 | static bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) | 182 | void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc) |
| 167 | { | ||
| 168 | struct bcma_bus *bus = pc->core->bus; | ||
| 169 | u16 chipid_top; | ||
| 170 | |||
| 171 | chipid_top = (bus->chipinfo.id & 0xFF00); | ||
| 172 | if (chipid_top != 0x4700 && | ||
| 173 | chipid_top != 0x5300) | ||
| 174 | return false; | ||
| 175 | |||
| 176 | #ifdef CONFIG_SSB_DRIVER_PCICORE | ||
| 177 | if (bus->sprom.boardflags_lo & SSB_BFL_NOPCI) | ||
| 178 | return false; | ||
| 179 | #endif /* CONFIG_SSB_DRIVER_PCICORE */ | ||
| 180 | |||
| 181 | #if 0 | ||
| 182 | /* TODO: on BCMA we use address from EROM instead of magic formula */ | ||
| 183 | u32 tmp; | ||
| 184 | return !mips_busprobe32(tmp, (bus->mmio + | ||
| 185 | (pc->core->core_index * BCMA_CORE_SIZE))); | ||
| 186 | #endif | ||
| 187 | |||
| 188 | return true; | ||
| 189 | } | ||
| 190 | |||
| 191 | void bcma_core_pci_init(struct bcma_drv_pci *pc) | ||
| 192 | { | 183 | { |
| 193 | if (pc->setup_done) | 184 | if (pc->setup_done) |
| 194 | return; | 185 | return; |
| 195 | 186 | ||
| 196 | if (bcma_core_pci_is_in_hostmode(pc)) { | ||
| 197 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | 187 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE |
| 188 | pc->hostmode = bcma_core_pci_is_in_hostmode(pc); | ||
| 189 | if (pc->hostmode) | ||
| 198 | bcma_core_pci_hostmode_init(pc); | 190 | bcma_core_pci_hostmode_init(pc); |
| 199 | #else | ||
| 200 | pr_err("Driver compiled without support for hostmode PCI\n"); | ||
| 201 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ | 191 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ |
| 202 | } else { | ||
| 203 | bcma_core_pci_clientmode_init(pc); | ||
| 204 | } | ||
| 205 | 192 | ||
| 206 | pc->setup_done = true; | 193 | if (!pc->hostmode) |
| 194 | bcma_core_pci_clientmode_init(pc); | ||
| 207 | } | 195 | } |
| 208 | 196 | ||
| 209 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, | 197 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, |
| @@ -2,13 +2,587 @@ · 1 unmodified line | |||
| 2 | * Broadcom specific AMBA | 2 | * Broadcom specific AMBA |
| 3 | * PCI Core in hostmode | 3 | * PCI Core in hostmode |
| 4 | * | 4 | * |
| 5 | * Copyright 2005 - 2011, Broadcom Corporation | ||
| 6 | * Copyright 2006, 2007, Michael Buesch <m@bues.ch> | ||
| 7 | * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de> | ||
| 8 | * | ||
| 5 | * Licensed under the GNU/GPL. See COPYING for details. | 9 | * Licensed under the GNU/GPL. See COPYING for details. |
| 6 | */ | 10 | */ |
| 7 | 11 | ||
| 8 | #include "bcma_private.h" | 12 | #include "bcma_private.h" |
| 13 | #include <linux/export.h> | ||
| 9 | #include <linux/bcma/bcma.h> | 14 | #include <linux/bcma/bcma.h> |
| 15 | #include <asm/paccess.h> | ||
| 16 | |||
| 17 | /* Probe a 32bit value on the bus and catch bus exceptions. | ||
| 18 | * Returns nonzero on a bus exception. | ||
| 19 | * This is MIPS specific */ | ||
| 20 | #define mips_busprobe32(val, addr) get_dbe((val), ((u32 *)(addr))) | ||
| 21 | |||
| 22 | /* Assume one-hot slot wiring */ | ||
| 23 | #define BCMA_PCI_SLOT_MAX 16 | ||
| 24 | #define PCI_CONFIG_SPACE_SIZE 256 | ||
| 25 | |||
| 26 | bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) | ||
| 27 | { | ||
| 28 | struct bcma_bus *bus = pc->core->bus; | ||
| 29 | u16 chipid_top; | ||
| 30 | u32 tmp; | ||
| 31 | |||
| 32 | chipid_top = (bus->chipinfo.id & 0xFF00); | ||
| 33 | if (chipid_top != 0x4700 && | ||
| 34 | chipid_top != 0x5300) | ||
| 35 | return false; | ||
| 36 | |||
| 37 | if (bus->sprom.boardflags_lo & BCMA_CORE_PCI_BFL_NOPCI) { | ||
| 38 | pr_info("This PCI core is disabled and not working\n"); | ||
| 39 | return false; | ||
| 40 | } | ||
| 41 | |||
| 42 | bcma_core_enable(pc->core, 0); | ||
| 43 | |||
| 44 | return !mips_busprobe32(tmp, pc->core->io_addr); | ||
| 45 | } | ||
| 46 | |||
| 47 | static u32 bcma_pcie_read_config(struct bcma_drv_pci *pc, u32 address) | ||
| 48 | { | ||
| 49 | pcicore_write32(pc, BCMA_CORE_PCI_CONFIG_ADDR, address); | ||
| 50 | pcicore_read32(pc, BCMA_CORE_PCI_CONFIG_ADDR); | ||
| 51 | return pcicore_read32(pc, BCMA_CORE_PCI_CONFIG_DATA); | ||
| 52 | } | ||
| 53 | |||
| 54 | static void bcma_pcie_write_config(struct bcma_drv_pci *pc, u32 address, | ||
| 55 | u32 data) | ||
| 56 | { | ||
| 57 | pcicore_write32(pc, BCMA_CORE_PCI_CONFIG_ADDR, address); | ||
| 58 | pcicore_read32(pc, BCMA_CORE_PCI_CONFIG_ADDR); | ||
| 59 | pcicore_write32(pc, BCMA_CORE_PCI_CONFIG_DATA, data); | ||
| 60 | } | ||
| 61 | |||
| 62 | static u32 bcma_get_cfgspace_addr(struct bcma_drv_pci *pc, unsigned int dev, | ||
| 63 | unsigned int func, unsigned int off) | ||
| 64 | { | ||
| 65 | u32 addr = 0; | ||
| 66 | |||
| 67 | /* Issue config commands only when the data link is up (atleast | ||
| 68 | * one external pcie device is present). | ||
| 69 | */ | ||
| 70 | if (dev >= 2 || !(bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_LSREG) | ||
| 71 | & BCMA_CORE_PCI_DLLP_LSREG_LINKUP)) | ||
| 72 | goto out; | ||
| 73 | |||
| 74 | /* Type 0 transaction */ | ||
| 75 | /* Slide the PCI window to the appropriate slot */ | ||
| 76 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI1, BCMA_CORE_PCI_SBTOPCI_CFG0); | ||
| 77 | /* Calculate the address */ | ||
| 78 | addr = pc->host_controller->host_cfg_addr; | ||
| 79 | addr |= (dev << BCMA_CORE_PCI_CFG_SLOT_SHIFT); | ||
| 80 | addr |= (func << BCMA_CORE_PCI_CFG_FUN_SHIFT); | ||
| 81 | addr |= (off & ~3); | ||
| 82 | |||
| 83 | out: | ||
| 84 | return addr; | ||
| 85 | } | ||
| 10 | 86 | ||
| 11 | void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) | 87 | static int bcma_extpci_read_config(struct bcma_drv_pci *pc, unsigned int dev, |
| 88 | unsigned int func, unsigned int off, | ||
| 89 | void *buf, int len) | ||
| 12 | { | 90 | { |
| 13 | pr_err("No support for PCI core in hostmode yet\n"); | 91 | int err = -EINVAL; |
| 92 | u32 addr, val; | ||
| 93 | void __iomem *mmio = 0; | ||
| 94 | |||
| 95 | WARN_ON(!pc->hostmode); | ||
| 96 | if (unlikely(len != 1 && len != 2 && len != 4)) | ||
| 97 | goto out; | ||
| 98 | if (dev == 0) { | ||
| 99 | /* we support only two functions on device 0 */ | ||
| 100 | if (func > 1) | ||
| 101 | return -EINVAL; | ||
| 102 | |||
| 103 | /* accesses to config registers with offsets >= 256 | ||
| 104 | * requires indirect access. | ||
| 105 | */ | ||
| 106 | if (off >= PCI_CONFIG_SPACE_SIZE) { | ||
| 107 | addr = (func << 12); | ||
| 108 | addr |= (off & 0x0FFF); | ||
| 109 | val = bcma_pcie_read_config(pc, addr); | ||
| 110 | } else { | ||
| 111 | addr = BCMA_CORE_PCI_PCICFG0; | ||
| 112 | addr |= (func << 8); | ||
| 113 | addr |= (off & 0xfc); | ||
| 114 | val = pcicore_read32(pc, addr); | ||
| 115 | } | ||
| 116 | } else { | ||
| 117 | addr = bcma_get_cfgspace_addr(pc, dev, func, off); | ||
| 118 | if (unlikely(!addr)) | ||
| 119 | goto out; | ||
| 120 | err = -ENOMEM; | ||
| 121 | mmio = ioremap_nocache(addr, len); | ||
| 122 | if (!mmio) | ||
| 123 | goto out; | ||
| 124 | |||
| 125 | if (mips_busprobe32(val, mmio)) { | ||
| 126 | val = 0xffffffff; | ||
| 127 | goto unmap; | ||
| 128 | } | ||
| 129 | |||
| 130 | val = readl(mmio); | ||
| 131 | } | ||
| 132 | val >>= (8 * (off & 3)); | ||
| 133 | |||
| 134 | switch (len) { | ||
| 135 | case 1: | ||
| 136 | *((u8 *)buf) = (u8)val; | ||
| 137 | break; | ||
| 138 | case 2: | ||
| 139 | *((u16 *)buf) = (u16)val; | ||
| 140 | break; | ||
| 141 | case 4: | ||
| 142 | *((u32 *)buf) = (u32)val; | ||
| 143 | break; | ||
| 144 | } | ||
| 145 | err = 0; | ||
| 146 | unmap: | ||
| 147 | if (mmio) | ||
| 148 | iounmap(mmio); | ||
| 149 | out: | ||
| 150 | return err; | ||
| 151 | } | ||
| 152 | |||
| 153 | static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev, | ||
| 154 | unsigned int func, unsigned int off, | ||
| 155 | const void *buf, int len) | ||
| 156 | { | ||
| 157 | int err = -EINVAL; | ||
| 158 | u32 addr = 0, val = 0; | ||
| 159 | void __iomem *mmio = 0; | ||
| 160 | u16 chipid = pc->core->bus->chipinfo.id; | ||
| 161 | |||
| 162 | WARN_ON(!pc->hostmode); | ||
| 163 | if (unlikely(len != 1 && len != 2 && len != 4)) | ||
| 164 | goto out; | ||
| 165 | if (dev == 0) { | ||
| 166 | /* accesses to config registers with offsets >= 256 | ||
| 167 | * requires indirect access. | ||
| 168 | */ | ||
| 169 | if (off < PCI_CONFIG_SPACE_SIZE) { | ||
| 170 | addr = pc->core->addr + BCMA_CORE_PCI_PCICFG0; | ||
| 171 | addr |= (func << 8); | ||
| 172 | addr |= (off & 0xfc); | ||
| 173 | mmio = ioremap_nocache(addr, len); | ||
| 174 | if (!mmio) | ||
| 175 | goto out; | ||
| 176 | } | ||
| 177 | } else { | ||
| 178 | addr = bcma_get_cfgspace_addr(pc, dev, func, off); | ||
| 179 | if (unlikely(!addr)) | ||
| 180 | goto out; | ||
| 181 | err = -ENOMEM; | ||
| 182 | mmio = ioremap_nocache(addr, len); | ||
| 183 | if (!mmio) | ||
| 184 | goto out; | ||
| 185 | |||
| 186 | if (mips_busprobe32(val, mmio)) { | ||
| 187 | val = 0xffffffff; | ||
| 188 | goto unmap; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | switch (len) { | ||
| 193 | case 1: | ||
| 194 | val = readl(mmio); | ||
| 195 | val &= ~(0xFF << (8 * (off & 3))); | ||
| 196 | val |= *((const u8 *)buf) << (8 * (off & 3)); | ||
| 197 | break; | ||
| 198 | case 2: | ||
| 199 | val = readl(mmio); | ||
| 200 | val &= ~(0xFFFF << (8 * (off & 3))); | ||
| 201 | val |= *((const u16 *)buf) << (8 * (off & 3)); | ||
| 202 | break; | ||
| 203 | case 4: | ||
| 204 | val = *((const u32 *)buf); | ||
| 205 | break; | ||
| 206 | } | ||
| 207 | if (dev == 0 && !addr) { | ||
| 208 | /* accesses to config registers with offsets >= 256 | ||
| 209 | * requires indirect access. | ||
| 210 | */ | ||
| 211 | addr = (func << 12); | ||
| 212 | addr |= (off & 0x0FFF); | ||
| 213 | bcma_pcie_write_config(pc, addr, val); | ||
| 214 | } else { | ||
| 215 | writel(val, mmio); | ||
| 216 | |||
| 217 | if (chipid == 0x4716 || chipid == 0x4748) | ||
| 218 | readl(mmio); | ||
| 219 | } | ||
| 220 | |||
| 221 | err = 0; | ||
| 222 | unmap: | ||
| 223 | if (mmio) | ||
| 224 | iounmap(mmio); | ||
| 225 | out: | ||
| 226 | return err; | ||
| 227 | } | ||
| 228 | |||
| 229 | static int bcma_core_pci_hostmode_read_config(struct pci_bus *bus, | ||
| 230 | unsigned int devfn, | ||
| 231 | int reg, int size, u32 *val) | ||
| 232 | { | ||
| 233 | unsigned long flags; | ||
| 234 | int err; | ||
| 235 | struct bcma_drv_pci *pc; | ||
| 236 | struct bcma_drv_pci_host *pc_host; | ||
| 237 | |||
| 238 | pc_host = container_of(bus->ops, struct bcma_drv_pci_host, pci_ops); | ||
| 239 | pc = pc_host->pdev; | ||
| 240 | |||
| 241 | spin_lock_irqsave(&pc_host->cfgspace_lock, flags); | ||
| 242 | err = bcma_extpci_read_config(pc, PCI_SLOT(devfn), | ||
| 243 | PCI_FUNC(devfn), reg, val, size); | ||
| 244 | spin_unlock_irqrestore(&pc_host->cfgspace_lock, flags); | ||
| 245 | |||
| 246 | return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; | ||
| 247 | } | ||
| 248 | |||
| 249 | static int bcma_core_pci_hostmode_write_config(struct pci_bus *bus, | ||
| 250 | unsigned int devfn, | ||
| 251 | int reg, int size, u32 val) | ||
| 252 | { | ||
| 253 | unsigned long flags; | ||
| 254 | int err; | ||
| 255 | struct bcma_drv_pci *pc; | ||
| 256 | struct bcma_drv_pci_host *pc_host; | ||
| 257 | |||
| 258 | pc_host = container_of(bus->ops, struct bcma_drv_pci_host, pci_ops); | ||
| 259 | pc = pc_host->pdev; | ||
| 260 | |||
| 261 | spin_lock_irqsave(&pc_host->cfgspace_lock, flags); | ||
| 262 | err = bcma_extpci_write_config(pc, PCI_SLOT(devfn), | ||
| 263 | PCI_FUNC(devfn), reg, &val, size); | ||
| 264 | spin_unlock_irqrestore(&pc_host->cfgspace_lock, flags); | ||
| 265 | |||
| 266 | return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; | ||
| 267 | } | ||
| 268 | |||
| 269 | /* return cap_offset if requested capability exists in the PCI config space */ | ||
| 270 | static u8 __devinit bcma_find_pci_capability(struct bcma_drv_pci *pc, | ||
| 271 | unsigned int dev, | ||
| 272 | unsigned int func, u8 req_cap_id, | ||
| 273 | unsigned char *buf, u32 *buflen) | ||
| 274 | { | ||
| 275 | u8 cap_id; | ||
| 276 | u8 cap_ptr = 0; | ||
| 277 | u32 bufsize; | ||
| 278 | u8 byte_val; | ||
| 279 | |||
| 280 | /* check for Header type 0 */ | ||
| 281 | bcma_extpci_read_config(pc, dev, func, PCI_HEADER_TYPE, &byte_val, | ||
| 282 | sizeof(u8)); | ||
| 283 | if ((byte_val & 0x7f) != PCI_HEADER_TYPE_NORMAL) | ||
| 284 | return cap_ptr; | ||
| 285 | |||
| 286 | /* check if the capability pointer field exists */ | ||
| 287 | bcma_extpci_read_config(pc, dev, func, PCI_STATUS, &byte_val, | ||
| 288 | sizeof(u8)); | ||
| 289 | if (!(byte_val & PCI_STATUS_CAP_LIST)) | ||
| 290 | return cap_ptr; | ||
| 291 | |||
| 292 | /* check if the capability pointer is 0x00 */ | ||
| 293 | bcma_extpci_read_config(pc, dev, func, PCI_CAPABILITY_LIST, &cap_ptr, | ||
| 294 | sizeof(u8)); | ||
| 295 | if (cap_ptr == 0x00) | ||
| 296 | return cap_ptr; | ||
| 297 | |||
| 298 | /* loop thr'u the capability list and see if the requested capabilty | ||
| 299 | * exists */ | ||
| 300 | bcma_extpci_read_config(pc, dev, func, cap_ptr, &cap_id, sizeof(u8)); | ||
| 301 | while (cap_id != req_cap_id) { | ||
| 302 | bcma_extpci_read_config(pc, dev, func, cap_ptr + 1, &cap_ptr, | ||
| 303 | sizeof(u8)); | ||
| 304 | if (cap_ptr == 0x00) | ||
| 305 | return cap_ptr; | ||
| 306 | bcma_extpci_read_config(pc, dev, func, cap_ptr, &cap_id, | ||
| 307 | sizeof(u8)); | ||
| 308 | } | ||
| 309 | |||
| 310 | /* found the caller requested capability */ | ||
| 311 | if ((buf != NULL) && (buflen != NULL)) { | ||
| 312 | u8 cap_data; | ||
| 313 | |||
| 314 | bufsize = *buflen; | ||
| 315 | if (!bufsize) | ||
| 316 | return cap_ptr; | ||
| 317 | |||
| 318 | *buflen = 0; | ||
| 319 | |||
| 320 | /* copy the cpability data excluding cap ID and next ptr */ | ||
| 321 | cap_data = cap_ptr + 2; | ||
| 322 | if ((bufsize + cap_data) > PCI_CONFIG_SPACE_SIZE) | ||
| 323 | bufsize = PCI_CONFIG_SPACE_SIZE - cap_data; | ||
| 324 | *buflen = bufsize; | ||
| 325 | while (bufsize--) { | ||
| 326 | bcma_extpci_read_config(pc, dev, func, cap_data, buf, | ||
| 327 | sizeof(u8)); | ||
| 328 | cap_data++; | ||
| 329 | buf++; | ||
| 330 | } | ||
| 331 | } | ||
| 332 | |||
| 333 | return cap_ptr; | ||
| 334 | } | ||
| 335 | |||
| 336 | /* If the root port is capable of returning Config Request | ||
| 337 | * Retry Status (CRS) Completion Status to software then | ||
| 338 | * enable the feature. | ||
| 339 | */ | ||
| 340 | static void __devinit bcma_core_pci_enable_crs(struct bcma_drv_pci *pc) | ||
| 341 | { | ||
| 342 | u8 cap_ptr, root_ctrl, root_cap, dev; | ||
| 343 | u16 val16; | ||
| 344 | int i; | ||
| 345 | |||
| 346 | cap_ptr = bcma_find_pci_capability(pc, 0, 0, PCI_CAP_ID_EXP, NULL, | ||
| 347 | NULL); | ||
| 348 | root_cap = cap_ptr + PCI_EXP_RTCAP; | ||
| 349 | bcma_extpci_read_config(pc, 0, 0, root_cap, &val16, sizeof(u16)); | ||
| 350 | if (val16 & BCMA_CORE_PCI_RC_CRS_VISIBILITY) { | ||
| 351 | /* Enable CRS software visibility */ | ||
| 352 | root_ctrl = cap_ptr + PCI_EXP_RTCTL; | ||
| 353 | val16 = PCI_EXP_RTCTL_CRSSVE; | ||
| 354 | bcma_extpci_read_config(pc, 0, 0, root_ctrl, &val16, | ||
| 355 | sizeof(u16)); | ||
| 356 | |||
| 357 | /* Initiate a configuration request to read the vendor id | ||
| 358 | * field of the device function's config space header after | ||
| 359 | * 100 ms wait time from the end of Reset. If the device is | ||
| 360 | * not done with its internal initialization, it must at | ||
| 361 | * least return a completion TLP, with a completion status | ||
| 362 | * of "Configuration Request Retry Status (CRS)". The root | ||
| 363 | * complex must complete the request to the host by returning | ||
| 364 | * a read-data value of 0001h for the Vendor ID field and | ||
| 365 | * all 1s for any additional bytes included in the request. | ||
| 366 | * Poll using the config reads for max wait time of 1 sec or | ||
| 367 | * until we receive the successful completion status. Repeat | ||
| 368 | * the procedure for all the devices. | ||
| 369 | */ | ||
| 370 | for (dev = 1; dev < BCMA_PCI_SLOT_MAX; dev++) { | ||
| 371 | for (i = 0; i < 100000; i++) { | ||
| 372 | bcma_extpci_read_config(pc, dev, 0, | ||
| 373 | PCI_VENDOR_ID, &val16, | ||
| 374 | sizeof(val16)); | ||
| 375 | if (val16 != 0x1) | ||
| 376 | break; | ||
| 377 | udelay(10); | ||
| 378 | } | ||
| 379 | if (val16 == 0x1) | ||
| 380 | pr_err("PCI: Broken device in slot %d\n", dev); | ||
| 381 | } | ||
| 382 | } | ||
| 383 | } | ||
| 384 | |||
| 385 | void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) | ||
| 386 | { | ||
| 387 | struct bcma_bus *bus = pc->core->bus; | ||
| 388 | struct bcma_drv_pci_host *pc_host; | ||
| 389 | u32 tmp; | ||
| 390 | u32 pci_membase_1G; | ||
| 391 | unsigned long io_map_base; | ||
| 392 | |||
| 393 | pr_info("PCIEcore in host mode found\n"); | ||
| 394 | |||
| 395 | pc_host = kzalloc(sizeof(*pc_host), GFP_KERNEL); | ||
| 396 | if (!pc_host) { | ||
| 397 | pr_err("can not allocate memory"); | ||
| 398 | return; | ||
| 399 | } | ||
| 400 | |||
| 401 | pc->host_controller = pc_host; | ||
| 402 | pc_host->pci_controller.io_resource = &pc_host->io_resource; | ||
| 403 | pc_host->pci_controller.mem_resource = &pc_host->mem_resource; | ||
| 404 | pc_host->pci_controller.pci_ops = &pc_host->pci_ops; | ||
| 405 | pc_host->pdev = pc; | ||
| 406 | |||
| 407 | pci_membase_1G = BCMA_SOC_PCI_DMA; | ||
| 408 | pc_host->host_cfg_addr = BCMA_SOC_PCI_CFG; | ||
| 409 | |||
| 410 | pc_host->pci_ops.read = bcma_core_pci_hostmode_read_config; | ||
| 411 | pc_host->pci_ops.write = bcma_core_pci_hostmode_write_config; | ||
| 412 | |||
| 413 | pc_host->mem_resource.name = "BCMA PCIcore external memory", | ||
| 414 | pc_host->mem_resource.start = BCMA_SOC_PCI_DMA; | ||
| 415 | pc_host->mem_resource.end = BCMA_SOC_PCI_DMA + BCMA_SOC_PCI_DMA_SZ - 1; | ||
| 416 | pc_host->mem_resource.flags = IORESOURCE_MEM | IORESOURCE_PCI_FIXED; | ||
| 417 | |||
| 418 | pc_host->io_resource.name = "BCMA PCIcore external I/O", | ||
| 419 | pc_host->io_resource.start = 0x100; | ||
| 420 | pc_host->io_resource.end = 0x7FF; | ||
| 421 | pc_host->io_resource.flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED; | ||
| 422 | |||
| 423 | /* Reset RC */ | ||
| 424 | udelay(3000); | ||
| 425 | pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST_OE); | ||
| 426 | udelay(1000); | ||
| 427 | pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST | | ||
| 428 | BCMA_CORE_PCI_CTL_RST_OE); | ||
| 429 | |||
| 430 | /* 64 MB I/O access window. On 4716, use | ||
| 431 | * sbtopcie0 to access the device registers. We | ||
| 432 | * can't use address match 2 (1 GB window) region | ||
| 433 | * as mips can't generate 64-bit address on the | ||
| 434 | * backplane. | ||
| 435 | */ | ||
| 436 | if (bus->chipinfo.id == 0x4716 || bus->chipinfo.id == 0x4748) { | ||
| 437 | pc_host->mem_resource.start = BCMA_SOC_PCI_MEM; | ||
| 438 | pc_host->mem_resource.end = BCMA_SOC_PCI_MEM + | ||
| 439 | BCMA_SOC_PCI_MEM_SZ - 1; | ||
| 440 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, | ||
| 441 | BCMA_CORE_PCI_SBTOPCI_MEM | BCMA_SOC_PCI_MEM); | ||
| 442 | } else if (bus->chipinfo.id == 0x5300) { | ||
| 443 | tmp = BCMA_CORE_PCI_SBTOPCI_MEM; | ||
| 444 | tmp |= BCMA_CORE_PCI_SBTOPCI_PREF; | ||
| 445 | tmp |= BCMA_CORE_PCI_SBTOPCI_BURST; | ||
| 446 | if (pc->core->core_unit == 0) { | ||
| 447 | pc_host->mem_resource.start = BCMA_SOC_PCI_MEM; | ||
| 448 | pc_host->mem_resource.end = BCMA_SOC_PCI_MEM + | ||
| 449 | BCMA_SOC_PCI_MEM_SZ - 1; | ||
| 450 | pci_membase_1G = BCMA_SOC_PCIE_DMA_H32; | ||
| 451 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, | ||
| 452 | tmp | BCMA_SOC_PCI_MEM); | ||
| 453 | } else if (pc->core->core_unit == 1) { | ||
| 454 | pc_host->mem_resource.start = BCMA_SOC_PCI1_MEM; | ||
| 455 | pc_host->mem_resource.end = BCMA_SOC_PCI1_MEM + | ||
| 456 | BCMA_SOC_PCI_MEM_SZ - 1; | ||
| 457 | pci_membase_1G = BCMA_SOC_PCIE1_DMA_H32; | ||
| 458 | pc_host->host_cfg_addr = BCMA_SOC_PCI1_CFG; | ||
| 459 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, | ||
| 460 | tmp | BCMA_SOC_PCI1_MEM); | ||
| 461 | } | ||
| 462 | } else | ||
| 463 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, | ||
| 464 | BCMA_CORE_PCI_SBTOPCI_IO); | ||
| 465 | |||
| 466 | /* 64 MB configuration access window */ | ||
| 467 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI1, BCMA_CORE_PCI_SBTOPCI_CFG0); | ||
| 468 | |||
| 469 | /* 1 GB memory access window */ | ||
| 470 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI2, | ||
| 471 | BCMA_CORE_PCI_SBTOPCI_MEM | pci_membase_1G); | ||
| 472 | |||
| 473 | |||
| 474 | /* As per PCI Express Base Spec 1.1 we need to wait for | ||
| 475 | * at least 100 ms from the end of a reset (cold/warm/hot) | ||
| 476 | * before issuing configuration requests to PCI Express | ||
| 477 | * devices. | ||
| 478 | */ | ||
| 479 | udelay(100000); | ||
| 480 | |||
| 481 | bcma_core_pci_enable_crs(pc); | ||
| 482 | |||
| 483 | /* Enable PCI bridge BAR0 memory & master access */ | ||
| 484 | tmp = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; | ||
| 485 | bcma_extpci_write_config(pc, 0, 0, PCI_COMMAND, &tmp, sizeof(tmp)); | ||
| 486 | |||
| 487 | /* Enable PCI interrupts */ | ||
| 488 | pcicore_write32(pc, BCMA_CORE_PCI_IMASK, BCMA_CORE_PCI_IMASK_INTA); | ||
| 489 | |||
| 490 | /* Ok, ready to run, register it to the system. | ||
| 491 | * The following needs change, if we want to port hostmode | ||
| 492 | * to non-MIPS platform. */ | ||
| 493 | io_map_base = (unsigned long)ioremap_nocache(BCMA_SOC_PCI_MEM, | ||
| 494 | 0x04000000); | ||
| 495 | pc_host->pci_controller.io_map_base = io_map_base; | ||
| 496 | set_io_port_base(pc_host->pci_controller.io_map_base); | ||
| 497 | /* Give some time to the PCI controller to configure itself with the new | ||
| 498 | * values. Not waiting at this point causes crashes of the machine. */ | ||
| 499 | mdelay(10); | ||
| 500 | register_pci_controller(&pc_host->pci_controller); | ||
| 501 | return; | ||
| 502 | } | ||
| 503 | |||
| 504 | /* Early PCI fixup for a device on the PCI-core bridge. */ | ||
| 505 | static void bcma_core_pci_fixup_pcibridge(struct pci_dev *dev) | ||
| 506 | { | ||
| 507 | if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { | ||
| 508 | /* This is not a device on the PCI-core bridge. */ | ||
| 509 | return; | ||
| 510 | } | ||
| 511 | if (PCI_SLOT(dev->devfn) != 0) | ||
| 512 | return; | ||
| 513 | |||
| 514 | pr_info("PCI: Fixing up bridge %s\n", pci_name(dev)); | ||
| 515 | |||
| 516 | /* Enable PCI bridge bus mastering and memory space */ | ||
| 517 | pci_set_master(dev); | ||
| 518 | if (pcibios_enable_device(dev, ~0) < 0) { | ||
| 519 | pr_err("PCI: BCMA bridge enable failed\n"); | ||
| 520 | return; | ||
| 521 | } | ||
| 522 | |||
| 523 | /* Enable PCI bridge BAR1 prefetch and burst */ | ||
| 524 | pci_write_config_dword(dev, BCMA_PCI_BAR1_CONTROL, 3); | ||
| 525 | } | ||
| 526 | DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, bcma_core_pci_fixup_pcibridge); | ||
| 527 | |||
| 528 | /* Early PCI fixup for all PCI-cores to set the correct memory address. */ | ||
| 529 | static void bcma_core_pci_fixup_addresses(struct pci_dev *dev) | ||
| 530 | { | ||
| 531 | struct resource *res; | ||
| 532 | int pos; | ||
| 533 | |||
| 534 | if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { | ||
| 535 | /* This is not a device on the PCI-core bridge. */ | ||
| 536 | return; | ||
| 537 | } | ||
| 538 | if (PCI_SLOT(dev->devfn) == 0) | ||
| 539 | return; | ||
| 540 | |||
| 541 | pr_info("PCI: Fixing up addresses %s\n", pci_name(dev)); | ||
| 542 | |||
| 543 | for (pos = 0; pos < 6; pos++) { | ||
| 544 | res = &dev->resource[pos]; | ||
| 545 | if (res->flags & (IORESOURCE_IO | IORESOURCE_MEM)) | ||
| 546 | pci_assign_resource(dev, pos); | ||
| 547 | } | ||
| 548 | } | ||
| 549 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, bcma_core_pci_fixup_addresses); | ||
| 550 | |||
| 551 | /* This function is called when doing a pci_enable_device(). | ||
| 552 | * We must first check if the device is a device on the PCI-core bridge. */ | ||
| 553 | int bcma_core_pci_plat_dev_init(struct pci_dev *dev) | ||
| 554 | { | ||
| 555 | struct bcma_drv_pci_host *pc_host; | ||
| 556 | |||
| 557 | if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { | ||
| 558 | /* This is not a device on the PCI-core bridge. */ | ||
| 559 | return -ENODEV; | ||
| 560 | } | ||
| 561 | pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host, | ||
| 562 | pci_ops); | ||
| 563 | |||
| 564 | pr_info("PCI: Fixing up device %s\n", pci_name(dev)); | ||
| 565 | |||
| 566 | /* Fix up interrupt lines */ | ||
| 567 | dev->irq = bcma_core_mips_irq(pc_host->pdev->core) + 2; | ||
| 568 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | ||
| 569 | |||
| 570 | return 0; | ||
| 571 | } | ||
| 572 | EXPORT_SYMBOL(bcma_core_pci_plat_dev_init); | ||
| 573 | |||
| 574 | /* PCI device IRQ mapping. */ | ||
| 575 | int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev) | ||
| 576 | { | ||
| 577 | struct bcma_drv_pci_host *pc_host; | ||
| 578 | |||
| 579 | if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { | ||
| 580 | /* This is not a device on the PCI-core bridge. */ | ||
| 581 | return -ENODEV; | ||
| 582 | } | ||
| 583 | |||
| 584 | pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host, | ||
| 585 | pci_ops); | ||
| 586 | return bcma_core_mips_irq(pc_host->pdev->core) + 2; | ||
| 14 | } | 587 | } |
| 588 | EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq); | ||
| @@ -154,8 +154,8 @@ const struct bcma_host_ops bcma_host_pci_ops = { · 153 unmodified lines | |||
| 154 | .awrite32 = bcma_host_pci_awrite32, | 154 | .awrite32 = bcma_host_pci_awrite32, |
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | static int bcma_host_pci_probe(struct pci_dev *dev, | 157 | static int __devinit bcma_host_pci_probe(struct pci_dev *dev, |
| 158 | const struct pci_device_id *id) | 158 | const struct pci_device_id *id) |
| 159 | { | 159 | { |
| 160 | struct bcma_bus *bus; | 160 | struct bcma_bus *bus; |
| 161 | int err = -ENOMEM; | 161 | int err = -ENOMEM; |
| @@ -13,6 +13,12 @@ · 12 unmodified lines | |||
| 13 | MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); | 13 | MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); |
| 14 | MODULE_LICENSE("GPL"); | 14 | MODULE_LICENSE("GPL"); |
| 15 | 15 | ||
| 16 | /* contains the number the next bus should get. */ | ||
| 17 | static unsigned int bcma_bus_next_num = 0; | ||
| 18 | |||
| 19 | /* bcma_buses_mutex locks the bcma_bus_next_num */ | ||
| 20 | static DEFINE_MUTEX(bcma_buses_mutex); | ||
| 21 | |||
| 16 | static int bcma_bus_match(struct device *dev, struct device_driver *drv); | 22 | static int bcma_bus_match(struct device *dev, struct device_driver *drv); |
| 17 | static int bcma_device_probe(struct device *dev); | 23 | static int bcma_device_probe(struct device *dev); |
| 18 | static int bcma_device_remove(struct device *dev); | 24 | static int bcma_device_remove(struct device *dev); |
| @@ -55,7 +61,7 @@ static struct bus_type bcma_bus_type = { · 36 unmodified lines | |||
| 55 | .dev_attrs = bcma_device_attrs, | 61 | .dev_attrs = bcma_device_attrs, |
| 56 | }; | 62 | }; |
| 57 | 63 | ||
| 58 | static struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid) | 64 | struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid) |
| 59 | { | 65 | { |
| 60 | struct bcma_device *core; | 66 | struct bcma_device *core; |
| 61 | 67 | ||
| @@ -65,6 +71,7 @@ static struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid) · 3 unmodified lines | |||
| 65 | } | 71 | } |
| 66 | return NULL; | 72 | return NULL; |
| 67 | } | 73 | } |
| 74 | EXPORT_SYMBOL_GPL(bcma_find_core); | ||
| 68 | 75 | ||
| 69 | static void bcma_release_core_dev(struct device *dev) | 76 | static void bcma_release_core_dev(struct device *dev) |
| 70 | { | 77 | { |
| @@ -93,7 +100,7 @@ static int bcma_register_cores(struct bcma_bus *bus) · 22 unmodified lines | |||
| 93 | 100 | ||
| 94 | core->dev.release = bcma_release_core_dev; | 101 | core->dev.release = bcma_release_core_dev; |
| 95 | core->dev.bus = &bcma_bus_type; | 102 | core->dev.bus = &bcma_bus_type; |
| 96 | dev_set_name(&core->dev, "bcma%d:%d", 0/*bus->num*/, dev_id); | 103 | dev_set_name(&core->dev, "bcma%d:%d", bus->num, dev_id); |
| 97 | 104 | ||
| 98 | switch (bus->hosttype) { | 105 | switch (bus->hosttype) { |
| 99 | case BCMA_HOSTTYPE_PCI: | 106 | case BCMA_HOSTTYPE_PCI: |
| @@ -132,11 +139,15 @@ static void bcma_unregister_cores(struct bcma_bus *bus) · 32 unmodified lines | |||
| 132 | } | 139 | } |
| 133 | } | 140 | } |
| 134 | 141 | ||
| 135 | int bcma_bus_register(struct bcma_bus *bus) | 142 | int __devinit bcma_bus_register(struct bcma_bus *bus) |
| 136 | { | 143 | { |
| 137 | int err; | 144 | int err; |
| 138 | struct bcma_device *core; | 145 | struct bcma_device *core; |
| 139 | 146 | ||
| 147 | mutex_lock(&bcma_buses_mutex); | ||
| 148 | bus->num = bcma_bus_next_num++; | ||
| 149 | mutex_unlock(&bcma_buses_mutex); | ||
| 150 | |||
| 140 | /* Scan for devices (cores) */ | 151 | /* Scan for devices (cores) */ |
| 141 | err = bcma_bus_scan(bus); | 152 | err = bcma_bus_scan(bus); |
| 142 | if (err) { | 153 | if (err) { |
| @@ -212,6 +212,17 @@ static struct bcma_device *bcma_find_core_by_index(struct bcma_bus *bus, · 211 unmodified lines | |||
| 212 | return NULL; | 212 | return NULL; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 coreid) | ||
| 216 | { | ||
| 217 | struct bcma_device *core; | ||
| 218 | |||
| 219 | list_for_each_entry_reverse(core, &bus->cores, list) { | ||
| 220 | if (core->id.id == coreid) | ||
| 221 | return core; | ||
| 222 | } | ||
| 223 | return NULL; | ||
| 224 | } | ||
| 225 | |||
| 215 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | 226 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, |
| 216 | struct bcma_device_id *match, int core_num, | 227 | struct bcma_device_id *match, int core_num, |
| 217 | struct bcma_device *core) | 228 | struct bcma_device *core) |
| @@ -353,6 +364,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, · 135 unmodified lines | |||
| 353 | void bcma_init_bus(struct bcma_bus *bus) | 364 | void bcma_init_bus(struct bcma_bus *bus) |
| 354 | { | 365 | { |
| 355 | s32 tmp; | 366 | s32 tmp; |
| 367 | struct bcma_chipinfo *chipinfo = &(bus->chipinfo); | ||
| 356 | 368 | ||
| 357 | if (bus->init_done) | 369 | if (bus->init_done) |
| 358 | return; | 370 | return; |
| @@ -363,9 +375,12 @@ void bcma_init_bus(struct bcma_bus *bus) · 4 unmodified lines | |||
| 363 | bcma_scan_switch_core(bus, BCMA_ADDR_BASE); | 375 | bcma_scan_switch_core(bus, BCMA_ADDR_BASE); |
| 364 | 376 | ||
| 365 | tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); | 377 | tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); |
| 366 | bus->chipinfo.id = (tmp & BCMA_CC_ID_ID) >> BCMA_CC_ID_ID_SHIFT; | 378 | chipinfo->id = (tmp & BCMA_CC_ID_ID) >> BCMA_CC_ID_ID_SHIFT; |
| 367 | bus->chipinfo.rev = (tmp & BCMA_CC_ID_REV) >> BCMA_CC_ID_REV_SHIFT; | 379 | chipinfo->rev = (tmp & BCMA_CC_ID_REV) >> BCMA_CC_ID_REV_SHIFT; |
| 368 | bus->chipinfo.pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT; | 380 | chipinfo->pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT; |
| 381 | pr_info("Found chip with id 0x%04X, rev 0x%02X and package 0x%02X\n", | ||
| 382 | chipinfo->id, chipinfo->rev, chipinfo->pkg); | ||
| 383 | |||
| 369 | bus->init_done = true; | 384 | bus->init_done = true; |
| 370 | } | 385 | } |
| 371 | 386 | ||
| @@ -392,6 +407,7 @@ int bcma_bus_scan(struct bcma_bus *bus) · 20 unmodified lines | |||
| 392 | bcma_scan_switch_core(bus, erombase); | 407 | bcma_scan_switch_core(bus, erombase); |
| 393 | 408 | ||
| 394 | while (eromptr < eromend) { | 409 | while (eromptr < eromend) { |
| 410 | struct bcma_device *other_core; | ||
| 395 | struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL); | 411 | struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL); |
| 396 | if (!core) | 412 | if (!core) |
| 397 | return -ENOMEM; | 413 | return -ENOMEM; |
| @@ -414,6 +430,8 @@ int bcma_bus_scan(struct bcma_bus *bus) · 16 unmodified lines | |||
| 414 | 430 | ||
| 415 | core->core_index = core_num++; | 431 | core->core_index = core_num++; |
| 416 | bus->nr_cores++; | 432 | bus->nr_cores++; |
| 433 | other_core = bcma_find_core_reverse(bus, core->id.id); | ||
| 434 | core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1; | ||
| 417 | 435 | ||
| 418 | pr_info("Core %d found: %s " | 436 | pr_info("Core %d found: %s " |
| 419 | "(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", | 437 | "(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", |
| @@ -2,6 +2,8 @@ · 1 unmodified line | |||
| 2 | * Broadcom specific AMBA | 2 | * Broadcom specific AMBA |
| 3 | * SPROM reading | 3 | * SPROM reading |
| 4 | * | 4 | * |
| 5 | * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de> | ||
| 6 | * | ||
| 5 | * Licensed under the GNU/GPL. See COPYING for details. | 7 | * Licensed under the GNU/GPL. See COPYING for details. |
| 6 | */ | 8 | */ |
| 7 | 9 | ||
| @@ -14,7 +16,57 @@ · 6 unmodified lines | |||
| 14 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
| 15 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 16 | 18 | ||
| 17 | #define SPOFF(offset) ((offset) / sizeof(u16)) | 19 | static int(*get_fallback_sprom)(struct bcma_bus *dev, struct ssb_sprom *out); |
| 20 | |||
| 21 | /** | ||
| 22 | * bcma_arch_register_fallback_sprom - Registers a method providing a | ||
| 23 | * fallback SPROM if no SPROM is found. | ||
| 24 | * | ||
| 25 | * @sprom_callback: The callback function. | ||
| 26 | * | ||
| 27 | * With this function the architecture implementation may register a | ||
| 28 | * callback handler which fills the SPROM data structure. The fallback is | ||
| 29 | * used for PCI based BCMA devices, where no valid SPROM can be found | ||
| 30 | * in the shadow registers and to provide the SPROM for SoCs where BCMA is | ||
| 31 | * to controll the system bus. | ||
| 32 | * | ||
| 33 | * This function is useful for weird architectures that have a half-assed | ||
| 34 | * BCMA device hardwired to their PCI bus. | ||
| 35 | * | ||
| 36 | * This function is available for architecture code, only. So it is not | ||
| 37 | * exported. | ||
| 38 | */ | ||
| 39 | int bcma_arch_register_fallback_sprom(int (*sprom_callback)(struct bcma_bus *bus, | ||
| 40 | struct ssb_sprom *out)) | ||
| 41 | { | ||
| 42 | if (get_fallback_sprom) | ||
| 43 | return -EEXIST; | ||
| 44 | get_fallback_sprom = sprom_callback; | ||
| 45 | |||
| 46 | return 0; | ||
| 47 | } | ||
| 48 | |||
| 49 | static int bcma_fill_sprom_with_fallback(struct bcma_bus *bus, | ||
| 50 | struct ssb_sprom *out) | ||
| 51 | { | ||
| 52 | int err; | ||
| 53 | |||
| 54 | if (!get_fallback_sprom) { | ||
| 55 | err = -ENOENT; | ||
| 56 | goto fail; | ||
| 57 | } | ||
| 58 | |||
| 59 | err = get_fallback_sprom(bus, out); | ||
| 60 | if (err) | ||
| 61 | goto fail; | ||
| 62 | |||
| 63 | pr_debug("Using SPROM revision %d provided by" | ||
| 64 | " platform.\n", bus->sprom.revision); | ||
| 65 | return 0; | ||
| 66 | fail: | ||
| 67 | pr_warn("Using fallback SPROM failed (err %d)\n", err); | ||
| 68 | return err; | ||
| 69 | } | ||
| 18 | 70 | ||
| 19 | /************************************************** | 71 | /************************************************** |
| 20 | * R/W ops. | 72 | * R/W ops. |
| @@ -124,10 +176,21 @@ static int bcma_sprom_valid(const u16 *sprom) · 103 unmodified lines | |||
| 124 | * SPROM extraction. | 176 | * SPROM extraction. |
| 125 | **************************************************/ | 177 | **************************************************/ |
| 126 | 178 | ||
| 179 | #define SPOFF(offset) ((offset) / sizeof(u16)) | ||
| 180 | |||
| 181 | #define SPEX(_field, _offset, _mask, _shift) \ | ||
| 182 | bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift)) | ||
| 183 | |||
| 127 | static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) | 184 | static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) |
| 128 | { | 185 | { |
| 129 | u16 v; | 186 | u16 v, o; |
| 130 | int i; | 187 | int i; |
| 188 | u16 pwr_info_offset[] = { | ||
| 189 | SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1, | ||
| 190 | SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3 | ||
| 191 | }; | ||
| 192 | BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) != | ||
| 193 | ARRAY_SIZE(bus->sprom.core_pwr_info)); | ||
| 131 | 194 | ||
| 132 | bus->sprom.revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & | 195 | bus->sprom.revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & |
| 133 | SSB_SPROM_REVISION_REV; | 196 | SSB_SPROM_REVISION_REV; |
| @@ -137,85 +200,229 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) · 3 unmodified lines | |||
| 137 | *(((__be16 *)bus->sprom.il0mac) + i) = cpu_to_be16(v); | 200 | *(((__be16 *)bus->sprom.il0mac) + i) = cpu_to_be16(v); |
| 138 | } | 201 | } |
| 139 | 202 | ||
| 140 | bus->sprom.board_rev = sprom[SPOFF(SSB_SPROM8_BOARDREV)]; | 203 | SPEX(board_rev, SSB_SPROM8_BOARDREV, ~0, 0); |
| 141 | 204 | ||
| 142 | bus->sprom.txpid2g[0] = (sprom[SPOFF(SSB_SPROM4_TXPID2G01)] & | 205 | SPEX(txpid2g[0], SSB_SPROM4_TXPID2G01, SSB_SPROM4_TXPID2G0, |
| 143 | SSB_SPROM4_TXPID2G0) >> SSB_SPROM4_TXPID2G0_SHIFT; | 206 | SSB_SPROM4_TXPID2G0_SHIFT); |
| 144 | bus->sprom.txpid2g[1] = (sprom[SPOFF(SSB_SPROM4_TXPID2G01)] & | 207 | SPEX(txpid2g[1], SSB_SPROM4_TXPID2G01, SSB_SPROM4_TXPID2G1, |
| 145 | SSB_SPROM4_TXPID2G1) >> SSB_SPROM4_TXPID2G1_SHIFT; | 208 | SSB_SPROM4_TXPID2G1_SHIFT); |
| 146 | bus->sprom.txpid2g[2] = (sprom[SPOFF(SSB_SPROM4_TXPID2G23)] & | 209 | SPEX(txpid2g[2], SSB_SPROM4_TXPID2G23, SSB_SPROM4_TXPID2G2, |
| 147 | SSB_SPROM4_TXPID2G2) >> SSB_SPROM4_TXPID2G2_SHIFT; | 210 | SSB_SPROM4_TXPID2G2_SHIFT); |
| 148 | bus->sprom.txpid2g[3] = (sprom[SPOFF(SSB_SPROM4_TXPID2G23)] & | 211 | SPEX(txpid2g[3], SSB_SPROM4_TXPID2G23, SSB_SPROM4_TXPID2G3, |
| 149 | SSB_SPROM4_TXPID2G3) >> SSB_SPROM4_TXPID2G3_SHIFT; | 212 | SSB_SPROM4_TXPID2G3_SHIFT); |
| 150 | 213 | ||
| 151 | bus->sprom.txpid5gl[0] = (sprom[SPOFF(SSB_SPROM4_TXPID5GL01)] & | 214 | SPEX(txpid5gl[0], SSB_SPROM4_TXPID5GL01, SSB_SPROM4_TXPID5GL0, |
| 152 | SSB_SPROM4_TXPID5GL0) >> SSB_SPROM4_TXPID5GL0_SHIFT; | 215 | SSB_SPROM4_TXPID5GL0_SHIFT); |
| 153 | bus->sprom.txpid5gl[1] = (sprom[SPOFF(SSB_SPROM4_TXPID5GL01)] & | 216 | SPEX(txpid5gl[1], SSB_SPROM4_TXPID5GL01, SSB_SPROM4_TXPID5GL1, |
| 154 | SSB_SPROM4_TXPID5GL1) >> SSB_SPROM4_TXPID5GL1_SHIFT; | 217 | SSB_SPROM4_TXPID5GL1_SHIFT); |
| 155 | bus->sprom.txpid5gl[2] = (sprom[SPOFF(SSB_SPROM4_TXPID5GL23)] & | 218 | SPEX(txpid5gl[2], SSB_SPROM4_TXPID5GL23, SSB_SPROM4_TXPID5GL2, |
| 156 | SSB_SPROM4_TXPID5GL2) >> SSB_SPROM4_TXPID5GL2_SHIFT; | 219 | SSB_SPROM4_TXPID5GL2_SHIFT); |
| 157 | bus->sprom.txpid5gl[3] = (sprom[SPOFF(SSB_SPROM4_TXPID5GL23)] & | 220 | SPEX(txpid5gl[3], SSB_SPROM4_TXPID5GL23, SSB_SPROM4_TXPID5GL3, |
| 158 | SSB_SPROM4_TXPID5GL3) >> SSB_SPROM4_TXPID5GL3_SHIFT; | 221 | SSB_SPROM4_TXPID5GL3_SHIFT); |
| 159 | 222 | ||
| 160 | bus->sprom.txpid5g[0] = (sprom[SPOFF(SSB_SPROM4_TXPID5G01)] & | 223 | SPEX(txpid5g[0], SSB_SPROM4_TXPID5G01, SSB_SPROM4_TXPID5G0, |
| 161 | SSB_SPROM4_TXPID5G0) >> SSB_SPROM4_TXPID5G0_SHIFT; | 224 | SSB_SPROM4_TXPID5G0_SHIFT); |
| 162 | bus->sprom.txpid5g[1] = (sprom[SPOFF(SSB_SPROM4_TXPID5G01)] & | 225 | SPEX(txpid5g[1], SSB_SPROM4_TXPID5G01, SSB_SPROM4_TXPID5G1, |
| 163 | SSB_SPROM4_TXPID5G1) >> SSB_SPROM4_TXPID5G1_SHIFT; | 226 | SSB_SPROM4_TXPID5G1_SHIFT); |
| 164 | bus->sprom.txpid5g[2] = (sprom[SPOFF(SSB_SPROM4_TXPID5G23)] & | 227 | SPEX(txpid5g[2], SSB_SPROM4_TXPID5G23, SSB_SPROM4_TXPID5G2, |
| 165 | SSB_SPROM4_TXPID5G2) >> SSB_SPROM4_TXPID5G2_SHIFT; | 228 | SSB_SPROM4_TXPID5G2_SHIFT); |
| 166 | bus->sprom.txpid5g[3] = (sprom[SPOFF(SSB_SPROM4_TXPID5G23)] & | 229 | SPEX(txpid5g[3], SSB_SPROM4_TXPID5G23, SSB_SPROM4_TXPID5G3, |
| 167 | SSB_SPROM4_TXPID5G3) >> SSB_SPROM4_TXPID5G3_SHIFT; | 230 | SSB_SPROM4_TXPID5G3_SHIFT); |
| 168 | 231 | ||
| 169 | bus->sprom.txpid5gh[0] = (sprom[SPOFF(SSB_SPROM4_TXPID5GH01)] & | 232 | SPEX(txpid5gh[0], SSB_SPROM4_TXPID5GH01, SSB_SPROM4_TXPID5GH0, |
| 170 | SSB_SPROM4_TXPID5GH0) >> SSB_SPROM4_TXPID5GH0_SHIFT; | 233 | SSB_SPROM4_TXPID5GH0_SHIFT); |
| 171 | bus->sprom.txpid5gh[1] = (sprom[SPOFF(SSB_SPROM4_TXPID5GH01)] & | 234 | SPEX(txpid5gh[1], SSB_SPROM4_TXPID5GH01, SSB_SPROM4_TXPID5GH1, |
| 172 | SSB_SPROM4_TXPID5GH1) >> SSB_SPROM4_TXPID5GH1_SHIFT; | 235 | SSB_SPROM4_TXPID5GH1_SHIFT); |
| 173 | bus->sprom.txpid5gh[2] = (sprom[SPOFF(SSB_SPROM4_TXPID5GH23)] & | 236 | SPEX(txpid5gh[2], SSB_SPROM4_TXPID5GH23, SSB_SPROM4_TXPID5GH2, |
| 174 | SSB_SPROM4_TXPID5GH2) >> SSB_SPROM4_TXPID5GH2_SHIFT; | 237 | SSB_SPROM4_TXPID5GH2_SHIFT); |
| 175 | bus->sprom.txpid5gh[3] = (sprom[SPOFF(SSB_SPROM4_TXPID5GH23)] & | 238 | SPEX(txpid5gh[3], SSB_SPROM4_TXPID5GH23, SSB_SPROM4_TXPID5GH3, |
| 176 | SSB_SPROM4_TXPID5GH3) >> SSB_SPROM4_TXPID5GH3_SHIFT; | 239 | SSB_SPROM4_TXPID5GH3_SHIFT); |
| 177 | 240 | ||
| 178 | bus->sprom.boardflags_lo = sprom[SPOFF(SSB_SPROM8_BFLLO)]; | 241 | SPEX(boardflags_lo, SSB_SPROM8_BFLLO, ~0, 0); |
| 179 | bus->sprom.boardflags_hi = sprom[SPOFF(SSB_SPROM8_BFLHI)]; | 242 | SPEX(boardflags_hi, SSB_SPROM8_BFLHI, ~0, 0); |
| 180 | bus->sprom.boardflags2_lo = sprom[SPOFF(SSB_SPROM8_BFL2LO)]; | 243 | SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, ~0, 0); |
| 181 | bus->sprom.boardflags2_hi = sprom[SPOFF(SSB_SPROM8_BFL2HI)]; | 244 | SPEX(boardflags2_hi, SSB_SPROM8_BFL2HI, ~0, 0); |
| 182 | 245 | ||
| 183 | bus->sprom.country_code = sprom[SPOFF(SSB_SPROM8_CCODE)]; | 246 | SPEX(country_code, SSB_SPROM8_CCODE, ~0, 0); |
| 184 | 247 | ||
| 185 | bus->sprom.fem.ghz2.tssipos = (sprom[SPOFF(SSB_SPROM8_FEM2G)] & | 248 | /* Extract cores power info info */ |
| 186 | SSB_SROM8_FEM_TSSIPOS) >> SSB_SROM8_FEM_TSSIPOS_SHIFT; | 249 | for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { |
| 187 | bus->sprom.fem.ghz2.extpa_gain = (sprom[SPOFF(SSB_SPROM8_FEM2G)] & | 250 | o = pwr_info_offset[i]; |
| 188 | SSB_SROM8_FEM_EXTPA_GAIN) >> SSB_SROM8_FEM_EXTPA_GAIN_SHIFT; | 251 | SPEX(core_pwr_info[i].itssi_2g, o + SSB_SROM8_2G_MAXP_ITSSI, |
| 189 | bus->sprom.fem.ghz2.pdet_range = (sprom[SPOFF(SSB_SPROM8_FEM2G)] & | 252 | SSB_SPROM8_2G_ITSSI, SSB_SPROM8_2G_ITSSI_SHIFT); |
| 190 | SSB_SROM8_FEM_PDET_RANGE) >> SSB_SROM8_FEM_PDET_RANGE_SHIFT; | 253 | SPEX(core_pwr_info[i].maxpwr_2g, o + SSB_SROM8_2G_MAXP_ITSSI, |
| 191 | bus->sprom.fem.ghz2.tr_iso = (sprom[SPOFF(SSB_SPROM8_FEM2G)] & | 254 | SSB_SPROM8_2G_MAXP, 0); |
| 192 | SSB_SROM8_FEM_TR_ISO) >> SSB_SROM8_FEM_TR_ISO_SHIFT; | 255 | |
| 193 | bus->sprom.fem.ghz2.antswlut = (sprom[SPOFF(SSB_SPROM8_FEM2G)] & | 256 | SPEX(core_pwr_info[i].pa_2g[0], o + SSB_SROM8_2G_PA_0, ~0, 0); |
| 194 | SSB_SROM8_FEM_ANTSWLUT) >> SSB_SROM8_FEM_ANTSWLUT_SHIFT; | 257 | SPEX(core_pwr_info[i].pa_2g[1], o + SSB_SROM8_2G_PA_1, ~0, 0); |
| 195 | 258 | SPEX(core_pwr_info[i].pa_2g[2], o + SSB_SROM8_2G_PA_2, ~0, 0); | |
| 196 | bus->sprom.fem.ghz5.tssipos = (sprom[SPOFF(SSB_SPROM8_FEM5G)] & | 259 | |
| 197 | SSB_SROM8_FEM_TSSIPOS) >> SSB_SROM8_FEM_TSSIPOS_SHIFT; | 260 | SPEX(core_pwr_info[i].itssi_5g, o + SSB_SROM8_5G_MAXP_ITSSI, |
| 198 | bus->sprom.fem.ghz5.extpa_gain = (sprom[SPOFF(SSB_SPROM8_FEM5G)] & | 261 | SSB_SPROM8_5G_ITSSI, SSB_SPROM8_5G_ITSSI_SHIFT); |
| 199 | SSB_SROM8_FEM_EXTPA_GAIN) >> SSB_SROM8_FEM_EXTPA_GAIN_SHIFT; | 262 | SPEX(core_pwr_info[i].maxpwr_5g, o + SSB_SROM8_5G_MAXP_ITSSI, |
| 200 | bus->sprom.fem.ghz5.pdet_range = (sprom[SPOFF(SSB_SPROM8_FEM5G)] & | 263 | SSB_SPROM8_5G_MAXP, 0); |
| 201 | SSB_SROM8_FEM_PDET_RANGE) >> SSB_SROM8_FEM_PDET_RANGE_SHIFT; | 264 | SPEX(core_pwr_info[i].maxpwr_5gh, o + SSB_SPROM8_5GHL_MAXP, |
| 202 | bus->sprom.fem.ghz5.tr_iso = (sprom[SPOFF(SSB_SPROM8_FEM5G)] & | 265 | SSB_SPROM8_5GH_MAXP, 0); |
| 203 | SSB_SROM8_FEM_TR_ISO) >> SSB_SROM8_FEM_TR_ISO_SHIFT; | 266 | SPEX(core_pwr_info[i].maxpwr_5gl, o + SSB_SPROM8_5GHL_MAXP, |
| 204 | bus->sprom.fem.ghz5.antswlut = (sprom[SPOFF(SSB_SPROM8_FEM5G)] & | 267 | SSB_SPROM8_5GL_MAXP, SSB_SPROM8_5GL_MAXP_SHIFT); |
| 205 | SSB_SROM8_FEM_ANTSWLUT) >> SSB_SROM8_FEM_ANTSWLUT_SHIFT; | 268 | |
| 269 | SPEX(core_pwr_info[i].pa_5gl[0], o + SSB_SROM8_5GL_PA_0, ~0, 0); | ||
| 270 | SPEX(core_pwr_info[i].pa_5gl[1], o + SSB_SROM8_5GL_PA_1, ~0, 0); | ||
| 271 | SPEX(core_pwr_info[i].pa_5gl[2], o + SSB_SROM8_5GL_PA_2, ~0, 0); | ||
| 272 | SPEX(core_pwr_info[i].pa_5g[0], o + SSB_SROM8_5G_PA_0, ~0, 0); | ||
| 273 | SPEX(core_pwr_info[i].pa_5g[1], o + SSB_SROM8_5G_PA_1, ~0, 0); | ||
| 274 | SPEX(core_pwr_info[i].pa_5g[2], o + SSB_SROM8_5G_PA_2, ~0, 0); | ||
| 275 | SPEX(core_pwr_info[i].pa_5gh[0], o + SSB_SROM8_5GH_PA_0, ~0, 0); | ||
| 276 | SPEX(core_pwr_info[i].pa_5gh[1], o + SSB_SROM8_5GH_PA_1, ~0, 0); | ||
| 277 | SPEX(core_pwr_info[i].pa_5gh[2], o + SSB_SROM8_5GH_PA_2, ~0, 0); | ||
| 278 | } | ||
| 279 | |||
| 280 | SPEX(fem.ghz2.tssipos, SSB_SPROM8_FEM2G, SSB_SROM8_FEM_TSSIPOS, | ||
| 281 | SSB_SROM8_FEM_TSSIPOS_SHIFT); | ||
| 282 | SPEX(fem.ghz2.extpa_gain, SSB_SPROM8_FEM2G, SSB_SROM8_FEM_EXTPA_GAIN, | ||
| 283 | SSB_SROM8_FEM_EXTPA_GAIN_SHIFT); | ||
| 284 | SPEX(fem.ghz2.pdet_range, SSB_SPROM8_FEM2G, SSB_SROM8_FEM_PDET_RANGE, | ||
| 285 | SSB_SROM8_FEM_PDET_RANGE_SHIFT); | ||
| 286 | SPEX(fem.ghz2.tr_iso, SSB_SPROM8_FEM2G, SSB_SROM8_FEM_TR_ISO, | ||
| 287 | SSB_SROM8_FEM_TR_ISO_SHIFT); | ||
| 288 | SPEX(fem.ghz2.antswlut, SSB_SPROM8_FEM2G, SSB_SROM8_FEM_ANTSWLUT, | ||
| 289 | SSB_SROM8_FEM_ANTSWLUT_SHIFT); | ||
| 290 | |||
| 291 | SPEX(fem.ghz5.tssipos, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_TSSIPOS, | ||
| 292 | SSB_SROM8_FEM_TSSIPOS_SHIFT); | ||
| 293 | SPEX(fem.ghz5.extpa_gain, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_EXTPA_GAIN, | ||
| 294 | SSB_SROM8_FEM_EXTPA_GAIN_SHIFT); | ||
| 295 | SPEX(fem.ghz5.pdet_range, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_PDET_RANGE, | ||
| 296 | SSB_SROM8_FEM_PDET_RANGE_SHIFT); | ||
| 297 | SPEX(fem.ghz5.tr_iso, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_TR_ISO, | ||
| 298 | SSB_SROM8_FEM_TR_ISO_SHIFT); | ||
| 299 | SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_ANTSWLUT, | ||
| 300 | SSB_SROM8_FEM_ANTSWLUT_SHIFT); | ||
| 301 | } | ||
| 302 | |||
| 303 | /* | ||
| 304 | * Indicates the presence of external SPROM. | ||
| 305 | */ | ||
| 306 | static bool bcma_sprom_ext_available(struct bcma_bus *bus) | ||
| 307 | { | ||
| 308 | u32 chip_status; | ||
| 309 | u32 srom_control; | ||
| 310 | u32 present_mask; | ||
| 311 | |||
| 312 | if (bus->drv_cc.core->id.rev >= 31) { | ||
| 313 | if (!(bus->drv_cc.capabilities & BCMA_CC_CAP_SPROM)) | ||
| 314 | return false; | ||
| 315 | |||
| 316 | srom_control = bcma_read32(bus->drv_cc.core, | ||
| 317 | BCMA_CC_SROM_CONTROL); | ||
| 318 | return srom_control & BCMA_CC_SROM_CONTROL_PRESENT; | ||
| 319 | } | ||
| 320 | |||
| 321 | /* older chipcommon revisions use chip status register */ | ||
| 322 | chip_status = bcma_read32(bus->drv_cc.core, BCMA_CC_CHIPSTAT); | ||
| 323 | switch (bus->chipinfo.id) { | ||
| 324 | case 0x4313: | ||
| 325 | present_mask = BCMA_CC_CHIPST_4313_SPROM_PRESENT; | ||
| 326 | break; | ||
| 327 | |||
| 328 | case 0x4331: | ||
| 329 | present_mask = BCMA_CC_CHIPST_4331_SPROM_PRESENT; | ||
| 330 | break; | ||
| 331 | |||
| 332 | default: | ||
| 333 | return true; | ||
| 334 | } | ||
| 335 | |||
| 336 | return chip_status & present_mask; | ||
| 337 | } | ||
| 338 | |||
| 339 | /* | ||
| 340 | * Indicates that on-chip OTP memory is present and enabled. | ||
| 341 | */ | ||
| 342 | static bool bcma_sprom_onchip_available(struct bcma_bus *bus) | ||
| 343 | { | ||
| 344 | u32 chip_status; | ||
| 345 | u32 otpsize = 0; | ||
| 346 | bool present; | ||
| 347 | |||
| 348 | chip_status = bcma_read32(bus->drv_cc.core, BCMA_CC_CHIPSTAT); | ||
| 349 | switch (bus->chipinfo.id) { | ||
| 350 | case 0x4313: | ||
| 351 | present = chip_status & BCMA_CC_CHIPST_4313_OTP_PRESENT; | ||
| 352 | break; | ||
| 353 | |||
| 354 | case 0x4331: | ||
| 355 | present = chip_status & BCMA_CC_CHIPST_4331_OTP_PRESENT; | ||
| 356 | break; | ||
| 357 | |||
| 358 | case 43224: | ||
| 359 | case 43225: | ||
| 360 | /* for these chips OTP is always available */ | ||
| 361 | present = true; | ||
| 362 | break; | ||
| 363 | |||
| 364 | default: | ||
| 365 | present = false; | ||
| 366 | break; | ||
| 367 | } | ||
| 368 | |||
| 369 | if (present) { | ||
| 370 | otpsize = bus->drv_cc.capabilities & BCMA_CC_CAP_OTPS; | ||
| 371 | otpsize >>= BCMA_CC_CAP_OTPS_SHIFT; | ||
| 372 | } | ||
| 373 | |||
| 374 | return otpsize != 0; | ||
| 375 | } | ||
| 376 | |||
| 377 | /* | ||
| 378 | * Verify OTP is filled and determine the byte | ||
| 379 | * offset where SPROM data is located. | ||
| 380 | * | ||
| 381 | * On error, returns 0; byte offset otherwise. | ||
| 382 | */ | ||
| 383 | static int bcma_sprom_onchip_offset(struct bcma_bus *bus) | ||
| 384 | { | ||
| 385 | struct bcma_device *cc = bus->drv_cc.core; | ||
| 386 | u32 offset; | ||
| 387 | |||
| 388 | /* verify OTP status */ | ||
| 389 | if ((bcma_read32(cc, BCMA_CC_OTPS) & BCMA_CC_OTPS_GU_PROG_HW) == 0) | ||
| 390 | return 0; | ||
| 391 | |||
| 392 | /* obtain bit offset from otplayout register */ | ||
| 393 | offset = (bcma_read32(cc, BCMA_CC_OTPL) & BCMA_CC_OTPL_GURGN_OFFSET); | ||
| 394 | return BCMA_CC_SPROM + (offset >> 3); | ||
| 206 | } | 395 | } |
| 207 | 396 | ||
| 208 | int bcma_sprom_get(struct bcma_bus *bus) | 397 | int bcma_sprom_get(struct bcma_bus *bus) |
| 209 | { | 398 | { |
| 210 | u16 offset; | 399 | u16 offset = BCMA_CC_SPROM; |
| 211 | u16 *sprom; | 400 | u16 *sprom; |
| 212 | int err = 0; | 401 | int err = 0; |
| 213 | 402 | ||
| 214 | if (!bus->drv_cc.core) | 403 | if (!bus->drv_cc.core) |
| 215 | return -EOPNOTSUPP; | 404 | return -EOPNOTSUPP; |
| 216 | 405 | ||
| 217 | if (!(bus->drv_cc.capabilities & BCMA_CC_CAP_SPROM)) | 406 | if (!bcma_sprom_ext_available(bus)) { |
| 218 | return -ENOENT; | 407 | /* |
| 408 | * External SPROM takes precedence so check | ||
| 409 | * on-chip OTP only when no external SPROM | ||
| 410 | * is present. | ||
| 411 | */ | ||
| 412 | if (bcma_sprom_onchip_available(bus)) { | ||
| 413 | /* determine offset */ | ||
| 414 | offset = bcma_sprom_onchip_offset(bus); | ||
| 415 | } | ||
| 416 | if (!offset) { | ||
| 417 | /* | ||
| 418 | * Maybe there is no SPROM on the device? | ||
| 419 | * Now we ask the arch code if there is some sprom | ||
| 420 | * available for this device in some other storage. | ||
| 421 | */ | ||
| 422 | err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); | ||
| 423 | return err; | ||
| 424 | } | ||
| 425 | } | ||
| 219 | 426 | ||
| 220 | sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), | 427 | sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), |
| 221 | GFP_KERNEL); | 428 | GFP_KERNEL); |
| @@ -225,11 +432,7 @@ int bcma_sprom_get(struct bcma_bus *bus) · 3 unmodified lines | |||
| 225 | if (bus->chipinfo.id == 0x4331) | 432 | if (bus->chipinfo.id == 0x4331) |
| 226 | bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false); | 433 | bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false); |
| 227 | 434 | ||
| 228 | /* Most cards have SPROM moved by additional offset 0x30 (48 dwords). | 435 | pr_debug("SPROM offset 0x%x\n", offset); |
| 229 | * According to brcm80211 this applies to cards with PCIe rev >= 6 | ||
| 230 | * TODO: understand this condition and use it */ | ||
| 231 | offset = (bus->chipinfo.id == 0x4331) ? BCMA_CC_SPROM : | ||
| 232 | BCMA_CC_SPROM_PCIE6; | ||
| 233 | bcma_sprom_read(bus, offset, sprom); | 436 | bcma_sprom_read(bus, offset, sprom); |
| 234 | 437 | ||
| 235 | if (bus->chipinfo.id == 0x4331) | 438 | if (bus->chipinfo.id == 0x4331) |
| @@ -65,12 +65,14 @@ static struct usb_device_id ath3k_table[] = { · 64 unmodified lines | |||
| 65 | { USB_DEVICE(0x0CF3, 0x3002) }, | 65 | { USB_DEVICE(0x0CF3, 0x3002) }, |
| 66 | { USB_DEVICE(0x13d3, 0x3304) }, | 66 | { USB_DEVICE(0x13d3, 0x3304) }, |
| 67 | { USB_DEVICE(0x0930, 0x0215) }, | 67 | { USB_DEVICE(0x0930, 0x0215) }, |
| 68 | { USB_DEVICE(0x0489, 0xE03D) }, | ||
| 68 | 69 | ||
| 69 | /* Atheros AR9285 Malbec with sflash firmware */ | 70 | /* Atheros AR9285 Malbec with sflash firmware */ |
| 70 | { USB_DEVICE(0x03F0, 0x311D) }, | 71 | { USB_DEVICE(0x03F0, 0x311D) }, |
| 71 | 72 | ||
| 72 | /* Atheros AR3012 with sflash firmware*/ | 73 | /* Atheros AR3012 with sflash firmware*/ |
| 73 | { USB_DEVICE(0x0CF3, 0x3004) }, | 74 | { USB_DEVICE(0x0CF3, 0x3004) }, |
| 75 | { USB_DEVICE(0x13d3, 0x3375) }, | ||
| 74 | 76 | ||
| 75 | /* Atheros AR5BBU12 with sflash firmware */ | 77 | /* Atheros AR5BBU12 with sflash firmware */ |
| 76 | { USB_DEVICE(0x0489, 0xE02C) }, | 78 | { USB_DEVICE(0x0489, 0xE02C) }, |
| @@ -87,6 +89,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { · 10 unmodified lines | |||
| 87 | 89 | ||
| 88 | /* Atheros AR3012 with sflash firmware*/ | 90 | /* Atheros AR3012 with sflash firmware*/ |
| 89 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 91 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
| 92 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | ||
| 90 | 93 | ||
| 91 | { } /* Terminating entry */ | 94 | { } /* Terminating entry */ |
| 92 | }; | 95 | }; |
| @@ -411,7 +411,7 @@ unlock: · 410 unmodified lines | |||
| 411 | 411 | ||
| 412 | static int bfusb_open(struct hci_dev *hdev) | 412 | static int bfusb_open(struct hci_dev *hdev) |
| 413 | { | 413 | { |
| 414 | struct bfusb_data *data = hdev->driver_data; | 414 | struct bfusb_data *data = hci_get_drvdata(hdev); |
| 415 | unsigned long flags; | 415 | unsigned long flags; |
| 416 | int i, err; | 416 | int i, err; |
| 417 | 417 | ||
| @@ -437,7 +437,7 @@ static int bfusb_open(struct hci_dev *hdev) · 19 unmodified lines | |||
| 437 | 437 | ||
| 438 | static int bfusb_flush(struct hci_dev *hdev) | 438 | static int bfusb_flush(struct hci_dev *hdev) |
| 439 | { | 439 | { |
| 440 | struct bfusb_data *data = hdev->driver_data; | 440 | struct bfusb_data *data = hci_get_drvdata(hdev); |
| 441 | 441 | ||
| 442 | BT_DBG("hdev %p bfusb %p", hdev, data); | 442 | BT_DBG("hdev %p bfusb %p", hdev, data); |
| 443 | 443 | ||
| @@ -448,7 +448,7 @@ static int bfusb_flush(struct hci_dev *hdev) · 4 unmodified lines | |||
| 448 | 448 | ||
| 449 | static int bfusb_close(struct hci_dev *hdev) | 449 | static int bfusb_close(struct hci_dev *hdev) |
| 450 | { | 450 | { |
| 451 | struct bfusb_data *data = hdev->driver_data; | 451 | struct bfusb_data *data = hci_get_drvdata(hdev); |
| 452 | unsigned long flags; | 452 | unsigned long flags; |
| 453 | 453 | ||
| 454 | BT_DBG("hdev %p bfusb %p", hdev, data); | 454 | BT_DBG("hdev %p bfusb %p", hdev, data); |
| @@ -483,7 +483,7 @@ static int bfusb_send_frame(struct sk_buff *skb) · 28 unmodified lines | |||
| 483 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 483 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
| 484 | return -EBUSY; | 484 | return -EBUSY; |
| 485 | 485 | ||
| 486 | data = hdev->driver_data; | 486 | data = hci_get_drvdata(hdev); |
| 487 | 487 | ||
| 488 | switch (bt_cb(skb)->pkt_type) { | 488 | switch (bt_cb(skb)->pkt_type) { |
| 489 | case HCI_COMMAND_PKT: | 489 | case HCI_COMMAND_PKT: |
| @@ -544,15 +544,6 @@ static int bfusb_send_frame(struct sk_buff *skb) · 54 unmodified lines | |||
| 544 | return 0; | 544 | return 0; |
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | static void bfusb_destruct(struct hci_dev *hdev) | ||
| 548 | { | ||
| 549 | struct bfusb_data *data = hdev->driver_data; | ||
| 550 | |||
| 551 | BT_DBG("hdev %p bfusb %p", hdev, data); | ||
| 552 | |||
| 553 | kfree(data); | ||
| 554 | } | ||
| 555 | |||
| 556 | static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) | 547 | static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) |
| 557 | { | 548 | { |
| 558 | return -ENOIOCTLCMD; | 549 | return -ENOIOCTLCMD; |
| @@ -705,18 +696,15 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 146 unmodified lines | |||
| 705 | data->hdev = hdev; | 696 | data->hdev = hdev; |
| 706 | 697 | ||
| 707 | hdev->bus = HCI_USB; | 698 | hdev->bus = HCI_USB; |
| 708 | hdev->driver_data = data; | 699 | hci_set_drvdata(hdev, data); |
| 709 | SET_HCIDEV_DEV(hdev, &intf->dev); | 700 | SET_HCIDEV_DEV(hdev, &intf->dev); |
| 710 | 701 | ||
| 711 | hdev->open = bfusb_open; | 702 | hdev->open = bfusb_open; |
| 712 | hdev->close = bfusb_close; | 703 | hdev->close = bfusb_close; |
| 713 | hdev->flush = bfusb_flush; | 704 | hdev->flush = bfusb_flush; |
| 714 | hdev->send = bfusb_send_frame; | 705 | hdev->send = bfusb_send_frame; |
| 715 | hdev->destruct = bfusb_destruct; | ||
| 716 | hdev->ioctl = bfusb_ioctl; | 706 | hdev->ioctl = bfusb_ioctl; |
| 717 | 707 | ||
| 718 | hdev->owner = THIS_MODULE; | ||
| 719 | |||
| 720 | if (hci_register_dev(hdev) < 0) { | 708 | if (hci_register_dev(hdev) < 0) { |
| 721 | BT_ERR("Can't register HCI device"); | 709 | BT_ERR("Can't register HCI device"); |
| 722 | hci_free_dev(hdev); | 710 | hci_free_dev(hdev); |
| @@ -753,6 +741,7 @@ static void bfusb_disconnect(struct usb_interface *intf) · 30 unmodified lines | |||
| 753 | 741 | ||
| 754 | hci_unregister_dev(hdev); | 742 | hci_unregister_dev(hdev); |
| 755 | hci_free_dev(hdev); | 743 | hci_free_dev(hdev); |
| 744 | kfree(data); | ||
| 756 | } | 745 | } |
| 757 | 746 | ||
| 758 | static struct usb_driver bfusb_driver = { | 747 | static struct usb_driver bfusb_driver = { |
| @@ -561,7 +561,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst) · 560 unmodified lines | |||
| 561 | 561 | ||
| 562 | static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) | 562 | static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) |
| 563 | { | 563 | { |
| 564 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); | 564 | bluecard_info_t *info = hci_get_drvdata(hdev); |
| 565 | struct sk_buff *skb; | 565 | struct sk_buff *skb; |
| 566 | 566 | ||
| 567 | /* Ericsson baud rate command */ | 567 | /* Ericsson baud rate command */ |
| @@ -609,7 +609,7 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) · 41 unmodified lines | |||
| 609 | 609 | ||
| 610 | static int bluecard_hci_flush(struct hci_dev *hdev) | 610 | static int bluecard_hci_flush(struct hci_dev *hdev) |
| 611 | { | 611 | { |
| 612 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); | 612 | bluecard_info_t *info = hci_get_drvdata(hdev); |
| 613 | 613 | ||
| 614 | /* Drop TX queue */ | 614 | /* Drop TX queue */ |
| 615 | skb_queue_purge(&(info->txq)); | 615 | skb_queue_purge(&(info->txq)); |
| @@ -620,7 +620,7 @@ static int bluecard_hci_flush(struct hci_dev *hdev) · 4 unmodified lines | |||
| 620 | 620 | ||
| 621 | static int bluecard_hci_open(struct hci_dev *hdev) | 621 | static int bluecard_hci_open(struct hci_dev *hdev) |
| 622 | { | 622 | { |
| 623 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); | 623 | bluecard_info_t *info = hci_get_drvdata(hdev); |
| 624 | unsigned int iobase = info->p_dev->resource[0]->start; | 624 | unsigned int iobase = info->p_dev->resource[0]->start; |
| 625 | 625 | ||
| 626 | if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) | 626 | if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) |
| @@ -640,7 +640,7 @@ static int bluecard_hci_open(struct hci_dev *hdev) · 13 unmodified lines | |||
| 640 | 640 | ||
| 641 | static int bluecard_hci_close(struct hci_dev *hdev) | 641 | static int bluecard_hci_close(struct hci_dev *hdev) |
| 642 | { | 642 | { |
| 643 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); | 643 | bluecard_info_t *info = hci_get_drvdata(hdev); |
| 644 | unsigned int iobase = info->p_dev->resource[0]->start; | 644 | unsigned int iobase = info->p_dev->resource[0]->start; |
| 645 | 645 | ||
| 646 | if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) | 646 | if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) |
| @@ -667,7 +667,7 @@ static int bluecard_hci_send_frame(struct sk_buff *skb) · 20 unmodified lines | |||
| 667 | return -ENODEV; | 667 | return -ENODEV; |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | info = (bluecard_info_t *)(hdev->driver_data); | 670 | info = hci_get_drvdata(hdev); |
| 671 | 671 | ||
| 672 | switch (bt_cb(skb)->pkt_type) { | 672 | switch (bt_cb(skb)->pkt_type) { |
| 673 | case HCI_COMMAND_PKT: | 673 | case HCI_COMMAND_PKT: |
| @@ -691,11 +691,6 @@ static int bluecard_hci_send_frame(struct sk_buff *skb) · 17 unmodified lines | |||
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | 693 | ||
| 694 | static void bluecard_hci_destruct(struct hci_dev *hdev) | ||
| 695 | { | ||
| 696 | } | ||
| 697 | |||
| 698 | |||
| 699 | static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) | 694 | static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) |
| 700 | { | 695 | { |
| 701 | return -ENOIOCTLCMD; | 696 | return -ENOIOCTLCMD; |
| @@ -734,18 +729,15 @@ static int bluecard_open(bluecard_info_t *info) · 32 unmodified lines | |||
| 734 | info->hdev = hdev; | 729 | info->hdev = hdev; |
| 735 | 730 | ||
| 736 | hdev->bus = HCI_PCCARD; | 731 | hdev->bus = HCI_PCCARD; |
| 737 | hdev->driver_data = info; | 732 | hci_set_drvdata(hdev, info); |
| 738 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); | 733 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); |
| 739 | 734 | ||
| 740 | hdev->open = bluecard_hci_open; | 735 | hdev->open = bluecard_hci_open; |
| 741 | hdev->close = bluecard_hci_close; | 736 | hdev->close = bluecard_hci_close; |
| 742 | hdev->flush = bluecard_hci_flush; | 737 | hdev->flush = bluecard_hci_flush; |
| 743 | hdev->send = bluecard_hci_send_frame; | 738 | hdev->send = bluecard_hci_send_frame; |
| 744 | hdev->destruct = bluecard_hci_destruct; | ||
| 745 | hdev->ioctl = bluecard_hci_ioctl; | 739 | hdev->ioctl = bluecard_hci_ioctl; |
| 746 | 740 | ||
| 747 | hdev->owner = THIS_MODULE; | ||
| 748 | |||
| 749 | id = inb(iobase + 0x30); | 741 | id = inb(iobase + 0x30); |
| 750 | 742 | ||
| 751 | if ((id & 0x0f) == 0x02) | 743 | if ((id & 0x0f) == 0x02) |
| @@ -66,7 +66,7 @@ struct hci_vendor_hdr { · 65 unmodified lines | |||
| 66 | 66 | ||
| 67 | static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count) | 67 | static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count) |
| 68 | { | 68 | { |
| 69 | struct bpa10x_data *data = hdev->driver_data; | 69 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 70 | 70 | ||
| 71 | BT_DBG("%s queue %d buffer %p count %d", hdev->name, | 71 | BT_DBG("%s queue %d buffer %p count %d", hdev->name, |
| 72 | queue, buf, count); | 72 | queue, buf, count); |
| @@ -189,7 +189,7 @@ done: · 116 unmodified lines | |||
| 189 | static void bpa10x_rx_complete(struct urb *urb) | 189 | static void bpa10x_rx_complete(struct urb *urb) |
| 190 | { | 190 | { |
| 191 | struct hci_dev *hdev = urb->context; | 191 | struct hci_dev *hdev = urb->context; |
| 192 | struct bpa10x_data *data = hdev->driver_data; | 192 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 193 | int err; | 193 | int err; |
| 194 | 194 | ||
| 195 | BT_DBG("%s urb %p status %d count %d", hdev->name, | 195 | BT_DBG("%s urb %p status %d count %d", hdev->name, |
| @@ -219,7 +219,7 @@ static void bpa10x_rx_complete(struct urb *urb) · 23 unmodified lines | |||
| 219 | 219 | ||
| 220 | static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev) | 220 | static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev) |
| 221 | { | 221 | { |
| 222 | struct bpa10x_data *data = hdev->driver_data; | 222 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 223 | struct urb *urb; | 223 | struct urb *urb; |
| 224 | unsigned char *buf; | 224 | unsigned char *buf; |
| 225 | unsigned int pipe; | 225 | unsigned int pipe; |
| @@ -260,7 +260,7 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev) · 34 unmodified lines | |||
| 260 | 260 | ||
| 261 | static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev) | 261 | static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev) |
| 262 | { | 262 | { |
| 263 | struct bpa10x_data *data = hdev->driver_data; | 263 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 264 | struct urb *urb; | 264 | struct urb *urb; |
| 265 | unsigned char *buf; | 265 | unsigned char *buf; |
| 266 | unsigned int pipe; | 266 | unsigned int pipe; |
| @@ -301,7 +301,7 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev) · 34 unmodified lines | |||
| 301 | 301 | ||
| 302 | static int bpa10x_open(struct hci_dev *hdev) | 302 | static int bpa10x_open(struct hci_dev *hdev) |
| 303 | { | 303 | { |
| 304 | struct bpa10x_data *data = hdev->driver_data; | 304 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 305 | int err; | 305 | int err; |
| 306 | 306 | ||
| 307 | BT_DBG("%s", hdev->name); | 307 | BT_DBG("%s", hdev->name); |
| @@ -329,7 +329,7 @@ error: · 21 unmodified lines | |||
| 329 | 329 | ||
| 330 | static int bpa10x_close(struct hci_dev *hdev) | 330 | static int bpa10x_close(struct hci_dev *hdev) |
| 331 | { | 331 | { |
| 332 | struct bpa10x_data *data = hdev->driver_data; | 332 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 333 | 333 | ||
| 334 | BT_DBG("%s", hdev->name); | 334 | BT_DBG("%s", hdev->name); |
| 335 | 335 | ||
| @@ -343,7 +343,7 @@ static int bpa10x_close(struct hci_dev *hdev) · 7 unmodified lines | |||
| 343 | 343 | ||
| 344 | static int bpa10x_flush(struct hci_dev *hdev) | 344 | static int bpa10x_flush(struct hci_dev *hdev) |
| 345 | { | 345 | { |
| 346 | struct bpa10x_data *data = hdev->driver_data; | 346 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 347 | 347 | ||
| 348 | BT_DBG("%s", hdev->name); | 348 | BT_DBG("%s", hdev->name); |
| 349 | 349 | ||
| @@ -355,7 +355,7 @@ static int bpa10x_flush(struct hci_dev *hdev) · 5 unmodified lines | |||
| 355 | static int bpa10x_send_frame(struct sk_buff *skb) | 355 | static int bpa10x_send_frame(struct sk_buff *skb) |
| 356 | { | 356 | { |
| 357 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 357 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
| 358 | struct bpa10x_data *data = hdev->driver_data; | 358 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
| 359 | struct usb_ctrlrequest *dr; | 359 | struct usb_ctrlrequest *dr; |
| 360 | struct urb *urb; | 360 | struct urb *urb; |
| 361 | unsigned int pipe; | 361 | unsigned int pipe; |
| @@ -432,17 +432,6 @@ static int bpa10x_send_frame(struct sk_buff *skb) · 70 unmodified lines | |||
| 432 | return 0; | 432 | return 0; |
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | static void bpa10x_destruct(struct hci_dev *hdev) | ||
| 436 | { | ||
| 437 | struct bpa10x_data *data = hdev->driver_data; | ||
| 438 | |||
| 439 | BT_DBG("%s", hdev->name); | ||
| 440 | |||
| 441 | kfree_skb(data->rx_skb[0]); | ||
| 442 | kfree_skb(data->rx_skb[1]); | ||
| 443 | kfree(data); | ||
| 444 | } | ||
| 445 | |||
| 446 | static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *id) | 435 | static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *id) |
| 447 | { | 436 | { |
| 448 | struct bpa10x_data *data; | 437 | struct bpa10x_data *data; |
| @@ -470,7 +459,7 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * · 21 unmodified lines | |||
| 470 | } | 459 | } |
| 471 | 460 | ||
| 472 | hdev->bus = HCI_USB; | 461 | hdev->bus = HCI_USB; |
| 473 | hdev->driver_data = data; | 462 | hci_set_drvdata(hdev, data); |
| 474 | 463 | ||
| 475 | data->hdev = hdev; | 464 | data->hdev = hdev; |
| 476 | 465 | ||
| @@ -480,9 +469,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * · 3 unmodified lines | |||
| 480 | hdev->close = bpa10x_close; | 469 | hdev->close = bpa10x_close; |
| 481 | hdev->flush = bpa10x_flush; | 470 | hdev->flush = bpa10x_flush; |
| 482 | hdev->send = bpa10x_send_frame; | 471 | hdev->send = bpa10x_send_frame; |
| 483 | hdev->destruct = bpa10x_destruct; | ||
| 484 | |||
| 485 | hdev->owner = THIS_MODULE; | ||
| 486 | 472 | ||
| 487 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | 473 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); |
| 488 | 474 | ||
| @@ -512,6 +498,9 @@ static void bpa10x_disconnect(struct usb_interface *intf) · 23 unmodified lines | |||
| 512 | hci_unregister_dev(data->hdev); | 498 | hci_unregister_dev(data->hdev); |
| 513 | 499 | ||
| 514 | hci_free_dev(data->hdev); | 500 | hci_free_dev(data->hdev); |
| 501 | kfree_skb(data->rx_skb[0]); | ||
| 502 | kfree_skb(data->rx_skb[1]); | ||
| 503 | kfree(data); | ||
| 515 | } | 504 | } |
| 516 | 505 | ||
| 517 | static struct usb_driver bpa10x_driver = { | 506 | static struct usb_driver bpa10x_driver = { |
| @@ -389,7 +389,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst) · 388 unmodified lines | |||
| 389 | 389 | ||
| 390 | static int bt3c_hci_flush(struct hci_dev *hdev) | 390 | static int bt3c_hci_flush(struct hci_dev *hdev) |
| 391 | { | 391 | { |
| 392 | bt3c_info_t *info = (bt3c_info_t *)(hdev->driver_data); | 392 | bt3c_info_t *info = hci_get_drvdata(hdev); |
| 393 | 393 | ||
| 394 | /* Drop TX queue */ | 394 | /* Drop TX queue */ |
| 395 | skb_queue_purge(&(info->txq)); | 395 | skb_queue_purge(&(info->txq)); |
| @@ -428,7 +428,7 @@ static int bt3c_hci_send_frame(struct sk_buff *skb) · 32 unmodified lines | |||
| 428 | return -ENODEV; | 428 | return -ENODEV; |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | info = (bt3c_info_t *) (hdev->driver_data); | 431 | info = hci_get_drvdata(hdev); |
| 432 | 432 | ||
| 433 | switch (bt_cb(skb)->pkt_type) { | 433 | switch (bt_cb(skb)->pkt_type) { |
| 434 | case HCI_COMMAND_PKT: | 434 | case HCI_COMMAND_PKT: |
| @@ -456,11 +456,6 @@ static int bt3c_hci_send_frame(struct sk_buff *skb) · 21 unmodified lines | |||
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | 458 | ||
| 459 | static void bt3c_hci_destruct(struct hci_dev *hdev) | ||
| 460 | { | ||
| 461 | } | ||
| 462 | |||
| 463 | |||
| 464 | static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) | 459 | static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) |
| 465 | { | 460 | { |
| 466 | return -ENOIOCTLCMD; | 461 | return -ENOIOCTLCMD; |
| @@ -580,18 +575,15 @@ static int bt3c_open(bt3c_info_t *info) · 113 unmodified lines | |||
| 580 | info->hdev = hdev; | 575 | info->hdev = hdev; |
| 581 | 576 | ||
| 582 | hdev->bus = HCI_PCCARD; | 577 | hdev->bus = HCI_PCCARD; |
| 583 | hdev->driver_data = info; | 578 | hci_set_drvdata(hdev, info); |
| 584 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); | 579 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); |
| 585 | 580 | ||
| 586 | hdev->open = bt3c_hci_open; | 581 | hdev->open = bt3c_hci_open; |
| 587 | hdev->close = bt3c_hci_close; | 582 | hdev->close = bt3c_hci_close; |
| 588 | hdev->flush = bt3c_hci_flush; | 583 | hdev->flush = bt3c_hci_flush; |
| 589 | hdev->send = bt3c_hci_send_frame; | 584 | hdev->send = bt3c_hci_send_frame; |
| 590 | hdev->destruct = bt3c_hci_destruct; | ||
| 591 | hdev->ioctl = bt3c_hci_ioctl; | 585 | hdev->ioctl = bt3c_hci_ioctl; |
| 592 | 586 | ||
| 593 | hdev->owner = THIS_MODULE; | ||
| 594 | |||
| 595 | /* Load firmware */ | 587 | /* Load firmware */ |
| 596 | err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev); | 588 | err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev); |
| 597 | if (err < 0) { | 589 | if (err < 0) { |
| @@ -384,7 +384,7 @@ static const struct file_operations btmrvl_txdnldready_fops = { · 383 unmodified lines | |||
| 384 | 384 | ||
| 385 | void btmrvl_debugfs_init(struct hci_dev *hdev) | 385 | void btmrvl_debugfs_init(struct hci_dev *hdev) |
| 386 | { | 386 | { |
| 387 | struct btmrvl_private *priv = hdev->driver_data; | 387 | struct btmrvl_private *priv = hci_get_drvdata(hdev); |
| 388 | struct btmrvl_debugfs_data *dbg; | 388 | struct btmrvl_debugfs_data *dbg; |
| 389 | 389 | ||
| 390 | if (!hdev->debugfs) | 390 | if (!hdev->debugfs) |
| @@ -401,36 +401,34 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) · 10 unmodified lines | |||
| 401 | dbg->config_dir = debugfs_create_dir("config", hdev->debugfs); | 401 | dbg->config_dir = debugfs_create_dir("config", hdev->debugfs); |
| 402 | 402 | ||
| 403 | dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir, | 403 | dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir, |
| 404 | hdev->driver_data, &btmrvl_psmode_fops); | 404 | priv, &btmrvl_psmode_fops); |
| 405 | dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir, | 405 | dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir, |
| 406 | hdev->driver_data, &btmrvl_pscmd_fops); | 406 | priv, &btmrvl_pscmd_fops); |
| 407 | dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir, | 407 | dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir, |
| 408 | hdev->driver_data, &btmrvl_gpiogap_fops); | 408 | priv, &btmrvl_gpiogap_fops); |
| 409 | dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir, | 409 | dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir, |
| 410 | hdev->driver_data, &btmrvl_hsmode_fops); | 410 | priv, &btmrvl_hsmode_fops); |
| 411 | dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir, | 411 | dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir, |
| 412 | hdev->driver_data, &btmrvl_hscmd_fops); | 412 | priv, &btmrvl_hscmd_fops); |
| 413 | dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir, | 413 | dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir, |
| 414 | hdev->driver_data, &btmrvl_hscfgcmd_fops); | 414 | priv, &btmrvl_hscfgcmd_fops); |
| 415 | 415 | ||
| 416 | dbg->status_dir = debugfs_create_dir("status", hdev->debugfs); | 416 | dbg->status_dir = debugfs_create_dir("status", hdev->debugfs); |
| 417 | dbg->curpsmode = debugfs_create_file("curpsmode", 0444, | 417 | dbg->curpsmode = debugfs_create_file("curpsmode", 0444, |
| 418 | dbg->status_dir, | 418 | dbg->status_dir, priv, |
| 419 | hdev->driver_data, | 419 | &btmrvl_curpsmode_fops); |
| 420 | &btmrvl_curpsmode_fops); | ||
| 421 | dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir, | 420 | dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir, |
| 422 | hdev->driver_data, &btmrvl_psstate_fops); | 421 | priv, &btmrvl_psstate_fops); |
| 423 | dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir, | 422 | dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir, |
| 424 | hdev->driver_data, &btmrvl_hsstate_fops); | 423 | priv, &btmrvl_hsstate_fops); |
| 425 | dbg->txdnldready = debugfs_create_file("txdnldready", 0444, | 424 | dbg->txdnldready = debugfs_create_file("txdnldready", 0444, |
| 426 | dbg->status_dir, | 425 | dbg->status_dir, priv, |
| 427 | hdev->driver_data, | 426 | &btmrvl_txdnldready_fops); |
| 428 | &btmrvl_txdnldready_fops); | ||
| 429 | } | 427 | } |
| 430 | 428 | ||
| 431 | void btmrvl_debugfs_remove(struct hci_dev *hdev) | 429 | void btmrvl_debugfs_remove(struct hci_dev *hdev) |
| 432 | { | 430 | { |
| 433 | struct btmrvl_private *priv = hdev->driver_data; | 431 | struct btmrvl_private *priv = hci_get_drvdata(hdev); |
| 434 | struct btmrvl_debugfs_data *dbg = priv->debugfs_data; | 432 | struct btmrvl_debugfs_data *dbg = priv->debugfs_data; |
| 435 | 433 | ||
| 436 | if (!dbg) | 434 | if (!dbg) |
| @@ -387,10 +387,6 @@ static int btmrvl_ioctl(struct hci_dev *hdev, · 386 unmodified lines | |||
| 387 | return -ENOIOCTLCMD; | 387 | return -ENOIOCTLCMD; |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | static void btmrvl_destruct(struct hci_dev *hdev) | ||
| 391 | { | ||
| 392 | } | ||
| 393 | |||
| 394 | static int btmrvl_send_frame(struct sk_buff *skb) | 390 | static int btmrvl_send_frame(struct sk_buff *skb) |
| 395 | { | 391 | { |
| 396 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 392 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
| @@ -398,12 +394,13 @@ static int btmrvl_send_frame(struct sk_buff *skb) · 1 unmodified line | |||
| 398 | 394 | ||
| 399 | BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len); | 395 | BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len); |
| 400 | 396 | ||
| 401 | if (!hdev || !hdev->driver_data) { | 397 | if (!hdev) { |
| 402 | BT_ERR("Frame for unknown HCI device"); | 398 | BT_ERR("Frame for unknown HCI device"); |
| 403 | return -ENODEV; | 399 | return -ENODEV; |
| 404 | } | 400 | } |
| 405 | 401 | ||
| 406 | priv = (struct btmrvl_private *) hdev->driver_data; | 402 | priv = hci_get_drvdata(hdev); |
| 403 | |||
| 407 | if (!test_bit(HCI_RUNNING, &hdev->flags)) { | 404 | if (!test_bit(HCI_RUNNING, &hdev->flags)) { |
| 408 | BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags); | 405 | BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags); |
| 409 | print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET, | 406 | print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET, |
| @@ -434,7 +431,7 @@ static int btmrvl_send_frame(struct sk_buff *skb) · 24 unmodified lines | |||
| 434 | 431 | ||
| 435 | static int btmrvl_flush(struct hci_dev *hdev) | 432 | static int btmrvl_flush(struct hci_dev *hdev) |
| 436 | { | 433 | { |
| 437 | struct btmrvl_private *priv = hdev->driver_data; | 434 | struct btmrvl_private *priv = hci_get_drvdata(hdev); |
| 438 | 435 | ||
| 439 | skb_queue_purge(&priv->adapter->tx_queue); | 436 | skb_queue_purge(&priv->adapter->tx_queue); |
| 440 | 437 | ||
| @@ -443,7 +440,7 @@ static int btmrvl_flush(struct hci_dev *hdev) · 2 unmodified lines | |||
| 443 | 440 | ||
| 444 | static int btmrvl_close(struct hci_dev *hdev) | 441 | static int btmrvl_close(struct hci_dev *hdev) |
| 445 | { | 442 | { |
| 446 | struct btmrvl_private *priv = hdev->driver_data; | 443 | struct btmrvl_private *priv = hci_get_drvdata(hdev); |
| 447 | 444 | ||
| 448 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | 445 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) |
| 449 | return 0; | 446 | return 0; |
| @@ -546,16 +543,14 @@ int btmrvl_register_hdev(struct btmrvl_private *priv) · 96 unmodified lines | |||
| 546 | } | 543 | } |
| 547 | 544 | ||
| 548 | priv->btmrvl_dev.hcidev = hdev; | 545 | priv->btmrvl_dev.hcidev = hdev; |
| 549 | hdev->driver_data = priv; | 546 | hci_set_drvdata(hdev, priv); |
| 550 | 547 | ||
| 551 | hdev->bus = HCI_SDIO; | 548 | hdev->bus = HCI_SDIO; |
| 552 | hdev->open = btmrvl_open; | 549 | hdev->open = btmrvl_open; |
| 553 | hdev->close = btmrvl_close; | 550 | hdev->close = btmrvl_close; |
| 554 | hdev->flush = btmrvl_flush; | 551 | hdev->flush = btmrvl_flush; |
| 555 | hdev->send = btmrvl_send_frame; | 552 | hdev->send = btmrvl_send_frame; |
| 556 | hdev->destruct = btmrvl_destruct; | ||
| 557 | hdev->ioctl = btmrvl_ioctl; | 553 | hdev->ioctl = btmrvl_ioctl; |
| 558 | hdev->owner = THIS_MODULE; | ||
| 559 | 554 | ||
| 560 | btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); | 555 | btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); |
| 561 | 556 | ||
| @@ -189,7 +189,7 @@ static void btsdio_interrupt(struct sdio_func *func) · 188 unmodified lines | |||
| 189 | 189 | ||
| 190 | static int btsdio_open(struct hci_dev *hdev) | 190 | static int btsdio_open(struct hci_dev *hdev) |
| 191 | { | 191 | { |
| 192 | struct btsdio_data *data = hdev->driver_data; | 192 | struct btsdio_data *data = hci_get_drvdata(hdev); |
| 193 | int err; | 193 | int err; |
| 194 | 194 | ||
| 195 | BT_DBG("%s", hdev->name); | 195 | BT_DBG("%s", hdev->name); |
| @@ -225,7 +225,7 @@ release: · 29 unmodified lines | |||
| 225 | 225 | ||
| 226 | static int btsdio_close(struct hci_dev *hdev) | 226 | static int btsdio_close(struct hci_dev *hdev) |
| 227 | { | 227 | { |
| 228 | struct btsdio_data *data = hdev->driver_data; | 228 | struct btsdio_data *data = hci_get_drvdata(hdev); |
| 229 | 229 | ||
| 230 | BT_DBG("%s", hdev->name); | 230 | BT_DBG("%s", hdev->name); |
| 231 | 231 | ||
| @@ -246,7 +246,7 @@ static int btsdio_close(struct hci_dev *hdev) · 14 unmodified lines | |||
| 246 | 246 | ||
| 247 | static int btsdio_flush(struct hci_dev *hdev) | 247 | static int btsdio_flush(struct hci_dev *hdev) |
| 248 | { | 248 | { |
| 249 | struct btsdio_data *data = hdev->driver_data; | 249 | struct btsdio_data *data = hci_get_drvdata(hdev); |
| 250 | 250 | ||
| 251 | BT_DBG("%s", hdev->name); | 251 | BT_DBG("%s", hdev->name); |
| 252 | 252 | ||
| @@ -258,7 +258,7 @@ static int btsdio_flush(struct hci_dev *hdev) · 5 unmodified lines | |||
| 258 | static int btsdio_send_frame(struct sk_buff *skb) | 258 | static int btsdio_send_frame(struct sk_buff *skb) |
| 259 | { | 259 | { |
| 260 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 260 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
| 261 | struct btsdio_data *data = hdev->driver_data; | 261 | struct btsdio_data *data = hci_get_drvdata(hdev); |
| 262 | 262 | ||
| 263 | BT_DBG("%s", hdev->name); | 263 | BT_DBG("%s", hdev->name); |
| 264 | 264 | ||
| @@ -289,15 +289,6 @@ static int btsdio_send_frame(struct sk_buff *skb) · 24 unmodified lines | |||
| 289 | return 0; | 289 | return 0; |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | static void btsdio_destruct(struct hci_dev *hdev) | ||
| 293 | { | ||
| 294 | struct btsdio_data *data = hdev->driver_data; | ||
| 295 | |||
| 296 | BT_DBG("%s", hdev->name); | ||
| 297 | |||
| 298 | kfree(data); | ||
| 299 | } | ||
| 300 | |||
| 301 | static int btsdio_probe(struct sdio_func *func, | 292 | static int btsdio_probe(struct sdio_func *func, |
| 302 | const struct sdio_device_id *id) | 293 | const struct sdio_device_id *id) |
| 303 | { | 294 | { |
| @@ -330,7 +321,7 @@ static int btsdio_probe(struct sdio_func *func, · 26 unmodified lines | |||
| 330 | } | 321 | } |
| 331 | 322 | ||
| 332 | hdev->bus = HCI_SDIO; | 323 | hdev->bus = HCI_SDIO; |
| 333 | hdev->driver_data = data; | 324 | hci_set_drvdata(hdev, data); |
| 334 | 325 | ||
| 335 | if (id->class == SDIO_CLASS_BT_AMP) | 326 | if (id->class == SDIO_CLASS_BT_AMP) |
| 336 | hdev->dev_type = HCI_AMP; | 327 | hdev->dev_type = HCI_AMP; |
| @@ -345,9 +336,6 @@ static int btsdio_probe(struct sdio_func *func, · 8 unmodified lines | |||
| 345 | hdev->close = btsdio_close; | 336 | hdev->close = btsdio_close; |
| 346 | hdev->flush = btsdio_flush; | 337 | hdev->flush = btsdio_flush; |
| 347 | hdev->send = btsdio_send_frame; | 338 | hdev->send = btsdio_send_frame; |
| 348 | hdev->destruct = btsdio_destruct; | ||
| 349 | |||
| 350 | hdev->owner = THIS_MODULE; | ||
| 351 | 339 | ||
| 352 | err = hci_register_dev(hdev); | 340 | err = hci_register_dev(hdev); |
| 353 | if (err < 0) { | 341 | if (err < 0) { |
| @@ -378,6 +366,7 @@ static void btsdio_remove(struct sdio_func *func) · 24 unmodified lines | |||
| 378 | hci_unregister_dev(hdev); | 366 | hci_unregister_dev(hdev); |
| 379 | 367 | ||
| 380 | hci_free_dev(hdev); | 368 | hci_free_dev(hdev); |
| 369 | kfree(data); | ||
| 381 | } | 370 | } |
| 382 | 371 | ||
| 383 | static struct sdio_driver btsdio_driver = { | 372 | static struct sdio_driver btsdio_driver = { |
| @@ -397,7 +397,7 @@ static void btuart_change_speed(btuart_info_t *info, unsigned int speed) · 396 unmodified lines | |||
| 397 | 397 | ||
| 398 | static int btuart_hci_flush(struct hci_dev *hdev) | 398 | static int btuart_hci_flush(struct hci_dev *hdev) |
| 399 | { | 399 | { |
| 400 | btuart_info_t *info = (btuart_info_t *)(hdev->driver_data); | 400 | btuart_info_t *info = hci_get_drvdata(hdev); |
| 401 | 401 | ||
| 402 | /* Drop TX queue */ | 402 | /* Drop TX queue */ |
| 403 | skb_queue_purge(&(info->txq)); | 403 | skb_queue_purge(&(info->txq)); |
| @@ -435,7 +435,7 @@ static int btuart_hci_send_frame(struct sk_buff *skb) · 31 unmodified lines | |||
| 435 | return -ENODEV; | 435 | return -ENODEV; |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | info = (btuart_info_t *)(hdev->driver_data); | 438 | info = hci_get_drvdata(hdev); |
| 439 | 439 | ||
| 440 | switch (bt_cb(skb)->pkt_type) { | 440 | switch (bt_cb(skb)->pkt_type) { |
| 441 | case HCI_COMMAND_PKT: | 441 | case HCI_COMMAND_PKT: |
| @@ -459,11 +459,6 @@ static int btuart_hci_send_frame(struct sk_buff *skb) · 17 unmodified lines | |||
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | 461 | ||
| 462 | static void btuart_hci_destruct(struct hci_dev *hdev) | ||
| 463 | { | ||
| 464 | } | ||
| 465 | |||
| 466 | |||
| 467 | static int btuart_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) | 462 | static int btuart_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) |
| 468 | { | 463 | { |
| 469 | return -ENOIOCTLCMD; | 464 | return -ENOIOCTLCMD; |
| @@ -498,18 +493,15 @@ static int btuart_open(btuart_info_t *info) · 28 unmodified lines | |||
| 498 | info->hdev = hdev; | 493 | info->hdev = hdev; |
| 499 | 494 | ||
| 500 | hdev->bus = HCI_PCCARD; | 495 | hdev->bus = HCI_PCCARD; |
| 501 | hdev->driver_data = info; | 496 | hci_set_drvdata(hdev, info); |
| 502 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); | 497 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); |
| 503 | 498 | ||
| 504 | hdev->open = btuart_hci_open; | 499 | hdev->open = btuart_hci_open; |
| 505 | hdev->close = btuart_hci_close; | 500 | hdev->close = btuart_hci_close; |
| 506 | hdev->flush = btuart_hci_flush; | 501 | hdev->flush = btuart_hci_flush; |
| 507 | hdev->send = btuart_hci_send_frame; | 502 | hdev->send = btuart_hci_send_frame; |
| 508 | hdev->destruct = btuart_hci_destruct; | ||
| 509 | hdev->ioctl = btuart_hci_ioctl; | 503 | hdev->ioctl = btuart_hci_ioctl; |
| 510 | 504 | ||
| 511 | hdev->owner = THIS_MODULE; | ||
| 512 | |||
| 513 | spin_lock_irqsave(&(info->lock), flags); | 505 | spin_lock_irqsave(&(info->lock), flags); |
| 514 | 506 | ||
| 515 | /* Reset UART */ | 507 | /* Reset UART */ |
| @@ -102,6 +102,7 @@ static struct usb_device_id btusb_table[] = { · 101 unmodified lines | |||
| 102 | 102 | ||
| 103 | /* Broadcom BCM20702A0 */ | 103 | /* Broadcom BCM20702A0 */ |
| 104 | { USB_DEVICE(0x0a5c, 0x21e3) }, | 104 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
| 105 | { USB_DEVICE(0x0a5c, 0x21e6) }, | ||
| 105 | { USB_DEVICE(0x0a5c, 0x21f3) }, | 106 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
| 106 | { USB_DEVICE(0x413c, 0x8197) }, | 107 | { USB_DEVICE(0x413c, 0x8197) }, |
| 107 | 108 | ||
| @@ -121,12 +122,14 @@ static struct usb_device_id blacklist_table[] = { · 13 unmodified lines | |||
| 121 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, | 122 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, |
| 122 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, | 123 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, |
| 123 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, | 124 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, |
| 125 | { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, | ||
| 124 | 126 | ||
| 125 | /* Atheros AR9285 Malbec with sflash firmware */ | 127 | /* Atheros AR9285 Malbec with sflash firmware */ |
| 126 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | 128 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, |
| 127 | 129 | ||
| 128 | /* Atheros 3012 with sflash firmware */ | 130 | /* Atheros 3012 with sflash firmware */ |
| 129 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 131 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
| 132 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | ||
| 130 | 133 | ||
| 131 | /* Atheros AR5BBU12 with sflash firmware */ | 134 | /* Atheros AR5BBU12 with sflash firmware */ |
| 132 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 135 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
| @@ -243,7 +246,7 @@ static int inc_tx(struct btusb_data *data) · 110 unmodified lines | |||
| 243 | static void btusb_intr_complete(struct urb *urb) | 246 | static void btusb_intr_complete(struct urb *urb) |
| 244 | { | 247 | { |
| 245 | struct hci_dev *hdev = urb->context; | 248 | struct hci_dev *hdev = urb->context; |
| 246 | struct btusb_data *data = hdev->driver_data; | 249 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 247 | int err; | 250 | int err; |
| 248 | 251 | ||
| 249 | BT_DBG("%s urb %p status %d count %d", hdev->name, | 252 | BT_DBG("%s urb %p status %d count %d", hdev->name, |
| @@ -282,7 +285,7 @@ static void btusb_intr_complete(struct urb *urb) · 32 unmodified lines | |||
| 282 | 285 | ||
| 283 | static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) | 286 | static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) |
| 284 | { | 287 | { |
| 285 | struct btusb_data *data = hdev->driver_data; | 288 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 286 | struct urb *urb; | 289 | struct urb *urb; |
| 287 | unsigned char *buf; | 290 | unsigned char *buf; |
| 288 | unsigned int pipe; | 291 | unsigned int pipe; |
| @@ -331,7 +334,7 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · 42 unmodified lines | |||
| 331 | static void btusb_bulk_complete(struct urb *urb) | 334 | static void btusb_bulk_complete(struct urb *urb) |
| 332 | { | 335 | { |
| 333 | struct hci_dev *hdev = urb->context; | 336 | struct hci_dev *hdev = urb->context; |
| 334 | struct btusb_data *data = hdev->driver_data; | 337 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 335 | int err; | 338 | int err; |
| 336 | 339 | ||
| 337 | BT_DBG("%s urb %p status %d count %d", hdev->name, | 340 | BT_DBG("%s urb %p status %d count %d", hdev->name, |
| @@ -370,7 +373,7 @@ static void btusb_bulk_complete(struct urb *urb) · 32 unmodified lines | |||
| 370 | 373 | ||
| 371 | static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags) | 374 | static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags) |
| 372 | { | 375 | { |
| 373 | struct btusb_data *data = hdev->driver_data; | 376 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 374 | struct urb *urb; | 377 | struct urb *urb; |
| 375 | unsigned char *buf; | 378 | unsigned char *buf; |
| 376 | unsigned int pipe; | 379 | unsigned int pipe; |
| @@ -417,7 +420,7 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags) · 40 unmodified lines | |||
| 417 | static void btusb_isoc_complete(struct urb *urb) | 420 | static void btusb_isoc_complete(struct urb *urb) |
| 418 | { | 421 | { |
| 419 | struct hci_dev *hdev = urb->context; | 422 | struct hci_dev *hdev = urb->context; |
| 420 | struct btusb_data *data = hdev->driver_data; | 423 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 421 | int i, err; | 424 | int i, err; |
| 422 | 425 | ||
| 423 | BT_DBG("%s urb %p status %d count %d", hdev->name, | 426 | BT_DBG("%s urb %p status %d count %d", hdev->name, |
| @@ -484,7 +487,7 @@ static inline void __fill_isoc_descriptor(struct urb *urb, int len, int mtu) · 60 unmodified lines | |||
| 484 | 487 | ||
| 485 | static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) | 488 | static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) |
| 486 | { | 489 | { |
| 487 | struct btusb_data *data = hdev->driver_data; | 490 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 488 | struct urb *urb; | 491 | struct urb *urb; |
| 489 | unsigned char *buf; | 492 | unsigned char *buf; |
| 490 | unsigned int pipe; | 493 | unsigned int pipe; |
| @@ -537,7 +540,7 @@ static void btusb_tx_complete(struct urb *urb) · 46 unmodified lines | |||
| 537 | { | 540 | { |
| 538 | struct sk_buff *skb = urb->context; | 541 | struct sk_buff *skb = urb->context; |
| 539 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 542 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
| 540 | struct btusb_data *data = hdev->driver_data; | 543 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 541 | 544 | ||
| 542 | BT_DBG("%s urb %p status %d count %d", hdev->name, | 545 | BT_DBG("%s urb %p status %d count %d", hdev->name, |
| 543 | urb, urb->status, urb->actual_length); | 546 | urb, urb->status, urb->actual_length); |
| @@ -584,7 +587,7 @@ done: · 40 unmodified lines | |||
| 584 | 587 | ||
| 585 | static int btusb_open(struct hci_dev *hdev) | 588 | static int btusb_open(struct hci_dev *hdev) |
| 586 | { | 589 | { |
| 587 | struct btusb_data *data = hdev->driver_data; | 590 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 588 | int err; | 591 | int err; |
| 589 | 592 | ||
| 590 | BT_DBG("%s", hdev->name); | 593 | BT_DBG("%s", hdev->name); |
| @@ -634,7 +637,7 @@ static void btusb_stop_traffic(struct btusb_data *data) · 43 unmodified lines | |||
| 634 | 637 | ||
| 635 | static int btusb_close(struct hci_dev *hdev) | 638 | static int btusb_close(struct hci_dev *hdev) |
| 636 | { | 639 | { |
| 637 | struct btusb_data *data = hdev->driver_data; | 640 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 638 | int err; | 641 | int err; |
| 639 | 642 | ||
| 640 | BT_DBG("%s", hdev->name); | 643 | BT_DBG("%s", hdev->name); |
| @@ -664,7 +667,7 @@ failed: · 23 unmodified lines | |||
| 664 | 667 | ||
| 665 | static int btusb_flush(struct hci_dev *hdev) | 668 | static int btusb_flush(struct hci_dev *hdev) |
| 666 | { | 669 | { |
| 667 | struct btusb_data *data = hdev->driver_data; | 670 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 668 | 671 | ||
| 669 | BT_DBG("%s", hdev->name); | 672 | BT_DBG("%s", hdev->name); |
| 670 | 673 | ||
| @@ -676,7 +679,7 @@ static int btusb_flush(struct hci_dev *hdev) · 5 unmodified lines | |||
| 676 | static int btusb_send_frame(struct sk_buff *skb) | 679 | static int btusb_send_frame(struct sk_buff *skb) |
| 677 | { | 680 | { |
| 678 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 681 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
| 679 | struct btusb_data *data = hdev->driver_data; | 682 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 680 | struct usb_ctrlrequest *dr; | 683 | struct usb_ctrlrequest *dr; |
| 681 | struct urb *urb; | 684 | struct urb *urb; |
| 682 | unsigned int pipe; | 685 | unsigned int pipe; |
| @@ -784,18 +787,9 @@ done: · 101 unmodified lines | |||
| 784 | return err; | 787 | return err; |
| 785 | } | 788 | } |
| 786 | 789 | ||
| 787 | static void btusb_destruct(struct hci_dev *hdev) | ||
| 788 | { | ||
| 789 | struct btusb_data *data = hdev->driver_data; | ||
| 790 | |||
| 791 | BT_DBG("%s", hdev->name); | ||
| 792 | |||
| 793 | kfree(data); | ||
| 794 | } | ||
| 795 | |||
| 796 | static void btusb_notify(struct hci_dev *hdev, unsigned int evt) | 790 | static void btusb_notify(struct hci_dev *hdev, unsigned int evt) |
| 797 | { | 791 | { |
| 798 | struct btusb_data *data = hdev->driver_data; | 792 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 799 | 793 | ||
| 800 | BT_DBG("%s evt %d", hdev->name, evt); | 794 | BT_DBG("%s evt %d", hdev->name, evt); |
| 801 | 795 | ||
| @@ -807,7 +801,7 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt) · 5 unmodified lines | |||
| 807 | 801 | ||
| 808 | static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting) | 802 | static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting) |
| 809 | { | 803 | { |
| 810 | struct btusb_data *data = hdev->driver_data; | 804 | struct btusb_data *data = hci_get_drvdata(hdev); |
| 811 | struct usb_interface *intf = data->isoc; | 805 | struct usb_interface *intf = data->isoc; |
| 812 | struct usb_endpoint_descriptor *ep_desc; | 806 | struct usb_endpoint_descriptor *ep_desc; |
| 813 | int i, err; | 807 | int i, err; |
| @@ -995,7 +989,7 @@ static int btusb_probe(struct usb_interface *intf, · 181 unmodified lines | |||
| 995 | } | 989 | } |
| 996 | 990 | ||
| 997 | hdev->bus = HCI_USB; | 991 | hdev->bus = HCI_USB; |
| 998 | hdev->driver_data = data; | 992 | hci_set_drvdata(hdev, data); |
| 999 | 993 | ||
| 1000 | data->hdev = hdev; | 994 | data->hdev = hdev; |
| 1001 | 995 | ||
| @@ -1005,11 +999,8 @@ static int btusb_probe(struct usb_interface *intf, · 3 unmodified lines | |||
| 1005 | hdev->close = btusb_close; | 999 | hdev->close = btusb_close; |
| 1006 | hdev->flush = btusb_flush; | 1000 | hdev->flush = btusb_flush; |
| 1007 | hdev->send = btusb_send_frame; | 1001 | hdev->send = btusb_send_frame; |
| 1008 | hdev->destruct = btusb_destruct; | ||
| 1009 | hdev->notify = btusb_notify; | 1002 | hdev->notify = btusb_notify; |
| 1010 | 1003 | ||
| 1011 | hdev->owner = THIS_MODULE; | ||
| 1012 | |||
| 1013 | /* Interface numbers are hardcoded in the specification */ | 1004 | /* Interface numbers are hardcoded in the specification */ |
| 1014 | data->isoc = usb_ifnum_to_if(data->udev, 1); | 1005 | data->isoc = usb_ifnum_to_if(data->udev, 1); |
| 1015 | 1006 | ||
| @@ -1091,9 +1082,6 @@ static void btusb_disconnect(struct usb_interface *intf) · 75 unmodified lines | |||
| 1091 | return; | 1082 | return; |
| 1092 | 1083 | ||
| 1093 | hdev = data->hdev; | 1084 | hdev = data->hdev; |
| 1094 | |||
| 1095 | __hci_dev_hold(hdev); | ||
| 1096 | |||
| 1097 | usb_set_intfdata(data->intf, NULL); | 1085 | usb_set_intfdata(data->intf, NULL); |
| 1098 | 1086 | ||
| 1099 | if (data->isoc) | 1087 | if (data->isoc) |
| @@ -1106,9 +1094,8 @@ static void btusb_disconnect(struct usb_interface *intf) · 6 unmodified lines | |||
| 1106 | else if (data->isoc) | 1094 | else if (data->isoc) |
| 1107 | usb_driver_release_interface(&btusb_driver, data->isoc); | 1095 | usb_driver_release_interface(&btusb_driver, data->isoc); |
| 1108 | 1096 | ||
| 1109 | __hci_dev_put(hdev); | ||
| 1110 | |||
| 1111 | hci_free_dev(hdev); | 1097 | hci_free_dev(hdev); |
| 1098 | kfree(data); | ||
| 1112 | } | 1099 | } |
| 1113 | 1100 | ||
| 1114 | #ifdef CONFIG_PM | 1101 | #ifdef CONFIG_PM |
| @@ -161,7 +161,7 @@ static int ti_st_open(struct hci_dev *hdev) · 160 unmodified lines | |||
| 161 | return -EBUSY; | 161 | return -EBUSY; |
| 162 | 162 | ||
| 163 | /* provide contexts for callbacks from ST */ | 163 | /* provide contexts for callbacks from ST */ |
| 164 | hst = hdev->driver_data; | 164 | hst = hci_get_drvdata(hdev); |
| 165 | 165 | ||
| 166 | for (i = 0; i < MAX_BT_CHNL_IDS; i++) { | 166 | for (i = 0; i < MAX_BT_CHNL_IDS; i++) { |
| 167 | ti_st_proto[i].priv_data = hst; | 167 | ti_st_proto[i].priv_data = hst; |
| @@ -236,7 +236,7 @@ done: · 68 unmodified lines | |||
| 236 | static int ti_st_close(struct hci_dev *hdev) | 236 | static int ti_st_close(struct hci_dev *hdev) |
| 237 | { | 237 | { |
| 238 | int err, i; | 238 | int err, i; |
| 239 | struct ti_st *hst = hdev->driver_data; | 239 | struct ti_st *hst = hci_get_drvdata(hdev); |
| 240 | 240 | ||
| 241 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | 241 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) |
| 242 | return 0; | 242 | return 0; |
| @@ -264,7 +264,7 @@ static int ti_st_send_frame(struct sk_buff *skb) · 21 unmodified lines | |||
| 264 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 264 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
| 265 | return -EBUSY; | 265 | return -EBUSY; |
| 266 | 266 | ||
| 267 | hst = hdev->driver_data; | 267 | hst = hci_get_drvdata(hdev); |
| 268 | 268 | ||
| 269 | /* Prepend skb with frame type */ | 269 | /* Prepend skb with frame type */ |
| 270 | memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); | 270 | memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); |
| @@ -291,14 +291,6 @@ static int ti_st_send_frame(struct sk_buff *skb) · 20 unmodified lines | |||
| 291 | return 0; | 291 | return 0; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | static void ti_st_destruct(struct hci_dev *hdev) | ||
| 295 | { | ||
| 296 | BT_DBG("%s", hdev->name); | ||
| 297 | /* do nothing here, since platform remove | ||
| 298 | * would free the hdev->driver_data | ||
| 299 | */ | ||
| 300 | } | ||
| 301 | |||
| 302 | static int bt_ti_probe(struct platform_device *pdev) | 294 | static int bt_ti_probe(struct platform_device *pdev) |
| 303 | { | 295 | { |
| 304 | static struct ti_st *hst; | 296 | static struct ti_st *hst; |
| @@ -320,13 +312,11 @@ static int bt_ti_probe(struct platform_device *pdev) · 15 unmodified lines | |||
| 320 | 312 | ||
| 321 | hst->hdev = hdev; | 313 | hst->hdev = hdev; |
| 322 | hdev->bus = HCI_UART; | 314 | hdev->bus = HCI_UART; |
| 323 | hdev->driver_data = hst; | 315 | hci_set_drvdata(hdev, hst); |
| 324 | hdev->open = ti_st_open; | 316 | hdev->open = ti_st_open; |
| 325 | hdev->close = ti_st_close; | 317 | hdev->close = ti_st_close; |
| 326 | hdev->flush = NULL; | 318 | hdev->flush = NULL; |
| 327 | hdev->send = ti_st_send_frame; | 319 | hdev->send = ti_st_send_frame; |
| 328 | hdev->destruct = ti_st_destruct; | ||
| 329 | hdev->owner = THIS_MODULE; | ||
| 330 | 320 | ||
| 331 | err = hci_register_dev(hdev); | 321 | err = hci_register_dev(hdev); |
| 332 | if (err < 0) { | 322 | if (err < 0) { |
| @@ -83,9 +83,6 @@ typedef struct dtl1_info_t { · 82 unmodified lines | |||
| 83 | 83 | ||
| 84 | 84 | ||
| 85 | static int dtl1_config(struct pcmcia_device *link); | 85 | static int dtl1_config(struct pcmcia_device *link); |
| 86 | static void dtl1_release(struct pcmcia_device *link); | ||
| 87 | |||
| 88 | static void dtl1_detach(struct pcmcia_device *p_dev); | ||
| 89 | 86 | ||
| 90 | 87 | ||
| 91 | /* Transmit states */ | 88 | /* Transmit states */ |
| @@ -367,7 +364,7 @@ static int dtl1_hci_open(struct hci_dev *hdev) · 275 unmodified lines | |||
| 367 | 364 | ||
| 368 | static int dtl1_hci_flush(struct hci_dev *hdev) | 365 | static int dtl1_hci_flush(struct hci_dev *hdev) |
| 369 | { | 366 | { |
| 370 | dtl1_info_t *info = (dtl1_info_t *)(hdev->driver_data); | 367 | dtl1_info_t *info = hci_get_drvdata(hdev); |
| 371 | 368 | ||
| 372 | /* Drop TX queue */ | 369 | /* Drop TX queue */ |
| 373 | skb_queue_purge(&(info->txq)); | 370 | skb_queue_purge(&(info->txq)); |
| @@ -399,7 +396,7 @@ static int dtl1_hci_send_frame(struct sk_buff *skb) · 25 unmodified lines | |||
| 399 | return -ENODEV; | 396 | return -ENODEV; |
| 400 | } | 397 | } |
| 401 | 398 | ||
| 402 | info = (dtl1_info_t *)(hdev->driver_data); | 399 | info = hci_get_drvdata(hdev); |
| 403 | 400 | ||
| 404 | switch (bt_cb(skb)->pkt_type) { | 401 | switch (bt_cb(skb)->pkt_type) { |
| 405 | case HCI_COMMAND_PKT: | 402 | case HCI_COMMAND_PKT: |
| @@ -442,11 +439,6 @@ static int dtl1_hci_send_frame(struct sk_buff *skb) · 36 unmodified lines | |||
| 442 | } | 439 | } |
| 443 | 440 | ||
| 444 | 441 | ||
| 445 | static void dtl1_hci_destruct(struct hci_dev *hdev) | ||
| 446 | { | ||
| 447 | } | ||
| 448 | |||
| 449 | |||
| 450 | static int dtl1_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) | 442 | static int dtl1_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) |
| 451 | { | 443 | { |
| 452 | return -ENOIOCTLCMD; | 444 | return -ENOIOCTLCMD; |
| @@ -483,18 +475,15 @@ static int dtl1_open(dtl1_info_t *info) · 30 unmodified lines | |||
| 483 | info->hdev = hdev; | 475 | info->hdev = hdev; |
| 484 | 476 | ||
| 485 | hdev->bus = HCI_PCCARD; | 477 | hdev->bus = HCI_PCCARD; |
| 486 | hdev->driver_data = info; | 478 | hci_set_drvdata(hdev, info); |
| 487 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); | 479 | SET_HCIDEV_DEV(hdev, &info->p_dev->dev); |
| 488 | 480 | ||
| 489 | hdev->open = dtl1_hci_open; | 481 | hdev->open = dtl1_hci_open; |
| 490 | hdev->close = dtl1_hci_close; | 482 | hdev->close = dtl1_hci_close; |
| 491 | hdev->flush = dtl1_hci_flush; | 483 | hdev->flush = dtl1_hci_flush; |
| 492 | hdev->send = dtl1_hci_send_frame; | 484 | hdev->send = dtl1_hci_send_frame; |
| 493 | hdev->destruct = dtl1_hci_destruct; | ||
| 494 | hdev->ioctl = dtl1_hci_ioctl; | 485 | hdev->ioctl = dtl1_hci_ioctl; |
| 495 | 486 | ||
| 496 | hdev->owner = THIS_MODULE; | ||
| 497 | |||
| 498 | spin_lock_irqsave(&(info->lock), flags); | 487 | spin_lock_irqsave(&(info->lock), flags); |
| 499 | 488 | ||
| 500 | /* Reset UART */ | 489 | /* Reset UART */ |
| @@ -579,8 +568,8 @@ static void dtl1_detach(struct pcmcia_device *link) · 78 unmodified lines | |||
| 579 | { | 568 | { |
| 580 | dtl1_info_t *info = link->priv; | 569 | dtl1_info_t *info = link->priv; |
| 581 | 570 | ||
| 582 | dtl1_release(link); | 571 | dtl1_close(info); |
| 583 | 572 | pcmcia_disable_device(link); | |
| 584 | kfree(info); | 573 | kfree(info); |
| 585 | } | 574 | } |
| 586 | 575 | ||
| @@ -619,21 +608,10 @@ static int dtl1_config(struct pcmcia_device *link) · 32 unmodified lines | |||
| 619 | return 0; | 608 | return 0; |
| 620 | 609 | ||
| 621 | failed: | 610 | failed: |
| 622 | dtl1_release(link); | 611 | dtl1_detach(link); |
| 623 | return -ENODEV; | 612 | return -ENODEV; |
| 624 | } | 613 | } |
| 625 | 614 | ||
| 626 | |||
| 627 | static void dtl1_release(struct pcmcia_device *link) | ||
| 628 | { | ||
| 629 | dtl1_info_t *info = link->priv; | ||
| 630 | |||
| 631 | dtl1_close(info); | ||
| 632 | |||
| 633 | pcmcia_disable_device(link); | ||
| 634 | } | ||
| 635 | |||
| 636 | |||
| 637 | static const struct pcmcia_device_id dtl1_ids[] = { | 615 | static const struct pcmcia_device_id dtl1_ids[] = { |
| 638 | PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), | 616 | PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), |
| 639 | PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82), | 617 | PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82), |
| @@ -112,7 +112,7 @@ static int ath_open(struct hci_uart *hu) · 111 unmodified lines | |||
| 112 | 112 | ||
| 113 | BT_DBG("hu %p", hu); | 113 | BT_DBG("hu %p", hu); |
| 114 | 114 | ||
| 115 | ath = kzalloc(sizeof(*ath), GFP_ATOMIC); | 115 | ath = kzalloc(sizeof(*ath), GFP_KERNEL); |
| 116 | if (!ath) | 116 | if (!ath) |
| 117 | return -ENOMEM; | 117 | return -ENOMEM; |
| 118 | 118 | ||
| @@ -692,7 +692,7 @@ static int bcsp_open(struct hci_uart *hu) · 691 unmodified lines | |||
| 692 | 692 | ||
| 693 | BT_DBG("hu %p", hu); | 693 | BT_DBG("hu %p", hu); |
| 694 | 694 | ||
| 695 | bcsp = kzalloc(sizeof(*bcsp), GFP_ATOMIC); | 695 | bcsp = kzalloc(sizeof(*bcsp), GFP_KERNEL); |
| 696 | if (!bcsp) | 696 | if (!bcsp) |
| 697 | return -ENOMEM; | 697 | return -ENOMEM; |
| 698 | 698 | ||
| @@ -69,7 +69,7 @@ static int h4_open(struct hci_uart *hu) · 68 unmodified lines | |||
| 69 | 69 | ||
| 70 | BT_DBG("hu %p", hu); | 70 | BT_DBG("hu %p", hu); |
| 71 | 71 | ||
| 72 | h4 = kzalloc(sizeof(*h4), GFP_ATOMIC); | 72 | h4 = kzalloc(sizeof(*h4), GFP_KERNEL); |
| 73 | if (!h4) | 73 | if (!h4) |
| 74 | return -ENOMEM; | 74 | return -ENOMEM; |
| 75 | 75 | ||
| @@ -48,8 +48,6 @@ · 47 unmodified lines | |||
| 48 | 48 | ||
| 49 | #define VERSION "2.2" | 49 | #define VERSION "2.2" |
| 50 | 50 | ||
| 51 | static bool reset = 0; | ||
| 52 | |||
| 53 | static struct hci_uart_proto *hup[HCI_UART_MAX_PROTO]; | 51 | static struct hci_uart_proto *hup[HCI_UART_MAX_PROTO]; |
| 54 | 52 | ||
| 55 | int hci_uart_register_proto(struct hci_uart_proto *p) | 53 | int hci_uart_register_proto(struct hci_uart_proto *p) |
| @@ -174,7 +172,7 @@ static int hci_uart_open(struct hci_dev *hdev) · 118 unmodified lines | |||
| 174 | /* Reset device */ | 172 | /* Reset device */ |
| 175 | static int hci_uart_flush(struct hci_dev *hdev) | 173 | static int hci_uart_flush(struct hci_dev *hdev) |
| 176 | { | 174 | { |
| 177 | struct hci_uart *hu = (struct hci_uart *) hdev->driver_data; | 175 | struct hci_uart *hu = hci_get_drvdata(hdev); |
| 178 | struct tty_struct *tty = hu->tty; | 176 | struct tty_struct *tty = hu->tty; |
| 179 | 177 | ||
| 180 | BT_DBG("hdev %p tty %p", hdev, tty); | 178 | BT_DBG("hdev %p tty %p", hdev, tty); |
| @@ -220,7 +218,7 @@ static int hci_uart_send_frame(struct sk_buff *skb) · 39 unmodified lines | |||
| 220 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 218 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
| 221 | return -EBUSY; | 219 | return -EBUSY; |
| 222 | 220 | ||
| 223 | hu = (struct hci_uart *) hdev->driver_data; | 221 | hu = hci_get_drvdata(hdev); |
| 224 | 222 | ||
| 225 | BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); | 223 | BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); |
| 226 | 224 | ||
| @@ -231,15 +229,6 @@ static int hci_uart_send_frame(struct sk_buff *skb) · 4 unmodified lines | |||
| 231 | return 0; | 229 | return 0; |
| 232 | } | 230 | } |
| 233 | 231 | ||
| 234 | static void hci_uart_destruct(struct hci_dev *hdev) | ||
| 235 | { | ||
| 236 | if (!hdev) | ||
| 237 | return; | ||
| 238 | |||
| 239 | BT_DBG("%s", hdev->name); | ||
| 240 | kfree(hdev->driver_data); | ||
| 241 | } | ||
| 242 | |||
| 243 | /* ------ LDISC part ------ */ | 232 | /* ------ LDISC part ------ */ |
| 244 | /* hci_uart_tty_open | 233 | /* hci_uart_tty_open |
| 245 | * | 234 | * |
| @@ -316,6 +305,8 @@ static void hci_uart_tty_close(struct tty_struct *tty) · 70 unmodified lines | |||
| 316 | hci_free_dev(hdev); | 305 | hci_free_dev(hdev); |
| 317 | } | 306 | } |
| 318 | } | 307 | } |
| 308 | |||
| 309 | kfree(hu); | ||
| 319 | } | 310 | } |
| 320 | } | 311 | } |
| 321 | 312 | ||
| @@ -391,22 +382,24 @@ static int hci_uart_register_dev(struct hci_uart *hu) · 69 unmodified lines | |||
| 391 | hu->hdev = hdev; | 382 | hu->hdev = hdev; |
| 392 | 383 | ||
| 393 | hdev->bus = HCI_UART; | 384 | hdev->bus = HCI_UART; |
| 394 | hdev->driver_data = hu; | 385 | hci_set_drvdata(hdev, hu); |
| 395 | 386 | ||
| 396 | hdev->open = hci_uart_open; | 387 | hdev->open = hci_uart_open; |
| 397 | hdev->close = hci_uart_close; | 388 | hdev->close = hci_uart_close; |
| 398 | hdev->flush = hci_uart_flush; | 389 | hdev->flush = hci_uart_flush; |
| 399 | hdev->send = hci_uart_send_frame; | 390 | hdev->send = hci_uart_send_frame; |
| 400 | hdev->destruct = hci_uart_destruct; | ||
| 401 | hdev->parent = hu->tty->dev; | 391 | hdev->parent = hu->tty->dev; |
| 402 | 392 | ||
| 403 | hdev->owner = THIS_MODULE; | 393 | if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) |
| 394 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | ||
| 404 | 395 | ||
| 405 | if (!reset) | 396 | if (!test_bit(HCI_UART_RESET_ON_INIT, &hu->hdev_flags)) |
| 406 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | 397 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); |
| 407 | 398 | ||
| 408 | if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) | 399 | if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags)) |
| 409 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | 400 | hdev->dev_type = HCI_AMP; |
| 401 | else | ||
| 402 | hdev->dev_type = HCI_BREDR; | ||
| 410 | 403 | ||
| 411 | if (hci_register_dev(hdev) < 0) { | 404 | if (hci_register_dev(hdev) < 0) { |
| 412 | BT_ERR("Can't register HCI device"); | 405 | BT_ERR("Can't register HCI device"); |
| @@ -594,9 +587,6 @@ static void __exit hci_uart_exit(void) · 181 unmodified lines | |||
| 594 | module_init(hci_uart_init); | 587 | module_init(hci_uart_init); |
| 595 | module_exit(hci_uart_exit); | 588 | module_exit(hci_uart_exit); |
| 596 | 589 | ||
| 597 | module_param(reset, bool, 0644); | ||
| 598 | MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); | ||
| 599 | |||
| 600 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); | 590 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
| 601 | MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION); | 591 | MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION); |
| 602 | MODULE_VERSION(VERSION); | 592 | MODULE_VERSION(VERSION); |
| @@ -125,7 +125,7 @@ static int ll_open(struct hci_uart *hu) · 124 unmodified lines | |||
| 125 | 125 | ||
| 126 | BT_DBG("hu %p", hu); | 126 | BT_DBG("hu %p", hu); |
| 127 | 127 | ||
| 128 | ll = kzalloc(sizeof(*ll), GFP_ATOMIC); | 128 | ll = kzalloc(sizeof(*ll), GFP_KERNEL); |
| 129 | if (!ll) | 129 | if (!ll) |
| 130 | return -ENOMEM; | 130 | return -ENOMEM; |
| 131 | 131 | ||
| @@ -45,6 +45,8 @@ · 44 unmodified lines | |||
| 45 | #define HCI_UART_ATH3K 5 | 45 | #define HCI_UART_ATH3K 5 |
| 46 | 46 | ||
| 47 | #define HCI_UART_RAW_DEVICE 0 | 47 | #define HCI_UART_RAW_DEVICE 0 |
| 48 | #define HCI_UART_RESET_ON_INIT 1 | ||
| 49 | #define HCI_UART_CREATE_AMP 2 | ||
| 48 | 50 | ||
| 49 | struct hci_uart; | 51 | struct hci_uart; |
| 50 | 52 | ||
| @@ -61,7 +61,7 @@ static int vhci_open_dev(struct hci_dev *hdev) · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | static int vhci_close_dev(struct hci_dev *hdev) | 62 | static int vhci_close_dev(struct hci_dev *hdev) |
| 63 | { | 63 | { |
| 64 | struct vhci_data *data = hdev->driver_data; | 64 | struct vhci_data *data = hci_get_drvdata(hdev); |
| 65 | 65 | ||
| 66 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | 66 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) |
| 67 | return 0; | 67 | return 0; |
| @@ -73,7 +73,7 @@ static int vhci_close_dev(struct hci_dev *hdev) · 5 unmodified lines | |||
| 73 | 73 | ||
| 74 | static int vhci_flush(struct hci_dev *hdev) | 74 | static int vhci_flush(struct hci_dev *hdev) |
| 75 | { | 75 | { |
| 76 | struct vhci_data *data = hdev->driver_data; | 76 | struct vhci_data *data = hci_get_drvdata(hdev); |
| 77 | 77 | ||
| 78 | skb_queue_purge(&data->readq); | 78 | skb_queue_purge(&data->readq); |
| 79 | 79 | ||
| @@ -93,7 +93,7 @@ static int vhci_send_frame(struct sk_buff *skb) · 13 unmodified lines | |||
| 93 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 93 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
| 94 | return -EBUSY; | 94 | return -EBUSY; |
| 95 | 95 | ||
| 96 | data = hdev->driver_data; | 96 | data = hci_get_drvdata(hdev); |
| 97 | 97 | ||
| 98 | memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); | 98 | memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); |
| 99 | skb_queue_tail(&data->readq, skb); | 99 | skb_queue_tail(&data->readq, skb); |
| @@ -103,11 +103,6 @@ static int vhci_send_frame(struct sk_buff *skb) · 3 unmodified lines | |||
| 103 | return 0; | 103 | return 0; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | static void vhci_destruct(struct hci_dev *hdev) | ||
| 107 | { | ||
| 108 | kfree(hdev->driver_data); | ||
| 109 | } | ||
| 110 | |||
| 111 | static inline ssize_t vhci_get_user(struct vhci_data *data, | 106 | static inline ssize_t vhci_get_user(struct vhci_data *data, |
| 112 | const char __user *buf, size_t count) | 107 | const char __user *buf, size_t count) |
| 113 | { | 108 | { |
| @@ -239,7 +234,7 @@ static int vhci_open(struct inode *inode, struct file *file) · 125 unmodified lines | |||
| 239 | data->hdev = hdev; | 234 | data->hdev = hdev; |
| 240 | 235 | ||
| 241 | hdev->bus = HCI_VIRTUAL; | 236 | hdev->bus = HCI_VIRTUAL; |
| 242 | hdev->driver_data = data; | 237 | hci_set_drvdata(hdev, data); |
| 243 | 238 | ||
| 244 | if (amp) | 239 | if (amp) |
| 245 | hdev->dev_type = HCI_AMP; | 240 | hdev->dev_type = HCI_AMP; |
| @@ -248,9 +243,6 @@ static int vhci_open(struct inode *inode, struct file *file) · 2 unmodified lines | |||
| 248 | hdev->close = vhci_close_dev; | 243 | hdev->close = vhci_close_dev; |
| 249 | hdev->flush = vhci_flush; | 244 | hdev->flush = vhci_flush; |
| 250 | hdev->send = vhci_send_frame; | 245 | hdev->send = vhci_send_frame; |
| 251 | hdev->destruct = vhci_destruct; | ||
| 252 | |||
| 253 | hdev->owner = THIS_MODULE; | ||
| 254 | 246 | ||
| 255 | if (hci_register_dev(hdev) < 0) { | 247 | if (hci_register_dev(hdev) < 0) { |
| 256 | BT_ERR("Can't register HCI device"); | 248 | BT_ERR("Can't register HCI device"); |
| @@ -273,6 +265,7 @@ static int vhci_release(struct inode *inode, struct file *file) · 16 unmodified lines | |||
| 273 | hci_free_dev(hdev); | 265 | hci_free_dev(hdev); |
| 274 | 266 | ||
| 275 | file->private_data = NULL; | 267 | file->private_data = NULL; |
| 268 | kfree(data); | ||
| 276 | 269 | ||
| 277 | return 0; | 270 | return 0; |
| 278 | } | 271 | } |
| @@ -178,22 +178,26 @@ static void queue_req(struct addr_req *req) · 177 unmodified lines | |||
| 178 | mutex_unlock(&lock); | 178 | mutex_unlock(&lock); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | static int dst_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *addr) | 181 | static int dst_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr, void *daddr) |
| 182 | { | 182 | { |
| 183 | struct neighbour *n; | 183 | struct neighbour *n; |
| 184 | int ret; | 184 | int ret; |
| 185 | 185 | ||
| 186 | n = dst_neigh_lookup(dst, daddr); | ||
| 187 | |||
| 186 | rcu_read_lock(); | 188 | rcu_read_lock(); |
| 187 | n = dst_get_neighbour_noref(dst); | ||
| 188 | if (!n || !(n->nud_state & NUD_VALID)) { | 189 | if (!n || !(n->nud_state & NUD_VALID)) { |
| 189 | if (n) | 190 | if (n) |
| 190 | neigh_event_send(n, NULL); | 191 | neigh_event_send(n, NULL); |
| 191 | ret = -ENODATA; | 192 | ret = -ENODATA; |
| 192 | } else { | 193 | } else { |
| 193 | ret = rdma_copy_addr(addr, dst->dev, n->ha); | 194 | ret = rdma_copy_addr(dev_addr, dst->dev, n->ha); |
| 194 | } | 195 | } |
| 195 | rcu_read_unlock(); | 196 | rcu_read_unlock(); |
| 196 | 197 | ||
| 198 | if (n) | ||
| 199 | neigh_release(n); | ||
| 200 | |||
| 197 | return ret; | 201 | return ret; |
| 198 | } | 202 | } |
| 199 | 203 | ||
| @@ -232,7 +236,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, · 32 unmodified lines | |||
| 232 | goto put; | 236 | goto put; |
| 233 | } | 237 | } |
| 234 | 238 | ||
| 235 | ret = dst_fetch_ha(&rt->dst, addr); | 239 | ret = dst_fetch_ha(&rt->dst, addr, &fl4.daddr); |
| 236 | put: | 240 | put: |
| 237 | ip_rt_put(rt); | 241 | ip_rt_put(rt); |
| 238 | out: | 242 | out: |
| @@ -280,7 +284,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, · 41 unmodified lines | |||
| 280 | goto put; | 284 | goto put; |
| 281 | } | 285 | } |
| 282 | 286 | ||
| 283 | ret = dst_fetch_ha(dst, addr); | 287 | ret = dst_fetch_ha(dst, addr, &fl6.daddr); |
| 284 | put: | 288 | put: |
| 285 | dst_release(dst); | 289 | dst_release(dst); |
| 286 | return ret; | 290 | return ret; |
| @@ -147,9 +147,13 @@ static int ibnl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 146 unmodified lines | |||
| 147 | if (op < 0 || op >= client->nops || | 147 | if (op < 0 || op >= client->nops || |
| 148 | !client->cb_table[RDMA_NL_GET_OP(op)].dump) | 148 | !client->cb_table[RDMA_NL_GET_OP(op)].dump) |
| 149 | return -EINVAL; | 149 | return -EINVAL; |
| 150 | return netlink_dump_start(nls, skb, nlh, | 150 | |
| 151 | client->cb_table[op].dump, | 151 | { |
| 152 | NULL, 0); | 152 | struct netlink_dump_control c = { |
| 153 | .dump = client->cb_table[op].dump, | ||
| 154 | }; | ||
| 155 | return netlink_dump_start(nls, skb, nlh, &c); | ||
| 156 | } | ||
| 153 | } | 157 | } |
| 154 | } | 158 | } |
| 155 | 159 | ||
| @@ -1562,11 +1562,11 @@ static int import_ep(struct c4iw_ep *ep, __be32 peer_ip, struct dst_entry *dst, · 1561 unmodified lines | |||
| 1562 | struct neighbour *n; | 1562 | struct neighbour *n; |
| 1563 | int err, step; | 1563 | int err, step; |
| 1564 | 1564 | ||
| 1565 | rcu_read_lock(); | 1565 | n = dst_neigh_lookup(dst, &peer_ip); |
| 1566 | n = dst_get_neighbour_noref(dst); | ||
| 1567 | err = -ENODEV; | ||
| 1568 | if (!n) | 1566 | if (!n) |
| 1569 | goto out; | 1567 | return -ENODEV; |
| 1568 | |||
| 1569 | rcu_read_lock(); | ||
| 1570 | err = -ENOMEM; | 1570 | err = -ENOMEM; |
| 1571 | if (n->dev->flags & IFF_LOOPBACK) { | 1571 | if (n->dev->flags & IFF_LOOPBACK) { |
| 1572 | struct net_device *pdev; | 1572 | struct net_device *pdev; |
| @@ -1614,6 +1614,8 @@ static int import_ep(struct c4iw_ep *ep, __be32 peer_ip, struct dst_entry *dst, · 41 unmodified lines | |||
| 1614 | out: | 1614 | out: |
| 1615 | rcu_read_unlock(); | 1615 | rcu_read_unlock(); |
| 1616 | 1616 | ||
| 1617 | neigh_release(n); | ||
| 1618 | |||
| 1617 | return err; | 1619 | return err; |
| 1618 | } | 1620 | } |
| 1619 | 1621 | ||
| @@ -1351,8 +1351,9 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi · 1350 unmodified lines | |||
| 1351 | else | 1351 | else |
| 1352 | netdev = nesvnic->netdev; | 1352 | netdev = nesvnic->netdev; |
| 1353 | 1353 | ||
| 1354 | neigh = dst_neigh_lookup(&rt->dst, &dst_ip); | ||
| 1355 | |||
| 1354 | rcu_read_lock(); | 1356 | rcu_read_lock(); |
| 1355 | neigh = dst_get_neighbour_noref(&rt->dst); | ||
| 1356 | if (neigh) { | 1357 | if (neigh) { |
| 1357 | if (neigh->nud_state & NUD_VALID) { | 1358 | if (neigh->nud_state & NUD_VALID) { |
| 1358 | nes_debug(NES_DBG_CM, "Neighbor MAC address for 0x%08X" | 1359 | nes_debug(NES_DBG_CM, "Neighbor MAC address for 0x%08X" |
| @@ -1379,9 +1380,12 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi · 20 unmodified lines | |||
| 1379 | neigh_event_send(neigh, NULL); | 1380 | neigh_event_send(neigh, NULL); |
| 1380 | } | 1381 | } |
| 1381 | } | 1382 | } |
| 1382 | |||
| 1383 | out: | 1383 | out: |
| 1384 | rcu_read_unlock(); | 1384 | rcu_read_unlock(); |
| 1385 | |||
| 1386 | if (neigh) | ||
| 1387 | neigh_release(neigh); | ||
| 1388 | |||
| 1385 | ip_rt_put(rt); | 1389 | ip_rt_put(rt); |
| 1386 | return rc; | 1390 | return rc; |
| 1387 | } | 1391 | } |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | * | 4 | * |
| 5 | * Author Fritz Elfert | 5 | * Author Fritz Elfert |
| 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
| 7 | * | 7 | * |
| 8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
| 9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
| 10 | * | 10 | * |
| @@ -40,21 +40,21 @@ · 29 unmodified lines | |||
| 40 | /* Struct for adding new cards */ | 40 | /* Struct for adding new cards */ |
| 41 | typedef struct act2000_cdef { | 41 | typedef struct act2000_cdef { |
| 42 | int bus; | 42 | int bus; |
| 43 | int port; | 43 | int port; |
| 44 | int irq; | 44 | int irq; |
| 45 | char id[10]; | 45 | char id[10]; |
| 46 | } act2000_cdef; | 46 | } act2000_cdef; |
| 47 | 47 | ||
| 48 | /* Struct for downloading firmware */ | 48 | /* Struct for downloading firmware */ |
| 49 | typedef struct act2000_ddef { | 49 | typedef struct act2000_ddef { |
| 50 | int length; /* Length of code */ | 50 | int length; /* Length of code */ |
| 51 | char __user *buffer; /* Ptr. to code */ | 51 | char __user *buffer; /* Ptr. to code */ |
| 52 | } act2000_ddef; | 52 | } act2000_ddef; |
| 53 | 53 | ||
| 54 | typedef struct act2000_fwid { | 54 | typedef struct act2000_fwid { |
| 55 | char isdn[4]; | 55 | char isdn[4]; |
| 56 | char revlen[2]; | 56 | char revlen[2]; |
| 57 | char revision[504]; | 57 | char revision[504]; |
| 58 | } act2000_fwid; | 58 | } act2000_fwid; |
| 59 | 59 | ||
| 60 | #if defined(__KERNEL__) || defined(__DEBUGVAR__) | 60 | #if defined(__KERNEL__) || defined(__DEBUGVAR__) |
| @@ -128,8 +128,8 @@ typedef struct act2000_chan { · 67 unmodified lines | |||
| 128 | 128 | ||
| 129 | typedef struct msn_entry { | 129 | typedef struct msn_entry { |
| 130 | char eaz; | 130 | char eaz; |
| 131 | char msn[16]; | 131 | char msn[16]; |
| 132 | struct msn_entry * next; | 132 | struct msn_entry *next; |
| 133 | } msn_entry; | 133 | } msn_entry; |
| 134 | 134 | ||
| 135 | typedef struct irq_data_isa { | 135 | typedef struct irq_data_isa { |
| @@ -183,17 +183,17 @@ typedef struct act2000_card { · 47 unmodified lines | |||
| 183 | 183 | ||
| 184 | static inline void act2000_schedule_tx(act2000_card *card) | 184 | static inline void act2000_schedule_tx(act2000_card *card) |
| 185 | { | 185 | { |
| 186 | schedule_work(&card->snd_tq); | 186 | schedule_work(&card->snd_tq); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | static inline void act2000_schedule_rx(act2000_card *card) | 189 | static inline void act2000_schedule_rx(act2000_card *card) |
| 190 | { | 190 | { |
| 191 | schedule_work(&card->rcv_tq); | 191 | schedule_work(&card->rcv_tq); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static inline void act2000_schedule_poll(act2000_card *card) | 194 | static inline void act2000_schedule_poll(act2000_card *card) |
| 195 | { | 195 | { |
| 196 | schedule_work(&card->poll_tq); | 196 | schedule_work(&card->poll_tq); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | extern char *act2000_find_eaz(act2000_card *, char); | 199 | extern char *act2000_find_eaz(act2000_card *, char); |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | * | 4 | * |
| 5 | * Author Fritz Elfert | 5 | * Author Fritz Elfert |
| 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
| 7 | * | 7 | * |
| 8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
| 9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
| 10 | * | 10 | * |
| @@ -25,99 +25,99 @@ · 14 unmodified lines | |||
| 25 | static int | 25 | static int |
| 26 | act2000_isa_reset(unsigned short portbase) | 26 | act2000_isa_reset(unsigned short portbase) |
| 27 | { | 27 | { |
| 28 | unsigned char reg; | 28 | unsigned char reg; |
| 29 | int i; | 29 | int i; |
| 30 | int found; | 30 | int found; |
| 31 | int serial = 0; | 31 | int serial = 0; |
| 32 | 32 | ||
| 33 | found = 0; | 33 | found = 0; |
| 34 | if ((reg = inb(portbase + ISA_COR)) != 0xff) { | 34 | if ((reg = inb(portbase + ISA_COR)) != 0xff) { |
| 35 | outb(reg | ISA_COR_RESET, portbase + ISA_COR); | 35 | outb(reg | ISA_COR_RESET, portbase + ISA_COR); |
| 36 | mdelay(10); | 36 | mdelay(10); |
| 37 | outb(reg, portbase + ISA_COR); | 37 | outb(reg, portbase + ISA_COR); |
| 38 | mdelay(10); | 38 | mdelay(10); |
| 39 | 39 | ||
| 40 | for (i = 0; i < 16; i++) { | 40 | for (i = 0; i < 16; i++) { |
| 41 | if (inb(portbase + ISA_ISR) & ISA_ISR_SERIAL) | 41 | if (inb(portbase + ISA_ISR) & ISA_ISR_SERIAL) |
| 42 | serial |= 0x10000; | 42 | serial |= 0x10000; |
| 43 | serial >>= 1; | 43 | serial >>= 1; |
| 44 | } | 44 | } |
| 45 | if (serial == ISA_SER_ID) | 45 | if (serial == ISA_SER_ID) |
| 46 | found++; | 46 | found++; |
| 47 | } | 47 | } |
| 48 | return found; | 48 | return found; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | int | 51 | int |
| 52 | act2000_isa_detect(unsigned short portbase) | 52 | act2000_isa_detect(unsigned short portbase) |
| 53 | { | 53 | { |
| 54 | int ret = 0; | 54 | int ret = 0; |
| 55 | 55 | ||
| 56 | if (request_region(portbase, ACT2000_PORTLEN, "act2000isa")) { | 56 | if (request_region(portbase, ACT2000_PORTLEN, "act2000isa")) { |
| 57 | ret = act2000_isa_reset(portbase); | 57 | ret = act2000_isa_reset(portbase); |
| 58 | release_region(portbase, ISA_REGION); | 58 | release_region(portbase, ISA_REGION); |
| 59 | } | 59 | } |
| 60 | return ret; | 60 | return ret; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | static irqreturn_t | 63 | static irqreturn_t |
| 64 | act2000_isa_interrupt(int dummy, void *dev_id) | 64 | act2000_isa_interrupt(int dummy, void *dev_id) |
| 65 | { | 65 | { |
| 66 | act2000_card *card = dev_id; | 66 | act2000_card *card = dev_id; |
| 67 | u_char istatus; | 67 | u_char istatus; |
| 68 | 68 | ||
| 69 | istatus = (inb(ISA_PORT_ISR) & 0x07); | 69 | istatus = (inb(ISA_PORT_ISR) & 0x07); |
| 70 | if (istatus & ISA_ISR_OUT) { | 70 | if (istatus & ISA_ISR_OUT) { |
| 71 | /* RX fifo has data */ | 71 | /* RX fifo has data */ |
| 72 | istatus &= ISA_ISR_OUT_MASK; | 72 | istatus &= ISA_ISR_OUT_MASK; |
| 73 | outb(0, ISA_PORT_SIS); | 73 | outb(0, ISA_PORT_SIS); |
| 74 | act2000_isa_receive(card); | 74 | act2000_isa_receive(card); |
| 75 | outb(ISA_SIS_INT, ISA_PORT_SIS); | 75 | outb(ISA_SIS_INT, ISA_PORT_SIS); |
| 76 | } | 76 | } |
| 77 | if (istatus & ISA_ISR_ERR) { | 77 | if (istatus & ISA_ISR_ERR) { |
| 78 | /* Error Interrupt */ | 78 | /* Error Interrupt */ |
| 79 | istatus &= ISA_ISR_ERR_MASK; | 79 | istatus &= ISA_ISR_ERR_MASK; |
| 80 | printk(KERN_WARNING "act2000: errIRQ\n"); | 80 | printk(KERN_WARNING "act2000: errIRQ\n"); |
| 81 | } | 81 | } |
| 82 | if (istatus) | 82 | if (istatus) |
| 83 | printk(KERN_DEBUG "act2000: ?IRQ %d %02x\n", card->irq, istatus); | 83 | printk(KERN_DEBUG "act2000: ?IRQ %d %02x\n", card->irq, istatus); |
| 84 | return IRQ_HANDLED; | 84 | return IRQ_HANDLED; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | static void | 87 | static void |
| 88 | act2000_isa_select_irq(act2000_card * card) | 88 | act2000_isa_select_irq(act2000_card *card) |
| 89 | { | 89 | { |
| 90 | unsigned char reg; | 90 | unsigned char reg; |
| 91 | 91 | ||
| 92 | reg = (inb(ISA_PORT_COR) & ~ISA_COR_IRQOFF) | ISA_COR_PERR; | 92 | reg = (inb(ISA_PORT_COR) & ~ISA_COR_IRQOFF) | ISA_COR_PERR; |
| 93 | switch (card->irq) { | 93 | switch (card->irq) { |
| 94 | case 3: | 94 | case 3: |
| 95 | reg = ISA_COR_IRQ03; | 95 | reg = ISA_COR_IRQ03; |
| 96 | break; | 96 | break; |
| 97 | case 5: | 97 | case 5: |
| 98 | reg = ISA_COR_IRQ05; | 98 | reg = ISA_COR_IRQ05; |
| 99 | break; | 99 | break; |
| 100 | case 7: | 100 | case 7: |
| 101 | reg = ISA_COR_IRQ07; | 101 | reg = ISA_COR_IRQ07; |
| 102 | break; | 102 | break; |
| 103 | case 10: | 103 | case 10: |
| 104 | reg = ISA_COR_IRQ10; | 104 | reg = ISA_COR_IRQ10; |
| 105 | break; | 105 | break; |
| 106 | case 11: | 106 | case 11: |
| 107 | reg = ISA_COR_IRQ11; | 107 | reg = ISA_COR_IRQ11; |
| 108 | break; | 108 | break; |
| 109 | case 12: | 109 | case 12: |
| 110 | reg = ISA_COR_IRQ12; | 110 | reg = ISA_COR_IRQ12; |
| 111 | break; | 111 | break; |
| 112 | case 15: | 112 | case 15: |
| 113 | reg = ISA_COR_IRQ15; | 113 | reg = ISA_COR_IRQ15; |
| 114 | break; | 114 | break; |
| 115 | } | 115 | } |
| 116 | outb(reg, ISA_PORT_COR); | 116 | outb(reg, ISA_PORT_COR); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | static void | 119 | static void |
| 120 | act2000_isa_enable_irq(act2000_card * card) | 120 | act2000_isa_enable_irq(act2000_card *card) |
| 121 | { | 121 | { |
| 122 | act2000_isa_select_irq(card); | 122 | act2000_isa_select_irq(card); |
| 123 | /* Enable READ irq */ | 123 | /* Enable READ irq */ |
| @@ -129,102 +129,102 @@ act2000_isa_enable_irq(act2000_card * card) · 5 unmodified lines | |||
| 129 | * If irq is -1, choose next free irq, else irq is given explicitly. | 129 | * If irq is -1, choose next free irq, else irq is given explicitly. |
| 130 | */ | 130 | */ |
| 131 | int | 131 | int |
| 132 | act2000_isa_config_irq(act2000_card * card, short irq) | 132 | act2000_isa_config_irq(act2000_card *card, short irq) |
| 133 | { | 133 | { |
| 134 | int old_irq; | 134 | int old_irq; |
| 135 | 135 | ||
| 136 | if (card->flags & ACT2000_FLAGS_IVALID) { | 136 | if (card->flags & ACT2000_FLAGS_IVALID) { |
| 137 | free_irq(card->irq, card); | 137 | free_irq(card->irq, card); |
| 138 | } | 138 | } |
| 139 | card->flags &= ~ACT2000_FLAGS_IVALID; | 139 | card->flags &= ~ACT2000_FLAGS_IVALID; |
| 140 | outb(ISA_COR_IRQOFF, ISA_PORT_COR); | 140 | outb(ISA_COR_IRQOFF, ISA_PORT_COR); |
| 141 | if (!irq) | 141 | if (!irq) |
| 142 | return 0; | 142 | return 0; |
| 143 | 143 | ||
| 144 | old_irq = card->irq; | 144 | old_irq = card->irq; |
| 145 | card->irq = irq; | 145 | card->irq = irq; |
| 146 | if (request_irq(irq, &act2000_isa_interrupt, 0, card->regname, card)) { | 146 | if (request_irq(irq, &act2000_isa_interrupt, 0, card->regname, card)) { |
| 147 | card->irq = old_irq; | 147 | card->irq = old_irq; |
| 148 | card->flags |= ACT2000_FLAGS_IVALID; | 148 | card->flags |= ACT2000_FLAGS_IVALID; |
| 149 | printk(KERN_WARNING | 149 | printk(KERN_WARNING |
| 150 | "act2000: Could not request irq %d\n",irq); | 150 | "act2000: Could not request irq %d\n", irq); |
| 151 | return -EBUSY; | 151 | return -EBUSY; |
| 152 | } else { | 152 | } else { |
| 153 | act2000_isa_select_irq(card); | 153 | act2000_isa_select_irq(card); |
| 154 | /* Disable READ and WRITE irq */ | 154 | /* Disable READ and WRITE irq */ |
| 155 | outb(0, ISA_PORT_SIS); | 155 | outb(0, ISA_PORT_SIS); |
| 156 | outb(0, ISA_PORT_SOS); | 156 | outb(0, ISA_PORT_SOS); |
| 157 | } | 157 | } |
| 158 | return 0; | 158 | return 0; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | int | 161 | int |
| 162 | act2000_isa_config_port(act2000_card * card, unsigned short portbase) | 162 | act2000_isa_config_port(act2000_card *card, unsigned short portbase) |
| 163 | { | 163 | { |
| 164 | if (card->flags & ACT2000_FLAGS_PVALID) { | 164 | if (card->flags & ACT2000_FLAGS_PVALID) { |
| 165 | release_region(card->port, ISA_REGION); | 165 | release_region(card->port, ISA_REGION); |
| 166 | card->flags &= ~ACT2000_FLAGS_PVALID; | 166 | card->flags &= ~ACT2000_FLAGS_PVALID; |
| 167 | } | 167 | } |
| 168 | if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL) | 168 | if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL) |
| 169 | return -EBUSY; | 169 | return -EBUSY; |
| 170 | else { | 170 | else { |
| 171 | card->port = portbase; | 171 | card->port = portbase; |
| 172 | card->flags |= ACT2000_FLAGS_PVALID; | 172 | card->flags |= ACT2000_FLAGS_PVALID; |
| 173 | return 0; | 173 | return 0; |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | /* | 177 | /* |
| 178 | * Release ressources, used by an adaptor. | 178 | * Release ressources, used by an adaptor. |
| 179 | */ | 179 | */ |
| 180 | void | 180 | void |
| 181 | act2000_isa_release(act2000_card * card) | 181 | act2000_isa_release(act2000_card *card) |
| 182 | { | 182 | { |
| 183 | unsigned long flags; | 183 | unsigned long flags; |
| 184 | 184 | ||
| 185 | spin_lock_irqsave(&card->lock, flags); | 185 | spin_lock_irqsave(&card->lock, flags); |
| 186 | if (card->flags & ACT2000_FLAGS_IVALID) | 186 | if (card->flags & ACT2000_FLAGS_IVALID) |
| 187 | free_irq(card->irq, card); | 187 | free_irq(card->irq, card); |
| 188 | 188 | ||
| 189 | card->flags &= ~ACT2000_FLAGS_IVALID; | 189 | card->flags &= ~ACT2000_FLAGS_IVALID; |
| 190 | if (card->flags & ACT2000_FLAGS_PVALID) | 190 | if (card->flags & ACT2000_FLAGS_PVALID) |
| 191 | release_region(card->port, ISA_REGION); | 191 | release_region(card->port, ISA_REGION); |
| 192 | card->flags &= ~ACT2000_FLAGS_PVALID; | 192 | card->flags &= ~ACT2000_FLAGS_PVALID; |
| 193 | spin_unlock_irqrestore(&card->lock, flags); | 193 | spin_unlock_irqrestore(&card->lock, flags); |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | static int | 196 | static int |
| 197 | act2000_isa_writeb(act2000_card * card, u_char data) | 197 | act2000_isa_writeb(act2000_card *card, u_char data) |
| 198 | { | 198 | { |
| 199 | u_char timeout = 40; | 199 | u_char timeout = 40; |
| 200 | 200 | ||
| 201 | while (timeout) { | 201 | while (timeout) { |
| 202 | if (inb(ISA_PORT_SOS) & ISA_SOS_READY) { | 202 | if (inb(ISA_PORT_SOS) & ISA_SOS_READY) { |
| 203 | outb(data, ISA_PORT_SDO); | 203 | outb(data, ISA_PORT_SDO); |
| 204 | return 0; | 204 | return 0; |
| 205 | } else { | 205 | } else { |
| 206 | timeout--; | 206 | timeout--; |
| 207 | udelay(10); | 207 | udelay(10); |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | return 1; | 210 | return 1; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static int | 213 | static int |
| 214 | act2000_isa_readb(act2000_card * card, u_char * data) | 214 | act2000_isa_readb(act2000_card *card, u_char *data) |
| 215 | { | 215 | { |
| 216 | u_char timeout = 40; | 216 | u_char timeout = 40; |
| 217 | 217 | ||
| 218 | while (timeout) { | 218 | while (timeout) { |
| 219 | if (inb(ISA_PORT_SIS) & ISA_SIS_READY) { | 219 | if (inb(ISA_PORT_SIS) & ISA_SIS_READY) { |
| 220 | *data = inb(ISA_PORT_SDI); | 220 | *data = inb(ISA_PORT_SDI); |
| 221 | return 0; | 221 | return 0; |
| 222 | } else { | 222 | } else { |
| 223 | timeout--; | 223 | timeout--; |
| 224 | udelay(10); | 224 | udelay(10); |
| 225 | } | 225 | } |
| 226 | } | 226 | } |
| 227 | return 1; | 227 | return 1; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | void | 230 | void |
| @@ -232,11 +232,11 @@ act2000_isa_receive(act2000_card *card) · 1 unmodified line | |||
| 232 | { | 232 | { |
| 233 | u_char c; | 233 | u_char c; |
| 234 | 234 | ||
| 235 | if (test_and_set_bit(ACT2000_LOCK_RX, (void *) &card->ilock) != 0) | 235 | if (test_and_set_bit(ACT2000_LOCK_RX, (void *) &card->ilock) != 0) |
| 236 | return; | 236 | return; |
| 237 | while (!act2000_isa_readb(card, &c)) { | 237 | while (!act2000_isa_readb(card, &c)) { |
| 238 | if (card->idat.isa.rcvidx < 8) { | 238 | if (card->idat.isa.rcvidx < 8) { |
| 239 | card->idat.isa.rcvhdr[card->idat.isa.rcvidx++] = c; | 239 | card->idat.isa.rcvhdr[card->idat.isa.rcvidx++] = c; |
| 240 | if (card->idat.isa.rcvidx == 8) { | 240 | if (card->idat.isa.rcvidx == 8) { |
| 241 | int valid = actcapi_chkhdr(card, (actcapi_msghdr *)&card->idat.isa.rcvhdr); | 241 | int valid = actcapi_chkhdr(card, (actcapi_msghdr *)&card->idat.isa.rcvhdr); |
| 242 | 242 | ||
| @@ -291,14 +291,14 @@ act2000_isa_receive(act2000_card *card) · 48 unmodified lines | |||
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | void | 293 | void |
| 294 | act2000_isa_send(act2000_card * card) | 294 | act2000_isa_send(act2000_card *card) |
| 295 | { | 295 | { |
| 296 | unsigned long flags; | 296 | unsigned long flags; |
| 297 | struct sk_buff *skb; | 297 | struct sk_buff *skb; |
| 298 | actcapi_msg *msg; | 298 | actcapi_msg *msg; |
| 299 | int l; | 299 | int l; |
| 300 | 300 | ||
| 301 | if (test_and_set_bit(ACT2000_LOCK_TX, (void *) &card->ilock) != 0) | 301 | if (test_and_set_bit(ACT2000_LOCK_TX, (void *) &card->ilock) != 0) |
| 302 | return; | 302 | return; |
| 303 | while (1) { | 303 | while (1) { |
| 304 | spin_lock_irqsave(&card->lock, flags); | 304 | spin_lock_irqsave(&card->lock, flags); |
| @@ -307,7 +307,7 @@ act2000_isa_send(act2000_card * card) · 2 unmodified lines | |||
| 307 | card->ack_msg = card->sbuf->data; | 307 | card->ack_msg = card->sbuf->data; |
| 308 | msg = (actcapi_msg *)card->sbuf->data; | 308 | msg = (actcapi_msg *)card->sbuf->data; |
| 309 | if ((msg->hdr.cmd.cmd == 0x86) && | 309 | if ((msg->hdr.cmd.cmd == 0x86) && |
| 310 | (msg->hdr.cmd.subcmd == 0) ) { | 310 | (msg->hdr.cmd.subcmd == 0)) { |
| 311 | /* Save flags in message */ | 311 | /* Save flags in message */ |
| 312 | card->need_b3ack = msg->msg.data_b3_req.flags; | 312 | card->need_b3ack = msg->msg.data_b3_req.flags; |
| 313 | msg->msg.data_b3_req.flags = 0; | 313 | msg->msg.data_b3_req.flags = 0; |
| @@ -335,7 +335,7 @@ act2000_isa_send(act2000_card * card) · 21 unmodified lines | |||
| 335 | } | 335 | } |
| 336 | msg = (actcapi_msg *)card->ack_msg; | 336 | msg = (actcapi_msg *)card->ack_msg; |
| 337 | if ((msg->hdr.cmd.cmd == 0x86) && | 337 | if ((msg->hdr.cmd.cmd == 0x86) && |
| 338 | (msg->hdr.cmd.subcmd == 0) ) { | 338 | (msg->hdr.cmd.subcmd == 0)) { |
| 339 | /* | 339 | /* |
| 340 | * If it's user data, reset data-ptr | 340 | * If it's user data, reset data-ptr |
| 341 | * and put skb into ackq. | 341 | * and put skb into ackq. |
| @@ -354,90 +354,90 @@ act2000_isa_send(act2000_card * card) · 12 unmodified lines | |||
| 354 | * Get firmware ID, check for 'ISDN' signature. | 354 | * Get firmware ID, check for 'ISDN' signature. |
| 355 | */ | 355 | */ |
| 356 | static int | 356 | static int |
| 357 | act2000_isa_getid(act2000_card * card) | 357 | act2000_isa_getid(act2000_card *card) |
| 358 | { | 358 | { |
| 359 | 359 | ||
| 360 | act2000_fwid fid; | 360 | act2000_fwid fid; |
| 361 | u_char *p = (u_char *) & fid; | 361 | u_char *p = (u_char *)&fid; |
| 362 | int count = 0; | 362 | int count = 0; |
| 363 | 363 | ||
| 364 | while (1) { | 364 | while (1) { |
| 365 | if (count > 510) | 365 | if (count > 510) |
| 366 | return -EPROTO; | 366 | return -EPROTO; |
| 367 | if (act2000_isa_readb(card, p++)) | 367 | if (act2000_isa_readb(card, p++)) |
| 368 | break; | 368 | break; |
| 369 | count++; | 369 | count++; |
| 370 | } | 370 | } |
| 371 | if (count <= 20) { | 371 | if (count <= 20) { |
| 372 | printk(KERN_WARNING "act2000: No Firmware-ID!\n"); | 372 | printk(KERN_WARNING "act2000: No Firmware-ID!\n"); |
| 373 | return -ETIME; | 373 | return -ETIME; |
| 374 | } | 374 | } |
| 375 | *p = '\0'; | 375 | *p = '\0'; |
| 376 | fid.revlen[0] = '\0'; | 376 | fid.revlen[0] = '\0'; |
| 377 | if (strcmp(fid.isdn, "ISDN")) { | 377 | if (strcmp(fid.isdn, "ISDN")) { |
| 378 | printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n"); | 378 | printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n"); |
| 379 | return -EPROTO; | 379 | return -EPROTO; |
| 380 | } | 380 | } |
| 381 | if ((p = strchr(fid.revision, '\n'))) | 381 | if ((p = strchr(fid.revision, '\n'))) |
| 382 | *p = '\0'; | 382 | *p = '\0'; |
| 383 | printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision); | 383 | printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision); |
| 384 | if (card->flags & ACT2000_FLAGS_IVALID) { | 384 | if (card->flags & ACT2000_FLAGS_IVALID) { |
| 385 | printk(KERN_DEBUG "Enabling Interrupts ...\n"); | 385 | printk(KERN_DEBUG "Enabling Interrupts ...\n"); |
| 386 | act2000_isa_enable_irq(card); | 386 | act2000_isa_enable_irq(card); |
| 387 | } | 387 | } |
| 388 | return 0; | 388 | return 0; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | /* | 391 | /* |
| 392 | * Download microcode into card, check Firmware signature. | 392 | * Download microcode into card, check Firmware signature. |
| 393 | */ | 393 | */ |
| 394 | int | 394 | int |
| 395 | act2000_isa_download(act2000_card * card, act2000_ddef __user * cb) | 395 | act2000_isa_download(act2000_card *card, act2000_ddef __user *cb) |
| 396 | { | 396 | { |
| 397 | unsigned int length; | 397 | unsigned int length; |
| 398 | int l; | 398 | int l; |
| 399 | int c; | 399 | int c; |
| 400 | long timeout; | 400 | long timeout; |
| 401 | u_char *b; | 401 | u_char *b; |
| 402 | u_char __user *p; | 402 | u_char __user *p; |
| 403 | u_char *buf; | 403 | u_char *buf; |
| 404 | act2000_ddef cblock; | 404 | act2000_ddef cblock; |
| 405 | 405 | ||
| 406 | if (!act2000_isa_reset(card->port)) | 406 | if (!act2000_isa_reset(card->port)) |
| 407 | return -ENXIO; | 407 | return -ENXIO; |
| 408 | msleep_interruptible(500); | 408 | msleep_interruptible(500); |
| 409 | if (copy_from_user(&cblock, cb, sizeof(cblock))) | 409 | if (copy_from_user(&cblock, cb, sizeof(cblock))) |
| 410 | return -EFAULT; | 410 | return -EFAULT; |
| 411 | length = cblock.length; | 411 | length = cblock.length; |
| 412 | p = cblock.buffer; | 412 | p = cblock.buffer; |
| 413 | if (!access_ok(VERIFY_READ, p, length)) | 413 | if (!access_ok(VERIFY_READ, p, length)) |
| 414 | return -EFAULT; | 414 | return -EFAULT; |
| 415 | buf = kmalloc(1024, GFP_KERNEL); | 415 | buf = kmalloc(1024, GFP_KERNEL); |
| 416 | if (!buf) | 416 | if (!buf) |
| 417 | return -ENOMEM; | 417 | return -ENOMEM; |
| 418 | timeout = 0; | 418 | timeout = 0; |
| 419 | while (length) { | 419 | while (length) { |
| 420 | l = (length > 1024) ? 1024 : length; | 420 | l = (length > 1024) ? 1024 : length; |
| 421 | c = 0; | 421 | c = 0; |
| 422 | b = buf; | 422 | b = buf; |
| 423 | if (copy_from_user(buf, p, l)) { | 423 | if (copy_from_user(buf, p, l)) { |
| 424 | kfree(buf); | 424 | kfree(buf); |
| 425 | return -EFAULT; | 425 | return -EFAULT; |
| 426 | } | 426 | } |
| 427 | while (c < l) { | 427 | while (c < l) { |
| 428 | if (act2000_isa_writeb(card, *b++)) { | 428 | if (act2000_isa_writeb(card, *b++)) { |
| 429 | printk(KERN_WARNING | 429 | printk(KERN_WARNING |
| 430 | "act2000: loader timed out" | 430 | "act2000: loader timed out" |
| 431 | " len=%d c=%d\n", length, c); | 431 | " len=%d c=%d\n", length, c); |
| 432 | kfree(buf); | 432 | kfree(buf); |
| 433 | return -ETIME; | 433 | return -ETIME; |
| 434 | } | 434 | } |
| 435 | c++; | 435 | c++; |
| 436 | } | 436 | } |
| 437 | length -= l; | 437 | length -= l; |
| 438 | p += l; | 438 | p += l; |
| 439 | } | 439 | } |
| 440 | kfree(buf); | 440 | kfree(buf); |
| 441 | msleep_interruptible(500); | 441 | msleep_interruptible(500); |
| 442 | return (act2000_isa_getid(card)); | 442 | return (act2000_isa_getid(card)); |
| 443 | } | 443 | } |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | * | 4 | * |
| 5 | * Author Fritz Elfert | 5 | * Author Fritz Elfert |
| 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
| 7 | * | 7 | * |
| 8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
| 9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
| 10 | * | 10 | * |
| @@ -18,9 +18,9 @@ · 7 unmodified lines | |||
| 18 | #define ISA_POLL_LOOP 40 /* Try to read-write before give up */ | 18 | #define ISA_POLL_LOOP 40 /* Try to read-write before give up */ |
| 19 | 19 | ||
| 20 | typedef enum { | 20 | typedef enum { |
| 21 | INT_NO_CHANGE = 0, /* Do not change the Mask */ | 21 | INT_NO_CHANGE = 0, /* Do not change the Mask */ |
| 22 | INT_ON = 1, /* Set to Enable */ | 22 | INT_ON = 1, /* Set to Enable */ |
| 23 | INT_OFF = 2, /* Set to Disable */ | 23 | INT_OFF = 2, /* Set to Disable */ |
| 24 | } ISA_INT_T; | 24 | } ISA_INT_T; |
| 25 | 25 | ||
| 26 | /**************************************************************************/ | 26 | /**************************************************************************/ |
| @@ -114,22 +114,22 @@ typedef enum { · 87 unmodified lines | |||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | /* Macros for accessing ports */ | 116 | /* Macros for accessing ports */ |
| 117 | #define ISA_PORT_COR (card->port+ISA_COR) | 117 | #define ISA_PORT_COR (card->port + ISA_COR) |
| 118 | #define ISA_PORT_ISR (card->port+ISA_ISR) | 118 | #define ISA_PORT_ISR (card->port + ISA_ISR) |
| 119 | #define ISA_PORT_EPR (card->port+ISA_EPR) | 119 | #define ISA_PORT_EPR (card->port + ISA_EPR) |
| 120 | #define ISA_PORT_EER (card->port+ISA_EER) | 120 | #define ISA_PORT_EER (card->port + ISA_EER) |
| 121 | #define ISA_PORT_SDI (card->port+ISA_SDI) | 121 | #define ISA_PORT_SDI (card->port + ISA_SDI) |
| 122 | #define ISA_PORT_SDO (card->port+ISA_SDO) | 122 | #define ISA_PORT_SDO (card->port + ISA_SDO) |
| 123 | #define ISA_PORT_SIS (card->port+ISA_SIS) | 123 | #define ISA_PORT_SIS (card->port + ISA_SIS) |
| 124 | #define ISA_PORT_SOS (card->port+ISA_SOS) | 124 | #define ISA_PORT_SOS (card->port + ISA_SOS) |
| 125 | 125 | ||
| 126 | /* Prototypes */ | 126 | /* Prototypes */ |
| 127 | 127 | ||
| 128 | extern int act2000_isa_detect(unsigned short portbase); | 128 | extern int act2000_isa_detect(unsigned short portbase); |
| 129 | extern int act2000_isa_config_irq(act2000_card * card, short irq); | 129 | extern int act2000_isa_config_irq(act2000_card *card, short irq); |
| 130 | extern int act2000_isa_config_port(act2000_card * card, unsigned short portbase); | 130 | extern int act2000_isa_config_port(act2000_card *card, unsigned short portbase); |
| 131 | extern int act2000_isa_download(act2000_card * card, act2000_ddef __user * cb); | 131 | extern int act2000_isa_download(act2000_card *card, act2000_ddef __user *cb); |
| 132 | extern void act2000_isa_release(act2000_card * card); | 132 | extern void act2000_isa_release(act2000_card *card); |
| 133 | extern void act2000_isa_receive(act2000_card *card); | 133 | extern void act2000_isa_receive(act2000_card *card); |
| 134 | extern void act2000_isa_send(act2000_card *card); | 134 | extern void act2000_isa_send(act2000_card *card); |
| 135 | 135 | ||
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * | 5 | * |
| 6 | * Author Fritz Elfert | 6 | * Author Fritz Elfert |
| 7 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 7 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
| 8 | * | 8 | * |
| 9 | * This software may be used and distributed according to the terms | 9 | * This software may be used and distributed according to the terms |
| 10 | * of the GNU General Public License, incorporated herein by reference. | 10 | * of the GNU General Public License, incorporated herein by reference. |
| 11 | * | 11 | * |
| @@ -64,14 +64,14 @@ static actcapi_msgdsc valid_msg[] = { · 52 unmodified lines | |||
| 64 | {{ 0x86, 0x00}, "DATA_B3_REQ"}, | 64 | {{ 0x86, 0x00}, "DATA_B3_REQ"}, |
| 65 | {{ 0xff, 0x00}, "MANUFACTURER_REQ"}, | 65 | {{ 0xff, 0x00}, "MANUFACTURER_REQ"}, |
| 66 | /* Responses */ | 66 | /* Responses */ |
| 67 | {{ 0x01, 0x03}, "RESET_B3_RESP"}, | 67 | {{ 0x01, 0x03}, "RESET_B3_RESP"}, |
| 68 | {{ 0x02, 0x03}, "CONNECT_RESP"}, | 68 | {{ 0x02, 0x03}, "CONNECT_RESP"}, |
| 69 | {{ 0x03, 0x03}, "CONNECT_ACTIVE_RESP"}, | 69 | {{ 0x03, 0x03}, "CONNECT_ACTIVE_RESP"}, |
| 70 | {{ 0x04, 0x03}, "DISCONNECT_RESP"}, | 70 | {{ 0x04, 0x03}, "DISCONNECT_RESP"}, |
| 71 | {{ 0x07, 0x03}, "INFO_RESP"}, | 71 | {{ 0x07, 0x03}, "INFO_RESP"}, |
| 72 | {{ 0x08, 0x03}, "DATA_RESP"}, | 72 | {{ 0x08, 0x03}, "DATA_RESP"}, |
| 73 | {{ 0x82, 0x03}, "CONNECT_B3_RESP"}, | 73 | {{ 0x82, 0x03}, "CONNECT_B3_RESP"}, |
| 74 | {{ 0x83, 0x03}, "CONNECT_B3_ACTIVE_RESP"}, | 74 | {{ 0x83, 0x03}, "CONNECT_B3_ACTIVE_RESP"}, |
| 75 | {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"}, | 75 | {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"}, |
| 76 | {{ 0x86, 0x03}, "DATA_B3_RESP"}, | 76 | {{ 0x86, 0x03}, "DATA_B3_RESP"}, |
| 77 | {{ 0xff, 0x03}, "MANUFACTURER_RESP"}, | 77 | {{ 0xff, 0x03}, "MANUFACTURER_RESP"}, |
| @@ -88,7 +88,7 @@ static actcapi_msgdsc valid_msg[] = { · 10 unmodified lines | |||
| 88 | * 2 = Valid message, B-Channel-data | 88 | * 2 = Valid message, B-Channel-data |
| 89 | */ | 89 | */ |
| 90 | int | 90 | int |
| 91 | actcapi_chkhdr(act2000_card * card, actcapi_msghdr *hdr) | 91 | actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr) |
| 92 | { | 92 | { |
| 93 | int i; | 93 | int i; |
| 94 | 94 | ||
| @@ -99,33 +99,33 @@ actcapi_chkhdr(act2000_card * card, actcapi_msghdr *hdr) · 4 unmodified lines | |||
| 99 | for (i = 0; i < num_valid_imsg; i++) | 99 | for (i = 0; i < num_valid_imsg; i++) |
| 100 | if ((hdr->cmd.cmd == valid_msg[i].cmd.cmd) && | 100 | if ((hdr->cmd.cmd == valid_msg[i].cmd.cmd) && |
| 101 | (hdr->cmd.subcmd == valid_msg[i].cmd.subcmd)) { | 101 | (hdr->cmd.subcmd == valid_msg[i].cmd.subcmd)) { |
| 102 | return (i?1:2); | 102 | return (i ? 1 : 2); |
| 103 | } | 103 | } |
| 104 | return 0; | 104 | return 0; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | #define ACTCAPI_MKHDR(l, c, s) { \ | 107 | #define ACTCAPI_MKHDR(l, c, s) { \ |
| 108 | skb = alloc_skb(l + 8, GFP_ATOMIC); \ | 108 | skb = alloc_skb(l + 8, GFP_ATOMIC); \ |
| 109 | if (skb) { \ | 109 | if (skb) { \ |
| 110 | m = (actcapi_msg *)skb_put(skb, l + 8); \ | 110 | m = (actcapi_msg *)skb_put(skb, l + 8); \ |
| 111 | m->hdr.len = l + 8; \ | 111 | m->hdr.len = l + 8; \ |
| 112 | m->hdr.applicationID = 1; \ | 112 | m->hdr.applicationID = 1; \ |
| 113 | m->hdr.cmd.cmd = c; \ | 113 | m->hdr.cmd.cmd = c; \ |
| 114 | m->hdr.cmd.subcmd = s; \ | 114 | m->hdr.cmd.subcmd = s; \ |
| 115 | m->hdr.msgnum = actcapi_nextsmsg(card); \ | 115 | m->hdr.msgnum = actcapi_nextsmsg(card); \ |
| 116 | } else m = NULL;\ | 116 | } else m = NULL; \ |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | #define ACTCAPI_CHKSKB if (!skb) { \ | 119 | #define ACTCAPI_CHKSKB if (!skb) { \ |
| 120 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); \ | 120 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); \ |
| 121 | return; \ | 121 | return; \ |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | #define ACTCAPI_QUEUE_TX { \ | 124 | #define ACTCAPI_QUEUE_TX { \ |
| 125 | actcapi_debug_msg(skb, 1); \ | 125 | actcapi_debug_msg(skb, 1); \ |
| 126 | skb_queue_tail(&card->sndq, skb); \ | 126 | skb_queue_tail(&card->sndq, skb); \ |
| 127 | act2000_schedule_tx(card); \ | 127 | act2000_schedule_tx(card); \ |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | int | 130 | int |
| 131 | actcapi_listen_req(act2000_card *card) | 131 | actcapi_listen_req(act2000_card *card) |
| @@ -138,16 +138,16 @@ actcapi_listen_req(act2000_card *card) · 6 unmodified lines | |||
| 138 | for (i = 0; i < ACT2000_BCH; i++) | 138 | for (i = 0; i < ACT2000_BCH; i++) |
| 139 | eazmask |= card->bch[i].eazmask; | 139 | eazmask |= card->bch[i].eazmask; |
| 140 | ACTCAPI_MKHDR(9, 0x05, 0x00); | 140 | ACTCAPI_MKHDR(9, 0x05, 0x00); |
| 141 | if (!skb) { | 141 | if (!skb) { |
| 142 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); | 142 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); |
| 143 | return -ENOMEM; | 143 | return -ENOMEM; |
| 144 | } | 144 | } |
| 145 | m->msg.listen_req.controller = 0; | 145 | m->msg.listen_req.controller = 0; |
| 146 | m->msg.listen_req.infomask = 0x3f; /* All information */ | 146 | m->msg.listen_req.infomask = 0x3f; /* All information */ |
| 147 | m->msg.listen_req.eazmask = eazmask; | 147 | m->msg.listen_req.eazmask = eazmask; |
| 148 | m->msg.listen_req.simask = (eazmask)?0x86:0; /* All SI's */ | 148 | m->msg.listen_req.simask = (eazmask) ? 0x86 : 0; /* All SI's */ |
| 149 | ACTCAPI_QUEUE_TX; | 149 | ACTCAPI_QUEUE_TX; |
| 150 | return 0; | 150 | return 0; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | int | 153 | int |
| @@ -159,7 +159,7 @@ actcapi_connect_req(act2000_card *card, act2000_chan *chan, char *phone, · 5 unmodified lines | |||
| 159 | 159 | ||
| 160 | ACTCAPI_MKHDR((11 + strlen(phone)), 0x02, 0x00); | 160 | ACTCAPI_MKHDR((11 + strlen(phone)), 0x02, 0x00); |
| 161 | if (!skb) { | 161 | if (!skb) { |
| 162 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); | 162 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); |
| 163 | chan->fsm_state = ACT2000_STATE_NULL; | 163 | chan->fsm_state = ACT2000_STATE_NULL; |
| 164 | return -ENOMEM; | 164 | return -ENOMEM; |
| 165 | } | 165 | } |
| @@ -168,7 +168,7 @@ actcapi_connect_req(act2000_card *card, act2000_chan *chan, char *phone, · 2 unmodified lines | |||
| 168 | m->msg.connect_req.infomask = 0x3f; | 168 | m->msg.connect_req.infomask = 0x3f; |
| 169 | m->msg.connect_req.si1 = si1; | 169 | m->msg.connect_req.si1 = si1; |
| 170 | m->msg.connect_req.si2 = si2; | 170 | m->msg.connect_req.si2 = si2; |
| 171 | m->msg.connect_req.eaz = eaz?eaz:'0'; | 171 | m->msg.connect_req.eaz = eaz ? eaz : '0'; |
| 172 | m->msg.connect_req.addr.len = strlen(phone) + 1; | 172 | m->msg.connect_req.addr.len = strlen(phone) + 1; |
| 173 | m->msg.connect_req.addr.tnp = 0x81; | 173 | m->msg.connect_req.addr.tnp = 0x81; |
| 174 | memcpy(m->msg.connect_req.addr.num, phone, strlen(phone)); | 174 | memcpy(m->msg.connect_req.addr.num, phone, strlen(phone)); |
| @@ -203,21 +203,21 @@ actcapi_manufacturer_req_net(act2000_card *card) · 28 unmodified lines | |||
| 203 | struct sk_buff *skb; | 203 | struct sk_buff *skb; |
| 204 | 204 | ||
| 205 | ACTCAPI_MKHDR(5, 0xff, 0x00); | 205 | ACTCAPI_MKHDR(5, 0xff, 0x00); |
| 206 | if (!skb) { | 206 | if (!skb) { |
| 207 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); | 207 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); |
| 208 | return -ENOMEM; | 208 | return -ENOMEM; |
| 209 | } | 209 | } |
| 210 | m->msg.manufacturer_req_net.manuf_msg = 0x11; | 210 | m->msg.manufacturer_req_net.manuf_msg = 0x11; |
| 211 | m->msg.manufacturer_req_net.controller = 1; | 211 | m->msg.manufacturer_req_net.controller = 1; |
| 212 | m->msg.manufacturer_req_net.nettype = (card->ptype == ISDN_PTYPE_EURO)?1:0; | 212 | m->msg.manufacturer_req_net.nettype = (card->ptype == ISDN_PTYPE_EURO) ? 1 : 0; |
| 213 | ACTCAPI_QUEUE_TX; | 213 | ACTCAPI_QUEUE_TX; |
| 214 | printk(KERN_INFO "act2000 %s: D-channel protocol now %s\n", | 214 | printk(KERN_INFO "act2000 %s: D-channel protocol now %s\n", |
| 215 | card->interface.id, (card->ptype == ISDN_PTYPE_EURO)?"euro":"1tr6"); | 215 | card->interface.id, (card->ptype == ISDN_PTYPE_EURO) ? "euro" : "1tr6"); |
| 216 | card->interface.features &= | 216 | card->interface.features &= |
| 217 | ~(ISDN_FEATURE_P_UNKNOWN | ISDN_FEATURE_P_EURO | ISDN_FEATURE_P_1TR6); | 217 | ~(ISDN_FEATURE_P_UNKNOWN | ISDN_FEATURE_P_EURO | ISDN_FEATURE_P_1TR6); |
| 218 | card->interface.features |= | 218 | card->interface.features |= |
| 219 | ((card->ptype == ISDN_PTYPE_EURO)?ISDN_FEATURE_P_EURO:ISDN_FEATURE_P_1TR6); | 219 | ((card->ptype == ISDN_PTYPE_EURO) ? ISDN_FEATURE_P_EURO : ISDN_FEATURE_P_1TR6); |
| 220 | return 0; | 220 | return 0; |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | /* | 223 | /* |
| @@ -231,16 +231,16 @@ actcapi_manufacturer_req_v42(act2000_card *card, ulong arg) · 7 unmodified lines | |||
| 231 | struct sk_buff *skb; | 231 | struct sk_buff *skb; |
| 232 | 232 | ||
| 233 | ACTCAPI_MKHDR(8, 0xff, 0x00); | 233 | ACTCAPI_MKHDR(8, 0xff, 0x00); |
| 234 | if (!skb) { | 234 | if (!skb) { |
| 235 | 235 | ||
| 236 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); | 236 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); |
| 237 | return -ENOMEM; | 237 | return -ENOMEM; |
| 238 | } | 238 | } |
| 239 | m->msg.manufacturer_req_v42.manuf_msg = 0x10; | 239 | m->msg.manufacturer_req_v42.manuf_msg = 0x10; |
| 240 | m->msg.manufacturer_req_v42.controller = 0; | 240 | m->msg.manufacturer_req_v42.controller = 0; |
| 241 | m->msg.manufacturer_req_v42.v42control = (arg?1:0); | 241 | m->msg.manufacturer_req_v42.v42control = (arg ? 1 : 0); |
| 242 | ACTCAPI_QUEUE_TX; | 242 | ACTCAPI_QUEUE_TX; |
| 243 | return 0; | 243 | return 0; |
| 244 | } | 244 | } |
| 245 | #endif /* 0 */ | 245 | #endif /* 0 */ |
| 246 | 246 | ||
| @@ -254,15 +254,15 @@ actcapi_manufacturer_req_errh(act2000_card *card) · 7 unmodified lines | |||
| 254 | struct sk_buff *skb; | 254 | struct sk_buff *skb; |
| 255 | 255 | ||
| 256 | ACTCAPI_MKHDR(4, 0xff, 0x00); | 256 | ACTCAPI_MKHDR(4, 0xff, 0x00); |
| 257 | if (!skb) { | 257 | if (!skb) { |
| 258 | 258 | ||
| 259 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); | 259 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); |
| 260 | return -ENOMEM; | 260 | return -ENOMEM; |
| 261 | } | 261 | } |
| 262 | m->msg.manufacturer_req_err.manuf_msg = 0x03; | 262 | m->msg.manufacturer_req_err.manuf_msg = 0x03; |
| 263 | m->msg.manufacturer_req_err.controller = 0; | 263 | m->msg.manufacturer_req_err.controller = 0; |
| 264 | ACTCAPI_QUEUE_TX; | 264 | ACTCAPI_QUEUE_TX; |
| 265 | return 0; | 265 | return 0; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | /* | 268 | /* |
| @@ -295,7 +295,7 @@ actcapi_manufacturer_req_msn(act2000_card *card) · 26 unmodified lines | |||
| 295 | } | 295 | } |
| 296 | p = p->next; | 296 | p = p->next; |
| 297 | } | 297 | } |
| 298 | return 0; | 298 | return 0; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | void | 301 | void |
| @@ -311,24 +311,24 @@ actcapi_select_b2_protocol_req(act2000_card *card, act2000_chan *chan) · 9 unmodified lines | |||
| 311 | sizeof(m->msg.select_b2_protocol_req.dlpd)); | 311 | sizeof(m->msg.select_b2_protocol_req.dlpd)); |
| 312 | m->msg.select_b2_protocol_req.dlpd.len = 6; | 312 | m->msg.select_b2_protocol_req.dlpd.len = 6; |
| 313 | switch (chan->l2prot) { | 313 | switch (chan->l2prot) { |
| 314 | case ISDN_PROTO_L2_TRANS: | 314 | case ISDN_PROTO_L2_TRANS: |
| 315 | m->msg.select_b2_protocol_req.protocol = 0x03; | 315 | m->msg.select_b2_protocol_req.protocol = 0x03; |
| 316 | m->msg.select_b2_protocol_req.dlpd.dlen = 4000; | 316 | m->msg.select_b2_protocol_req.dlpd.dlen = 4000; |
| 317 | break; | 317 | break; |
| 318 | case ISDN_PROTO_L2_HDLC: | 318 | case ISDN_PROTO_L2_HDLC: |
| 319 | m->msg.select_b2_protocol_req.protocol = 0x02; | 319 | m->msg.select_b2_protocol_req.protocol = 0x02; |
| 320 | m->msg.select_b2_protocol_req.dlpd.dlen = 4000; | 320 | m->msg.select_b2_protocol_req.dlpd.dlen = 4000; |
| 321 | break; | 321 | break; |
| 322 | case ISDN_PROTO_L2_X75I: | 322 | case ISDN_PROTO_L2_X75I: |
| 323 | case ISDN_PROTO_L2_X75UI: | 323 | case ISDN_PROTO_L2_X75UI: |
| 324 | case ISDN_PROTO_L2_X75BUI: | 324 | case ISDN_PROTO_L2_X75BUI: |
| 325 | m->msg.select_b2_protocol_req.protocol = 0x01; | 325 | m->msg.select_b2_protocol_req.protocol = 0x01; |
| 326 | m->msg.select_b2_protocol_req.dlpd.dlen = 4000; | 326 | m->msg.select_b2_protocol_req.dlpd.dlen = 4000; |
| 327 | m->msg.select_b2_protocol_req.dlpd.laa = 3; | 327 | m->msg.select_b2_protocol_req.dlpd.laa = 3; |
| 328 | m->msg.select_b2_protocol_req.dlpd.lab = 1; | 328 | m->msg.select_b2_protocol_req.dlpd.lab = 1; |
| 329 | m->msg.select_b2_protocol_req.dlpd.win = 7; | 329 | m->msg.select_b2_protocol_req.dlpd.win = 7; |
| 330 | m->msg.select_b2_protocol_req.dlpd.modulo = 8; | 330 | m->msg.select_b2_protocol_req.dlpd.modulo = 8; |
| 331 | break; | 331 | break; |
| 332 | } | 332 | } |
| 333 | ACTCAPI_QUEUE_TX; | 333 | ACTCAPI_QUEUE_TX; |
| 334 | } | 334 | } |
| @@ -345,11 +345,11 @@ actcapi_select_b3_protocol_req(act2000_card *card, act2000_chan *chan) · 10 unmodified lines | |||
| 345 | memset(&m->msg.select_b3_protocol_req.ncpd, 0, | 345 | memset(&m->msg.select_b3_protocol_req.ncpd, 0, |
| 346 | sizeof(m->msg.select_b3_protocol_req.ncpd)); | 346 | sizeof(m->msg.select_b3_protocol_req.ncpd)); |
| 347 | switch (chan->l3prot) { | 347 | switch (chan->l3prot) { |
| 348 | case ISDN_PROTO_L3_TRANS: | 348 | case ISDN_PROTO_L3_TRANS: |
| 349 | m->msg.select_b3_protocol_req.protocol = 0x04; | 349 | m->msg.select_b3_protocol_req.protocol = 0x04; |
| 350 | m->msg.select_b3_protocol_req.ncpd.len = 13; | 350 | m->msg.select_b3_protocol_req.ncpd.len = 13; |
| 351 | m->msg.select_b3_protocol_req.ncpd.modulo = 8; | 351 | m->msg.select_b3_protocol_req.ncpd.modulo = 8; |
| 352 | break; | 352 | break; |
| 353 | } | 353 | } |
| 354 | ACTCAPI_QUEUE_TX; | 354 | ACTCAPI_QUEUE_TX; |
| 355 | } | 355 | } |
| @@ -434,7 +434,7 @@ actcapi_connect_b3_resp(act2000_card *card, act2000_chan *chan, __u8 rejectcause · 78 unmodified lines | |||
| 434 | actcapi_msg *m; | 434 | actcapi_msg *m; |
| 435 | struct sk_buff *skb; | 435 | struct sk_buff *skb; |
| 436 | 436 | ||
| 437 | ACTCAPI_MKHDR((rejectcause?3:17), 0x82, 0x03); | 437 | ACTCAPI_MKHDR((rejectcause ? 3 : 17), 0x82, 0x03); |
| 438 | ACTCAPI_CHKSKB; | 438 | ACTCAPI_CHKSKB; |
| 439 | m->msg.connect_b3_resp.ncci = chan->ncci; | 439 | m->msg.connect_b3_resp.ncci = chan->ncci; |
| 440 | m->msg.connect_b3_resp.rejectcause = rejectcause; | 440 | m->msg.connect_b3_resp.rejectcause = rejectcause; |
| @@ -563,10 +563,10 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff *skb) { · 122 unmodified lines | |||
| 563 | blocknr = msg->msg.data_b3_ind.blocknr; | 563 | blocknr = msg->msg.data_b3_ind.blocknr; |
| 564 | skb_pull(skb, 19); | 564 | skb_pull(skb, 19); |
| 565 | card->interface.rcvcallb_skb(card->myid, chan, skb); | 565 | card->interface.rcvcallb_skb(card->myid, chan, skb); |
| 566 | if (!(skb = alloc_skb(11, GFP_ATOMIC))) { | 566 | if (!(skb = alloc_skb(11, GFP_ATOMIC))) { |
| 567 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); | 567 | printk(KERN_WARNING "actcapi: alloc_skb failed\n"); |
| 568 | return 1; | 568 | return 1; |
| 569 | } | 569 | } |
| 570 | msg = (actcapi_msg *)skb_put(skb, 11); | 570 | msg = (actcapi_msg *)skb_put(skb, 11); |
| 571 | msg->hdr.len = 11; | 571 | msg->hdr.len = 11; |
| 572 | msg->hdr.applicationID = 1; | 572 | msg->hdr.applicationID = 1; |
| @@ -595,34 +595,34 @@ handle_ack(act2000_card *card, act2000_chan *chan, __u8 blocknr) { · 22 unmodified lines | |||
| 595 | spin_lock_irqsave(&card->lock, flags); | 595 | spin_lock_irqsave(&card->lock, flags); |
| 596 | skb = skb_peek(&card->ackq); | 596 | skb = skb_peek(&card->ackq); |
| 597 | spin_unlock_irqrestore(&card->lock, flags); | 597 | spin_unlock_irqrestore(&card->lock, flags); |
| 598 | if (!skb) { | 598 | if (!skb) { |
| 599 | printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); | 599 | printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); |
| 600 | return 0; | 600 | return 0; |
| 601 | } | 601 | } |
| 602 | tmp = skb; | 602 | tmp = skb; |
| 603 | while (1) { | 603 | while (1) { |
| 604 | m = (actcapi_msg *)tmp->data; | 604 | m = (actcapi_msg *)tmp->data; |
| 605 | if ((((m->msg.data_b3_req.fakencci >> 8) & 0xff) == chan->ncci) && | 605 | if ((((m->msg.data_b3_req.fakencci >> 8) & 0xff) == chan->ncci) && |
| 606 | (m->msg.data_b3_req.blocknr == blocknr)) { | 606 | (m->msg.data_b3_req.blocknr == blocknr)) { |
| 607 | /* found corresponding DATA_B3_REQ */ | 607 | /* found corresponding DATA_B3_REQ */ |
| 608 | skb_unlink(tmp, &card->ackq); | 608 | skb_unlink(tmp, &card->ackq); |
| 609 | chan->queued -= m->msg.data_b3_req.datalen; | 609 | chan->queued -= m->msg.data_b3_req.datalen; |
| 610 | if (m->msg.data_b3_req.flags) | 610 | if (m->msg.data_b3_req.flags) |
| 611 | ret = m->msg.data_b3_req.datalen; | 611 | ret = m->msg.data_b3_req.datalen; |
| 612 | dev_kfree_skb(tmp); | 612 | dev_kfree_skb(tmp); |
| 613 | if (chan->queued < 0) | 613 | if (chan->queued < 0) |
| 614 | chan->queued = 0; | 614 | chan->queued = 0; |
| 615 | return ret; | 615 | return ret; |
| 616 | } | 616 | } |
| 617 | spin_lock_irqsave(&card->lock, flags); | 617 | spin_lock_irqsave(&card->lock, flags); |
| 618 | tmp = skb_peek((struct sk_buff_head *)tmp); | 618 | tmp = skb_peek((struct sk_buff_head *)tmp); |
| 619 | spin_unlock_irqrestore(&card->lock, flags); | 619 | spin_unlock_irqrestore(&card->lock, flags); |
| 620 | if ((tmp == skb) || (tmp == NULL)) { | 620 | if ((tmp == skb) || (tmp == NULL)) { |
| 621 | /* reached end of queue */ | 621 | /* reached end of queue */ |
| 622 | printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); | 622 | printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); |
| 623 | return 0; | 623 | return 0; |
| 624 | } | 624 | } |
| 625 | } | 625 | } |
| 626 | } | 626 | } |
| 627 | 627 | ||
| 628 | void | 628 | void |
| @@ -644,294 +644,294 @@ actcapi_dispatch(struct work_struct *work) · 15 unmodified lines | |||
| 644 | msg = (actcapi_msg *)skb->data; | 644 | msg = (actcapi_msg *)skb->data; |
| 645 | ccmd = ((msg->hdr.cmd.cmd << 8) | msg->hdr.cmd.subcmd); | 645 | ccmd = ((msg->hdr.cmd.cmd << 8) | msg->hdr.cmd.subcmd); |
| 646 | switch (ccmd) { | 646 | switch (ccmd) { |
| 647 | case 0x8602: | 647 | case 0x8602: |
| 648 | /* DATA_B3_IND */ | 648 | /* DATA_B3_IND */ |
| 649 | if (actcapi_data_b3_ind(card, skb)) | 649 | if (actcapi_data_b3_ind(card, skb)) |
| 650 | return; | 650 | return; |
| 651 | break; | 651 | break; |
| 652 | case 0x8601: | 652 | case 0x8601: |
| 653 | /* DATA_B3_CONF */ | 653 | /* DATA_B3_CONF */ |
| 654 | chan = find_ncci(card, msg->msg.data_b3_conf.ncci); | 654 | chan = find_ncci(card, msg->msg.data_b3_conf.ncci); |
| 655 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_ACTIVE)) { | 655 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_ACTIVE)) { |
| 656 | if (msg->msg.data_b3_conf.info != 0) | 656 | if (msg->msg.data_b3_conf.info != 0) |
| 657 | printk(KERN_WARNING "act2000: DATA_B3_CONF: %04x\n", | 657 | printk(KERN_WARNING "act2000: DATA_B3_CONF: %04x\n", |
| 658 | msg->msg.data_b3_conf.info); | 658 | msg->msg.data_b3_conf.info); |
| 659 | len = handle_ack(card, &card->bch[chan], | 659 | len = handle_ack(card, &card->bch[chan], |
| 660 | msg->msg.data_b3_conf.blocknr); | 660 | msg->msg.data_b3_conf.blocknr); |
| 661 | if (len) { | 661 | if (len) { |
| 662 | cmd.driver = card->myid; | ||
| 663 | cmd.command = ISDN_STAT_BSENT; | ||
| 664 | cmd.arg = chan; | ||
| 665 | cmd.parm.length = len; | ||
| 666 | card->interface.statcallb(&cmd); | ||
| 667 | } | ||
| 668 | } | ||
| 669 | break; | ||
| 670 | case 0x0201: | ||
| 671 | /* CONNECT_CONF */ | ||
| 672 | chan = find_dialing(card, msg->hdr.msgnum); | ||
| 673 | if (chan >= 0) { | ||
| 674 | if (msg->msg.connect_conf.info) { | ||
| 675 | card->bch[chan].fsm_state = ACT2000_STATE_NULL; | ||
| 676 | cmd.driver = card->myid; | ||
| 677 | cmd.command = ISDN_STAT_DHUP; | ||
| 678 | cmd.arg = chan; | ||
| 679 | card->interface.statcallb(&cmd); | ||
| 680 | } else { | ||
| 681 | card->bch[chan].fsm_state = ACT2000_STATE_OWAIT; | ||
| 682 | card->bch[chan].plci = msg->msg.connect_conf.plci; | ||
| 683 | } | ||
| 684 | } | ||
| 685 | break; | ||
| 686 | case 0x0202: | ||
| 687 | /* CONNECT_IND */ | ||
| 688 | chan = new_plci(card, msg->msg.connect_ind.plci); | ||
| 689 | if (chan < 0) { | ||
| 690 | ctmp = (act2000_chan *)tmp; | ||
| 691 | ctmp->plci = msg->msg.connect_ind.plci; | ||
| 692 | actcapi_connect_resp(card, ctmp, 0x11); /* All Card-Cannels busy */ | ||
| 693 | } else { | ||
| 694 | card->bch[chan].fsm_state = ACT2000_STATE_ICALL; | ||
| 695 | cmd.driver = card->myid; | ||
| 696 | cmd.command = ISDN_STAT_ICALL; | ||
| 697 | cmd.arg = chan; | ||
| 698 | cmd.parm.setup.si1 = msg->msg.connect_ind.si1; | ||
| 699 | cmd.parm.setup.si2 = msg->msg.connect_ind.si2; | ||
| 700 | if (card->ptype == ISDN_PTYPE_EURO) | ||
| 701 | strcpy(cmd.parm.setup.eazmsn, | ||
| 702 | act2000_find_eaz(card, msg->msg.connect_ind.eaz)); | ||
| 703 | else { | ||
| 704 | cmd.parm.setup.eazmsn[0] = msg->msg.connect_ind.eaz; | ||
| 705 | cmd.parm.setup.eazmsn[1] = 0; | ||
| 706 | } | ||
| 707 | memset(cmd.parm.setup.phone, 0, sizeof(cmd.parm.setup.phone)); | ||
| 708 | memcpy(cmd.parm.setup.phone, msg->msg.connect_ind.addr.num, | ||
| 709 | msg->msg.connect_ind.addr.len - 1); | ||
| 710 | cmd.parm.setup.plan = msg->msg.connect_ind.addr.tnp; | ||
| 711 | cmd.parm.setup.screen = 0; | ||
| 712 | if (card->interface.statcallb(&cmd) == 2) | ||
| 713 | actcapi_connect_resp(card, &card->bch[chan], 0x15); /* Reject Call */ | ||
| 714 | } | ||
| 715 | break; | ||
| 716 | case 0x0302: | ||
| 717 | /* CONNECT_ACTIVE_IND */ | ||
| 718 | chan = find_plci(card, msg->msg.connect_active_ind.plci); | ||
| 719 | if (chan >= 0) | ||
| 720 | switch (card->bch[chan].fsm_state) { | ||
| 721 | case ACT2000_STATE_IWAIT: | ||
| 722 | actcapi_connect_active_resp(card, &card->bch[chan]); | ||
| 723 | break; | ||
| 724 | case ACT2000_STATE_OWAIT: | ||
| 725 | actcapi_connect_active_resp(card, &card->bch[chan]); | ||
| 726 | actcapi_select_b2_protocol_req(card, &card->bch[chan]); | ||
| 727 | break; | ||
| 728 | } | ||
| 729 | break; | ||
| 730 | case 0x8202: | ||
| 731 | /* CONNECT_B3_IND */ | ||
| 732 | chan = find_plci(card, msg->msg.connect_b3_ind.plci); | ||
| 733 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_IBWAIT)) { | ||
| 734 | card->bch[chan].ncci = msg->msg.connect_b3_ind.ncci; | ||
| 735 | actcapi_connect_b3_resp(card, &card->bch[chan], 0); | ||
| 736 | } else { | ||
| 737 | ctmp = (act2000_chan *)tmp; | ||
| 738 | ctmp->ncci = msg->msg.connect_b3_ind.ncci; | ||
| 739 | actcapi_connect_b3_resp(card, ctmp, 0x11); /* All Card-Cannels busy */ | ||
| 740 | } | ||
| 741 | break; | ||
| 742 | case 0x8302: | ||
| 743 | /* CONNECT_B3_ACTIVE_IND */ | ||
| 744 | chan = find_ncci(card, msg->msg.connect_b3_active_ind.ncci); | ||
| 745 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BWAIT)) { | ||
| 746 | actcapi_connect_b3_active_resp(card, &card->bch[chan]); | ||
| 747 | cmd.driver = card->myid; | ||
| 748 | cmd.command = ISDN_STAT_BCONN; | ||
| 749 | cmd.arg = chan; | ||
| 750 | card->interface.statcallb(&cmd); | ||
| 751 | } | ||
| 752 | break; | ||
| 753 | case 0x8402: | ||
| 754 | /* DISCONNECT_B3_IND */ | ||
| 755 | chan = find_ncci(card, msg->msg.disconnect_b3_ind.ncci); | ||
| 756 | if (chan >= 0) { | ||
| 757 | ctmp = &card->bch[chan]; | ||
| 758 | actcapi_disconnect_b3_resp(card, ctmp); | ||
| 759 | switch (ctmp->fsm_state) { | ||
| 760 | case ACT2000_STATE_ACTIVE: | ||
| 761 | ctmp->fsm_state = ACT2000_STATE_DHWAIT2; | ||
| 762 | cmd.driver = card->myid; | ||
| 763 | cmd.command = ISDN_STAT_BHUP; | ||
| 764 | cmd.arg = chan; | ||
| 765 | card->interface.statcallb(&cmd); | ||
| 766 | break; | ||
| 767 | case ACT2000_STATE_BHWAIT2: | ||
| 768 | actcapi_disconnect_req(card, ctmp); | ||
| 769 | ctmp->fsm_state = ACT2000_STATE_DHWAIT; | ||
| 770 | cmd.driver = card->myid; | ||
| 771 | cmd.command = ISDN_STAT_BHUP; | ||
| 772 | cmd.arg = chan; | ||
| 773 | card->interface.statcallb(&cmd); | ||
| 774 | break; | ||
| 775 | } | ||
| 776 | } | ||
| 777 | break; | ||
| 778 | case 0x0402: | ||
| 779 | /* DISCONNECT_IND */ | ||
| 780 | chan = find_plci(card, msg->msg.disconnect_ind.plci); | ||
| 781 | if (chan >= 0) { | ||
| 782 | ctmp = &card->bch[chan]; | ||
| 783 | actcapi_disconnect_resp(card, ctmp); | ||
| 784 | ctmp->fsm_state = ACT2000_STATE_NULL; | ||
| 785 | cmd.driver = card->myid; | ||
| 786 | cmd.command = ISDN_STAT_DHUP; | ||
| 787 | cmd.arg = chan; | ||
| 788 | card->interface.statcallb(&cmd); | ||
| 789 | } else { | ||
| 790 | ctmp = (act2000_chan *)tmp; | ||
| 791 | ctmp->plci = msg->msg.disconnect_ind.plci; | ||
| 792 | actcapi_disconnect_resp(card, ctmp); | ||
| 793 | } | ||
| 794 | break; | ||
| 795 | case 0x4001: | ||
| 796 | /* SELECT_B2_PROTOCOL_CONF */ | ||
| 797 | chan = find_plci(card, msg->msg.select_b2_protocol_conf.plci); | ||
| 798 | if (chan >= 0) | ||
| 799 | switch (card->bch[chan].fsm_state) { | ||
| 800 | case ACT2000_STATE_ICALL: | ||
| 801 | case ACT2000_STATE_OWAIT: | ||
| 802 | ctmp = &card->bch[chan]; | ||
| 803 | if (msg->msg.select_b2_protocol_conf.info == 0) | ||
| 804 | actcapi_select_b3_protocol_req(card, ctmp); | ||
| 805 | else { | ||
| 806 | ctmp->fsm_state = ACT2000_STATE_NULL; | ||
| 662 | cmd.driver = card->myid; | 807 | cmd.driver = card->myid; |
| 663 | cmd.command = ISDN_STAT_BSENT; | 808 | cmd.command = ISDN_STAT_DHUP; |
| 664 | cmd.arg = chan; | 809 | cmd.arg = chan; |
| 665 | cmd.parm.length = len; | ||
| 666 | card->interface.statcallb(&cmd); | 810 | card->interface.statcallb(&cmd); |
| 667 | } | 811 | } |
| 812 | break; | ||
| 668 | } | 813 | } |
| 669 | break; | 814 | break; |
| 670 | case 0x0201: | 815 | case 0x8001: |
| 671 | /* CONNECT_CONF */ | 816 | /* SELECT_B3_PROTOCOL_CONF */ |
| 672 | chan = find_dialing(card, msg->hdr.msgnum); | 817 | chan = find_plci(card, msg->msg.select_b3_protocol_conf.plci); |
| 673 | if (chan >= 0) { | 818 | if (chan >= 0) |
| 674 | if (msg->msg.connect_conf.info) { | 819 | switch (card->bch[chan].fsm_state) { |
| 675 | card->bch[chan].fsm_state = ACT2000_STATE_NULL; | 820 | case ACT2000_STATE_ICALL: |
| 821 | case ACT2000_STATE_OWAIT: | ||
| 822 | ctmp = &card->bch[chan]; | ||
| 823 | if (msg->msg.select_b3_protocol_conf.info == 0) | ||
| 824 | actcapi_listen_b3_req(card, ctmp); | ||
| 825 | else { | ||
| 826 | ctmp->fsm_state = ACT2000_STATE_NULL; | ||
| 676 | cmd.driver = card->myid; | 827 | cmd.driver = card->myid; |
| 677 | cmd.command = ISDN_STAT_DHUP; | 828 | cmd.command = ISDN_STAT_DHUP; |
| 678 | cmd.arg = chan; | 829 | cmd.arg = chan; |
| 679 | card->interface.statcallb(&cmd); | 830 | card->interface.statcallb(&cmd); |
| 680 | } else { | ||
| 681 | card->bch[chan].fsm_state = ACT2000_STATE_OWAIT; | ||
| 682 | card->bch[chan].plci = msg->msg.connect_conf.plci; | ||
| 683 | } | 831 | } |
| 684 | } | 832 | } |
| 685 | break; | 833 | break; |
| 686 | case 0x0202: | 834 | case 0x8101: |
| 687 | /* CONNECT_IND */ | 835 | /* LISTEN_B3_CONF */ |
| 688 | chan = new_plci(card, msg->msg.connect_ind.plci); | 836 | chan = find_plci(card, msg->msg.listen_b3_conf.plci); |
| 689 | if (chan < 0) { | 837 | if (chan >= 0) |
| 690 | ctmp = (act2000_chan *)tmp; | 838 | switch (card->bch[chan].fsm_state) { |
| 691 | ctmp->plci = msg->msg.connect_ind.plci; | 839 | case ACT2000_STATE_ICALL: |
| 692 | actcapi_connect_resp(card, ctmp, 0x11); /* All Card-Cannels busy */ | 840 | ctmp = &card->bch[chan]; |
| 693 | } else { | 841 | if (msg->msg.listen_b3_conf.info == 0) |
| 694 | card->bch[chan].fsm_state = ACT2000_STATE_ICALL; | 842 | actcapi_connect_resp(card, ctmp, 0); |
| 695 | cmd.driver = card->myid; | ||
| 696 | cmd.command = ISDN_STAT_ICALL; | ||
| 697 | cmd.arg = chan; | ||
| 698 | cmd.parm.setup.si1 = msg->msg.connect_ind.si1; | ||
| 699 | cmd.parm.setup.si2 = msg->msg.connect_ind.si2; | ||
| 700 | if (card->ptype == ISDN_PTYPE_EURO) | ||
| 701 | strcpy(cmd.parm.setup.eazmsn, | ||
| 702 | act2000_find_eaz(card, msg->msg.connect_ind.eaz)); | ||
| 703 | else { | 843 | else { |
| 704 | cmd.parm.setup.eazmsn[0] = msg->msg.connect_ind.eaz; | 844 | ctmp->fsm_state = ACT2000_STATE_NULL; |
| 705 | cmd.parm.setup.eazmsn[1] = 0; | 845 | cmd.driver = card->myid; |
| 706 | } | 846 | cmd.command = ISDN_STAT_DHUP; |
| 707 | memset(cmd.parm.setup.phone, 0, sizeof(cmd.parm.setup.phone)); | 847 | cmd.arg = chan; |
| 708 | memcpy(cmd.parm.setup.phone, msg->msg.connect_ind.addr.num, | 848 | card->interface.statcallb(&cmd); |
| 709 | msg->msg.connect_ind.addr.len - 1); | ||
| 710 | cmd.parm.setup.plan = msg->msg.connect_ind.addr.tnp; | ||
| 711 | cmd.parm.setup.screen = 0; | ||
| 712 | if (card->interface.statcallb(&cmd) == 2) | ||
| 713 | actcapi_connect_resp(card, &card->bch[chan], 0x15); /* Reject Call */ | ||
| 714 | } | ||
| 715 | break; | ||
| 716 | case 0x0302: | ||
| 717 | /* CONNECT_ACTIVE_IND */ | ||
| 718 | chan = find_plci(card, msg->msg.connect_active_ind.plci); | ||
| 719 | if (chan >= 0) | ||
| 720 | switch (card->bch[chan].fsm_state) { | ||
| 721 | case ACT2000_STATE_IWAIT: | ||
| 722 | actcapi_connect_active_resp(card, &card->bch[chan]); | ||
| 723 | break; | ||
| 724 | case ACT2000_STATE_OWAIT: | ||
| 725 | actcapi_connect_active_resp(card, &card->bch[chan]); | ||
| 726 | actcapi_select_b2_protocol_req(card, &card->bch[chan]); | ||
| 727 | break; | ||
| 728 | } | 849 | } |
| 729 | break; | 850 | break; |
| 730 | case 0x8202: | 851 | case ACT2000_STATE_OWAIT: |
| 731 | /* CONNECT_B3_IND */ | ||
| 732 | chan = find_plci(card, msg->msg.connect_b3_ind.plci); | ||
| 733 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_IBWAIT)) { | ||
| 734 | card->bch[chan].ncci = msg->msg.connect_b3_ind.ncci; | ||
| 735 | actcapi_connect_b3_resp(card, &card->bch[chan], 0); | ||
| 736 | } else { | ||
| 737 | ctmp = (act2000_chan *)tmp; | ||
| 738 | ctmp->ncci = msg->msg.connect_b3_ind.ncci; | ||
| 739 | actcapi_connect_b3_resp(card, ctmp, 0x11); /* All Card-Cannels busy */ | ||
| 740 | } | ||
| 741 | break; | ||
| 742 | case 0x8302: | ||
| 743 | /* CONNECT_B3_ACTIVE_IND */ | ||
| 744 | chan = find_ncci(card, msg->msg.connect_b3_active_ind.ncci); | ||
| 745 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BWAIT)) { | ||
| 746 | actcapi_connect_b3_active_resp(card, &card->bch[chan]); | ||
| 747 | cmd.driver = card->myid; | ||
| 748 | cmd.command = ISDN_STAT_BCONN; | ||
| 749 | cmd.arg = chan; | ||
| 750 | card->interface.statcallb(&cmd); | ||
| 751 | } | ||
| 752 | break; | ||
| 753 | case 0x8402: | ||
| 754 | /* DISCONNECT_B3_IND */ | ||
| 755 | chan = find_ncci(card, msg->msg.disconnect_b3_ind.ncci); | ||
| 756 | if (chan >= 0) { | ||
| 757 | ctmp = &card->bch[chan]; | 852 | ctmp = &card->bch[chan]; |
| 758 | actcapi_disconnect_b3_resp(card, ctmp); | 853 | if (msg->msg.listen_b3_conf.info == 0) { |
| 759 | switch (ctmp->fsm_state) { | 854 | actcapi_connect_b3_req(card, ctmp); |
| 760 | case ACT2000_STATE_ACTIVE: | 855 | ctmp->fsm_state = ACT2000_STATE_OBWAIT; |
| 761 | ctmp->fsm_state = ACT2000_STATE_DHWAIT2; | 856 | cmd.driver = card->myid; |
| 762 | cmd.driver = card->myid; | 857 | cmd.command = ISDN_STAT_DCONN; |
| 763 | cmd.command = ISDN_STAT_BHUP; | 858 | cmd.arg = chan; |
| 764 | cmd.arg = chan; | 859 | card->interface.statcallb(&cmd); |
| 765 | card->interface.statcallb(&cmd); | 860 | } else { |
| 766 | break; | 861 | ctmp->fsm_state = ACT2000_STATE_NULL; |
| 767 | case ACT2000_STATE_BHWAIT2: | 862 | cmd.driver = card->myid; |
| 768 | actcapi_disconnect_req(card, ctmp); | 863 | cmd.command = ISDN_STAT_DHUP; |
| 769 | ctmp->fsm_state = ACT2000_STATE_DHWAIT; | 864 | cmd.arg = chan; |
| 770 | cmd.driver = card->myid; | 865 | card->interface.statcallb(&cmd); |
| 771 | cmd.command = ISDN_STAT_BHUP; | ||
| 772 | cmd.arg = chan; | ||
| 773 | card->interface.statcallb(&cmd); | ||
| 774 | break; | ||
| 775 | } | 866 | } |
| 867 | break; | ||
| 776 | } | 868 | } |
| 777 | break; | 869 | break; |
| 778 | case 0x0402: | 870 | case 0x8201: |
| 779 | /* DISCONNECT_IND */ | 871 | /* CONNECT_B3_CONF */ |
| 780 | chan = find_plci(card, msg->msg.disconnect_ind.plci); | 872 | chan = find_plci(card, msg->msg.connect_b3_conf.plci); |
| 781 | if (chan >= 0) { | 873 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_OBWAIT)) { |
| 782 | ctmp = &card->bch[chan]; | 874 | ctmp = &card->bch[chan]; |
| 783 | actcapi_disconnect_resp(card, ctmp); | 875 | if (msg->msg.connect_b3_conf.info) { |
| 784 | ctmp->fsm_state = ACT2000_STATE_NULL; | 876 | ctmp->fsm_state = ACT2000_STATE_NULL; |
| 785 | cmd.driver = card->myid; | 877 | cmd.driver = card->myid; |
| 786 | cmd.command = ISDN_STAT_DHUP; | 878 | cmd.command = ISDN_STAT_DHUP; |
| 787 | cmd.arg = chan; | 879 | cmd.arg = chan; |
| 788 | card->interface.statcallb(&cmd); | 880 | card->interface.statcallb(&cmd); |
| 789 | } else { | 881 | } else { |
| 790 | ctmp = (act2000_chan *)tmp; | 882 | ctmp->ncci = msg->msg.connect_b3_conf.ncci; |
| 791 | ctmp->plci = msg->msg.disconnect_ind.plci; | 883 | ctmp->fsm_state = ACT2000_STATE_BWAIT; |
| 792 | actcapi_disconnect_resp(card, ctmp); | ||
| 793 | } | 884 | } |
| 794 | break; | 885 | } |
| 795 | case 0x4001: | 886 | break; |
| 796 | /* SELECT_B2_PROTOCOL_CONF */ | 887 | case 0x8401: |
| 797 | chan = find_plci(card, msg->msg.select_b2_protocol_conf.plci); | 888 | /* DISCONNECT_B3_CONF */ |
| 798 | if (chan >= 0) | 889 | chan = find_ncci(card, msg->msg.disconnect_b3_conf.ncci); |
| 799 | switch (card->bch[chan].fsm_state) { | 890 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BHWAIT)) |
| 800 | case ACT2000_STATE_ICALL: | 891 | card->bch[chan].fsm_state = ACT2000_STATE_BHWAIT2; |
| 801 | case ACT2000_STATE_OWAIT: | 892 | break; |
| 802 | ctmp = &card->bch[chan]; | 893 | case 0x0702: |
| 803 | if (msg->msg.select_b2_protocol_conf.info == 0) | 894 | /* INFO_IND */ |
| 804 | actcapi_select_b3_protocol_req(card, ctmp); | 895 | chan = find_plci(card, msg->msg.info_ind.plci); |
| 805 | else { | 896 | if (chan >= 0) |
| 806 | ctmp->fsm_state = ACT2000_STATE_NULL; | 897 | /* TODO: Eval Charging info / cause */ |
| 807 | cmd.driver = card->myid; | 898 | actcapi_info_resp(card, &card->bch[chan]); |
| 808 | cmd.command = ISDN_STAT_DHUP; | 899 | break; |
| 809 | cmd.arg = chan; | 900 | case 0x0401: |
| 810 | card->interface.statcallb(&cmd); | 901 | /* LISTEN_CONF */ |
| 811 | } | 902 | case 0x0501: |
| 812 | break; | 903 | /* LISTEN_CONF */ |
| 813 | } | 904 | case 0xff01: |
| 814 | break; | 905 | /* MANUFACTURER_CONF */ |
| 815 | case 0x8001: | 906 | break; |
| 816 | /* SELECT_B3_PROTOCOL_CONF */ | 907 | case 0xff02: |
| 817 | chan = find_plci(card, msg->msg.select_b3_protocol_conf.plci); | 908 | /* MANUFACTURER_IND */ |
| 818 | if (chan >= 0) | 909 | if (msg->msg.manuf_msg == 3) { |
| 819 | switch (card->bch[chan].fsm_state) { | 910 | memset(tmp, 0, sizeof(tmp)); |
| 820 | case ACT2000_STATE_ICALL: | 911 | strncpy(tmp, |
| 821 | case ACT2000_STATE_OWAIT: | 912 | &msg->msg.manufacturer_ind_err.errstring, |
| 822 | ctmp = &card->bch[chan]; | 913 | msg->hdr.len - 16); |
| 823 | if (msg->msg.select_b3_protocol_conf.info == 0) | 914 | if (msg->msg.manufacturer_ind_err.errcode) |
| 824 | actcapi_listen_b3_req(card, ctmp); | 915 | printk(KERN_WARNING "act2000: %s\n", tmp); |
| 825 | else { | 916 | else { |
| 826 | ctmp->fsm_state = ACT2000_STATE_NULL; | 917 | printk(KERN_DEBUG "act2000: %s\n", tmp); |
| 827 | cmd.driver = card->myid; | 918 | if ((!strncmp(tmp, "INFO: Trace buffer con", 22)) || |
| 828 | cmd.command = ISDN_STAT_DHUP; | 919 | (!strncmp(tmp, "INFO: Compile Date/Tim", 22))) { |
| 829 | cmd.arg = chan; | 920 | card->flags |= ACT2000_FLAGS_RUNNING; |
| 830 | card->interface.statcallb(&cmd); | 921 | cmd.command = ISDN_STAT_RUN; |
| 831 | } | ||
| 832 | } | ||
| 833 | break; | ||
| 834 | case 0x8101: | ||
| 835 | /* LISTEN_B3_CONF */ | ||
| 836 | chan = find_plci(card, msg->msg.listen_b3_conf.plci); | ||
| 837 | if (chan >= 0) | ||
| 838 | switch (card->bch[chan].fsm_state) { | ||
| 839 | case ACT2000_STATE_ICALL: | ||
| 840 | ctmp = &card->bch[chan]; | ||
| 841 | if (msg->msg.listen_b3_conf.info == 0) | ||
| 842 | actcapi_connect_resp(card, ctmp, 0); | ||
| 843 | else { | ||
| 844 | ctmp->fsm_state = ACT2000_STATE_NULL; | ||
| 845 | cmd.driver = card->myid; | ||
| 846 | cmd.command = ISDN_STAT_DHUP; | ||
| 847 | cmd.arg = chan; | ||
| 848 | card->interface.statcallb(&cmd); | ||
| 849 | } | ||
| 850 | break; | ||
| 851 | case ACT2000_STATE_OWAIT: | ||
| 852 | ctmp = &card->bch[chan]; | ||
| 853 | if (msg->msg.listen_b3_conf.info == 0) { | ||
| 854 | actcapi_connect_b3_req(card, ctmp); | ||
| 855 | ctmp->fsm_state = ACT2000_STATE_OBWAIT; | ||
| 856 | cmd.driver = card->myid; | ||
| 857 | cmd.command = ISDN_STAT_DCONN; | ||
| 858 | cmd.arg = chan; | ||
| 859 | card->interface.statcallb(&cmd); | ||
| 860 | } else { | ||
| 861 | ctmp->fsm_state = ACT2000_STATE_NULL; | ||
| 862 | cmd.driver = card->myid; | ||
| 863 | cmd.command = ISDN_STAT_DHUP; | ||
| 864 | cmd.arg = chan; | ||
| 865 | card->interface.statcallb(&cmd); | ||
| 866 | } | ||
| 867 | break; | ||
| 868 | } | ||
| 869 | break; | ||
| 870 | case 0x8201: | ||
| 871 | /* CONNECT_B3_CONF */ | ||
| 872 | chan = find_plci(card, msg->msg.connect_b3_conf.plci); | ||
| 873 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_OBWAIT)) { | ||
| 874 | ctmp = &card->bch[chan]; | ||
| 875 | if (msg->msg.connect_b3_conf.info) { | ||
| 876 | ctmp->fsm_state = ACT2000_STATE_NULL; | ||
| 877 | cmd.driver = card->myid; | 922 | cmd.driver = card->myid; |
| 878 | cmd.command = ISDN_STAT_DHUP; | 923 | cmd.arg = 0; |
| 879 | cmd.arg = chan; | 924 | actcapi_manufacturer_req_net(card); |
| 925 | actcapi_manufacturer_req_msn(card); | ||
| 926 | actcapi_listen_req(card); | ||
| 880 | card->interface.statcallb(&cmd); | 927 | card->interface.statcallb(&cmd); |
| 881 | } else { | ||
| 882 | ctmp->ncci = msg->msg.connect_b3_conf.ncci; | ||
| 883 | ctmp->fsm_state = ACT2000_STATE_BWAIT; | ||
| 884 | } | 928 | } |
| 885 | } | 929 | } |
| 886 | break; | 930 | } |
| 887 | case 0x8401: | 931 | break; |
| 888 | /* DISCONNECT_B3_CONF */ | 932 | default: |
| 889 | chan = find_ncci(card, msg->msg.disconnect_b3_conf.ncci); | 933 | printk(KERN_WARNING "act2000: UNHANDLED Message %04x\n", ccmd); |
| 890 | if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BHWAIT)) | 934 | break; |
| 891 | card->bch[chan].fsm_state = ACT2000_STATE_BHWAIT2; | ||
| 892 | break; | ||
| 893 | case 0x0702: | ||
| 894 | /* INFO_IND */ | ||
| 895 | chan = find_plci(card, msg->msg.info_ind.plci); | ||
| 896 | if (chan >= 0) | ||
| 897 | /* TODO: Eval Charging info / cause */ | ||
| 898 | actcapi_info_resp(card, &card->bch[chan]); | ||
| 899 | break; | ||
| 900 | case 0x0401: | ||
| 901 | /* LISTEN_CONF */ | ||
| 902 | case 0x0501: | ||
| 903 | /* LISTEN_CONF */ | ||
| 904 | case 0xff01: | ||
| 905 | /* MANUFACTURER_CONF */ | ||
| 906 | break; | ||
| 907 | case 0xff02: | ||
| 908 | /* MANUFACTURER_IND */ | ||
| 909 | if (msg->msg.manuf_msg == 3) { | ||
| 910 | memset(tmp, 0, sizeof(tmp)); | ||
| 911 | strncpy(tmp, | ||
| 912 | &msg->msg.manufacturer_ind_err.errstring, | ||
| 913 | msg->hdr.len - 16); | ||
| 914 | if (msg->msg.manufacturer_ind_err.errcode) | ||
| 915 | printk(KERN_WARNING "act2000: %s\n", tmp); | ||
| 916 | else { | ||
| 917 | printk(KERN_DEBUG "act2000: %s\n", tmp); | ||
| 918 | if ((!strncmp(tmp, "INFO: Trace buffer con", 22)) || | ||
| 919 | (!strncmp(tmp, "INFO: Compile Date/Tim", 22))) { | ||
| 920 | card->flags |= ACT2000_FLAGS_RUNNING; | ||
| 921 | cmd.command = ISDN_STAT_RUN; | ||
| 922 | cmd.driver = card->myid; | ||
| 923 | cmd.arg = 0; | ||
| 924 | actcapi_manufacturer_req_net(card); | ||
| 925 | actcapi_manufacturer_req_msn(card); | ||
| 926 | actcapi_listen_req(card); | ||
| 927 | card->interface.statcallb(&cmd); | ||
| 928 | } | ||
| 929 | } | ||
| 930 | } | ||
| 931 | break; | ||
| 932 | default: | ||
| 933 | printk(KERN_WARNING "act2000: UNHANDLED Message %04x\n", ccmd); | ||
| 934 | break; | ||
| 935 | } | 935 | } |
| 936 | dev_kfree_skb(skb); | 936 | dev_kfree_skb(skb); |
| 937 | } | 937 | } |
| @@ -1015,7 +1015,7 @@ actcapi_debug_msg(struct sk_buff *skb, int direction) · 77 unmodified lines | |||
| 1015 | char *descr; | 1015 | char *descr; |
| 1016 | int i; | 1016 | int i; |
| 1017 | char tmp[170]; | 1017 | char tmp[170]; |
| 1018 | 1018 | ||
| 1019 | #ifndef DEBUG_DATA_MSG | 1019 | #ifndef DEBUG_DATA_MSG |
| 1020 | if (msg->hdr.cmd.cmd == 0x86) | 1020 | if (msg->hdr.cmd.cmd == 0x86) |
| 1021 | return; | 1021 | return; |
| @@ -1030,151 +1030,151 @@ actcapi_debug_msg(struct sk_buff *skb, int direction) · 8 unmodified lines | |||
| 1030 | descr = valid_msg[i].description; | 1030 | descr = valid_msg[i].description; |
| 1031 | break; | 1031 | break; |
| 1032 | } | 1032 | } |
| 1033 | printk(KERN_DEBUG "%s %s msg\n", direction?"Outgoing":"Incoming", descr); | 1033 | printk(KERN_DEBUG "%s %s msg\n", direction ? "Outgoing" : "Incoming", descr); |
| 1034 | printk(KERN_DEBUG " ApplID = %d\n", msg->hdr.applicationID); | 1034 | printk(KERN_DEBUG " ApplID = %d\n", msg->hdr.applicationID); |
| 1035 | printk(KERN_DEBUG " Len = %d\n", msg->hdr.len); | 1035 | printk(KERN_DEBUG " Len = %d\n", msg->hdr.len); |
| 1036 | printk(KERN_DEBUG " MsgNum = 0x%04x\n", msg->hdr.msgnum); | 1036 | printk(KERN_DEBUG " MsgNum = 0x%04x\n", msg->hdr.msgnum); |
| 1037 | printk(KERN_DEBUG " Cmd = 0x%02x\n", msg->hdr.cmd.cmd); | 1037 | printk(KERN_DEBUG " Cmd = 0x%02x\n", msg->hdr.cmd.cmd); |
| 1038 | printk(KERN_DEBUG " SubCmd = 0x%02x\n", msg->hdr.cmd.subcmd); | 1038 | printk(KERN_DEBUG " SubCmd = 0x%02x\n", msg->hdr.cmd.subcmd); |
| 1039 | switch (i) { | 1039 | switch (i) { |
| 1040 | case 0: | 1040 | case 0: |
| 1041 | /* DATA B3 IND */ | 1041 | /* DATA B3 IND */ |
| 1042 | printk(KERN_DEBUG " BLOCK = 0x%02x\n", | 1042 | printk(KERN_DEBUG " BLOCK = 0x%02x\n", |
| 1043 | msg->msg.data_b3_ind.blocknr); | 1043 | msg->msg.data_b3_ind.blocknr); |
| 1044 | break; | 1044 | break; |
| 1045 | case 2: | 1045 | case 2: |
| 1046 | /* CONNECT CONF */ | 1046 | /* CONNECT CONF */ |
| 1047 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | 1047 | printk(KERN_DEBUG " PLCI = 0x%04x\n", |
| 1048 | msg->msg.connect_conf.plci); | 1048 | msg->msg.connect_conf.plci); |
| 1049 | printk(KERN_DEBUG " Info = 0x%04x\n", | 1049 | printk(KERN_DEBUG " Info = 0x%04x\n", |
| 1050 | msg->msg.connect_conf.info); | 1050 | msg->msg.connect_conf.info); |
| 1051 | break; | 1051 | break; |
| 1052 | case 3: | ||
| 1053 | /* CONNECT IND */ | ||
| 1054 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1055 | msg->msg.connect_ind.plci); | ||
| 1056 | printk(KERN_DEBUG " Contr = %d\n", | ||
| 1057 | msg->msg.connect_ind.controller); | ||
| 1058 | printk(KERN_DEBUG " SI1 = %d\n", | ||
| 1059 | msg->msg.connect_ind.si1); | ||
| 1060 | printk(KERN_DEBUG " SI2 = %d\n", | ||
| 1061 | msg->msg.connect_ind.si2); | ||
| 1062 | printk(KERN_DEBUG " EAZ = '%c'\n", | ||
| 1063 | msg->msg.connect_ind.eaz); | ||
| 1064 | actcapi_debug_caddr(&msg->msg.connect_ind.addr); | ||
| 1065 | break; | ||
| 1066 | case 5: | ||
| 1067 | /* CONNECT ACTIVE IND */ | ||
| 1068 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1069 | msg->msg.connect_active_ind.plci); | ||
| 1070 | actcapi_debug_caddr(&msg->msg.connect_active_ind.addr); | ||
| 1071 | break; | ||
| 1072 | case 8: | ||
| 1073 | /* LISTEN CONF */ | ||
| 1074 | printk(KERN_DEBUG " Contr = %d\n", | ||
| 1075 | msg->msg.listen_conf.controller); | ||
| 1076 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1077 | msg->msg.listen_conf.info); | ||
| 1078 | break; | ||
| 1079 | case 11: | ||
| 1080 | /* INFO IND */ | ||
| 1081 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1082 | msg->msg.info_ind.plci); | ||
| 1083 | printk(KERN_DEBUG " Imsk = 0x%04x\n", | ||
| 1084 | msg->msg.info_ind.nr.mask); | ||
| 1085 | if (msg->hdr.len > 12) { | ||
| 1086 | int l = msg->hdr.len - 12; | ||
| 1087 | int j; | ||
| 1088 | char *p = tmp; | ||
| 1089 | for (j = 0; j < l; j++) | ||
| 1090 | p += sprintf(p, "%02x ", msg->msg.info_ind.el.display[j]); | ||
| 1091 | printk(KERN_DEBUG " D = '%s'\n", tmp); | ||
| 1092 | } | ||
| 1093 | break; | ||
| 1094 | case 14: | ||
| 1095 | /* SELECT B2 PROTOCOL CONF */ | ||
| 1096 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1097 | msg->msg.select_b2_protocol_conf.plci); | ||
| 1098 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1099 | msg->msg.select_b2_protocol_conf.info); | ||
| 1100 | break; | ||
| 1101 | case 15: | ||
| 1102 | /* SELECT B3 PROTOCOL CONF */ | ||
| 1103 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1104 | msg->msg.select_b3_protocol_conf.plci); | ||
| 1105 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1106 | msg->msg.select_b3_protocol_conf.info); | ||
| 1107 | break; | ||
| 1108 | case 16: | ||
| 1109 | /* LISTEN B3 CONF */ | ||
| 1110 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1111 | msg->msg.listen_b3_conf.plci); | ||
| 1112 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1113 | msg->msg.listen_b3_conf.info); | ||
| 1114 | break; | ||
| 1115 | case 18: | ||
| 1116 | /* CONNECT B3 IND */ | ||
| 1117 | printk(KERN_DEBUG " NCCI = 0x%04x\n", | ||
| 1118 | msg->msg.connect_b3_ind.ncci); | ||
| 1119 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1120 | msg->msg.connect_b3_ind.plci); | ||
| 1121 | actcapi_debug_ncpi(&msg->msg.connect_b3_ind.ncpi); | ||
| 1122 | break; | ||
| 1123 | case 19: | ||
| 1124 | /* CONNECT B3 ACTIVE IND */ | ||
| 1125 | printk(KERN_DEBUG " NCCI = 0x%04x\n", | ||
| 1126 | msg->msg.connect_b3_active_ind.ncci); | ||
| 1127 | actcapi_debug_ncpi(&msg->msg.connect_b3_active_ind.ncpi); | ||
| 1128 | break; | ||
| 1129 | case 26: | ||
| 1130 | /* MANUFACTURER IND */ | ||
| 1131 | printk(KERN_DEBUG " Mmsg = 0x%02x\n", | ||
| 1132 | msg->msg.manufacturer_ind_err.manuf_msg); | ||
| 1133 | switch (msg->msg.manufacturer_ind_err.manuf_msg) { | ||
| 1052 | case 3: | 1134 | case 3: |
| 1053 | /* CONNECT IND */ | ||
| 1054 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1055 | msg->msg.connect_ind.plci); | ||
| 1056 | printk(KERN_DEBUG " Contr = %d\n", | 1135 | printk(KERN_DEBUG " Contr = %d\n", |
| 1057 | msg->msg.connect_ind.controller); | 1136 | msg->msg.manufacturer_ind_err.controller); |
| 1058 | printk(KERN_DEBUG " SI1 = %d\n", | 1137 | printk(KERN_DEBUG " Code = 0x%08x\n", |
| 1059 | msg->msg.connect_ind.si1); | 1138 | msg->msg.manufacturer_ind_err.errcode); |
| 1060 | printk(KERN_DEBUG " SI2 = %d\n", | 1139 | memset(tmp, 0, sizeof(tmp)); |
| 1061 | msg->msg.connect_ind.si2); | 1140 | strncpy(tmp, &msg->msg.manufacturer_ind_err.errstring, |
| 1062 | printk(KERN_DEBUG " EAZ = '%c'\n", | 1141 | msg->hdr.len - 16); |
| 1063 | msg->msg.connect_ind.eaz); | 1142 | printk(KERN_DEBUG " Emsg = '%s'\n", tmp); |
| 1064 | actcapi_debug_caddr(&msg->msg.connect_ind.addr); | ||
| 1065 | break; | ||
| 1066 | case 5: | ||
| 1067 | /* CONNECT ACTIVE IND */ | ||
| 1068 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1069 | msg->msg.connect_active_ind.plci); | ||
| 1070 | actcapi_debug_caddr(&msg->msg.connect_active_ind.addr); | ||
| 1071 | break; | ||
| 1072 | case 8: | ||
| 1073 | /* LISTEN CONF */ | ||
| 1074 | printk(KERN_DEBUG " Contr = %d\n", | ||
| 1075 | msg->msg.listen_conf.controller); | ||
| 1076 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1077 | msg->msg.listen_conf.info); | ||
| 1078 | break; | ||
| 1079 | case 11: | ||
| 1080 | /* INFO IND */ | ||
| 1081 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1082 | msg->msg.info_ind.plci); | ||
| 1083 | printk(KERN_DEBUG " Imsk = 0x%04x\n", | ||
| 1084 | msg->msg.info_ind.nr.mask); | ||
| 1085 | if (msg->hdr.len > 12) { | ||
| 1086 | int l = msg->hdr.len - 12; | ||
| 1087 | int j; | ||
| 1088 | char *p = tmp; | ||
| 1089 | for (j = 0; j < l ; j++) | ||
| 1090 | p += sprintf(p, "%02x ", msg->msg.info_ind.el.display[j]); | ||
| 1091 | printk(KERN_DEBUG " D = '%s'\n", tmp); | ||
| 1092 | } | ||
| 1093 | break; | ||
| 1094 | case 14: | ||
| 1095 | /* SELECT B2 PROTOCOL CONF */ | ||
| 1096 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1097 | msg->msg.select_b2_protocol_conf.plci); | ||
| 1098 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1099 | msg->msg.select_b2_protocol_conf.info); | ||
| 1100 | break; | ||
| 1101 | case 15: | ||
| 1102 | /* SELECT B3 PROTOCOL CONF */ | ||
| 1103 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1104 | msg->msg.select_b3_protocol_conf.plci); | ||
| 1105 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1106 | msg->msg.select_b3_protocol_conf.info); | ||
| 1107 | break; | ||
| 1108 | case 16: | ||
| 1109 | /* LISTEN B3 CONF */ | ||
| 1110 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1111 | msg->msg.listen_b3_conf.plci); | ||
| 1112 | printk(KERN_DEBUG " Info = 0x%04x\n", | ||
| 1113 | msg->msg.listen_b3_conf.info); | ||
| 1114 | break; | ||
| 1115 | case 18: | ||
| 1116 | /* CONNECT B3 IND */ | ||
| 1117 | printk(KERN_DEBUG " NCCI = 0x%04x\n", | ||
| 1118 | msg->msg.connect_b3_ind.ncci); | ||
| 1119 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1120 | msg->msg.connect_b3_ind.plci); | ||
| 1121 | actcapi_debug_ncpi(&msg->msg.connect_b3_ind.ncpi); | ||
| 1122 | break; | ||
| 1123 | case 19: | ||
| 1124 | /* CONNECT B3 ACTIVE IND */ | ||
| 1125 | printk(KERN_DEBUG " NCCI = 0x%04x\n", | ||
| 1126 | msg->msg.connect_b3_active_ind.ncci); | ||
| 1127 | actcapi_debug_ncpi(&msg->msg.connect_b3_active_ind.ncpi); | ||
| 1128 | break; | ||
| 1129 | case 26: | ||
| 1130 | /* MANUFACTURER IND */ | ||
| 1131 | printk(KERN_DEBUG " Mmsg = 0x%02x\n", | ||
| 1132 | msg->msg.manufacturer_ind_err.manuf_msg); | ||
| 1133 | switch (msg->msg.manufacturer_ind_err.manuf_msg) { | ||
| 1134 | case 3: | ||
| 1135 | printk(KERN_DEBUG " Contr = %d\n", | ||
| 1136 | msg->msg.manufacturer_ind_err.controller); | ||
| 1137 | printk(KERN_DEBUG " Code = 0x%08x\n", | ||
| 1138 | msg->msg.manufacturer_ind_err.errcode); | ||
| 1139 | memset(tmp, 0, sizeof(tmp)); | ||
| 1140 | strncpy(tmp, &msg->msg.manufacturer_ind_err.errstring, | ||
| 1141 | msg->hdr.len - 16); | ||
| 1142 | printk(KERN_DEBUG " Emsg = '%s'\n", tmp); | ||
| 1143 | break; | ||
| 1144 | } | ||
| 1145 | break; | ||
| 1146 | case 30: | ||
| 1147 | /* LISTEN REQ */ | ||
| 1148 | printk(KERN_DEBUG " Imsk = 0x%08x\n", | ||
| 1149 | msg->msg.listen_req.infomask); | ||
| 1150 | printk(KERN_DEBUG " Emsk = 0x%04x\n", | ||
| 1151 | msg->msg.listen_req.eazmask); | ||
| 1152 | printk(KERN_DEBUG " Smsk = 0x%04x\n", | ||
| 1153 | msg->msg.listen_req.simask); | ||
| 1154 | break; | ||
| 1155 | case 35: | ||
| 1156 | /* SELECT_B2_PROTOCOL_REQ */ | ||
| 1157 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1158 | msg->msg.select_b2_protocol_req.plci); | ||
| 1159 | printk(KERN_DEBUG " prot = 0x%02x\n", | ||
| 1160 | msg->msg.select_b2_protocol_req.protocol); | ||
| 1161 | if (msg->hdr.len >= 11) | ||
| 1162 | printk(KERN_DEBUG "No dlpd\n"); | ||
| 1163 | else | ||
| 1164 | actcapi_debug_dlpd(&msg->msg.select_b2_protocol_req.dlpd); | ||
| 1165 | break; | ||
| 1166 | case 44: | ||
| 1167 | /* CONNECT RESP */ | ||
| 1168 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1169 | msg->msg.connect_resp.plci); | ||
| 1170 | printk(KERN_DEBUG " CAUSE = 0x%02x\n", | ||
| 1171 | msg->msg.connect_resp.rejectcause); | ||
| 1172 | break; | ||
| 1173 | case 45: | ||
| 1174 | /* CONNECT ACTIVE RESP */ | ||
| 1175 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1176 | msg->msg.connect_active_resp.plci); | ||
| 1177 | break; | 1143 | break; |
| 1144 | } | ||
| 1145 | break; | ||
| 1146 | case 30: | ||
| 1147 | /* LISTEN REQ */ | ||
| 1148 | printk(KERN_DEBUG " Imsk = 0x%08x\n", | ||
| 1149 | msg->msg.listen_req.infomask); | ||
| 1150 | printk(KERN_DEBUG " Emsk = 0x%04x\n", | ||
| 1151 | msg->msg.listen_req.eazmask); | ||
| 1152 | printk(KERN_DEBUG " Smsk = 0x%04x\n", | ||
| 1153 | msg->msg.listen_req.simask); | ||
| 1154 | break; | ||
| 1155 | case 35: | ||
| 1156 | /* SELECT_B2_PROTOCOL_REQ */ | ||
| 1157 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1158 | msg->msg.select_b2_protocol_req.plci); | ||
| 1159 | printk(KERN_DEBUG " prot = 0x%02x\n", | ||
| 1160 | msg->msg.select_b2_protocol_req.protocol); | ||
| 1161 | if (msg->hdr.len >= 11) | ||
| 1162 | printk(KERN_DEBUG "No dlpd\n"); | ||
| 1163 | else | ||
| 1164 | actcapi_debug_dlpd(&msg->msg.select_b2_protocol_req.dlpd); | ||
| 1165 | break; | ||
| 1166 | case 44: | ||
| 1167 | /* CONNECT RESP */ | ||
| 1168 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1169 | msg->msg.connect_resp.plci); | ||
| 1170 | printk(KERN_DEBUG " CAUSE = 0x%02x\n", | ||
| 1171 | msg->msg.connect_resp.rejectcause); | ||
| 1172 | break; | ||
| 1173 | case 45: | ||
| 1174 | /* CONNECT ACTIVE RESP */ | ||
| 1175 | printk(KERN_DEBUG " PLCI = 0x%04x\n", | ||
| 1176 | msg->msg.connect_active_resp.plci); | ||
| 1177 | break; | ||
| 1178 | } | 1178 | } |
| 1179 | } | 1179 | } |
| 1180 | #endif | 1180 | #endif |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | * | 4 | * |
| 5 | * Author Fritz Elfert | 5 | * Author Fritz Elfert |
| 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
| 7 | * | 7 | * |
| 8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
| 9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
| 10 | * | 10 | * |
| @@ -46,10 +46,10 @@ typedef struct actcapi_addr { · 35 unmodified lines | |||
| 46 | typedef union actcapi_infonr { /* info number */ | 46 | typedef union actcapi_infonr { /* info number */ |
| 47 | __u16 mask; /* info-mask field */ | 47 | __u16 mask; /* info-mask field */ |
| 48 | struct bmask { /* bit definitions */ | 48 | struct bmask { /* bit definitions */ |
| 49 | unsigned codes : 3; /* code set */ | 49 | unsigned codes:3; /* code set */ |
| 50 | unsigned rsvd : 5; /* reserved */ | 50 | unsigned rsvd:5; /* reserved */ |
| 51 | unsigned svind : 1; /* single, variable length ind. */ | 51 | unsigned svind:1; /* single, variable length ind. */ |
| 52 | unsigned wtype : 7; /* W-element type */ | 52 | unsigned wtype:7; /* W-element type */ |
| 53 | } bmask; | 53 | } bmask; |
| 54 | } actcapi_infonr; | 54 | } actcapi_infonr; |
| 55 | 55 | ||
| @@ -59,13 +59,13 @@ typedef union actcapi_infoel { /* info element */ · 3 unmodified lines | |||
| 59 | __u8 display[40]; /* display contents */ | 59 | __u8 display[40]; /* display contents */ |
| 60 | __u8 uuinfo[40]; /* User-user info field */ | 60 | __u8 uuinfo[40]; /* User-user info field */ |
| 61 | struct cause { /* Cause information */ | 61 | struct cause { /* Cause information */ |
| 62 | unsigned ext2 : 1; /* extension */ | 62 | unsigned ext2:1; /* extension */ |
| 63 | unsigned cod : 2; /* coding standard */ | 63 | unsigned cod:2; /* coding standard */ |
| 64 | unsigned spare : 1; /* spare */ | 64 | unsigned spare:1; /* spare */ |
| 65 | unsigned loc : 4; /* location */ | 65 | unsigned loc:4; /* location */ |
| 66 | unsigned ext1 : 1; /* extension */ | 66 | unsigned ext1:1; /* extension */ |
| 67 | unsigned cval : 7; /* Cause value */ | 67 | unsigned cval:7; /* Cause value */ |
| 68 | } cause; | 68 | } cause; |
| 69 | struct charge { /* Charging information */ | 69 | struct charge { /* Charging information */ |
| 70 | __u8 toc; /* type of charging info */ | 70 | __u8 toc; /* type of charging info */ |
| 71 | __u8 unit[10]; /* charging units */ | 71 | __u8 unit[10]; /* charging units */ |
| @@ -111,14 +111,14 @@ typedef struct actcapi_ncpd { · 39 unmodified lines | |||
| 111 | * Bit 5-7 = Controller | 111 | * Bit 5-7 = Controller |
| 112 | * Bit 8-15 = NCCI | 112 | * Bit 8-15 = NCCI |
| 113 | */ | 113 | */ |
| 114 | #define MAKE_NCCI(plci,contr,ncci) \ | 114 | #define MAKE_NCCI(plci, contr, ncci) \ |
| 115 | ((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8)) | 115 | ((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8)) |
| 116 | 116 | ||
| 117 | #define EVAL_NCCI(fakencci,plci,contr,ncci) { \ | 117 | #define EVAL_NCCI(fakencci, plci, contr, ncci) { \ |
| 118 | plci = fakencci & 0x1f; \ | 118 | plci = fakencci & 0x1f; \ |
| 119 | contr = (fakencci >> 5) & 0x7; \ | 119 | contr = (fakencci >> 5) & 0x7; \ |
| 120 | ncci = (fakencci >> 8) & 0xff; \ | 120 | ncci = (fakencci >> 8) & 0xff; \ |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | /* | 123 | /* |
| 124 | * Layout of PLCI field in a B3 DATA CAPI message is different from | 124 | * Layout of PLCI field in a B3 DATA CAPI message is different from |
| @@ -128,13 +128,13 @@ typedef struct actcapi_ncpd { · 3 unmodified lines | |||
| 128 | * Bit 5-7 = Controller | 128 | * Bit 5-7 = Controller |
| 129 | * Bit 8-15 = reserved (must be 0) | 129 | * Bit 8-15 = reserved (must be 0) |
| 130 | */ | 130 | */ |
| 131 | #define MAKE_PLCI(plci,contr) \ | 131 | #define MAKE_PLCI(plci, contr) \ |
| 132 | ((plci & 0x1f) | ((contr & 0x7) << 5)) | 132 | ((plci & 0x1f) | ((contr & 0x7) << 5)) |
| 133 | 133 | ||
| 134 | #define EVAL_PLCI(fakeplci,plci,contr) { \ | 134 | #define EVAL_PLCI(fakeplci, plci, contr) { \ |
| 135 | plci = fakeplci & 0x1f; \ | 135 | plci = fakeplci & 0x1f; \ |
| 136 | contr = (fakeplci >> 5) & 0x7; \ | 136 | contr = (fakeplci >> 5) & 0x7; \ |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | typedef struct actcapi_msg { | 139 | typedef struct actcapi_msg { |
| 140 | actcapi_msghdr hdr; | 140 | actcapi_msghdr hdr; |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | * | 4 | * |
| 5 | * Author Fritz Elfert | 5 | * Author Fritz Elfert |
| 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
| 7 | * | 7 | * |
| 8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
| 9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
| 10 | * | 10 | * |
| @@ -21,8 +21,8 @@ · 10 unmodified lines | |||
| 21 | 21 | ||
| 22 | static unsigned short act2000_isa_ports[] = | 22 | static unsigned short act2000_isa_ports[] = |
| 23 | { | 23 | { |
| 24 | 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, | 24 | 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, |
| 25 | 0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60, | 25 | 0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60, |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | static act2000_card *cards = (act2000_card *) NULL; | 28 | static act2000_card *cards = (act2000_card *) NULL; |
| @@ -33,14 +33,14 @@ static int act_port = -1; /* -1 = Autoprobe */ · 4 unmodified lines | |||
| 33 | static int act_irq = -1; | 33 | static int act_irq = -1; |
| 34 | static char *act_id = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; | 34 | static char *act_id = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; |
| 35 | 35 | ||
| 36 | MODULE_DESCRIPTION( "ISDN4Linux: Driver for IBM Active 2000 ISDN card"); | 36 | MODULE_DESCRIPTION("ISDN4Linux: Driver for IBM Active 2000 ISDN card"); |
| 37 | MODULE_AUTHOR( "Fritz Elfert"); | 37 | MODULE_AUTHOR("Fritz Elfert"); |
| 38 | MODULE_LICENSE( "GPL"); | 38 | MODULE_LICENSE("GPL"); |
| 39 | MODULE_PARM_DESC(act_bus, "BusType of first card, 1=ISA, 2=MCA, 3=PCMCIA, currently only ISA"); | 39 | MODULE_PARM_DESC(act_bus, "BusType of first card, 1=ISA, 2=MCA, 3=PCMCIA, currently only ISA"); |
| 40 | MODULE_PARM_DESC(membase, "Base port address of first card"); | 40 | MODULE_PARM_DESC(membase, "Base port address of first card"); |
| 41 | MODULE_PARM_DESC(act_irq, "IRQ of first card"); | 41 | MODULE_PARM_DESC(act_irq, "IRQ of first card"); |
| 42 | MODULE_PARM_DESC(act_id, "ID-String of first card"); | 42 | MODULE_PARM_DESC(act_id, "ID-String of first card"); |
| 43 | module_param(act_bus, int, 0); | 43 | module_param(act_bus, int, 0); |
| 44 | module_param(act_port, int, 0); | 44 | module_param(act_port, int, 0); |
| 45 | module_param(act_irq, int, 0); | 45 | module_param(act_irq, int, 0); |
| 46 | module_param(act_id, charp, 0); | 46 | module_param(act_id, charp, 0); |
| @@ -51,7 +51,7 @@ static act2000_chan * · 4 unmodified lines | |||
| 51 | find_channel(act2000_card *card, int channel) | 51 | find_channel(act2000_card *card, int channel) |
| 52 | { | 52 | { |
| 53 | if ((channel >= 0) && (channel < ACT2000_BCH)) | 53 | if ((channel >= 0) && (channel < ACT2000_BCH)) |
| 54 | return &(card->bch[channel]); | 54 | return &(card->bch[channel]); |
| 55 | printk(KERN_WARNING "act2000: Invalid channel %d\n", channel); | 55 | printk(KERN_WARNING "act2000: Invalid channel %d\n", channel); |
| 56 | return NULL; | 56 | return NULL; |
| 57 | } | 57 | } |
| @@ -84,7 +84,7 @@ act2000_clear_msn(act2000_card *card) · 26 unmodified lines | |||
| 84 | static __u16 | 84 | static __u16 |
| 85 | act2000_find_msn(act2000_card *card, char *msn, int ia5) | 85 | act2000_find_msn(act2000_card *card, char *msn, int ia5) |
| 86 | { | 86 | { |
| 87 | struct msn_entry *p = card->msn_list; | 87 | struct msn_entry *p = card->msn_list; |
| 88 | __u8 eaz = '0'; | 88 | __u8 eaz = '0'; |
| 89 | 89 | ||
| 90 | while (p) { | 90 | while (p) { |
| @@ -107,14 +107,14 @@ act2000_find_msn(act2000_card *card, char *msn, int ia5) · 16 unmodified lines | |||
| 107 | char * | 107 | char * |
| 108 | act2000_find_eaz(act2000_card *card, char eaz) | 108 | act2000_find_eaz(act2000_card *card, char eaz) |
| 109 | { | 109 | { |
| 110 | struct msn_entry *p = card->msn_list; | 110 | struct msn_entry *p = card->msn_list; |
| 111 | 111 | ||
| 112 | while (p) { | 112 | while (p) { |
| 113 | if (p->eaz == eaz) | 113 | if (p->eaz == eaz) |
| 114 | return(p->msn); | 114 | return (p->msn); |
| 115 | p = p->next; | 115 | p = p->next; |
| 116 | } | 116 | } |
| 117 | return("\0"); | 117 | return ("\0"); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | /* | 120 | /* |
| @@ -126,11 +126,11 @@ act2000_find_eaz(act2000_card *card, char eaz) · 5 unmodified lines | |||
| 126 | static int | 126 | static int |
| 127 | act2000_set_msn(act2000_card *card, char *eazmsn) | 127 | act2000_set_msn(act2000_card *card, char *eazmsn) |
| 128 | { | 128 | { |
| 129 | struct msn_entry *p = card->msn_list; | 129 | struct msn_entry *p = card->msn_list; |
| 130 | struct msn_entry *q = NULL; | 130 | struct msn_entry *q = NULL; |
| 131 | unsigned long flags; | 131 | unsigned long flags; |
| 132 | int i; | 132 | int i; |
| 133 | 133 | ||
| 134 | if (!strlen(eazmsn)) | 134 | if (!strlen(eazmsn)) |
| 135 | return 0; | 135 | return 0; |
| 136 | if (strlen(eazmsn) > 16) | 136 | if (strlen(eazmsn) > 16) |
| @@ -138,7 +138,7 @@ act2000_set_msn(act2000_card *card, char *eazmsn) · 1 unmodified line | |||
| 138 | for (i = 0; i < strlen(eazmsn); i++) | 138 | for (i = 0; i < strlen(eazmsn); i++) |
| 139 | if (!isdigit(eazmsn[i])) | 139 | if (!isdigit(eazmsn[i])) |
| 140 | return -EINVAL; | 140 | return -EINVAL; |
| 141 | if (strlen(eazmsn) == 1) { | 141 | if (strlen(eazmsn) == 1) { |
| 142 | /* Delete a single MSN */ | 142 | /* Delete a single MSN */ |
| 143 | while (p) { | 143 | while (p) { |
| 144 | if (p->eaz == eazmsn[0]) { | 144 | if (p->eaz == eazmsn[0]) { |
| @@ -158,7 +158,7 @@ act2000_set_msn(act2000_card *card, char *eazmsn) · 13 unmodified lines | |||
| 158 | p = p->next; | 158 | p = p->next; |
| 159 | } | 159 | } |
| 160 | return 0; | 160 | return 0; |
| 161 | } | 161 | } |
| 162 | /* Add a single MSN */ | 162 | /* Add a single MSN */ |
| 163 | while (p) { | 163 | while (p) { |
| 164 | /* Found in list, replace MSN */ | 164 | /* Found in list, replace MSN */ |
| @@ -198,14 +198,14 @@ act2000_transmit(struct work_struct *work) · 33 unmodified lines | |||
| 198 | container_of(work, struct act2000_card, snd_tq); | 198 | container_of(work, struct act2000_card, snd_tq); |
| 199 | 199 | ||
| 200 | switch (card->bus) { | 200 | switch (card->bus) { |
| 201 | case ACT2000_BUS_ISA: | 201 | case ACT2000_BUS_ISA: |
| 202 | act2000_isa_send(card); | 202 | act2000_isa_send(card); |
| 203 | break; | 203 | break; |
| 204 | case ACT2000_BUS_PCMCIA: | 204 | case ACT2000_BUS_PCMCIA: |
| 205 | case ACT2000_BUS_MCA: | 205 | case ACT2000_BUS_MCA: |
| 206 | default: | 206 | default: |
| 207 | printk(KERN_WARNING | 207 | printk(KERN_WARNING |
| 208 | "act2000_transmit: Illegal bustype %d\n", card->bus); | 208 | "act2000_transmit: Illegal bustype %d\n", card->bus); |
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | 211 | ||
| @@ -216,221 +216,221 @@ act2000_receive(struct work_struct *work) · 4 unmodified lines | |||
| 216 | container_of(work, struct act2000_card, poll_tq); | 216 | container_of(work, struct act2000_card, poll_tq); |
| 217 | 217 | ||
| 218 | switch (card->bus) { | 218 | switch (card->bus) { |
| 219 | case ACT2000_BUS_ISA: | 219 | case ACT2000_BUS_ISA: |
| 220 | act2000_isa_receive(card); | 220 | act2000_isa_receive(card); |
| 221 | break; | 221 | break; |
| 222 | case ACT2000_BUS_PCMCIA: | 222 | case ACT2000_BUS_PCMCIA: |
| 223 | case ACT2000_BUS_MCA: | 223 | case ACT2000_BUS_MCA: |
| 224 | default: | 224 | default: |
| 225 | printk(KERN_WARNING | 225 | printk(KERN_WARNING |
| 226 | "act2000_receive: Illegal bustype %d\n", card->bus); | 226 | "act2000_receive: Illegal bustype %d\n", card->bus); |
| 227 | } | 227 | } |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | static void | 230 | static void |
| 231 | act2000_poll(unsigned long data) | 231 | act2000_poll(unsigned long data) |
| 232 | { | 232 | { |
| 233 | act2000_card * card = (act2000_card *)data; | 233 | act2000_card *card = (act2000_card *)data; |
| 234 | unsigned long flags; | 234 | unsigned long flags; |
| 235 | 235 | ||
| 236 | act2000_receive(&card->poll_tq); | 236 | act2000_receive(&card->poll_tq); |
| 237 | spin_lock_irqsave(&card->lock, flags); | 237 | spin_lock_irqsave(&card->lock, flags); |
| 238 | mod_timer(&card->ptimer, jiffies+3); | 238 | mod_timer(&card->ptimer, jiffies + 3); |
| 239 | spin_unlock_irqrestore(&card->lock, flags); | 239 | spin_unlock_irqrestore(&card->lock, flags); |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | static int | 242 | static int |
| 243 | act2000_command(act2000_card * card, isdn_ctrl * c) | 243 | act2000_command(act2000_card *card, isdn_ctrl *c) |
| 244 | { | 244 | { |
| 245 | ulong a; | 245 | ulong a; |
| 246 | act2000_chan *chan; | 246 | act2000_chan *chan; |
| 247 | act2000_cdef cdef; | 247 | act2000_cdef cdef; |
| 248 | isdn_ctrl cmd; | 248 | isdn_ctrl cmd; |
| 249 | char tmp[17]; | 249 | char tmp[17]; |
| 250 | int ret; | 250 | int ret; |
| 251 | unsigned long flags; | 251 | unsigned long flags; |
| 252 | void __user *arg; | 252 | void __user *arg; |
| 253 | 253 | ||
| 254 | switch (c->command) { | 254 | switch (c->command) { |
| 255 | case ISDN_CMD_IOCTL: | 255 | case ISDN_CMD_IOCTL: |
| 256 | memcpy(&a, c->parm.num, sizeof(ulong)); | 256 | memcpy(&a, c->parm.num, sizeof(ulong)); |
| 257 | arg = (void __user *)a; | 257 | arg = (void __user *)a; |
| 258 | switch (c->arg) { | 258 | switch (c->arg) { |
| 259 | case ACT2000_IOCTL_LOADBOOT: | 259 | case ACT2000_IOCTL_LOADBOOT: |
| 260 | switch (card->bus) { | 260 | switch (card->bus) { |
| 261 | case ACT2000_BUS_ISA: | 261 | case ACT2000_BUS_ISA: |
| 262 | ret = act2000_isa_download(card, | 262 | ret = act2000_isa_download(card, |
| 263 | arg); | 263 | arg); |
| 264 | if (!ret) { | 264 | if (!ret) { |
| 265 | card->flags |= ACT2000_FLAGS_LOADED; | 265 | card->flags |= ACT2000_FLAGS_LOADED; |
| 266 | if (!(card->flags & ACT2000_FLAGS_IVALID)) { | 266 | if (!(card->flags & ACT2000_FLAGS_IVALID)) { |
| 267 | card->ptimer.expires = jiffies + 3; | 267 | card->ptimer.expires = jiffies + 3; |
| 268 | card->ptimer.function = act2000_poll; | 268 | card->ptimer.function = act2000_poll; |
| 269 | card->ptimer.data = (unsigned long)card; | 269 | card->ptimer.data = (unsigned long)card; |
| 270 | add_timer(&card->ptimer); | 270 | add_timer(&card->ptimer); |
| 271 | } | ||
| 272 | actcapi_manufacturer_req_errh(card); | ||
| 273 | } | ||
| 274 | break; | ||
| 275 | default: | ||
| 276 | printk(KERN_WARNING | ||
| 277 | "act2000: Illegal BUS type %d\n", | ||
| 278 | card->bus); | ||
| 279 | ret = -EIO; | ||
| 280 | } | 271 | } |
| 281 | return ret; | 272 | actcapi_manufacturer_req_errh(card); |
| 282 | case ACT2000_IOCTL_SETPROTO: | 273 | } |
| 283 | card->ptype = a?ISDN_PTYPE_EURO:ISDN_PTYPE_1TR6; | ||
| 284 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 285 | return 0; | ||
| 286 | actcapi_manufacturer_req_net(card); | ||
| 287 | return 0; | ||
| 288 | case ACT2000_IOCTL_SETMSN: | ||
| 289 | if (copy_from_user(tmp, arg, | ||
| 290 | sizeof(tmp))) | ||
| 291 | return -EFAULT; | ||
| 292 | if ((ret = act2000_set_msn(card, tmp))) | ||
| 293 | return ret; | ||
| 294 | if (card->flags & ACT2000_FLAGS_RUNNING) | ||
| 295 | return(actcapi_manufacturer_req_msn(card)); | ||
| 296 | return 0; | ||
| 297 | case ACT2000_IOCTL_ADDCARD: | ||
| 298 | if (copy_from_user(&cdef, arg, | ||
| 299 | sizeof(cdef))) | ||
| 300 | return -EFAULT; | ||
| 301 | if (act2000_addcard(cdef.bus, cdef.port, cdef.irq, cdef.id)) | ||
| 302 | return -EIO; | ||
| 303 | return 0; | ||
| 304 | case ACT2000_IOCTL_TEST: | ||
| 305 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 306 | return -ENODEV; | ||
| 307 | return 0; | ||
| 308 | default: | ||
| 309 | return -EINVAL; | ||
| 310 | } | ||
| 311 | break; | ||
| 312 | case ISDN_CMD_DIAL: | ||
| 313 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 314 | return -ENODEV; | ||
| 315 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 316 | break; | 274 | break; |
| 317 | spin_lock_irqsave(&card->lock, flags); | 275 | default: |
| 318 | if (chan->fsm_state != ACT2000_STATE_NULL) { | 276 | printk(KERN_WARNING |
| 319 | spin_unlock_irqrestore(&card->lock, flags); | 277 | "act2000: Illegal BUS type %d\n", |
| 320 | printk(KERN_WARNING "Dial on channel with state %d\n", | 278 | card->bus); |
| 321 | chan->fsm_state); | 279 | ret = -EIO; |
| 322 | return -EBUSY; | ||
| 323 | } | ||
| 324 | if (card->ptype == ISDN_PTYPE_EURO) | ||
| 325 | tmp[0] = act2000_find_msn(card, c->parm.setup.eazmsn, 1); | ||
| 326 | else | ||
| 327 | tmp[0] = c->parm.setup.eazmsn[0]; | ||
| 328 | chan->fsm_state = ACT2000_STATE_OCALL; | ||
| 329 | chan->callref = 0xffff; | ||
| 330 | spin_unlock_irqrestore(&card->lock, flags); | ||
| 331 | ret = actcapi_connect_req(card, chan, c->parm.setup.phone, | ||
| 332 | tmp[0], c->parm.setup.si1, | ||
| 333 | c->parm.setup.si2); | ||
| 334 | if (ret) { | ||
| 335 | cmd.driver = card->myid; | ||
| 336 | cmd.command = ISDN_STAT_DHUP; | ||
| 337 | cmd.arg &= 0x0f; | ||
| 338 | card->interface.statcallb(&cmd); | ||
| 339 | } | 280 | } |
| 340 | return ret; | 281 | return ret; |
| 341 | case ISDN_CMD_ACCEPTD: | 282 | case ACT2000_IOCTL_SETPROTO: |
| 342 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 283 | card->ptype = a ? ISDN_PTYPE_EURO : ISDN_PTYPE_1TR6; |
| 343 | return -ENODEV; | ||
| 344 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 345 | break; | ||
| 346 | if (chan->fsm_state == ACT2000_STATE_ICALL) | ||
| 347 | actcapi_select_b2_protocol_req(card, chan); | ||
| 348 | return 0; | ||
| 349 | case ISDN_CMD_ACCEPTB: | ||
| 350 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 351 | return -ENODEV; | ||
| 352 | return 0; | ||
| 353 | case ISDN_CMD_HANGUP: | ||
| 354 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 284 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) |
| 355 | return -ENODEV; | 285 | return 0; |
| 356 | if (!(chan = find_channel(card, c->arg & 0x0f))) | 286 | actcapi_manufacturer_req_net(card); |
| 357 | break; | ||
| 358 | switch (chan->fsm_state) { | ||
| 359 | case ACT2000_STATE_ICALL: | ||
| 360 | case ACT2000_STATE_BSETUP: | ||
| 361 | actcapi_connect_resp(card, chan, 0x15); | ||
| 362 | break; | ||
| 363 | case ACT2000_STATE_ACTIVE: | ||
| 364 | actcapi_disconnect_b3_req(card, chan); | ||
| 365 | break; | ||
| 366 | } | ||
| 367 | return 0; | 287 | return 0; |
| 368 | case ISDN_CMD_SETEAZ: | 288 | case ACT2000_IOCTL_SETMSN: |
| 369 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 289 | if (copy_from_user(tmp, arg, |
| 370 | return -ENODEV; | 290 | sizeof(tmp))) |
| 371 | if (!(chan = find_channel(card, c->arg & 0x0f))) | 291 | return -EFAULT; |
| 372 | break; | 292 | if ((ret = act2000_set_msn(card, tmp))) |
| 373 | if (strlen(c->parm.num)) { | 293 | return ret; |
| 374 | if (card->ptype == ISDN_PTYPE_EURO) { | 294 | if (card->flags & ACT2000_FLAGS_RUNNING) |
| 375 | chan->eazmask = act2000_find_msn(card, c->parm.num, 0); | 295 | return (actcapi_manufacturer_req_msn(card)); |
| 376 | } | ||
| 377 | if (card->ptype == ISDN_PTYPE_1TR6) { | ||
| 378 | int i; | ||
| 379 | chan->eazmask = 0; | ||
| 380 | for (i = 0; i < strlen(c->parm.num); i++) | ||
| 381 | if (isdigit(c->parm.num[i])) | ||
| 382 | chan->eazmask |= (1 << (c->parm.num[i] - '0')); | ||
| 383 | } | ||
| 384 | } else | ||
| 385 | chan->eazmask = 0x3ff; | ||
| 386 | actcapi_listen_req(card); | ||
| 387 | return 0; | 296 | return 0; |
| 388 | case ISDN_CMD_CLREAZ: | 297 | case ACT2000_IOCTL_ADDCARD: |
| 389 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 298 | if (copy_from_user(&cdef, arg, |
| 390 | return -ENODEV; | 299 | sizeof(cdef))) |
| 391 | if (!(chan = find_channel(card, c->arg & 0x0f))) | 300 | return -EFAULT; |
| 392 | break; | 301 | if (act2000_addcard(cdef.bus, cdef.port, cdef.irq, cdef.id)) |
| 393 | chan->eazmask = 0; | 302 | return -EIO; |
| 394 | actcapi_listen_req(card); | ||
| 395 | return 0; | 303 | return 0; |
| 396 | case ISDN_CMD_SETL2: | 304 | case ACT2000_IOCTL_TEST: |
| 397 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 305 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) |
| 398 | return -ENODEV; | 306 | return -ENODEV; |
| 399 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 400 | break; | ||
| 401 | chan->l2prot = (c->arg >> 8); | ||
| 402 | return 0; | 307 | return 0; |
| 403 | case ISDN_CMD_SETL3: | 308 | default: |
| 404 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 309 | return -EINVAL; |
| 405 | return -ENODEV; | 310 | } |
| 406 | if ((c->arg >> 8) != ISDN_PROTO_L3_TRANS) { | 311 | break; |
| 407 | printk(KERN_WARNING "L3 protocol unknown\n"); | 312 | case ISDN_CMD_DIAL: |
| 408 | return -1; | 313 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) |
| 314 | return -ENODEV; | ||
| 315 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 316 | break; | ||
| 317 | spin_lock_irqsave(&card->lock, flags); | ||
| 318 | if (chan->fsm_state != ACT2000_STATE_NULL) { | ||
| 319 | spin_unlock_irqrestore(&card->lock, flags); | ||
| 320 | printk(KERN_WARNING "Dial on channel with state %d\n", | ||
| 321 | chan->fsm_state); | ||
| 322 | return -EBUSY; | ||
| 323 | } | ||
| 324 | if (card->ptype == ISDN_PTYPE_EURO) | ||
| 325 | tmp[0] = act2000_find_msn(card, c->parm.setup.eazmsn, 1); | ||
| 326 | else | ||
| 327 | tmp[0] = c->parm.setup.eazmsn[0]; | ||
| 328 | chan->fsm_state = ACT2000_STATE_OCALL; | ||
| 329 | chan->callref = 0xffff; | ||
| 330 | spin_unlock_irqrestore(&card->lock, flags); | ||
| 331 | ret = actcapi_connect_req(card, chan, c->parm.setup.phone, | ||
| 332 | tmp[0], c->parm.setup.si1, | ||
| 333 | c->parm.setup.si2); | ||
| 334 | if (ret) { | ||
| 335 | cmd.driver = card->myid; | ||
| 336 | cmd.command = ISDN_STAT_DHUP; | ||
| 337 | cmd.arg &= 0x0f; | ||
| 338 | card->interface.statcallb(&cmd); | ||
| 339 | } | ||
| 340 | return ret; | ||
| 341 | case ISDN_CMD_ACCEPTD: | ||
| 342 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 343 | return -ENODEV; | ||
| 344 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 345 | break; | ||
| 346 | if (chan->fsm_state == ACT2000_STATE_ICALL) | ||
| 347 | actcapi_select_b2_protocol_req(card, chan); | ||
| 348 | return 0; | ||
| 349 | case ISDN_CMD_ACCEPTB: | ||
| 350 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 351 | return -ENODEV; | ||
| 352 | return 0; | ||
| 353 | case ISDN_CMD_HANGUP: | ||
| 354 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 355 | return -ENODEV; | ||
| 356 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 357 | break; | ||
| 358 | switch (chan->fsm_state) { | ||
| 359 | case ACT2000_STATE_ICALL: | ||
| 360 | case ACT2000_STATE_BSETUP: | ||
| 361 | actcapi_connect_resp(card, chan, 0x15); | ||
| 362 | break; | ||
| 363 | case ACT2000_STATE_ACTIVE: | ||
| 364 | actcapi_disconnect_b3_req(card, chan); | ||
| 365 | break; | ||
| 366 | } | ||
| 367 | return 0; | ||
| 368 | case ISDN_CMD_SETEAZ: | ||
| 369 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 370 | return -ENODEV; | ||
| 371 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 372 | break; | ||
| 373 | if (strlen(c->parm.num)) { | ||
| 374 | if (card->ptype == ISDN_PTYPE_EURO) { | ||
| 375 | chan->eazmask = act2000_find_msn(card, c->parm.num, 0); | ||
| 409 | } | 376 | } |
| 410 | if (!(chan = find_channel(card, c->arg & 0x0f))) | 377 | if (card->ptype == ISDN_PTYPE_1TR6) { |
| 411 | break; | 378 | int i; |
| 412 | chan->l3prot = (c->arg >> 8); | 379 | chan->eazmask = 0; |
| 413 | return 0; | 380 | for (i = 0; i < strlen(c->parm.num); i++) |
| 414 | } | 381 | if (isdigit(c->parm.num[i])) |
| 415 | 382 | chan->eazmask |= (1 << (c->parm.num[i] - '0')); | |
| 416 | return -EINVAL; | 383 | } |
| 384 | } else | ||
| 385 | chan->eazmask = 0x3ff; | ||
| 386 | actcapi_listen_req(card); | ||
| 387 | return 0; | ||
| 388 | case ISDN_CMD_CLREAZ: | ||
| 389 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 390 | return -ENODEV; | ||
| 391 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 392 | break; | ||
| 393 | chan->eazmask = 0; | ||
| 394 | actcapi_listen_req(card); | ||
| 395 | return 0; | ||
| 396 | case ISDN_CMD_SETL2: | ||
| 397 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 398 | return -ENODEV; | ||
| 399 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 400 | break; | ||
| 401 | chan->l2prot = (c->arg >> 8); | ||
| 402 | return 0; | ||
| 403 | case ISDN_CMD_SETL3: | ||
| 404 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | ||
| 405 | return -ENODEV; | ||
| 406 | if ((c->arg >> 8) != ISDN_PROTO_L3_TRANS) { | ||
| 407 | printk(KERN_WARNING "L3 protocol unknown\n"); | ||
| 408 | return -1; | ||
| 409 | } | ||
| 410 | if (!(chan = find_channel(card, c->arg & 0x0f))) | ||
| 411 | break; | ||
| 412 | chan->l3prot = (c->arg >> 8); | ||
| 413 | return 0; | ||
| 414 | } | ||
| 415 | |||
| 416 | return -EINVAL; | ||
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | static int | 419 | static int |
| 420 | act2000_sendbuf(act2000_card *card, int channel, int ack, struct sk_buff *skb) | 420 | act2000_sendbuf(act2000_card *card, int channel, int ack, struct sk_buff *skb) |
| 421 | { | 421 | { |
| 422 | struct sk_buff *xmit_skb; | 422 | struct sk_buff *xmit_skb; |
| 423 | int len; | 423 | int len; |
| 424 | act2000_chan *chan; | 424 | act2000_chan *chan; |
| 425 | actcapi_msg *msg; | 425 | actcapi_msg *msg; |
| 426 | 426 | ||
| 427 | if (!(chan = find_channel(card, channel))) | 427 | if (!(chan = find_channel(card, channel))) |
| 428 | return -1; | ||
| 429 | if (chan->fsm_state != ACT2000_STATE_ACTIVE) | ||
| 428 | return -1; | 430 | return -1; |
| 429 | if (chan->fsm_state != ACT2000_STATE_ACTIVE) | 431 | len = skb->len; |
| 430 | return -1; | 432 | if ((chan->queued + len) >= ACT2000_MAX_QUEUED) |
| 431 | len = skb->len; | 433 | return 0; |
| 432 | if ((chan->queued + len) >= ACT2000_MAX_QUEUED) | ||
| 433 | return 0; | ||
| 434 | if (!len) | 434 | if (!len) |
| 435 | return 0; | 435 | return 0; |
| 436 | if (skb_headroom(skb) < 19) { | 436 | if (skb_headroom(skb) < 19) { |
| @@ -462,28 +462,28 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, struct sk_buff *skb) · 25 unmodified lines | |||
| 462 | msg->msg.data_b3_req.fakencci = MAKE_NCCI(chan->plci, 0, chan->ncci); | 462 | msg->msg.data_b3_req.fakencci = MAKE_NCCI(chan->plci, 0, chan->ncci); |
| 463 | msg->msg.data_b3_req.flags = ack; /* Will be set to 0 on actual sending */ | 463 | msg->msg.data_b3_req.flags = ack; /* Will be set to 0 on actual sending */ |
| 464 | actcapi_debug_msg(xmit_skb, 1); | 464 | actcapi_debug_msg(xmit_skb, 1); |
| 465 | chan->queued += len; | 465 | chan->queued += len; |
| 466 | skb_queue_tail(&card->sndq, xmit_skb); | 466 | skb_queue_tail(&card->sndq, xmit_skb); |
| 467 | act2000_schedule_tx(card); | 467 | act2000_schedule_tx(card); |
| 468 | return len; | 468 | return len; |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | 471 | ||
| 472 | /* Read the Status-replies from the Interface */ | 472 | /* Read the Status-replies from the Interface */ |
| 473 | static int | 473 | static int |
| 474 | act2000_readstatus(u_char __user * buf, int len, act2000_card * card) | 474 | act2000_readstatus(u_char __user *buf, int len, act2000_card *card) |
| 475 | { | 475 | { |
| 476 | int count; | 476 | int count; |
| 477 | u_char __user *p; | 477 | u_char __user *p; |
| 478 | 478 | ||
| 479 | for (p = buf, count = 0; count < len; p++, count++) { | 479 | for (p = buf, count = 0; count < len; p++, count++) { |
| 480 | if (card->status_buf_read == card->status_buf_write) | 480 | if (card->status_buf_read == card->status_buf_write) |
| 481 | return count; | 481 | return count; |
| 482 | put_user(*card->status_buf_read++, p); | 482 | put_user(*card->status_buf_read++, p); |
| 483 | if (card->status_buf_read > card->status_buf_end) | 483 | if (card->status_buf_read > card->status_buf_end) |
| 484 | card->status_buf_read = card->status_buf; | 484 | card->status_buf_read = card->status_buf; |
| 485 | } | 485 | } |
| 486 | return count; | 486 | return count; |
| 487 | } | 487 | } |
| 488 | 488 | ||
| 489 | /* | 489 | /* |
| @@ -492,75 +492,75 @@ act2000_readstatus(u_char __user * buf, int len, act2000_card * card) · 2 unmodified lines | |||
| 492 | static inline act2000_card * | 492 | static inline act2000_card * |
| 493 | act2000_findcard(int driverid) | 493 | act2000_findcard(int driverid) |
| 494 | { | 494 | { |
| 495 | act2000_card *p = cards; | 495 | act2000_card *p = cards; |
| 496 | 496 | ||
| 497 | while (p) { | 497 | while (p) { |
| 498 | if (p->myid == driverid) | 498 | if (p->myid == driverid) |
| 499 | return p; | 499 | return p; |
| 500 | p = p->next; | 500 | p = p->next; |
| 501 | } | 501 | } |
| 502 | return (act2000_card *) 0; | 502 | return (act2000_card *) 0; |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | /* | 505 | /* |
| 506 | * Wrapper functions for interface to linklevel | 506 | * Wrapper functions for interface to linklevel |
| 507 | */ | 507 | */ |
| 508 | static int | 508 | static int |
| 509 | if_command(isdn_ctrl * c) | 509 | if_command(isdn_ctrl *c) |
| 510 | { | 510 | { |
| 511 | act2000_card *card = act2000_findcard(c->driver); | 511 | act2000_card *card = act2000_findcard(c->driver); |
| 512 | 512 | ||
| 513 | if (card) | 513 | if (card) |
| 514 | return (act2000_command(card, c)); | 514 | return (act2000_command(card, c)); |
| 515 | printk(KERN_ERR | 515 | printk(KERN_ERR |
| 516 | "act2000: if_command %d called with invalid driverId %d!\n", | 516 | "act2000: if_command %d called with invalid driverId %d!\n", |
| 517 | c->command, c->driver); | 517 | c->command, c->driver); |
| 518 | return -ENODEV; | 518 | return -ENODEV; |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | static int | 521 | static int |
| 522 | if_writecmd(const u_char __user *buf, int len, int id, int channel) | 522 | if_writecmd(const u_char __user *buf, int len, int id, int channel) |
| 523 | { | 523 | { |
| 524 | act2000_card *card = act2000_findcard(id); | 524 | act2000_card *card = act2000_findcard(id); |
| 525 | 525 | ||
| 526 | if (card) { | 526 | if (card) { |
| 527 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 527 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) |
| 528 | return -ENODEV; | 528 | return -ENODEV; |
| 529 | return (len); | 529 | return (len); |
| 530 | } | 530 | } |
| 531 | printk(KERN_ERR | 531 | printk(KERN_ERR |
| 532 | "act2000: if_writecmd called with invalid driverId!\n"); | 532 | "act2000: if_writecmd called with invalid driverId!\n"); |
| 533 | return -ENODEV; | 533 | return -ENODEV; |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | static int | 536 | static int |
| 537 | if_readstatus(u_char __user * buf, int len, int id, int channel) | 537 | if_readstatus(u_char __user *buf, int len, int id, int channel) |
| 538 | { | 538 | { |
| 539 | act2000_card *card = act2000_findcard(id); | 539 | act2000_card *card = act2000_findcard(id); |
| 540 | 540 | ||
| 541 | if (card) { | 541 | if (card) { |
| 542 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 542 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) |
| 543 | return -ENODEV; | 543 | return -ENODEV; |
| 544 | return (act2000_readstatus(buf, len, card)); | 544 | return (act2000_readstatus(buf, len, card)); |
| 545 | } | 545 | } |
| 546 | printk(KERN_ERR | 546 | printk(KERN_ERR |
| 547 | "act2000: if_readstatus called with invalid driverId!\n"); | 547 | "act2000: if_readstatus called with invalid driverId!\n"); |
| 548 | return -ENODEV; | 548 | return -ENODEV; |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | static int | 551 | static int |
| 552 | if_sendbuf(int id, int channel, int ack, struct sk_buff *skb) | 552 | if_sendbuf(int id, int channel, int ack, struct sk_buff *skb) |
| 553 | { | 553 | { |
| 554 | act2000_card *card = act2000_findcard(id); | 554 | act2000_card *card = act2000_findcard(id); |
| 555 | 555 | ||
| 556 | if (card) { | 556 | if (card) { |
| 557 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) | 557 | if (!(card->flags & ACT2000_FLAGS_RUNNING)) |
| 558 | return -ENODEV; | 558 | return -ENODEV; |
| 559 | return (act2000_sendbuf(card, channel, ack, skb)); | 559 | return (act2000_sendbuf(card, channel, ack, skb)); |
| 560 | } | 560 | } |
| 561 | printk(KERN_ERR | 561 | printk(KERN_ERR |
| 562 | "act2000: if_sendbuf called with invalid driverId!\n"); | 562 | "act2000: if_sendbuf called with invalid driverId!\n"); |
| 563 | return -ENODEV; | 563 | return -ENODEV; |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | 566 | ||
| @@ -572,14 +572,14 @@ static void · 5 unmodified lines | |||
| 572 | act2000_alloccard(int bus, int port, int irq, char *id) | 572 | act2000_alloccard(int bus, int port, int irq, char *id) |
| 573 | { | 573 | { |
| 574 | int i; | 574 | int i; |
| 575 | act2000_card *card; | 575 | act2000_card *card; |
| 576 | if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) { | 576 | if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) { |
| 577 | printk(KERN_WARNING | 577 | printk(KERN_WARNING |
| 578 | "act2000: (%s) Could not allocate card-struct.\n", id); | 578 | "act2000: (%s) Could not allocate card-struct.\n", id); |
| 579 | return; | 579 | return; |
| 580 | } | 580 | } |
| 581 | spin_lock_init(&card->lock); | 581 | spin_lock_init(&card->lock); |
| 582 | spin_lock_init(&card->mnlock); | 582 | spin_lock_init(&card->mnlock); |
| 583 | skb_queue_head_init(&card->sndq); | 583 | skb_queue_head_init(&card->sndq); |
| 584 | skb_queue_head_init(&card->rcvq); | 584 | skb_queue_head_init(&card->rcvq); |
| 585 | skb_queue_head_init(&card->ackq); | 585 | skb_queue_head_init(&card->ackq); |
| @@ -588,82 +588,82 @@ act2000_alloccard(int bus, int port, int irq, char *id) · 2 unmodified lines | |||
| 588 | INIT_WORK(&card->poll_tq, act2000_receive); | 588 | INIT_WORK(&card->poll_tq, act2000_receive); |
| 589 | init_timer(&card->ptimer); | 589 | init_timer(&card->ptimer); |
| 590 | card->interface.owner = THIS_MODULE; | 590 | card->interface.owner = THIS_MODULE; |
| 591 | card->interface.channels = ACT2000_BCH; | 591 | card->interface.channels = ACT2000_BCH; |
| 592 | card->interface.maxbufsize = 4000; | 592 | card->interface.maxbufsize = 4000; |
| 593 | card->interface.command = if_command; | 593 | card->interface.command = if_command; |
| 594 | card->interface.writebuf_skb = if_sendbuf; | 594 | card->interface.writebuf_skb = if_sendbuf; |
| 595 | card->interface.writecmd = if_writecmd; | 595 | card->interface.writecmd = if_writecmd; |
| 596 | card->interface.readstat = if_readstatus; | 596 | card->interface.readstat = if_readstatus; |
| 597 | card->interface.features = | 597 | card->interface.features = |
| 598 | ISDN_FEATURE_L2_X75I | | 598 | ISDN_FEATURE_L2_X75I | |
| 599 | ISDN_FEATURE_L2_HDLC | | 599 | ISDN_FEATURE_L2_HDLC | |
| 600 | ISDN_FEATURE_L3_TRANS | | 600 | ISDN_FEATURE_L3_TRANS | |
| 601 | ISDN_FEATURE_P_UNKNOWN; | 601 | ISDN_FEATURE_P_UNKNOWN; |
| 602 | card->interface.hl_hdrlen = 20; | 602 | card->interface.hl_hdrlen = 20; |
| 603 | card->ptype = ISDN_PTYPE_EURO; | 603 | card->ptype = ISDN_PTYPE_EURO; |
| 604 | strlcpy(card->interface.id, id, sizeof(card->interface.id)); | 604 | strlcpy(card->interface.id, id, sizeof(card->interface.id)); |
| 605 | for (i=0; i<ACT2000_BCH; i++) { | 605 | for (i = 0; i < ACT2000_BCH; i++) { |
| 606 | card->bch[i].plci = 0x8000; | 606 | card->bch[i].plci = 0x8000; |
| 607 | card->bch[i].ncci = 0x8000; | 607 | card->bch[i].ncci = 0x8000; |
| 608 | card->bch[i].l2prot = ISDN_PROTO_L2_X75I; | 608 | card->bch[i].l2prot = ISDN_PROTO_L2_X75I; |
| 609 | card->bch[i].l3prot = ISDN_PROTO_L3_TRANS; | 609 | card->bch[i].l3prot = ISDN_PROTO_L3_TRANS; |
| 610 | } | 610 | } |
| 611 | card->myid = -1; | 611 | card->myid = -1; |
| 612 | card->bus = bus; | 612 | card->bus = bus; |
| 613 | card->port = port; | 613 | card->port = port; |
| 614 | card->irq = irq; | 614 | card->irq = irq; |
| 615 | card->next = cards; | 615 | card->next = cards; |
| 616 | cards = card; | 616 | cards = card; |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | /* | 619 | /* |
| 620 | * register card at linklevel | 620 | * register card at linklevel |
| 621 | */ | 621 | */ |
| 622 | static int | 622 | static int |
| 623 | act2000_registercard(act2000_card * card) | 623 | act2000_registercard(act2000_card *card) |
| 624 | { | 624 | { |
| 625 | switch (card->bus) { | 625 | switch (card->bus) { |
| 626 | case ACT2000_BUS_ISA: | 626 | case ACT2000_BUS_ISA: |
| 627 | break; | 627 | break; |
| 628 | case ACT2000_BUS_MCA: | 628 | case ACT2000_BUS_MCA: |
| 629 | case ACT2000_BUS_PCMCIA: | 629 | case ACT2000_BUS_PCMCIA: |
| 630 | default: | 630 | default: |
| 631 | printk(KERN_WARNING | 631 | printk(KERN_WARNING |
| 632 | "act2000: Illegal BUS type %d\n", | 632 | "act2000: Illegal BUS type %d\n", |
| 633 | card->bus); | 633 | card->bus); |
| 634 | return -1; | 634 | return -1; |
| 635 | } | 635 | } |
| 636 | if (!register_isdn(&card->interface)) { | 636 | if (!register_isdn(&card->interface)) { |
| 637 | printk(KERN_WARNING | 637 | printk(KERN_WARNING |
| 638 | "act2000: Unable to register %s\n", | 638 | "act2000: Unable to register %s\n", |
| 639 | card->interface.id); | 639 | card->interface.id); |
| 640 | return -1; | 640 | return -1; |
| 641 | } | 641 | } |
| 642 | card->myid = card->interface.channels; | 642 | card->myid = card->interface.channels; |
| 643 | sprintf(card->regname, "act2000-isdn (%s)", card->interface.id); | 643 | sprintf(card->regname, "act2000-isdn (%s)", card->interface.id); |
| 644 | return 0; | 644 | return 0; |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | static void | 647 | static void |
| 648 | unregister_card(act2000_card * card) | 648 | unregister_card(act2000_card *card) |
| 649 | { | 649 | { |
| 650 | isdn_ctrl cmd; | 650 | isdn_ctrl cmd; |
| 651 | 651 | ||
| 652 | cmd.command = ISDN_STAT_UNLOAD; | 652 | cmd.command = ISDN_STAT_UNLOAD; |
| 653 | cmd.driver = card->myid; | 653 | cmd.driver = card->myid; |
| 654 | card->interface.statcallb(&cmd); | 654 | card->interface.statcallb(&cmd); |
| 655 | switch (card->bus) { | 655 | switch (card->bus) { |
| 656 | case ACT2000_BUS_ISA: | 656 | case ACT2000_BUS_ISA: |
| 657 | act2000_isa_release(card); | 657 | act2000_isa_release(card); |
| 658 | break; | 658 | break; |
| 659 | case ACT2000_BUS_MCA: | 659 | case ACT2000_BUS_MCA: |
| 660 | case ACT2000_BUS_PCMCIA: | 660 | case ACT2000_BUS_PCMCIA: |
| 661 | default: | 661 | default: |
| 662 | printk(KERN_WARNING | 662 | printk(KERN_WARNING |
| 663 | "act2000: Invalid BUS type %d\n", | 663 | "act2000: Invalid BUS type %d\n", |
| 664 | card->bus); | 664 | card->bus); |
| 665 | break; | 665 | break; |
| 666 | } | 666 | } |
| 667 | } | 667 | } |
| 668 | 668 | ||
| 669 | static int | 669 | static int |
| @@ -690,23 +690,23 @@ act2000_addcard(int bus, int port, int irq, char *id) · 20 unmodified lines | |||
| 690 | for (i = 0; i < ARRAY_SIZE(act2000_isa_ports); i++) | 690 | for (i = 0; i < ARRAY_SIZE(act2000_isa_ports); i++) |
| 691 | if (act2000_isa_detect(act2000_isa_ports[i])) { | 691 | if (act2000_isa_detect(act2000_isa_ports[i])) { |
| 692 | printk(KERN_INFO "act2000: Detected " | 692 | printk(KERN_INFO "act2000: Detected " |
| 693 | "ISA card at port 0x%x\n", | 693 | "ISA card at port 0x%x\n", |
| 694 | act2000_isa_ports[i]); | 694 | act2000_isa_ports[i]); |
| 695 | act2000_alloccard(bus, | 695 | act2000_alloccard(bus, |
| 696 | act2000_isa_ports[i], irq, id); | 696 | act2000_isa_ports[i], irq, id); |
| 697 | } | 697 | } |
| 698 | break; | 698 | break; |
| 699 | case ACT2000_BUS_MCA: | 699 | case ACT2000_BUS_MCA: |
| 700 | case ACT2000_BUS_PCMCIA: | 700 | case ACT2000_BUS_PCMCIA: |
| 701 | default: | 701 | default: |
| 702 | printk(KERN_WARNING | 702 | printk(KERN_WARNING |
| 703 | "act2000: addcard: Invalid BUS type %d\n", bus); | 703 | "act2000: addcard: Invalid BUS type %d\n", bus); |
| 704 | } | 704 | } |
| 705 | } | 705 | } |
| 706 | if (!cards) | 706 | if (!cards) |
| 707 | return 1; | 707 | return 1; |
| 708 | p = cards; | 708 | p = cards; |
| 709 | while (p) { | 709 | while (p) { |
| 710 | initialized = 0; | 710 | initialized = 0; |
| 711 | if (!p->interface.statcallb) { | 711 | if (!p->interface.statcallb) { |
| 712 | /* Not yet registered. | 712 | /* Not yet registered. |
| @@ -714,99 +714,99 @@ act2000_addcard(int bus, int port, int irq, char *id) · 1 unmodified line | |||
| 714 | */ | 714 | */ |
| 715 | added++; | 715 | added++; |
| 716 | switch (p->bus) { | 716 | switch (p->bus) { |
| 717 | case ACT2000_BUS_ISA: | 717 | case ACT2000_BUS_ISA: |
| 718 | if (act2000_isa_detect(p->port)) { | 718 | if (act2000_isa_detect(p->port)) { |
| 719 | if (act2000_registercard(p)) | 719 | if (act2000_registercard(p)) |
| 720 | break; | 720 | break; |
| 721 | if (act2000_isa_config_port(p, p->port)) { | 721 | if (act2000_isa_config_port(p, p->port)) { |
| 722 | printk(KERN_WARNING | 722 | printk(KERN_WARNING |
| 723 | "act2000: Could not request port 0x%04x\n", | 723 | "act2000: Could not request port 0x%04x\n", |
| 724 | p->port); | ||
| 725 | unregister_card(p); | ||
| 726 | p->interface.statcallb = NULL; | ||
| 727 | break; | ||
| 728 | } | ||
| 729 | if (act2000_isa_config_irq(p, p->irq)) { | ||
| 730 | printk(KERN_INFO | ||
| 731 | "act2000: No IRQ available, fallback to polling\n"); | ||
| 732 | /* Fall back to polled operation */ | ||
| 733 | p->irq = 0; | ||
| 734 | } | ||
| 735 | printk(KERN_INFO | ||
| 736 | "act2000: ISA" | ||
| 737 | "-type card at port " | ||
| 738 | "0x%04x ", | ||
| 739 | p->port); | 724 | p->port); |
| 740 | if (p->irq) | 725 | unregister_card(p); |
| 741 | printk("irq %d\n", p->irq); | 726 | p->interface.statcallb = NULL; |
| 742 | else | 727 | break; |
| 743 | printk("polled\n"); | 728 | } |
| 744 | initialized = 1; | 729 | if (act2000_isa_config_irq(p, p->irq)) { |
| 730 | printk(KERN_INFO | ||
| 731 | "act2000: No IRQ available, fallback to polling\n"); | ||
| 732 | /* Fall back to polled operation */ | ||
| 733 | p->irq = 0; | ||
| 745 | } | 734 | } |
| 746 | break; | 735 | printk(KERN_INFO |
| 747 | case ACT2000_BUS_MCA: | 736 | "act2000: ISA" |
| 748 | case ACT2000_BUS_PCMCIA: | 737 | "-type card at port " |
| 749 | default: | 738 | "0x%04x ", |
| 750 | printk(KERN_WARNING | 739 | p->port); |
| 751 | "act2000: addcard: Invalid BUS type %d\n", | 740 | if (p->irq) |
| 752 | p->bus); | 741 | printk("irq %d\n", p->irq); |
| 742 | else | ||
| 743 | printk("polled\n"); | ||
| 744 | initialized = 1; | ||
| 745 | } | ||
| 746 | break; | ||
| 747 | case ACT2000_BUS_MCA: | ||
| 748 | case ACT2000_BUS_PCMCIA: | ||
| 749 | default: | ||
| 750 | printk(KERN_WARNING | ||
| 751 | "act2000: addcard: Invalid BUS type %d\n", | ||
| 752 | p->bus); | ||
| 753 | } | 753 | } |
| 754 | } else | 754 | } else |
| 755 | /* Card already initialized */ | 755 | /* Card already initialized */ |
| 756 | initialized = 1; | 756 | initialized = 1; |
| 757 | if (initialized) { | 757 | if (initialized) { |
| 758 | /* Init OK, next card ... */ | 758 | /* Init OK, next card ... */ |
| 759 | q = p; | 759 | q = p; |
| 760 | p = p->next; | 760 | p = p->next; |
| 761 | } else { | 761 | } else { |
| 762 | /* Init failed, remove card from list, free memory */ | 762 | /* Init failed, remove card from list, free memory */ |
| 763 | printk(KERN_WARNING | 763 | printk(KERN_WARNING |
| 764 | "act2000: Initialization of %s failed\n", | 764 | "act2000: Initialization of %s failed\n", |
| 765 | p->interface.id); | 765 | p->interface.id); |
| 766 | if (q) { | 766 | if (q) { |
| 767 | q->next = p->next; | 767 | q->next = p->next; |
| 768 | kfree(p); | 768 | kfree(p); |
| 769 | p = q->next; | 769 | p = q->next; |
| 770 | } else { | 770 | } else { |
| 771 | cards = p->next; | 771 | cards = p->next; |
| 772 | kfree(p); | 772 | kfree(p); |
| 773 | p = cards; | 773 | p = cards; |
| 774 | } | 774 | } |
| 775 | failed++; | 775 | failed++; |
| 776 | } | 776 | } |
| 777 | } | 777 | } |
| 778 | return (added - failed); | 778 | return (added - failed); |
| 779 | } | 779 | } |
| 780 | 780 | ||
| 781 | #define DRIVERNAME "IBM Active 2000 ISDN driver" | 781 | #define DRIVERNAME "IBM Active 2000 ISDN driver" |
| 782 | 782 | ||
| 783 | static int __init act2000_init(void) | 783 | static int __init act2000_init(void) |
| 784 | { | 784 | { |
| 785 | printk(KERN_INFO "%s\n", DRIVERNAME); | 785 | printk(KERN_INFO "%s\n", DRIVERNAME); |
| 786 | if (!cards) | 786 | if (!cards) |
| 787 | act2000_addcard(act_bus, act_port, act_irq, act_id); | 787 | act2000_addcard(act_bus, act_port, act_irq, act_id); |
| 788 | if (!cards) | 788 | if (!cards) |
| 789 | printk(KERN_INFO "act2000: No cards defined yet\n"); | 789 | printk(KERN_INFO "act2000: No cards defined yet\n"); |
| 790 | return 0; | 790 | return 0; |
| 791 | } | 791 | } |
| 792 | 792 | ||
| 793 | static void __exit act2000_exit(void) | 793 | static void __exit act2000_exit(void) |
| 794 | { | 794 | { |
| 795 | act2000_card *card = cards; | 795 | act2000_card *card = cards; |
| 796 | act2000_card *last; | 796 | act2000_card *last; |
| 797 | while (card) { | 797 | while (card) { |
| 798 | unregister_card(card); | 798 | unregister_card(card); |
| 799 | del_timer(&card->ptimer); | 799 | del_timer(&card->ptimer); |
| 800 | card = card->next; | 800 | card = card->next; |
| 801 | } | 801 | } |
| 802 | card = cards; | 802 | card = cards; |
| 803 | while (card) { | 803 | while (card) { |
| 804 | last = card; | 804 | last = card; |
| 805 | card = card->next; | 805 | card = card->next; |
| 806 | act2000_clear_msn(last); | 806 | act2000_clear_msn(last); |
| 807 | kfree(last); | 807 | kfree(last); |
| 808 | } | 808 | } |
| 809 | printk(KERN_INFO "%s unloaded\n", DRIVERNAME); | 809 | printk(KERN_INFO "%s unloaded\n", DRIVERNAME); |
| 810 | } | 810 | } |
| 811 | 811 | ||
| 812 | module_init(act2000_init); | 812 | module_init(act2000_init); |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
| 26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
| 27 | #include <linux/ppp_defs.h> | 27 | #include <linux/ppp_defs.h> |
| 28 | #include <linux/if_ppp.h> | 28 | #include <linux/ppp-ioctl.h> |
| 29 | #include <linux/skbuff.h> | 29 | #include <linux/skbuff.h> |
| 30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
| 31 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
| @@ -164,7 +164,7 @@ static int capiminor_del_ack(struct capiminor *mp, u16 datahandle) · 132 unmodified lines | |||
| 164 | 164 | ||
| 165 | spin_lock_bh(&mp->ackqlock); | 165 | spin_lock_bh(&mp->ackqlock); |
| 166 | list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) { | 166 | list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) { |
| 167 | if (p->datahandle == datahandle) { | 167 | if (p->datahandle == datahandle) { |
| 168 | list_del(&p->list); | 168 | list_del(&p->list); |
| 169 | mp->nack--; | 169 | mp->nack--; |
| 170 | spin_unlock_bh(&mp->ackqlock); | 170 | spin_unlock_bh(&mp->ackqlock); |
| @@ -199,8 +199,8 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) · 28 unmodified lines | |||
| 199 | unsigned int minor; | 199 | unsigned int minor; |
| 200 | 200 | ||
| 201 | mp = kzalloc(sizeof(*mp), GFP_KERNEL); | 201 | mp = kzalloc(sizeof(*mp), GFP_KERNEL); |
| 202 | if (!mp) { | 202 | if (!mp) { |
| 203 | printk(KERN_ERR "capi: can't alloc capiminor\n"); | 203 | printk(KERN_ERR "capi: can't alloc capiminor\n"); |
| 204 | return NULL; | 204 | return NULL; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| @@ -391,7 +391,7 @@ gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb) · 184 unmodified lines | |||
| 391 | struct sk_buff *nskb; | 391 | struct sk_buff *nskb; |
| 392 | nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_KERNEL); | 392 | nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_KERNEL); |
| 393 | if (nskb) { | 393 | if (nskb) { |
| 394 | u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2); | 394 | u16 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 4 + 2); |
| 395 | unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN); | 395 | unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN); |
| 396 | capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN); | 396 | capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN); |
| 397 | capimsg_setu16(s, 2, mp->ap->applid); | 397 | capimsg_setu16(s, 2, mp->ap->applid); |
| @@ -418,7 +418,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) · 20 unmodified lines | |||
| 418 | pr_debug("capi: currently no receiver\n"); | 418 | pr_debug("capi: currently no receiver\n"); |
| 419 | return -1; | 419 | return -1; |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | ld = tty_ldisc_ref(tty); | 422 | ld = tty_ldisc_ref(tty); |
| 423 | if (!ld) { | 423 | if (!ld) { |
| 424 | /* fatal error, do not requeue */ | 424 | /* fatal error, do not requeue */ |
| @@ -459,7 +459,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) · 34 unmodified lines | |||
| 459 | ld->ops->receive_buf(tty, skb->data, NULL, skb->len); | 459 | ld->ops->receive_buf(tty, skb->data, NULL, skb->len); |
| 460 | } else { | 460 | } else { |
| 461 | printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", | 461 | printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", |
| 462 | errcode); | 462 | errcode); |
| 463 | kfree_skb(nskb); | 463 | kfree_skb(nskb); |
| 464 | 464 | ||
| 465 | if (errcode == CAPI_SENDQUEUEFULL) | 465 | if (errcode == CAPI_SENDQUEUEFULL) |
| @@ -618,7 +618,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) · 152 unmodified lines | |||
| 618 | goto unlock_out; | 618 | goto unlock_out; |
| 619 | } | 619 | } |
| 620 | if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) { | 620 | if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) { |
| 621 | datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2); | 621 | datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 4 + 2); |
| 622 | pr_debug("capi_signal: DATA_B3_IND %u len=%d\n", | 622 | pr_debug("capi_signal: DATA_B3_IND %u len=%d\n", |
| 623 | datahandle, skb->len-CAPIMSG_LEN(skb->data)); | 623 | datahandle, skb->len-CAPIMSG_LEN(skb->data)); |
| 624 | skb_queue_tail(&mp->inqueue, skb); | 624 | skb_queue_tail(&mp->inqueue, skb); |
| @@ -627,10 +627,10 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) · 2 unmodified lines | |||
| 627 | 627 | ||
| 628 | } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) { | 628 | } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) { |
| 629 | 629 | ||
| 630 | datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4); | 630 | datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4); |
| 631 | pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n", | 631 | pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n", |
| 632 | datahandle, | 632 | datahandle, |
| 633 | CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2)); | 633 | CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2)); |
| 634 | kfree_skb(skb); | 634 | kfree_skb(skb); |
| 635 | capiminor_del_ack(mp, datahandle); | 635 | capiminor_del_ack(mp, datahandle); |
| 636 | tty = tty_port_tty_get(&mp->port); | 636 | tty = tty_port_tty_get(&mp->port); |
| @@ -669,7 +669,7 @@ capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) · 32 unmodified lines | |||
| 669 | if (file->f_flags & O_NONBLOCK) | 669 | if (file->f_flags & O_NONBLOCK) |
| 670 | return -EAGAIN; | 670 | return -EAGAIN; |
| 671 | err = wait_event_interruptible(cdev->recvwait, | 671 | err = wait_event_interruptible(cdev->recvwait, |
| 672 | (skb = skb_dequeue(&cdev->recvqueue))); | 672 | (skb = skb_dequeue(&cdev->recvqueue))); |
| 673 | if (err) | 673 | if (err) |
| 674 | return err; | 674 | return err; |
| 675 | } | 675 | } |
| @@ -736,7 +736,7 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos · 60 unmodified lines | |||
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | static unsigned int | 738 | static unsigned int |
| 739 | capi_poll(struct file *file, poll_table * wait) | 739 | capi_poll(struct file *file, poll_table *wait) |
| 740 | { | 740 | { |
| 741 | struct capidev *cdev = file->private_data; | 741 | struct capidev *cdev = file->private_data; |
| 742 | unsigned int mask = 0; | 742 | unsigned int mask = 0; |
| @@ -786,75 +786,75 @@ register_out: · 43 unmodified lines | |||
| 786 | return retval; | 786 | return retval; |
| 787 | 787 | ||
| 788 | case CAPI_GET_VERSION: | 788 | case CAPI_GET_VERSION: |
| 789 | { | 789 | { |
| 790 | if (copy_from_user(&data.contr, argp, | 790 | if (copy_from_user(&data.contr, argp, |
| 791 | sizeof(data.contr))) | 791 | sizeof(data.contr))) |
| 792 | return -EFAULT; | 792 | return -EFAULT; |
| 793 | cdev->errcode = capi20_get_version(data.contr, &data.version); | 793 | cdev->errcode = capi20_get_version(data.contr, &data.version); |
| 794 | if (cdev->errcode) | 794 | if (cdev->errcode) |
| 795 | return -EIO; | 795 | return -EIO; |
| 796 | if (copy_to_user(argp, &data.version, | 796 | if (copy_to_user(argp, &data.version, |
| 797 | sizeof(data.version))) | 797 | sizeof(data.version))) |
| 798 | return -EFAULT; | 798 | return -EFAULT; |
| 799 | } | 799 | } |
| 800 | return 0; | 800 | return 0; |
| 801 | 801 | ||
| 802 | case CAPI_GET_SERIAL: | 802 | case CAPI_GET_SERIAL: |
| 803 | { | 803 | { |
| 804 | if (copy_from_user(&data.contr, argp, | 804 | if (copy_from_user(&data.contr, argp, |
| 805 | sizeof(data.contr))) | 805 | sizeof(data.contr))) |
| 806 | return -EFAULT; | 806 | return -EFAULT; |
| 807 | cdev->errcode = capi20_get_serial (data.contr, data.serial); | 807 | cdev->errcode = capi20_get_serial(data.contr, data.serial); |
| 808 | if (cdev->errcode) | 808 | if (cdev->errcode) |
| 809 | return -EIO; | 809 | return -EIO; |
| 810 | if (copy_to_user(argp, data.serial, | 810 | if (copy_to_user(argp, data.serial, |
| 811 | sizeof(data.serial))) | 811 | sizeof(data.serial))) |
| 812 | return -EFAULT; | 812 | return -EFAULT; |
| 813 | } | 813 | } |
| 814 | return 0; | 814 | return 0; |
| 815 | case CAPI_GET_PROFILE: | 815 | case CAPI_GET_PROFILE: |
| 816 | { | 816 | { |
| 817 | if (copy_from_user(&data.contr, argp, | 817 | if (copy_from_user(&data.contr, argp, |
| 818 | sizeof(data.contr))) | 818 | sizeof(data.contr))) |
| 819 | return -EFAULT; | 819 | return -EFAULT; |
| 820 | 820 | ||
| 821 | if (data.contr == 0) { | 821 | if (data.contr == 0) { |
| 822 | cdev->errcode = capi20_get_profile(data.contr, &data.profile); | 822 | cdev->errcode = capi20_get_profile(data.contr, &data.profile); |
| 823 | if (cdev->errcode) | 823 | if (cdev->errcode) |
| 824 | return -EIO; | 824 | return -EIO; |
| 825 | 825 | ||
| 826 | retval = copy_to_user(argp, | 826 | retval = copy_to_user(argp, |
| 827 | &data.profile.ncontroller, | 827 | &data.profile.ncontroller, |
| 828 | sizeof(data.profile.ncontroller)); | 828 | sizeof(data.profile.ncontroller)); |
| 829 | 829 | ||
| 830 | } else { | 830 | } else { |
| 831 | cdev->errcode = capi20_get_profile(data.contr, &data.profile); | 831 | cdev->errcode = capi20_get_profile(data.contr, &data.profile); |
| 832 | if (cdev->errcode) | 832 | if (cdev->errcode) |
| 833 | return -EIO; | 833 | return -EIO; |
| 834 | 834 | ||
| 835 | retval = copy_to_user(argp, &data.profile, | 835 | retval = copy_to_user(argp, &data.profile, |
| 836 | sizeof(data.profile)); | 836 | sizeof(data.profile)); |
| 837 | } | ||
| 838 | if (retval) | ||
| 839 | return -EFAULT; | ||
| 840 | } | 837 | } |
| 841 | return 0; | 838 | if (retval) |
| 839 | return -EFAULT; | ||
| 840 | } | ||
| 841 | return 0; | ||
| 842 | 842 | ||
| 843 | case CAPI_GET_MANUFACTURER: | 843 | case CAPI_GET_MANUFACTURER: |
| 844 | { | 844 | { |
| 845 | if (copy_from_user(&data.contr, argp, | 845 | if (copy_from_user(&data.contr, argp, |
| 846 | sizeof(data.contr))) | 846 | sizeof(data.contr))) |
| 847 | return -EFAULT; | 847 | return -EFAULT; |
| 848 | cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer); | 848 | cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer); |
| 849 | if (cdev->errcode) | 849 | if (cdev->errcode) |
| 850 | return -EIO; | 850 | return -EIO; |
| 851 | 851 | ||
| 852 | if (copy_to_user(argp, data.manufacturer, | 852 | if (copy_to_user(argp, data.manufacturer, |
| 853 | sizeof(data.manufacturer))) | 853 | sizeof(data.manufacturer))) |
| 854 | return -EFAULT; | 854 | return -EFAULT; |
| 855 | 855 | ||
| 856 | } | 856 | } |
| 857 | return 0; | 857 | return 0; |
| 858 | case CAPI_GET_ERRCODE: | 858 | case CAPI_GET_ERRCODE: |
| 859 | data.errcode = cdev->errcode; | 859 | data.errcode = cdev->errcode; |
| 860 | cdev->errcode = CAPI_NOERROR; | 860 | cdev->errcode = CAPI_NOERROR; |
| @@ -871,15 +871,15 @@ register_out: · 10 unmodified lines | |||
| 871 | return -ENXIO; | 871 | return -ENXIO; |
| 872 | 872 | ||
| 873 | case CAPI_MANUFACTURER_CMD: | 873 | case CAPI_MANUFACTURER_CMD: |
| 874 | { | 874 | { |
| 875 | struct capi_manufacturer_cmd mcmd; | 875 | struct capi_manufacturer_cmd mcmd; |
| 876 | if (!capable(CAP_SYS_ADMIN)) | 876 | if (!capable(CAP_SYS_ADMIN)) |
| 877 | return -EPERM; | 877 | return -EPERM; |
| 878 | if (copy_from_user(&mcmd, argp, sizeof(mcmd))) | 878 | if (copy_from_user(&mcmd, argp, sizeof(mcmd))) |
| 879 | return -EFAULT; | 879 | return -EFAULT; |
| 880 | return capi20_manufacturer(mcmd.cmd, mcmd.data); | 880 | return capi20_manufacturer(mcmd.cmd, mcmd.data); |
| 881 | } | 881 | } |
| 882 | return 0; | 882 | return 0; |
| 883 | 883 | ||
| 884 | case CAPI_SET_FLAGS: | 884 | case CAPI_SET_FLAGS: |
| 885 | case CAPI_CLR_FLAGS: { | 885 | case CAPI_CLR_FLAGS: { |
| @@ -1066,7 +1066,7 @@ static int capinc_tty_write(struct tty_struct *tty, · 180 unmodified lines | |||
| 1066 | mp->outbytes += skb->len; | 1066 | mp->outbytes += skb->len; |
| 1067 | } | 1067 | } |
| 1068 | 1068 | ||
| 1069 | skb = alloc_skb(CAPI_DATA_B3_REQ_LEN+count, GFP_ATOMIC); | 1069 | skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + count, GFP_ATOMIC); |
| 1070 | if (!skb) { | 1070 | if (!skb) { |
| 1071 | printk(KERN_ERR "capinc_tty_write: alloc_skb failed\n"); | 1071 | printk(KERN_ERR "capinc_tty_write: alloc_skb failed\n"); |
| 1072 | spin_unlock_bh(&mp->outlock); | 1072 | spin_unlock_bh(&mp->outlock); |
| @@ -1107,7 +1107,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) · 34 unmodified lines | |||
| 1107 | invoke_send = true; | 1107 | invoke_send = true; |
| 1108 | } | 1108 | } |
| 1109 | 1109 | ||
| 1110 | skb = alloc_skb(CAPI_DATA_B3_REQ_LEN+CAPI_MAX_BLKSIZE, GFP_ATOMIC); | 1110 | skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + CAPI_MAX_BLKSIZE, GFP_ATOMIC); |
| 1111 | if (skb) { | 1111 | if (skb) { |
| 1112 | skb_reserve(skb, CAPI_DATA_B3_REQ_LEN); | 1112 | skb_reserve(skb, CAPI_DATA_B3_REQ_LEN); |
| 1113 | *(skb_put(skb, 1)) = ch; | 1113 | *(skb_put(skb, 1)) = ch; |
| @@ -1171,12 +1171,12 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty) · 57 unmodified lines | |||
| 1171 | } | 1171 | } |
| 1172 | 1172 | ||
| 1173 | static int capinc_tty_ioctl(struct tty_struct *tty, | 1173 | static int capinc_tty_ioctl(struct tty_struct *tty, |
| 1174 | unsigned int cmd, unsigned long arg) | 1174 | unsigned int cmd, unsigned long arg) |
| 1175 | { | 1175 | { |
| 1176 | return -ENOIOCTLCMD; | 1176 | return -ENOIOCTLCMD; |
| 1177 | } | 1177 | } |
| 1178 | 1178 | ||
| 1179 | static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old) | 1179 | static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios *old) |
| 1180 | { | 1180 | { |
| 1181 | pr_debug("capinc_tty_set_termios\n"); | 1181 | pr_debug("capinc_tty_set_termios\n"); |
| 1182 | } | 1182 | } |
| @@ -1339,18 +1339,18 @@ static inline void capinc_tty_exit(void) { } · 156 unmodified lines | |||
| 1339 | */ | 1339 | */ |
| 1340 | static int capi20_proc_show(struct seq_file *m, void *v) | 1340 | static int capi20_proc_show(struct seq_file *m, void *v) |
| 1341 | { | 1341 | { |
| 1342 | struct capidev *cdev; | 1342 | struct capidev *cdev; |
| 1343 | struct list_head *l; | 1343 | struct list_head *l; |
| 1344 | 1344 | ||
| 1345 | mutex_lock(&capidev_list_lock); | 1345 | mutex_lock(&capidev_list_lock); |
| 1346 | list_for_each(l, &capidev_list) { | 1346 | list_for_each(l, &capidev_list) { |
| 1347 | cdev = list_entry(l, struct capidev, list); | 1347 | cdev = list_entry(l, struct capidev, list); |
| 1348 | seq_printf(m, "0 %d %lu %lu %lu %lu\n", | 1348 | seq_printf(m, "0 %d %lu %lu %lu %lu\n", |
| 1349 | cdev->ap.applid, | 1349 | cdev->ap.applid, |
| 1350 | cdev->ap.nrecvctlpkt, | 1350 | cdev->ap.nrecvctlpkt, |
| 1351 | cdev->ap.nrecvdatapkt, | 1351 | cdev->ap.nrecvdatapkt, |
| 1352 | cdev->ap.nsentctlpkt, | 1352 | cdev->ap.nsentctlpkt, |
| 1353 | cdev->ap.nsentdatapkt); | 1353 | cdev->ap.nsentdatapkt); |
| 1354 | } | 1354 | } |
| 1355 | mutex_unlock(&capidev_list_lock); | 1355 | mutex_unlock(&capidev_list_lock); |
| 1356 | return 0; | 1356 | return 0; |
| @@ -1445,9 +1445,9 @@ static int __init capi_init(void) · 88 unmodified lines | |||
| 1445 | proc_init(); | 1445 | proc_init(); |
| 1446 | 1446 | ||
| 1447 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 1447 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
| 1448 | compileinfo = " (middleware)"; | 1448 | compileinfo = " (middleware)"; |
| 1449 | #else | 1449 | #else |
| 1450 | compileinfo = " (no middleware)"; | 1450 | compileinfo = " (no middleware)"; |
| 1451 | #endif | 1451 | #endif |
| 1452 | printk(KERN_NOTICE "CAPI 2.0 started up with major %d%s\n", | 1452 | printk(KERN_NOTICE "CAPI 2.0 started up with major %d%s\n", |
| 1453 | capi_major, compileinfo); | 1453 | capi_major, compileinfo); |
| @@ -40,7 +40,7 @@ static int debugmode = 0; · 39 unmodified lines | |||
| 40 | MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); | 40 | MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); |
| 41 | MODULE_AUTHOR("Carsten Paeth"); | 41 | MODULE_AUTHOR("Carsten Paeth"); |
| 42 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); |
| 43 | module_param(debugmode, uint, S_IRUGO|S_IWUSR); | 43 | module_param(debugmode, uint, S_IRUGO | S_IWUSR); |
| 44 | 44 | ||
| 45 | /* -------- type definitions ----------------------------------------- */ | 45 | /* -------- type definitions ----------------------------------------- */ |
| 46 | 46 | ||
| @@ -64,7 +64,7 @@ struct capidrv_contr { · 17 unmodified lines | |||
| 64 | int state; | 64 | int state; |
| 65 | u32 cipmask; | 65 | u32 cipmask; |
| 66 | u32 cipmask2; | 66 | u32 cipmask2; |
| 67 | struct timer_list listentimer; | 67 | struct timer_list listentimer; |
| 68 | 68 | ||
| 69 | /* | 69 | /* |
| 70 | * ID of capi message sent | 70 | * ID of capi message sent |
| @@ -105,9 +105,9 @@ struct capidrv_contr { · 34 unmodified lines | |||
| 105 | /* */ | 105 | /* */ |
| 106 | u16 datahandle; | 106 | u16 datahandle; |
| 107 | struct ncci_datahandle_queue { | 107 | struct ncci_datahandle_queue { |
| 108 | struct ncci_datahandle_queue *next; | 108 | struct ncci_datahandle_queue *next; |
| 109 | u16 datahandle; | 109 | u16 datahandle; |
| 110 | int len; | 110 | int len; |
| 111 | } *ackqueue; | 111 | } *ackqueue; |
| 112 | } *ncci_list; | 112 | } *ncci_list; |
| 113 | } *plcip; | 113 | } *plcip; |
| @@ -142,7 +142,7 @@ static capidrv_data global; · 28 unmodified lines | |||
| 142 | static DEFINE_SPINLOCK(global_lock); | 142 | static DEFINE_SPINLOCK(global_lock); |
| 143 | 143 | ||
| 144 | static void handle_dtrace_data(capidrv_contr *card, | 144 | static void handle_dtrace_data(capidrv_contr *card, |
| 145 | int send, int level2, u8 *data, u16 len); | 145 | int send, int level2, u8 *data, u16 len); |
| 146 | 146 | ||
| 147 | /* -------- convert functions ---------------------------------------- */ | 147 | /* -------- convert functions ---------------------------------------- */ |
| 148 | 148 | ||
| @@ -158,11 +158,11 @@ static inline u32 b1prot(int l2, int l3) · 9 unmodified lines | |||
| 158 | return 0; | 158 | return 0; |
| 159 | case ISDN_PROTO_L2_TRANS: | 159 | case ISDN_PROTO_L2_TRANS: |
| 160 | return 1; | 160 | return 1; |
| 161 | case ISDN_PROTO_L2_V11096: | 161 | case ISDN_PROTO_L2_V11096: |
| 162 | case ISDN_PROTO_L2_V11019: | 162 | case ISDN_PROTO_L2_V11019: |
| 163 | case ISDN_PROTO_L2_V11038: | 163 | case ISDN_PROTO_L2_V11038: |
| 164 | return 2; | 164 | return 2; |
| 165 | case ISDN_PROTO_L2_FAX: | 165 | case ISDN_PROTO_L2_FAX: |
| 166 | return 4; | 166 | return 4; |
| 167 | case ISDN_PROTO_L2_MODEM: | 167 | case ISDN_PROTO_L2_MODEM: |
| 168 | return 8; | 168 | return 8; |
| @@ -179,12 +179,12 @@ static inline u32 b2prot(int l2, int l3) · 10 unmodified lines | |||
| 179 | return 0; | 179 | return 0; |
| 180 | case ISDN_PROTO_L2_HDLC: | 180 | case ISDN_PROTO_L2_HDLC: |
| 181 | case ISDN_PROTO_L2_TRANS: | 181 | case ISDN_PROTO_L2_TRANS: |
| 182 | case ISDN_PROTO_L2_V11096: | 182 | case ISDN_PROTO_L2_V11096: |
| 183 | case ISDN_PROTO_L2_V11019: | 183 | case ISDN_PROTO_L2_V11019: |
| 184 | case ISDN_PROTO_L2_V11038: | 184 | case ISDN_PROTO_L2_V11038: |
| 185 | case ISDN_PROTO_L2_MODEM: | 185 | case ISDN_PROTO_L2_MODEM: |
| 186 | return 1; | 186 | return 1; |
| 187 | case ISDN_PROTO_L2_FAX: | 187 | case ISDN_PROTO_L2_FAX: |
| 188 | return 4; | 188 | return 4; |
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| @@ -197,13 +197,13 @@ static inline u32 b3prot(int l2, int l3) · 6 unmodified lines | |||
| 197 | case ISDN_PROTO_L2_X75BUI: | 197 | case ISDN_PROTO_L2_X75BUI: |
| 198 | case ISDN_PROTO_L2_HDLC: | 198 | case ISDN_PROTO_L2_HDLC: |
| 199 | case ISDN_PROTO_L2_TRANS: | 199 | case ISDN_PROTO_L2_TRANS: |
| 200 | case ISDN_PROTO_L2_V11096: | 200 | case ISDN_PROTO_L2_V11096: |
| 201 | case ISDN_PROTO_L2_V11019: | 201 | case ISDN_PROTO_L2_V11019: |
| 202 | case ISDN_PROTO_L2_V11038: | 202 | case ISDN_PROTO_L2_V11038: |
| 203 | case ISDN_PROTO_L2_MODEM: | 203 | case ISDN_PROTO_L2_MODEM: |
| 204 | default: | 204 | default: |
| 205 | return 0; | 205 | return 0; |
| 206 | case ISDN_PROTO_L2_FAX: | 206 | case ISDN_PROTO_L2_FAX: |
| 207 | return 4; | 207 | return 4; |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| @@ -231,38 +231,38 @@ static _cstruct b1config(int l2, int l3) · 21 unmodified lines | |||
| 231 | case ISDN_PROTO_L2_TRANS: | 231 | case ISDN_PROTO_L2_TRANS: |
| 232 | default: | 232 | default: |
| 233 | return NULL; | 233 | return NULL; |
| 234 | case ISDN_PROTO_L2_V11096: | 234 | case ISDN_PROTO_L2_V11096: |
| 235 | return b1config_async_v110(9600); | 235 | return b1config_async_v110(9600); |
| 236 | case ISDN_PROTO_L2_V11019: | 236 | case ISDN_PROTO_L2_V11019: |
| 237 | return b1config_async_v110(19200); | 237 | return b1config_async_v110(19200); |
| 238 | case ISDN_PROTO_L2_V11038: | 238 | case ISDN_PROTO_L2_V11038: |
| 239 | return b1config_async_v110(38400); | 239 | return b1config_async_v110(38400); |
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static inline u16 si2cip(u8 si1, u8 si2) | 243 | static inline u16 si2cip(u8 si1, u8 si2) |
| 244 | { | 244 | { |
| 245 | static const u8 cip[17][5] = | 245 | static const u8 cip[17][5] = |
| 246 | { | 246 | { |
| 247 | /* 0 1 2 3 4 */ | 247 | /* 0 1 2 3 4 */ |
| 248 | {0, 0, 0, 0, 0}, /*0 */ | 248 | {0, 0, 0, 0, 0}, /*0 */ |
| 249 | {16, 16, 4, 26, 16}, /*1 */ | 249 | {16, 16, 4, 26, 16}, /*1 */ |
| 250 | {17, 17, 17, 4, 4}, /*2 */ | 250 | {17, 17, 17, 4, 4}, /*2 */ |
| 251 | {2, 2, 2, 2, 2}, /*3 */ | 251 | {2, 2, 2, 2, 2}, /*3 */ |
| 252 | {18, 18, 18, 18, 18}, /*4 */ | 252 | {18, 18, 18, 18, 18}, /*4 */ |
| 253 | {2, 2, 2, 2, 2}, /*5 */ | 253 | {2, 2, 2, 2, 2}, /*5 */ |
| 254 | {0, 0, 0, 0, 0}, /*6 */ | 254 | {0, 0, 0, 0, 0}, /*6 */ |
| 255 | {2, 2, 2, 2, 2}, /*7 */ | 255 | {2, 2, 2, 2, 2}, /*7 */ |
| 256 | {2, 2, 2, 2, 2}, /*8 */ | 256 | {2, 2, 2, 2, 2}, /*8 */ |
| 257 | {21, 21, 21, 21, 21}, /*9 */ | 257 | {21, 21, 21, 21, 21}, /*9 */ |
| 258 | {19, 19, 19, 19, 19}, /*10 */ | 258 | {19, 19, 19, 19, 19}, /*10 */ |
| 259 | {0, 0, 0, 0, 0}, /*11 */ | 259 | {0, 0, 0, 0, 0}, /*11 */ |
| 260 | {0, 0, 0, 0, 0}, /*12 */ | 260 | {0, 0, 0, 0, 0}, /*12 */ |
| 261 | {0, 0, 0, 0, 0}, /*13 */ | 261 | {0, 0, 0, 0, 0}, /*13 */ |
| 262 | {0, 0, 0, 0, 0}, /*14 */ | 262 | {0, 0, 0, 0, 0}, /*14 */ |
| 263 | {22, 22, 22, 22, 22}, /*15 */ | 263 | {22, 22, 22, 22, 22}, /*15 */ |
| 264 | {27, 27, 27, 28, 27} /*16 */ | 264 | {27, 27, 27, 28, 27} /*16 */ |
| 265 | }; | 265 | }; |
| 266 | if (si1 > 16) | 266 | if (si1 > 16) |
| 267 | si1 = 0; | 267 | si1 = 0; |
| 268 | if (si2 > 4) | 268 | if (si2 > 4) |
| @@ -274,10 +274,10 @@ static inline u16 si2cip(u8 si1, u8 si2) · 5 unmodified lines | |||
| 274 | static inline u8 cip2si1(u16 cipval) | 274 | static inline u8 cip2si1(u16 cipval) |
| 275 | { | 275 | { |
| 276 | static const u8 si[32] = | 276 | static const u8 si[32] = |
| 277 | {7, 1, 7, 7, 1, 1, 7, 7, /*0-7 */ | 277 | {7, 1, 7, 7, 1, 1, 7, 7, /*0-7 */ |
| 278 | 7, 1, 0, 0, 0, 0, 0, 0, /*8-15 */ | 278 | 7, 1, 0, 0, 0, 0, 0, 0, /*8-15 */ |
| 279 | 1, 2, 4, 10, 9, 9, 15, 7, /*16-23 */ | 279 | 1, 2, 4, 10, 9, 9, 15, 7, /*16-23 */ |
| 280 | 7, 7, 1, 16, 16, 0, 0, 0}; /*24-31 */ | 280 | 7, 7, 1, 16, 16, 0, 0, 0}; /*24-31 */ |
| 281 | 281 | ||
| 282 | if (cipval > 31) | 282 | if (cipval > 31) |
| 283 | cipval = 0; /* .... */ | 283 | cipval = 0; /* .... */ |
| @@ -287,10 +287,10 @@ static inline u8 cip2si1(u16 cipval) · 3 unmodified lines | |||
| 287 | static inline u8 cip2si2(u16 cipval) | 287 | static inline u8 cip2si2(u16 cipval) |
| 288 | { | 288 | { |
| 289 | static const u8 si[32] = | 289 | static const u8 si[32] = |
| 290 | {0, 0, 0, 0, 2, 3, 0, 0, /*0-7 */ | 290 | {0, 0, 0, 0, 2, 3, 0, 0, /*0-7 */ |
| 291 | 0, 3, 0, 0, 0, 0, 0, 0, /*8-15 */ | 291 | 0, 3, 0, 0, 0, 0, 0, 0, /*8-15 */ |
| 292 | 1, 2, 0, 0, 9, 0, 0, 0, /*16-23 */ | 292 | 1, 2, 0, 0, 9, 0, 0, 0, /*16-23 */ |
| 293 | 0, 0, 3, 2, 3, 0, 0, 0}; /*24-31 */ | 293 | 0, 0, 3, 2, 3, 0, 0, 0}; /*24-31 */ |
| 294 | 294 | ||
| 295 | if (cipval > 31) | 295 | if (cipval > 31) |
| 296 | cipval = 0; /* .... */ | 296 | cipval = 0; /* .... */ |
| @@ -302,7 +302,7 @@ static inline u8 cip2si2(u16 cipval) · 5 unmodified lines | |||
| 302 | 302 | ||
| 303 | static inline capidrv_contr *findcontrbydriverid(int driverid) | 303 | static inline capidrv_contr *findcontrbydriverid(int driverid) |
| 304 | { | 304 | { |
| 305 | unsigned long flags; | 305 | unsigned long flags; |
| 306 | capidrv_contr *p; | 306 | capidrv_contr *p; |
| 307 | 307 | ||
| 308 | spin_lock_irqsave(&global_lock, flags); | 308 | spin_lock_irqsave(&global_lock, flags); |
| @@ -329,7 +329,7 @@ static capidrv_contr *findcontrbynumber(u32 contr) · 20 unmodified lines | |||
| 329 | 329 | ||
| 330 | /* -------- plci management ------------------------------------------ */ | 330 | /* -------- plci management ------------------------------------------ */ |
| 331 | 331 | ||
| 332 | static capidrv_plci *new_plci(capidrv_contr * card, int chan) | 332 | static capidrv_plci *new_plci(capidrv_contr *card, int chan) |
| 333 | { | 333 | { |
| 334 | capidrv_plci *plcip; | 334 | capidrv_plci *plcip; |
| 335 | 335 | ||
| @@ -349,7 +349,7 @@ static capidrv_plci *new_plci(capidrv_contr * card, int chan) · 13 unmodified lines | |||
| 349 | return plcip; | 349 | return plcip; |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | static capidrv_plci *find_plci_by_plci(capidrv_contr * card, u32 plci) | 352 | static capidrv_plci *find_plci_by_plci(capidrv_contr *card, u32 plci) |
| 353 | { | 353 | { |
| 354 | capidrv_plci *p; | 354 | capidrv_plci *p; |
| 355 | for (p = card->plci_list; p; p = p->next) | 355 | for (p = card->plci_list; p; p = p->next) |
| @@ -358,7 +358,7 @@ static capidrv_plci *find_plci_by_plci(capidrv_contr * card, u32 plci) · 2 unmodified lines | |||
| 358 | return NULL; | 358 | return NULL; |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | static capidrv_plci *find_plci_by_msgid(capidrv_contr * card, u16 msgid) | 361 | static capidrv_plci *find_plci_by_msgid(capidrv_contr *card, u16 msgid) |
| 362 | { | 362 | { |
| 363 | capidrv_plci *p; | 363 | capidrv_plci *p; |
| 364 | for (p = card->plci_list; p; p = p->next) | 364 | for (p = card->plci_list; p; p = p->next) |
| @@ -367,7 +367,7 @@ static capidrv_plci *find_plci_by_msgid(capidrv_contr * card, u16 msgid) · 2 unmodified lines | |||
| 367 | return NULL; | 367 | return NULL; |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | static capidrv_plci *find_plci_by_ncci(capidrv_contr * card, u32 ncci) | 370 | static capidrv_plci *find_plci_by_ncci(capidrv_contr *card, u32 ncci) |
| 371 | { | 371 | { |
| 372 | capidrv_plci *p; | 372 | capidrv_plci *p; |
| 373 | for (p = card->plci_list; p; p = p->next) | 373 | for (p = card->plci_list; p; p = p->next) |
| @@ -376,7 +376,7 @@ static capidrv_plci *find_plci_by_ncci(capidrv_contr * card, u32 ncci) · 2 unmodified lines | |||
| 376 | return NULL; | 376 | return NULL; |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | static void free_plci(capidrv_contr * card, capidrv_plci * plcip) | 379 | static void free_plci(capidrv_contr *card, capidrv_plci *plcip) |
| 380 | { | 380 | { |
| 381 | capidrv_plci **pp; | 381 | capidrv_plci **pp; |
| 382 | 382 | ||
| @@ -396,8 +396,8 @@ static void free_plci(capidrv_contr * card, capidrv_plci * plcip) · 13 unmodified lines | |||
| 396 | 396 | ||
| 397 | /* -------- ncci management ------------------------------------------ */ | 397 | /* -------- ncci management ------------------------------------------ */ |
| 398 | 398 | ||
| 399 | static inline capidrv_ncci *new_ncci(capidrv_contr * card, | 399 | static inline capidrv_ncci *new_ncci(capidrv_contr *card, |
| 400 | capidrv_plci * plcip, | 400 | capidrv_plci *plcip, |
| 401 | u32 ncci) | 401 | u32 ncci) |
| 402 | { | 402 | { |
| 403 | capidrv_ncci *nccip; | 403 | capidrv_ncci *nccip; |
| @@ -421,7 +421,7 @@ static inline capidrv_ncci *new_ncci(capidrv_contr * card, · 17 unmodified lines | |||
| 421 | return nccip; | 421 | return nccip; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | static inline capidrv_ncci *find_ncci(capidrv_contr * card, u32 ncci) | 424 | static inline capidrv_ncci *find_ncci(capidrv_contr *card, u32 ncci) |
| 425 | { | 425 | { |
| 426 | capidrv_plci *plcip; | 426 | capidrv_plci *plcip; |
| 427 | capidrv_ncci *p; | 427 | capidrv_ncci *p; |
| @@ -435,7 +435,7 @@ static inline capidrv_ncci *find_ncci(capidrv_contr * card, u32 ncci) · 7 unmodified lines | |||
| 435 | return NULL; | 435 | return NULL; |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr * card, | 438 | static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr *card, |
| 439 | u32 ncci, u16 msgid) | 439 | u32 ncci, u16 msgid) |
| 440 | { | 440 | { |
| 441 | capidrv_plci *plcip; | 441 | capidrv_plci *plcip; |
| @@ -450,7 +450,7 @@ static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr * card, · 8 unmodified lines | |||
| 450 | return NULL; | 450 | return NULL; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | static void free_ncci(capidrv_contr * card, struct capidrv_ncci *nccip) | 453 | static void free_ncci(capidrv_contr *card, struct capidrv_ncci *nccip) |
| 454 | { | 454 | { |
| 455 | struct capidrv_ncci **pp; | 455 | struct capidrv_ncci **pp; |
| 456 | 456 | ||
| @@ -465,20 +465,20 @@ static void free_ncci(capidrv_contr * card, struct capidrv_ncci *nccip) · 8 unmodified lines | |||
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | static int capidrv_add_ack(struct capidrv_ncci *nccip, | 467 | static int capidrv_add_ack(struct capidrv_ncci *nccip, |
| 468 | u16 datahandle, int len) | 468 | u16 datahandle, int len) |
| 469 | { | 469 | { |
| 470 | struct ncci_datahandle_queue *n, **pp; | 470 | struct ncci_datahandle_queue *n, **pp; |
| 471 | 471 | ||
| 472 | n = (struct ncci_datahandle_queue *) | 472 | n = (struct ncci_datahandle_queue *) |
| 473 | kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC); | 473 | kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC); |
| 474 | if (!n) { | 474 | if (!n) { |
| 475 | printk(KERN_ERR "capidrv: kmalloc ncci_datahandle failed\n"); | 475 | printk(KERN_ERR "capidrv: kmalloc ncci_datahandle failed\n"); |
| 476 | return -1; | 476 | return -1; |
| 477 | } | 477 | } |
| 478 | n->next = NULL; | 478 | n->next = NULL; |
| 479 | n->datahandle = datahandle; | 479 | n->datahandle = datahandle; |
| 480 | n->len = len; | 480 | n->len = len; |
| 481 | for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) ; | 481 | for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next); |
| 482 | *pp = n; | 482 | *pp = n; |
| 483 | return 0; | 483 | return 0; |
| 484 | } | 484 | } |
| @@ -489,11 +489,11 @@ static int capidrv_del_ack(struct capidrv_ncci *nccip, u16 datahandle) · 4 unmodified lines | |||
| 489 | int len; | 489 | int len; |
| 490 | 490 | ||
| 491 | for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) { | 491 | for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) { |
| 492 | if ((*pp)->datahandle == datahandle) { | 492 | if ((*pp)->datahandle == datahandle) { |
| 493 | p = *pp; | 493 | p = *pp; |
| 494 | len = p->len; | 494 | len = p->len; |
| 495 | *pp = (*pp)->next; | 495 | *pp = (*pp)->next; |
| 496 | kfree(p); | 496 | kfree(p); |
| 497 | return len; | 497 | return len; |
| 498 | } | 498 | } |
| 499 | } | 499 | } |
| @@ -502,7 +502,7 @@ static int capidrv_del_ack(struct capidrv_ncci *nccip, u16 datahandle) · 2 unmodified lines | |||
| 502 | 502 | ||
| 503 | /* -------- convert and send capi message ---------------------------- */ | 503 | /* -------- convert and send capi message ---------------------------- */ |
| 504 | 504 | ||
| 505 | static void send_message(capidrv_contr * card, _cmsg * cmsg) | 505 | static void send_message(capidrv_contr *card, _cmsg *cmsg) |
| 506 | { | 506 | { |
| 507 | struct sk_buff *skb; | 507 | struct sk_buff *skb; |
| 508 | size_t len; | 508 | size_t len; |
| @@ -529,18 +529,18 @@ struct listenstatechange { · 20 unmodified lines | |||
| 529 | 529 | ||
| 530 | static struct listenstatechange listentable[] = | 530 | static struct listenstatechange listentable[] = |
| 531 | { | 531 | { |
| 532 | {ST_LISTEN_NONE, ST_LISTEN_WAIT_CONF, EV_LISTEN_REQ}, | 532 | {ST_LISTEN_NONE, ST_LISTEN_WAIT_CONF, EV_LISTEN_REQ}, |
| 533 | {ST_LISTEN_ACTIVE, ST_LISTEN_ACTIVE_WAIT_CONF, EV_LISTEN_REQ}, | 533 | {ST_LISTEN_ACTIVE, ST_LISTEN_ACTIVE_WAIT_CONF, EV_LISTEN_REQ}, |
| 534 | {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_ERROR}, | 534 | {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_ERROR}, |
| 535 | {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_ERROR}, | 535 | {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_ERROR}, |
| 536 | {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY}, | 536 | {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY}, |
| 537 | {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY}, | 537 | {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY}, |
| 538 | {ST_LISTEN_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK}, | 538 | {ST_LISTEN_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK}, |
| 539 | {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK}, | 539 | {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK}, |
| 540 | {}, | 540 | {}, |
| 541 | }; | 541 | }; |
| 542 | 542 | ||
| 543 | static void listen_change_state(capidrv_contr * card, int event) | 543 | static void listen_change_state(capidrv_contr *card, int event) |
| 544 | { | 544 | { |
| 545 | struct listenstatechange *p = listentable; | 545 | struct listenstatechange *p = listentable; |
| 546 | while (p->event) { | 546 | while (p->event) { |
| @@ -560,7 +560,7 @@ static void listen_change_state(capidrv_contr * card, int event) · 13 unmodified lines | |||
| 560 | 560 | ||
| 561 | /* ------------------------------------------------------------------ */ | 561 | /* ------------------------------------------------------------------ */ |
| 562 | 562 | ||
| 563 | static void p0(capidrv_contr * card, capidrv_plci * plci) | 563 | static void p0(capidrv_contr *card, capidrv_plci *plci) |
| 564 | { | 564 | { |
| 565 | isdn_ctrl cmd; | 565 | isdn_ctrl cmd; |
| 566 | 566 | ||
| @@ -578,71 +578,71 @@ struct plcistatechange { · 11 unmodified lines | |||
| 578 | int actstate; | 578 | int actstate; |
| 579 | int nextstate; | 579 | int nextstate; |
| 580 | int event; | 580 | int event; |
| 581 | void (*changefunc) (capidrv_contr * card, capidrv_plci * plci); | 581 | void (*changefunc)(capidrv_contr *card, capidrv_plci *plci); |
| 582 | }; | 582 | }; |
| 583 | 583 | ||
| 584 | static struct plcistatechange plcitable[] = | 584 | static struct plcistatechange plcitable[] = |
| 585 | { | 585 | { |
| 586 | /* P-0 */ | 586 | /* P-0 */ |
| 587 | {ST_PLCI_NONE, ST_PLCI_OUTGOING, EV_PLCI_CONNECT_REQ, NULL}, | 587 | {ST_PLCI_NONE, ST_PLCI_OUTGOING, EV_PLCI_CONNECT_REQ, NULL}, |
| 588 | {ST_PLCI_NONE, ST_PLCI_ALLOCATED, EV_PLCI_FACILITY_IND_UP, NULL}, | 588 | {ST_PLCI_NONE, ST_PLCI_ALLOCATED, EV_PLCI_FACILITY_IND_UP, NULL}, |
| 589 | {ST_PLCI_NONE, ST_PLCI_INCOMING, EV_PLCI_CONNECT_IND, NULL}, | 589 | {ST_PLCI_NONE, ST_PLCI_INCOMING, EV_PLCI_CONNECT_IND, NULL}, |
| 590 | {ST_PLCI_NONE, ST_PLCI_RESUMEING, EV_PLCI_RESUME_REQ, NULL}, | 590 | {ST_PLCI_NONE, ST_PLCI_RESUMEING, EV_PLCI_RESUME_REQ, NULL}, |
| 591 | /* P-0.1 */ | 591 | /* P-0.1 */ |
| 592 | {ST_PLCI_OUTGOING, ST_PLCI_NONE, EV_PLCI_CONNECT_CONF_ERROR, p0}, | 592 | {ST_PLCI_OUTGOING, ST_PLCI_NONE, EV_PLCI_CONNECT_CONF_ERROR, p0}, |
| 593 | {ST_PLCI_OUTGOING, ST_PLCI_ALLOCATED, EV_PLCI_CONNECT_CONF_OK, NULL}, | 593 | {ST_PLCI_OUTGOING, ST_PLCI_ALLOCATED, EV_PLCI_CONNECT_CONF_OK, NULL}, |
| 594 | /* P-1 */ | 594 | /* P-1 */ |
| 595 | {ST_PLCI_ALLOCATED, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, | 595 | {ST_PLCI_ALLOCATED, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, |
| 596 | {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, | 596 | {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, |
| 597 | {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, | 597 | {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, |
| 598 | {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, | 598 | {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, |
| 599 | /* P-ACT */ | 599 | /* P-ACT */ |
| 600 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, | 600 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, |
| 601 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, | 601 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, |
| 602 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, | 602 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, |
| 603 | {ST_PLCI_ACTIVE, ST_PLCI_HELD, EV_PLCI_HOLD_IND, NULL}, | 603 | {ST_PLCI_ACTIVE, ST_PLCI_HELD, EV_PLCI_HOLD_IND, NULL}, |
| 604 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_SUSPEND_IND, NULL}, | 604 | {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_SUSPEND_IND, NULL}, |
| 605 | /* P-2 */ | 605 | /* P-2 */ |
| 606 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL}, | 606 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL}, |
| 607 | {ST_PLCI_INCOMING, ST_PLCI_FACILITY_IND, EV_PLCI_FACILITY_IND_UP, NULL}, | 607 | {ST_PLCI_INCOMING, ST_PLCI_FACILITY_IND, EV_PLCI_FACILITY_IND_UP, NULL}, |
| 608 | {ST_PLCI_INCOMING, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_RESP, NULL}, | 608 | {ST_PLCI_INCOMING, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_RESP, NULL}, |
| 609 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, | 609 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, |
| 610 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, | 610 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, |
| 611 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, | 611 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, |
| 612 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CD_IND, NULL}, | 612 | {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CD_IND, NULL}, |
| 613 | /* P-3 */ | 613 | /* P-3 */ |
| 614 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL}, | 614 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL}, |
| 615 | {ST_PLCI_FACILITY_IND, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, | 615 | {ST_PLCI_FACILITY_IND, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, |
| 616 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, | 616 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, |
| 617 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, | 617 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, |
| 618 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, | 618 | {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, |
| 619 | /* P-4 */ | 619 | /* P-4 */ |
| 620 | {ST_PLCI_ACCEPTING, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, | 620 | {ST_PLCI_ACCEPTING, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, |
| 621 | {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, | 621 | {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, |
| 622 | {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, | 622 | {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, |
| 623 | {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, | 623 | {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, |
| 624 | /* P-5 */ | 624 | /* P-5 */ |
| 625 | {ST_PLCI_DISCONNECTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, | 625 | {ST_PLCI_DISCONNECTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, |
| 626 | /* P-6 */ | 626 | /* P-6 */ |
| 627 | {ST_PLCI_DISCONNECTED, ST_PLCI_NONE, EV_PLCI_DISCONNECT_RESP, p0}, | 627 | {ST_PLCI_DISCONNECTED, ST_PLCI_NONE, EV_PLCI_DISCONNECT_RESP, p0}, |
| 628 | /* P-0.Res */ | 628 | /* P-0.Res */ |
| 629 | {ST_PLCI_RESUMEING, ST_PLCI_NONE, EV_PLCI_RESUME_CONF_ERROR, p0}, | 629 | {ST_PLCI_RESUMEING, ST_PLCI_NONE, EV_PLCI_RESUME_CONF_ERROR, p0}, |
| 630 | {ST_PLCI_RESUMEING, ST_PLCI_RESUME, EV_PLCI_RESUME_CONF_OK, NULL}, | 630 | {ST_PLCI_RESUMEING, ST_PLCI_RESUME, EV_PLCI_RESUME_CONF_OK, NULL}, |
| 631 | /* P-RES */ | 631 | /* P-RES */ |
| 632 | {ST_PLCI_RESUME, ST_PLCI_ACTIVE, EV_PLCI_RESUME_IND, NULL}, | 632 | {ST_PLCI_RESUME, ST_PLCI_ACTIVE, EV_PLCI_RESUME_IND, NULL}, |
| 633 | /* P-HELD */ | 633 | /* P-HELD */ |
| 634 | {ST_PLCI_HELD, ST_PLCI_ACTIVE, EV_PLCI_RETRIEVE_IND, NULL}, | 634 | {ST_PLCI_HELD, ST_PLCI_ACTIVE, EV_PLCI_RETRIEVE_IND, NULL}, |
| 635 | {}, | 635 | {}, |
| 636 | }; | 636 | }; |
| 637 | 637 | ||
| 638 | static void plci_change_state(capidrv_contr * card, capidrv_plci * plci, int event) | 638 | static void plci_change_state(capidrv_contr *card, capidrv_plci *plci, int event) |
| 639 | { | 639 | { |
| 640 | struct plcistatechange *p = plcitable; | 640 | struct plcistatechange *p = plcitable; |
| 641 | while (p->event) { | 641 | while (p->event) { |
| 642 | if (plci->state == p->actstate && p->event == event) { | 642 | if (plci->state == p->actstate && p->event == event) { |
| 643 | if (debugmode) | 643 | if (debugmode) |
| 644 | printk(KERN_DEBUG "capidrv-%d: plci_change_state:0x%x %d -> %d\n", | 644 | printk(KERN_DEBUG "capidrv-%d: plci_change_state:0x%x %d -> %d\n", |
| 645 | card->contrnr, plci->plci, plci->state, p->nextstate); | 645 | card->contrnr, plci->plci, plci->state, p->nextstate); |
| 646 | plci->state = p->nextstate; | 646 | plci->state = p->nextstate; |
| 647 | if (p->changefunc) | 647 | if (p->changefunc) |
| 648 | p->changefunc(card, plci); | 648 | p->changefunc(card, plci); |
| @@ -658,7 +658,7 @@ static void plci_change_state(capidrv_contr * card, capidrv_plci * plci, int eve · 9 unmodified lines | |||
| 658 | 658 | ||
| 659 | static _cmsg cmsg; | 659 | static _cmsg cmsg; |
| 660 | 660 | ||
| 661 | static void n0(capidrv_contr * card, capidrv_ncci * ncci) | 661 | static void n0(capidrv_contr *card, capidrv_ncci *ncci) |
| 662 | { | 662 | { |
| 663 | isdn_ctrl cmd; | 663 | isdn_ctrl cmd; |
| 664 | 664 | ||
| @@ -670,7 +670,7 @@ static void n0(capidrv_contr * card, capidrv_ncci * ncci) · 5 unmodified lines | |||
| 670 | NULL, /* Keypadfacility */ | 670 | NULL, /* Keypadfacility */ |
| 671 | NULL, /* Useruserdata */ /* $$$$ */ | 671 | NULL, /* Useruserdata */ /* $$$$ */ |
| 672 | NULL /* Facilitydataarray */ | 672 | NULL /* Facilitydataarray */ |
| 673 | ); | 673 | ); |
| 674 | plci_change_state(card, ncci->plcip, EV_PLCI_DISCONNECT_REQ); | 674 | plci_change_state(card, ncci->plcip, EV_PLCI_DISCONNECT_REQ); |
| 675 | send_message(card, &cmsg); | 675 | send_message(card, &cmsg); |
| 676 | 676 | ||
| @@ -687,51 +687,51 @@ struct nccistatechange { · 10 unmodified lines | |||
| 687 | int actstate; | 687 | int actstate; |
| 688 | int nextstate; | 688 | int nextstate; |
| 689 | int event; | 689 | int event; |
| 690 | void (*changefunc) (capidrv_contr * card, capidrv_ncci * ncci); | 690 | void (*changefunc)(capidrv_contr *card, capidrv_ncci *ncci); |
| 691 | }; | 691 | }; |
| 692 | 692 | ||
| 693 | static struct nccistatechange nccitable[] = | 693 | static struct nccistatechange nccitable[] = |
| 694 | { | 694 | { |
| 695 | /* N-0 */ | 695 | /* N-0 */ |
| 696 | {ST_NCCI_NONE, ST_NCCI_OUTGOING, EV_NCCI_CONNECT_B3_REQ, NULL}, | 696 | {ST_NCCI_NONE, ST_NCCI_OUTGOING, EV_NCCI_CONNECT_B3_REQ, NULL}, |
| 697 | {ST_NCCI_NONE, ST_NCCI_INCOMING, EV_NCCI_CONNECT_B3_IND, NULL}, | 697 | {ST_NCCI_NONE, ST_NCCI_INCOMING, EV_NCCI_CONNECT_B3_IND, NULL}, |
| 698 | /* N-0.1 */ | 698 | /* N-0.1 */ |
| 699 | {ST_NCCI_OUTGOING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_CONF_OK, NULL}, | 699 | {ST_NCCI_OUTGOING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_CONF_OK, NULL}, |
| 700 | {ST_NCCI_OUTGOING, ST_NCCI_NONE, EV_NCCI_CONNECT_B3_CONF_ERROR, n0}, | 700 | {ST_NCCI_OUTGOING, ST_NCCI_NONE, EV_NCCI_CONNECT_B3_CONF_ERROR, n0}, |
| 701 | /* N-1 */ | 701 | /* N-1 */ |
| 702 | {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_CONNECT_B3_REJECT, NULL}, | 702 | {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_CONNECT_B3_REJECT, NULL}, |
| 703 | {ST_NCCI_INCOMING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_RESP, NULL}, | 703 | {ST_NCCI_INCOMING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_RESP, NULL}, |
| 704 | {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, | 704 | {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, |
| 705 | {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, | 705 | {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, |
| 706 | /* N-2 */ | 706 | /* N-2 */ |
| 707 | {ST_NCCI_ALLOCATED, ST_NCCI_ACTIVE, EV_NCCI_CONNECT_B3_ACTIVE_IND, NULL}, | 707 | {ST_NCCI_ALLOCATED, ST_NCCI_ACTIVE, EV_NCCI_CONNECT_B3_ACTIVE_IND, NULL}, |
| 708 | {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, | 708 | {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, |
| 709 | {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, | 709 | {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, |
| 710 | /* N-ACT */ | 710 | /* N-ACT */ |
| 711 | {ST_NCCI_ACTIVE, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL}, | 711 | {ST_NCCI_ACTIVE, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL}, |
| 712 | {ST_NCCI_ACTIVE, ST_NCCI_RESETING, EV_NCCI_RESET_B3_REQ, NULL}, | 712 | {ST_NCCI_ACTIVE, ST_NCCI_RESETING, EV_NCCI_RESET_B3_REQ, NULL}, |
| 713 | {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, | 713 | {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, |
| 714 | {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, | 714 | {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, |
| 715 | /* N-3 */ | 715 | /* N-3 */ |
| 716 | {ST_NCCI_RESETING, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL}, | 716 | {ST_NCCI_RESETING, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL}, |
| 717 | {ST_NCCI_RESETING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, | 717 | {ST_NCCI_RESETING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, |
| 718 | {ST_NCCI_RESETING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, | 718 | {ST_NCCI_RESETING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, |
| 719 | /* N-4 */ | 719 | /* N-4 */ |
| 720 | {ST_NCCI_DISCONNECTING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, | 720 | {ST_NCCI_DISCONNECTING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, |
| 721 | {ST_NCCI_DISCONNECTING, ST_NCCI_PREVIOUS, EV_NCCI_DISCONNECT_B3_CONF_ERROR,NULL}, | 721 | {ST_NCCI_DISCONNECTING, ST_NCCI_PREVIOUS, EV_NCCI_DISCONNECT_B3_CONF_ERROR, NULL}, |
| 722 | /* N-5 */ | 722 | /* N-5 */ |
| 723 | {ST_NCCI_DISCONNECTED, ST_NCCI_NONE, EV_NCCI_DISCONNECT_B3_RESP, n0}, | 723 | {ST_NCCI_DISCONNECTED, ST_NCCI_NONE, EV_NCCI_DISCONNECT_B3_RESP, n0}, |
| 724 | {}, | 724 | {}, |
| 725 | }; | 725 | }; |
| 726 | 726 | ||
| 727 | static void ncci_change_state(capidrv_contr * card, capidrv_ncci * ncci, int event) | 727 | static void ncci_change_state(capidrv_contr *card, capidrv_ncci *ncci, int event) |
| 728 | { | 728 | { |
| 729 | struct nccistatechange *p = nccitable; | 729 | struct nccistatechange *p = nccitable; |
| 730 | while (p->event) { | 730 | while (p->event) { |
| 731 | if (ncci->state == p->actstate && p->event == event) { | 731 | if (ncci->state == p->actstate && p->event == event) { |
| 732 | if (debugmode) | 732 | if (debugmode) |
| 733 | printk(KERN_DEBUG "capidrv-%d: ncci_change_state:0x%x %d -> %d\n", | 733 | printk(KERN_DEBUG "capidrv-%d: ncci_change_state:0x%x %d -> %d\n", |
| 734 | card->contrnr, ncci->ncci, ncci->state, p->nextstate); | 734 | card->contrnr, ncci->ncci, ncci->state, p->nextstate); |
| 735 | if (p->nextstate == ST_NCCI_PREVIOUS) { | 735 | if (p->nextstate == ST_NCCI_PREVIOUS) { |
| 736 | ncci->state = ncci->oldstate; | 736 | ncci->state = ncci->oldstate; |
| 737 | ncci->oldstate = p->actstate; | 737 | ncci->oldstate = p->actstate; |
| @@ -751,7 +751,7 @@ static void ncci_change_state(capidrv_contr * card, capidrv_ncci * ncci, int eve · 13 unmodified lines | |||
| 751 | 751 | ||
| 752 | /* ------------------------------------------------------------------- */ | 752 | /* ------------------------------------------------------------------- */ |
| 753 | 753 | ||
| 754 | static inline int new_bchan(capidrv_contr * card) | 754 | static inline int new_bchan(capidrv_contr *card) |
| 755 | { | 755 | { |
| 756 | int i; | 756 | int i; |
| 757 | for (i = 0; i < card->nbchan; i++) { | 757 | for (i = 0; i < card->nbchan; i++) { |
| @@ -765,7 +765,7 @@ static inline int new_bchan(capidrv_contr * card) · 7 unmodified lines | |||
| 765 | 765 | ||
| 766 | /* ------------------------------------------------------------------- */ | 766 | /* ------------------------------------------------------------------- */ |
| 767 | 767 | ||
| 768 | static void handle_controller(_cmsg * cmsg) | 768 | static void handle_controller(_cmsg *cmsg) |
| 769 | { | 769 | { |
| 770 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); | 770 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); |
| 771 | 771 | ||
| @@ -791,54 +791,54 @@ static void handle_controller(_cmsg * cmsg) · 19 unmodified lines | |||
| 791 | break; | 791 | break; |
| 792 | 792 | ||
| 793 | case CAPI_MANUFACTURER_IND: /* Controller */ | 793 | case CAPI_MANUFACTURER_IND: /* Controller */ |
| 794 | if ( cmsg->ManuID == 0x214D5641 | 794 | if (cmsg->ManuID == 0x214D5641 |
| 795 | && cmsg->Class == 0 | 795 | && cmsg->Class == 0 |
| 796 | && cmsg->Function == 1) { | 796 | && cmsg->Function == 1) { |
| 797 | u8 *data = cmsg->ManuData+3; | 797 | u8 *data = cmsg->ManuData + 3; |
| 798 | u16 len = cmsg->ManuData[0]; | 798 | u16 len = cmsg->ManuData[0]; |
| 799 | u16 layer; | 799 | u16 layer; |
| 800 | int direction; | 800 | int direction; |
| 801 | if (len == 255) { | 801 | if (len == 255) { |
| 802 | len = (cmsg->ManuData[1] | (cmsg->ManuData[2] << 8)); | 802 | len = (cmsg->ManuData[1] | (cmsg->ManuData[2] << 8)); |
| 803 | data += 2; | 803 | data += 2; |
| 804 | } | 804 | } |
| 805 | len -= 2; | 805 | len -= 2; |
| 806 | layer = ((*(data-1)) << 8) | *(data-2); | 806 | layer = ((*(data - 1)) << 8) | *(data - 2); |
| 807 | if (layer & 0x300) | 807 | if (layer & 0x300) |
| 808 | direction = (layer & 0x200) ? 0 : 1; | 808 | direction = (layer & 0x200) ? 0 : 1; |
| 809 | else direction = (layer & 0x800) ? 0 : 1; | 809 | else direction = (layer & 0x800) ? 0 : 1; |
| 810 | if (layer & 0x0C00) { | 810 | if (layer & 0x0C00) { |
| 811 | if ((layer & 0xff) == 0x80) { | 811 | if ((layer & 0xff) == 0x80) { |
| 812 | handle_dtrace_data(card, direction, 1, data, len); | 812 | handle_dtrace_data(card, direction, 1, data, len); |
| 813 | break; | 813 | break; |
| 814 | } | 814 | } |
| 815 | } else if ((layer & 0xff) < 0x80) { | 815 | } else if ((layer & 0xff) < 0x80) { |
| 816 | handle_dtrace_data(card, direction, 0, data, len); | 816 | handle_dtrace_data(card, direction, 0, data, len); |
| 817 | break; | 817 | break; |
| 818 | } | 818 | } |
| 819 | printk(KERN_INFO "capidrv-%d: %s from controller 0x%x layer 0x%x, ignored\n", | 819 | printk(KERN_INFO "capidrv-%d: %s from controller 0x%x layer 0x%x, ignored\n", |
| 820 | card->contrnr, | 820 | card->contrnr, |
| 821 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 821 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 822 | cmsg->adr.adrController, layer); | 822 | cmsg->adr.adrController, layer); |
| 823 | break; | 823 | break; |
| 824 | } | 824 | } |
| 825 | goto ignored; | 825 | goto ignored; |
| 826 | case CAPI_MANUFACTURER_CONF: /* Controller */ | 826 | case CAPI_MANUFACTURER_CONF: /* Controller */ |
| 827 | if (cmsg->ManuID == 0x214D5641) { | 827 | if (cmsg->ManuID == 0x214D5641) { |
| 828 | char *s = NULL; | 828 | char *s = NULL; |
| 829 | switch (cmsg->Class) { | 829 | switch (cmsg->Class) { |
| 830 | case 0: break; | 830 | case 0: break; |
| 831 | case 1: s = "unknown class"; break; | 831 | case 1: s = "unknown class"; break; |
| 832 | case 2: s = "unknown function"; break; | 832 | case 2: s = "unknown function"; break; |
| 833 | default: s = "unknown error"; break; | 833 | default: s = "unknown error"; break; |
| 834 | } | 834 | } |
| 835 | if (s) | 835 | if (s) |
| 836 | printk(KERN_INFO "capidrv-%d: %s from controller 0x%x function %d: %s\n", | 836 | printk(KERN_INFO "capidrv-%d: %s from controller 0x%x function %d: %s\n", |
| 837 | card->contrnr, | 837 | card->contrnr, |
| 838 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 838 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 839 | cmsg->adr.adrController, | 839 | cmsg->adr.adrController, |
| 840 | cmsg->Function, s); | 840 | cmsg->Function, s); |
| 841 | break; | 841 | break; |
| 842 | } | 842 | } |
| 843 | goto ignored; | 843 | goto ignored; |
| 844 | case CAPI_FACILITY_IND: /* Controller/plci/ncci */ | 844 | case CAPI_FACILITY_IND: /* Controller/plci/ncci */ |
| @@ -858,14 +858,14 @@ static void handle_controller(_cmsg * cmsg) · 13 unmodified lines | |||
| 858 | } | 858 | } |
| 859 | return; | 859 | return; |
| 860 | 860 | ||
| 861 | ignored: | 861 | ignored: |
| 862 | printk(KERN_INFO "capidrv-%d: %s from controller 0x%x ignored\n", | 862 | printk(KERN_INFO "capidrv-%d: %s from controller 0x%x ignored\n", |
| 863 | card->contrnr, | 863 | card->contrnr, |
| 864 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 864 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 865 | cmsg->adr.adrController); | 865 | cmsg->adr.adrController); |
| 866 | } | 866 | } |
| 867 | 867 | ||
| 868 | static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) | 868 | static void handle_incoming_call(capidrv_contr *card, _cmsg *cmsg) |
| 869 | { | 869 | { |
| 870 | capidrv_plci *plcip; | 870 | capidrv_plci *plcip; |
| 871 | capidrv_bchan *bchan; | 871 | capidrv_bchan *bchan; |
| @@ -890,27 +890,27 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) · 18 unmodified lines | |||
| 890 | cmd.arg = chan; | 890 | cmd.arg = chan; |
| 891 | memset(&cmd.parm.setup, 0, sizeof(cmd.parm.setup)); | 891 | memset(&cmd.parm.setup, 0, sizeof(cmd.parm.setup)); |
| 892 | strncpy(cmd.parm.setup.phone, | 892 | strncpy(cmd.parm.setup.phone, |
| 893 | cmsg->CallingPartyNumber + 3, | 893 | cmsg->CallingPartyNumber + 3, |
| 894 | cmsg->CallingPartyNumber[0] - 2); | 894 | cmsg->CallingPartyNumber[0] - 2); |
| 895 | strncpy(cmd.parm.setup.eazmsn, | 895 | strncpy(cmd.parm.setup.eazmsn, |
| 896 | cmsg->CalledPartyNumber + 2, | 896 | cmsg->CalledPartyNumber + 2, |
| 897 | cmsg->CalledPartyNumber[0] - 1); | 897 | cmsg->CalledPartyNumber[0] - 1); |
| 898 | cmd.parm.setup.si1 = cip2si1(cmsg->CIPValue); | 898 | cmd.parm.setup.si1 = cip2si1(cmsg->CIPValue); |
| 899 | cmd.parm.setup.si2 = cip2si2(cmsg->CIPValue); | 899 | cmd.parm.setup.si2 = cip2si2(cmsg->CIPValue); |
| 900 | cmd.parm.setup.plan = cmsg->CallingPartyNumber[1]; | 900 | cmd.parm.setup.plan = cmsg->CallingPartyNumber[1]; |
| 901 | cmd.parm.setup.screen = cmsg->CallingPartyNumber[2]; | 901 | cmd.parm.setup.screen = cmsg->CallingPartyNumber[2]; |
| 902 | 902 | ||
| 903 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s\n", | 903 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s\n", |
| 904 | card->contrnr, | 904 | card->contrnr, |
| 905 | cmd.parm.setup.phone, | 905 | cmd.parm.setup.phone, |
| 906 | cmd.parm.setup.si1, | 906 | cmd.parm.setup.si1, |
| 907 | cmd.parm.setup.si2, | 907 | cmd.parm.setup.si2, |
| 908 | cmd.parm.setup.eazmsn); | 908 | cmd.parm.setup.eazmsn); |
| 909 | 909 | ||
| 910 | if (cmd.parm.setup.si1 == 1 && cmd.parm.setup.si2 != 0) { | 910 | if (cmd.parm.setup.si1 == 1 && cmd.parm.setup.si2 != 0) { |
| 911 | printk(KERN_INFO "capidrv-%d: patching si2=%d to 0 for VBOX\n", | 911 | printk(KERN_INFO "capidrv-%d: patching si2=%d to 0 for VBOX\n", |
| 912 | card->contrnr, | 912 | card->contrnr, |
| 913 | cmd.parm.setup.si2); | 913 | cmd.parm.setup.si2); |
| 914 | cmd.parm.setup.si2 = 0; | 914 | cmd.parm.setup.si2 = 0; |
| 915 | } | 915 | } |
| 916 | 916 | ||
| @@ -927,11 +927,11 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) · 10 unmodified lines | |||
| 927 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); | 927 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); |
| 928 | send_message(card, cmsg); | 928 | send_message(card, cmsg); |
| 929 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s ignored\n", | 929 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s ignored\n", |
| 930 | card->contrnr, | 930 | card->contrnr, |
| 931 | cmd.parm.setup.phone, | 931 | cmd.parm.setup.phone, |
| 932 | cmd.parm.setup.si1, | 932 | cmd.parm.setup.si1, |
| 933 | cmd.parm.setup.si2, | 933 | cmd.parm.setup.si2, |
| 934 | cmd.parm.setup.eazmsn); | 934 | cmd.parm.setup.eazmsn); |
| 935 | break; | 935 | break; |
| 936 | case 1: | 936 | case 1: |
| 937 | /* At least one device matching this call (RING on ttyI) | 937 | /* At least one device matching this call (RING on ttyI) |
| @@ -945,11 +945,11 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) · 7 unmodified lines | |||
| 945 | */ | 945 | */ |
| 946 | if (plcip->state == ST_PLCI_INCOMING) { | 946 | if (plcip->state == ST_PLCI_INCOMING) { |
| 947 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s tty alerting\n", | 947 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s tty alerting\n", |
| 948 | card->contrnr, | 948 | card->contrnr, |
| 949 | cmd.parm.setup.phone, | 949 | cmd.parm.setup.phone, |
| 950 | cmd.parm.setup.si1, | 950 | cmd.parm.setup.si1, |
| 951 | cmd.parm.setup.si2, | 951 | cmd.parm.setup.si2, |
| 952 | cmd.parm.setup.eazmsn); | 952 | cmd.parm.setup.eazmsn); |
| 953 | capi_fill_ALERT_REQ(cmsg, | 953 | capi_fill_ALERT_REQ(cmsg, |
| 954 | global.ap.applid, | 954 | global.ap.applid, |
| 955 | card->msgid++, | 955 | card->msgid++, |
| @@ -958,16 +958,16 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) · 2 unmodified lines | |||
| 958 | NULL,/* Keypadfacility */ | 958 | NULL,/* Keypadfacility */ |
| 959 | NULL,/* Useruserdata */ | 959 | NULL,/* Useruserdata */ |
| 960 | NULL /* Facilitydataarray */ | 960 | NULL /* Facilitydataarray */ |
| 961 | ); | 961 | ); |
| 962 | plcip->msgid = cmsg->Messagenumber; | 962 | plcip->msgid = cmsg->Messagenumber; |
| 963 | send_message(card, cmsg); | 963 | send_message(card, cmsg); |
| 964 | } else { | 964 | } else { |
| 965 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s on netdev\n", | 965 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s on netdev\n", |
| 966 | card->contrnr, | 966 | card->contrnr, |
| 967 | cmd.parm.setup.phone, | 967 | cmd.parm.setup.phone, |
| 968 | cmd.parm.setup.si1, | 968 | cmd.parm.setup.si1, |
| 969 | cmd.parm.setup.si2, | 969 | cmd.parm.setup.si2, |
| 970 | cmd.parm.setup.eazmsn); | 970 | cmd.parm.setup.eazmsn); |
| 971 | } | 971 | } |
| 972 | break; | 972 | break; |
| 973 | 973 | ||
| @@ -990,7 +990,7 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) · 16 unmodified lines | |||
| 990 | return; | 990 | return; |
| 991 | } | 991 | } |
| 992 | 992 | ||
| 993 | static void handle_plci(_cmsg * cmsg) | 993 | static void handle_plci(_cmsg *cmsg) |
| 994 | { | 994 | { |
| 995 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); | 995 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); |
| 996 | capidrv_plci *plcip; | 996 | capidrv_plci *plcip; |
| @@ -1008,8 +1008,8 @@ static void handle_plci(_cmsg * cmsg) · 11 unmodified lines | |||
| 1008 | case CAPI_DISCONNECT_IND: /* plci */ | 1008 | case CAPI_DISCONNECT_IND: /* plci */ |
| 1009 | if (cmsg->Reason) { | 1009 | if (cmsg->Reason) { |
| 1010 | printk(KERN_INFO "capidrv-%d: %s reason 0x%x (%s) for plci 0x%x\n", | 1010 | printk(KERN_INFO "capidrv-%d: %s reason 0x%x (%s) for plci 0x%x\n", |
| 1011 | card->contrnr, | 1011 | card->contrnr, |
| 1012 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1012 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1013 | cmsg->Reason, capi_info2str(cmsg->Reason), cmsg->adr.adrPLCI); | 1013 | cmsg->Reason, capi_info2str(cmsg->Reason), cmsg->adr.adrPLCI); |
| 1014 | } | 1014 | } |
| 1015 | if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI))) { | 1015 | if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI))) { |
| @@ -1027,9 +1027,9 @@ static void handle_plci(_cmsg * cmsg) · 11 unmodified lines | |||
| 1027 | case CAPI_DISCONNECT_CONF: /* plci */ | 1027 | case CAPI_DISCONNECT_CONF: /* plci */ |
| 1028 | if (cmsg->Info) { | 1028 | if (cmsg->Info) { |
| 1029 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", | 1029 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", |
| 1030 | card->contrnr, | 1030 | card->contrnr, |
| 1031 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1031 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1032 | cmsg->Info, capi_info2str(cmsg->Info), | 1032 | cmsg->Info, capi_info2str(cmsg->Info), |
| 1033 | cmsg->adr.adrPLCI); | 1033 | cmsg->adr.adrPLCI); |
| 1034 | } | 1034 | } |
| 1035 | if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI))) | 1035 | if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI))) |
| @@ -1041,9 +1041,9 @@ static void handle_plci(_cmsg * cmsg) · 5 unmodified lines | |||
| 1041 | case CAPI_ALERT_CONF: /* plci */ | 1041 | case CAPI_ALERT_CONF: /* plci */ |
| 1042 | if (cmsg->Info) { | 1042 | if (cmsg->Info) { |
| 1043 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", | 1043 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", |
| 1044 | card->contrnr, | 1044 | card->contrnr, |
| 1045 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1045 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1046 | cmsg->Info, capi_info2str(cmsg->Info), | 1046 | cmsg->Info, capi_info2str(cmsg->Info), |
| 1047 | cmsg->adr.adrPLCI); | 1047 | cmsg->adr.adrPLCI); |
| 1048 | } | 1048 | } |
| 1049 | break; | 1049 | break; |
| @@ -1055,9 +1055,9 @@ static void handle_plci(_cmsg * cmsg) · 5 unmodified lines | |||
| 1055 | case CAPI_CONNECT_CONF: /* plci */ | 1055 | case CAPI_CONNECT_CONF: /* plci */ |
| 1056 | if (cmsg->Info) { | 1056 | if (cmsg->Info) { |
| 1057 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", | 1057 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", |
| 1058 | card->contrnr, | 1058 | card->contrnr, |
| 1059 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1059 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1060 | cmsg->Info, capi_info2str(cmsg->Info), | 1060 | cmsg->Info, capi_info2str(cmsg->Info), |
| 1061 | cmsg->adr.adrPLCI); | 1061 | cmsg->adr.adrPLCI); |
| 1062 | } | 1062 | } |
| 1063 | if (!(plcip = find_plci_by_msgid(card, cmsg->Messagenumber))) | 1063 | if (!(plcip = find_plci_by_msgid(card, cmsg->Messagenumber))) |
| @@ -1096,7 +1096,7 @@ static void handle_plci(_cmsg * cmsg) · 32 unmodified lines | |||
| 1096 | card->msgid++, | 1096 | card->msgid++, |
| 1097 | plcip->plci, /* adr */ | 1097 | plcip->plci, /* adr */ |
| 1098 | NULL /* NCPI */ | 1098 | NULL /* NCPI */ |
| 1099 | ); | 1099 | ); |
| 1100 | nccip->msgid = cmsg->Messagenumber; | 1100 | nccip->msgid = cmsg->Messagenumber; |
| 1101 | plci_change_state(card, plcip, | 1101 | plci_change_state(card, plcip, |
| 1102 | EV_PLCI_CONNECT_ACTIVE_IND); | 1102 | EV_PLCI_CONNECT_ACTIVE_IND); |
| @@ -1122,8 +1122,8 @@ static void handle_plci(_cmsg * cmsg) · 19 unmodified lines | |||
| 1122 | sprintf(cmd.parm.num, "%lu", | 1122 | sprintf(cmd.parm.num, "%lu", |
| 1123 | (unsigned long) | 1123 | (unsigned long) |
| 1124 | ((u32) cmsg->InfoElement[1] | 1124 | ((u32) cmsg->InfoElement[1] |
| 1125 | | ((u32) (cmsg->InfoElement[2]) << 8) | 1125 | | ((u32) (cmsg->InfoElement[2]) << 8) |
| 1126 | | ((u32) (cmsg->InfoElement[3]) << 16) | 1126 | | ((u32) (cmsg->InfoElement[3]) << 16) |
| 1127 | | ((u32) (cmsg->InfoElement[4]) << 24))); | 1127 | | ((u32) (cmsg->InfoElement[4]) << 24))); |
| 1128 | card->interface.statcallb(&cmd); | 1128 | card->interface.statcallb(&cmd); |
| 1129 | break; | 1129 | break; |
| @@ -1132,11 +1132,11 @@ static void handle_plci(_cmsg * cmsg) · 2 unmodified lines | |||
| 1132 | cdb = capi_cmsg2str(cmsg); | 1132 | cdb = capi_cmsg2str(cmsg); |
| 1133 | if (cdb) { | 1133 | if (cdb) { |
| 1134 | printk(KERN_WARNING "capidrv-%d: %s\n", | 1134 | printk(KERN_WARNING "capidrv-%d: %s\n", |
| 1135 | card->contrnr, cdb->buf); | 1135 | card->contrnr, cdb->buf); |
| 1136 | cdebbuf_free(cdb); | 1136 | cdebbuf_free(cdb); |
| 1137 | } else | 1137 | } else |
| 1138 | printk(KERN_WARNING "capidrv-%d: CAPI_INFO_IND InfoNumber %x not handled\n", | 1138 | printk(KERN_WARNING "capidrv-%d: CAPI_INFO_IND InfoNumber %x not handled\n", |
| 1139 | card->contrnr, cmsg->InfoNumber); | 1139 | card->contrnr, cmsg->InfoNumber); |
| 1140 | 1140 | ||
| 1141 | break; | 1141 | break; |
| 1142 | 1142 | ||
| @@ -1159,13 +1159,13 @@ static void handle_plci(_cmsg * cmsg) · 16 unmodified lines | |||
| 1159 | cmsg->adr.adrPLCI); | 1159 | cmsg->adr.adrPLCI); |
| 1160 | } | 1160 | } |
| 1161 | return; | 1161 | return; |
| 1162 | ignored: | 1162 | ignored: |
| 1163 | printk(KERN_INFO "capidrv-%d: %s for plci 0x%x ignored\n", | 1163 | printk(KERN_INFO "capidrv-%d: %s for plci 0x%x ignored\n", |
| 1164 | card->contrnr, | 1164 | card->contrnr, |
| 1165 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1165 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1166 | cmsg->adr.adrPLCI); | 1166 | cmsg->adr.adrPLCI); |
| 1167 | return; | 1167 | return; |
| 1168 | notfound: | 1168 | notfound: |
| 1169 | printk(KERN_ERR "capidrv-%d: %s: plci 0x%x not found\n", | 1169 | printk(KERN_ERR "capidrv-%d: %s: plci 0x%x not found\n", |
| 1170 | card->contrnr, | 1170 | card->contrnr, |
| 1171 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1171 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| @@ -1173,7 +1173,7 @@ static void handle_plci(_cmsg * cmsg) · 1 unmodified line | |||
| 1173 | return; | 1173 | return; |
| 1174 | } | 1174 | } |
| 1175 | 1175 | ||
| 1176 | static void handle_ncci(_cmsg * cmsg) | 1176 | static void handle_ncci(_cmsg *cmsg) |
| 1177 | { | 1177 | { |
| 1178 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); | 1178 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); |
| 1179 | capidrv_plci *plcip; | 1179 | capidrv_plci *plcip; |
| @@ -1222,7 +1222,7 @@ static void handle_ncci(_cmsg * cmsg) · 42 unmodified lines | |||
| 1222 | nccip->ncci, /* adr */ | 1222 | nccip->ncci, /* adr */ |
| 1223 | 0, /* Reject */ | 1223 | 0, /* Reject */ |
| 1224 | NULL /* NCPI */ | 1224 | NULL /* NCPI */ |
| 1225 | ); | 1225 | ); |
| 1226 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_RESP); | 1226 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_RESP); |
| 1227 | send_message(card, cmsg); | 1227 | send_message(card, cmsg); |
| 1228 | break; | 1228 | break; |
| @@ -1230,8 +1230,8 @@ static void handle_ncci(_cmsg * cmsg) · 1 unmodified line | |||
| 1230 | printk(KERN_ERR "capidrv-%d: no mem for ncci, sorry\n", card->contrnr); | 1230 | printk(KERN_ERR "capidrv-%d: no mem for ncci, sorry\n", card->contrnr); |
| 1231 | } else { | 1231 | } else { |
| 1232 | printk(KERN_ERR "capidrv-%d: %s: plci for ncci 0x%x not found\n", | 1232 | printk(KERN_ERR "capidrv-%d: %s: plci for ncci 0x%x not found\n", |
| 1233 | card->contrnr, | 1233 | card->contrnr, |
| 1234 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1234 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1235 | cmsg->adr.adrNCCI); | 1235 | cmsg->adr.adrNCCI); |
| 1236 | } | 1236 | } |
| 1237 | capi_fill_CONNECT_B3_RESP(cmsg, | 1237 | capi_fill_CONNECT_B3_RESP(cmsg, |
| @@ -1240,7 +1240,7 @@ static void handle_ncci(_cmsg * cmsg) · 2 unmodified lines | |||
| 1240 | cmsg->adr.adrNCCI, | 1240 | cmsg->adr.adrNCCI, |
| 1241 | 2, /* Reject */ | 1241 | 2, /* Reject */ |
| 1242 | NULL /* NCPI */ | 1242 | NULL /* NCPI */ |
| 1243 | ); | 1243 | ); |
| 1244 | send_message(card, cmsg); | 1244 | send_message(card, cmsg); |
| 1245 | break; | 1245 | break; |
| 1246 | 1246 | ||
| @@ -1254,9 +1254,9 @@ static void handle_ncci(_cmsg * cmsg) · 7 unmodified lines | |||
| 1254 | nccip->ncci = cmsg->adr.adrNCCI; | 1254 | nccip->ncci = cmsg->adr.adrNCCI; |
| 1255 | if (cmsg->Info) { | 1255 | if (cmsg->Info) { |
| 1256 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n", | 1256 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n", |
| 1257 | card->contrnr, | 1257 | card->contrnr, |
| 1258 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1258 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1259 | cmsg->Info, capi_info2str(cmsg->Info), | 1259 | cmsg->Info, capi_info2str(cmsg->Info), |
| 1260 | cmsg->adr.adrNCCI); | 1260 | cmsg->adr.adrNCCI); |
| 1261 | } | 1261 | } |
| 1262 | 1262 | ||
| @@ -1278,7 +1278,7 @@ static void handle_ncci(_cmsg * cmsg) · 15 unmodified lines | |||
| 1278 | case CAPI_DATA_B3_CONF: /* ncci */ | 1278 | case CAPI_DATA_B3_CONF: /* ncci */ |
| 1279 | if (cmsg->Info) { | 1279 | if (cmsg->Info) { |
| 1280 | printk(KERN_WARNING "CAPI_DATA_B3_CONF: Info %x - %s\n", | 1280 | printk(KERN_WARNING "CAPI_DATA_B3_CONF: Info %x - %s\n", |
| 1281 | cmsg->Info, capi_info2str(cmsg->Info)); | 1281 | cmsg->Info, capi_info2str(cmsg->Info)); |
| 1282 | } | 1282 | } |
| 1283 | if (!(nccip = find_ncci(card, cmsg->adr.adrNCCI))) | 1283 | if (!(nccip = find_ncci(card, cmsg->adr.adrNCCI))) |
| 1284 | goto notfound; | 1284 | goto notfound; |
| @@ -1286,11 +1286,11 @@ static void handle_ncci(_cmsg * cmsg) · 1 unmodified line | |||
| 1286 | len = capidrv_del_ack(nccip, cmsg->DataHandle); | 1286 | len = capidrv_del_ack(nccip, cmsg->DataHandle); |
| 1287 | if (len < 0) | 1287 | if (len < 0) |
| 1288 | break; | 1288 | break; |
| 1289 | cmd.command = ISDN_STAT_BSENT; | 1289 | cmd.command = ISDN_STAT_BSENT; |
| 1290 | cmd.driver = card->myid; | 1290 | cmd.driver = card->myid; |
| 1291 | cmd.arg = nccip->chan; | 1291 | cmd.arg = nccip->chan; |
| 1292 | cmd.parm.length = len; | 1292 | cmd.parm.length = len; |
| 1293 | card->interface.statcallb(&cmd); | 1293 | card->interface.statcallb(&cmd); |
| 1294 | break; | 1294 | break; |
| 1295 | 1295 | ||
| 1296 | case CAPI_DISCONNECT_B3_IND: /* ncci */ | 1296 | case CAPI_DISCONNECT_B3_IND: /* ncci */ |
| @@ -1309,9 +1309,9 @@ static void handle_ncci(_cmsg * cmsg) · 12 unmodified lines | |||
| 1309 | goto notfound; | 1309 | goto notfound; |
| 1310 | if (cmsg->Info) { | 1310 | if (cmsg->Info) { |
| 1311 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n", | 1311 | printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n", |
| 1312 | card->contrnr, | 1312 | card->contrnr, |
| 1313 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1313 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1314 | cmsg->Info, capi_info2str(cmsg->Info), | 1314 | cmsg->Info, capi_info2str(cmsg->Info), |
| 1315 | cmsg->adr.adrNCCI); | 1315 | cmsg->adr.adrNCCI); |
| 1316 | ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_CONF_ERROR); | 1316 | ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_CONF_ERROR); |
| 1317 | } | 1317 | } |
| @@ -1340,13 +1340,13 @@ static void handle_ncci(_cmsg * cmsg) · 22 unmodified lines | |||
| 1340 | cmsg->adr.adrNCCI); | 1340 | cmsg->adr.adrNCCI); |
| 1341 | } | 1341 | } |
| 1342 | return; | 1342 | return; |
| 1343 | ignored: | 1343 | ignored: |
| 1344 | printk(KERN_INFO "capidrv-%d: %s for ncci 0x%x ignored\n", | 1344 | printk(KERN_INFO "capidrv-%d: %s for ncci 0x%x ignored\n", |
| 1345 | card->contrnr, | 1345 | card->contrnr, |
| 1346 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1346 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| 1347 | cmsg->adr.adrNCCI); | 1347 | cmsg->adr.adrNCCI); |
| 1348 | return; | 1348 | return; |
| 1349 | notfound: | 1349 | notfound: |
| 1350 | printk(KERN_ERR "capidrv-%d: %s: ncci 0x%x not found\n", | 1350 | printk(KERN_ERR "capidrv-%d: %s: ncci 0x%x not found\n", |
| 1351 | card->contrnr, | 1351 | card->contrnr, |
| 1352 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), | 1352 | capi_cmd2str(cmsg->Command, cmsg->Subcommand), |
| @@ -1354,7 +1354,7 @@ static void handle_ncci(_cmsg * cmsg) · 1 unmodified line | |||
| 1354 | } | 1354 | } |
| 1355 | 1355 | ||
| 1356 | 1356 | ||
| 1357 | static void handle_data(_cmsg * cmsg, struct sk_buff *skb) | 1357 | static void handle_data(_cmsg *cmsg, struct sk_buff *skb) |
| 1358 | { | 1358 | { |
| 1359 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); | 1359 | capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); |
| 1360 | capidrv_ncci *nccip; | 1360 | capidrv_ncci *nccip; |
| @@ -1390,12 +1390,12 @@ static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb) · 29 unmodified lines | |||
| 1390 | 1390 | ||
| 1391 | if (cdb) { | 1391 | if (cdb) { |
| 1392 | printk(KERN_DEBUG "%s: applid=%d %s\n", __func__, | 1392 | printk(KERN_DEBUG "%s: applid=%d %s\n", __func__, |
| 1393 | ap->applid, cdb->buf); | 1393 | ap->applid, cdb->buf); |
| 1394 | cdebbuf_free(cdb); | 1394 | cdebbuf_free(cdb); |
| 1395 | } else | 1395 | } else |
| 1396 | printk(KERN_DEBUG "%s: applid=%d %s not traced\n", | 1396 | printk(KERN_DEBUG "%s: applid=%d %s not traced\n", |
| 1397 | __func__, ap->applid, | 1397 | __func__, ap->applid, |
| 1398 | capi_cmd2str(s_cmsg.Command, s_cmsg.Subcommand)); | 1398 | capi_cmd2str(s_cmsg.Command, s_cmsg.Subcommand)); |
| 1399 | } | 1399 | } |
| 1400 | if (s_cmsg.Command == CAPI_DATA_B3 | 1400 | if (s_cmsg.Command == CAPI_DATA_B3 |
| 1401 | && s_cmsg.Subcommand == CAPI_IND) { | 1401 | && s_cmsg.Subcommand == CAPI_IND) { |
| @@ -1418,38 +1418,38 @@ static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb) · 16 unmodified lines | |||
| 1418 | 1418 | ||
| 1419 | /* ------------------------------------------------------------------- */ | 1419 | /* ------------------------------------------------------------------- */ |
| 1420 | 1420 | ||
| 1421 | #define PUTBYTE_TO_STATUS(card, byte) \ | 1421 | #define PUTBYTE_TO_STATUS(card, byte) \ |
| 1422 | do { \ | 1422 | do { \ |
| 1423 | *(card)->q931_write++ = (byte); \ | 1423 | *(card)->q931_write++ = (byte); \ |
| 1424 | if ((card)->q931_write > (card)->q931_end) \ | 1424 | if ((card)->q931_write > (card)->q931_end) \ |
| 1425 | (card)->q931_write = (card)->q931_buf; \ | 1425 | (card)->q931_write = (card)->q931_buf; \ |
| 1426 | } while (0) | 1426 | } while (0) |
| 1427 | 1427 | ||
| 1428 | static void handle_dtrace_data(capidrv_contr *card, | 1428 | static void handle_dtrace_data(capidrv_contr *card, |
| 1429 | int send, int level2, u8 *data, u16 len) | 1429 | int send, int level2, u8 *data, u16 len) |
| 1430 | { | 1430 | { |
| 1431 | u8 *p, *end; | 1431 | u8 *p, *end; |
| 1432 | isdn_ctrl cmd; | 1432 | isdn_ctrl cmd; |
| 1433 | 1433 | ||
| 1434 | if (!len) { | 1434 | if (!len) { |
| 1435 | printk(KERN_DEBUG "capidrv-%d: avmb1_q931_data: len == %d\n", | 1435 | printk(KERN_DEBUG "capidrv-%d: avmb1_q931_data: len == %d\n", |
| 1436 | card->contrnr, len); | 1436 | card->contrnr, len); |
| 1437 | return; | 1437 | return; |
| 1438 | } | 1438 | } |
| 1439 | 1439 | ||
| 1440 | if (level2) { | 1440 | if (level2) { |
| 1441 | PUTBYTE_TO_STATUS(card, 'D'); | 1441 | PUTBYTE_TO_STATUS(card, 'D'); |
| 1442 | PUTBYTE_TO_STATUS(card, '2'); | 1442 | PUTBYTE_TO_STATUS(card, '2'); |
| 1443 | PUTBYTE_TO_STATUS(card, send ? '>' : '<'); | 1443 | PUTBYTE_TO_STATUS(card, send ? '>' : '<'); |
| 1444 | PUTBYTE_TO_STATUS(card, ':'); | 1444 | PUTBYTE_TO_STATUS(card, ':'); |
| 1445 | } else { | 1445 | } else { |
| 1446 | PUTBYTE_TO_STATUS(card, 'D'); | 1446 | PUTBYTE_TO_STATUS(card, 'D'); |
| 1447 | PUTBYTE_TO_STATUS(card, '3'); | 1447 | PUTBYTE_TO_STATUS(card, '3'); |
| 1448 | PUTBYTE_TO_STATUS(card, send ? '>' : '<'); | 1448 | PUTBYTE_TO_STATUS(card, send ? '>' : '<'); |
| 1449 | PUTBYTE_TO_STATUS(card, ':'); | 1449 | PUTBYTE_TO_STATUS(card, ':'); |
| 1450 | } | 1450 | } |
| 1451 | 1451 | ||
| 1452 | for (p = data, end = data+len; p < end; p++) { | 1452 | for (p = data, end = data + len; p < end; p++) { |
| 1453 | PUTBYTE_TO_STATUS(card, ' '); | 1453 | PUTBYTE_TO_STATUS(card, ' '); |
| 1454 | PUTBYTE_TO_STATUS(card, hex_asc_hi(*p)); | 1454 | PUTBYTE_TO_STATUS(card, hex_asc_hi(*p)); |
| 1455 | PUTBYTE_TO_STATUS(card, hex_asc_lo(*p)); | 1455 | PUTBYTE_TO_STATUS(card, hex_asc_lo(*p)); |
| @@ -1458,7 +1458,7 @@ static void handle_dtrace_data(capidrv_contr *card, · 2 unmodified lines | |||
| 1458 | 1458 | ||
| 1459 | cmd.command = ISDN_STAT_STAVAIL; | 1459 | cmd.command = ISDN_STAT_STAVAIL; |
| 1460 | cmd.driver = card->myid; | 1460 | cmd.driver = card->myid; |
| 1461 | cmd.arg = len*3+5; | 1461 | cmd.arg = len * 3 + 5; |
| 1462 | card->interface.statcallb(&cmd); | 1462 | card->interface.statcallb(&cmd); |
| 1463 | } | 1463 | } |
| 1464 | 1464 | ||
| @@ -1466,17 +1466,17 @@ static void handle_dtrace_data(capidrv_contr *card, · 1 unmodified line | |||
| 1466 | 1466 | ||
| 1467 | static _cmsg cmdcmsg; | 1467 | static _cmsg cmdcmsg; |
| 1468 | 1468 | ||
| 1469 | static int capidrv_ioctl(isdn_ctrl * c, capidrv_contr * card) | 1469 | static int capidrv_ioctl(isdn_ctrl *c, capidrv_contr *card) |
| 1470 | { | 1470 | { |
| 1471 | switch (c->arg) { | 1471 | switch (c->arg) { |
| 1472 | case 1: | 1472 | case 1: |
| 1473 | debugmode = (int)(*((unsigned int *)c->parm.num)); | 1473 | debugmode = (int)(*((unsigned int *)c->parm.num)); |
| 1474 | printk(KERN_DEBUG "capidrv-%d: debugmode=%d\n", | 1474 | printk(KERN_DEBUG "capidrv-%d: debugmode=%d\n", |
| 1475 | card->contrnr, debugmode); | 1475 | card->contrnr, debugmode); |
| 1476 | return 0; | 1476 | return 0; |
| 1477 | default: | 1477 | default: |
| 1478 | printk(KERN_DEBUG "capidrv-%d: capidrv_ioctl(%ld) called ??\n", | 1478 | printk(KERN_DEBUG "capidrv-%d: capidrv_ioctl(%ld) called ??\n", |
| 1479 | card->contrnr, c->arg); | 1479 | card->contrnr, c->arg); |
| 1480 | return -EINVAL; | 1480 | return -EINVAL; |
| 1481 | } | 1481 | } |
| 1482 | return -EINVAL; | 1482 | return -EINVAL; |
| @@ -1487,9 +1487,9 @@ static int capidrv_ioctl(isdn_ctrl * c, capidrv_contr * card) · 4 unmodified lines | |||
| 1487 | */ | 1487 | */ |
| 1488 | 1488 | ||
| 1489 | struct internal_bchannelinfo { | 1489 | struct internal_bchannelinfo { |
| 1490 | unsigned short channelalloc; | 1490 | unsigned short channelalloc; |
| 1491 | unsigned short operation; | 1491 | unsigned short operation; |
| 1492 | unsigned char cmask[31]; | 1492 | unsigned char cmask[31]; |
| 1493 | }; | 1493 | }; |
| 1494 | 1494 | ||
| 1495 | static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) | 1495 | static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) |
| @@ -1540,10 +1540,10 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) · 44 unmodified lines | |||
| 1540 | if (digit2 <= 0 || digit2 > 30) return -4; | 1540 | if (digit2 <= 0 || digit2 > 30) return -4; |
| 1541 | if (*s == 0 || *s == ',' || *s == ' ') { | 1541 | if (*s == 0 || *s == ',' || *s == ' ') { |
| 1542 | if (digit1 > digit2) | 1542 | if (digit1 > digit2) |
| 1543 | for (i = digit2; i <= digit1 ; i++) | 1543 | for (i = digit2; i <= digit1; i++) |
| 1544 | bmask |= (1 << i); | 1544 | bmask |= (1 << i); |
| 1545 | else | 1545 | else |
| 1546 | for (i = digit1; i <= digit2 ; i++) | 1546 | for (i = digit1; i <= digit2; i++) |
| 1547 | bmask |= (1 << i); | 1547 | bmask |= (1 << i); |
| 1548 | digit1 = digit2 = 0; | 1548 | digit1 = digit2 = 0; |
| 1549 | if (*s) s++; | 1549 | if (*s) s++; |
| @@ -1556,131 +1556,131 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) · 6 unmodified lines | |||
| 1556 | return 0; | 1556 | return 0; |
| 1557 | } | 1557 | } |
| 1558 | 1558 | ||
| 1559 | static int FVteln2capi20(char *teln, u8 AdditionalInfo[1+2+2+31]) | 1559 | static int FVteln2capi20(char *teln, u8 AdditionalInfo[1 + 2 + 2 + 31]) |
| 1560 | { | 1560 | { |
| 1561 | unsigned long bmask; | 1561 | unsigned long bmask; |
| 1562 | int active; | 1562 | int active; |
| 1563 | int rc, i; | 1563 | int rc, i; |
| 1564 | 1564 | ||
| 1565 | rc = decodeFVteln(teln, &bmask, &active); | 1565 | rc = decodeFVteln(teln, &bmask, &active); |
| 1566 | if (rc) return rc; | 1566 | if (rc) return rc; |
| 1567 | /* Length */ | 1567 | /* Length */ |
| 1568 | AdditionalInfo[0] = 2+2+31; | 1568 | AdditionalInfo[0] = 2 + 2 + 31; |
| 1569 | /* Channel: 3 => use channel allocation */ | 1569 | /* Channel: 3 => use channel allocation */ |
| 1570 | AdditionalInfo[1] = 3; AdditionalInfo[2] = 0; | 1570 | AdditionalInfo[1] = 3; AdditionalInfo[2] = 0; |
| 1571 | /* Operation: 0 => DTE mode, 1 => DCE mode */ | 1571 | /* Operation: 0 => DTE mode, 1 => DCE mode */ |
| 1572 | if (active) { | 1572 | if (active) { |
| 1573 | AdditionalInfo[3] = 0; AdditionalInfo[4] = 0; | 1573 | AdditionalInfo[3] = 0; AdditionalInfo[4] = 0; |
| 1574 | } else { | 1574 | } else { |
| 1575 | AdditionalInfo[3] = 1; AdditionalInfo[4] = 0; | 1575 | AdditionalInfo[3] = 1; AdditionalInfo[4] = 0; |
| 1576 | } | 1576 | } |
| 1577 | /* Channel mask array */ | 1577 | /* Channel mask array */ |
| 1578 | AdditionalInfo[5] = 0; /* no D-Channel */ | 1578 | AdditionalInfo[5] = 0; /* no D-Channel */ |
| 1579 | for (i=1; i <= 30; i++) | 1579 | for (i = 1; i <= 30; i++) |
| 1580 | AdditionalInfo[5+i] = (bmask & (1 << i)) ? 0xff : 0; | 1580 | AdditionalInfo[5 + i] = (bmask & (1 << i)) ? 0xff : 0; |
| 1581 | return 0; | 1581 | return 0; |
| 1582 | } | 1582 | } |
| 1583 | 1583 | ||
| 1584 | static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) | 1584 | static int capidrv_command(isdn_ctrl *c, capidrv_contr *card) |
| 1585 | { | 1585 | { |
| 1586 | isdn_ctrl cmd; | 1586 | isdn_ctrl cmd; |
| 1587 | struct capidrv_bchan *bchan; | 1587 | struct capidrv_bchan *bchan; |
| 1588 | struct capidrv_plci *plcip; | 1588 | struct capidrv_plci *plcip; |
| 1589 | u8 AdditionalInfo[1+2+2+31]; | 1589 | u8 AdditionalInfo[1 + 2 + 2 + 31]; |
| 1590 | int rc, isleasedline = 0; | 1590 | int rc, isleasedline = 0; |
| 1591 | 1591 | ||
| 1592 | if (c->command == ISDN_CMD_IOCTL) | 1592 | if (c->command == ISDN_CMD_IOCTL) |
| 1593 | return capidrv_ioctl(c, card); | 1593 | return capidrv_ioctl(c, card); |
| 1594 | 1594 | ||
| 1595 | switch (c->command) { | 1595 | switch (c->command) { |
| 1596 | case ISDN_CMD_DIAL:{ | 1596 | case ISDN_CMD_DIAL:{ |
| 1597 | u8 calling[ISDN_MSNLEN + 3]; | 1597 | u8 calling[ISDN_MSNLEN + 3]; |
| 1598 | u8 called[ISDN_MSNLEN + 2]; | 1598 | u8 called[ISDN_MSNLEN + 2]; |
| 1599 | 1599 | ||
| 1600 | if (debugmode) | 1600 | if (debugmode) |
| 1601 | printk(KERN_DEBUG "capidrv-%d: ISDN_CMD_DIAL(ch=%ld,\"%s,%d,%d,%s\")\n", | 1601 | printk(KERN_DEBUG "capidrv-%d: ISDN_CMD_DIAL(ch=%ld,\"%s,%d,%d,%s\")\n", |
| 1602 | card->contrnr, | 1602 | card->contrnr, |
| 1603 | c->arg, | 1603 | c->arg, |
| 1604 | c->parm.setup.phone, | 1604 | c->parm.setup.phone, |
| 1605 | c->parm.setup.si1, | 1605 | c->parm.setup.si1, |
| 1606 | c->parm.setup.si2, | 1606 | c->parm.setup.si2, |
| 1607 | c->parm.setup.eazmsn); | 1607 | c->parm.setup.eazmsn); |
| 1608 | |||
| 1609 | bchan = &card->bchans[c->arg % card->nbchan]; | ||
| 1610 | |||
| 1611 | if (bchan->plcip) { | ||
| 1612 | printk(KERN_ERR "capidrv-%d: dail ch=%ld,\"%s,%d,%d,%s\" in use (plci=0x%x)\n", | ||
| 1613 | card->contrnr, | ||
| 1614 | c->arg, | ||
| 1615 | c->parm.setup.phone, | ||
| 1616 | c->parm.setup.si1, | ||
| 1617 | c->parm.setup.si2, | ||
| 1618 | c->parm.setup.eazmsn, | ||
| 1619 | bchan->plcip->plci); | ||
| 1620 | return 0; | ||
| 1621 | } | ||
| 1622 | bchan->si1 = c->parm.setup.si1; | ||
| 1623 | bchan->si2 = c->parm.setup.si2; | ||
| 1624 | |||
| 1625 | strncpy(bchan->num, c->parm.setup.phone, sizeof(bchan->num)); | ||
| 1626 | strncpy(bchan->mynum, c->parm.setup.eazmsn, sizeof(bchan->mynum)); | ||
| 1627 | rc = FVteln2capi20(bchan->num, AdditionalInfo); | ||
| 1628 | isleasedline = (rc == 0); | ||
| 1629 | if (rc < 0) | ||
| 1630 | printk(KERN_ERR "capidrv-%d: WARNING: invalid leased linedefinition \"%s\"\n", card->contrnr, bchan->num); | ||
| 1631 | |||
| 1632 | if (isleasedline) { | ||
| 1633 | calling[0] = 0; | ||
| 1634 | called[0] = 0; | ||
| 1635 | if (debugmode) | ||
| 1636 | printk(KERN_DEBUG "capidrv-%d: connecting leased line\n", card->contrnr); | ||
| 1637 | } else { | ||
| 1638 | calling[0] = strlen(bchan->mynum) + 2; | ||
| 1639 | calling[1] = 0; | ||
| 1640 | calling[2] = 0x80; | ||
| 1641 | strncpy(calling + 3, bchan->mynum, ISDN_MSNLEN); | ||
| 1642 | called[0] = strlen(bchan->num) + 1; | ||
| 1643 | called[1] = 0x80; | ||
| 1644 | strncpy(called + 2, bchan->num, ISDN_MSNLEN); | ||
| 1645 | } | ||
| 1646 | 1608 | ||
| 1647 | capi_fill_CONNECT_REQ(&cmdcmsg, | 1609 | bchan = &card->bchans[c->arg % card->nbchan]; |
| 1648 | global.ap.applid, | 1610 | |
| 1649 | card->msgid++, | 1611 | if (bchan->plcip) { |
| 1650 | card->contrnr, /* adr */ | 1612 | printk(KERN_ERR "capidrv-%d: dail ch=%ld,\"%s,%d,%d,%s\" in use (plci=0x%x)\n", |
| 1651 | si2cip(bchan->si1, bchan->si2), /* cipvalue */ | 1613 | card->contrnr, |
| 1652 | called, /* CalledPartyNumber */ | 1614 | c->arg, |
| 1653 | calling, /* CallingPartyNumber */ | 1615 | c->parm.setup.phone, |
| 1654 | NULL, /* CalledPartySubaddress */ | 1616 | c->parm.setup.si1, |
| 1655 | NULL, /* CallingPartySubaddress */ | 1617 | c->parm.setup.si2, |
| 1656 | b1prot(bchan->l2, bchan->l3), /* B1protocol */ | 1618 | c->parm.setup.eazmsn, |
| 1657 | b2prot(bchan->l2, bchan->l3), /* B2protocol */ | 1619 | bchan->plcip->plci); |
| 1658 | b3prot(bchan->l2, bchan->l3), /* B3protocol */ | ||
| 1659 | b1config(bchan->l2, bchan->l3), /* B1configuration */ | ||
| 1660 | NULL, /* B2configuration */ | ||
| 1661 | NULL, /* B3configuration */ | ||
| 1662 | NULL, /* BC */ | ||
| 1663 | NULL, /* LLC */ | ||
| 1664 | NULL, /* HLC */ | ||
| 1665 | /* BChannelinformation */ | ||
| 1666 | isleasedline ? AdditionalInfo : NULL, | ||
| 1667 | NULL, /* Keypadfacility */ | ||
| 1668 | NULL, /* Useruserdata */ | ||
| 1669 | NULL /* Facilitydataarray */ | ||
| 1670 | ); | ||
| 1671 | if ((plcip = new_plci(card, (c->arg % card->nbchan))) == NULL) { | ||
| 1672 | cmd.command = ISDN_STAT_DHUP; | ||
| 1673 | cmd.driver = card->myid; | ||
| 1674 | cmd.arg = (c->arg % card->nbchan); | ||
| 1675 | card->interface.statcallb(&cmd); | ||
| 1676 | return -1; | ||
| 1677 | } | ||
| 1678 | plcip->msgid = cmdcmsg.Messagenumber; | ||
| 1679 | plcip->leasedline = isleasedline; | ||
| 1680 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REQ); | ||
| 1681 | send_message(card, &cmdcmsg); | ||
| 1682 | return 0; | 1620 | return 0; |
| 1683 | } | 1621 | } |
| 1622 | bchan->si1 = c->parm.setup.si1; | ||
| 1623 | bchan->si2 = c->parm.setup.si2; | ||
| 1624 | |||
| 1625 | strncpy(bchan->num, c->parm.setup.phone, sizeof(bchan->num)); | ||
| 1626 | strncpy(bchan->mynum, c->parm.setup.eazmsn, sizeof(bchan->mynum)); | ||
| 1627 | rc = FVteln2capi20(bchan->num, AdditionalInfo); | ||
| 1628 | isleasedline = (rc == 0); | ||
| 1629 | if (rc < 0) | ||
| 1630 | printk(KERN_ERR "capidrv-%d: WARNING: invalid leased linedefinition \"%s\"\n", card->contrnr, bchan->num); | ||
| 1631 | |||
| 1632 | if (isleasedline) { | ||
| 1633 | calling[0] = 0; | ||
| 1634 | called[0] = 0; | ||
| 1635 | if (debugmode) | ||
| 1636 | printk(KERN_DEBUG "capidrv-%d: connecting leased line\n", card->contrnr); | ||
| 1637 | } else { | ||
| 1638 | calling[0] = strlen(bchan->mynum) + 2; | ||
| 1639 | calling[1] = 0; | ||
| 1640 | calling[2] = 0x80; | ||
| 1641 | strncpy(calling + 3, bchan->mynum, ISDN_MSNLEN); | ||
| 1642 | called[0] = strlen(bchan->num) + 1; | ||
| 1643 | called[1] = 0x80; | ||
| 1644 | strncpy(called + 2, bchan->num, ISDN_MSNLEN); | ||
| 1645 | } | ||
| 1646 | |||
| 1647 | capi_fill_CONNECT_REQ(&cmdcmsg, | ||
| 1648 | global.ap.applid, | ||
| 1649 | card->msgid++, | ||
| 1650 | card->contrnr, /* adr */ | ||
| 1651 | si2cip(bchan->si1, bchan->si2), /* cipvalue */ | ||
| 1652 | called, /* CalledPartyNumber */ | ||
| 1653 | calling, /* CallingPartyNumber */ | ||
| 1654 | NULL, /* CalledPartySubaddress */ | ||
| 1655 | NULL, /* CallingPartySubaddress */ | ||
| 1656 | b1prot(bchan->l2, bchan->l3), /* B1protocol */ | ||
| 1657 | b2prot(bchan->l2, bchan->l3), /* B2protocol */ | ||
| 1658 | b3prot(bchan->l2, bchan->l3), /* B3protocol */ | ||
| 1659 | b1config(bchan->l2, bchan->l3), /* B1configuration */ | ||
| 1660 | NULL, /* B2configuration */ | ||
| 1661 | NULL, /* B3configuration */ | ||
| 1662 | NULL, /* BC */ | ||
| 1663 | NULL, /* LLC */ | ||
| 1664 | NULL, /* HLC */ | ||
| 1665 | /* BChannelinformation */ | ||
| 1666 | isleasedline ? AdditionalInfo : NULL, | ||
| 1667 | NULL, /* Keypadfacility */ | ||
| 1668 | NULL, /* Useruserdata */ | ||
| 1669 | NULL /* Facilitydataarray */ | ||
| 1670 | ); | ||
| 1671 | if ((plcip = new_plci(card, (c->arg % card->nbchan))) == NULL) { | ||
| 1672 | cmd.command = ISDN_STAT_DHUP; | ||
| 1673 | cmd.driver = card->myid; | ||
| 1674 | cmd.arg = (c->arg % card->nbchan); | ||
| 1675 | card->interface.statcallb(&cmd); | ||
| 1676 | return -1; | ||
| 1677 | } | ||
| 1678 | plcip->msgid = cmdcmsg.Messagenumber; | ||
| 1679 | plcip->leasedline = isleasedline; | ||
| 1680 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REQ); | ||
| 1681 | send_message(card, &cmdcmsg); | ||
| 1682 | return 0; | ||
| 1683 | } | ||
| 1684 | 1684 | ||
| 1685 | case ISDN_CMD_ACCEPTD: | 1685 | case ISDN_CMD_ACCEPTD: |
| 1686 | 1686 | ||
| @@ -1708,7 +1708,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) · 21 unmodified lines | |||
| 1708 | NULL, /* Keypadfacility */ | 1708 | NULL, /* Keypadfacility */ |
| 1709 | NULL, /* Useruserdata */ | 1709 | NULL, /* Useruserdata */ |
| 1710 | NULL /* Facilitydataarray */ | 1710 | NULL /* Facilitydataarray */ |
| 1711 | ); | 1711 | ); |
| 1712 | capi_cmsg2message(&cmdcmsg, cmdcmsg.buf); | 1712 | capi_cmsg2message(&cmdcmsg, cmdcmsg.buf); |
| 1713 | plci_change_state(card, bchan->plcip, EV_PLCI_CONNECT_RESP); | 1713 | plci_change_state(card, bchan->plcip, EV_PLCI_CONNECT_RESP); |
| 1714 | send_message(card, &cmdcmsg); | 1714 | send_message(card, &cmdcmsg); |
| @@ -1742,7 +1742,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) · 27 unmodified lines | |||
| 1742 | card->msgid++, | 1742 | card->msgid++, |
| 1743 | bchan->nccip->ncci, | 1743 | bchan->nccip->ncci, |
| 1744 | NULL /* NCPI */ | 1744 | NULL /* NCPI */ |
| 1745 | ); | 1745 | ); |
| 1746 | ncci_change_state(card, bchan->nccip, EV_NCCI_DISCONNECT_B3_REQ); | 1746 | ncci_change_state(card, bchan->nccip, EV_NCCI_DISCONNECT_B3_REQ); |
| 1747 | send_message(card, &cmdcmsg); | 1747 | send_message(card, &cmdcmsg); |
| 1748 | return 0; | 1748 | return 0; |
| @@ -1761,12 +1761,12 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) · 12 unmodified lines | |||
| 1761 | capi_fill_DISCONNECT_REQ(&cmdcmsg, | 1761 | capi_fill_DISCONNECT_REQ(&cmdcmsg, |
| 1762 | global.ap.applid, | 1762 | global.ap.applid, |
| 1763 | card->msgid++, | 1763 | card->msgid++, |
| 1764 | bchan->plcip->plci, | 1764 | bchan->plcip->plci, |
| 1765 | NULL, /* BChannelinformation */ | 1765 | NULL, /* BChannelinformation */ |
| 1766 | NULL, /* Keypadfacility */ | 1766 | NULL, /* Keypadfacility */ |
| 1767 | NULL, /* Useruserdata */ | 1767 | NULL, /* Useruserdata */ |
| 1768 | NULL /* Facilitydataarray */ | 1768 | NULL /* Facilitydataarray */ |
| 1769 | ); | 1769 | ); |
| 1770 | plci_change_state(card, bchan->plcip, EV_PLCI_DISCONNECT_REQ); | 1770 | plci_change_state(card, bchan->plcip, EV_PLCI_DISCONNECT_REQ); |
| 1771 | send_message(card, &cmdcmsg); | 1771 | send_message(card, &cmdcmsg); |
| 1772 | return 0; | 1772 | return 0; |
| @@ -1778,8 +1778,8 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) · 5 unmodified lines | |||
| 1778 | } | 1778 | } |
| 1779 | } | 1779 | } |
| 1780 | printk(KERN_ERR "capidrv-%d: chan %ld disconnect request on free channel\n", | 1780 | printk(KERN_ERR "capidrv-%d: chan %ld disconnect request on free channel\n", |
| 1781 | card->contrnr, | 1781 | card->contrnr, |
| 1782 | c->arg); | 1782 | c->arg); |
| 1783 | return -EINVAL; | 1783 | return -EINVAL; |
| 1784 | /* ready */ | 1784 | /* ready */ |
| 1785 | 1785 | ||
| @@ -1813,20 +1813,20 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) · 27 unmodified lines | |||
| 1813 | case ISDN_CMD_CLREAZ: | 1813 | case ISDN_CMD_CLREAZ: |
| 1814 | if (debugmode) | 1814 | if (debugmode) |
| 1815 | printk(KERN_DEBUG "capidrv-%d: clearing EAZ on chan %ld\n", | 1815 | printk(KERN_DEBUG "capidrv-%d: clearing EAZ on chan %ld\n", |
| 1816 | card->contrnr, c->arg); | 1816 | card->contrnr, c->arg); |
| 1817 | bchan = &card->bchans[c->arg % card->nbchan]; | 1817 | bchan = &card->bchans[c->arg % card->nbchan]; |
| 1818 | bchan->msn[0] = 0; | 1818 | bchan->msn[0] = 0; |
| 1819 | return 0; | 1819 | return 0; |
| 1820 | 1820 | ||
| 1821 | default: | 1821 | default: |
| 1822 | printk(KERN_ERR "capidrv-%d: ISDN_CMD_%d, Huh?\n", | 1822 | printk(KERN_ERR "capidrv-%d: ISDN_CMD_%d, Huh?\n", |
| 1823 | card->contrnr, c->command); | 1823 | card->contrnr, c->command); |
| 1824 | return -EINVAL; | 1824 | return -EINVAL; |
| 1825 | } | 1825 | } |
| 1826 | return 0; | 1826 | return 0; |
| 1827 | } | 1827 | } |
| 1828 | 1828 | ||
| 1829 | static int if_command(isdn_ctrl * c) | 1829 | static int if_command(isdn_ctrl *c) |
| 1830 | { | 1830 | { |
| 1831 | capidrv_contr *card = findcontrbydriverid(c->driver); | 1831 | capidrv_contr *card = findcontrbydriverid(c->driver); |
| 1832 | 1832 | ||
| @@ -1834,8 +1834,8 @@ static int if_command(isdn_ctrl * c) · 1 unmodified line | |||
| 1834 | return capidrv_command(c, card); | 1834 | return capidrv_command(c, card); |
| 1835 | 1835 | ||
| 1836 | printk(KERN_ERR | 1836 | printk(KERN_ERR |
| 1837 | "capidrv: if_command %d called with invalid driverId %d!\n", | 1837 | "capidrv: if_command %d called with invalid driverId %d!\n", |
| 1838 | c->command, c->driver); | 1838 | c->command, c->driver); |
| 1839 | return -ENODEV; | 1839 | return -ENODEV; |
| 1840 | } | 1840 | } |
| 1841 | 1841 | ||
| @@ -1859,7 +1859,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) · 17 unmodified lines | |||
| 1859 | } | 1859 | } |
| 1860 | if (debugmode > 4) | 1860 | if (debugmode > 4) |
| 1861 | printk(KERN_DEBUG "capidrv-%d: sendbuf len=%d skb=%p doack=%d\n", | 1861 | printk(KERN_DEBUG "capidrv-%d: sendbuf len=%d skb=%p doack=%d\n", |
| 1862 | card->contrnr, len, skb, doack); | 1862 | card->contrnr, len, skb, doack); |
| 1863 | bchan = &card->bchans[channel % card->nbchan]; | 1863 | bchan = &card->bchans[channel % card->nbchan]; |
| 1864 | nccip = bchan->nccip; | 1864 | nccip = bchan->nccip; |
| 1865 | if (!nccip || nccip->state != ST_NCCI_ACTIVE) { | 1865 | if (!nccip || nccip->state != ST_NCCI_ACTIVE) { |
| @@ -1891,10 +1891,10 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) · 25 unmodified lines | |||
| 1891 | skb->len, /* DataLength */ | 1891 | skb->len, /* DataLength */ |
| 1892 | datahandle, /* DataHandle */ | 1892 | datahandle, /* DataHandle */ |
| 1893 | 0 /* Flags */ | 1893 | 0 /* Flags */ |
| 1894 | ); | 1894 | ); |
| 1895 | 1895 | ||
| 1896 | if (capidrv_add_ack(nccip, datahandle, doack ? (int)skb->len : -1) < 0) | 1896 | if (capidrv_add_ack(nccip, datahandle, doack ? (int)skb->len : -1) < 0) |
| 1897 | return 0; | 1897 | return 0; |
| 1898 | 1898 | ||
| 1899 | capi_cmsg2message(&sendcmsg, sendcmsg.buf); | 1899 | capi_cmsg2message(&sendcmsg, sendcmsg.buf); |
| 1900 | msglen = CAPIMSG_LEN(sendcmsg.buf); | 1900 | msglen = CAPIMSG_LEN(sendcmsg.buf); |
| @@ -1902,8 +1902,8 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) · 1 unmodified line | |||
| 1902 | struct sk_buff *nskb = skb_realloc_headroom(skb, msglen); | 1902 | struct sk_buff *nskb = skb_realloc_headroom(skb, msglen); |
| 1903 | if (!nskb) { | 1903 | if (!nskb) { |
| 1904 | printk(KERN_ERR "capidrv-%d: if_sendbuf: no memory\n", | 1904 | printk(KERN_ERR "capidrv-%d: if_sendbuf: no memory\n", |
| 1905 | card->contrnr); | 1905 | card->contrnr); |
| 1906 | (void)capidrv_del_ack(nccip, datahandle); | 1906 | (void)capidrv_del_ack(nccip, datahandle); |
| 1907 | return 0; | 1907 | return 0; |
| 1908 | } | 1908 | } |
| 1909 | printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n", | 1909 | printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n", |
| @@ -1917,9 +1917,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) · 7 unmodified lines | |||
| 1917 | } | 1917 | } |
| 1918 | if (debugmode > 3) | 1918 | if (debugmode > 3) |
| 1919 | printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n", | 1919 | printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n", |
| 1920 | card->contrnr, errcode, capi_info2str(errcode)); | 1920 | card->contrnr, errcode, capi_info2str(errcode)); |
| 1921 | (void)capidrv_del_ack(nccip, datahandle); | 1921 | (void)capidrv_del_ack(nccip, datahandle); |
| 1922 | dev_kfree_skb(nskb); | 1922 | dev_kfree_skb(nskb); |
| 1923 | return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; | 1923 | return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; |
| 1924 | } else { | 1924 | } else { |
| 1925 | memcpy(skb_push(skb, msglen), sendcmsg.buf, msglen); | 1925 | memcpy(skb_push(skb, msglen), sendcmsg.buf, msglen); |
| @@ -1930,9 +1930,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) · 4 unmodified lines | |||
| 1930 | } | 1930 | } |
| 1931 | if (debugmode > 3) | 1931 | if (debugmode > 3) |
| 1932 | printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n", | 1932 | printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n", |
| 1933 | card->contrnr, errcode, capi_info2str(errcode)); | 1933 | card->contrnr, errcode, capi_info2str(errcode)); |
| 1934 | skb_pull(skb, msglen); | 1934 | skb_pull(skb, msglen); |
| 1935 | (void)capidrv_del_ack(nccip, datahandle); | 1935 | (void)capidrv_del_ack(nccip, datahandle); |
| 1936 | return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; | 1936 | return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; |
| 1937 | } | 1937 | } |
| 1938 | } | 1938 | } |
| @@ -1949,11 +1949,11 @@ static int if_readstat(u8 __user *buf, int len, int id, int channel) · 10 unmodified lines | |||
| 1949 | return -ENODEV; | 1949 | return -ENODEV; |
| 1950 | } | 1950 | } |
| 1951 | 1951 | ||
| 1952 | for (p=buf, count=0; count < len; p++, count++) { | 1952 | for (p = buf, count = 0; count < len; p++, count++) { |
| 1953 | if (put_user(*card->q931_read++, p)) | 1953 | if (put_user(*card->q931_read++, p)) |
| 1954 | return -EFAULT; | 1954 | return -EFAULT; |
| 1955 | if (card->q931_read > card->q931_end) | 1955 | if (card->q931_read > card->q931_end) |
| 1956 | card->q931_read = card->q931_buf; | 1956 | card->q931_read = card->q931_buf; |
| 1957 | } | 1957 | } |
| 1958 | return count; | 1958 | return count; |
| 1959 | 1959 | ||
| @@ -1961,35 +1961,35 @@ static int if_readstat(u8 __user *buf, int len, int id, int channel) · 1 unmodified line | |||
| 1961 | 1961 | ||
| 1962 | static void enable_dchannel_trace(capidrv_contr *card) | 1962 | static void enable_dchannel_trace(capidrv_contr *card) |
| 1963 | { | 1963 | { |
| 1964 | u8 manufacturer[CAPI_MANUFACTURER_LEN]; | 1964 | u8 manufacturer[CAPI_MANUFACTURER_LEN]; |
| 1965 | capi_version version; | 1965 | capi_version version; |
| 1966 | u16 contr = card->contrnr; | 1966 | u16 contr = card->contrnr; |
| 1967 | u16 errcode; | 1967 | u16 errcode; |
| 1968 | u16 avmversion[3]; | 1968 | u16 avmversion[3]; |
| 1969 | 1969 | ||
| 1970 | errcode = capi20_get_manufacturer(contr, manufacturer); | 1970 | errcode = capi20_get_manufacturer(contr, manufacturer); |
| 1971 | if (errcode != CAPI_NOERROR) { | 1971 | if (errcode != CAPI_NOERROR) { |
| 1972 | printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n", | 1972 | printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n", |
| 1973 | card->name, errcode); | 1973 | card->name, errcode); |
| 1974 | return; | 1974 | return; |
| 1975 | } | 1975 | } |
| 1976 | if (strstr(manufacturer, "AVM") == NULL) { | 1976 | if (strstr(manufacturer, "AVM") == NULL) { |
| 1977 | printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n", | 1977 | printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n", |
| 1978 | card->name, manufacturer); | 1978 | card->name, manufacturer); |
| 1979 | return; | 1979 | return; |
| 1980 | } | 1980 | } |
| 1981 | errcode = capi20_get_version(contr, &version); | 1981 | errcode = capi20_get_version(contr, &version); |
| 1982 | if (errcode != CAPI_NOERROR) { | 1982 | if (errcode != CAPI_NOERROR) { |
| 1983 | printk(KERN_ERR "%s: can't get version (0x%x)\n", | 1983 | printk(KERN_ERR "%s: can't get version (0x%x)\n", |
| 1984 | card->name, errcode); | 1984 | card->name, errcode); |
| 1985 | return; | 1985 | return; |
| 1986 | } | 1986 | } |
| 1987 | avmversion[0] = (version.majormanuversion >> 4) & 0x0f; | 1987 | avmversion[0] = (version.majormanuversion >> 4) & 0x0f; |
| 1988 | avmversion[1] = (version.majormanuversion << 4) & 0xf0; | 1988 | avmversion[1] = (version.majormanuversion << 4) & 0xf0; |
| 1989 | avmversion[1] |= (version.minormanuversion >> 4) & 0x0f; | 1989 | avmversion[1] |= (version.minormanuversion >> 4) & 0x0f; |
| 1990 | avmversion[2] |= version.minormanuversion & 0x0f; | 1990 | avmversion[2] |= version.minormanuversion & 0x0f; |
| 1991 | 1991 | ||
| 1992 | if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) { | 1992 | if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) { |
| 1993 | printk(KERN_INFO "%s: D2 trace enabled\n", card->name); | 1993 | printk(KERN_INFO "%s: D2 trace enabled\n", card->name); |
| 1994 | capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid, | 1994 | capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid, |
| 1995 | card->msgid++, | 1995 | card->msgid++, |
| @@ -2030,8 +2030,8 @@ static void listentimerfunc(unsigned long x) · 34 unmodified lines | |||
| 2030 | capidrv_contr *card = (capidrv_contr *)x; | 2030 | capidrv_contr *card = (capidrv_contr *)x; |
| 2031 | if (card->state != ST_LISTEN_NONE && card->state != ST_LISTEN_ACTIVE) | 2031 | if (card->state != ST_LISTEN_NONE && card->state != ST_LISTEN_ACTIVE) |
| 2032 | printk(KERN_ERR "%s: controller dead ??\n", card->name); | 2032 | printk(KERN_ERR "%s: controller dead ??\n", card->name); |
| 2033 | send_listen(card); | 2033 | send_listen(card); |
| 2034 | mod_timer(&card->listentimer, jiffies + 60*HZ); | 2034 | mod_timer(&card->listentimer, jiffies + 60 * HZ); |
| 2035 | } | 2035 | } |
| 2036 | 2036 | ||
| 2037 | 2037 | ||
| @@ -2050,7 +2050,7 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) · 12 unmodified lines | |||
| 2050 | } | 2050 | } |
| 2051 | if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) { | 2051 | if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) { |
| 2052 | printk(KERN_WARNING | 2052 | printk(KERN_WARNING |
| 2053 | "capidrv: (%s) Could not allocate contr-struct.\n", id); | 2053 | "capidrv: (%s) Could not allocate contr-struct.\n", id); |
| 2054 | return -1; | 2054 | return -1; |
| 2055 | } | 2055 | } |
| 2056 | card->owner = THIS_MODULE; | 2056 | card->owner = THIS_MODULE; |
| @@ -2061,7 +2061,7 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) · 4 unmodified lines | |||
| 2061 | card->bchans = kmalloc(sizeof(capidrv_bchan) * card->nbchan, GFP_ATOMIC); | 2061 | card->bchans = kmalloc(sizeof(capidrv_bchan) * card->nbchan, GFP_ATOMIC); |
| 2062 | if (!card->bchans) { | 2062 | if (!card->bchans) { |
| 2063 | printk(KERN_WARNING | 2063 | printk(KERN_WARNING |
| 2064 | "capidrv: (%s) Could not allocate bchan-structs.\n", id); | 2064 | "capidrv: (%s) Could not allocate bchan-structs.\n", id); |
| 2065 | module_put(card->owner); | 2065 | module_put(card->owner); |
| 2066 | kfree(card); | 2066 | kfree(card); |
| 2067 | return -1; | 2067 | return -1; |
| @@ -2073,17 +2073,17 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) · 5 unmodified lines | |||
| 2073 | card->interface.writecmd = NULL; | 2073 | card->interface.writecmd = NULL; |
| 2074 | card->interface.readstat = if_readstat; | 2074 | card->interface.readstat = if_readstat; |
| 2075 | card->interface.features = ISDN_FEATURE_L2_HDLC | | 2075 | card->interface.features = ISDN_FEATURE_L2_HDLC | |
| 2076 | ISDN_FEATURE_L2_TRANS | | 2076 | ISDN_FEATURE_L2_TRANS | |
| 2077 | ISDN_FEATURE_L3_TRANS | | 2077 | ISDN_FEATURE_L3_TRANS | |
| 2078 | ISDN_FEATURE_P_UNKNOWN | | 2078 | ISDN_FEATURE_P_UNKNOWN | |
| 2079 | ISDN_FEATURE_L2_X75I | | 2079 | ISDN_FEATURE_L2_X75I | |
| 2080 | ISDN_FEATURE_L2_X75UI | | 2080 | ISDN_FEATURE_L2_X75UI | |
| 2081 | ISDN_FEATURE_L2_X75BUI; | 2081 | ISDN_FEATURE_L2_X75BUI; |
| 2082 | if (profp->support1 & (1<<2)) | 2082 | if (profp->support1 & (1 << 2)) |
| 2083 | card->interface.features |= ISDN_FEATURE_L2_V11096 | | 2083 | card->interface.features |= ISDN_FEATURE_L2_V11096 | |
| 2084 | ISDN_FEATURE_L2_V11019 | | 2084 | ISDN_FEATURE_L2_V11019 | |
| 2085 | ISDN_FEATURE_L2_V11038; | 2085 | ISDN_FEATURE_L2_V11038; |
| 2086 | if (profp->support1 & (1<<8)) | 2086 | if (profp->support1 & (1 << 8)) |
| 2087 | card->interface.features |= ISDN_FEATURE_L2_MODEM; | 2087 | card->interface.features |= ISDN_FEATURE_L2_MODEM; |
| 2088 | card->interface.hl_hdrlen = 22; /* len of DATA_B3_REQ */ | 2088 | card->interface.hl_hdrlen = 22; /* len of DATA_B3_REQ */ |
| 2089 | strncpy(card->interface.id, id, sizeof(card->interface.id) - 1); | 2089 | strncpy(card->interface.id, id, sizeof(card->interface.id) - 1); |
| @@ -2122,10 +2122,10 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) · 32 unmodified lines | |||
| 2122 | card->listentimer.data = (unsigned long)card; | 2122 | card->listentimer.data = (unsigned long)card; |
| 2123 | card->listentimer.function = listentimerfunc; | 2123 | card->listentimer.function = listentimerfunc; |
| 2124 | send_listen(card); | 2124 | send_listen(card); |
| 2125 | mod_timer(&card->listentimer, jiffies + 60*HZ); | 2125 | mod_timer(&card->listentimer, jiffies + 60 * HZ); |
| 2126 | 2126 | ||
| 2127 | printk(KERN_INFO "%s: now up (%d B channels)\n", | 2127 | printk(KERN_INFO "%s: now up (%d B channels)\n", |
| 2128 | card->name, card->nbchan); | 2128 | card->name, card->nbchan); |
| 2129 | 2129 | ||
| 2130 | enable_dchannel_trace(card); | 2130 | enable_dchannel_trace(card); |
| 2131 | 2131 | ||
| @@ -2158,7 +2158,7 @@ static int capidrv_delcontr(u16 contr) · 26 unmodified lines | |||
| 2158 | 2158 | ||
| 2159 | if (debugmode) | 2159 | if (debugmode) |
| 2160 | printk(KERN_DEBUG "capidrv-%d: id=%d unloading\n", | 2160 | printk(KERN_DEBUG "capidrv-%d: id=%d unloading\n", |
| 2161 | card->contrnr, card->myid); | 2161 | card->contrnr, card->myid); |
| 2162 | 2162 | ||
| 2163 | cmd.command = ISDN_STAT_STOP; | 2163 | cmd.command = ISDN_STAT_STOP; |
| 2164 | cmd.driver = card->myid; | 2164 | cmd.driver = card->myid; |
| @@ -2168,17 +2168,17 @@ static int capidrv_delcontr(u16 contr) · 3 unmodified lines | |||
| 2168 | 2168 | ||
| 2169 | cmd.command = ISDN_STAT_DISCH; | 2169 | cmd.command = ISDN_STAT_DISCH; |
| 2170 | cmd.driver = card->myid; | 2170 | cmd.driver = card->myid; |
| 2171 | cmd.arg = card->nbchan-1; | 2171 | cmd.arg = card->nbchan - 1; |
| 2172 | cmd.parm.num[0] = 0; | 2172 | cmd.parm.num[0] = 0; |
| 2173 | if (debugmode) | 2173 | if (debugmode) |
| 2174 | printk(KERN_DEBUG "capidrv-%d: id=%d disable chan=%ld\n", | 2174 | printk(KERN_DEBUG "capidrv-%d: id=%d disable chan=%ld\n", |
| 2175 | card->contrnr, card->myid, cmd.arg); | 2175 | card->contrnr, card->myid, cmd.arg); |
| 2176 | card->interface.statcallb(&cmd); | 2176 | card->interface.statcallb(&cmd); |
| 2177 | 2177 | ||
| 2178 | if (card->bchans[card->nbchan-1].nccip) | 2178 | if (card->bchans[card->nbchan - 1].nccip) |
| 2179 | free_ncci(card, card->bchans[card->nbchan-1].nccip); | 2179 | free_ncci(card, card->bchans[card->nbchan - 1].nccip); |
| 2180 | if (card->bchans[card->nbchan-1].plcip) | 2180 | if (card->bchans[card->nbchan - 1].plcip) |
| 2181 | free_plci(card, card->bchans[card->nbchan-1].plcip); | 2181 | free_plci(card, card->bchans[card->nbchan - 1].plcip); |
| 2182 | if (card->plci_list) | 2182 | if (card->plci_list) |
| 2183 | printk(KERN_ERR "capidrv: bug in free_plci()\n"); | 2183 | printk(KERN_ERR "capidrv: bug in free_plci()\n"); |
| 2184 | card->nbchan--; | 2184 | card->nbchan--; |
| @@ -2188,7 +2188,7 @@ static int capidrv_delcontr(u16 contr) · 3 unmodified lines | |||
| 2188 | 2188 | ||
| 2189 | if (debugmode) | 2189 | if (debugmode) |
| 2190 | printk(KERN_DEBUG "capidrv-%d: id=%d isdn unload\n", | 2190 | printk(KERN_DEBUG "capidrv-%d: id=%d isdn unload\n", |
| 2191 | card->contrnr, card->myid); | 2191 | card->contrnr, card->myid); |
| 2192 | 2192 | ||
| 2193 | cmd.command = ISDN_STAT_UNLOAD; | 2193 | cmd.command = ISDN_STAT_UNLOAD; |
| 2194 | cmd.driver = card->myid; | 2194 | cmd.driver = card->myid; |
| @@ -2196,7 +2196,7 @@ static int capidrv_delcontr(u16 contr) · 1 unmodified line | |||
| 2196 | 2196 | ||
| 2197 | if (debugmode) | 2197 | if (debugmode) |
| 2198 | printk(KERN_DEBUG "capidrv-%d: id=%d remove contr from list\n", | 2198 | printk(KERN_DEBUG "capidrv-%d: id=%d remove contr from list\n", |
| 2199 | card->contrnr, card->myid); | 2199 | card->contrnr, card->myid); |
| 2200 | 2200 | ||
| 2201 | spin_lock_irqsave(&global_lock, flags); | 2201 | spin_lock_irqsave(&global_lock, flags); |
| 2202 | for (pp = &global.contr_list; *pp; pp = &(*pp)->next) { | 2202 | for (pp = &global.contr_list; *pp; pp = &(*pp)->next) { |
| @@ -2243,10 +2243,10 @@ lower_callback(struct notifier_block *nb, unsigned long val, void *v) · 40 unmodified lines | |||
| 2243 | static int capidrv_proc_show(struct seq_file *m, void *v) | 2243 | static int capidrv_proc_show(struct seq_file *m, void *v) |
| 2244 | { | 2244 | { |
| 2245 | seq_printf(m, "%lu %lu %lu %lu\n", | 2245 | seq_printf(m, "%lu %lu %lu %lu\n", |
| 2246 | global.ap.nrecvctlpkt, | 2246 | global.ap.nrecvctlpkt, |
| 2247 | global.ap.nrecvdatapkt, | 2247 | global.ap.nrecvdatapkt, |
| 2248 | global.ap.nsentctlpkt, | 2248 | global.ap.nsentctlpkt, |
| 2249 | global.ap.nsentdatapkt); | 2249 | global.ap.nsentdatapkt); |
| 2250 | return 0; | 2250 | return 0; |
| 2251 | } | 2251 | } |
| 2252 | 2252 | ||
| @@ -34,7 +34,7 @@ · 33 unmodified lines | |||
| 34 | * per plci state machine | 34 | * per plci state machine |
| 35 | */ | 35 | */ |
| 36 | #define ST_PLCI_NONE 0 /* P-0 */ | 36 | #define ST_PLCI_NONE 0 /* P-0 */ |
| 37 | #define ST_PLCI_OUTGOING 1 /* P-0.1 */ | 37 | #define ST_PLCI_OUTGOING 1 /* P-0.1 */ |
| 38 | #define ST_PLCI_ALLOCATED 2 /* P-1 */ | 38 | #define ST_PLCI_ALLOCATED 2 /* P-1 */ |
| 39 | #define ST_PLCI_ACTIVE 3 /* P-ACT */ | 39 | #define ST_PLCI_ACTIVE 3 /* P-ACT */ |
| 40 | #define ST_PLCI_INCOMING 4 /* P-2 */ | 40 | #define ST_PLCI_INCOMING 4 /* P-2 */ |
| @@ -47,20 +47,20 @@ · 6 unmodified lines | |||
| 47 | #define ST_PLCI_HELD 11 /* P-HELD */ | 47 | #define ST_PLCI_HELD 11 /* P-HELD */ |
| 48 | 48 | ||
| 49 | #define EV_PLCI_CONNECT_REQ 1 /* P-0 -> P-0.1 | 49 | #define EV_PLCI_CONNECT_REQ 1 /* P-0 -> P-0.1 |
| 50 | */ | 50 | */ |
| 51 | #define EV_PLCI_CONNECT_CONF_ERROR 2 /* P-0.1 -> P-0 | 51 | #define EV_PLCI_CONNECT_CONF_ERROR 2 /* P-0.1 -> P-0 |
| 52 | */ | 52 | */ |
| 53 | #define EV_PLCI_CONNECT_CONF_OK 3 /* P-0.1 -> P-1 | 53 | #define EV_PLCI_CONNECT_CONF_OK 3 /* P-0.1 -> P-1 |
| 54 | */ | 54 | */ |
| 55 | #define EV_PLCI_FACILITY_IND_UP 4 /* P-0 -> P-1 | 55 | #define EV_PLCI_FACILITY_IND_UP 4 /* P-0 -> P-1 |
| 56 | */ | 56 | */ |
| 57 | #define EV_PLCI_CONNECT_IND 5 /* P-0 -> P-2 | 57 | #define EV_PLCI_CONNECT_IND 5 /* P-0 -> P-2 |
| 58 | */ | 58 | */ |
| 59 | #define EV_PLCI_CONNECT_ACTIVE_IND 6 /* P-1 -> P-ACT | 59 | #define EV_PLCI_CONNECT_ACTIVE_IND 6 /* P-1 -> P-ACT |
| 60 | */ | 60 | */ |
| 61 | #define EV_PLCI_CONNECT_REJECT 7 /* P-2 -> P-5 | 61 | #define EV_PLCI_CONNECT_REJECT 7 /* P-2 -> P-5 |
| 62 | P-3 -> P-5 | 62 | P-3 -> P-5 |
| 63 | */ | 63 | */ |
| 64 | #define EV_PLCI_DISCONNECT_REQ 8 /* P-1 -> P-5 | 64 | #define EV_PLCI_DISCONNECT_REQ 8 /* P-1 -> P-5 |
| 65 | P-2 -> P-5 | 65 | P-2 -> P-5 |
| 66 | P-3 -> P-5 | 66 | P-3 -> P-5 |
| @@ -68,7 +68,7 @@ · 1 unmodified line | |||
| 68 | P-ACT -> P-5 | 68 | P-ACT -> P-5 |
| 69 | P-Res -> P-5 (*) | 69 | P-Res -> P-5 (*) |
| 70 | P-HELD -> P-5 (*) | 70 | P-HELD -> P-5 (*) |
| 71 | */ | 71 | */ |
| 72 | #define EV_PLCI_DISCONNECT_IND 9 /* P-1 -> P-6 | 72 | #define EV_PLCI_DISCONNECT_IND 9 /* P-1 -> P-6 |
| 73 | P-2 -> P-6 | 73 | P-2 -> P-6 |
| 74 | P-3 -> P-6 | 74 | P-3 -> P-6 |
| @@ -77,35 +77,35 @@ · 2 unmodified lines | |||
| 77 | P-ACT -> P-6 | 77 | P-ACT -> P-6 |
| 78 | P-Res -> P-6 (*) | 78 | P-Res -> P-6 (*) |
| 79 | P-HELD -> P-6 (*) | 79 | P-HELD -> P-6 (*) |
| 80 | */ | 80 | */ |
| 81 | #define EV_PLCI_FACILITY_IND_DOWN 10 /* P-0.1 -> P-5 | 81 | #define EV_PLCI_FACILITY_IND_DOWN 10 /* P-0.1 -> P-5 |
| 82 | P-1 -> P-5 | 82 | P-1 -> P-5 |
| 83 | P-ACT -> P-5 | 83 | P-ACT -> P-5 |
| 84 | P-2 -> P-5 | 84 | P-2 -> P-5 |
| 85 | P-3 -> P-5 | 85 | P-3 -> P-5 |
| 86 | P-4 -> P-5 | 86 | P-4 -> P-5 |
| 87 | */ | 87 | */ |
| 88 | #define EV_PLCI_DISCONNECT_RESP 11 /* P-6 -> P-0 | 88 | #define EV_PLCI_DISCONNECT_RESP 11 /* P-6 -> P-0 |
| 89 | */ | 89 | */ |
| 90 | #define EV_PLCI_CONNECT_RESP 12 /* P-6 -> P-0 | 90 | #define EV_PLCI_CONNECT_RESP 12 /* P-6 -> P-0 |
| 91 | */ | 91 | */ |
| 92 | 92 | ||
| 93 | #define EV_PLCI_RESUME_REQ 13 /* P-0 -> P-0.Res | 93 | #define EV_PLCI_RESUME_REQ 13 /* P-0 -> P-0.Res |
| 94 | */ | 94 | */ |
| 95 | #define EV_PLCI_RESUME_CONF_OK 14 /* P-0.Res -> P-Res | 95 | #define EV_PLCI_RESUME_CONF_OK 14 /* P-0.Res -> P-Res |
| 96 | */ | 96 | */ |
| 97 | #define EV_PLCI_RESUME_CONF_ERROR 15 /* P-0.Res -> P-0 | 97 | #define EV_PLCI_RESUME_CONF_ERROR 15 /* P-0.Res -> P-0 |
| 98 | */ | 98 | */ |
| 99 | #define EV_PLCI_RESUME_IND 16 /* P-Res -> P-ACT | 99 | #define EV_PLCI_RESUME_IND 16 /* P-Res -> P-ACT |
| 100 | */ | 100 | */ |
| 101 | #define EV_PLCI_HOLD_IND 17 /* P-ACT -> P-HELD | 101 | #define EV_PLCI_HOLD_IND 17 /* P-ACT -> P-HELD |
| 102 | */ | 102 | */ |
| 103 | #define EV_PLCI_RETRIEVE_IND 18 /* P-HELD -> P-ACT | 103 | #define EV_PLCI_RETRIEVE_IND 18 /* P-HELD -> P-ACT |
| 104 | */ | 104 | */ |
| 105 | #define EV_PLCI_SUSPEND_IND 19 /* P-ACT -> P-5 | 105 | #define EV_PLCI_SUSPEND_IND 19 /* P-ACT -> P-5 |
| 106 | */ | 106 | */ |
| 107 | #define EV_PLCI_CD_IND 20 /* P-2 -> P-5 | 107 | #define EV_PLCI_CD_IND 20 /* P-2 -> P-5 |
| 108 | */ | 108 | */ |
| 109 | 109 | ||
| 110 | /* | 110 | /* |
| 111 | * per ncci state machine | 111 | * per ncci state machine |
| @@ -4,9 +4,9 @@ · 3 unmodified lines | |||
| 4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
| 5 | #include <linux/isdn/capilli.h> | 5 | #include <linux/isdn/capilli.h> |
| 6 | 6 | ||
| 7 | #define DBG(format, arg...) do { \ | 7 | #define DBG(format, arg...) do { \ |
| 8 | printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ | 8 | printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ |
| 9 | } while (0) | 9 | } while (0) |
| 10 | 10 | ||
| 11 | struct capilib_msgidqueue { | 11 | struct capilib_msgidqueue { |
| 12 | struct capilib_msgidqueue *next; | 12 | struct capilib_msgidqueue *next; |
| @@ -28,7 +28,7 @@ struct capilib_ncci { · 15 unmodified lines | |||
| 28 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
| 29 | // NCCI Handling | 29 | // NCCI Handling |
| 30 | 30 | ||
| 31 | static inline void mq_init(struct capilib_ncci * np) | 31 | static inline void mq_init(struct capilib_ncci *np) |
| 32 | { | 32 | { |
| 33 | u_int i; | 33 | u_int i; |
| 34 | np->msgidqueue = NULL; | 34 | np->msgidqueue = NULL; |
| @@ -42,7 +42,7 @@ static inline void mq_init(struct capilib_ncci * np) · 7 unmodified lines | |||
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid) | 45 | static inline int mq_enqueue(struct capilib_ncci *np, u16 msgid) |
| 46 | { | 46 | { |
| 47 | struct capilib_msgidqueue *mq; | 47 | struct capilib_msgidqueue *mq; |
| 48 | if ((mq = np->msgidfree) == NULL) | 48 | if ((mq = np->msgidfree) == NULL) |
| @@ -59,7 +59,7 @@ static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid) · 10 unmodified lines | |||
| 59 | return 1; | 59 | return 1; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | static inline int mq_dequeue(struct capilib_ncci * np, u16 msgid) | 62 | static inline int mq_dequeue(struct capilib_ncci *np, u16 msgid) |
| 63 | { | 63 | { |
| 64 | struct capilib_msgidqueue **pp; | 64 | struct capilib_msgidqueue **pp; |
| 65 | for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) { | 65 | for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) { |
| @@ -165,7 +165,7 @@ u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid) · 99 unmodified lines | |||
| 165 | continue; | 165 | continue; |
| 166 | if (np->ncci != ncci) | 166 | if (np->ncci != ncci) |
| 167 | continue; | 167 | continue; |
| 168 | 168 | ||
| 169 | if (mq_enqueue(np, msgid) == 0) | 169 | if (mq_enqueue(np, msgid) == 0) |
| 170 | return CAPI_SENDQUEUEFULL; | 170 | return CAPI_SENDQUEUEFULL; |
| 171 | 171 | ||
| @@ -188,7 +188,7 @@ void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgi · 16 unmodified lines | |||
| 188 | continue; | 188 | continue; |
| 189 | if (np->ncci != ncci) | 189 | if (np->ncci != ncci) |
| 190 | continue; | 190 | continue; |
| 191 | 191 | ||
| 192 | if (mq_dequeue(np, msgid) == 0) { | 192 | if (mq_dequeue(np, msgid) == 0) { |
| 193 | printk(KERN_ERR "kcapi: msgid %hu ncci 0x%x not on queue\n", | 193 | printk(KERN_ERR "kcapi: msgid %hu ncci 0x%x not on queue\n", |
| 194 | msgid, ncci); | 194 | msgid, ncci); |
| @@ -25,149 +25,149 @@ · 24 unmodified lines | |||
| 25 | #ifndef CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON | 25 | #ifndef CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON |
| 26 | char *capi_info2str(u16 reason) | 26 | char *capi_info2str(u16 reason) |
| 27 | { | 27 | { |
| 28 | return ".."; | 28 | return ".."; |
| 29 | } | 29 | } |
| 30 | #else | 30 | #else |
| 31 | char *capi_info2str(u16 reason) | 31 | char *capi_info2str(u16 reason) |
| 32 | { | 32 | { |
| 33 | switch (reason) { | 33 | switch (reason) { |
| 34 | 34 | ||
| 35 | /*-- informative values (corresponding message was processed) -----*/ | 35 | /*-- informative values (corresponding message was processed) -----*/ |
| 36 | case 0x0001: | 36 | case 0x0001: |
| 37 | return "NCPI not supported by current protocol, NCPI ignored"; | 37 | return "NCPI not supported by current protocol, NCPI ignored"; |
| 38 | case 0x0002: | 38 | case 0x0002: |
| 39 | return "Flags not supported by current protocol, flags ignored"; | 39 | return "Flags not supported by current protocol, flags ignored"; |
| 40 | case 0x0003: | 40 | case 0x0003: |
| 41 | return "Alert already sent by another application"; | 41 | return "Alert already sent by another application"; |
| 42 | 42 | ||
| 43 | /*-- error information concerning CAPI_REGISTER -----*/ | 43 | /*-- error information concerning CAPI_REGISTER -----*/ |
| 44 | case 0x1001: | 44 | case 0x1001: |
| 45 | return "Too many applications"; | 45 | return "Too many applications"; |
| 46 | case 0x1002: | 46 | case 0x1002: |
| 47 | return "Logical block size too small, must be at least 128 Bytes"; | 47 | return "Logical block size too small, must be at least 128 Bytes"; |
| 48 | case 0x1003: | 48 | case 0x1003: |
| 49 | return "Buffer exceeds 64 kByte"; | 49 | return "Buffer exceeds 64 kByte"; |
| 50 | case 0x1004: | 50 | case 0x1004: |
| 51 | return "Message buffer size too small, must be at least 1024 Bytes"; | 51 | return "Message buffer size too small, must be at least 1024 Bytes"; |
| 52 | case 0x1005: | 52 | case 0x1005: |
| 53 | return "Max. number of logical connections not supported"; | 53 | return "Max. number of logical connections not supported"; |
| 54 | case 0x1006: | 54 | case 0x1006: |
| 55 | return "Reserved"; | 55 | return "Reserved"; |
| 56 | case 0x1007: | 56 | case 0x1007: |
| 57 | return "The message could not be accepted because of an internal busy condition"; | 57 | return "The message could not be accepted because of an internal busy condition"; |
| 58 | case 0x1008: | 58 | case 0x1008: |
| 59 | return "OS resource error (no memory ?)"; | 59 | return "OS resource error (no memory ?)"; |
| 60 | case 0x1009: | 60 | case 0x1009: |
| 61 | return "CAPI not installed"; | 61 | return "CAPI not installed"; |
| 62 | case 0x100A: | 62 | case 0x100A: |
| 63 | return "Controller does not support external equipment"; | 63 | return "Controller does not support external equipment"; |
| 64 | case 0x100B: | 64 | case 0x100B: |
| 65 | return "Controller does only support external equipment"; | 65 | return "Controller does only support external equipment"; |
| 66 | 66 | ||
| 67 | /*-- error information concerning message exchange functions -----*/ | 67 | /*-- error information concerning message exchange functions -----*/ |
| 68 | case 0x1101: | 68 | case 0x1101: |
| 69 | return "Illegal application number"; | 69 | return "Illegal application number"; |
| 70 | case 0x1102: | 70 | case 0x1102: |
| 71 | return "Illegal command or subcommand or message length less than 12 bytes"; | 71 | return "Illegal command or subcommand or message length less than 12 bytes"; |
| 72 | case 0x1103: | 72 | case 0x1103: |
| 73 | return "The message could not be accepted because of a queue full condition !! The error code does not imply that CAPI cannot receive messages directed to another controller, PLCI or NCCI"; | 73 | return "The message could not be accepted because of a queue full condition !! The error code does not imply that CAPI cannot receive messages directed to another controller, PLCI or NCCI"; |
| 74 | case 0x1104: | 74 | case 0x1104: |
| 75 | return "Queue is empty"; | 75 | return "Queue is empty"; |
| 76 | case 0x1105: | 76 | case 0x1105: |
| 77 | return "Queue overflow, a message was lost !! This indicates a configuration error. The only recovery from this error is to perform a CAPI_RELEASE"; | 77 | return "Queue overflow, a message was lost !! This indicates a configuration error. The only recovery from this error is to perform a CAPI_RELEASE"; |
| 78 | case 0x1106: | 78 | case 0x1106: |
| 79 | return "Unknown notification parameter"; | 79 | return "Unknown notification parameter"; |
| 80 | case 0x1107: | 80 | case 0x1107: |
| 81 | return "The Message could not be accepted because of an internal busy condition"; | 81 | return "The Message could not be accepted because of an internal busy condition"; |
| 82 | case 0x1108: | 82 | case 0x1108: |
| 83 | return "OS Resource error (no memory ?)"; | 83 | return "OS Resource error (no memory ?)"; |
| 84 | case 0x1109: | 84 | case 0x1109: |
| 85 | return "CAPI not installed"; | 85 | return "CAPI not installed"; |
| 86 | case 0x110A: | 86 | case 0x110A: |
| 87 | return "Controller does not support external equipment"; | 87 | return "Controller does not support external equipment"; |
| 88 | case 0x110B: | 88 | case 0x110B: |
| 89 | return "Controller does only support external equipment"; | 89 | return "Controller does only support external equipment"; |
| 90 | 90 | ||
| 91 | /*-- error information concerning resource / coding problems -----*/ | 91 | /*-- error information concerning resource / coding problems -----*/ |
| 92 | case 0x2001: | 92 | case 0x2001: |
| 93 | return "Message not supported in current state"; | 93 | return "Message not supported in current state"; |
| 94 | case 0x2002: | 94 | case 0x2002: |
| 95 | return "Illegal Controller / PLCI / NCCI"; | 95 | return "Illegal Controller / PLCI / NCCI"; |
| 96 | case 0x2003: | 96 | case 0x2003: |
| 97 | return "Out of PLCI"; | 97 | return "Out of PLCI"; |
| 98 | case 0x2004: | 98 | case 0x2004: |
| 99 | return "Out of NCCI"; | 99 | return "Out of NCCI"; |
| 100 | case 0x2005: | 100 | case 0x2005: |
| 101 | return "Out of LISTEN"; | 101 | return "Out of LISTEN"; |
| 102 | case 0x2006: | 102 | case 0x2006: |
| 103 | return "Out of FAX resources (protocol T.30)"; | 103 | return "Out of FAX resources (protocol T.30)"; |
| 104 | case 0x2007: | 104 | case 0x2007: |
| 105 | return "Illegal message parameter coding"; | 105 | return "Illegal message parameter coding"; |
| 106 | 106 | ||
| 107 | /*-- error information concerning requested services -----*/ | 107 | /*-- error information concerning requested services -----*/ |
| 108 | case 0x3001: | 108 | case 0x3001: |
| 109 | return "B1 protocol not supported"; | 109 | return "B1 protocol not supported"; |
| 110 | case 0x3002: | 110 | case 0x3002: |
| 111 | return "B2 protocol not supported"; | 111 | return "B2 protocol not supported"; |
| 112 | case 0x3003: | 112 | case 0x3003: |
| 113 | return "B3 protocol not supported"; | 113 | return "B3 protocol not supported"; |
| 114 | case 0x3004: | 114 | case 0x3004: |
| 115 | return "B1 protocol parameter not supported"; | 115 | return "B1 protocol parameter not supported"; |
| 116 | case 0x3005: | 116 | case 0x3005: |
| 117 | return "B2 protocol parameter not supported"; | 117 | return "B2 protocol parameter not supported"; |
| 118 | case 0x3006: | 118 | case 0x3006: |
| 119 | return "B3 protocol parameter not supported"; | 119 | return "B3 protocol parameter not supported"; |
| 120 | case 0x3007: | 120 | case 0x3007: |
| 121 | return "B protocol combination not supported"; | 121 | return "B protocol combination not supported"; |
| 122 | case 0x3008: | 122 | case 0x3008: |
| 123 | return "NCPI not supported"; | 123 | return "NCPI not supported"; |
| 124 | case 0x3009: | 124 | case 0x3009: |
| 125 | return "CIP Value unknown"; | 125 | return "CIP Value unknown"; |
| 126 | case 0x300A: | 126 | case 0x300A: |
| 127 | return "Flags not supported (reserved bits)"; | 127 | return "Flags not supported (reserved bits)"; |
| 128 | case 0x300B: | 128 | case 0x300B: |
| 129 | return "Facility not supported"; | 129 | return "Facility not supported"; |
| 130 | case 0x300C: | 130 | case 0x300C: |
| 131 | return "Data length not supported by current protocol"; | 131 | return "Data length not supported by current protocol"; |
| 132 | case 0x300D: | 132 | case 0x300D: |
| 133 | return "Reset procedure not supported by current protocol"; | 133 | return "Reset procedure not supported by current protocol"; |
| 134 | 134 | ||
| 135 | /*-- informations about the clearing of a physical connection -----*/ | 135 | /*-- informations about the clearing of a physical connection -----*/ |
| 136 | case 0x3301: | 136 | case 0x3301: |
| 137 | return "Protocol error layer 1 (broken line or B-channel removed by signalling protocol)"; | 137 | return "Protocol error layer 1 (broken line or B-channel removed by signalling protocol)"; |
| 138 | case 0x3302: | 138 | case 0x3302: |
| 139 | return "Protocol error layer 2"; | 139 | return "Protocol error layer 2"; |
| 140 | case 0x3303: | 140 | case 0x3303: |
| 141 | return "Protocol error layer 3"; | 141 | return "Protocol error layer 3"; |
| 142 | case 0x3304: | 142 | case 0x3304: |
| 143 | return "Another application got that call"; | 143 | return "Another application got that call"; |
| 144 | /*-- T.30 specific reasons -----*/ | 144 | /*-- T.30 specific reasons -----*/ |
| 145 | case 0x3311: | 145 | case 0x3311: |
| 146 | return "Connecting not successful (remote station is no FAX G3 machine)"; | 146 | return "Connecting not successful (remote station is no FAX G3 machine)"; |
| 147 | case 0x3312: | 147 | case 0x3312: |
| 148 | return "Connecting not successful (training error)"; | 148 | return "Connecting not successful (training error)"; |
| 149 | case 0x3313: | 149 | case 0x3313: |
| 150 | return "Disconnected before transfer (remote station does not support transfer mode, e.g. resolution)"; | 150 | return "Disconnected before transfer (remote station does not support transfer mode, e.g. resolution)"; |
| 151 | case 0x3314: | 151 | case 0x3314: |
| 152 | return "Disconnected during transfer (remote abort)"; | 152 | return "Disconnected during transfer (remote abort)"; |
| 153 | case 0x3315: | 153 | case 0x3315: |
| 154 | return "Disconnected during transfer (remote procedure error, e.g. unsuccessful repetition of T.30 commands)"; | 154 | return "Disconnected during transfer (remote procedure error, e.g. unsuccessful repetition of T.30 commands)"; |
| 155 | case 0x3316: | 155 | case 0x3316: |
| 156 | return "Disconnected during transfer (local tx data underrun)"; | 156 | return "Disconnected during transfer (local tx data underrun)"; |
| 157 | case 0x3317: | 157 | case 0x3317: |
| 158 | return "Disconnected during transfer (local rx data overflow)"; | 158 | return "Disconnected during transfer (local rx data overflow)"; |
| 159 | case 0x3318: | 159 | case 0x3318: |
| 160 | return "Disconnected during transfer (local abort)"; | 160 | return "Disconnected during transfer (local abort)"; |
| 161 | case 0x3319: | 161 | case 0x3319: |
| 162 | return "Illegal parameter coding (e.g. SFF coding error)"; | 162 | return "Illegal parameter coding (e.g. SFF coding error)"; |
| 163 | 163 | ||
| 164 | /*-- disconnect causes from the network according to ETS 300 102-1/Q.931 -----*/ | 164 | /*-- disconnect causes from the network according to ETS 300 102-1/Q.931 -----*/ |
| 165 | case 0x3481: return "Unallocated (unassigned) number"; | 165 | case 0x3481: return "Unallocated (unassigned) number"; |
| 166 | case 0x3482: return "No route to specified transit network"; | 166 | case 0x3482: return "No route to specified transit network"; |
| 167 | case 0x3483: return "No route to destination"; | 167 | case 0x3483: return "No route to destination"; |
| 168 | case 0x3486: return "Channel unacceptable"; | 168 | case 0x3486: return "Channel unacceptable"; |
| 169 | case 0x3487: | 169 | case 0x3487: |
| 170 | return "Call awarded and being delivered in an established channel"; | 170 | return "Call awarded and being delivered in an established channel"; |
| 171 | case 0x3490: return "Normal call clearing"; | 171 | case 0x3490: return "Normal call clearing"; |
| 172 | case 0x3491: return "User busy"; | 172 | case 0x3491: return "User busy"; |
| 173 | case 0x3492: return "No user responding"; | 173 | case 0x3492: return "No user responding"; |
| @@ -217,7 +217,7 @@ char *capi_info2str(u16 reason) · 43 unmodified lines | |||
| 217 | case 0x34FF: return "Interworking, unspecified"; | 217 | case 0x34FF: return "Interworking, unspecified"; |
| 218 | 218 | ||
| 219 | default: return "No additional information"; | 219 | default: return "No additional information"; |
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| 222 | #endif | 222 | #endif |
| 223 | 223 | ||
| @@ -235,169 +235,169 @@ typedef struct { · 11 unmodified lines | |||
| 235 | 235 | ||
| 236 | static _cdef cdef[] = | 236 | static _cdef cdef[] = |
| 237 | { | 237 | { |
| 238 | /*00 */ | 238 | /*00 */ |
| 239 | {_CEND}, | 239 | {_CEND}, |
| 240 | /*01 */ | 240 | /*01 */ |
| 241 | {_CEND}, | 241 | {_CEND}, |
| 242 | /*02 */ | 242 | /*02 */ |
| 243 | {_CEND}, | 243 | {_CEND}, |
| 244 | /*03 */ | 244 | /*03 */ |
| 245 | {_CDWORD, offsetof(_cmsg, adr.adrController)}, | 245 | {_CDWORD, offsetof(_cmsg, adr.adrController)}, |
| 246 | /*04 */ | 246 | /*04 */ |
| 247 | {_CMSTRUCT, offsetof(_cmsg, AdditionalInfo)}, | 247 | {_CMSTRUCT, offsetof(_cmsg, AdditionalInfo)}, |
| 248 | /*05 */ | 248 | /*05 */ |
| 249 | {_CSTRUCT, offsetof(_cmsg, B1configuration)}, | 249 | {_CSTRUCT, offsetof(_cmsg, B1configuration)}, |
| 250 | /*06 */ | 250 | /*06 */ |
| 251 | {_CWORD, offsetof(_cmsg, B1protocol)}, | 251 | {_CWORD, offsetof(_cmsg, B1protocol)}, |
| 252 | /*07 */ | 252 | /*07 */ |
| 253 | {_CSTRUCT, offsetof(_cmsg, B2configuration)}, | 253 | {_CSTRUCT, offsetof(_cmsg, B2configuration)}, |
| 254 | /*08 */ | 254 | /*08 */ |
| 255 | {_CWORD, offsetof(_cmsg, B2protocol)}, | 255 | {_CWORD, offsetof(_cmsg, B2protocol)}, |
| 256 | /*09 */ | 256 | /*09 */ |
| 257 | {_CSTRUCT, offsetof(_cmsg, B3configuration)}, | 257 | {_CSTRUCT, offsetof(_cmsg, B3configuration)}, |
| 258 | /*0a */ | 258 | /*0a */ |
| 259 | {_CWORD, offsetof(_cmsg, B3protocol)}, | 259 | {_CWORD, offsetof(_cmsg, B3protocol)}, |
| 260 | /*0b */ | 260 | /*0b */ |
| 261 | {_CSTRUCT, offsetof(_cmsg, BC)}, | 261 | {_CSTRUCT, offsetof(_cmsg, BC)}, |
| 262 | /*0c */ | 262 | /*0c */ |
| 263 | {_CSTRUCT, offsetof(_cmsg, BChannelinformation)}, | 263 | {_CSTRUCT, offsetof(_cmsg, BChannelinformation)}, |
| 264 | /*0d */ | 264 | /*0d */ |
| 265 | {_CMSTRUCT, offsetof(_cmsg, BProtocol)}, | 265 | {_CMSTRUCT, offsetof(_cmsg, BProtocol)}, |
| 266 | /*0e */ | 266 | /*0e */ |
| 267 | {_CSTRUCT, offsetof(_cmsg, CalledPartyNumber)}, | 267 | {_CSTRUCT, offsetof(_cmsg, CalledPartyNumber)}, |
| 268 | /*0f */ | 268 | /*0f */ |
| 269 | {_CSTRUCT, offsetof(_cmsg, CalledPartySubaddress)}, | 269 | {_CSTRUCT, offsetof(_cmsg, CalledPartySubaddress)}, |
| 270 | /*10 */ | 270 | /*10 */ |
| 271 | {_CSTRUCT, offsetof(_cmsg, CallingPartyNumber)}, | 271 | {_CSTRUCT, offsetof(_cmsg, CallingPartyNumber)}, |
| 272 | /*11 */ | 272 | /*11 */ |
| 273 | {_CSTRUCT, offsetof(_cmsg, CallingPartySubaddress)}, | 273 | {_CSTRUCT, offsetof(_cmsg, CallingPartySubaddress)}, |
| 274 | /*12 */ | 274 | /*12 */ |
| 275 | {_CDWORD, offsetof(_cmsg, CIPmask)}, | 275 | {_CDWORD, offsetof(_cmsg, CIPmask)}, |
| 276 | /*13 */ | 276 | /*13 */ |
| 277 | {_CDWORD, offsetof(_cmsg, CIPmask2)}, | 277 | {_CDWORD, offsetof(_cmsg, CIPmask2)}, |
| 278 | /*14 */ | 278 | /*14 */ |
| 279 | {_CWORD, offsetof(_cmsg, CIPValue)}, | 279 | {_CWORD, offsetof(_cmsg, CIPValue)}, |
| 280 | /*15 */ | 280 | /*15 */ |
| 281 | {_CDWORD, offsetof(_cmsg, Class)}, | 281 | {_CDWORD, offsetof(_cmsg, Class)}, |
| 282 | /*16 */ | 282 | /*16 */ |
| 283 | {_CSTRUCT, offsetof(_cmsg, ConnectedNumber)}, | 283 | {_CSTRUCT, offsetof(_cmsg, ConnectedNumber)}, |
| 284 | /*17 */ | 284 | /*17 */ |
| 285 | {_CSTRUCT, offsetof(_cmsg, ConnectedSubaddress)}, | 285 | {_CSTRUCT, offsetof(_cmsg, ConnectedSubaddress)}, |
| 286 | /*18 */ | 286 | /*18 */ |
| 287 | {_CDWORD, offsetof(_cmsg, Data)}, | 287 | {_CDWORD, offsetof(_cmsg, Data)}, |
| 288 | /*19 */ | 288 | /*19 */ |
| 289 | {_CWORD, offsetof(_cmsg, DataHandle)}, | 289 | {_CWORD, offsetof(_cmsg, DataHandle)}, |
| 290 | /*1a */ | 290 | /*1a */ |
| 291 | {_CWORD, offsetof(_cmsg, DataLength)}, | 291 | {_CWORD, offsetof(_cmsg, DataLength)}, |
| 292 | /*1b */ | 292 | /*1b */ |
| 293 | {_CSTRUCT, offsetof(_cmsg, FacilityConfirmationParameter)}, | 293 | {_CSTRUCT, offsetof(_cmsg, FacilityConfirmationParameter)}, |
| 294 | /*1c */ | 294 | /*1c */ |
| 295 | {_CSTRUCT, offsetof(_cmsg, Facilitydataarray)}, | 295 | {_CSTRUCT, offsetof(_cmsg, Facilitydataarray)}, |
| 296 | /*1d */ | 296 | /*1d */ |
| 297 | {_CSTRUCT, offsetof(_cmsg, FacilityIndicationParameter)}, | 297 | {_CSTRUCT, offsetof(_cmsg, FacilityIndicationParameter)}, |
| 298 | /*1e */ | 298 | /*1e */ |
| 299 | {_CSTRUCT, offsetof(_cmsg, FacilityRequestParameter)}, | 299 | {_CSTRUCT, offsetof(_cmsg, FacilityRequestParameter)}, |
| 300 | /*1f */ | 300 | /*1f */ |
| 301 | {_CWORD, offsetof(_cmsg, FacilitySelector)}, | 301 | {_CWORD, offsetof(_cmsg, FacilitySelector)}, |
| 302 | /*20 */ | 302 | /*20 */ |
| 303 | {_CWORD, offsetof(_cmsg, Flags)}, | 303 | {_CWORD, offsetof(_cmsg, Flags)}, |
| 304 | /*21 */ | 304 | /*21 */ |
| 305 | {_CDWORD, offsetof(_cmsg, Function)}, | 305 | {_CDWORD, offsetof(_cmsg, Function)}, |
| 306 | /*22 */ | 306 | /*22 */ |
| 307 | {_CSTRUCT, offsetof(_cmsg, HLC)}, | 307 | {_CSTRUCT, offsetof(_cmsg, HLC)}, |
| 308 | /*23 */ | 308 | /*23 */ |
| 309 | {_CWORD, offsetof(_cmsg, Info)}, | 309 | {_CWORD, offsetof(_cmsg, Info)}, |
| 310 | /*24 */ | 310 | /*24 */ |
| 311 | {_CSTRUCT, offsetof(_cmsg, InfoElement)}, | 311 | {_CSTRUCT, offsetof(_cmsg, InfoElement)}, |
| 312 | /*25 */ | 312 | /*25 */ |
| 313 | {_CDWORD, offsetof(_cmsg, InfoMask)}, | 313 | {_CDWORD, offsetof(_cmsg, InfoMask)}, |
| 314 | /*26 */ | 314 | /*26 */ |
| 315 | {_CWORD, offsetof(_cmsg, InfoNumber)}, | 315 | {_CWORD, offsetof(_cmsg, InfoNumber)}, |
| 316 | /*27 */ | 316 | /*27 */ |
| 317 | {_CSTRUCT, offsetof(_cmsg, Keypadfacility)}, | 317 | {_CSTRUCT, offsetof(_cmsg, Keypadfacility)}, |
| 318 | /*28 */ | 318 | /*28 */ |
| 319 | {_CSTRUCT, offsetof(_cmsg, LLC)}, | 319 | {_CSTRUCT, offsetof(_cmsg, LLC)}, |
| 320 | /*29 */ | 320 | /*29 */ |
| 321 | {_CSTRUCT, offsetof(_cmsg, ManuData)}, | 321 | {_CSTRUCT, offsetof(_cmsg, ManuData)}, |
| 322 | /*2a */ | 322 | /*2a */ |
| 323 | {_CDWORD, offsetof(_cmsg, ManuID)}, | 323 | {_CDWORD, offsetof(_cmsg, ManuID)}, |
| 324 | /*2b */ | 324 | /*2b */ |
| 325 | {_CSTRUCT, offsetof(_cmsg, NCPI)}, | 325 | {_CSTRUCT, offsetof(_cmsg, NCPI)}, |
| 326 | /*2c */ | 326 | /*2c */ |
| 327 | {_CWORD, offsetof(_cmsg, Reason)}, | 327 | {_CWORD, offsetof(_cmsg, Reason)}, |
| 328 | /*2d */ | 328 | /*2d */ |
| 329 | {_CWORD, offsetof(_cmsg, Reason_B3)}, | 329 | {_CWORD, offsetof(_cmsg, Reason_B3)}, |
| 330 | /*2e */ | 330 | /*2e */ |
| 331 | {_CWORD, offsetof(_cmsg, Reject)}, | 331 | {_CWORD, offsetof(_cmsg, Reject)}, |
| 332 | /*2f */ | 332 | /*2f */ |
| 333 | {_CSTRUCT, offsetof(_cmsg, Useruserdata)} | 333 | {_CSTRUCT, offsetof(_cmsg, Useruserdata)} |
| 334 | }; | 334 | }; |
| 335 | 335 | ||
| 336 | static unsigned char *cpars[] = | 336 | static unsigned char *cpars[] = |
| 337 | { | 337 | { |
| 338 | /* ALERT_REQ */ [0x01] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01", | 338 | /* ALERT_REQ */ [0x01] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01", |
| 339 | /* CONNECT_REQ */ [0x02] = "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01", | 339 | /* CONNECT_REQ */ [0x02] = "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01", |
| 340 | /* DISCONNECT_REQ */ [0x04] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01", | 340 | /* DISCONNECT_REQ */ [0x04] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01", |
| 341 | /* LISTEN_REQ */ [0x05] = "\x03\x25\x12\x13\x10\x11\x01", | 341 | /* LISTEN_REQ */ [0x05] = "\x03\x25\x12\x13\x10\x11\x01", |
| 342 | /* INFO_REQ */ [0x08] = "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01", | 342 | /* INFO_REQ */ [0x08] = "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01", |
| 343 | /* FACILITY_REQ */ [0x09] = "\x03\x1f\x1e\x01", | 343 | /* FACILITY_REQ */ [0x09] = "\x03\x1f\x1e\x01", |
| 344 | /* SELECT_B_PROTOCOL_REQ */ [0x0a] = "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01", | 344 | /* SELECT_B_PROTOCOL_REQ */ [0x0a] = "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01", |
| 345 | /* CONNECT_B3_REQ */ [0x0b] = "\x03\x2b\x01", | 345 | /* CONNECT_B3_REQ */ [0x0b] = "\x03\x2b\x01", |
| 346 | /* DISCONNECT_B3_REQ */ [0x0d] = "\x03\x2b\x01", | 346 | /* DISCONNECT_B3_REQ */ [0x0d] = "\x03\x2b\x01", |
| 347 | /* DATA_B3_REQ */ [0x0f] = "\x03\x18\x1a\x19\x20\x01", | 347 | /* DATA_B3_REQ */ [0x0f] = "\x03\x18\x1a\x19\x20\x01", |
| 348 | /* RESET_B3_REQ */ [0x10] = "\x03\x2b\x01", | 348 | /* RESET_B3_REQ */ [0x10] = "\x03\x2b\x01", |
| 349 | /* ALERT_CONF */ [0x13] = "\x03\x23\x01", | 349 | /* ALERT_CONF */ [0x13] = "\x03\x23\x01", |
| 350 | /* CONNECT_CONF */ [0x14] = "\x03\x23\x01", | 350 | /* CONNECT_CONF */ [0x14] = "\x03\x23\x01", |
| 351 | /* DISCONNECT_CONF */ [0x16] = "\x03\x23\x01", | 351 | /* DISCONNECT_CONF */ [0x16] = "\x03\x23\x01", |
| 352 | /* LISTEN_CONF */ [0x17] = "\x03\x23\x01", | 352 | /* LISTEN_CONF */ [0x17] = "\x03\x23\x01", |
| 353 | /* MANUFACTURER_REQ */ [0x18] = "\x03\x2a\x15\x21\x29\x01", | 353 | /* MANUFACTURER_REQ */ [0x18] = "\x03\x2a\x15\x21\x29\x01", |
| 354 | /* INFO_CONF */ [0x1a] = "\x03\x23\x01", | 354 | /* INFO_CONF */ [0x1a] = "\x03\x23\x01", |
| 355 | /* FACILITY_CONF */ [0x1b] = "\x03\x23\x1f\x1b\x01", | 355 | /* FACILITY_CONF */ [0x1b] = "\x03\x23\x1f\x1b\x01", |
| 356 | /* SELECT_B_PROTOCOL_CONF */ [0x1c] = "\x03\x23\x01", | 356 | /* SELECT_B_PROTOCOL_CONF */ [0x1c] = "\x03\x23\x01", |
| 357 | /* CONNECT_B3_CONF */ [0x1d] = "\x03\x23\x01", | 357 | /* CONNECT_B3_CONF */ [0x1d] = "\x03\x23\x01", |
| 358 | /* DISCONNECT_B3_CONF */ [0x1f] = "\x03\x23\x01", | 358 | /* DISCONNECT_B3_CONF */ [0x1f] = "\x03\x23\x01", |
| 359 | /* DATA_B3_CONF */ [0x21] = "\x03\x19\x23\x01", | 359 | /* DATA_B3_CONF */ [0x21] = "\x03\x19\x23\x01", |
| 360 | /* RESET_B3_CONF */ [0x22] = "\x03\x23\x01", | 360 | /* RESET_B3_CONF */ [0x22] = "\x03\x23\x01", |
| 361 | /* CONNECT_IND */ [0x26] = "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01", | 361 | /* CONNECT_IND */ [0x26] = "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01", |
| 362 | /* CONNECT_ACTIVE_IND */ [0x27] = "\x03\x16\x17\x28\x01", | 362 | /* CONNECT_ACTIVE_IND */ [0x27] = "\x03\x16\x17\x28\x01", |
| 363 | /* DISCONNECT_IND */ [0x28] = "\x03\x2c\x01", | 363 | /* DISCONNECT_IND */ [0x28] = "\x03\x2c\x01", |
| 364 | /* MANUFACTURER_CONF */ [0x2a] = "\x03\x2a\x15\x21\x29\x01", | 364 | /* MANUFACTURER_CONF */ [0x2a] = "\x03\x2a\x15\x21\x29\x01", |
| 365 | /* INFO_IND */ [0x2c] = "\x03\x26\x24\x01", | 365 | /* INFO_IND */ [0x2c] = "\x03\x26\x24\x01", |
| 366 | /* FACILITY_IND */ [0x2d] = "\x03\x1f\x1d\x01", | 366 | /* FACILITY_IND */ [0x2d] = "\x03\x1f\x1d\x01", |
| 367 | /* CONNECT_B3_IND */ [0x2f] = "\x03\x2b\x01", | 367 | /* CONNECT_B3_IND */ [0x2f] = "\x03\x2b\x01", |
| 368 | /* CONNECT_B3_ACTIVE_IND */ [0x30] = "\x03\x2b\x01", | 368 | /* CONNECT_B3_ACTIVE_IND */ [0x30] = "\x03\x2b\x01", |
| 369 | /* DISCONNECT_B3_IND */ [0x31] = "\x03\x2d\x2b\x01", | 369 | /* DISCONNECT_B3_IND */ [0x31] = "\x03\x2d\x2b\x01", |
| 370 | /* DATA_B3_IND */ [0x33] = "\x03\x18\x1a\x19\x20\x01", | 370 | /* DATA_B3_IND */ [0x33] = "\x03\x18\x1a\x19\x20\x01", |
| 371 | /* RESET_B3_IND */ [0x34] = "\x03\x2b\x01", | 371 | /* RESET_B3_IND */ [0x34] = "\x03\x2b\x01", |
| 372 | /* CONNECT_B3_T90_ACTIVE_IND */ [0x35] = "\x03\x2b\x01", | 372 | /* CONNECT_B3_T90_ACTIVE_IND */ [0x35] = "\x03\x2b\x01", |
| 373 | /* CONNECT_RESP */ [0x38] = "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01", | 373 | /* CONNECT_RESP */ [0x38] = "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01", |
| 374 | /* CONNECT_ACTIVE_RESP */ [0x39] = "\x03\x01", | 374 | /* CONNECT_ACTIVE_RESP */ [0x39] = "\x03\x01", |
| 375 | /* DISCONNECT_RESP */ [0x3a] = "\x03\x01", | 375 | /* DISCONNECT_RESP */ [0x3a] = "\x03\x01", |
| 376 | /* MANUFACTURER_IND */ [0x3c] = "\x03\x2a\x15\x21\x29\x01", | 376 | /* MANUFACTURER_IND */ [0x3c] = "\x03\x2a\x15\x21\x29\x01", |
| 377 | /* INFO_RESP */ [0x3e] = "\x03\x01", | 377 | /* INFO_RESP */ [0x3e] = "\x03\x01", |
| 378 | /* FACILITY_RESP */ [0x3f] = "\x03\x1f\x01", | 378 | /* FACILITY_RESP */ [0x3f] = "\x03\x1f\x01", |
| 379 | /* CONNECT_B3_RESP */ [0x41] = "\x03\x2e\x2b\x01", | 379 | /* CONNECT_B3_RESP */ [0x41] = "\x03\x2e\x2b\x01", |
| 380 | /* CONNECT_B3_ACTIVE_RESP */ [0x42] = "\x03\x01", | 380 | /* CONNECT_B3_ACTIVE_RESP */ [0x42] = "\x03\x01", |
| 381 | /* DISCONNECT_B3_RESP */ [0x43] = "\x03\x01", | 381 | /* DISCONNECT_B3_RESP */ [0x43] = "\x03\x01", |
| 382 | /* DATA_B3_RESP */ [0x45] = "\x03\x19\x01", | 382 | /* DATA_B3_RESP */ [0x45] = "\x03\x19\x01", |
| 383 | /* RESET_B3_RESP */ [0x46] = "\x03\x01", | 383 | /* RESET_B3_RESP */ [0x46] = "\x03\x01", |
| 384 | /* CONNECT_B3_T90_ACTIVE_RESP */ [0x47] = "\x03\x01", | 384 | /* CONNECT_B3_T90_ACTIVE_RESP */ [0x47] = "\x03\x01", |
| 385 | /* MANUFACTURER_RESP */ [0x4e] = "\x03\x2a\x15\x21\x29\x01", | 385 | /* MANUFACTURER_RESP */ [0x4e] = "\x03\x2a\x15\x21\x29\x01", |
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 388 | /*-------------------------------------------------------*/ | 388 | /*-------------------------------------------------------*/ |
| 389 | 389 | ||
| 390 | #define byteTLcpy(x,y) *(u8 *)(x)=*(u8 *)(y); | 390 | #define byteTLcpy(x, y) *(u8 *)(x) = *(u8 *)(y); |
| 391 | #define wordTLcpy(x,y) *(u16 *)(x)=*(u16 *)(y); | 391 | #define wordTLcpy(x, y) *(u16 *)(x) = *(u16 *)(y); |
| 392 | #define dwordTLcpy(x,y) memcpy(x,y,4); | 392 | #define dwordTLcpy(x, y) memcpy(x, y, 4); |
| 393 | #define structTLcpy(x,y,l) memcpy (x,y,l) | 393 | #define structTLcpy(x, y, l) memcpy(x, y, l) |
| 394 | #define structTLcpyovl(x,y,l) memmove (x,y,l) | 394 | #define structTLcpyovl(x, y, l) memmove(x, y, l) |
| 395 | 395 | ||
| 396 | #define byteTRcpy(x,y) *(u8 *)(y)=*(u8 *)(x); | 396 | #define byteTRcpy(x, y) *(u8 *)(y) = *(u8 *)(x); |
| 397 | #define wordTRcpy(x,y) *(u16 *)(y)=*(u16 *)(x); | 397 | #define wordTRcpy(x, y) *(u16 *)(y) = *(u16 *)(x); |
| 398 | #define dwordTRcpy(x,y) memcpy(y,x,4); | 398 | #define dwordTRcpy(x, y) memcpy(y, x, 4); |
| 399 | #define structTRcpy(x,y,l) memcpy (y,x,l) | 399 | #define structTRcpy(x, y, l) memcpy(y, x, l) |
| 400 | #define structTRcpyovl(x,y,l) memmove (y,x,l) | 400 | #define structTRcpyovl(x, y, l) memmove(y, x, l) |
| 401 | 401 | ||
| 402 | /*-------------------------------------------------------*/ | 402 | /*-------------------------------------------------------*/ |
| 403 | static unsigned command_2_index(unsigned c, unsigned sc) | 403 | static unsigned command_2_index(unsigned c, unsigned sc) |
| @@ -414,9 +414,9 @@ static unsigned command_2_index(unsigned c, unsigned sc) · 10 unmodified lines | |||
| 414 | 414 | ||
| 415 | /*-------------------------------------------------------*/ | 415 | /*-------------------------------------------------------*/ |
| 416 | #define TYP (cdef[cmsg->par[cmsg->p]].typ) | 416 | #define TYP (cdef[cmsg->par[cmsg->p]].typ) |
| 417 | #define OFF (((u8 *)cmsg)+cdef[cmsg->par[cmsg->p]].off) | 417 | #define OFF (((u8 *)cmsg) + cdef[cmsg->par[cmsg->p]].off) |
| 418 | 418 | ||
| 419 | static void jumpcstruct(_cmsg * cmsg) | 419 | static void jumpcstruct(_cmsg *cmsg) |
| 420 | { | 420 | { |
| 421 | unsigned layer; | 421 | unsigned layer; |
| 422 | for (cmsg->p++, layer = 1; layer;) { | 422 | for (cmsg->p++, layer = 1; layer;) { |
| @@ -433,7 +433,7 @@ static void jumpcstruct(_cmsg * cmsg) · 10 unmodified lines | |||
| 433 | } | 433 | } |
| 434 | } | 434 | } |
| 435 | /*-------------------------------------------------------*/ | 435 | /*-------------------------------------------------------*/ |
| 436 | static void pars_2_message(_cmsg * cmsg) | 436 | static void pars_2_message(_cmsg *cmsg) |
| 437 | { | 437 | { |
| 438 | 438 | ||
| 439 | for (; TYP != _CEND; cmsg->p++) { | 439 | for (; TYP != _CEND; cmsg->p++) { |
| @@ -499,7 +499,7 @@ static void pars_2_message(_cmsg * cmsg) · 59 unmodified lines | |||
| 499 | * Return value: 0 for success | 499 | * Return value: 0 for success |
| 500 | */ | 500 | */ |
| 501 | 501 | ||
| 502 | unsigned capi_cmsg2message(_cmsg * cmsg, u8 * msg) | 502 | unsigned capi_cmsg2message(_cmsg *cmsg, u8 *msg) |
| 503 | { | 503 | { |
| 504 | cmsg->m = msg; | 504 | cmsg->m = msg; |
| 505 | cmsg->l = 8; | 505 | cmsg->l = 8; |
| @@ -518,7 +518,7 @@ unsigned capi_cmsg2message(_cmsg * cmsg, u8 * msg) · 12 unmodified lines | |||
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | /*-------------------------------------------------------*/ | 520 | /*-------------------------------------------------------*/ |
| 521 | static void message_2_pars(_cmsg * cmsg) | 521 | static void message_2_pars(_cmsg *cmsg) |
| 522 | { | 522 | { |
| 523 | for (; TYP != _CEND; cmsg->p++) { | 523 | for (; TYP != _CEND; cmsg->p++) { |
| 524 | 524 | ||
| @@ -569,7 +569,7 @@ static void message_2_pars(_cmsg * cmsg) · 44 unmodified lines | |||
| 569 | * Return value: 0 for success | 569 | * Return value: 0 for success |
| 570 | */ | 570 | */ |
| 571 | 571 | ||
| 572 | unsigned capi_message2cmsg(_cmsg * cmsg, u8 * msg) | 572 | unsigned capi_message2cmsg(_cmsg *cmsg, u8 *msg) |
| 573 | { | 573 | { |
| 574 | memset(cmsg, 0, sizeof(_cmsg)); | 574 | memset(cmsg, 0, sizeof(_cmsg)); |
| 575 | cmsg->m = msg; | 575 | cmsg->m = msg; |
| @@ -600,7 +600,7 @@ unsigned capi_message2cmsg(_cmsg * cmsg, u8 * msg) · 24 unmodified lines | |||
| 600 | * Return value: 0 for success | 600 | * Return value: 0 for success |
| 601 | */ | 601 | */ |
| 602 | 602 | ||
| 603 | unsigned capi_cmsg_header(_cmsg * cmsg, u16 _ApplId, | 603 | unsigned capi_cmsg_header(_cmsg *cmsg, u16 _ApplId, |
| 604 | u8 _Command, u8 _Subcommand, | 604 | u8 _Command, u8 _Subcommand, |
| 605 | u16 _Messagenumber, u32 _Controller) | 605 | u16 _Messagenumber, u32 _Controller) |
| 606 | { | 606 | { |
| @@ -689,54 +689,54 @@ char *capi_cmd2str(u8 cmd, u8 subcmd) · 82 unmodified lines | |||
| 689 | 689 | ||
| 690 | static char *pnames[] = | 690 | static char *pnames[] = |
| 691 | { | 691 | { |
| 692 | /*00 */ NULL, | 692 | /*00 */ NULL, |
| 693 | /*01 */ NULL, | 693 | /*01 */ NULL, |
| 694 | /*02 */ NULL, | 694 | /*02 */ NULL, |
| 695 | /*03 */ "Controller/PLCI/NCCI", | 695 | /*03 */ "Controller/PLCI/NCCI", |
| 696 | /*04 */ "AdditionalInfo", | 696 | /*04 */ "AdditionalInfo", |
| 697 | /*05 */ "B1configuration", | 697 | /*05 */ "B1configuration", |
| 698 | /*06 */ "B1protocol", | 698 | /*06 */ "B1protocol", |
| 699 | /*07 */ "B2configuration", | 699 | /*07 */ "B2configuration", |
| 700 | /*08 */ "B2protocol", | 700 | /*08 */ "B2protocol", |
| 701 | /*09 */ "B3configuration", | 701 | /*09 */ "B3configuration", |
| 702 | /*0a */ "B3protocol", | 702 | /*0a */ "B3protocol", |
| 703 | /*0b */ "BC", | 703 | /*0b */ "BC", |
| 704 | /*0c */ "BChannelinformation", | 704 | /*0c */ "BChannelinformation", |
| 705 | /*0d */ "BProtocol", | 705 | /*0d */ "BProtocol", |
| 706 | /*0e */ "CalledPartyNumber", | 706 | /*0e */ "CalledPartyNumber", |
| 707 | /*0f */ "CalledPartySubaddress", | 707 | /*0f */ "CalledPartySubaddress", |
| 708 | /*10 */ "CallingPartyNumber", | 708 | /*10 */ "CallingPartyNumber", |
| 709 | /*11 */ "CallingPartySubaddress", | 709 | /*11 */ "CallingPartySubaddress", |
| 710 | /*12 */ "CIPmask", | 710 | /*12 */ "CIPmask", |
| 711 | /*13 */ "CIPmask2", | 711 | /*13 */ "CIPmask2", |
| 712 | /*14 */ "CIPValue", | 712 | /*14 */ "CIPValue", |
| 713 | /*15 */ "Class", | 713 | /*15 */ "Class", |
| 714 | /*16 */ "ConnectedNumber", | 714 | /*16 */ "ConnectedNumber", |
| 715 | /*17 */ "ConnectedSubaddress", | 715 | /*17 */ "ConnectedSubaddress", |
| 716 | /*18 */ "Data32", | 716 | /*18 */ "Data32", |
| 717 | /*19 */ "DataHandle", | 717 | /*19 */ "DataHandle", |
| 718 | /*1a */ "DataLength", | 718 | /*1a */ "DataLength", |
| 719 | /*1b */ "FacilityConfirmationParameter", | 719 | /*1b */ "FacilityConfirmationParameter", |
| 720 | /*1c */ "Facilitydataarray", | 720 | /*1c */ "Facilitydataarray", |
| 721 | /*1d */ "FacilityIndicationParameter", | 721 | /*1d */ "FacilityIndicationParameter", |
| 722 | /*1e */ "FacilityRequestParameter", | 722 | /*1e */ "FacilityRequestParameter", |
| 723 | /*1f */ "FacilitySelector", | 723 | /*1f */ "FacilitySelector", |
| 724 | /*20 */ "Flags", | 724 | /*20 */ "Flags", |
| 725 | /*21 */ "Function", | 725 | /*21 */ "Function", |
| 726 | /*22 */ "HLC", | 726 | /*22 */ "HLC", |
| 727 | /*23 */ "Info", | 727 | /*23 */ "Info", |
| 728 | /*24 */ "InfoElement", | 728 | /*24 */ "InfoElement", |
| 729 | /*25 */ "InfoMask", | 729 | /*25 */ "InfoMask", |
| 730 | /*26 */ "InfoNumber", | 730 | /*26 */ "InfoNumber", |
| 731 | /*27 */ "Keypadfacility", | 731 | /*27 */ "Keypadfacility", |
| 732 | /*28 */ "LLC", | 732 | /*28 */ "LLC", |
| 733 | /*29 */ "ManuData", | 733 | /*29 */ "ManuData", |
| 734 | /*2a */ "ManuID", | 734 | /*2a */ "ManuID", |
| 735 | /*2b */ "NCPI", | 735 | /*2b */ "NCPI", |
| 736 | /*2c */ "Reason", | 736 | /*2c */ "Reason", |
| 737 | /*2d */ "Reason_B3", | 737 | /*2d */ "Reason_B3", |
| 738 | /*2e */ "Reject", | 738 | /*2e */ "Reject", |
| 739 | /*2f */ "Useruserdata" | 739 | /*2f */ "Useruserdata" |
| 740 | }; | 740 | }; |
| 741 | 741 | ||
| 742 | 742 | ||
| @@ -744,10 +744,10 @@ static char *pnames[] = · 1 unmodified line | |||
| 744 | #include <stdarg.h> | 744 | #include <stdarg.h> |
| 745 | 745 | ||
| 746 | /*-------------------------------------------------------*/ | 746 | /*-------------------------------------------------------*/ |
| 747 | static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt,...) | 747 | static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...) |
| 748 | { | 748 | { |
| 749 | va_list f; | 749 | va_list f; |
| 750 | size_t n,r; | 750 | size_t n, r; |
| 751 | 751 | ||
| 752 | if (!cdb) | 752 | if (!cdb) |
| 753 | return NULL; | 753 | return NULL; |
| @@ -783,7 +783,7 @@ static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt,...) · 29 unmodified lines | |||
| 783 | return cdb; | 783 | return cdb; |
| 784 | } | 784 | } |
| 785 | 785 | ||
| 786 | static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 * m, unsigned len) | 786 | static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 *m, unsigned len) |
| 787 | { | 787 | { |
| 788 | unsigned hex = 0; | 788 | unsigned hex = 0; |
| 789 | 789 | ||
| @@ -807,7 +807,7 @@ static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 * m, unsigned len) · 17 unmodified lines | |||
| 807 | return cdb; | 807 | return cdb; |
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | static _cdebbuf *printstruct(_cdebbuf *cdb, u8 * m) | 810 | static _cdebbuf *printstruct(_cdebbuf *cdb, u8 *m) |
| 811 | { | 811 | { |
| 812 | unsigned len; | 812 | unsigned len; |
| 813 | 813 | ||
| @@ -940,7 +940,7 @@ void cdebbuf_free(_cdebbuf *cdb) · 126 unmodified lines | |||
| 940 | * The returned buffer should be freed by a call to cdebbuf_free() after use. | 940 | * The returned buffer should be freed by a call to cdebbuf_free() after use. |
| 941 | */ | 941 | */ |
| 942 | 942 | ||
| 943 | _cdebbuf *capi_message2str(u8 * msg) | 943 | _cdebbuf *capi_message2str(u8 *msg) |
| 944 | { | 944 | { |
| 945 | _cdebbuf *cdb; | 945 | _cdebbuf *cdb; |
| 946 | _cmsg *cmsg; | 946 | _cmsg *cmsg; |
| @@ -964,10 +964,10 @@ _cdebbuf *capi_message2str(u8 * msg) · 17 unmodified lines | |||
| 964 | cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)]; | 964 | cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)]; |
| 965 | 965 | ||
| 966 | cdb = bufprint(cdb, "%-26s ID=%03d #0x%04x LEN=%04d\n", | 966 | cdb = bufprint(cdb, "%-26s ID=%03d #0x%04x LEN=%04d\n", |
| 967 | mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], | 967 | mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], |
| 968 | ((unsigned short *) msg)[1], | 968 | ((unsigned short *) msg)[1], |
| 969 | ((unsigned short *) msg)[3], | 969 | ((unsigned short *) msg)[3], |
| 970 | ((unsigned short *) msg)[0]); | 970 | ((unsigned short *) msg)[0]); |
| 971 | 971 | ||
| 972 | cdb = protocol_message_2_pars(cdb, cmsg, 1); | 972 | cdb = protocol_message_2_pars(cdb, cmsg, 1); |
| 973 | if (unlikely(cmsg != g_cmsg)) | 973 | if (unlikely(cmsg != g_cmsg)) |
| @@ -986,7 +986,7 @@ _cdebbuf *capi_message2str(u8 * msg) · 12 unmodified lines | |||
| 986 | * The returned buffer should be freed by a call to cdebbuf_free() after use. | 986 | * The returned buffer should be freed by a call to cdebbuf_free() after use. |
| 987 | */ | 987 | */ |
| 988 | 988 | ||
| 989 | _cdebbuf *capi_cmsg2str(_cmsg * cmsg) | 989 | _cdebbuf *capi_cmsg2str(_cmsg *cmsg) |
| 990 | { | 990 | { |
| 991 | _cdebbuf *cdb; | 991 | _cdebbuf *cdb; |
| 992 | 992 | ||
| @@ -998,17 +998,17 @@ _cdebbuf *capi_cmsg2str(_cmsg * cmsg) · 5 unmodified lines | |||
| 998 | cmsg->l = 8; | 998 | cmsg->l = 8; |
| 999 | cmsg->p = 0; | 999 | cmsg->p = 0; |
| 1000 | cdb = bufprint(cdb, "%s ID=%03d #0x%04x LEN=%04d\n", | 1000 | cdb = bufprint(cdb, "%s ID=%03d #0x%04x LEN=%04d\n", |
| 1001 | mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], | 1001 | mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], |
| 1002 | ((u16 *) cmsg->m)[1], | 1002 | ((u16 *) cmsg->m)[1], |
| 1003 | ((u16 *) cmsg->m)[3], | 1003 | ((u16 *) cmsg->m)[3], |
| 1004 | ((u16 *) cmsg->m)[0]); | 1004 | ((u16 *) cmsg->m)[0]); |
| 1005 | cdb = protocol_message_2_pars(cdb, cmsg, 1); | 1005 | cdb = protocol_message_2_pars(cdb, cmsg, 1); |
| 1006 | return cdb; | 1006 | return cdb; |
| 1007 | } | 1007 | } |
| 1008 | 1008 | ||
| 1009 | int __init cdebug_init(void) | 1009 | int __init cdebug_init(void) |
| 1010 | { | 1010 | { |
| 1011 | g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL); | 1011 | g_cmsg = kmalloc(sizeof(_cmsg), GFP_KERNEL); |
| 1012 | if (!g_cmsg) | 1012 | if (!g_cmsg) |
| 1013 | return -ENOMEM; | 1013 | return -ENOMEM; |
| 1014 | g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL); | 1014 | g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL); |
| @@ -1041,12 +1041,12 @@ void __exit cdebug_exit(void) · 26 unmodified lines | |||
| 1041 | 1041 | ||
| 1042 | static _cdebbuf g_debbuf = {"CONFIG_CAPI_TRACE not enabled", NULL, 0, 0}; | 1042 | static _cdebbuf g_debbuf = {"CONFIG_CAPI_TRACE not enabled", NULL, 0, 0}; |
| 1043 | 1043 | ||
| 1044 | _cdebbuf *capi_message2str(u8 * msg) | 1044 | _cdebbuf *capi_message2str(u8 *msg) |
| 1045 | { | 1045 | { |
| 1046 | return &g_debbuf; | 1046 | return &g_debbuf; |
| 1047 | } | 1047 | } |
| 1048 | 1048 | ||
| 1049 | _cdebbuf *capi_cmsg2str(_cmsg * cmsg) | 1049 | _cdebbuf *capi_cmsg2str(_cmsg *cmsg) |
| 1050 | { | 1050 | { |
| 1051 | return &g_debbuf; | 1051 | return &g_debbuf; |
| 1052 | } | 1052 | } |
| @@ -1,10 +1,10 @@ | |||
| 1 | /* $Id: kcapi.c,v 1.1.2.8 2004/03/26 19:57:20 armin Exp $ | 1 | /* $Id: kcapi.c,v 1.1.2.8 2004/03/26 19:57:20 armin Exp $ |
| 2 | * | 2 | * |
| 3 | * Kernel CAPI 2.0 Module | 3 | * Kernel CAPI 2.0 Module |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> | 6 | * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> |
| 7 | * | 7 | * |
| 8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
| 9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
| 10 | * | 10 | * |
| @@ -55,7 +55,7 @@ struct capictr_event { · 44 unmodified lines | |||
| 55 | 55 | ||
| 56 | /* ------------------------------------------------------------- */ | 56 | /* ------------------------------------------------------------- */ |
| 57 | 57 | ||
| 58 | static struct capi_version driver_version = {2, 0, 1, 1<<4}; | 58 | static struct capi_version driver_version = {2, 0, 1, 1 << 4}; |
| 59 | static char driver_serial[CAPI_SERIAL_LEN] = "0004711"; | 59 | static char driver_serial[CAPI_SERIAL_LEN] = "0004711"; |
| 60 | static char capi_manufakturer[64] = "AVM Berlin"; | 60 | static char capi_manufakturer[64] = "AVM Berlin"; |
| 61 | 61 | ||
| @@ -172,7 +172,7 @@ register_appl(struct capi_ctr *ctr, u16 applid, capi_register_params *rparam) · 110 unmodified lines | |||
| 172 | static void release_appl(struct capi_ctr *ctr, u16 applid) | 172 | static void release_appl(struct capi_ctr *ctr, u16 applid) |
| 173 | { | 173 | { |
| 174 | DBG("applid %#x", applid); | 174 | DBG("applid %#x", applid); |
| 175 | 175 | ||
| 176 | ctr->release_appl(ctr, applid); | 176 | ctr->release_appl(ctr, applid); |
| 177 | capi_ctr_put(ctr); | 177 | capi_ctr_put(ctr); |
| 178 | } | 178 | } |
| @@ -186,7 +186,7 @@ static void notify_up(u32 contr) · 7 unmodified lines | |||
| 186 | mutex_lock(&capi_controller_lock); | 186 | mutex_lock(&capi_controller_lock); |
| 187 | 187 | ||
| 188 | if (showcapimsgs & 1) | 188 | if (showcapimsgs & 1) |
| 189 | printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr); | 189 | printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr); |
| 190 | 190 | ||
| 191 | ctr = get_capi_ctr_by_nr(contr); | 191 | ctr = get_capi_ctr_by_nr(contr); |
| 192 | if (ctr) { | 192 | if (ctr) { |
| @@ -352,16 +352,16 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl, · 159 unmodified lines | |||
| 352 | cdb = capi_message2str(skb->data); | 352 | cdb = capi_message2str(skb->data); |
| 353 | if (cdb) { | 353 | if (cdb) { |
| 354 | printk(KERN_INFO "kcapi: controller [%03d] not active, got: %s", | 354 | printk(KERN_INFO "kcapi: controller [%03d] not active, got: %s", |
| 355 | ctr->cnr, cdb->buf); | 355 | ctr->cnr, cdb->buf); |
| 356 | cdebbuf_free(cdb); | 356 | cdebbuf_free(cdb); |
| 357 | } else | 357 | } else |
| 358 | printk(KERN_INFO "kcapi: controller [%03d] not active, cannot trace\n", | 358 | printk(KERN_INFO "kcapi: controller [%03d] not active, cannot trace\n", |
| 359 | ctr->cnr); | 359 | ctr->cnr); |
| 360 | goto error; | 360 | goto error; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | cmd = CAPIMSG_COMMAND(skb->data); | 363 | cmd = CAPIMSG_COMMAND(skb->data); |
| 364 | subcmd = CAPIMSG_SUBCOMMAND(skb->data); | 364 | subcmd = CAPIMSG_SUBCOMMAND(skb->data); |
| 365 | if (cmd == CAPI_DATA_B3 && subcmd == CAPI_IND) { | 365 | if (cmd == CAPI_DATA_B3 && subcmd == CAPI_IND) { |
| 366 | ctr->nrecvdatapkt++; | 366 | ctr->nrecvdatapkt++; |
| 367 | if (ctr->traceflag > 2) | 367 | if (ctr->traceflag > 2) |
| @@ -382,13 +382,13 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl, · 14 unmodified lines | |||
| 382 | cdb = capi_message2str(skb->data); | 382 | cdb = capi_message2str(skb->data); |
| 383 | if (cdb) { | 383 | if (cdb) { |
| 384 | printk(KERN_DEBUG "kcapi: got [%03d] %s\n", | 384 | printk(KERN_DEBUG "kcapi: got [%03d] %s\n", |
| 385 | ctr->cnr, cdb->buf); | 385 | ctr->cnr, cdb->buf); |
| 386 | cdebbuf_free(cdb); | 386 | cdebbuf_free(cdb); |
| 387 | } else | 387 | } else |
| 388 | printk(KERN_DEBUG "kcapi: got [%03d] id#%d %s len=%u, cannot trace\n", | 388 | printk(KERN_DEBUG "kcapi: got [%03d] id#%d %s len=%u, cannot trace\n", |
| 389 | ctr->cnr, CAPIMSG_APPID(skb->data), | 389 | ctr->cnr, CAPIMSG_APPID(skb->data), |
| 390 | capi_cmd2str(cmd, subcmd), | 390 | capi_cmd2str(cmd, subcmd), |
| 391 | CAPIMSG_LEN(skb->data)); | 391 | CAPIMSG_LEN(skb->data)); |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | } | 394 | } |
| @@ -400,12 +400,12 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl, · 5 unmodified lines | |||
| 400 | cdb = capi_message2str(skb->data); | 400 | cdb = capi_message2str(skb->data); |
| 401 | if (cdb) { | 401 | if (cdb) { |
| 402 | printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s)\n", | 402 | printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s)\n", |
| 403 | CAPIMSG_APPID(skb->data), cdb->buf); | 403 | CAPIMSG_APPID(skb->data), cdb->buf); |
| 404 | cdebbuf_free(cdb); | 404 | cdebbuf_free(cdb); |
| 405 | } else | 405 | } else |
| 406 | printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s) cannot trace\n", | 406 | printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s) cannot trace\n", |
| 407 | CAPIMSG_APPID(skb->data), | 407 | CAPIMSG_APPID(skb->data), |
| 408 | capi_cmd2str(cmd, subcmd)); | 408 | capi_cmd2str(cmd, subcmd)); |
| 409 | goto error; | 409 | goto error; |
| 410 | } | 410 | } |
| 411 | skb_queue_tail(&ap->recv_queue, skb); | 411 | skb_queue_tail(&ap->recv_queue, skb); |
| @@ -519,7 +519,7 @@ int attach_capi_ctr(struct capi_ctr *ctr) · 107 unmodified lines | |||
| 519 | if (i == CAPI_MAXCONTR) { | 519 | if (i == CAPI_MAXCONTR) { |
| 520 | mutex_unlock(&capi_controller_lock); | 520 | mutex_unlock(&capi_controller_lock); |
| 521 | printk(KERN_ERR "kcapi: out of controller slots\n"); | 521 | printk(KERN_ERR "kcapi: out of controller slots\n"); |
| 522 | return -EBUSY; | 522 | return -EBUSY; |
| 523 | } | 523 | } |
| 524 | capi_controller[i] = ctr; | 524 | capi_controller[i] = ctr; |
| 525 | 525 | ||
| @@ -541,7 +541,7 @@ int attach_capi_ctr(struct capi_ctr *ctr) · 15 unmodified lines | |||
| 541 | mutex_unlock(&capi_controller_lock); | 541 | mutex_unlock(&capi_controller_lock); |
| 542 | 542 | ||
| 543 | printk(KERN_NOTICE "kcapi: controller [%03d]: %s attached\n", | 543 | printk(KERN_NOTICE "kcapi: controller [%03d]: %s attached\n", |
| 544 | ctr->cnr, ctr->name); | 544 | ctr->cnr, ctr->name); |
| 545 | return 0; | 545 | return 0; |
| 546 | } | 546 | } |
| 547 | 547 | ||
| @@ -772,7 +772,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb) · 224 unmodified lines | |||
| 772 | u8 cmd, subcmd; | 772 | u8 cmd, subcmd; |
| 773 | 773 | ||
| 774 | DBG("applid %#x", ap->applid); | 774 | DBG("applid %#x", ap->applid); |
| 775 | 775 | ||
| 776 | if (ncontrollers == 0) | 776 | if (ncontrollers == 0) |
| 777 | return CAPI_REGNOTINSTALLED; | 777 | return CAPI_REGNOTINSTALLED; |
| 778 | if ((ap->applid == 0) || ap->release_in_progress) | 778 | if ((ap->applid == 0) || ap->release_in_progress) |
| @@ -794,9 +794,9 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb) · 15 unmodified lines | |||
| 794 | return CAPI_SENDQUEUEFULL; | 794 | return CAPI_SENDQUEUEFULL; |
| 795 | 795 | ||
| 796 | cmd = CAPIMSG_COMMAND(skb->data); | 796 | cmd = CAPIMSG_COMMAND(skb->data); |
| 797 | subcmd = CAPIMSG_SUBCOMMAND(skb->data); | 797 | subcmd = CAPIMSG_SUBCOMMAND(skb->data); |
| 798 | 798 | ||
| 799 | if (cmd == CAPI_DATA_B3 && subcmd== CAPI_REQ) { | 799 | if (cmd == CAPI_DATA_B3 && subcmd == CAPI_REQ) { |
| 800 | ctr->nsentdatapkt++; | 800 | ctr->nsentdatapkt++; |
| 801 | ap->nsentdatapkt++; | 801 | ap->nsentdatapkt++; |
| 802 | if (ctr->traceflag > 2) | 802 | if (ctr->traceflag > 2) |
| @@ -819,15 +819,15 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb) · 16 unmodified lines | |||
| 819 | _cdebbuf *cdb = capi_message2str(skb->data); | 819 | _cdebbuf *cdb = capi_message2str(skb->data); |
| 820 | if (cdb) { | 820 | if (cdb) { |
| 821 | printk(KERN_DEBUG "kcapi: put [%03d] %s\n", | 821 | printk(KERN_DEBUG "kcapi: put [%03d] %s\n", |
| 822 | CAPIMSG_CONTROLLER(skb->data), | 822 | CAPIMSG_CONTROLLER(skb->data), |
| 823 | cdb->buf); | 823 | cdb->buf); |
| 824 | cdebbuf_free(cdb); | 824 | cdebbuf_free(cdb); |
| 825 | } else | 825 | } else |
| 826 | printk(KERN_DEBUG "kcapi: put [%03d] id#%d %s len=%u cannot trace\n", | 826 | printk(KERN_DEBUG "kcapi: put [%03d] id#%d %s len=%u cannot trace\n", |
| 827 | CAPIMSG_CONTROLLER(skb->data), | 827 | CAPIMSG_CONTROLLER(skb->data), |
| 828 | CAPIMSG_APPID(skb->data), | 828 | CAPIMSG_APPID(skb->data), |
| 829 | capi_cmd2str(cmd, subcmd), | 829 | capi_cmd2str(cmd, subcmd), |
| 830 | CAPIMSG_LEN(skb->data)); | 830 | CAPIMSG_LEN(skb->data)); |
| 831 | } | 831 | } |
| 832 | } | 832 | } |
| 833 | return ctr->send_message(ctr, skb); | 833 | return ctr->send_message(ctr, skb); |
| @@ -1028,14 +1028,14 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data) · 194 unmodified lines | |||
| 1028 | case AVMB1_ADDCARD: | 1028 | case AVMB1_ADDCARD: |
| 1029 | case AVMB1_ADDCARD_WITH_TYPE: | 1029 | case AVMB1_ADDCARD_WITH_TYPE: |
| 1030 | if (cmd == AVMB1_ADDCARD) { | 1030 | if (cmd == AVMB1_ADDCARD) { |
| 1031 | if ((retval = copy_from_user(&cdef, data, | 1031 | if ((retval = copy_from_user(&cdef, data, |
| 1032 | sizeof(avmb1_carddef)))) | 1032 | sizeof(avmb1_carddef)))) |
| 1033 | return -EFAULT; | 1033 | return -EFAULT; |
| 1034 | cdef.cardtype = AVM_CARDTYPE_B1; | 1034 | cdef.cardtype = AVM_CARDTYPE_B1; |
| 1035 | } else { | 1035 | } else { |
| 1036 | if ((retval = copy_from_user(&cdef, data, | 1036 | if ((retval = copy_from_user(&cdef, data, |
| 1037 | sizeof(avmb1_extcarddef)))) | 1037 | sizeof(avmb1_extcarddef)))) |
| 1038 | return -EFAULT; | 1038 | return -EFAULT; |
| 1039 | } | 1039 | } |
| 1040 | cparams.port = cdef.port; | 1040 | cparams.port = cdef.port; |
| 1041 | cparams.irq = cdef.irq; | 1041 | cparams.irq = cdef.irq; |
| @@ -1043,24 +1043,24 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data) · 1 unmodified line | |||
| 1043 | 1043 | ||
| 1044 | mutex_lock(&capi_drivers_lock); | 1044 | mutex_lock(&capi_drivers_lock); |
| 1045 | 1045 | ||
| 1046 | switch (cdef.cardtype) { | 1046 | switch (cdef.cardtype) { |
| 1047 | case AVM_CARDTYPE_B1: | 1047 | case AVM_CARDTYPE_B1: |
| 1048 | list_for_each(l, &capi_drivers) { | 1048 | list_for_each(l, &capi_drivers) { |
| 1049 | driver = list_entry(l, struct capi_driver, list); | 1049 | driver = list_entry(l, struct capi_driver, list); |
| 1050 | if (strcmp(driver->name, "b1isa") == 0) | 1050 | if (strcmp(driver->name, "b1isa") == 0) |
| 1051 | break; | 1051 | break; |
| 1052 | } | 1052 | } |
| 1053 | break; | 1053 | break; |
| 1054 | case AVM_CARDTYPE_T1: | 1054 | case AVM_CARDTYPE_T1: |
| 1055 | list_for_each(l, &capi_drivers) { | 1055 | list_for_each(l, &capi_drivers) { |
| 1056 | driver = list_entry(l, struct capi_driver, list); | 1056 | driver = list_entry(l, struct capi_driver, list); |
| 1057 | if (strcmp(driver->name, "t1isa") == 0) | 1057 | if (strcmp(driver->name, "t1isa") == 0) |
| 1058 | break; | 1058 | break; |
| 1059 | } | 1059 | } |
| 1060 | break; | 1060 | break; |
| 1061 | default: | 1061 | default: |
| 1062 | driver = NULL; | 1062 | driver = NULL; |
| 1063 | break; | 1063 | break; |
| 1064 | } | 1064 | } |
| 1065 | if (!driver) { | 1065 | if (!driver) { |
| 1066 | printk(KERN_ERR "kcapi: driver not loaded.\n"); | 1066 | printk(KERN_ERR "kcapi: driver not loaded.\n"); |
| @@ -1136,7 +1136,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data) · 69 unmodified lines | |||
| 1136 | 1136 | ||
| 1137 | retval = wait_on_ctr_state(ctr, CAPI_CTR_RUNNING); | 1137 | retval = wait_on_ctr_state(ctr, CAPI_CTR_RUNNING); |
| 1138 | 1138 | ||
| 1139 | load_unlock_out: | 1139 | load_unlock_out: |
| 1140 | mutex_unlock(&capi_controller_lock); | 1140 | mutex_unlock(&capi_controller_lock); |
| 1141 | return retval; | 1141 | return retval; |
| 1142 | 1142 | ||
| @@ -1167,7 +1167,7 @@ load_unlock_out: · 24 unmodified lines | |||
| 1167 | 1167 | ||
| 1168 | retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED); | 1168 | retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED); |
| 1169 | 1169 | ||
| 1170 | reset_unlock_out: | 1170 | reset_unlock_out: |
| 1171 | mutex_unlock(&capi_controller_lock); | 1171 | mutex_unlock(&capi_controller_lock); |
| 1172 | return retval; | 1172 | return retval; |
| 1173 | } | 1173 | } |
| @@ -1235,7 +1235,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data) · 61 unmodified lines | |||
| 1235 | cparams.membase = cdef.membase; | 1235 | cparams.membase = cdef.membase; |
| 1236 | cparams.cardnr = cdef.cardnr; | 1236 | cparams.cardnr = cdef.cardnr; |
| 1237 | cparams.cardtype = 0; | 1237 | cparams.cardtype = 0; |
| 1238 | cdef.driver[sizeof(cdef.driver)-1] = 0; | 1238 | cdef.driver[sizeof(cdef.driver) - 1] = 0; |
| 1239 | 1239 | ||
| 1240 | mutex_lock(&capi_drivers_lock); | 1240 | mutex_lock(&capi_drivers_lock); |
| 1241 | 1241 | ||
| @@ -1246,7 +1246,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data) · 4 unmodified lines | |||
| 1246 | } | 1246 | } |
| 1247 | if (driver == NULL) { | 1247 | if (driver == NULL) { |
| 1248 | printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n", | 1248 | printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n", |
| 1249 | cdef.driver); | 1249 | cdef.driver); |
| 1250 | retval = -ESRCH; | 1250 | retval = -ESRCH; |
| 1251 | } else if (!driver->add_card) { | 1251 | } else if (!driver->add_card) { |
| 1252 | printk(KERN_ERR "kcapi: driver \"%s\" has no add card function.\n", cdef.driver); | 1252 | printk(KERN_ERR "kcapi: driver \"%s\" has no add card function.\n", cdef.driver); |
| @@ -1260,7 +1260,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data) · 7 unmodified lines | |||
| 1260 | 1260 | ||
| 1261 | default: | 1261 | default: |
| 1262 | printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n", | 1262 | printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n", |
| 1263 | cmd); | 1263 | cmd); |
| 1264 | break; | 1264 | break; |
| 1265 | 1265 | ||
| 1266 | } | 1266 | } |
| @@ -1305,7 +1305,7 @@ static int __init kcapi_init(void) · 38 unmodified lines | |||
| 1305 | 1305 | ||
| 1306 | static void __exit kcapi_exit(void) | 1306 | static void __exit kcapi_exit(void) |
| 1307 | { | 1307 | { |
| 1308 | kcapi_proc_exit(); | 1308 | kcapi_proc_exit(); |
| 1309 | 1309 | ||
| 1310 | unregister_capictr_notifier(&capictr_nb); | 1310 | unregister_capictr_notifier(&capictr_nb); |
| 1311 | cdebug_exit(); | 1311 | cdebug_exit(); |
| @@ -1,9 +1,9 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Kernel CAPI 2.0 Module | 2 | * Kernel CAPI 2.0 Module |
| 3 | * | 3 | * |
| 4 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 4 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 5 | * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> | 5 | * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -16,9 +16,9 @@ · 6 unmodified lines | |||
| 16 | #include <linux/isdn/capilli.h> | 16 | #include <linux/isdn/capilli.h> |
| 17 | 17 | ||
| 18 | #ifdef KCAPI_DEBUG | 18 | #ifdef KCAPI_DEBUG |
| 19 | #define DBG(format, arg...) do { \ | 19 | #define DBG(format, arg...) do { \ |
| 20 | printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ | 20 | printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ |
| 21 | } while (0) | 21 | } while (0) |
| 22 | #else | 22 | #else |
| 23 | #define DBG(format, arg...) /* */ | 23 | #define DBG(format, arg...) /* */ |
| 24 | #endif | 24 | #endif |
| @@ -49,4 +49,3 @@ static inline void kcapi_proc_init(void) { }; · 24 unmodified lines | |||
| 49 | static inline void kcapi_proc_exit(void) { }; | 49 | static inline void kcapi_proc_exit(void) { }; |
| 50 | 50 | ||
| 51 | #endif | 51 | #endif |
| 52 | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Kernel CAPI 2.0 Module - /proc/capi handling | 2 | * Kernel CAPI 2.0 Module - /proc/capi handling |
| 3 | * | 3 | * |
| 4 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 4 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 5 | * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> | 5 | * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -29,7 +29,7 @@ static char *state2str(unsigned short state) · 19 unmodified lines | |||
| 29 | // /proc/capi | 29 | // /proc/capi |
| 30 | // =========================================================================== | 30 | // =========================================================================== |
| 31 | 31 | ||
| 32 | // /proc/capi/controller: | 32 | // /proc/capi/controller: |
| 33 | // cnr driver cardstate name driverinfo | 33 | // cnr driver cardstate name driverinfo |
| 34 | // /proc/capi/contrstats: | 34 | // /proc/capi/contrstats: |
| 35 | // cnr nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt | 35 | // cnr nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt |
| @@ -85,7 +85,7 @@ static int contrstats_show(struct seq_file *seq, void *v) · 49 unmodified lines | |||
| 85 | return 0; | 85 | return 0; |
| 86 | 86 | ||
| 87 | seq_printf(seq, "%d %lu %lu %lu %lu\n", | 87 | seq_printf(seq, "%d %lu %lu %lu %lu\n", |
| 88 | ctr->cnr, | 88 | ctr->cnr, |
| 89 | ctr->nrecvctlpkt, | 89 | ctr->nrecvctlpkt, |
| 90 | ctr->nrecvdatapkt, | 90 | ctr->nrecvdatapkt, |
| 91 | ctr->nsentctlpkt, | 91 | ctr->nsentctlpkt, |
| @@ -134,9 +134,9 @@ static const struct file_operations proc_contrstats_ops = { · 42 unmodified lines | |||
| 134 | .release = seq_release, | 134 | .release = seq_release, |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | // /proc/capi/applications: | 137 | // /proc/capi/applications: |
| 138 | // applid l3cnt dblkcnt dblklen #ncci recvqueuelen | 138 | // applid l3cnt dblkcnt dblklen #ncci recvqueuelen |
| 139 | // /proc/capi/applstats: | 139 | // /proc/capi/applstats: |
| 140 | // applid nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt | 140 | // applid nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt |
| 141 | // --------------------------------------------------------------------------- | 141 | // --------------------------------------------------------------------------- |
| 142 | 142 | ||
| @@ -297,7 +297,7 @@ static const struct file_operations proc_driver_ops = { · 154 unmodified lines | |||
| 297 | 297 | ||
| 298 | // --------------------------------------------------------------------------- | 298 | // --------------------------------------------------------------------------- |
| 299 | 299 | ||
| 300 | void __init | 300 | void __init |
| 301 | kcapi_proc_init(void) | 301 | kcapi_proc_init(void) |
| 302 | { | 302 | { |
| 303 | proc_mkdir("capi", NULL); | 303 | proc_mkdir("capi", NULL); |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * Module init for DSS1 diversion services for i4l. | 3 | * Module init for DSS1 diversion services for i4l. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Werner Cornelius (werner@isdn4linux.de) | 5 | * Copyright 1999 by Werner Cornelius (werner@isdn4linux.de) |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -23,13 +23,13 @@ MODULE_LICENSE("GPL"); · 13 unmodified lines | |||
| 23 | /* structure containing interface to hl */ | 23 | /* structure containing interface to hl */ |
| 24 | /****************************************/ | 24 | /****************************************/ |
| 25 | isdn_divert_if divert_if = | 25 | isdn_divert_if divert_if = |
| 26 | { DIVERT_IF_MAGIC, /* magic value */ | 26 | { DIVERT_IF_MAGIC, /* magic value */ |
| 27 | DIVERT_CMD_REG, /* register cmd */ | 27 | DIVERT_CMD_REG, /* register cmd */ |
| 28 | ll_callback, /* callback routine from ll */ | 28 | ll_callback, /* callback routine from ll */ |
| 29 | NULL, /* command still not specified */ | 29 | NULL, /* command still not specified */ |
| 30 | NULL, /* drv_to_name */ | 30 | NULL, /* drv_to_name */ |
| 31 | NULL, /* name_to_drv */ | 31 | NULL, /* name_to_drv */ |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | /*************************/ | 34 | /*************************/ |
| 35 | /* Module interface code */ | 35 | /* Module interface code */ |
| @@ -38,17 +38,17 @@ isdn_divert_if divert_if = · 2 unmodified lines | |||
| 38 | static int __init divert_init(void) | 38 | static int __init divert_init(void) |
| 39 | { int i; | 39 | { int i; |
| 40 | 40 | ||
| 41 | if (divert_dev_init()) | 41 | if (divert_dev_init()) |
| 42 | { printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n"); | 42 | { printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n"); |
| 43 | return(-EIO); | 43 | return (-EIO); |
| 44 | } | 44 | } |
| 45 | if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) | 45 | if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) |
| 46 | { divert_dev_deinit(); | 46 | { divert_dev_deinit(); |
| 47 | printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n",i); | 47 | printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n", i); |
| 48 | return(-EIO); | 48 | return (-EIO); |
| 49 | } | 49 | } |
| 50 | printk(KERN_INFO "dss1_divert module successfully installed\n"); | 50 | printk(KERN_INFO "dss1_divert module successfully installed\n"); |
| 51 | return(0); | 51 | return (0); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /**********************/ | 54 | /**********************/ |
| @@ -56,27 +56,26 @@ static int __init divert_init(void) · 1 unmodified line | |||
| 56 | /**********************/ | 56 | /**********************/ |
| 57 | static void __exit divert_exit(void) | 57 | static void __exit divert_exit(void) |
| 58 | { | 58 | { |
| 59 | unsigned long flags; | 59 | unsigned long flags; |
| 60 | int i; | 60 | int i; |
| 61 | 61 | ||
| 62 | spin_lock_irqsave(&divert_lock, flags); | 62 | spin_lock_irqsave(&divert_lock, flags); |
| 63 | divert_if.cmd = DIVERT_CMD_REL; /* release */ | 63 | divert_if.cmd = DIVERT_CMD_REL; /* release */ |
| 64 | if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) | 64 | if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) |
| 65 | { printk(KERN_WARNING "dss1_divert: error %d releasing module\n",i); | 65 | { printk(KERN_WARNING "dss1_divert: error %d releasing module\n", i); |
| 66 | spin_unlock_irqrestore(&divert_lock, flags); | 66 | spin_unlock_irqrestore(&divert_lock, flags); |
| 67 | return; | 67 | return; |
| 68 | } | 68 | } |
| 69 | if (divert_dev_deinit()) | 69 | if (divert_dev_deinit()) |
| 70 | { printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n"); | 70 | { printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n"); |
| 71 | spin_unlock_irqrestore(&divert_lock, flags); | 71 | spin_unlock_irqrestore(&divert_lock, flags); |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| 74 | spin_unlock_irqrestore(&divert_lock, flags); | 74 | spin_unlock_irqrestore(&divert_lock, flags); |
| 75 | deleterule(-1); /* delete all rules and free mem */ | 75 | deleterule(-1); /* delete all rules and free mem */ |
| 76 | deleteprocs(); | 76 | deleteprocs(); |
| 77 | printk(KERN_INFO "dss1_divert module successfully removed \n"); | 77 | printk(KERN_INFO "dss1_divert module successfully removed \n"); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | module_init(divert_init); | 80 | module_init(divert_init); |
| 81 | module_exit(divert_exit); | 81 | module_exit(divert_exit); |
| 82 | |||
| @@ -50,10 +50,10 @@ put_info_buffer(char *cp) · 49 unmodified lines | |||
| 50 | if (!*cp) | 50 | if (!*cp) |
| 51 | return; | 51 | return; |
| 52 | if (!(ib = kmalloc(sizeof(struct divert_info) + strlen(cp), GFP_ATOMIC))) | 52 | if (!(ib = kmalloc(sizeof(struct divert_info) + strlen(cp), GFP_ATOMIC))) |
| 53 | return; /* no memory */ | 53 | return; /* no memory */ |
| 54 | strcpy(ib->info_start, cp); /* set output string */ | 54 | strcpy(ib->info_start, cp); /* set output string */ |
| 55 | ib->next = NULL; | 55 | ib->next = NULL; |
| 56 | spin_lock_irqsave( &divert_info_lock, flags ); | 56 | spin_lock_irqsave(&divert_info_lock, flags); |
| 57 | ib->usage_cnt = if_used; | 57 | ib->usage_cnt = if_used; |
| 58 | if (!divert_info_head) | 58 | if (!divert_info_head) |
| 59 | divert_info_head = ib; /* new head */ | 59 | divert_info_head = ib; /* new head */ |
| @@ -71,7 +71,7 @@ put_info_buffer(char *cp) · 11 unmodified lines | |||
| 71 | } else | 71 | } else |
| 72 | break; | 72 | break; |
| 73 | } /* divert_info_head->next */ | 73 | } /* divert_info_head->next */ |
| 74 | spin_unlock_irqrestore( &divert_info_lock, flags ); | 74 | spin_unlock_irqrestore(&divert_info_lock, flags); |
| 75 | wake_up_interruptible(&(rd_queue)); | 75 | wake_up_interruptible(&(rd_queue)); |
| 76 | } /* put_info_buffer */ | 76 | } /* put_info_buffer */ |
| 77 | 77 | ||
| @@ -81,7 +81,7 @@ put_info_buffer(char *cp) · 3 unmodified lines | |||
| 81 | /* deflection device read routine */ | 81 | /* deflection device read routine */ |
| 82 | /**********************************/ | 82 | /**********************************/ |
| 83 | static ssize_t | 83 | static ssize_t |
| 84 | isdn_divert_read(struct file *file, char __user *buf, size_t count, loff_t * off) | 84 | isdn_divert_read(struct file *file, char __user *buf, size_t count, loff_t *off) |
| 85 | { | 85 | { |
| 86 | struct divert_info *inf; | 86 | struct divert_info *inf; |
| 87 | int len; | 87 | int len; |
| @@ -109,7 +109,7 @@ isdn_divert_read(struct file *file, char __user *buf, size_t count, loff_t * off · 21 unmodified lines | |||
| 109 | /* deflection device write routine */ | 109 | /* deflection device write routine */ |
| 110 | /**********************************/ | 110 | /**********************************/ |
| 111 | static ssize_t | 111 | static ssize_t |
| 112 | isdn_divert_write(struct file *file, const char __user *buf, size_t count, loff_t * off) | 112 | isdn_divert_write(struct file *file, const char __user *buf, size_t count, loff_t *off) |
| 113 | { | 113 | { |
| 114 | return (-ENODEV); | 114 | return (-ENODEV); |
| 115 | } /* isdn_divert_write */ | 115 | } /* isdn_divert_write */ |
| @@ -119,7 +119,7 @@ isdn_divert_write(struct file *file, const char __user *buf, size_t count, loff_ · 3 unmodified lines | |||
| 119 | /* select routines for various kernels */ | 119 | /* select routines for various kernels */ |
| 120 | /***************************************/ | 120 | /***************************************/ |
| 121 | static unsigned int | 121 | static unsigned int |
| 122 | isdn_divert_poll(struct file *file, poll_table * wait) | 122 | isdn_divert_poll(struct file *file, poll_table *wait) |
| 123 | { | 123 | { |
| 124 | unsigned int mask = 0; | 124 | unsigned int mask = 0; |
| 125 | 125 | ||
| @@ -139,13 +139,13 @@ isdn_divert_open(struct inode *ino, struct file *filep) · 13 unmodified lines | |||
| 139 | { | 139 | { |
| 140 | unsigned long flags; | 140 | unsigned long flags; |
| 141 | 141 | ||
| 142 | spin_lock_irqsave( &divert_info_lock, flags ); | 142 | spin_lock_irqsave(&divert_info_lock, flags); |
| 143 | if_used++; | 143 | if_used++; |
| 144 | if (divert_info_head) | 144 | if (divert_info_head) |
| 145 | filep->private_data = &(divert_info_tail->next); | 145 | filep->private_data = &(divert_info_tail->next); |
| 146 | else | 146 | else |
| 147 | filep->private_data = &divert_info_head; | 147 | filep->private_data = &divert_info_head; |
| 148 | spin_unlock_irqrestore( &divert_info_lock, flags ); | 148 | spin_unlock_irqrestore(&divert_info_lock, flags); |
| 149 | /* start_divert(); */ | 149 | /* start_divert(); */ |
| 150 | return nonseekable_open(ino, filep); | 150 | return nonseekable_open(ino, filep); |
| 151 | } /* isdn_divert_open */ | 151 | } /* isdn_divert_open */ |
| @@ -159,7 +159,7 @@ isdn_divert_close(struct inode *ino, struct file *filep) · 7 unmodified lines | |||
| 159 | struct divert_info *inf; | 159 | struct divert_info *inf; |
| 160 | unsigned long flags; | 160 | unsigned long flags; |
| 161 | 161 | ||
| 162 | spin_lock_irqsave( &divert_info_lock, flags ); | 162 | spin_lock_irqsave(&divert_info_lock, flags); |
| 163 | if_used--; | 163 | if_used--; |
| 164 | inf = *((struct divert_info **) filep->private_data); | 164 | inf = *((struct divert_info **) filep->private_data); |
| 165 | while (inf) { | 165 | while (inf) { |
| @@ -172,7 +172,7 @@ isdn_divert_close(struct inode *ino, struct file *filep) · 6 unmodified lines | |||
| 172 | divert_info_head = divert_info_head->next; | 172 | divert_info_head = divert_info_head->next; |
| 173 | kfree(inf); | 173 | kfree(inf); |
| 174 | } | 174 | } |
| 175 | spin_unlock_irqrestore( &divert_info_lock, flags ); | 175 | spin_unlock_irqrestore(&divert_info_lock, flags); |
| 176 | return (0); | 176 | return (0); |
| 177 | } /* isdn_divert_close */ | 177 | } /* isdn_divert_close */ |
| 178 | 178 | ||
| @@ -191,75 +191,75 @@ static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg) · 12 unmodified lines | |||
| 191 | return -EFAULT; | 191 | return -EFAULT; |
| 192 | 192 | ||
| 193 | switch (cmd) { | 193 | switch (cmd) { |
| 194 | case IIOCGETVER: | 194 | case IIOCGETVER: |
| 195 | dioctl.drv_version = DIVERT_IIOC_VERSION; /* set version */ | 195 | dioctl.drv_version = DIVERT_IIOC_VERSION; /* set version */ |
| 196 | break; | 196 | break; |
| 197 | |||
| 198 | case IIOCGETDRV: | ||
| 199 | if ((dioctl.getid.drvid = divert_if.name_to_drv(dioctl.getid.drvnam)) < 0) | ||
| 200 | return (-EINVAL); | ||
| 201 | break; | ||
| 202 | |||
| 203 | case IIOCGETNAM: | ||
| 204 | cp = divert_if.drv_to_name(dioctl.getid.drvid); | ||
| 205 | if (!cp) | ||
| 206 | return (-EINVAL); | ||
| 207 | if (!*cp) | ||
| 208 | return (-EINVAL); | ||
| 209 | strcpy(dioctl.getid.drvnam, cp); | ||
| 210 | break; | ||
| 211 | |||
| 212 | case IIOCGETRULE: | ||
| 213 | if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx))) | ||
| 214 | return (-EINVAL); | ||
| 215 | dioctl.getsetrule.rule = *rulep; /* copy data */ | ||
| 216 | break; | ||
| 217 | |||
| 218 | case IIOCMODRULE: | ||
| 219 | if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx))) | ||
| 220 | return (-EINVAL); | ||
| 221 | spin_lock_irqsave(&divert_lock, flags); | ||
| 222 | *rulep = dioctl.getsetrule.rule; /* copy data */ | ||
| 223 | spin_unlock_irqrestore(&divert_lock, flags); | ||
| 224 | return (0); /* no copy required */ | ||
| 225 | break; | ||
| 226 | 197 | ||
| 227 | case IIOCINSRULE: | 198 | case IIOCGETDRV: |
| 228 | return (insertrule(dioctl.getsetrule.ruleidx, &dioctl.getsetrule.rule)); | 199 | if ((dioctl.getid.drvid = divert_if.name_to_drv(dioctl.getid.drvnam)) < 0) |
| 229 | break; | 200 | return (-EINVAL); |
| 201 | break; | ||
| 230 | 202 | ||
| 231 | case IIOCDELRULE: | 203 | case IIOCGETNAM: |
| 232 | return (deleterule(dioctl.getsetrule.ruleidx)); | 204 | cp = divert_if.drv_to_name(dioctl.getid.drvid); |
| 233 | break; | 205 | if (!cp) |
| 206 | return (-EINVAL); | ||
| 207 | if (!*cp) | ||
| 208 | return (-EINVAL); | ||
| 209 | strcpy(dioctl.getid.drvnam, cp); | ||
| 210 | break; | ||
| 234 | 211 | ||
| 235 | case IIOCDODFACT: | 212 | case IIOCGETRULE: |
| 236 | return (deflect_extern_action(dioctl.fwd_ctrl.subcmd, | 213 | if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx))) |
| 237 | dioctl.fwd_ctrl.callid, | 214 | return (-EINVAL); |
| 238 | dioctl.fwd_ctrl.to_nr)); | 215 | dioctl.getsetrule.rule = *rulep; /* copy data */ |
| 239 | 216 | break; | |
| 240 | case IIOCDOCFACT: | ||
| 241 | case IIOCDOCFDIS: | ||
| 242 | case IIOCDOCFINT: | ||
| 243 | if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid)) | ||
| 244 | return (-EINVAL); /* invalid driver */ | ||
| 245 | if (strnlen(dioctl.cf_ctrl.msn, sizeof(dioctl.cf_ctrl.msn)) == | ||
| 246 | sizeof(dioctl.cf_ctrl.msn)) | ||
| 247 | return -EINVAL; | ||
| 248 | if (strnlen(dioctl.cf_ctrl.fwd_nr, sizeof(dioctl.cf_ctrl.fwd_nr)) == | ||
| 249 | sizeof(dioctl.cf_ctrl.fwd_nr)) | ||
| 250 | return -EINVAL; | ||
| 251 | if ((i = cf_command(dioctl.cf_ctrl.drvid, | ||
| 252 | (cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2, | ||
| 253 | dioctl.cf_ctrl.cfproc, | ||
| 254 | dioctl.cf_ctrl.msn, | ||
| 255 | dioctl.cf_ctrl.service, | ||
| 256 | dioctl.cf_ctrl.fwd_nr, | ||
| 257 | &dioctl.cf_ctrl.procid))) | ||
| 258 | return (i); | ||
| 259 | break; | ||
| 260 | 217 | ||
| 261 | default: | 218 | case IIOCMODRULE: |
| 219 | if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx))) | ||
| 262 | return (-EINVAL); | 220 | return (-EINVAL); |
| 221 | spin_lock_irqsave(&divert_lock, flags); | ||
| 222 | *rulep = dioctl.getsetrule.rule; /* copy data */ | ||
| 223 | spin_unlock_irqrestore(&divert_lock, flags); | ||
| 224 | return (0); /* no copy required */ | ||
| 225 | break; | ||
| 226 | |||
| 227 | case IIOCINSRULE: | ||
| 228 | return (insertrule(dioctl.getsetrule.ruleidx, &dioctl.getsetrule.rule)); | ||
| 229 | break; | ||
| 230 | |||
| 231 | case IIOCDELRULE: | ||
| 232 | return (deleterule(dioctl.getsetrule.ruleidx)); | ||
| 233 | break; | ||
| 234 | |||
| 235 | case IIOCDODFACT: | ||
| 236 | return (deflect_extern_action(dioctl.fwd_ctrl.subcmd, | ||
| 237 | dioctl.fwd_ctrl.callid, | ||
| 238 | dioctl.fwd_ctrl.to_nr)); | ||
| 239 | |||
| 240 | case IIOCDOCFACT: | ||
| 241 | case IIOCDOCFDIS: | ||
| 242 | case IIOCDOCFINT: | ||
| 243 | if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid)) | ||
| 244 | return (-EINVAL); /* invalid driver */ | ||
| 245 | if (strnlen(dioctl.cf_ctrl.msn, sizeof(dioctl.cf_ctrl.msn)) == | ||
| 246 | sizeof(dioctl.cf_ctrl.msn)) | ||
| 247 | return -EINVAL; | ||
| 248 | if (strnlen(dioctl.cf_ctrl.fwd_nr, sizeof(dioctl.cf_ctrl.fwd_nr)) == | ||
| 249 | sizeof(dioctl.cf_ctrl.fwd_nr)) | ||
| 250 | return -EINVAL; | ||
| 251 | if ((i = cf_command(dioctl.cf_ctrl.drvid, | ||
| 252 | (cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2, | ||
| 253 | dioctl.cf_ctrl.cfproc, | ||
| 254 | dioctl.cf_ctrl.msn, | ||
| 255 | dioctl.cf_ctrl.service, | ||
| 256 | dioctl.cf_ctrl.fwd_nr, | ||
| 257 | &dioctl.cf_ctrl.procid))) | ||
| 258 | return (i); | ||
| 259 | break; | ||
| 260 | |||
| 261 | default: | ||
| 262 | return (-EINVAL); | ||
| 263 | } /* switch cmd */ | 263 | } /* switch cmd */ |
| 264 | return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0; | 264 | return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0; |
| 265 | } /* isdn_divert_ioctl */ | 265 | } /* isdn_divert_ioctl */ |
| @@ -284,7 +284,7 @@ static const struct file_operations isdn_fops = · 18 unmodified lines | |||
| 284 | .poll = isdn_divert_poll, | 284 | .poll = isdn_divert_poll, |
| 285 | .unlocked_ioctl = isdn_divert_ioctl, | 285 | .unlocked_ioctl = isdn_divert_ioctl, |
| 286 | .open = isdn_divert_open, | 286 | .open = isdn_divert_open, |
| 287 | .release = isdn_divert_close, | 287 | .release = isdn_divert_close, |
| 288 | }; | 288 | }; |
| 289 | 289 | ||
| 290 | /****************************/ | 290 | /****************************/ |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * DSS1 main diversion supplementary handling for i4l. | 3 | * DSS1 main diversion supplementary handling for i4l. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Werner Cornelius (werner@isdn4linux.de) | 5 | * Copyright 1999 by Werner Cornelius (werner@isdn4linux.de) |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -20,24 +20,24 @@ · 10 unmodified lines | |||
| 20 | /* structure keeping calling info */ | 20 | /* structure keeping calling info */ |
| 21 | /**********************************/ | 21 | /**********************************/ |
| 22 | struct call_struc | 22 | struct call_struc |
| 23 | { isdn_ctrl ics; /* delivered setup + driver parameters */ | 23 | { isdn_ctrl ics; /* delivered setup + driver parameters */ |
| 24 | ulong divert_id; /* Id delivered to user */ | 24 | ulong divert_id; /* Id delivered to user */ |
| 25 | unsigned char akt_state; /* actual state */ | 25 | unsigned char akt_state; /* actual state */ |
| 26 | char deflect_dest[35]; /* deflection destination */ | 26 | char deflect_dest[35]; /* deflection destination */ |
| 27 | struct timer_list timer; /* timer control structure */ | 27 | struct timer_list timer; /* timer control structure */ |
| 28 | char info[90]; /* device info output */ | 28 | char info[90]; /* device info output */ |
| 29 | struct call_struc *next; /* pointer to next entry */ | 29 | struct call_struc *next; /* pointer to next entry */ |
| 30 | struct call_struc *prev; | 30 | struct call_struc *prev; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | /********************************************/ | 34 | /********************************************/ |
| 35 | /* structure keeping deflection table entry */ | 35 | /* structure keeping deflection table entry */ |
| 36 | /********************************************/ | 36 | /********************************************/ |
| 37 | struct deflect_struc | 37 | struct deflect_struc |
| 38 | { struct deflect_struc *next,*prev; | 38 | { struct deflect_struc *next, *prev; |
| 39 | divert_rule rule; /* used rule */ | 39 | divert_rule rule; /* used rule */ |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | /*****************************************/ | 43 | /*****************************************/ |
| @@ -45,10 +45,10 @@ struct deflect_struc · 1 unmodified line | |||
| 45 | /*****************************************/ | 45 | /*****************************************/ |
| 46 | /* diversion/deflection processes */ | 46 | /* diversion/deflection processes */ |
| 47 | static struct call_struc *divert_head = NULL; /* head of remembered entrys */ | 47 | static struct call_struc *divert_head = NULL; /* head of remembered entrys */ |
| 48 | static ulong next_id = 1; /* next info id */ | 48 | static ulong next_id = 1; /* next info id */ |
| 49 | static struct deflect_struc *table_head = NULL; | 49 | static struct deflect_struc *table_head = NULL; |
| 50 | static struct deflect_struc *table_tail = NULL; | 50 | static struct deflect_struc *table_tail = NULL; |
| 51 | static unsigned char extern_wait_max = 4; /* maximum wait in s for external process */ | 51 | static unsigned char extern_wait_max = 4; /* maximum wait in s for external process */ |
| 52 | 52 | ||
| 53 | DEFINE_SPINLOCK(divert_lock); | 53 | DEFINE_SPINLOCK(divert_lock); |
| 54 | 54 | ||
| @@ -57,50 +57,50 @@ DEFINE_SPINLOCK(divert_lock); · 2 unmodified lines | |||
| 57 | /***************************/ | 57 | /***************************/ |
| 58 | static void deflect_timer_expire(ulong arg) | 58 | static void deflect_timer_expire(ulong arg) |
| 59 | { | 59 | { |
| 60 | unsigned long flags; | 60 | unsigned long flags; |
| 61 | struct call_struc *cs = (struct call_struc *) arg; | 61 | struct call_struc *cs = (struct call_struc *) arg; |
| 62 | 62 | ||
| 63 | spin_lock_irqsave(&divert_lock, flags); | 63 | spin_lock_irqsave(&divert_lock, flags); |
| 64 | del_timer(&cs->timer); /* delete active timer */ | 64 | del_timer(&cs->timer); /* delete active timer */ |
| 65 | spin_unlock_irqrestore(&divert_lock, flags); | 65 | spin_unlock_irqrestore(&divert_lock, flags); |
| 66 | 66 | ||
| 67 | switch(cs->akt_state) | 67 | switch (cs->akt_state) |
| 68 | { case DEFLECT_PROCEED: | 68 | { case DEFLECT_PROCEED: |
| 69 | cs->ics.command = ISDN_CMD_HANGUP; /* cancel action */ | 69 | cs->ics.command = ISDN_CMD_HANGUP; /* cancel action */ |
| 70 | divert_if.ll_cmd(&cs->ics); | 70 | divert_if.ll_cmd(&cs->ics); |
| 71 | spin_lock_irqsave(&divert_lock, flags); | 71 | spin_lock_irqsave(&divert_lock, flags); |
| 72 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ | 72 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ |
| 73 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); | 73 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); |
| 74 | add_timer(&cs->timer); | 74 | add_timer(&cs->timer); |
| 75 | spin_unlock_irqrestore(&divert_lock, flags); | 75 | spin_unlock_irqrestore(&divert_lock, flags); |
| 76 | break; | 76 | break; |
| 77 | 77 | ||
| 78 | case DEFLECT_ALERT: | 78 | case DEFLECT_ALERT: |
| 79 | cs->ics.command = ISDN_CMD_REDIR; /* protocol */ | 79 | cs->ics.command = ISDN_CMD_REDIR; /* protocol */ |
| 80 | strlcpy(cs->ics.parm.setup.phone, cs->deflect_dest, sizeof(cs->ics.parm.setup.phone)); | 80 | strlcpy(cs->ics.parm.setup.phone, cs->deflect_dest, sizeof(cs->ics.parm.setup.phone)); |
| 81 | strcpy(cs->ics.parm.setup.eazmsn,"Testtext delayed"); | 81 | strcpy(cs->ics.parm.setup.eazmsn, "Testtext delayed"); |
| 82 | divert_if.ll_cmd(&cs->ics); | 82 | divert_if.ll_cmd(&cs->ics); |
| 83 | spin_lock_irqsave(&divert_lock, flags); | 83 | spin_lock_irqsave(&divert_lock, flags); |
| 84 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ | 84 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ |
| 85 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); | 85 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); |
| 86 | add_timer(&cs->timer); | 86 | add_timer(&cs->timer); |
| 87 | spin_unlock_irqrestore(&divert_lock, flags); | 87 | spin_unlock_irqrestore(&divert_lock, flags); |
| 88 | break; | 88 | break; |
| 89 | 89 | ||
| 90 | case DEFLECT_AUTODEL: | 90 | case DEFLECT_AUTODEL: |
| 91 | default: | 91 | default: |
| 92 | spin_lock_irqsave(&divert_lock, flags); | 92 | spin_lock_irqsave(&divert_lock, flags); |
| 93 | if (cs->prev) | 93 | if (cs->prev) |
| 94 | cs->prev->next = cs->next; /* forward link */ | 94 | cs->prev->next = cs->next; /* forward link */ |
| 95 | else | 95 | else |
| 96 | divert_head = cs->next; | 96 | divert_head = cs->next; |
| 97 | if (cs->next) | 97 | if (cs->next) |
| 98 | cs->next->prev = cs->prev; /* back link */ | 98 | cs->next->prev = cs->prev; /* back link */ |
| 99 | spin_unlock_irqrestore(&divert_lock, flags); | 99 | spin_unlock_irqrestore(&divert_lock, flags); |
| 100 | kfree(cs); | 100 | kfree(cs); |
| 101 | return; | 101 | return; |
| 102 | 102 | ||
| 103 | } /* switch */ | 103 | } /* switch */ |
| 104 | } /* deflect_timer_func */ | 104 | } /* deflect_timer_func */ |
| 105 | 105 | ||
| 106 | 106 | ||
| @@ -108,94 +108,94 @@ static void deflect_timer_expire(ulong arg) · 1 unmodified line | |||
| 108 | /* handle call forwarding de/activations */ | 108 | /* handle call forwarding de/activations */ |
| 109 | /* 0 = deact, 1 = act, 2 = interrogate */ | 109 | /* 0 = deact, 1 = act, 2 = interrogate */ |
| 110 | /*****************************************/ | 110 | /*****************************************/ |
| 111 | int cf_command(int drvid, int mode, | 111 | int cf_command(int drvid, int mode, |
| 112 | u_char proc, char *msn, | 112 | u_char proc, char *msn, |
| 113 | u_char service, char *fwd_nr, ulong *procid) | 113 | u_char service, char *fwd_nr, ulong *procid) |
| 114 | { unsigned long flags; | 114 | { unsigned long flags; |
| 115 | int retval,msnlen; | 115 | int retval, msnlen; |
| 116 | int fwd_len; | 116 | int fwd_len; |
| 117 | char *p,*ielenp,tmp[60]; | 117 | char *p, *ielenp, tmp[60]; |
| 118 | struct call_struc *cs; | 118 | struct call_struc *cs; |
| 119 | 119 | ||
| 120 | if (strchr(msn,'.')) return(-EINVAL); /* subaddress not allowed in msn */ | 120 | if (strchr(msn, '.')) return (-EINVAL); /* subaddress not allowed in msn */ |
| 121 | if ((proc & 0x7F) > 2) return(-EINVAL); | 121 | if ((proc & 0x7F) > 2) return (-EINVAL); |
| 122 | proc &= 3; | 122 | proc &= 3; |
| 123 | p = tmp; | 123 | p = tmp; |
| 124 | *p++ = 0x30; /* enumeration */ | 124 | *p++ = 0x30; /* enumeration */ |
| 125 | ielenp = p++; /* remember total length position */ | 125 | ielenp = p++; /* remember total length position */ |
| 126 | *p++ = 0xa; /* proc tag */ | 126 | *p++ = 0xa; /* proc tag */ |
| 127 | *p++ = 1; /* length */ | 127 | *p++ = 1; /* length */ |
| 128 | *p++ = proc & 0x7F; /* procedure to de/activate/interrogate */ | 128 | *p++ = proc & 0x7F; /* procedure to de/activate/interrogate */ |
| 129 | *p++ = 0xa; /* service tag */ | 129 | *p++ = 0xa; /* service tag */ |
| 130 | *p++ = 1; /* length */ | 130 | *p++ = 1; /* length */ |
| 131 | *p++ = service; /* service to handle */ | 131 | *p++ = service; /* service to handle */ |
| 132 | 132 | ||
| 133 | if (mode == 1) | 133 | if (mode == 1) |
| 134 | { if (!*fwd_nr) return(-EINVAL); /* destination missing */ | 134 | { if (!*fwd_nr) return (-EINVAL); /* destination missing */ |
| 135 | if (strchr(fwd_nr,'.')) return(-EINVAL); /* subaddress not allowed */ | 135 | if (strchr(fwd_nr, '.')) return (-EINVAL); /* subaddress not allowed */ |
| 136 | fwd_len = strlen(fwd_nr); | 136 | fwd_len = strlen(fwd_nr); |
| 137 | *p++ = 0x30; /* number enumeration */ | 137 | *p++ = 0x30; /* number enumeration */ |
| 138 | *p++ = fwd_len + 2; /* complete forward to len */ | 138 | *p++ = fwd_len + 2; /* complete forward to len */ |
| 139 | *p++ = 0x80; /* fwd to nr */ | 139 | *p++ = 0x80; /* fwd to nr */ |
| 140 | *p++ = fwd_len; /* length of number */ | 140 | *p++ = fwd_len; /* length of number */ |
| 141 | strcpy(p,fwd_nr); /* copy number */ | 141 | strcpy(p, fwd_nr); /* copy number */ |
| 142 | p += fwd_len; /* pointer beyond fwd */ | 142 | p += fwd_len; /* pointer beyond fwd */ |
| 143 | } /* activate */ | 143 | } /* activate */ |
| 144 | 144 | ||
| 145 | msnlen = strlen(msn); | 145 | msnlen = strlen(msn); |
| 146 | *p++ = 0x80; /* msn number */ | 146 | *p++ = 0x80; /* msn number */ |
| 147 | if (msnlen > 1) | 147 | if (msnlen > 1) |
| 148 | { *p++ = msnlen; /* length */ | 148 | { *p++ = msnlen; /* length */ |
| 149 | strcpy(p,msn); | 149 | strcpy(p, msn); |
| 150 | p += msnlen; | 150 | p += msnlen; |
| 151 | } | 151 | } |
| 152 | else *p++ = 0; | 152 | else *p++ = 0; |
| 153 | 153 | ||
| 154 | *ielenp = p - ielenp - 1; /* set total IE length */ | 154 | *ielenp = p - ielenp - 1; /* set total IE length */ |
| 155 | 155 | ||
| 156 | /* allocate mem for information struct */ | 156 | /* allocate mem for information struct */ |
| 157 | if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) | 157 | if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) |
| 158 | return(-ENOMEM); /* no memory */ | 158 | return (-ENOMEM); /* no memory */ |
| 159 | init_timer(&cs->timer); | 159 | init_timer(&cs->timer); |
| 160 | cs->info[0] = '\0'; | 160 | cs->info[0] = '\0'; |
| 161 | cs->timer.function = deflect_timer_expire; | 161 | cs->timer.function = deflect_timer_expire; |
| 162 | cs->timer.data = (ulong) cs; /* pointer to own structure */ | 162 | cs->timer.data = (ulong) cs; /* pointer to own structure */ |
| 163 | cs->ics.driver = drvid; | 163 | cs->ics.driver = drvid; |
| 164 | cs->ics.command = ISDN_CMD_PROT_IO; /* protocol specific io */ | 164 | cs->ics.command = ISDN_CMD_PROT_IO; /* protocol specific io */ |
| 165 | cs->ics.arg = DSS1_CMD_INVOKE; /* invoke supplementary service */ | 165 | cs->ics.arg = DSS1_CMD_INVOKE; /* invoke supplementary service */ |
| 166 | cs->ics.parm.dss1_io.proc = (mode == 1) ? 7: (mode == 2) ? 11:8; /* operation */ | 166 | cs->ics.parm.dss1_io.proc = (mode == 1) ? 7 : (mode == 2) ? 11 : 8; /* operation */ |
| 167 | cs->ics.parm.dss1_io.timeout = 4000; /* from ETS 300 207-1 */ | 167 | cs->ics.parm.dss1_io.timeout = 4000; /* from ETS 300 207-1 */ |
| 168 | cs->ics.parm.dss1_io.datalen = p - tmp; /* total len */ | 168 | cs->ics.parm.dss1_io.datalen = p - tmp; /* total len */ |
| 169 | cs->ics.parm.dss1_io.data = tmp; /* start of buffer */ | 169 | cs->ics.parm.dss1_io.data = tmp; /* start of buffer */ |
| 170 | 170 | ||
| 171 | spin_lock_irqsave(&divert_lock, flags); | 171 | spin_lock_irqsave(&divert_lock, flags); |
| 172 | cs->ics.parm.dss1_io.ll_id = next_id++; /* id for callback */ | 172 | cs->ics.parm.dss1_io.ll_id = next_id++; /* id for callback */ |
| 173 | spin_unlock_irqrestore(&divert_lock, flags); | 173 | spin_unlock_irqrestore(&divert_lock, flags); |
| 174 | *procid = cs->ics.parm.dss1_io.ll_id; | 174 | *procid = cs->ics.parm.dss1_io.ll_id; |
| 175 | 175 | ||
| 176 | sprintf(cs->info,"%d 0x%lx %s%s 0 %s %02x %d%s%s\n", | 176 | sprintf(cs->info, "%d 0x%lx %s%s 0 %s %02x %d%s%s\n", |
| 177 | (!mode ) ? DIVERT_DEACTIVATE : (mode == 1) ? DIVERT_ACTIVATE : DIVERT_REPORT, | 177 | (!mode) ? DIVERT_DEACTIVATE : (mode == 1) ? DIVERT_ACTIVATE : DIVERT_REPORT, |
| 178 | cs->ics.parm.dss1_io.ll_id, | 178 | cs->ics.parm.dss1_io.ll_id, |
| 179 | (mode != 2) ? "" : "0 ", | 179 | (mode != 2) ? "" : "0 ", |
| 180 | divert_if.drv_to_name(cs->ics.driver), | 180 | divert_if.drv_to_name(cs->ics.driver), |
| 181 | msn, | 181 | msn, |
| 182 | service & 0xFF, | 182 | service & 0xFF, |
| 183 | proc, | 183 | proc, |
| 184 | (mode != 1) ? "" : " 0 ", | 184 | (mode != 1) ? "" : " 0 ", |
| 185 | (mode != 1) ? "" : fwd_nr); | 185 | (mode != 1) ? "" : fwd_nr); |
| 186 | 186 | ||
| 187 | retval = divert_if.ll_cmd(&cs->ics); /* execute command */ | 187 | retval = divert_if.ll_cmd(&cs->ics); /* execute command */ |
| 188 | 188 | ||
| 189 | if (!retval) | 189 | if (!retval) |
| 190 | { cs->prev = NULL; | 190 | { cs->prev = NULL; |
| 191 | spin_lock_irqsave(&divert_lock, flags); | 191 | spin_lock_irqsave(&divert_lock, flags); |
| 192 | cs->next = divert_head; | 192 | cs->next = divert_head; |
| 193 | divert_head = cs; | 193 | divert_head = cs; |
| 194 | spin_unlock_irqrestore(&divert_lock, flags); | 194 | spin_unlock_irqrestore(&divert_lock, flags); |
| 195 | } | 195 | } |
| 196 | else | 196 | else |
| 197 | kfree(cs); | 197 | kfree(cs); |
| 198 | return(retval); | 198 | return (retval); |
| 199 | } /* cf_command */ | 199 | } /* cf_command */ |
| 200 | 200 | ||
| 201 | 201 | ||
| @@ -204,165 +204,165 @@ int cf_command(int drvid, int mode, · 2 unmodified lines | |||
| 204 | /****************************************/ | 204 | /****************************************/ |
| 205 | int deflect_extern_action(u_char cmd, ulong callid, char *to_nr) | 205 | int deflect_extern_action(u_char cmd, ulong callid, char *to_nr) |
| 206 | { struct call_struc *cs; | 206 | { struct call_struc *cs; |
| 207 | isdn_ctrl ic; | 207 | isdn_ctrl ic; |
| 208 | unsigned long flags; | 208 | unsigned long flags; |
| 209 | int i; | 209 | int i; |
| 210 | 210 | ||
| 211 | if ((cmd & 0x7F) > 2) return(-EINVAL); /* invalid command */ | 211 | if ((cmd & 0x7F) > 2) return (-EINVAL); /* invalid command */ |
| 212 | cs = divert_head; /* start of parameter list */ | 212 | cs = divert_head; /* start of parameter list */ |
| 213 | while (cs) | 213 | while (cs) |
| 214 | { if (cs->divert_id == callid) break; /* found */ | 214 | { if (cs->divert_id == callid) break; /* found */ |
| 215 | cs = cs->next; | 215 | cs = cs->next; |
| 216 | } /* search entry */ | 216 | } /* search entry */ |
| 217 | if (!cs) return(-EINVAL); /* invalid callid */ | 217 | if (!cs) return (-EINVAL); /* invalid callid */ |
| 218 | 218 | ||
| 219 | ic.driver = cs->ics.driver; | 219 | ic.driver = cs->ics.driver; |
| 220 | ic.arg = cs->ics.arg; | 220 | ic.arg = cs->ics.arg; |
| 221 | i = -EINVAL; | 221 | i = -EINVAL; |
| 222 | if (cs->akt_state == DEFLECT_AUTODEL) return(i); /* no valid call */ | 222 | if (cs->akt_state == DEFLECT_AUTODEL) return (i); /* no valid call */ |
| 223 | switch (cmd & 0x7F) | 223 | switch (cmd & 0x7F) |
| 224 | { case 0: /* hangup */ | 224 | { case 0: /* hangup */ |
| 225 | del_timer(&cs->timer); | 225 | del_timer(&cs->timer); |
| 226 | ic.command = ISDN_CMD_HANGUP; | 226 | ic.command = ISDN_CMD_HANGUP; |
| 227 | i = divert_if.ll_cmd(&ic); | 227 | i = divert_if.ll_cmd(&ic); |
| 228 | spin_lock_irqsave(&divert_lock, flags); | 228 | spin_lock_irqsave(&divert_lock, flags); |
| 229 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ | 229 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ |
| 230 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); | 230 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); |
| 231 | add_timer(&cs->timer); | 231 | add_timer(&cs->timer); |
| 232 | spin_unlock_irqrestore(&divert_lock, flags); | 232 | spin_unlock_irqrestore(&divert_lock, flags); |
| 233 | break; | 233 | break; |
| 234 | 234 | ||
| 235 | case 1: /* alert */ | 235 | case 1: /* alert */ |
| 236 | if (cs->akt_state == DEFLECT_ALERT) return(0); | 236 | if (cs->akt_state == DEFLECT_ALERT) return (0); |
| 237 | cmd &= 0x7F; /* never wait */ | 237 | cmd &= 0x7F; /* never wait */ |
| 238 | del_timer(&cs->timer); | 238 | del_timer(&cs->timer); |
| 239 | ic.command = ISDN_CMD_ALERT; | 239 | ic.command = ISDN_CMD_ALERT; |
| 240 | if ((i = divert_if.ll_cmd(&ic))) | 240 | if ((i = divert_if.ll_cmd(&ic))) |
| 241 | { | 241 | { |
| 242 | spin_lock_irqsave(&divert_lock, flags); | 242 | spin_lock_irqsave(&divert_lock, flags); |
| 243 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ | 243 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ |
| 244 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); | 244 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); |
| 245 | add_timer(&cs->timer); | 245 | add_timer(&cs->timer); |
| 246 | spin_unlock_irqrestore(&divert_lock, flags); | 246 | spin_unlock_irqrestore(&divert_lock, flags); |
| 247 | } | 247 | } |
| 248 | else | 248 | else |
| 249 | cs->akt_state = DEFLECT_ALERT; | 249 | cs->akt_state = DEFLECT_ALERT; |
| 250 | break; | 250 | break; |
| 251 | 251 | ||
| 252 | case 2: /* redir */ | 252 | case 2: /* redir */ |
| 253 | del_timer(&cs->timer); | 253 | del_timer(&cs->timer); |
| 254 | strlcpy(cs->ics.parm.setup.phone, to_nr, sizeof(cs->ics.parm.setup.phone)); | 254 | strlcpy(cs->ics.parm.setup.phone, to_nr, sizeof(cs->ics.parm.setup.phone)); |
| 255 | strcpy(cs->ics.parm.setup.eazmsn, "Testtext manual"); | 255 | strcpy(cs->ics.parm.setup.eazmsn, "Testtext manual"); |
| 256 | ic.command = ISDN_CMD_REDIR; | 256 | ic.command = ISDN_CMD_REDIR; |
| 257 | if ((i = divert_if.ll_cmd(&ic))) | 257 | if ((i = divert_if.ll_cmd(&ic))) |
| 258 | { | 258 | { |
| 259 | spin_lock_irqsave(&divert_lock, flags); | 259 | spin_lock_irqsave(&divert_lock, flags); |
| 260 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ | 260 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ |
| 261 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); | 261 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); |
| 262 | add_timer(&cs->timer); | 262 | add_timer(&cs->timer); |
| 263 | spin_unlock_irqrestore(&divert_lock, flags); | 263 | spin_unlock_irqrestore(&divert_lock, flags); |
| 264 | } | 264 | } |
| 265 | else | 265 | else |
| 266 | cs->akt_state = DEFLECT_ALERT; | 266 | cs->akt_state = DEFLECT_ALERT; |
| 267 | break; | 267 | break; |
| 268 | 268 | ||
| 269 | } /* switch */ | 269 | } /* switch */ |
| 270 | return(i); | 270 | return (i); |
| 271 | } /* deflect_extern_action */ | 271 | } /* deflect_extern_action */ |
| 272 | 272 | ||
| 273 | /********************************/ | 273 | /********************************/ |
| 274 | /* insert a new rule before idx */ | 274 | /* insert a new rule before idx */ |
| 275 | /********************************/ | 275 | /********************************/ |
| 276 | int insertrule(int idx, divert_rule *newrule) | 276 | int insertrule(int idx, divert_rule *newrule) |
| 277 | { struct deflect_struc *ds,*ds1=NULL; | 277 | { struct deflect_struc *ds, *ds1 = NULL; |
| 278 | unsigned long flags; | 278 | unsigned long flags; |
| 279 | 279 | ||
| 280 | if (!(ds = kmalloc(sizeof(struct deflect_struc), | 280 | if (!(ds = kmalloc(sizeof(struct deflect_struc), |
| 281 | GFP_KERNEL))) | 281 | GFP_KERNEL))) |
| 282 | return(-ENOMEM); /* no memory */ | 282 | return (-ENOMEM); /* no memory */ |
| 283 | 283 | ||
| 284 | ds->rule = *newrule; /* set rule */ | 284 | ds->rule = *newrule; /* set rule */ |
| 285 | 285 | ||
| 286 | spin_lock_irqsave(&divert_lock, flags); | 286 | spin_lock_irqsave(&divert_lock, flags); |
| 287 | 287 | ||
| 288 | if (idx >= 0) | 288 | if (idx >= 0) |
| 289 | { ds1 = table_head; | 289 | { ds1 = table_head; |
| 290 | while ((ds1) && (idx > 0)) | 290 | while ((ds1) && (idx > 0)) |
| 291 | { idx--; | 291 | { idx--; |
| 292 | ds1 = ds1->next; | 292 | ds1 = ds1->next; |
| 293 | } | 293 | } |
| 294 | if (!ds1) idx = -1; | 294 | if (!ds1) idx = -1; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | if (idx < 0) | 297 | if (idx < 0) |
| 298 | { ds->prev = table_tail; /* previous entry */ | 298 | { ds->prev = table_tail; /* previous entry */ |
| 299 | ds->next = NULL; /* end of chain */ | 299 | ds->next = NULL; /* end of chain */ |
| 300 | if (ds->prev) | 300 | if (ds->prev) |
| 301 | ds->prev->next = ds; /* last forward */ | 301 | ds->prev->next = ds; /* last forward */ |
| 302 | else | 302 | else |
| 303 | table_head = ds; /* is first entry */ | 303 | table_head = ds; /* is first entry */ |
| 304 | table_tail = ds; /* end of queue */ | 304 | table_tail = ds; /* end of queue */ |
| 305 | } | 305 | } |
| 306 | else | 306 | else |
| 307 | { ds->next = ds1; /* next entry */ | 307 | { ds->next = ds1; /* next entry */ |
| 308 | ds->prev = ds1->prev; /* prev entry */ | 308 | ds->prev = ds1->prev; /* prev entry */ |
| 309 | ds1->prev = ds; /* backward chain old element */ | 309 | ds1->prev = ds; /* backward chain old element */ |
| 310 | if (!ds->prev) | 310 | if (!ds->prev) |
| 311 | table_head = ds; /* first element */ | 311 | table_head = ds; /* first element */ |
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | spin_unlock_irqrestore(&divert_lock, flags); | 314 | spin_unlock_irqrestore(&divert_lock, flags); |
| 315 | return(0); | 315 | return (0); |
| 316 | } /* insertrule */ | 316 | } /* insertrule */ |
| 317 | 317 | ||
| 318 | /***********************************/ | 318 | /***********************************/ |
| 319 | /* delete the rule at position idx */ | 319 | /* delete the rule at position idx */ |
| 320 | /***********************************/ | 320 | /***********************************/ |
| 321 | int deleterule(int idx) | 321 | int deleterule(int idx) |
| 322 | { struct deflect_struc *ds,*ds1; | 322 | { struct deflect_struc *ds, *ds1; |
| 323 | unsigned long flags; | 323 | unsigned long flags; |
| 324 | 324 | ||
| 325 | if (idx < 0) | 325 | if (idx < 0) |
| 326 | { spin_lock_irqsave(&divert_lock, flags); | 326 | { spin_lock_irqsave(&divert_lock, flags); |
| 327 | ds = table_head; | 327 | ds = table_head; |
| 328 | table_head = NULL; | 328 | table_head = NULL; |
| 329 | table_tail = NULL; | 329 | table_tail = NULL; |
| 330 | spin_unlock_irqrestore(&divert_lock, flags); | 330 | spin_unlock_irqrestore(&divert_lock, flags); |
| 331 | while (ds) | 331 | while (ds) |
| 332 | { ds1 = ds; | 332 | { ds1 = ds; |
| 333 | ds = ds->next; | 333 | ds = ds->next; |
| 334 | kfree(ds1); | 334 | kfree(ds1); |
| 335 | } | 335 | } |
| 336 | return(0); | 336 | return (0); |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | spin_lock_irqsave(&divert_lock, flags); | 339 | spin_lock_irqsave(&divert_lock, flags); |
| 340 | ds = table_head; | 340 | ds = table_head; |
| 341 | 341 | ||
| 342 | while ((ds) && (idx > 0)) | 342 | while ((ds) && (idx > 0)) |
| 343 | { idx--; | 343 | { idx--; |
| 344 | ds = ds->next; | 344 | ds = ds->next; |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | if (!ds) | 347 | if (!ds) |
| 348 | { | 348 | { |
| 349 | spin_unlock_irqrestore(&divert_lock, flags); | 349 | spin_unlock_irqrestore(&divert_lock, flags); |
| 350 | return(-EINVAL); | 350 | return (-EINVAL); |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | if (ds->next) | 353 | if (ds->next) |
| 354 | ds->next->prev = ds->prev; /* backward chain */ | 354 | ds->next->prev = ds->prev; /* backward chain */ |
| 355 | else | 355 | else |
| 356 | table_tail = ds->prev; /* end of chain */ | 356 | table_tail = ds->prev; /* end of chain */ |
| 357 | 357 | ||
| 358 | if (ds->prev) | 358 | if (ds->prev) |
| 359 | ds->prev->next = ds->next; /* forward chain */ | 359 | ds->prev->next = ds->next; /* forward chain */ |
| 360 | else | 360 | else |
| 361 | table_head = ds->next; /* start of chain */ | 361 | table_head = ds->next; /* start of chain */ |
| 362 | 362 | ||
| 363 | spin_unlock_irqrestore(&divert_lock, flags); | 363 | spin_unlock_irqrestore(&divert_lock, flags); |
| 364 | kfree(ds); | 364 | kfree(ds); |
| 365 | return(0); | 365 | return (0); |
| 366 | } /* deleterule */ | 366 | } /* deleterule */ |
| 367 | 367 | ||
| 368 | /*******************************************/ | 368 | /*******************************************/ |
| @@ -370,16 +370,16 @@ int deleterule(int idx) · 1 unmodified line | |||
| 370 | /*******************************************/ | 370 | /*******************************************/ |
| 371 | divert_rule *getruleptr(int idx) | 371 | divert_rule *getruleptr(int idx) |
| 372 | { struct deflect_struc *ds = table_head; | 372 | { struct deflect_struc *ds = table_head; |
| 373 | 373 | ||
| 374 | if (idx < 0) return(NULL); | 374 | if (idx < 0) return (NULL); |
| 375 | while ((ds) && (idx >= 0)) | 375 | while ((ds) && (idx >= 0)) |
| 376 | { if (!(idx--)) | 376 | { if (!(idx--)) |
| 377 | { return(&ds->rule); | 377 | { return (&ds->rule); |
| 378 | break; | 378 | break; |
| 379 | } | 379 | } |
| 380 | ds = ds->next; | 380 | ds = ds->next; |
| 381 | } | 381 | } |
| 382 | return(NULL); | 382 | return (NULL); |
| 383 | } /* getruleptr */ | 383 | } /* getruleptr */ |
| 384 | 384 | ||
| 385 | /*************************************************/ | 385 | /*************************************************/ |
| @@ -387,168 +387,168 @@ divert_rule *getruleptr(int idx) · 1 unmodified line | |||
| 387 | /*************************************************/ | 387 | /*************************************************/ |
| 388 | static int isdn_divert_icall(isdn_ctrl *ic) | 388 | static int isdn_divert_icall(isdn_ctrl *ic) |
| 389 | { int retval = 0; | 389 | { int retval = 0; |
| 390 | unsigned long flags; | 390 | unsigned long flags; |
| 391 | struct call_struc *cs = NULL; | 391 | struct call_struc *cs = NULL; |
| 392 | struct deflect_struc *dv; | 392 | struct deflect_struc *dv; |
| 393 | char *p,*p1; | 393 | char *p, *p1; |
| 394 | u_char accept; | 394 | u_char accept; |
| 395 | 395 | ||
| 396 | /* first check the internal deflection table */ | 396 | /* first check the internal deflection table */ |
| 397 | for (dv = table_head; dv ; dv = dv->next ) | 397 | for (dv = table_head; dv; dv = dv->next) |
| 398 | { /* scan table */ | 398 | { /* scan table */ |
| 399 | if (((dv->rule.callopt == 1) && (ic->command == ISDN_STAT_ICALLW)) || | 399 | if (((dv->rule.callopt == 1) && (ic->command == ISDN_STAT_ICALLW)) || |
| 400 | ((dv->rule.callopt == 2) && (ic->command == ISDN_STAT_ICALL))) | 400 | ((dv->rule.callopt == 2) && (ic->command == ISDN_STAT_ICALL))) |
| 401 | continue; /* call option check */ | 401 | continue; /* call option check */ |
| 402 | if (!(dv->rule.drvid & (1L << ic->driver))) | 402 | if (!(dv->rule.drvid & (1L << ic->driver))) |
| 403 | continue; /* driver not matching */ | 403 | continue; /* driver not matching */ |
| 404 | if ((dv->rule.si1) && (dv->rule.si1 != ic->parm.setup.si1)) | 404 | if ((dv->rule.si1) && (dv->rule.si1 != ic->parm.setup.si1)) |
| 405 | continue; /* si1 not matching */ | 405 | continue; /* si1 not matching */ |
| 406 | if ((dv->rule.si2) && (dv->rule.si2 != ic->parm.setup.si2)) | 406 | if ((dv->rule.si2) && (dv->rule.si2 != ic->parm.setup.si2)) |
| 407 | continue; /* si2 not matching */ | 407 | continue; /* si2 not matching */ |
| 408 | 408 | ||
| 409 | p = dv->rule.my_msn; | 409 | p = dv->rule.my_msn; |
| 410 | p1 = ic->parm.setup.eazmsn; | 410 | p1 = ic->parm.setup.eazmsn; |
| 411 | accept = 0; | 411 | accept = 0; |
| 412 | while (*p) | 412 | while (*p) |
| 413 | { /* complete compare */ | 413 | { /* complete compare */ |
| 414 | if (*p == '-') | 414 | if (*p == '-') |
| 415 | { accept = 1; /* call accepted */ | 415 | { accept = 1; /* call accepted */ |
| 416 | break; | 416 | break; |
| 417 | } | 417 | } |
| 418 | if (*p++ != *p1++) | 418 | if (*p++ != *p1++) |
| 419 | break; /* not accepted */ | 419 | break; /* not accepted */ |
| 420 | if ((!*p) && (!*p1)) | 420 | if ((!*p) && (!*p1)) |
| 421 | accept = 1; | 421 | accept = 1; |
| 422 | } /* complete compare */ | 422 | } /* complete compare */ |
| 423 | if (!accept) continue; /* not accepted */ | 423 | if (!accept) continue; /* not accepted */ |
| 424 | 424 | ||
| 425 | if ((strcmp(dv->rule.caller,"0")) || (ic->parm.setup.phone[0])) | 425 | if ((strcmp(dv->rule.caller, "0")) || (ic->parm.setup.phone[0])) |
| 426 | { p = dv->rule.caller; | 426 | { p = dv->rule.caller; |
| 427 | p1 = ic->parm.setup.phone; | 427 | p1 = ic->parm.setup.phone; |
| 428 | accept = 0; | 428 | accept = 0; |
| 429 | while (*p) | 429 | while (*p) |
| 430 | { /* complete compare */ | 430 | { /* complete compare */ |
| 431 | if (*p == '-') | 431 | if (*p == '-') |
| 432 | { accept = 1; /* call accepted */ | 432 | { accept = 1; /* call accepted */ |
| 433 | break; | 433 | break; |
| 434 | } | 434 | } |
| 435 | if (*p++ != *p1++) | 435 | if (*p++ != *p1++) |
| 436 | break; /* not accepted */ | 436 | break; /* not accepted */ |
| 437 | if ((!*p) && (!*p1)) | 437 | if ((!*p) && (!*p1)) |
| 438 | accept = 1; | 438 | accept = 1; |
| 439 | } /* complete compare */ | 439 | } /* complete compare */ |
| 440 | if (!accept) continue; /* not accepted */ | 440 | if (!accept) continue; /* not accepted */ |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | switch (dv->rule.action) | 443 | switch (dv->rule.action) |
| 444 | { case DEFLECT_IGNORE: | 444 | { case DEFLECT_IGNORE: |
| 445 | return(0); | 445 | return (0); |
| 446 | break; | 446 | break; |
| 447 | 447 | ||
| 448 | case DEFLECT_ALERT: | 448 | case DEFLECT_ALERT: |
| 449 | case DEFLECT_PROCEED: | 449 | case DEFLECT_PROCEED: |
| 450 | case DEFLECT_REPORT: | 450 | case DEFLECT_REPORT: |
| 451 | case DEFLECT_REJECT: | 451 | case DEFLECT_REJECT: |
| 452 | if (dv->rule.action == DEFLECT_PROCEED) | 452 | if (dv->rule.action == DEFLECT_PROCEED) |
| 453 | if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime))) | 453 | if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime))) |
| 454 | return(0); /* no external deflection needed */ | 454 | return (0); /* no external deflection needed */ |
| 455 | if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) | 455 | if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) |
| 456 | return(0); /* no memory */ | 456 | return (0); /* no memory */ |
| 457 | init_timer(&cs->timer); | 457 | init_timer(&cs->timer); |
| 458 | cs->info[0] = '\0'; | 458 | cs->info[0] = '\0'; |
| 459 | cs->timer.function = deflect_timer_expire; | 459 | cs->timer.function = deflect_timer_expire; |
| 460 | cs->timer.data = (ulong) cs; /* pointer to own structure */ | 460 | cs->timer.data = (ulong) cs; /* pointer to own structure */ |
| 461 | 461 | ||
| 462 | cs->ics = *ic; /* copy incoming data */ | 462 | cs->ics = *ic; /* copy incoming data */ |
| 463 | if (!cs->ics.parm.setup.phone[0]) strcpy(cs->ics.parm.setup.phone,"0"); | 463 | if (!cs->ics.parm.setup.phone[0]) strcpy(cs->ics.parm.setup.phone, "0"); |
| 464 | if (!cs->ics.parm.setup.eazmsn[0]) strcpy(cs->ics.parm.setup.eazmsn,"0"); | 464 | if (!cs->ics.parm.setup.eazmsn[0]) strcpy(cs->ics.parm.setup.eazmsn, "0"); |
| 465 | cs->ics.parm.setup.screen = dv->rule.screen; | 465 | cs->ics.parm.setup.screen = dv->rule.screen; |
| 466 | if (dv->rule.waittime) | 466 | if (dv->rule.waittime) |
| 467 | cs->timer.expires = jiffies + (HZ * dv->rule.waittime); | 467 | cs->timer.expires = jiffies + (HZ * dv->rule.waittime); |
| 468 | else | 468 | else |
| 469 | if (dv->rule.action == DEFLECT_PROCEED) | 469 | if (dv->rule.action == DEFLECT_PROCEED) |
| 470 | cs->timer.expires = jiffies + (HZ * extern_wait_max); | 470 | cs->timer.expires = jiffies + (HZ * extern_wait_max); |
| 471 | else | 471 | else |
| 472 | cs->timer.expires = 0; | 472 | cs->timer.expires = 0; |
| 473 | cs->akt_state = dv->rule.action; | 473 | cs->akt_state = dv->rule.action; |
| 474 | spin_lock_irqsave(&divert_lock, flags); | 474 | spin_lock_irqsave(&divert_lock, flags); |
| 475 | cs->divert_id = next_id++; /* new sequence number */ | 475 | cs->divert_id = next_id++; /* new sequence number */ |
| 476 | spin_unlock_irqrestore(&divert_lock, flags); | 476 | spin_unlock_irqrestore(&divert_lock, flags); |
| 477 | cs->prev = NULL; | 477 | cs->prev = NULL; |
| 478 | if (cs->akt_state == DEFLECT_ALERT) | 478 | if (cs->akt_state == DEFLECT_ALERT) |
| 479 | { strcpy(cs->deflect_dest,dv->rule.to_nr); | 479 | { strcpy(cs->deflect_dest, dv->rule.to_nr); |
| 480 | if (!cs->timer.expires) | 480 | if (!cs->timer.expires) |
| 481 | { strcpy(ic->parm.setup.eazmsn,"Testtext direct"); | 481 | { strcpy(ic->parm.setup.eazmsn, "Testtext direct"); |
| 482 | ic->parm.setup.screen = dv->rule.screen; | 482 | ic->parm.setup.screen = dv->rule.screen; |
| 483 | strlcpy(ic->parm.setup.phone, dv->rule.to_nr, sizeof(ic->parm.setup.phone)); | 483 | strlcpy(ic->parm.setup.phone, dv->rule.to_nr, sizeof(ic->parm.setup.phone)); |
| 484 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ | 484 | cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ |
| 485 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); | 485 | cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); |
| 486 | retval = 5; | 486 | retval = 5; |
| 487 | } | 487 | } |
| 488 | else | 488 | else |
| 489 | retval = 1; /* alerting */ | 489 | retval = 1; /* alerting */ |
| 490 | } | 490 | } |
| 491 | else | 491 | else |
| 492 | { cs->deflect_dest[0] = '\0'; | 492 | { cs->deflect_dest[0] = '\0'; |
| 493 | retval = 4; /* only proceed */ | 493 | retval = 4; /* only proceed */ |
| 494 | } | 494 | } |
| 495 | sprintf(cs->info,"%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n", | 495 | sprintf(cs->info, "%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n", |
| 496 | cs->akt_state, | 496 | cs->akt_state, |
| 497 | cs->divert_id, | 497 | cs->divert_id, |
| 498 | divert_if.drv_to_name(cs->ics.driver), | 498 | divert_if.drv_to_name(cs->ics.driver), |
| 499 | (ic->command == ISDN_STAT_ICALLW) ? "1":"0", | 499 | (ic->command == ISDN_STAT_ICALLW) ? "1" : "0", |
| 500 | cs->ics.parm.setup.phone, | 500 | cs->ics.parm.setup.phone, |
| 501 | cs->ics.parm.setup.eazmsn, | 501 | cs->ics.parm.setup.eazmsn, |
| 502 | cs->ics.parm.setup.si1, | 502 | cs->ics.parm.setup.si1, |
| 503 | cs->ics.parm.setup.si2, | 503 | cs->ics.parm.setup.si2, |
| 504 | cs->ics.parm.setup.screen, | 504 | cs->ics.parm.setup.screen, |
| 505 | dv->rule.waittime, | 505 | dv->rule.waittime, |
| 506 | cs->deflect_dest); | 506 | cs->deflect_dest); |
| 507 | if ((dv->rule.action == DEFLECT_REPORT) || | 507 | if ((dv->rule.action == DEFLECT_REPORT) || |
| 508 | (dv->rule.action == DEFLECT_REJECT)) | 508 | (dv->rule.action == DEFLECT_REJECT)) |
| 509 | { put_info_buffer(cs->info); | 509 | { put_info_buffer(cs->info); |
| 510 | kfree(cs); /* remove */ | 510 | kfree(cs); /* remove */ |
| 511 | return((dv->rule.action == DEFLECT_REPORT) ? 0:2); /* nothing to do */ | 511 | return ((dv->rule.action == DEFLECT_REPORT) ? 0 : 2); /* nothing to do */ |
| 512 | } | 512 | } |
| 513 | break; | 513 | break; |
| 514 | 514 | ||
| 515 | default: | 515 | default: |
| 516 | return(0); /* ignore call */ | 516 | return (0); /* ignore call */ |
| 517 | break; | 517 | break; |
| 518 | } /* switch action */ | 518 | } /* switch action */ |
| 519 | break; | 519 | break; |
| 520 | } /* scan_table */ | 520 | } /* scan_table */ |
| 521 | 521 | ||
| 522 | if (cs) | 522 | if (cs) |
| 523 | { cs->prev = NULL; | 523 | { cs->prev = NULL; |
| 524 | spin_lock_irqsave(&divert_lock, flags); | 524 | spin_lock_irqsave(&divert_lock, flags); |
| 525 | cs->next = divert_head; | 525 | cs->next = divert_head; |
| 526 | divert_head = cs; | 526 | divert_head = cs; |
| 527 | if (cs->timer.expires) add_timer(&cs->timer); | 527 | if (cs->timer.expires) add_timer(&cs->timer); |
| 528 | spin_unlock_irqrestore(&divert_lock, flags); | 528 | spin_unlock_irqrestore(&divert_lock, flags); |
| 529 | 529 | ||
| 530 | put_info_buffer(cs->info); | 530 | put_info_buffer(cs->info); |
| 531 | return(retval); | 531 | return (retval); |
| 532 | } | 532 | } |
| 533 | else | 533 | else |
| 534 | return(0); | 534 | return (0); |
| 535 | } /* isdn_divert_icall */ | 535 | } /* isdn_divert_icall */ |
| 536 | 536 | ||
| 537 | 537 | ||
| 538 | void deleteprocs(void) | 538 | void deleteprocs(void) |
| 539 | { struct call_struc *cs, *cs1; | 539 | { struct call_struc *cs, *cs1; |
| 540 | unsigned long flags; | 540 | unsigned long flags; |
| 541 | 541 | ||
| 542 | spin_lock_irqsave(&divert_lock, flags); | 542 | spin_lock_irqsave(&divert_lock, flags); |
| 543 | cs = divert_head; | 543 | cs = divert_head; |
| 544 | divert_head = NULL; | 544 | divert_head = NULL; |
| 545 | while (cs) | 545 | while (cs) |
| 546 | { del_timer(&cs->timer); | 546 | { del_timer(&cs->timer); |
| 547 | cs1 = cs; | 547 | cs1 = cs; |
| 548 | cs = cs->next; | 548 | cs = cs->next; |
| 549 | kfree(cs1); | 549 | kfree(cs1); |
| 550 | } | 550 | } |
| 551 | spin_unlock_irqrestore(&divert_lock, flags); | 551 | spin_unlock_irqrestore(&divert_lock, flags); |
| 552 | } /* deleteprocs */ | 552 | } /* deleteprocs */ |
| 553 | 553 | ||
| 554 | /****************************************************/ | 554 | /****************************************************/ |
| @@ -556,42 +556,42 @@ void deleteprocs(void) · 1 unmodified line | |||
| 556 | /****************************************************/ | 556 | /****************************************************/ |
| 557 | static int put_address(char *st, u_char *p, int len) | 557 | static int put_address(char *st, u_char *p, int len) |
| 558 | { u_char retval = 0; | 558 | { u_char retval = 0; |
| 559 | u_char adr_typ = 0; /* network standard */ | 559 | u_char adr_typ = 0; /* network standard */ |
| 560 | 560 | ||
| 561 | if (len < 2) return(retval); | 561 | if (len < 2) return (retval); |
| 562 | if (*p == 0xA1) | 562 | if (*p == 0xA1) |
| 563 | { retval = *(++p) + 2; /* total length */ | 563 | { retval = *(++p) + 2; /* total length */ |
| 564 | if (retval > len) return(0); /* too short */ | 564 | if (retval > len) return (0); /* too short */ |
| 565 | len = retval - 2; /* remaining length */ | 565 | len = retval - 2; /* remaining length */ |
| 566 | if (len < 3) return(0); | 566 | if (len < 3) return (0); |
| 567 | if ((*(++p) != 0x0A) || (*(++p) != 1)) return(0); | 567 | if ((*(++p) != 0x0A) || (*(++p) != 1)) return (0); |
| 568 | adr_typ = *(++p); | 568 | adr_typ = *(++p); |
| 569 | len -= 3; | 569 | len -= 3; |
| 570 | p++; | 570 | p++; |
| 571 | if (len < 2) return(0); | 571 | if (len < 2) return (0); |
| 572 | if (*p++ != 0x12) return(0); | 572 | if (*p++ != 0x12) return (0); |
| 573 | if (*p > len) return(0); /* check number length */ | 573 | if (*p > len) return (0); /* check number length */ |
| 574 | len = *p++; | 574 | len = *p++; |
| 575 | } | 575 | } |
| 576 | else | 576 | else |
| 577 | if (*p == 0x80) | 577 | if (*p == 0x80) |
| 578 | { retval = *(++p) + 2; /* total length */ | 578 | { retval = *(++p) + 2; /* total length */ |
| 579 | if (retval > len) return(0); | 579 | if (retval > len) return (0); |
| 580 | len = retval - 2; | 580 | len = retval - 2; |
| 581 | p++; | 581 | p++; |
| 582 | } | 582 | } |
| 583 | else | 583 | else |
| 584 | return(0); /* invalid address information */ | 584 | return (0); /* invalid address information */ |
| 585 | 585 | ||
| 586 | sprintf(st,"%d ",adr_typ); | 586 | sprintf(st, "%d ", adr_typ); |
| 587 | st += strlen(st); | 587 | st += strlen(st); |
| 588 | if (!len) | 588 | if (!len) |
| 589 | *st++ = '-'; | 589 | *st++ = '-'; |
| 590 | else | 590 | else |
| 591 | while (len--) | 591 | while (len--) |
| 592 | *st++ = *p++; | 592 | *st++ = *p++; |
| 593 | *st = '\0'; | 593 | *st = '\0'; |
| 594 | return(retval); | 594 | return (retval); |
| 595 | } /* put_address */ | 595 | } /* put_address */ |
| 596 | 596 | ||
| 597 | /*************************************/ | 597 | /*************************************/ |
| @@ -599,93 +599,93 @@ static int put_address(char *st, u_char *p, int len) · 1 unmodified line | |||
| 599 | /*************************************/ | 599 | /*************************************/ |
| 600 | static int interrogate_success(isdn_ctrl *ic, struct call_struc *cs) | 600 | static int interrogate_success(isdn_ctrl *ic, struct call_struc *cs) |
| 601 | { char *src = ic->parm.dss1_io.data; | 601 | { char *src = ic->parm.dss1_io.data; |
| 602 | int restlen = ic->parm.dss1_io.datalen; | 602 | int restlen = ic->parm.dss1_io.datalen; |
| 603 | int cnt = 1; | 603 | int cnt = 1; |
| 604 | u_char n,n1; | 604 | u_char n, n1; |
| 605 | char st[90], *p, *stp; | 605 | char st[90], *p, *stp; |
| 606 | 606 | ||
| 607 | if (restlen < 2) return(-100); /* frame too short */ | 607 | if (restlen < 2) return (-100); /* frame too short */ |
| 608 | if (*src++ != 0x30) return(-101); | 608 | if (*src++ != 0x30) return (-101); |
| 609 | if ((n = *src++) > 0x81) return(-102); /* invalid length field */ | 609 | if ((n = *src++) > 0x81) return (-102); /* invalid length field */ |
| 610 | restlen -= 2; /* remaining bytes */ | 610 | restlen -= 2; /* remaining bytes */ |
| 611 | if (n == 0x80) | 611 | if (n == 0x80) |
| 612 | { if (restlen < 2) return(-103); | 612 | { if (restlen < 2) return (-103); |
| 613 | if ((*(src+restlen-1)) || (*(src+restlen-2))) return(-104); | 613 | if ((*(src + restlen - 1)) || (*(src + restlen - 2))) return (-104); |
| 614 | restlen -= 2; | 614 | restlen -= 2; |
| 615 | } | 615 | } |
| 616 | else | 616 | else |
| 617 | if ( n == 0x81) | 617 | if (n == 0x81) |
| 618 | { n = *src++; | 618 | { n = *src++; |
| 619 | restlen--; | 619 | restlen--; |
| 620 | if (n > restlen) return(-105); | 620 | if (n > restlen) return (-105); |
| 621 | restlen = n; | 621 | restlen = n; |
| 622 | } | 622 | } |
| 623 | else | 623 | else |
| 624 | if (n > restlen) return(-106); | 624 | if (n > restlen) return (-106); |
| 625 | else | 625 | else |
| 626 | restlen = n; /* standard format */ | 626 | restlen = n; /* standard format */ |
| 627 | if (restlen < 3) return(-107); /* no procedure */ | 627 | if (restlen < 3) return (-107); /* no procedure */ |
| 628 | if ((*src++ != 2) || (*src++ != 1) || (*src++ != 0x0B)) return(-108); | 628 | if ((*src++ != 2) || (*src++ != 1) || (*src++ != 0x0B)) return (-108); |
| 629 | restlen -= 3; | 629 | restlen -= 3; |
| 630 | if (restlen < 2) return(-109); /* list missing */ | 630 | if (restlen < 2) return (-109); /* list missing */ |
| 631 | if (*src == 0x31) | 631 | if (*src == 0x31) |
| 632 | { src++; | 632 | { src++; |
| 633 | if ((n = *src++) > 0x81) return(-110); /* invalid length field */ | 633 | if ((n = *src++) > 0x81) return (-110); /* invalid length field */ |
| 634 | restlen -= 2; /* remaining bytes */ | 634 | restlen -= 2; /* remaining bytes */ |
| 635 | if (n == 0x80) | 635 | if (n == 0x80) |
| 636 | { if (restlen < 2) return(-111); | 636 | { if (restlen < 2) return (-111); |
| 637 | if ((*(src+restlen-1)) || (*(src+restlen-2))) return(-112); | 637 | if ((*(src + restlen - 1)) || (*(src + restlen - 2))) return (-112); |
| 638 | restlen -= 2; | 638 | restlen -= 2; |
| 639 | } | 639 | } |
| 640 | else | 640 | else |
| 641 | if ( n == 0x81) | 641 | if (n == 0x81) |
| 642 | { n = *src++; | 642 | { n = *src++; |
| 643 | restlen--; | 643 | restlen--; |
| 644 | if (n > restlen) return(-113); | 644 | if (n > restlen) return (-113); |
| 645 | restlen = n; | 645 | restlen = n; |
| 646 | } | 646 | } |
| 647 | else | 647 | else |
| 648 | if (n > restlen) return(-114); | 648 | if (n > restlen) return (-114); |
| 649 | else | 649 | else |
| 650 | restlen = n; /* standard format */ | 650 | restlen = n; /* standard format */ |
| 651 | } /* result list header */ | 651 | } /* result list header */ |
| 652 | 652 | ||
| 653 | while (restlen >= 2) | 653 | while (restlen >= 2) |
| 654 | { stp = st; | 654 | { stp = st; |
| 655 | sprintf(stp,"%d 0x%lx %d %s ",DIVERT_REPORT, ic->parm.dss1_io.ll_id, | 655 | sprintf(stp, "%d 0x%lx %d %s ", DIVERT_REPORT, ic->parm.dss1_io.ll_id, |
| 656 | cnt++,divert_if.drv_to_name(ic->driver)); | 656 | cnt++, divert_if.drv_to_name(ic->driver)); |
| 657 | stp += strlen(stp); | 657 | stp += strlen(stp); |
| 658 | if (*src++ != 0x30) return(-115); /* invalid enum */ | 658 | if (*src++ != 0x30) return (-115); /* invalid enum */ |
| 659 | n = *src++; | 659 | n = *src++; |
| 660 | restlen -= 2; | 660 | restlen -= 2; |
| 661 | if (n > restlen) return(-116); /* enum length wrong */ | 661 | if (n > restlen) return (-116); /* enum length wrong */ |
| 662 | restlen -= n; | 662 | restlen -= n; |
| 663 | p = src; /* one entry */ | 663 | p = src; /* one entry */ |
| 664 | src += n; | 664 | src += n; |
| 665 | if (!(n1 = put_address(stp,p,n & 0xFF))) continue; | 665 | if (!(n1 = put_address(stp, p, n & 0xFF))) continue; |
| 666 | stp += strlen(stp); | 666 | stp += strlen(stp); |
| 667 | p += n1; | 667 | p += n1; |
| 668 | n -= n1; | 668 | n -= n1; |
| 669 | if (n < 6) continue; /* no service and proc */ | 669 | if (n < 6) continue; /* no service and proc */ |
| 670 | if ((*p++ != 0x0A) || (*p++ != 1)) continue; | 670 | if ((*p++ != 0x0A) || (*p++ != 1)) continue; |
| 671 | sprintf(stp," 0x%02x ",(*p++) & 0xFF); | 671 | sprintf(stp, " 0x%02x ", (*p++) & 0xFF); |
| 672 | stp += strlen(stp); | 672 | stp += strlen(stp); |
| 673 | if ((*p++ != 0x0A) || (*p++ != 1)) continue; | 673 | if ((*p++ != 0x0A) || (*p++ != 1)) continue; |
| 674 | sprintf(stp,"%d ",(*p++) & 0xFF); | 674 | sprintf(stp, "%d ", (*p++) & 0xFF); |
| 675 | stp += strlen(stp); | 675 | stp += strlen(stp); |
| 676 | n -= 6; | 676 | n -= 6; |
| 677 | if (n > 2) | 677 | if (n > 2) |
| 678 | { if (*p++ != 0x30) continue; | 678 | { if (*p++ != 0x30) continue; |
| 679 | if (*p > (n-2)) continue; | 679 | if (*p > (n - 2)) continue; |
| 680 | n = *p++; | 680 | n = *p++; |
| 681 | if (!(n1 = put_address(stp,p,n & 0xFF))) continue; | 681 | if (!(n1 = put_address(stp, p, n & 0xFF))) continue; |
| 682 | stp += strlen(stp); | 682 | stp += strlen(stp); |
| 683 | } | 683 | } |
| 684 | sprintf(stp,"\n"); | 684 | sprintf(stp, "\n"); |
| 685 | put_info_buffer(st); | 685 | put_info_buffer(st); |
| 686 | } /* while restlen */ | 686 | } /* while restlen */ |
| 687 | if (restlen) return(-117); | 687 | if (restlen) return (-117); |
| 688 | return(0); | 688 | return (0); |
| 689 | } /* interrogate_success */ | 689 | } /* interrogate_success */ |
| 690 | 690 | ||
| 691 | /*********************************************/ | 691 | /*********************************************/ |
| @@ -693,90 +693,90 @@ static int interrogate_success(isdn_ctrl *ic, struct call_struc *cs) · 1 unmodified line | |||
| 693 | /*********************************************/ | 693 | /*********************************************/ |
| 694 | static int prot_stat_callback(isdn_ctrl *ic) | 694 | static int prot_stat_callback(isdn_ctrl *ic) |
| 695 | { struct call_struc *cs, *cs1; | 695 | { struct call_struc *cs, *cs1; |
| 696 | int i; | 696 | int i; |
| 697 | unsigned long flags; | 697 | unsigned long flags; |
| 698 | 698 | ||
| 699 | cs = divert_head; /* start of list */ | 699 | cs = divert_head; /* start of list */ |
| 700 | cs1 = NULL; | 700 | cs1 = NULL; |
| 701 | while (cs) | 701 | while (cs) |
| 702 | { if (ic->driver == cs->ics.driver) | 702 | { if (ic->driver == cs->ics.driver) |
| 703 | { switch (cs->ics.arg) | 703 | { switch (cs->ics.arg) |
| 704 | { case DSS1_CMD_INVOKE: | 704 | { case DSS1_CMD_INVOKE: |
| 705 | if ((cs->ics.parm.dss1_io.ll_id == ic->parm.dss1_io.ll_id) && | 705 | if ((cs->ics.parm.dss1_io.ll_id == ic->parm.dss1_io.ll_id) && |
| 706 | (cs->ics.parm.dss1_io.hl_id == ic->parm.dss1_io.hl_id)) | 706 | (cs->ics.parm.dss1_io.hl_id == ic->parm.dss1_io.hl_id)) |
| 707 | { switch (ic->arg) | 707 | { switch (ic->arg) |
| 708 | { case DSS1_STAT_INVOKE_ERR: | 708 | { case DSS1_STAT_INVOKE_ERR: |
| 709 | sprintf(cs->info,"128 0x%lx 0x%x\n", | 709 | sprintf(cs->info, "128 0x%lx 0x%x\n", |
| 710 | ic->parm.dss1_io.ll_id, | 710 | ic->parm.dss1_io.ll_id, |
| 711 | ic->parm.dss1_io.timeout); | 711 | ic->parm.dss1_io.timeout); |
| 712 | put_info_buffer(cs->info); | 712 | put_info_buffer(cs->info); |
| 713 | break; | 713 | break; |
| 714 | 714 | ||
| 715 | case DSS1_STAT_INVOKE_RES: | 715 | case DSS1_STAT_INVOKE_RES: |
| 716 | switch (cs->ics.parm.dss1_io.proc) | 716 | switch (cs->ics.parm.dss1_io.proc) |
| 717 | { case 7: | 717 | { case 7: |
| 718 | case 8: | 718 | case 8: |
| 719 | put_info_buffer(cs->info); | 719 | put_info_buffer(cs->info); |
| 720 | break; | 720 | break; |
| 721 | 721 | ||
| 722 | case 11: | 722 | case 11: |
| 723 | i = interrogate_success(ic,cs); | 723 | i = interrogate_success(ic, cs); |
| 724 | if (i) | 724 | if (i) |
| 725 | sprintf(cs->info,"%d 0x%lx %d\n",DIVERT_REPORT, | 725 | sprintf(cs->info, "%d 0x%lx %d\n", DIVERT_REPORT, |
| 726 | ic->parm.dss1_io.ll_id,i); | 726 | ic->parm.dss1_io.ll_id, i); |
| 727 | put_info_buffer(cs->info); | 727 | put_info_buffer(cs->info); |
| 728 | break; | 728 | break; |
| 729 | 729 | ||
| 730 | default: | 730 | default: |
| 731 | printk(KERN_WARNING "dss1_divert: unknown proc %d\n",cs->ics.parm.dss1_io.proc); | 731 | printk(KERN_WARNING "dss1_divert: unknown proc %d\n", cs->ics.parm.dss1_io.proc); |
| 732 | break; | 732 | break; |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | 735 | ||
| 736 | break; | 736 | break; |
| 737 | 737 | ||
| 738 | default: | 738 | default: |
| 739 | printk(KERN_WARNING "dss1_divert unknown invoke answer %lx\n",ic->arg); | 739 | printk(KERN_WARNING "dss1_divert unknown invoke answer %lx\n", ic->arg); |
| 740 | break; | 740 | break; |
| 741 | } | 741 | } |
| 742 | cs1 = cs; /* remember structure */ | 742 | cs1 = cs; /* remember structure */ |
| 743 | cs = NULL; | 743 | cs = NULL; |
| 744 | continue; /* abort search */ | 744 | continue; /* abort search */ |
| 745 | } /* id found */ | 745 | } /* id found */ |
| 746 | break; | 746 | break; |
| 747 | 747 | ||
| 748 | case DSS1_CMD_INVOKE_ABORT: | 748 | case DSS1_CMD_INVOKE_ABORT: |
| 749 | printk(KERN_WARNING "dss1_divert unhandled invoke abort\n"); | 749 | printk(KERN_WARNING "dss1_divert unhandled invoke abort\n"); |
| 750 | break; | 750 | break; |
| 751 | 751 | ||
| 752 | default: | 752 | default: |
| 753 | printk(KERN_WARNING "dss1_divert unknown cmd 0x%lx\n",cs->ics.arg); | 753 | printk(KERN_WARNING "dss1_divert unknown cmd 0x%lx\n", cs->ics.arg); |
| 754 | break; | 754 | break; |
| 755 | } /* switch ics.arg */ | 755 | } /* switch ics.arg */ |
| 756 | cs = cs->next; | 756 | cs = cs->next; |
| 757 | } /* driver ok */ | 757 | } /* driver ok */ |
| 758 | } | 758 | } |
| 759 | 759 | ||
| 760 | if (!cs1) | 760 | if (!cs1) |
| 761 | { printk(KERN_WARNING "dss1_divert unhandled process\n"); | 761 | { printk(KERN_WARNING "dss1_divert unhandled process\n"); |
| 762 | return(0); | 762 | return (0); |
| 763 | } | 763 | } |
| 764 | 764 | ||
| 765 | if (cs1->ics.driver == -1) | 765 | if (cs1->ics.driver == -1) |
| 766 | { | 766 | { |
| 767 | spin_lock_irqsave(&divert_lock, flags); | 767 | spin_lock_irqsave(&divert_lock, flags); |
| 768 | del_timer(&cs1->timer); | 768 | del_timer(&cs1->timer); |
| 769 | if (cs1->prev) | 769 | if (cs1->prev) |
| 770 | cs1->prev->next = cs1->next; /* forward link */ | 770 | cs1->prev->next = cs1->next; /* forward link */ |
| 771 | else | 771 | else |
| 772 | divert_head = cs1->next; | 772 | divert_head = cs1->next; |
| 773 | if (cs1->next) | 773 | if (cs1->next) |
| 774 | cs1->next->prev = cs1->prev; /* back link */ | 774 | cs1->next->prev = cs1->prev; /* back link */ |
| 775 | spin_unlock_irqrestore(&divert_lock, flags); | 775 | spin_unlock_irqrestore(&divert_lock, flags); |
| 776 | kfree(cs1); | 776 | kfree(cs1); |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | return(0); | 779 | return (0); |
| 780 | } /* prot_stat_callback */ | 780 | } /* prot_stat_callback */ |
| 781 | 781 | ||
| 782 | 782 | ||
| @@ -785,79 +785,78 @@ static int prot_stat_callback(isdn_ctrl *ic) · 2 unmodified lines | |||
| 785 | /***************************/ | 785 | /***************************/ |
| 786 | static int isdn_divert_stat_callback(isdn_ctrl *ic) | 786 | static int isdn_divert_stat_callback(isdn_ctrl *ic) |
| 787 | { struct call_struc *cs, *cs1; | 787 | { struct call_struc *cs, *cs1; |
| 788 | unsigned long flags; | 788 | unsigned long flags; |
| 789 | int retval; | 789 | int retval; |
| 790 | 790 | ||
| 791 | retval = -1; | 791 | retval = -1; |
| 792 | cs = divert_head; /* start of list */ | 792 | cs = divert_head; /* start of list */ |
| 793 | while (cs) | 793 | while (cs) |
| 794 | { if ((ic->driver == cs->ics.driver) && (ic->arg == cs->ics.arg)) | 794 | { if ((ic->driver == cs->ics.driver) && (ic->arg == cs->ics.arg)) |
| 795 | { switch (ic->command) | 795 | { switch (ic->command) |
| 796 | { case ISDN_STAT_DHUP: | 796 | { case ISDN_STAT_DHUP: |
| 797 | sprintf(cs->info,"129 0x%lx\n",cs->divert_id); | 797 | sprintf(cs->info, "129 0x%lx\n", cs->divert_id); |
| 798 | del_timer(&cs->timer); | 798 | del_timer(&cs->timer); |
| 799 | cs->ics.driver = -1; | 799 | cs->ics.driver = -1; |
| 800 | break; | 800 | break; |
| 801 | 801 | ||
| 802 | case ISDN_STAT_CAUSE: | 802 | case ISDN_STAT_CAUSE: |
| 803 | sprintf(cs->info,"130 0x%lx %s\n",cs->divert_id,ic->parm.num); | 803 | sprintf(cs->info, "130 0x%lx %s\n", cs->divert_id, ic->parm.num); |
| 804 | break; | 804 | break; |
| 805 | 805 | ||
| 806 | case ISDN_STAT_REDIR: | 806 | case ISDN_STAT_REDIR: |
| 807 | sprintf(cs->info,"131 0x%lx\n",cs->divert_id); | 807 | sprintf(cs->info, "131 0x%lx\n", cs->divert_id); |
| 808 | del_timer(&cs->timer); | 808 | del_timer(&cs->timer); |
| 809 | cs->ics.driver = -1; | 809 | cs->ics.driver = -1; |
| 810 | break; | 810 | break; |
| 811 | 811 | ||
| 812 | default: | 812 | default: |
| 813 | sprintf(cs->info,"999 0x%lx 0x%x\n",cs->divert_id,(int)(ic->command)); | 813 | sprintf(cs->info, "999 0x%lx 0x%x\n", cs->divert_id, (int)(ic->command)); |
| 814 | break; | 814 | break; |
| 815 | } | 815 | } |
| 816 | put_info_buffer(cs->info); | 816 | put_info_buffer(cs->info); |
| 817 | retval = 0; | 817 | retval = 0; |
| 818 | } | 818 | } |
| 819 | cs1 = cs; | 819 | cs1 = cs; |
| 820 | cs = cs->next; | 820 | cs = cs->next; |
| 821 | if (cs1->ics.driver == -1) | 821 | if (cs1->ics.driver == -1) |
| 822 | { | 822 | { |
| 823 | spin_lock_irqsave(&divert_lock, flags); | 823 | spin_lock_irqsave(&divert_lock, flags); |
| 824 | if (cs1->prev) | 824 | if (cs1->prev) |
| 825 | cs1->prev->next = cs1->next; /* forward link */ | 825 | cs1->prev->next = cs1->next; /* forward link */ |
| 826 | else | 826 | else |
| 827 | divert_head = cs1->next; | 827 | divert_head = cs1->next; |
| 828 | if (cs1->next) | 828 | if (cs1->next) |
| 829 | cs1->next->prev = cs1->prev; /* back link */ | 829 | cs1->next->prev = cs1->prev; /* back link */ |
| 830 | spin_unlock_irqrestore(&divert_lock, flags); | 830 | spin_unlock_irqrestore(&divert_lock, flags); |
| 831 | kfree(cs1); | 831 | kfree(cs1); |
| 832 | } | 832 | } |
| 833 | } | 833 | } |
| 834 | return(retval); /* not found */ | 834 | return (retval); /* not found */ |
| 835 | } /* isdn_divert_stat_callback */ | 835 | } /* isdn_divert_stat_callback */ |
| 836 | 836 | ||
| 837 | 837 | ||
| 838 | /********************/ | 838 | /********************/ |
| 839 | /* callback from ll */ | 839 | /* callback from ll */ |
| 840 | /********************/ | 840 | /********************/ |
| 841 | int ll_callback(isdn_ctrl *ic) | 841 | int ll_callback(isdn_ctrl *ic) |
| 842 | { | 842 | { |
| 843 | switch (ic->command) | 843 | switch (ic->command) |
| 844 | { case ISDN_STAT_ICALL: | 844 | { case ISDN_STAT_ICALL: |
| 845 | case ISDN_STAT_ICALLW: | 845 | case ISDN_STAT_ICALLW: |
| 846 | return(isdn_divert_icall(ic)); | 846 | return (isdn_divert_icall(ic)); |
| 847 | break; | 847 | break; |
| 848 | 848 | ||
| 849 | case ISDN_STAT_PROT: | 849 | case ISDN_STAT_PROT: |
| 850 | if ((ic->arg & 0xFF) == ISDN_PTYPE_EURO) | 850 | if ((ic->arg & 0xFF) == ISDN_PTYPE_EURO) |
| 851 | { if (ic->arg != DSS1_STAT_INVOKE_BRD) | 851 | { if (ic->arg != DSS1_STAT_INVOKE_BRD) |
| 852 | return(prot_stat_callback(ic)); | 852 | return (prot_stat_callback(ic)); |
| 853 | else | 853 | else |
| 854 | return(0); /* DSS1 invoke broadcast */ | 854 | return (0); /* DSS1 invoke broadcast */ |
| 855 | } | 855 | } |
| 856 | else | 856 | else |
| 857 | return(-1); /* protocol not euro */ | 857 | return (-1); /* protocol not euro */ |
| 858 | 858 | ||
| 859 | default: | 859 | default: |
| 860 | return(isdn_divert_stat_callback(ic)); | 860 | return (isdn_divert_stat_callback(ic)); |
| 861 | } | 861 | } |
| 862 | } /* ll_callback */ | 862 | } /* ll_callback */ |
| 863 | |||
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * Header for the diversion supplementary ioctl interface. | 3 | * Header for the diversion supplementary ioctl interface. |
| 4 | * | 4 | * |
| 5 | * Copyright 1998 by Werner Cornelius (werner@ikt.de) | 5 | * Copyright 1998 by Werner Cornelius (werner@ikt.de) |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -20,13 +20,13 @@ · 10 unmodified lines | |||
| 20 | #define IIOCGETDRV _IO('I', 2) /* get driver number */ | 20 | #define IIOCGETDRV _IO('I', 2) /* get driver number */ |
| 21 | #define IIOCGETNAM _IO('I', 3) /* get driver name */ | 21 | #define IIOCGETNAM _IO('I', 3) /* get driver name */ |
| 22 | #define IIOCGETRULE _IO('I', 4) /* read one rule */ | 22 | #define IIOCGETRULE _IO('I', 4) /* read one rule */ |
| 23 | #define IIOCMODRULE _IO('I', 5) /* modify/replace a rule */ | 23 | #define IIOCMODRULE _IO('I', 5) /* modify/replace a rule */ |
| 24 | #define IIOCINSRULE _IO('I', 6) /* insert/append one rule */ | 24 | #define IIOCINSRULE _IO('I', 6) /* insert/append one rule */ |
| 25 | #define IIOCDELRULE _IO('I', 7) /* delete a rule */ | 25 | #define IIOCDELRULE _IO('I', 7) /* delete a rule */ |
| 26 | #define IIOCDODFACT _IO('I', 8) /* hangup/reject/alert/immediately deflect a call */ | 26 | #define IIOCDODFACT _IO('I', 8) /* hangup/reject/alert/immediately deflect a call */ |
| 27 | #define IIOCDOCFACT _IO('I', 9) /* activate control forwarding in PBX */ | 27 | #define IIOCDOCFACT _IO('I', 9) /* activate control forwarding in PBX */ |
| 28 | #define IIOCDOCFDIS _IO('I',10) /* deactivate control forwarding in PBX */ | 28 | #define IIOCDOCFDIS _IO('I', 10) /* deactivate control forwarding in PBX */ |
| 29 | #define IIOCDOCFINT _IO('I',11) /* interrogate control forwarding in PBX */ | 29 | #define IIOCDOCFINT _IO('I', 11) /* interrogate control forwarding in PBX */ |
| 30 | 30 | ||
| 31 | /*************************************/ | 31 | /*************************************/ |
| 32 | /* states reported through interface */ | 32 | /* states reported through interface */ |
| @@ -34,65 +34,65 @@ · 1 unmodified line | |||
| 34 | #define DEFLECT_IGNORE 0 /* ignore incoming call */ | 34 | #define DEFLECT_IGNORE 0 /* ignore incoming call */ |
| 35 | #define DEFLECT_REPORT 1 /* only report */ | 35 | #define DEFLECT_REPORT 1 /* only report */ |
| 36 | #define DEFLECT_PROCEED 2 /* deflect when externally triggered */ | 36 | #define DEFLECT_PROCEED 2 /* deflect when externally triggered */ |
| 37 | #define DEFLECT_ALERT 3 /* alert and deflect after delay */ | 37 | #define DEFLECT_ALERT 3 /* alert and deflect after delay */ |
| 38 | #define DEFLECT_REJECT 4 /* reject immediately */ | 38 | #define DEFLECT_REJECT 4 /* reject immediately */ |
| 39 | #define DIVERT_ACTIVATE 5 /* diversion activate */ | 39 | #define DIVERT_ACTIVATE 5 /* diversion activate */ |
| 40 | #define DIVERT_DEACTIVATE 6 /* diversion deactivate */ | 40 | #define DIVERT_DEACTIVATE 6 /* diversion deactivate */ |
| 41 | #define DIVERT_REPORT 7 /* interrogation result */ | 41 | #define DIVERT_REPORT 7 /* interrogation result */ |
| 42 | #define DEFLECT_AUTODEL 255 /* only for internal use */ | 42 | #define DEFLECT_AUTODEL 255 /* only for internal use */ |
| 43 | 43 | ||
| 44 | #define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */ | 44 | #define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */ |
| 45 | 45 | ||
| 46 | typedef struct | 46 | typedef struct |
| 47 | { ulong drvid; /* driver ids, bit mapped */ | 47 | { ulong drvid; /* driver ids, bit mapped */ |
| 48 | char my_msn[35]; /* desired msn, subaddr allowed */ | 48 | char my_msn[35]; /* desired msn, subaddr allowed */ |
| 49 | char caller[35]; /* caller id, partial string with * + subaddr allowed */ | 49 | char caller[35]; /* caller id, partial string with * + subaddr allowed */ |
| 50 | char to_nr[35]; /* deflected to number incl. subaddress */ | 50 | char to_nr[35]; /* deflected to number incl. subaddress */ |
| 51 | u_char si1,si2; /* service indicators, si1=bitmask, si1+2 0 = all */ | 51 | u_char si1, si2; /* service indicators, si1=bitmask, si1+2 0 = all */ |
| 52 | u_char screen; /* screening: 0 = no info, 1 = info, 2 = nfo with nr */ | 52 | u_char screen; /* screening: 0 = no info, 1 = info, 2 = nfo with nr */ |
| 53 | u_char callopt; /* option for call handling: | 53 | u_char callopt; /* option for call handling: |
| 54 | 0 = all calls | 54 | 0 = all calls |
| 55 | 1 = only non waiting calls | 55 | 1 = only non waiting calls |
| 56 | 2 = only waiting calls */ | 56 | 2 = only waiting calls */ |
| 57 | u_char action; /* desired action: | 57 | u_char action; /* desired action: |
| 58 | 0 = don't report call -> ignore | 58 | 0 = don't report call -> ignore |
| 59 | 1 = report call, do not allow/proceed for deflection | 59 | 1 = report call, do not allow/proceed for deflection |
| 60 | 2 = report call, send proceed, wait max waittime secs | 60 | 2 = report call, send proceed, wait max waittime secs |
| 61 | 3 = report call, alert and deflect after waittime | 61 | 3 = report call, alert and deflect after waittime |
| 62 | 4 = report call, reject immediately | 62 | 4 = report call, reject immediately |
| 63 | actions 1-2 only take place if interface is opened | 63 | actions 1-2 only take place if interface is opened |
| 64 | */ | 64 | */ |
| 65 | u_char waittime; /* maximum wait time for proceeding */ | 65 | u_char waittime; /* maximum wait time for proceeding */ |
| 66 | } divert_rule; | 66 | } divert_rule; |
| 67 | 67 | ||
| 68 | typedef union | 68 | typedef union |
| 69 | { int drv_version; /* return of driver version */ | 69 | { int drv_version; /* return of driver version */ |
| 70 | struct | 70 | struct |
| 71 | { int drvid; /* id of driver */ | 71 | { int drvid; /* id of driver */ |
| 72 | char drvnam[30]; /* name of driver */ | 72 | char drvnam[30]; /* name of driver */ |
| 73 | } getid; | 73 | } getid; |
| 74 | struct | 74 | struct |
| 75 | { int ruleidx; /* index of rule */ | 75 | { int ruleidx; /* index of rule */ |
| 76 | divert_rule rule; /* rule parms */ | 76 | divert_rule rule; /* rule parms */ |
| 77 | } getsetrule; | 77 | } getsetrule; |
| 78 | struct | 78 | struct |
| 79 | { u_char subcmd; /* 0 = hangup/reject, | 79 | { u_char subcmd; /* 0 = hangup/reject, |
| 80 | 1 = alert, | 80 | 1 = alert, |
| 81 | 2 = deflect */ | 81 | 2 = deflect */ |
| 82 | ulong callid; /* id of call delivered by ascii output */ | 82 | ulong callid; /* id of call delivered by ascii output */ |
| 83 | char to_nr[35]; /* destination when deflect, | 83 | char to_nr[35]; /* destination when deflect, |
| 84 | else uus1 string (maxlen 31), | 84 | else uus1 string (maxlen 31), |
| 85 | data from rule used if empty */ | 85 | data from rule used if empty */ |
| 86 | } fwd_ctrl; | 86 | } fwd_ctrl; |
| 87 | struct | 87 | struct |
| 88 | { int drvid; /* id of driver */ | 88 | { int drvid; /* id of driver */ |
| 89 | u_char cfproc; /* cfu = 0, cfb = 1, cfnr = 2 */ | 89 | u_char cfproc; /* cfu = 0, cfb = 1, cfnr = 2 */ |
| 90 | ulong procid; /* process id returned when no error */ | 90 | ulong procid; /* process id returned when no error */ |
| 91 | u_char service; /* basically coded service, 0 = all */ | 91 | u_char service; /* basically coded service, 0 = all */ |
| 92 | char msn[25]; /* desired msn, empty = all */ | 92 | char msn[25]; /* desired msn, empty = all */ |
| 93 | char fwd_nr[35];/* forwarded to number + subaddress */ | 93 | char fwd_nr[35];/* forwarded to number + subaddress */ |
| 94 | } cf_ctrl; | 94 | } cf_ctrl; |
| 95 | } divert_ioctl; | 95 | } divert_ioctl; |
| 96 | 96 | ||
| 97 | #ifdef __KERNEL__ | 97 | #ifdef __KERNEL__ |
| 98 | 98 | ||
| @@ -105,10 +105,10 @@ typedef union · 6 unmodified lines | |||
| 105 | /* structure keeping ascii info for device output */ | 105 | /* structure keeping ascii info for device output */ |
| 106 | /**************************************************/ | 106 | /**************************************************/ |
| 107 | struct divert_info | 107 | struct divert_info |
| 108 | { struct divert_info *next; | 108 | { struct divert_info *next; |
| 109 | ulong usage_cnt; /* number of files still to work */ | 109 | ulong usage_cnt; /* number of files still to work */ |
| 110 | char info_start[2]; /* info string start */ | 110 | char info_start[2]; /* info string start */ |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | 113 | ||
| 114 | /**************/ | 114 | /**************/ |
| @@ -214,7 +214,7 @@ byte_stuff: · 213 unmodified lines | |||
| 214 | } else if (fcs != PPP_GOODFCS) { | 214 | } else if (fcs != PPP_GOODFCS) { |
| 215 | /* frame check error */ | 215 | /* frame check error */ |
| 216 | dev_err(cs->dev, | 216 | dev_err(cs->dev, |
| 217 | "Checksum failed, %u bytes corrupted!\n", | 217 | "Checksum failed, %u bytes corrupted!\n", |
| 218 | skb->len); | 218 | skb->len); |
| 219 | gigaset_isdn_rcv_err(bcs); | 219 | gigaset_isdn_rcv_err(bcs); |
| 220 | dev_kfree_skb_any(skb); | 220 | dev_kfree_skb_any(skb); |
| @@ -543,7 +543,7 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb) · 322 unmodified lines | |||
| 543 | /* size of new buffer (worst case = every byte must be stuffed): | 543 | /* size of new buffer (worst case = every byte must be stuffed): |
| 544 | * 2 * original size + room for link layer header | 544 | * 2 * original size + room for link layer header |
| 545 | */ | 545 | */ |
| 546 | iraw_skb = dev_alloc_skb(2*skb->len + skb->mac_len); | 546 | iraw_skb = dev_alloc_skb(2 * skb->len + skb->mac_len); |
| 547 | if (!iraw_skb) { | 547 | if (!iraw_skb) { |
| 548 | dev_kfree_skb_any(skb); | 548 | dev_kfree_skb_any(skb); |
| 549 | return NULL; | 549 | return NULL; |
| @@ -410,10 +410,10 @@ static void check_pending(struct bas_cardstate *ucs) · 409 unmodified lines | |||
| 410 | if (!(ucs->basstate & BS_RESETTING)) | 410 | if (!(ucs->basstate & BS_RESETTING)) |
| 411 | ucs->pending = 0; | 411 | ucs->pending = 0; |
| 412 | break; | 412 | break; |
| 413 | /* | 413 | /* |
| 414 | * HD_READ_ATMESSAGE and HD_WRITE_ATMESSAGE are handled separately | 414 | * HD_READ_ATMESSAGE and HD_WRITE_ATMESSAGE are handled separately |
| 415 | * and should never end up here | 415 | * and should never end up here |
| 416 | */ | 416 | */ |
| 417 | default: | 417 | default: |
| 418 | dev_warn(&ucs->interface->dev, | 418 | dev_warn(&ucs->interface->dev, |
| 419 | "unknown pending request 0x%02x cleared\n", | 419 | "unknown pending request 0x%02x cleared\n", |
| @@ -491,7 +491,7 @@ static void read_ctrl_callback(struct urb *urb) · 71 unmodified lines | |||
| 491 | numbytes = urb->actual_length; | 491 | numbytes = urb->actual_length; |
| 492 | if (unlikely(numbytes != ucs->rcvbuf_size)) { | 492 | if (unlikely(numbytes != ucs->rcvbuf_size)) { |
| 493 | dev_warn(cs->dev, | 493 | dev_warn(cs->dev, |
| 494 | "control read: received %d chars, expected %d\n", | 494 | "control read: received %d chars, expected %d\n", |
| 495 | numbytes, ucs->rcvbuf_size); | 495 | numbytes, ucs->rcvbuf_size); |
| 496 | if (numbytes > ucs->rcvbuf_size) | 496 | if (numbytes > ucs->rcvbuf_size) |
| 497 | numbytes = ucs->rcvbuf_size; | 497 | numbytes = ucs->rcvbuf_size; |
| @@ -710,7 +710,7 @@ static void read_int_callback(struct urb *urb) · 212 unmodified lines | |||
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | l = (unsigned) ucs->int_in_buf[1] + | 712 | l = (unsigned) ucs->int_in_buf[1] + |
| 713 | (((unsigned) ucs->int_in_buf[2]) << 8); | 713 | (((unsigned) ucs->int_in_buf[2]) << 8); |
| 714 | 714 | ||
| 715 | gig_dbg(DEBUG_USBREQ, "<-------%d: 0x%02x (%u [0x%02x 0x%02x])", | 715 | gig_dbg(DEBUG_USBREQ, "<-------%d: 0x%02x (%u [0x%02x 0x%02x])", |
| 716 | urb->actual_length, (int)ucs->int_in_buf[0], l, | 716 | urb->actual_length, (int)ucs->int_in_buf[0], l, |
| @@ -770,14 +770,14 @@ static void read_int_callback(struct urb *urb) · 53 unmodified lines | |||
| 770 | case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */ | 770 | case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */ |
| 771 | if (!l) { | 771 | if (!l) { |
| 772 | dev_warn(cs->dev, | 772 | dev_warn(cs->dev, |
| 773 | "HD_RECEIVEATDATA_ACK with length 0 ignored\n"); | 773 | "HD_RECEIVEATDATA_ACK with length 0 ignored\n"); |
| 774 | break; | 774 | break; |
| 775 | } | 775 | } |
| 776 | spin_lock_irqsave(&cs->lock, flags); | 776 | spin_lock_irqsave(&cs->lock, flags); |
| 777 | if (ucs->basstate & BS_ATRDPEND) { | 777 | if (ucs->basstate & BS_ATRDPEND) { |
| 778 | spin_unlock_irqrestore(&cs->lock, flags); | 778 | spin_unlock_irqrestore(&cs->lock, flags); |
| 779 | dev_warn(cs->dev, | 779 | dev_warn(cs->dev, |
| 780 | "HD_RECEIVEATDATA_ACK(%d) during HD_READ_ATMESSAGE(%d) ignored\n", | 780 | "HD_RECEIVEATDATA_ACK(%d) during HD_READ_ATMESSAGE(%d) ignored\n", |
| 781 | l, ucs->rcvbuf_size); | 781 | l, ucs->rcvbuf_size); |
| 782 | break; | 782 | break; |
| 783 | } | 783 | } |
| @@ -878,7 +878,7 @@ static void read_iso_callback(struct urb *urb) · 94 unmodified lines | |||
| 878 | ubc->isoinlost += urb->iso_frame_desc[i].actual_length; | 878 | ubc->isoinlost += urb->iso_frame_desc[i].actual_length; |
| 879 | if (unlikely(urb->iso_frame_desc[i].status != 0 && | 879 | if (unlikely(urb->iso_frame_desc[i].status != 0 && |
| 880 | urb->iso_frame_desc[i].status != | 880 | urb->iso_frame_desc[i].status != |
| 881 | -EINPROGRESS)) | 881 | -EINPROGRESS)) |
| 882 | ubc->loststatus = urb->iso_frame_desc[i].status; | 882 | ubc->loststatus = urb->iso_frame_desc[i].status; |
| 883 | urb->iso_frame_desc[i].status = 0; | 883 | urb->iso_frame_desc[i].status = 0; |
| 884 | urb->iso_frame_desc[i].actual_length = 0; | 884 | urb->iso_frame_desc[i].actual_length = 0; |
| @@ -891,7 +891,7 @@ static void read_iso_callback(struct urb *urb) · 6 unmodified lines | |||
| 891 | rc = usb_submit_urb(urb, GFP_ATOMIC); | 891 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
| 892 | if (unlikely(rc != 0 && rc != -ENODEV)) { | 892 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
| 893 | dev_err(bcs->cs->dev, | 893 | dev_err(bcs->cs->dev, |
| 894 | "could not resubmit isoc read URB: %s\n", | 894 | "could not resubmit isoc read URB: %s\n", |
| 895 | get_usb_rcmsg(rc)); | 895 | get_usb_rcmsg(rc)); |
| 896 | dump_urb(DEBUG_ISO, "isoc read", urb); | 896 | dump_urb(DEBUG_ISO, "isoc read", urb); |
| 897 | error_hangup(bcs); | 897 | error_hangup(bcs); |
| @@ -1017,17 +1017,17 @@ static int starturbs(struct bc_state *bcs) · 119 unmodified lines | |||
| 1017 | } | 1017 | } |
| 1018 | 1018 | ||
| 1019 | /* keep one URB free, submit the others */ | 1019 | /* keep one URB free, submit the others */ |
| 1020 | for (k = 0; k < BAS_OUTURBS-1; ++k) { | 1020 | for (k = 0; k < BAS_OUTURBS - 1; ++k) { |
| 1021 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); | 1021 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); |
| 1022 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, GFP_ATOMIC); | 1022 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, GFP_ATOMIC); |
| 1023 | if (rc != 0) | 1023 | if (rc != 0) |
| 1024 | goto error; | 1024 | goto error; |
| 1025 | } | 1025 | } |
| 1026 | dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); | 1026 | dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); |
| 1027 | ubc->isooutfree = &ubc->isoouturbs[BAS_OUTURBS-1]; | 1027 | ubc->isooutfree = &ubc->isoouturbs[BAS_OUTURBS - 1]; |
| 1028 | ubc->isooutdone = ubc->isooutovfl = NULL; | 1028 | ubc->isooutdone = ubc->isooutovfl = NULL; |
| 1029 | return 0; | 1029 | return 0; |
| 1030 | error: | 1030 | error: |
| 1031 | stopurbs(ubc); | 1031 | stopurbs(ubc); |
| 1032 | return rc; | 1032 | return rc; |
| 1033 | } | 1033 | } |
| @@ -1229,7 +1229,7 @@ static void write_iso_tasklet(unsigned long data) · 195 unmodified lines | |||
| 1229 | if (ifd->status || | 1229 | if (ifd->status || |
| 1230 | ifd->actual_length != ifd->length) { | 1230 | ifd->actual_length != ifd->length) { |
| 1231 | dev_warn(cs->dev, | 1231 | dev_warn(cs->dev, |
| 1232 | "isoc write: frame %d[%d/%d]: %s\n", | 1232 | "isoc write: frame %d[%d/%d]: %s\n", |
| 1233 | i, ifd->actual_length, | 1233 | i, ifd->actual_length, |
| 1234 | ifd->length, | 1234 | ifd->length, |
| 1235 | get_usb_statmsg(ifd->status)); | 1235 | get_usb_statmsg(ifd->status)); |
| @@ -1316,7 +1316,7 @@ static void read_iso_tasklet(unsigned long data) · 80 unmodified lines | |||
| 1316 | ubc->isoindone = NULL; | 1316 | ubc->isoindone = NULL; |
| 1317 | if (unlikely(ubc->loststatus != -EINPROGRESS)) { | 1317 | if (unlikely(ubc->loststatus != -EINPROGRESS)) { |
| 1318 | dev_warn(cs->dev, | 1318 | dev_warn(cs->dev, |
| 1319 | "isoc read overrun, URB dropped (status: %s, %d bytes)\n", | 1319 | "isoc read overrun, URB dropped (status: %s, %d bytes)\n", |
| 1320 | get_usb_statmsg(ubc->loststatus), | 1320 | get_usb_statmsg(ubc->loststatus), |
| 1321 | ubc->isoinlost); | 1321 | ubc->isoinlost); |
| 1322 | ubc->loststatus = -EINPROGRESS; | 1322 | ubc->loststatus = -EINPROGRESS; |
| @@ -1965,7 +1965,7 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) · 642 unmodified lines | |||
| 1965 | int rc; | 1965 | int rc; |
| 1966 | 1966 | ||
| 1967 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? | 1967 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? |
| 1968 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, | 1968 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, |
| 1969 | "CMD Transmit", cb->len, cb->buf); | 1969 | "CMD Transmit", cb->len, cb->buf); |
| 1970 | 1970 | ||
| 1971 | /* translate "+++" escape sequence sent as a single separate command | 1971 | /* translate "+++" escape sequence sent as a single separate command |
| @@ -2453,13 +2453,13 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) · 481 unmodified lines | |||
| 2453 | 2453 | ||
| 2454 | /* wait a bit for blocking conditions to go away */ | 2454 | /* wait a bit for blocking conditions to go away */ |
| 2455 | rc = wait_event_timeout(ucs->waitqueue, | 2455 | rc = wait_event_timeout(ucs->waitqueue, |
| 2456 | !(ucs->basstate & | 2456 | !(ucs->basstate & |
| 2457 | (BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)), | 2457 | (BS_B1OPEN | BS_B2OPEN | BS_ATRDPEND | BS_ATWRPEND)), |
| 2458 | BAS_TIMEOUT*HZ/10); | 2458 | BAS_TIMEOUT * HZ / 10); |
| 2459 | gig_dbg(DEBUG_SUSPEND, "wait_event_timeout() -> %d", rc); | 2459 | gig_dbg(DEBUG_SUSPEND, "wait_event_timeout() -> %d", rc); |
| 2460 | 2460 | ||
| 2461 | /* check for conditions preventing suspend */ | 2461 | /* check for conditions preventing suspend */ |
| 2462 | if (ucs->basstate & (BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)) { | 2462 | if (ucs->basstate & (BS_B1OPEN | BS_B2OPEN | BS_ATRDPEND | BS_ATWRPEND)) { |
| 2463 | dev_warn(cs->dev, "cannot suspend:\n"); | 2463 | dev_warn(cs->dev, "cannot suspend:\n"); |
| 2464 | if (ucs->basstate & BS_B1OPEN) | 2464 | if (ucs->basstate & BS_B1OPEN) |
| 2465 | dev_warn(cs->dev, " B channel 1 open\n"); | 2465 | dev_warn(cs->dev, " B channel 1 open\n"); |
| @@ -2482,7 +2482,7 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) · 16 unmodified lines | |||
| 2482 | return rc; | 2482 | return rc; |
| 2483 | } | 2483 | } |
| 2484 | wait_event_timeout(ucs->waitqueue, !ucs->pending, | 2484 | wait_event_timeout(ucs->waitqueue, !ucs->pending, |
| 2485 | BAS_TIMEOUT*HZ/10); | 2485 | BAS_TIMEOUT * HZ / 10); |
| 2486 | /* in case of timeout, proceed anyway */ | 2486 | /* in case of timeout, proceed anyway */ |
| 2487 | } | 2487 | } |
| 2488 | 2488 | ||
| @@ -26,17 +26,17 @@ · 25 unmodified lines | |||
| 26 | #define CapiFacilitySpecificFunctionNotSupported 0x3011 | 26 | #define CapiFacilitySpecificFunctionNotSupported 0x3011 |
| 27 | 27 | ||
| 28 | /* missing from capicmd.h */ | 28 | /* missing from capicmd.h */ |
| 29 | #define CAPI_CONNECT_IND_BASELEN (CAPI_MSG_BASELEN+4+2+8*1) | 29 | #define CAPI_CONNECT_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 2 + 8 * 1) |
| 30 | #define CAPI_CONNECT_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN+4+3*1) | 30 | #define CAPI_CONNECT_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 3 * 1) |
| 31 | #define CAPI_CONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN+4+1) | 31 | #define CAPI_CONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 1) |
| 32 | #define CAPI_CONNECT_B3_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN+4+1) | 32 | #define CAPI_CONNECT_B3_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 1) |
| 33 | #define CAPI_DATA_B3_REQ_LEN64 (CAPI_MSG_BASELEN+4+4+2+2+2+8) | 33 | #define CAPI_DATA_B3_REQ_LEN64 (CAPI_MSG_BASELEN + 4 + 4 + 2 + 2 + 2 + 8) |
| 34 | #define CAPI_DATA_B3_CONF_LEN (CAPI_MSG_BASELEN+4+2+2) | 34 | #define CAPI_DATA_B3_CONF_LEN (CAPI_MSG_BASELEN + 4 + 2 + 2) |
| 35 | #define CAPI_DISCONNECT_IND_LEN (CAPI_MSG_BASELEN+4+2) | 35 | #define CAPI_DISCONNECT_IND_LEN (CAPI_MSG_BASELEN + 4 + 2) |
| 36 | #define CAPI_DISCONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN+4+2+1) | 36 | #define CAPI_DISCONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 2 + 1) |
| 37 | #define CAPI_FACILITY_CONF_BASELEN (CAPI_MSG_BASELEN+4+2+2+1) | 37 | #define CAPI_FACILITY_CONF_BASELEN (CAPI_MSG_BASELEN + 4 + 2 + 2 + 1) |
| 38 | /* most _CONF messages contain only Controller/PLCI/NCCI and Info parameters */ | 38 | /* most _CONF messages contain only Controller/PLCI/NCCI and Info parameters */ |
| 39 | #define CAPI_STDCONF_LEN (CAPI_MSG_BASELEN+4+2) | 39 | #define CAPI_STDCONF_LEN (CAPI_MSG_BASELEN + 4 + 2) |
| 40 | 40 | ||
| 41 | #define CAPI_FACILITY_HANDSET 0x0000 | 41 | #define CAPI_FACILITY_HANDSET 0x0000 |
| 42 | #define CAPI_FACILITY_DTMF 0x0001 | 42 | #define CAPI_FACILITY_DTMF 0x0001 |
| @@ -97,10 +97,10 @@ struct gigaset_capi_ctr { · 54 unmodified lines | |||
| 97 | /* two _cmsg structures possibly used concurrently: */ | 97 | /* two _cmsg structures possibly used concurrently: */ |
| 98 | _cmsg hcmsg; /* for message composition triggered from hardware */ | 98 | _cmsg hcmsg; /* for message composition triggered from hardware */ |
| 99 | _cmsg acmsg; /* for dissection of messages sent from application */ | 99 | _cmsg acmsg; /* for dissection of messages sent from application */ |
| 100 | u8 bc_buf[MAX_BC_OCTETS+1]; | 100 | u8 bc_buf[MAX_BC_OCTETS + 1]; |
| 101 | u8 hlc_buf[MAX_HLC_OCTETS+1]; | 101 | u8 hlc_buf[MAX_HLC_OCTETS + 1]; |
| 102 | u8 cgpty_buf[MAX_NUMBER_DIGITS+3]; | 102 | u8 cgpty_buf[MAX_NUMBER_DIGITS + 3]; |
| 103 | u8 cdpty_buf[MAX_NUMBER_DIGITS+2]; | 103 | u8 cdpty_buf[MAX_NUMBER_DIGITS + 2]; |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | /* CIP Value table (from CAPI 2.0 standard, ch. 6.1) */ | 106 | /* CIP Value table (from CAPI 2.0 standard, ch. 6.1) */ |
| @@ -109,50 +109,50 @@ static struct { · 2 unmodified lines | |||
| 109 | u8 *hlc; | 109 | u8 *hlc; |
| 110 | } cip2bchlc[] = { | 110 | } cip2bchlc[] = { |
| 111 | [1] = { "8090A3", NULL }, | 111 | [1] = { "8090A3", NULL }, |
| 112 | /* Speech (A-law) */ | 112 | /* Speech (A-law) */ |
| 113 | [2] = { "8890", NULL }, | 113 | [2] = { "8890", NULL }, |
| 114 | /* Unrestricted digital information */ | 114 | /* Unrestricted digital information */ |
| 115 | [3] = { "8990", NULL }, | 115 | [3] = { "8990", NULL }, |
| 116 | /* Restricted digital information */ | 116 | /* Restricted digital information */ |
| 117 | [4] = { "9090A3", NULL }, | 117 | [4] = { "9090A3", NULL }, |
| 118 | /* 3,1 kHz audio (A-law) */ | 118 | /* 3,1 kHz audio (A-law) */ |
| 119 | [5] = { "9190", NULL }, | 119 | [5] = { "9190", NULL }, |
| 120 | /* 7 kHz audio */ | 120 | /* 7 kHz audio */ |
| 121 | [6] = { "9890", NULL }, | 121 | [6] = { "9890", NULL }, |
| 122 | /* Video */ | 122 | /* Video */ |
| 123 | [7] = { "88C0C6E6", NULL }, | 123 | [7] = { "88C0C6E6", NULL }, |
| 124 | /* Packet mode */ | 124 | /* Packet mode */ |
| 125 | [8] = { "8890218F", NULL }, | 125 | [8] = { "8890218F", NULL }, |
| 126 | /* 56 kbit/s rate adaptation */ | 126 | /* 56 kbit/s rate adaptation */ |
| 127 | [9] = { "9190A5", NULL }, | 127 | [9] = { "9190A5", NULL }, |
| 128 | /* Unrestricted digital information with tones/announcements */ | 128 | /* Unrestricted digital information with tones/announcements */ |
| 129 | [16] = { "8090A3", "9181" }, | 129 | [16] = { "8090A3", "9181" }, |
| 130 | /* Telephony */ | 130 | /* Telephony */ |
| 131 | [17] = { "9090A3", "9184" }, | 131 | [17] = { "9090A3", "9184" }, |
| 132 | /* Group 2/3 facsimile */ | 132 | /* Group 2/3 facsimile */ |
| 133 | [18] = { "8890", "91A1" }, | 133 | [18] = { "8890", "91A1" }, |
| 134 | /* Group 4 facsimile Class 1 */ | 134 | /* Group 4 facsimile Class 1 */ |
| 135 | [19] = { "8890", "91A4" }, | 135 | [19] = { "8890", "91A4" }, |
| 136 | /* Teletex service basic and mixed mode | 136 | /* Teletex service basic and mixed mode |
| 137 | and Group 4 facsimile service Classes II and III */ | 137 | and Group 4 facsimile service Classes II and III */ |
| 138 | [20] = { "8890", "91A8" }, | 138 | [20] = { "8890", "91A8" }, |
| 139 | /* Teletex service basic and processable mode */ | 139 | /* Teletex service basic and processable mode */ |
| 140 | [21] = { "8890", "91B1" }, | 140 | [21] = { "8890", "91B1" }, |
| 141 | /* Teletex service basic mode */ | 141 | /* Teletex service basic mode */ |
| 142 | [22] = { "8890", "91B2" }, | 142 | [22] = { "8890", "91B2" }, |
| 143 | /* International interworking for Videotex */ | 143 | /* International interworking for Videotex */ |
| 144 | [23] = { "8890", "91B5" }, | 144 | [23] = { "8890", "91B5" }, |
| 145 | /* Telex */ | 145 | /* Telex */ |
| 146 | [24] = { "8890", "91B8" }, | 146 | [24] = { "8890", "91B8" }, |
| 147 | /* Message Handling Systems in accordance with X.400 */ | 147 | /* Message Handling Systems in accordance with X.400 */ |
| 148 | [25] = { "8890", "91C1" }, | 148 | [25] = { "8890", "91C1" }, |
| 149 | /* OSI application in accordance with X.200 */ | 149 | /* OSI application in accordance with X.200 */ |
| 150 | [26] = { "9190A5", "9181" }, | 150 | [26] = { "9190A5", "9181" }, |
| 151 | /* 7 kHz telephony */ | 151 | /* 7 kHz telephony */ |
| 152 | [27] = { "9190A5", "916001" }, | 152 | [27] = { "9190A5", "916001" }, |
| 153 | /* Video telephony, first connection */ | 153 | /* Video telephony, first connection */ |
| 154 | [28] = { "8890", "916002" }, | 154 | [28] = { "8890", "916002" }, |
| 155 | /* Video telephony, second connection */ | 155 | /* Video telephony, second connection */ |
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | /* | 158 | /* |
| @@ -164,7 +164,7 @@ static struct { · 5 unmodified lines | |||
| 164 | * emit unsupported parameter warning | 164 | * emit unsupported parameter warning |
| 165 | */ | 165 | */ |
| 166 | static inline void ignore_cstruct_param(struct cardstate *cs, _cstruct param, | 166 | static inline void ignore_cstruct_param(struct cardstate *cs, _cstruct param, |
| 167 | char *msgname, char *paramname) | 167 | char *msgname, char *paramname) |
| 168 | { | 168 | { |
| 169 | if (param && *param) | 169 | if (param && *param) |
| 170 | dev_warn(cs->dev, "%s: ignoring unsupported parameter: %s\n", | 170 | dev_warn(cs->dev, "%s: ignoring unsupported parameter: %s\n", |
| @@ -259,15 +259,15 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag, · 88 unmodified lines | |||
| 259 | CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l, | 259 | CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l, |
| 260 | CAPIMSG_CONTROL(data)); | 260 | CAPIMSG_CONTROL(data)); |
| 261 | l -= 12; | 261 | l -= 12; |
| 262 | dbgline = kmalloc(3*l, GFP_ATOMIC); | 262 | dbgline = kmalloc(3 * l, GFP_ATOMIC); |
| 263 | if (!dbgline) | 263 | if (!dbgline) |
| 264 | return; | 264 | return; |
| 265 | for (i = 0; i < l; i++) { | 265 | for (i = 0; i < l; i++) { |
| 266 | dbgline[3*i] = hex_asc_hi(data[12+i]); | 266 | dbgline[3 * i] = hex_asc_hi(data[12 + i]); |
| 267 | dbgline[3*i+1] = hex_asc_lo(data[12+i]); | 267 | dbgline[3 * i + 1] = hex_asc_lo(data[12 + i]); |
| 268 | dbgline[3*i+2] = ' '; | 268 | dbgline[3 * i + 2] = ' '; |
| 269 | } | 269 | } |
| 270 | dbgline[3*l-1] = '\0'; | 270 | dbgline[3 * l - 1] = '\0'; |
| 271 | gig_dbg(level, " %s", dbgline); | 271 | gig_dbg(level, " %s", dbgline); |
| 272 | kfree(dbgline); | 272 | kfree(dbgline); |
| 273 | if (CAPIMSG_COMMAND(data) == CAPI_DATA_B3 && | 273 | if (CAPIMSG_COMMAND(data) == CAPI_DATA_B3 && |
| @@ -279,16 +279,16 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag, · 5 unmodified lines | |||
| 279 | return; | 279 | return; |
| 280 | if (l > 64) | 280 | if (l > 64) |
| 281 | l = 64; /* arbitrary limit */ | 281 | l = 64; /* arbitrary limit */ |
| 282 | dbgline = kmalloc(3*l, GFP_ATOMIC); | 282 | dbgline = kmalloc(3 * l, GFP_ATOMIC); |
| 283 | if (!dbgline) | 283 | if (!dbgline) |
| 284 | return; | 284 | return; |
| 285 | data += CAPIMSG_LEN(data); | 285 | data += CAPIMSG_LEN(data); |
| 286 | for (i = 0; i < l; i++) { | 286 | for (i = 0; i < l; i++) { |
| 287 | dbgline[3*i] = hex_asc_hi(data[i]); | 287 | dbgline[3 * i] = hex_asc_hi(data[i]); |
| 288 | dbgline[3*i+1] = hex_asc_lo(data[i]); | 288 | dbgline[3 * i + 1] = hex_asc_lo(data[i]); |
| 289 | dbgline[3*i+2] = ' '; | 289 | dbgline[3 * i + 2] = ' '; |
| 290 | } | 290 | } |
| 291 | dbgline[3*l-1] = '\0'; | 291 | dbgline[3 * l - 1] = '\0'; |
| 292 | gig_dbg(level, " %s", dbgline); | 292 | gig_dbg(level, " %s", dbgline); |
| 293 | kfree(dbgline); | 293 | kfree(dbgline); |
| 294 | } | 294 | } |
| @@ -301,7 +301,7 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag, · 6 unmodified lines | |||
| 301 | 301 | ||
| 302 | static const char *format_ie(const char *ie) | 302 | static const char *format_ie(const char *ie) |
| 303 | { | 303 | { |
| 304 | static char result[3*MAX_FMT_IE_LEN]; | 304 | static char result[3 * MAX_FMT_IE_LEN]; |
| 305 | int len, count; | 305 | int len, count; |
| 306 | char *pout = result; | 306 | char *pout = result; |
| 307 | 307 | ||
| @@ -310,7 +310,7 @@ static const char *format_ie(const char *ie) · 2 unmodified lines | |||
| 310 | 310 | ||
| 311 | count = len = ie[0]; | 311 | count = len = ie[0]; |
| 312 | if (count > MAX_FMT_IE_LEN) | 312 | if (count > MAX_FMT_IE_LEN) |
| 313 | count = MAX_FMT_IE_LEN-1; | 313 | count = MAX_FMT_IE_LEN - 1; |
| 314 | while (count--) { | 314 | while (count--) { |
| 315 | *pout++ = hex_asc_hi(*++ie); | 315 | *pout++ = hex_asc_hi(*++ie); |
| 316 | *pout++ = hex_asc_lo(*ie); | 316 | *pout++ = hex_asc_lo(*ie); |
| @@ -403,8 +403,8 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb) · 86 unmodified lines | |||
| 403 | send_data_b3_conf(cs, &iif->ctr, ap->id, CAPIMSG_MSGID(req), | 403 | send_data_b3_conf(cs, &iif->ctr, ap->id, CAPIMSG_MSGID(req), |
| 404 | bcs->channel + 1, CAPIMSG_HANDLE_REQ(req), | 404 | bcs->channel + 1, CAPIMSG_HANDLE_REQ(req), |
| 405 | (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) ? | 405 | (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) ? |
| 406 | CapiFlagsNotSupportedByProtocol : | 406 | CapiFlagsNotSupportedByProtocol : |
| 407 | CAPI_NOERROR); | 407 | CAPI_NOERROR); |
| 408 | } | 408 | } |
| 409 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); | 409 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); |
| 410 | 410 | ||
| @@ -589,7 +589,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) · 178 unmodified lines | |||
| 589 | } | 589 | } |
| 590 | iif->cdpty_buf[0] = i + 1; | 590 | iif->cdpty_buf[0] = i + 1; |
| 591 | iif->cdpty_buf[1] = 0x80; /* type / numbering plan unknown */ | 591 | iif->cdpty_buf[1] = 0x80; /* type / numbering plan unknown */ |
| 592 | memcpy(iif->cdpty_buf+2, at_state->str_var[STR_ZCPN], i); | 592 | memcpy(iif->cdpty_buf + 2, at_state->str_var[STR_ZCPN], i); |
| 593 | iif->hcmsg.CalledPartyNumber = iif->cdpty_buf; | 593 | iif->hcmsg.CalledPartyNumber = iif->cdpty_buf; |
| 594 | msgsize += iif->hcmsg.CalledPartyNumber[0]; | 594 | msgsize += iif->hcmsg.CalledPartyNumber[0]; |
| 595 | } | 595 | } |
| @@ -605,7 +605,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) · 9 unmodified lines | |||
| 605 | iif->cgpty_buf[0] = i + 2; | 605 | iif->cgpty_buf[0] = i + 2; |
| 606 | iif->cgpty_buf[1] = 0x00; /* type / numbering plan unknown */ | 606 | iif->cgpty_buf[1] = 0x00; /* type / numbering plan unknown */ |
| 607 | iif->cgpty_buf[2] = 0x80; /* pres. allowed, not screened */ | 607 | iif->cgpty_buf[2] = 0x80; /* pres. allowed, not screened */ |
| 608 | memcpy(iif->cgpty_buf+3, at_state->str_var[STR_NMBR], i); | 608 | memcpy(iif->cgpty_buf + 3, at_state->str_var[STR_NMBR], i); |
| 609 | iif->hcmsg.CallingPartyNumber = iif->cgpty_buf; | 609 | iif->hcmsg.CallingPartyNumber = iif->cgpty_buf; |
| 610 | msgsize += iif->hcmsg.CallingPartyNumber[0]; | 610 | msgsize += iif->hcmsg.CallingPartyNumber[0]; |
| 611 | } | 611 | } |
| @@ -977,7 +977,7 @@ void gigaset_isdn_stop(struct cardstate *cs) · 365 unmodified lines | |||
| 977 | * register CAPI application | 977 | * register CAPI application |
| 978 | */ | 978 | */ |
| 979 | static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, | 979 | static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, |
| 980 | capi_register_params *rp) | 980 | capi_register_params *rp) |
| 981 | { | 981 | { |
| 982 | struct gigaset_capi_ctr *iif | 982 | struct gigaset_capi_ctr *iif |
| 983 | = container_of(ctr, struct gigaset_capi_ctr, ctr); | 983 | = container_of(ctr, struct gigaset_capi_ctr, ctr); |
| @@ -1181,21 +1181,21 @@ static void do_facility_req(struct gigaset_capi_ctr *iif, · 197 unmodified lines | |||
| 1181 | } | 1181 | } |
| 1182 | if (CAPIMSG_U32(pparam, 4) != 0) { | 1182 | if (CAPIMSG_U32(pparam, 4) != 0) { |
| 1183 | dev_notice(cs->dev, | 1183 | dev_notice(cs->dev, |
| 1184 | "%s: unsupported supplementary service notification mask 0x%x\n", | 1184 | "%s: unsupported supplementary service notification mask 0x%x\n", |
| 1185 | "FACILITY_REQ", CAPIMSG_U32(pparam, 4)); | 1185 | "FACILITY_REQ", CAPIMSG_U32(pparam, 4)); |
| 1186 | info = CapiFacilitySpecificFunctionNotSupported; | 1186 | info = CapiFacilitySpecificFunctionNotSupported; |
| 1187 | confparam[3] = 2; /* length */ | 1187 | confparam[3] = 2; /* length */ |
| 1188 | capimsg_setu16(confparam, 4, | 1188 | capimsg_setu16(confparam, 4, |
| 1189 | CapiSupplementaryServiceNotSupported); | 1189 | CapiSupplementaryServiceNotSupported); |
| 1190 | } | 1190 | } |
| 1191 | info = CapiSuccess; | 1191 | info = CapiSuccess; |
| 1192 | confparam[3] = 2; /* length */ | 1192 | confparam[3] = 2; /* length */ |
| 1193 | capimsg_setu16(confparam, 4, CapiSuccess); | 1193 | capimsg_setu16(confparam, 4, CapiSuccess); |
| 1194 | break; | 1194 | break; |
| 1195 | /* ToDo: add supported services */ | 1195 | /* ToDo: add supported services */ |
| 1196 | default: | 1196 | default: |
| 1197 | dev_notice(cs->dev, | 1197 | dev_notice(cs->dev, |
| 1198 | "%s: unsupported supplementary service function 0x%04x\n", | 1198 | "%s: unsupported supplementary service function 0x%04x\n", |
| 1199 | "FACILITY_REQ", function); | 1199 | "FACILITY_REQ", function); |
| 1200 | info = CapiFacilitySpecificFunctionNotSupported; | 1200 | info = CapiFacilitySpecificFunctionNotSupported; |
| 1201 | /* Supplementary Service specific parameter */ | 1201 | /* Supplementary Service specific parameter */ |
| @@ -1318,7 +1318,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, · 116 unmodified lines | |||
| 1318 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; | 1318 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; |
| 1319 | 1319 | ||
| 1320 | /* build command table */ | 1320 | /* build command table */ |
| 1321 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_KERNEL); | 1321 | commands = kzalloc(AT_NUM * (sizeof *commands), GFP_KERNEL); |
| 1322 | if (!commands) | 1322 | if (!commands) |
| 1323 | goto oom; | 1323 | goto oom; |
| 1324 | 1324 | ||
| @@ -1353,10 +1353,10 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, · 28 unmodified lines | |||
| 1353 | commands[AT_TYPE] = kstrdup(s, GFP_KERNEL); | 1353 | commands[AT_TYPE] = kstrdup(s, GFP_KERNEL); |
| 1354 | if (!commands[AT_TYPE]) | 1354 | if (!commands[AT_TYPE]) |
| 1355 | goto oom; | 1355 | goto oom; |
| 1356 | commands[AT_DIAL] = kmalloc(l+3, GFP_KERNEL); | 1356 | commands[AT_DIAL] = kmalloc(l + 3, GFP_KERNEL); |
| 1357 | if (!commands[AT_DIAL]) | 1357 | if (!commands[AT_DIAL]) |
| 1358 | goto oom; | 1358 | goto oom; |
| 1359 | snprintf(commands[AT_DIAL], l+3, "D%.*s\r", l, pp); | 1359 | snprintf(commands[AT_DIAL], l + 3, "D%.*s\r", l, pp); |
| 1360 | 1360 | ||
| 1361 | /* encode parameter: Calling party number */ | 1361 | /* encode parameter: Calling party number */ |
| 1362 | pp = cmsg->CallingPartyNumber; | 1362 | pp = cmsg->CallingPartyNumber; |
| @@ -1406,10 +1406,10 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, · 43 unmodified lines | |||
| 1406 | 1406 | ||
| 1407 | if (l) { | 1407 | if (l) { |
| 1408 | /* number */ | 1408 | /* number */ |
| 1409 | commands[AT_MSN] = kmalloc(l+8, GFP_KERNEL); | 1409 | commands[AT_MSN] = kmalloc(l + 8, GFP_KERNEL); |
| 1410 | if (!commands[AT_MSN]) | 1410 | if (!commands[AT_MSN]) |
| 1411 | goto oom; | 1411 | goto oom; |
| 1412 | snprintf(commands[AT_MSN], l+8, "^SMSN=%*s\r", l, pp); | 1412 | snprintf(commands[AT_MSN], l + 8, "^SMSN=%*s\r", l, pp); |
| 1413 | } | 1413 | } |
| 1414 | } | 1414 | } |
| 1415 | 1415 | ||
| @@ -1430,13 +1430,13 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, · 14 unmodified lines | |||
| 1430 | 1430 | ||
| 1431 | /* determine lengths */ | 1431 | /* determine lengths */ |
| 1432 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ | 1432 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ |
| 1433 | lbc = 2*cmsg->BC[0]; | 1433 | lbc = 2 * cmsg->BC[0]; |
| 1434 | else if (cip2bchlc[cmsg->CIPValue].bc) /* BC derived from CIP */ | 1434 | else if (cip2bchlc[cmsg->CIPValue].bc) /* BC derived from CIP */ |
| 1435 | lbc = strlen(cip2bchlc[cmsg->CIPValue].bc); | 1435 | lbc = strlen(cip2bchlc[cmsg->CIPValue].bc); |
| 1436 | else /* no BC */ | 1436 | else /* no BC */ |
| 1437 | lbc = 0; | 1437 | lbc = 0; |
| 1438 | if (cmsg->HLC && cmsg->HLC[0]) /* HLC specified explicitly */ | 1438 | if (cmsg->HLC && cmsg->HLC[0]) /* HLC specified explicitly */ |
| 1439 | lhlc = 2*cmsg->HLC[0]; | 1439 | lhlc = 2 * cmsg->HLC[0]; |
| 1440 | else if (cip2bchlc[cmsg->CIPValue].hlc) /* HLC derived from CIP */ | 1440 | else if (cip2bchlc[cmsg->CIPValue].hlc) /* HLC derived from CIP */ |
| 1441 | lhlc = strlen(cip2bchlc[cmsg->CIPValue].hlc); | 1441 | lhlc = strlen(cip2bchlc[cmsg->CIPValue].hlc); |
| 1442 | else /* no HLC */ | 1442 | else /* no HLC */ |
| @@ -1481,7 +1481,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, · 38 unmodified lines | |||
| 1481 | if (cmsg->BProtocol == CAPI_DEFAULT) { | 1481 | if (cmsg->BProtocol == CAPI_DEFAULT) { |
| 1482 | bcs->proto2 = L2_HDLC; | 1482 | bcs->proto2 = L2_HDLC; |
| 1483 | dev_warn(cs->dev, | 1483 | dev_warn(cs->dev, |
| 1484 | "B2 Protocol X.75 SLP unsupported, using Transparent\n"); | 1484 | "B2 Protocol X.75 SLP unsupported, using Transparent\n"); |
| 1485 | } else { | 1485 | } else { |
| 1486 | switch (cmsg->B1protocol) { | 1486 | switch (cmsg->B1protocol) { |
| 1487 | case 0: | 1487 | case 0: |
| @@ -1492,24 +1492,24 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, · 4 unmodified lines | |||
| 1492 | break; | 1492 | break; |
| 1493 | default: | 1493 | default: |
| 1494 | dev_warn(cs->dev, | 1494 | dev_warn(cs->dev, |
| 1495 | "B1 Protocol %u unsupported, using Transparent\n", | 1495 | "B1 Protocol %u unsupported, using Transparent\n", |
| 1496 | cmsg->B1protocol); | 1496 | cmsg->B1protocol); |
| 1497 | bcs->proto2 = L2_VOICE; | 1497 | bcs->proto2 = L2_VOICE; |
| 1498 | } | 1498 | } |
| 1499 | if (cmsg->B2protocol != 1) | 1499 | if (cmsg->B2protocol != 1) |
| 1500 | dev_warn(cs->dev, | 1500 | dev_warn(cs->dev, |
| 1501 | "B2 Protocol %u unsupported, using Transparent\n", | 1501 | "B2 Protocol %u unsupported, using Transparent\n", |
| 1502 | cmsg->B2protocol); | 1502 | cmsg->B2protocol); |
| 1503 | if (cmsg->B3protocol != 0) | 1503 | if (cmsg->B3protocol != 0) |
| 1504 | dev_warn(cs->dev, | 1504 | dev_warn(cs->dev, |
| 1505 | "B3 Protocol %u unsupported, using Transparent\n", | 1505 | "B3 Protocol %u unsupported, using Transparent\n", |
| 1506 | cmsg->B3protocol); | 1506 | cmsg->B3protocol); |
| 1507 | ignore_cstruct_param(cs, cmsg->B1configuration, | 1507 | ignore_cstruct_param(cs, cmsg->B1configuration, |
| 1508 | "CONNECT_REQ", "B1 Configuration"); | 1508 | "CONNECT_REQ", "B1 Configuration"); |
| 1509 | ignore_cstruct_param(cs, cmsg->B2configuration, | 1509 | ignore_cstruct_param(cs, cmsg->B2configuration, |
| 1510 | "CONNECT_REQ", "B2 Configuration"); | 1510 | "CONNECT_REQ", "B2 Configuration"); |
| 1511 | ignore_cstruct_param(cs, cmsg->B3configuration, | 1511 | ignore_cstruct_param(cs, cmsg->B3configuration, |
| 1512 | "CONNECT_REQ", "B3 Configuration"); | 1512 | "CONNECT_REQ", "B3 Configuration"); |
| 1513 | } | 1513 | } |
| 1514 | commands[AT_PROTO] = kmalloc(9, GFP_KERNEL); | 1514 | commands[AT_PROTO] = kmalloc(9, GFP_KERNEL); |
| 1515 | if (!commands[AT_PROTO]) | 1515 | if (!commands[AT_PROTO]) |
| @@ -1518,20 +1518,20 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, · 2 unmodified lines | |||
| 1518 | 1518 | ||
| 1519 | /* ToDo: check/encode remaining parameters */ | 1519 | /* ToDo: check/encode remaining parameters */ |
| 1520 | ignore_cstruct_param(cs, cmsg->CalledPartySubaddress, | 1520 | ignore_cstruct_param(cs, cmsg->CalledPartySubaddress, |
| 1521 | "CONNECT_REQ", "Called pty subaddr"); | 1521 | "CONNECT_REQ", "Called pty subaddr"); |
| 1522 | ignore_cstruct_param(cs, cmsg->CallingPartySubaddress, | 1522 | ignore_cstruct_param(cs, cmsg->CallingPartySubaddress, |
| 1523 | "CONNECT_REQ", "Calling pty subaddr"); | 1523 | "CONNECT_REQ", "Calling pty subaddr"); |
| 1524 | ignore_cstruct_param(cs, cmsg->LLC, | 1524 | ignore_cstruct_param(cs, cmsg->LLC, |
| 1525 | "CONNECT_REQ", "LLC"); | 1525 | "CONNECT_REQ", "LLC"); |
| 1526 | if (cmsg->AdditionalInfo != CAPI_DEFAULT) { | 1526 | if (cmsg->AdditionalInfo != CAPI_DEFAULT) { |
| 1527 | ignore_cstruct_param(cs, cmsg->BChannelinformation, | 1527 | ignore_cstruct_param(cs, cmsg->BChannelinformation, |
| 1528 | "CONNECT_REQ", "B Channel Information"); | 1528 | "CONNECT_REQ", "B Channel Information"); |
| 1529 | ignore_cstruct_param(cs, cmsg->Keypadfacility, | 1529 | ignore_cstruct_param(cs, cmsg->Keypadfacility, |
| 1530 | "CONNECT_REQ", "Keypad Facility"); | 1530 | "CONNECT_REQ", "Keypad Facility"); |
| 1531 | ignore_cstruct_param(cs, cmsg->Useruserdata, | 1531 | ignore_cstruct_param(cs, cmsg->Useruserdata, |
| 1532 | "CONNECT_REQ", "User-User Data"); | 1532 | "CONNECT_REQ", "User-User Data"); |
| 1533 | ignore_cstruct_param(cs, cmsg->Facilitydataarray, | 1533 | ignore_cstruct_param(cs, cmsg->Facilitydataarray, |
| 1534 | "CONNECT_REQ", "Facility Data Array"); | 1534 | "CONNECT_REQ", "Facility Data Array"); |
| 1535 | } | 1535 | } |
| 1536 | 1536 | ||
| 1537 | /* encode parameter: B channel to use */ | 1537 | /* encode parameter: B channel to use */ |
| @@ -1602,7 +1602,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, · 64 unmodified lines | |||
| 1602 | if (oap != ap) { | 1602 | if (oap != ap) { |
| 1603 | spin_unlock_irqrestore(&bcs->aplock, flags); | 1603 | spin_unlock_irqrestore(&bcs->aplock, flags); |
| 1604 | send_disconnect_ind(bcs, oap, | 1604 | send_disconnect_ind(bcs, oap, |
| 1605 | CapiCallGivenToOtherApplication); | 1605 | CapiCallGivenToOtherApplication); |
| 1606 | spin_lock_irqsave(&bcs->aplock, flags); | 1606 | spin_lock_irqsave(&bcs->aplock, flags); |
| 1607 | } | 1607 | } |
| 1608 | } | 1608 | } |
| @@ -1619,7 +1619,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, · 10 unmodified lines | |||
| 1619 | if (cmsg->BProtocol == CAPI_DEFAULT) { | 1619 | if (cmsg->BProtocol == CAPI_DEFAULT) { |
| 1620 | bcs->proto2 = L2_HDLC; | 1620 | bcs->proto2 = L2_HDLC; |
| 1621 | dev_warn(cs->dev, | 1621 | dev_warn(cs->dev, |
| 1622 | "B2 Protocol X.75 SLP unsupported, using Transparent\n"); | 1622 | "B2 Protocol X.75 SLP unsupported, using Transparent\n"); |
| 1623 | } else { | 1623 | } else { |
| 1624 | switch (cmsg->B1protocol) { | 1624 | switch (cmsg->B1protocol) { |
| 1625 | case 0: | 1625 | case 0: |
| @@ -1630,46 +1630,46 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, · 4 unmodified lines | |||
| 1630 | break; | 1630 | break; |
| 1631 | default: | 1631 | default: |
| 1632 | dev_warn(cs->dev, | 1632 | dev_warn(cs->dev, |
| 1633 | "B1 Protocol %u unsupported, using Transparent\n", | 1633 | "B1 Protocol %u unsupported, using Transparent\n", |
| 1634 | cmsg->B1protocol); | 1634 | cmsg->B1protocol); |
| 1635 | bcs->proto2 = L2_VOICE; | 1635 | bcs->proto2 = L2_VOICE; |
| 1636 | } | 1636 | } |
| 1637 | if (cmsg->B2protocol != 1) | 1637 | if (cmsg->B2protocol != 1) |
| 1638 | dev_warn(cs->dev, | 1638 | dev_warn(cs->dev, |
| 1639 | "B2 Protocol %u unsupported, using Transparent\n", | 1639 | "B2 Protocol %u unsupported, using Transparent\n", |
| 1640 | cmsg->B2protocol); | 1640 | cmsg->B2protocol); |
| 1641 | if (cmsg->B3protocol != 0) | 1641 | if (cmsg->B3protocol != 0) |
| 1642 | dev_warn(cs->dev, | 1642 | dev_warn(cs->dev, |
| 1643 | "B3 Protocol %u unsupported, using Transparent\n", | 1643 | "B3 Protocol %u unsupported, using Transparent\n", |
| 1644 | cmsg->B3protocol); | 1644 | cmsg->B3protocol); |
| 1645 | ignore_cstruct_param(cs, cmsg->B1configuration, | 1645 | ignore_cstruct_param(cs, cmsg->B1configuration, |
| 1646 | "CONNECT_RESP", "B1 Configuration"); | 1646 | "CONNECT_RESP", "B1 Configuration"); |
| 1647 | ignore_cstruct_param(cs, cmsg->B2configuration, | 1647 | ignore_cstruct_param(cs, cmsg->B2configuration, |
| 1648 | "CONNECT_RESP", "B2 Configuration"); | 1648 | "CONNECT_RESP", "B2 Configuration"); |
| 1649 | ignore_cstruct_param(cs, cmsg->B3configuration, | 1649 | ignore_cstruct_param(cs, cmsg->B3configuration, |
| 1650 | "CONNECT_RESP", "B3 Configuration"); | 1650 | "CONNECT_RESP", "B3 Configuration"); |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
| 1653 | /* ToDo: check/encode remaining parameters */ | 1653 | /* ToDo: check/encode remaining parameters */ |
| 1654 | ignore_cstruct_param(cs, cmsg->ConnectedNumber, | 1654 | ignore_cstruct_param(cs, cmsg->ConnectedNumber, |
| 1655 | "CONNECT_RESP", "Connected Number"); | 1655 | "CONNECT_RESP", "Connected Number"); |
| 1656 | ignore_cstruct_param(cs, cmsg->ConnectedSubaddress, | 1656 | ignore_cstruct_param(cs, cmsg->ConnectedSubaddress, |
| 1657 | "CONNECT_RESP", "Connected Subaddress"); | 1657 | "CONNECT_RESP", "Connected Subaddress"); |
| 1658 | ignore_cstruct_param(cs, cmsg->LLC, | 1658 | ignore_cstruct_param(cs, cmsg->LLC, |
| 1659 | "CONNECT_RESP", "LLC"); | 1659 | "CONNECT_RESP", "LLC"); |
| 1660 | if (cmsg->AdditionalInfo != CAPI_DEFAULT) { | 1660 | if (cmsg->AdditionalInfo != CAPI_DEFAULT) { |
| 1661 | ignore_cstruct_param(cs, cmsg->BChannelinformation, | 1661 | ignore_cstruct_param(cs, cmsg->BChannelinformation, |
| 1662 | "CONNECT_RESP", "BChannel Information"); | 1662 | "CONNECT_RESP", "BChannel Information"); |
| 1663 | ignore_cstruct_param(cs, cmsg->Keypadfacility, | 1663 | ignore_cstruct_param(cs, cmsg->Keypadfacility, |
| 1664 | "CONNECT_RESP", "Keypad Facility"); | 1664 | "CONNECT_RESP", "Keypad Facility"); |
| 1665 | ignore_cstruct_param(cs, cmsg->Useruserdata, | 1665 | ignore_cstruct_param(cs, cmsg->Useruserdata, |
| 1666 | "CONNECT_RESP", "User-User Data"); | 1666 | "CONNECT_RESP", "User-User Data"); |
| 1667 | ignore_cstruct_param(cs, cmsg->Facilitydataarray, | 1667 | ignore_cstruct_param(cs, cmsg->Facilitydataarray, |
| 1668 | "CONNECT_RESP", "Facility Data Array"); | 1668 | "CONNECT_RESP", "Facility Data Array"); |
| 1669 | } | 1669 | } |
| 1670 | 1670 | ||
| 1671 | /* Accept call */ | 1671 | /* Accept call */ |
| 1672 | if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state, | 1672 | if (!gigaset_add_event(cs, &cs->bcs[channel - 1].at_state, |
| 1673 | EV_ACCEPT, NULL, 0, NULL)) | 1673 | EV_ACCEPT, NULL, 0, NULL)) |
| 1674 | return; | 1674 | return; |
| 1675 | gigaset_schedule_event(cs); | 1675 | gigaset_schedule_event(cs); |
| @@ -1712,7 +1712,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, · 36 unmodified lines | |||
| 1712 | if (oap != ap) { | 1712 | if (oap != ap) { |
| 1713 | spin_unlock_irqrestore(&bcs->aplock, flags); | 1713 | spin_unlock_irqrestore(&bcs->aplock, flags); |
| 1714 | send_disconnect_ind(bcs, oap, | 1714 | send_disconnect_ind(bcs, oap, |
| 1715 | CapiCallGivenToOtherApplication); | 1715 | CapiCallGivenToOtherApplication); |
| 1716 | spin_lock_irqsave(&bcs->aplock, flags); | 1716 | spin_lock_irqsave(&bcs->aplock, flags); |
| 1717 | } | 1717 | } |
| 1718 | } | 1718 | } |
| @@ -1723,7 +1723,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, · 4 unmodified lines | |||
| 1723 | /* reject call - will trigger DISCONNECT_IND for this app */ | 1723 | /* reject call - will trigger DISCONNECT_IND for this app */ |
| 1724 | dev_info(cs->dev, "%s: Reject=%x\n", | 1724 | dev_info(cs->dev, "%s: Reject=%x\n", |
| 1725 | "CONNECT_RESP", cmsg->Reject); | 1725 | "CONNECT_RESP", cmsg->Reject); |
| 1726 | if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state, | 1726 | if (!gigaset_add_event(cs, &cs->bcs[channel - 1].at_state, |
| 1727 | EV_HUP, NULL, 0, NULL)) | 1727 | EV_HUP, NULL, 0, NULL)) |
| 1728 | return; | 1728 | return; |
| 1729 | gigaset_schedule_event(cs); | 1729 | gigaset_schedule_event(cs); |
| @@ -1756,7 +1756,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, · 26 unmodified lines | |||
| 1756 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1756 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
| 1757 | return; | 1757 | return; |
| 1758 | } | 1758 | } |
| 1759 | bcs = &cs->bcs[channel-1]; | 1759 | bcs = &cs->bcs[channel - 1]; |
| 1760 | 1760 | ||
| 1761 | /* mark logical connection active */ | 1761 | /* mark logical connection active */ |
| 1762 | bcs->apconnstate = APCONN_ACTIVE; | 1762 | bcs->apconnstate = APCONN_ACTIVE; |
| @@ -1767,7 +1767,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, · 4 unmodified lines | |||
| 1767 | /* NCPI parameter: not applicable for B3 Transparent */ | 1767 | /* NCPI parameter: not applicable for B3 Transparent */ |
| 1768 | ignore_cstruct_param(cs, cmsg->NCPI, "CONNECT_B3_REQ", "NCPI"); | 1768 | ignore_cstruct_param(cs, cmsg->NCPI, "CONNECT_B3_REQ", "NCPI"); |
| 1769 | send_conf(iif, ap, skb, (cmsg->NCPI && cmsg->NCPI[0]) ? | 1769 | send_conf(iif, ap, skb, (cmsg->NCPI && cmsg->NCPI[0]) ? |
| 1770 | CapiNcpiNotSupportedByProtocol : CapiSuccess); | 1770 | CapiNcpiNotSupportedByProtocol : CapiSuccess); |
| 1771 | } | 1771 | } |
| 1772 | 1772 | ||
| 1773 | /* | 1773 | /* |
| @@ -1801,7 +1801,7 @@ static void do_connect_b3_resp(struct gigaset_capi_ctr *iif, · 27 unmodified lines | |||
| 1801 | dev_kfree_skb_any(skb); | 1801 | dev_kfree_skb_any(skb); |
| 1802 | return; | 1802 | return; |
| 1803 | } | 1803 | } |
| 1804 | bcs = &cs->bcs[channel-1]; | 1804 | bcs = &cs->bcs[channel - 1]; |
| 1805 | 1805 | ||
| 1806 | if (cmsg->Reject) { | 1806 | if (cmsg->Reject) { |
| 1807 | /* Reject: clear B3 connect received flag */ | 1807 | /* Reject: clear B3 connect received flag */ |
| @@ -1905,7 +1905,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif, · 97 unmodified lines | |||
| 1905 | return; | 1905 | return; |
| 1906 | } | 1906 | } |
| 1907 | capi_cmsg2message(b3cmsg, | 1907 | capi_cmsg2message(b3cmsg, |
| 1908 | __skb_put(b3skb, CAPI_DISCONNECT_B3_IND_BASELEN)); | 1908 | __skb_put(b3skb, CAPI_DISCONNECT_B3_IND_BASELEN)); |
| 1909 | kfree(b3cmsg); | 1909 | kfree(b3cmsg); |
| 1910 | capi_ctr_handle_message(&iif->ctr, ap->id, b3skb); | 1910 | capi_ctr_handle_message(&iif->ctr, ap->id, b3skb); |
| 1911 | } | 1911 | } |
| @@ -1947,7 +1947,7 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, · 35 unmodified lines | |||
| 1947 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1947 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
| 1948 | return; | 1948 | return; |
| 1949 | } | 1949 | } |
| 1950 | bcs = &cs->bcs[channel-1]; | 1950 | bcs = &cs->bcs[channel - 1]; |
| 1951 | 1951 | ||
| 1952 | /* reject if logical connection not active */ | 1952 | /* reject if logical connection not active */ |
| 1953 | if (bcs->apconnstate < APCONN_ACTIVE) { | 1953 | if (bcs->apconnstate < APCONN_ACTIVE) { |
| @@ -1965,9 +1965,9 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, · 11 unmodified lines | |||
| 1965 | 1965 | ||
| 1966 | /* NCPI parameter: not applicable for B3 Transparent */ | 1966 | /* NCPI parameter: not applicable for B3 Transparent */ |
| 1967 | ignore_cstruct_param(cs, cmsg->NCPI, | 1967 | ignore_cstruct_param(cs, cmsg->NCPI, |
| 1968 | "DISCONNECT_B3_REQ", "NCPI"); | 1968 | "DISCONNECT_B3_REQ", "NCPI"); |
| 1969 | send_conf(iif, ap, skb, (cmsg->NCPI && cmsg->NCPI[0]) ? | 1969 | send_conf(iif, ap, skb, (cmsg->NCPI && cmsg->NCPI[0]) ? |
| 1970 | CapiNcpiNotSupportedByProtocol : CapiSuccess); | 1970 | CapiNcpiNotSupportedByProtocol : CapiSuccess); |
| 1971 | } | 1971 | } |
| 1972 | 1972 | ||
| 1973 | /* | 1973 | /* |
| @@ -1997,7 +1997,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, · 23 unmodified lines | |||
| 1997 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1997 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
| 1998 | return; | 1998 | return; |
| 1999 | } | 1999 | } |
| 2000 | bcs = &cs->bcs[channel-1]; | 2000 | bcs = &cs->bcs[channel - 1]; |
| 2001 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) | 2001 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) |
| 2002 | dev_notice(cs->dev, "%s: unexpected length %d\n", | 2002 | dev_notice(cs->dev, "%s: unexpected length %d\n", |
| 2003 | "DATA_B3_REQ", msglen); | 2003 | "DATA_B3_REQ", msglen); |
| @@ -2040,7 +2040,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, · 36 unmodified lines | |||
| 2040 | if (!(flags & CAPI_FLAGS_DELIVERY_CONFIRMATION)) | 2040 | if (!(flags & CAPI_FLAGS_DELIVERY_CONFIRMATION)) |
| 2041 | send_data_b3_conf(cs, &iif->ctr, ap->id, msgid, channel, handle, | 2041 | send_data_b3_conf(cs, &iif->ctr, ap->id, msgid, channel, handle, |
| 2042 | flags ? CapiFlagsNotSupportedByProtocol | 2042 | flags ? CapiFlagsNotSupportedByProtocol |
| 2043 | : CAPI_NOERROR); | 2043 | : CAPI_NOERROR); |
| 2044 | } | 2044 | } |
| 2045 | 2045 | ||
| 2046 | /* | 2046 | /* |
| @@ -2258,11 +2258,11 @@ static int gigaset_proc_show(struct seq_file *m, void *v) · 211 unmodified lines | |||
| 2258 | 2258 | ||
| 2259 | seq_printf(m, "%-16s %s\n", "name", ctr->name); | 2259 | seq_printf(m, "%-16s %s\n", "name", ctr->name); |
| 2260 | seq_printf(m, "%-16s %s %s\n", "dev", | 2260 | seq_printf(m, "%-16s %s %s\n", "dev", |
| 2261 | dev_driver_string(cs->dev), dev_name(cs->dev)); | 2261 | dev_driver_string(cs->dev), dev_name(cs->dev)); |
| 2262 | seq_printf(m, "%-16s %d\n", "id", cs->myid); | 2262 | seq_printf(m, "%-16s %d\n", "id", cs->myid); |
| 2263 | if (cs->gotfwver) | 2263 | if (cs->gotfwver) |
| 2264 | seq_printf(m, "%-16s %d.%d.%d.%d\n", "firmware", | 2264 | seq_printf(m, "%-16s %d.%d.%d.%d\n", "firmware", |
| 2265 | cs->fwver[0], cs->fwver[1], cs->fwver[2], cs->fwver[3]); | 2265 | cs->fwver[0], cs->fwver[1], cs->fwver[2], cs->fwver[3]); |
| 2266 | seq_printf(m, "%-16s %d\n", "channels", cs->channels); | 2266 | seq_printf(m, "%-16s %d\n", "channels", cs->channels); |
| 2267 | seq_printf(m, "%-16s %s\n", "onechannel", cs->onechannel ? "yes" : "no"); | 2267 | seq_printf(m, "%-16s %s\n", "onechannel", cs->onechannel ? "yes" : "no"); |
| 2268 | 2268 | ||
| @@ -2315,13 +2315,13 @@ static int gigaset_proc_show(struct seq_file *m, void *v) · 46 unmodified lines | |||
| 2315 | 2315 | ||
| 2316 | for (i = 0; i < cs->channels; i++) { | 2316 | for (i = 0; i < cs->channels; i++) { |
| 2317 | seq_printf(m, "[%d]%-13s %d\n", i, "corrupted", | 2317 | seq_printf(m, "[%d]%-13s %d\n", i, "corrupted", |
| 2318 | cs->bcs[i].corrupted); | 2318 | cs->bcs[i].corrupted); |
| 2319 | seq_printf(m, "[%d]%-13s %d\n", i, "trans_down", | 2319 | seq_printf(m, "[%d]%-13s %d\n", i, "trans_down", |
| 2320 | cs->bcs[i].trans_down); | 2320 | cs->bcs[i].trans_down); |
| 2321 | seq_printf(m, "[%d]%-13s %d\n", i, "trans_up", | 2321 | seq_printf(m, "[%d]%-13s %d\n", i, "trans_up", |
| 2322 | cs->bcs[i].trans_up); | 2322 | cs->bcs[i].trans_up); |
| 2323 | seq_printf(m, "[%d]%-13s %d\n", i, "chstate", | 2323 | seq_printf(m, "[%d]%-13s %d\n", i, "chstate", |
| 2324 | cs->bcs[i].chstate); | 2324 | cs->bcs[i].chstate); |
| 2325 | switch (cs->bcs[i].proto2) { | 2325 | switch (cs->bcs[i].proto2) { |
| 2326 | case L2_BITSYNC: | 2326 | case L2_BITSYNC: |
| 2327 | s = "bitsync"; | 2327 | s = "bitsync"; |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | /* Module parameters */ | 30 | /* Module parameters */ |
| 31 | int gigaset_debuglevel; | 31 | int gigaset_debuglevel; |
| 32 | EXPORT_SYMBOL_GPL(gigaset_debuglevel); | 32 | EXPORT_SYMBOL_GPL(gigaset_debuglevel); |
| 33 | module_param_named(debug, gigaset_debuglevel, int, S_IRUGO|S_IWUSR); | 33 | module_param_named(debug, gigaset_debuglevel, int, S_IRUGO | S_IWUSR); |
| 34 | MODULE_PARM_DESC(debug, "debug level"); | 34 | MODULE_PARM_DESC(debug, "debug level"); |
| 35 | 35 | ||
| 36 | /* driver state flags */ | 36 | /* driver state flags */ |
| @@ -123,7 +123,7 @@ int gigaset_enterconfigmode(struct cardstate *cs) · 86 unmodified lines | |||
| 123 | if (r < 0) | 123 | if (r < 0) |
| 124 | goto error; | 124 | goto error; |
| 125 | } | 125 | } |
| 126 | r = setflags(cs, TIOCM_RTS|TIOCM_DTR, 800); | 126 | r = setflags(cs, TIOCM_RTS | TIOCM_DTR, 800); |
| 127 | if (r < 0) | 127 | if (r < 0) |
| 128 | goto error; | 128 | goto error; |
| 129 | 129 | ||
| @@ -131,8 +131,8 @@ int gigaset_enterconfigmode(struct cardstate *cs) · 1 unmodified line | |||
| 131 | 131 | ||
| 132 | error: | 132 | error: |
| 133 | dev_err(cs->dev, "error %d on setuartbits\n", -r); | 133 | dev_err(cs->dev, "error %d on setuartbits\n", -r); |
| 134 | cs->control_state = TIOCM_RTS|TIOCM_DTR; | 134 | cs->control_state = TIOCM_RTS | TIOCM_DTR; |
| 135 | cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR); | 135 | cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS | TIOCM_DTR); |
| 136 | 136 | ||
| 137 | return -1; | 137 | return -1; |
| 138 | } | 138 | } |
| @@ -591,7 +591,7 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, · 452 unmodified lines | |||
| 591 | if (head > tail) | 591 | if (head > tail) |
| 592 | n = head - 1 - tail; | 592 | n = head - 1 - tail; |
| 593 | else if (head == 0) | 593 | else if (head == 0) |
| 594 | n = (RBUFSIZE-1) - tail; | 594 | n = (RBUFSIZE - 1) - tail; |
| 595 | else | 595 | else |
| 596 | n = RBUFSIZE - tail; | 596 | n = RBUFSIZE - tail; |
| 597 | if (!n) { | 597 | if (!n) { |
| @@ -910,10 +910,10 @@ int gigaset_start(struct cardstate *cs) · 312 unmodified lines | |||
| 910 | spin_unlock_irqrestore(&cs->lock, flags); | 910 | spin_unlock_irqrestore(&cs->lock, flags); |
| 911 | 911 | ||
| 912 | if (cs->mstate != MS_LOCKED) { | 912 | if (cs->mstate != MS_LOCKED) { |
| 913 | cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS); | 913 | cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR | TIOCM_RTS); |
| 914 | cs->ops->baud_rate(cs, B115200); | 914 | cs->ops->baud_rate(cs, B115200); |
| 915 | cs->ops->set_line_ctrl(cs, CS8); | 915 | cs->ops->set_line_ctrl(cs, CS8); |
| 916 | cs->control_state = TIOCM_DTR|TIOCM_RTS; | 916 | cs->control_state = TIOCM_DTR | TIOCM_RTS; |
| 917 | } | 917 | } |
| 918 | 918 | ||
| 919 | cs->waiting = 1; | 919 | cs->waiting = 1; |
| @@ -153,104 +153,104 @@ struct reply_t gigaset_tab_nocid[] = · 152 unmodified lines | |||
| 153 | * action, command */ | 153 | * action, command */ |
| 154 | 154 | ||
| 155 | /* initialize device, set cid mode if possible */ | 155 | /* initialize device, set cid mode if possible */ |
| 156 | {RSP_INIT, -1, -1, SEQ_INIT, 100, 1, {ACT_TIMEOUT} }, | 156 | {RSP_INIT, -1, -1, SEQ_INIT, 100, 1, {ACT_TIMEOUT} }, |
| 157 | 157 | ||
| 158 | {EV_TIMEOUT, 100, 100, -1, 101, 3, {0}, "Z\r"}, | 158 | {EV_TIMEOUT, 100, 100, -1, 101, 3, {0}, "Z\r"}, |
| 159 | {RSP_OK, 101, 103, -1, 120, 5, {ACT_GETSTRING}, | 159 | {RSP_OK, 101, 103, -1, 120, 5, {ACT_GETSTRING}, |
| 160 | "+GMR\r"}, | 160 | "+GMR\r"}, |
| 161 | 161 | ||
| 162 | {EV_TIMEOUT, 101, 101, -1, 102, 5, {0}, "Z\r"}, | 162 | {EV_TIMEOUT, 101, 101, -1, 102, 5, {0}, "Z\r"}, |
| 163 | {RSP_ERROR, 101, 101, -1, 102, 5, {0}, "Z\r"}, | 163 | {RSP_ERROR, 101, 101, -1, 102, 5, {0}, "Z\r"}, |
| 164 | 164 | ||
| 165 | {EV_TIMEOUT, 102, 102, -1, 108, 5, {ACT_SETDLE1}, | 165 | {EV_TIMEOUT, 102, 102, -1, 108, 5, {ACT_SETDLE1}, |
| 166 | "^SDLE=0\r"}, | 166 | "^SDLE=0\r"}, |
| 167 | {RSP_OK, 108, 108, -1, 104, -1}, | 167 | {RSP_OK, 108, 108, -1, 104, -1}, |
| 168 | {RSP_ZDLE, 104, 104, 0, 103, 5, {0}, "Z\r"}, | 168 | {RSP_ZDLE, 104, 104, 0, 103, 5, {0}, "Z\r"}, |
| 169 | {EV_TIMEOUT, 104, 104, -1, 0, 0, {ACT_FAILINIT} }, | 169 | {EV_TIMEOUT, 104, 104, -1, 0, 0, {ACT_FAILINIT} }, |
| 170 | {RSP_ERROR, 108, 108, -1, 0, 0, {ACT_FAILINIT} }, | 170 | {RSP_ERROR, 108, 108, -1, 0, 0, {ACT_FAILINIT} }, |
| 171 | 171 | ||
| 172 | {EV_TIMEOUT, 108, 108, -1, 105, 2, {ACT_SETDLE0, | 172 | {EV_TIMEOUT, 108, 108, -1, 105, 2, {ACT_SETDLE0, |
| 173 | ACT_HUPMODEM, | 173 | ACT_HUPMODEM, |
| 174 | ACT_TIMEOUT} }, | 174 | ACT_TIMEOUT} }, |
| 175 | {EV_TIMEOUT, 105, 105, -1, 103, 5, {0}, "Z\r"}, | 175 | {EV_TIMEOUT, 105, 105, -1, 103, 5, {0}, "Z\r"}, |
| 176 | 176 | ||
| 177 | {RSP_ERROR, 102, 102, -1, 107, 5, {0}, "^GETPRE\r"}, | 177 | {RSP_ERROR, 102, 102, -1, 107, 5, {0}, "^GETPRE\r"}, |
| 178 | {RSP_OK, 107, 107, -1, 0, 0, {ACT_CONFIGMODE} }, | 178 | {RSP_OK, 107, 107, -1, 0, 0, {ACT_CONFIGMODE} }, |
| 179 | {RSP_ERROR, 107, 107, -1, 0, 0, {ACT_FAILINIT} }, | 179 | {RSP_ERROR, 107, 107, -1, 0, 0, {ACT_FAILINIT} }, |
| 180 | {EV_TIMEOUT, 107, 107, -1, 0, 0, {ACT_FAILINIT} }, | 180 | {EV_TIMEOUT, 107, 107, -1, 0, 0, {ACT_FAILINIT} }, |
| 181 | 181 | ||
| 182 | {RSP_ERROR, 103, 103, -1, 0, 0, {ACT_FAILINIT} }, | 182 | {RSP_ERROR, 103, 103, -1, 0, 0, {ACT_FAILINIT} }, |
| 183 | {EV_TIMEOUT, 103, 103, -1, 0, 0, {ACT_FAILINIT} }, | 183 | {EV_TIMEOUT, 103, 103, -1, 0, 0, {ACT_FAILINIT} }, |
| 184 | 184 | ||
| 185 | {RSP_STRING, 120, 120, -1, 121, -1, {ACT_SETVER} }, | 185 | {RSP_STRING, 120, 120, -1, 121, -1, {ACT_SETVER} }, |
| 186 | 186 | ||
| 187 | {EV_TIMEOUT, 120, 121, -1, 0, 0, {ACT_FAILVER, | 187 | {EV_TIMEOUT, 120, 121, -1, 0, 0, {ACT_FAILVER, |
| 188 | ACT_INIT} }, | 188 | ACT_INIT} }, |
| 189 | {RSP_ERROR, 120, 121, -1, 0, 0, {ACT_FAILVER, | 189 | {RSP_ERROR, 120, 121, -1, 0, 0, {ACT_FAILVER, |
| 190 | ACT_INIT} }, | 190 | ACT_INIT} }, |
| 191 | {RSP_OK, 121, 121, -1, 0, 0, {ACT_GOTVER, | 191 | {RSP_OK, 121, 121, -1, 0, 0, {ACT_GOTVER, |
| 192 | ACT_INIT} }, | 192 | ACT_INIT} }, |
| 193 | 193 | ||
| 194 | /* leave dle mode */ | 194 | /* leave dle mode */ |
| 195 | {RSP_INIT, 0, 0, SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"}, | 195 | {RSP_INIT, 0, 0, SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"}, |
| 196 | {RSP_OK, 201, 201, -1, 202, -1}, | 196 | {RSP_OK, 201, 201, -1, 202, -1}, |
| 197 | {RSP_ZDLE, 202, 202, 0, 0, 0, {ACT_DLE0} }, | 197 | {RSP_ZDLE, 202, 202, 0, 0, 0, {ACT_DLE0} }, |
| 198 | {RSP_NODEV, 200, 249, -1, 0, 0, {ACT_FAKEDLE0} }, | 198 | {RSP_NODEV, 200, 249, -1, 0, 0, {ACT_FAKEDLE0} }, |
| 199 | {RSP_ERROR, 200, 249, -1, 0, 0, {ACT_FAILDLE0} }, | 199 | {RSP_ERROR, 200, 249, -1, 0, 0, {ACT_FAILDLE0} }, |
| 200 | {EV_TIMEOUT, 200, 249, -1, 0, 0, {ACT_FAILDLE0} }, | 200 | {EV_TIMEOUT, 200, 249, -1, 0, 0, {ACT_FAILDLE0} }, |
| 201 | 201 | ||
| 202 | /* enter dle mode */ | 202 | /* enter dle mode */ |
| 203 | {RSP_INIT, 0, 0, SEQ_DLE1, 251, 5, {0}, "^SDLE=1\r"}, | 203 | {RSP_INIT, 0, 0, SEQ_DLE1, 251, 5, {0}, "^SDLE=1\r"}, |
| 204 | {RSP_OK, 251, 251, -1, 252, -1}, | 204 | {RSP_OK, 251, 251, -1, 252, -1}, |
| 205 | {RSP_ZDLE, 252, 252, 1, 0, 0, {ACT_DLE1} }, | 205 | {RSP_ZDLE, 252, 252, 1, 0, 0, {ACT_DLE1} }, |
| 206 | {RSP_ERROR, 250, 299, -1, 0, 0, {ACT_FAILDLE1} }, | 206 | {RSP_ERROR, 250, 299, -1, 0, 0, {ACT_FAILDLE1} }, |
| 207 | {EV_TIMEOUT, 250, 299, -1, 0, 0, {ACT_FAILDLE1} }, | 207 | {EV_TIMEOUT, 250, 299, -1, 0, 0, {ACT_FAILDLE1} }, |
| 208 | 208 | ||
| 209 | /* incoming call */ | 209 | /* incoming call */ |
| 210 | {RSP_RING, -1, -1, -1, -1, -1, {ACT_RING} }, | 210 | {RSP_RING, -1, -1, -1, -1, -1, {ACT_RING} }, |
| 211 | 211 | ||
| 212 | /* get cid */ | 212 | /* get cid */ |
| 213 | {RSP_INIT, 0, 0, SEQ_CID, 301, 5, {0}, "^SGCI?\r"}, | 213 | {RSP_INIT, 0, 0, SEQ_CID, 301, 5, {0}, "^SGCI?\r"}, |
| 214 | {RSP_OK, 301, 301, -1, 302, -1}, | 214 | {RSP_OK, 301, 301, -1, 302, -1}, |
| 215 | {RSP_ZGCI, 302, 302, -1, 0, 0, {ACT_CID} }, | 215 | {RSP_ZGCI, 302, 302, -1, 0, 0, {ACT_CID} }, |
| 216 | {RSP_ERROR, 301, 349, -1, 0, 0, {ACT_FAILCID} }, | 216 | {RSP_ERROR, 301, 349, -1, 0, 0, {ACT_FAILCID} }, |
| 217 | {EV_TIMEOUT, 301, 349, -1, 0, 0, {ACT_FAILCID} }, | 217 | {EV_TIMEOUT, 301, 349, -1, 0, 0, {ACT_FAILCID} }, |
| 218 | 218 | ||
| 219 | /* enter cid mode */ | 219 | /* enter cid mode */ |
| 220 | {RSP_INIT, 0, 0, SEQ_CIDMODE, 150, 5, {0}, "^SGCI=1\r"}, | 220 | {RSP_INIT, 0, 0, SEQ_CIDMODE, 150, 5, {0}, "^SGCI=1\r"}, |
| 221 | {RSP_OK, 150, 150, -1, 0, 0, {ACT_CMODESET} }, | 221 | {RSP_OK, 150, 150, -1, 0, 0, {ACT_CMODESET} }, |
| 222 | {RSP_ERROR, 150, 150, -1, 0, 0, {ACT_FAILCMODE} }, | 222 | {RSP_ERROR, 150, 150, -1, 0, 0, {ACT_FAILCMODE} }, |
| 223 | {EV_TIMEOUT, 150, 150, -1, 0, 0, {ACT_FAILCMODE} }, | 223 | {EV_TIMEOUT, 150, 150, -1, 0, 0, {ACT_FAILCMODE} }, |
| 224 | 224 | ||
| 225 | /* leave cid mode */ | 225 | /* leave cid mode */ |
| 226 | {RSP_INIT, 0, 0, SEQ_UMMODE, 160, 5, {0}, "Z\r"}, | 226 | {RSP_INIT, 0, 0, SEQ_UMMODE, 160, 5, {0}, "Z\r"}, |
| 227 | {RSP_OK, 160, 160, -1, 0, 0, {ACT_UMODESET} }, | 227 | {RSP_OK, 160, 160, -1, 0, 0, {ACT_UMODESET} }, |
| 228 | {RSP_ERROR, 160, 160, -1, 0, 0, {ACT_FAILUMODE} }, | 228 | {RSP_ERROR, 160, 160, -1, 0, 0, {ACT_FAILUMODE} }, |
| 229 | {EV_TIMEOUT, 160, 160, -1, 0, 0, {ACT_FAILUMODE} }, | 229 | {EV_TIMEOUT, 160, 160, -1, 0, 0, {ACT_FAILUMODE} }, |
| 230 | 230 | ||
| 231 | /* abort getting cid */ | 231 | /* abort getting cid */ |
| 232 | {RSP_INIT, 0, 0, SEQ_NOCID, 0, 0, {ACT_ABORTCID} }, | 232 | {RSP_INIT, 0, 0, SEQ_NOCID, 0, 0, {ACT_ABORTCID} }, |
| 233 | 233 | ||
| 234 | /* reset */ | 234 | /* reset */ |
| 235 | {RSP_INIT, 0, 0, SEQ_SHUTDOWN, 504, 5, {0}, "Z\r"}, | 235 | {RSP_INIT, 0, 0, SEQ_SHUTDOWN, 504, 5, {0}, "Z\r"}, |
| 236 | {RSP_OK, 504, 504, -1, 0, 0, {ACT_SDOWN} }, | 236 | {RSP_OK, 504, 504, -1, 0, 0, {ACT_SDOWN} }, |
| 237 | {RSP_ERROR, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} }, | 237 | {RSP_ERROR, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} }, |
| 238 | {EV_TIMEOUT, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} }, | 238 | {EV_TIMEOUT, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} }, |
| 239 | {RSP_NODEV, 501, 599, -1, 0, 0, {ACT_FAKESDOWN} }, | 239 | {RSP_NODEV, 501, 599, -1, 0, 0, {ACT_FAKESDOWN} }, |
| 240 | 240 | ||
| 241 | {EV_PROC_CIDMODE, -1, -1, -1, -1, -1, {ACT_PROC_CIDMODE} }, | 241 | {EV_PROC_CIDMODE, -1, -1, -1, -1, -1, {ACT_PROC_CIDMODE} }, |
| 242 | {EV_IF_LOCK, -1, -1, -1, -1, -1, {ACT_IF_LOCK} }, | 242 | {EV_IF_LOCK, -1, -1, -1, -1, -1, {ACT_IF_LOCK} }, |
| 243 | {EV_IF_VER, -1, -1, -1, -1, -1, {ACT_IF_VER} }, | 243 | {EV_IF_VER, -1, -1, -1, -1, -1, {ACT_IF_VER} }, |
| 244 | {EV_START, -1, -1, -1, -1, -1, {ACT_START} }, | 244 | {EV_START, -1, -1, -1, -1, -1, {ACT_START} }, |
| 245 | {EV_STOP, -1, -1, -1, -1, -1, {ACT_STOP} }, | 245 | {EV_STOP, -1, -1, -1, -1, -1, {ACT_STOP} }, |
| 246 | {EV_SHUTDOWN, -1, -1, -1, -1, -1, {ACT_SHUTDOWN} }, | 246 | {EV_SHUTDOWN, -1, -1, -1, -1, -1, {ACT_SHUTDOWN} }, |
| 247 | 247 | ||
| 248 | /* misc. */ | 248 | /* misc. */ |
| 249 | {RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} }, | 249 | {RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} }, |
| 250 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, | 250 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, |
| 251 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | 251 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, |
| 252 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, | 252 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, |
| 253 | {RSP_LAST} | 253 | {RSP_LAST} |
| 254 | }; | 254 | }; |
| 255 | 255 | ||
| 256 | /* 600: start dialing, 650: dial in progress, 800: connection is up, 700: ring, | 256 | /* 600: start dialing, 650: dial in progress, 800: connection is up, 700: ring, |
| @@ -261,91 +261,91 @@ struct reply_t gigaset_tab_cid[] = · 4 unmodified lines | |||
| 261 | * action, command */ | 261 | * action, command */ |
| 262 | 262 | ||
| 263 | /* dial */ | 263 | /* dial */ |
| 264 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, | 264 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, |
| 265 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, | 265 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD + AT_BC} }, |
| 266 | {RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD+AT_PROTO} }, | 266 | {RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD + AT_PROTO} }, |
| 267 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, | 267 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD + AT_TYPE} }, |
| 268 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, | 268 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD + AT_MSN} }, |
| 269 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, | 269 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD + AT_CLIP} }, |
| 270 | {RSP_OK, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, | 270 | {RSP_OK, 605, 605, -1, 606, 5, {ACT_CMD + AT_CLIP} }, |
| 271 | {RSP_NULL, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} }, | 271 | {RSP_NULL, 606, 606, -1, 607, 5, {ACT_CMD + AT_ISO} }, |
| 272 | {RSP_OK, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} }, | 272 | {RSP_OK, 606, 606, -1, 607, 5, {ACT_CMD + AT_ISO} }, |
| 273 | {RSP_OK, 607, 607, -1, 608, 5, {0}, "+VLS=17\r"}, | 273 | {RSP_OK, 607, 607, -1, 608, 5, {0}, "+VLS=17\r"}, |
| 274 | {RSP_OK, 608, 608, -1, 609, -1}, | 274 | {RSP_OK, 608, 608, -1, 609, -1}, |
| 275 | {RSP_ZSAU, 609, 609, ZSAU_PROCEEDING, 610, 5, {ACT_CMD+AT_DIAL} }, | 275 | {RSP_ZSAU, 609, 609, ZSAU_PROCEEDING, 610, 5, {ACT_CMD + AT_DIAL} }, |
| 276 | {RSP_OK, 610, 610, -1, 650, 0, {ACT_DIALING} }, | 276 | {RSP_OK, 610, 610, -1, 650, 0, {ACT_DIALING} }, |
| 277 | 277 | ||
| 278 | {RSP_ERROR, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} }, | 278 | {RSP_ERROR, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} }, |
| 279 | {EV_TIMEOUT, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} }, | 279 | {EV_TIMEOUT, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} }, |
| 280 | 280 | ||
| 281 | /* optional dialing responses */ | 281 | /* optional dialing responses */ |
| 282 | {EV_BC_OPEN, 650, 650, -1, 651, -1}, | 282 | {EV_BC_OPEN, 650, 650, -1, 651, -1}, |
| 283 | {RSP_ZVLS, 609, 651, 17, -1, -1, {ACT_DEBUG} }, | 283 | {RSP_ZVLS, 609, 651, 17, -1, -1, {ACT_DEBUG} }, |
| 284 | {RSP_ZCTP, 610, 651, -1, -1, -1, {ACT_DEBUG} }, | 284 | {RSP_ZCTP, 610, 651, -1, -1, -1, {ACT_DEBUG} }, |
| 285 | {RSP_ZCPN, 610, 651, -1, -1, -1, {ACT_DEBUG} }, | 285 | {RSP_ZCPN, 610, 651, -1, -1, -1, {ACT_DEBUG} }, |
| 286 | {RSP_ZSAU, 650, 651, ZSAU_CALL_DELIVERED, -1, -1, {ACT_DEBUG} }, | 286 | {RSP_ZSAU, 650, 651, ZSAU_CALL_DELIVERED, -1, -1, {ACT_DEBUG} }, |
| 287 | 287 | ||
| 288 | /* connect */ | 288 | /* connect */ |
| 289 | {RSP_ZSAU, 650, 650, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} }, | 289 | {RSP_ZSAU, 650, 650, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} }, |
| 290 | {RSP_ZSAU, 651, 651, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT, | 290 | {RSP_ZSAU, 651, 651, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT, |
| 291 | ACT_NOTIFY_BC_UP} }, | 291 | ACT_NOTIFY_BC_UP} }, |
| 292 | {RSP_ZSAU, 750, 750, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} }, | 292 | {RSP_ZSAU, 750, 750, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} }, |
| 293 | {RSP_ZSAU, 751, 751, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT, | 293 | {RSP_ZSAU, 751, 751, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT, |
| 294 | ACT_NOTIFY_BC_UP} }, | 294 | ACT_NOTIFY_BC_UP} }, |
| 295 | {EV_BC_OPEN, 800, 800, -1, 800, -1, {ACT_NOTIFY_BC_UP} }, | 295 | {EV_BC_OPEN, 800, 800, -1, 800, -1, {ACT_NOTIFY_BC_UP} }, |
| 296 | 296 | ||
| 297 | /* remote hangup */ | 297 | /* remote hangup */ |
| 298 | {RSP_ZSAU, 650, 651, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT} }, | 298 | {RSP_ZSAU, 650, 651, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT} }, |
| 299 | {RSP_ZSAU, 750, 751, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} }, | 299 | {RSP_ZSAU, 750, 751, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} }, |
| 300 | {RSP_ZSAU, 800, 800, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} }, | 300 | {RSP_ZSAU, 800, 800, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} }, |
| 301 | 301 | ||
| 302 | /* hangup */ | 302 | /* hangup */ |
| 303 | {EV_HUP, -1, -1, -1, -1, -1, {ACT_HUP} }, | 303 | {EV_HUP, -1, -1, -1, -1, -1, {ACT_HUP} }, |
| 304 | {RSP_INIT, -1, -1, SEQ_HUP, 401, 5, {0}, "+VLS=0\r"}, | 304 | {RSP_INIT, -1, -1, SEQ_HUP, 401, 5, {0}, "+VLS=0\r"}, |
| 305 | {RSP_OK, 401, 401, -1, 402, 5}, | 305 | {RSP_OK, 401, 401, -1, 402, 5}, |
| 306 | {RSP_ZVLS, 402, 402, 0, 403, 5}, | 306 | {RSP_ZVLS, 402, 402, 0, 403, 5}, |
| 307 | {RSP_ZSAU, 403, 403, ZSAU_DISCONNECT_REQ, -1, -1, {ACT_DEBUG} }, | 307 | {RSP_ZSAU, 403, 403, ZSAU_DISCONNECT_REQ, -1, -1, {ACT_DEBUG} }, |
| 308 | {RSP_ZSAU, 403, 403, ZSAU_NULL, 0, 0, {ACT_DISCONNECT} }, | 308 | {RSP_ZSAU, 403, 403, ZSAU_NULL, 0, 0, {ACT_DISCONNECT} }, |
| 309 | {RSP_NODEV, 401, 403, -1, 0, 0, {ACT_FAKEHUP} }, | 309 | {RSP_NODEV, 401, 403, -1, 0, 0, {ACT_FAKEHUP} }, |
| 310 | {RSP_ERROR, 401, 401, -1, 0, 0, {ACT_ABORTHUP} }, | 310 | {RSP_ERROR, 401, 401, -1, 0, 0, {ACT_ABORTHUP} }, |
| 311 | {EV_TIMEOUT, 401, 403, -1, 0, 0, {ACT_ABORTHUP} }, | 311 | {EV_TIMEOUT, 401, 403, -1, 0, 0, {ACT_ABORTHUP} }, |
| 312 | 312 | ||
| 313 | {EV_BC_CLOSED, 0, 0, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} }, | 313 | {EV_BC_CLOSED, 0, 0, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} }, |
| 314 | 314 | ||
| 315 | /* ring */ | 315 | /* ring */ |
| 316 | {RSP_ZBC, 700, 700, -1, -1, -1, {0} }, | 316 | {RSP_ZBC, 700, 700, -1, -1, -1, {0} }, |
| 317 | {RSP_ZHLC, 700, 700, -1, -1, -1, {0} }, | 317 | {RSP_ZHLC, 700, 700, -1, -1, -1, {0} }, |
| 318 | {RSP_NMBR, 700, 700, -1, -1, -1, {0} }, | 318 | {RSP_NMBR, 700, 700, -1, -1, -1, {0} }, |
| 319 | {RSP_ZCPN, 700, 700, -1, -1, -1, {0} }, | 319 | {RSP_ZCPN, 700, 700, -1, -1, -1, {0} }, |
| 320 | {RSP_ZCTP, 700, 700, -1, -1, -1, {0} }, | 320 | {RSP_ZCTP, 700, 700, -1, -1, -1, {0} }, |
| 321 | {EV_TIMEOUT, 700, 700, -1, 720, 720, {ACT_ICALL} }, | 321 | {EV_TIMEOUT, 700, 700, -1, 720, 720, {ACT_ICALL} }, |
| 322 | {EV_BC_CLOSED, 720, 720, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} }, | 322 | {EV_BC_CLOSED, 720, 720, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} }, |
| 323 | 323 | ||
| 324 | /*accept icall*/ | 324 | /*accept icall*/ |
| 325 | {EV_ACCEPT, -1, -1, -1, -1, -1, {ACT_ACCEPT} }, | 325 | {EV_ACCEPT, -1, -1, -1, -1, -1, {ACT_ACCEPT} }, |
| 326 | {RSP_INIT, 720, 720, SEQ_ACCEPT, 721, 5, {ACT_CMD+AT_PROTO} }, | 326 | {RSP_INIT, 720, 720, SEQ_ACCEPT, 721, 5, {ACT_CMD + AT_PROTO} }, |
| 327 | {RSP_OK, 721, 721, -1, 722, 5, {ACT_CMD+AT_ISO} }, | 327 | {RSP_OK, 721, 721, -1, 722, 5, {ACT_CMD + AT_ISO} }, |
| 328 | {RSP_OK, 722, 722, -1, 723, 5, {0}, "+VLS=17\r"}, | 328 | {RSP_OK, 722, 722, -1, 723, 5, {0}, "+VLS=17\r"}, |
| 329 | {RSP_OK, 723, 723, -1, 724, 5, {0} }, | 329 | {RSP_OK, 723, 723, -1, 724, 5, {0} }, |
| 330 | {RSP_ZVLS, 724, 724, 17, 750, 50, {ACT_ACCEPTED} }, | 330 | {RSP_ZVLS, 724, 724, 17, 750, 50, {ACT_ACCEPTED} }, |
| 331 | {RSP_ERROR, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} }, | 331 | {RSP_ERROR, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} }, |
| 332 | {EV_TIMEOUT, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} }, | 332 | {EV_TIMEOUT, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} }, |
| 333 | {RSP_ZSAU, 700, 729, ZSAU_NULL, 0, 0, {ACT_ABORTACCEPT} }, | 333 | {RSP_ZSAU, 700, 729, ZSAU_NULL, 0, 0, {ACT_ABORTACCEPT} }, |
| 334 | {RSP_ZSAU, 700, 729, ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT} }, | 334 | {RSP_ZSAU, 700, 729, ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT} }, |
| 335 | {RSP_ZSAU, 700, 729, ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT} }, | 335 | {RSP_ZSAU, 700, 729, ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT} }, |
| 336 | 336 | ||
| 337 | {EV_BC_OPEN, 750, 750, -1, 751, -1}, | 337 | {EV_BC_OPEN, 750, 750, -1, 751, -1}, |
| 338 | {EV_TIMEOUT, 750, 751, -1, 0, 0, {ACT_CONNTIMEOUT} }, | 338 | {EV_TIMEOUT, 750, 751, -1, 0, 0, {ACT_CONNTIMEOUT} }, |
| 339 | 339 | ||
| 340 | /* B channel closed (general case) */ | 340 | /* B channel closed (general case) */ |
| 341 | {EV_BC_CLOSED, -1, -1, -1, -1, -1, {ACT_NOTIFY_BC_DOWN} }, | 341 | {EV_BC_CLOSED, -1, -1, -1, -1, -1, {ACT_NOTIFY_BC_DOWN} }, |
| 342 | 342 | ||
| 343 | /* misc. */ | 343 | /* misc. */ |
| 344 | {RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | 344 | {RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} }, |
| 345 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, | 345 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, |
| 346 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | 346 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, |
| 347 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, | 347 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, |
| 348 | {RSP_LAST} | 348 | {RSP_LAST} |
| 349 | }; | 349 | }; |
| 350 | 350 | ||
| 351 | 351 | ||
| @@ -453,7 +453,7 @@ void gigaset_handle_modem_response(struct cardstate *cs) · 101 unmodified lines | |||
| 453 | case '=': | 453 | case '=': |
| 454 | if (params > MAX_REC_PARAMS) { | 454 | if (params > MAX_REC_PARAMS) { |
| 455 | dev_warn(cs->dev, | 455 | dev_warn(cs->dev, |
| 456 | "too many parameters in response\n"); | 456 | "too many parameters in response\n"); |
| 457 | /* need last parameter (might be CID) */ | 457 | /* need last parameter (might be CID) */ |
| 458 | params--; | 458 | params--; |
| 459 | } | 459 | } |
| @@ -461,7 +461,7 @@ void gigaset_handle_modem_response(struct cardstate *cs) · 1 unmodified line | |||
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | rawstring = 0; | 463 | rawstring = 0; |
| 464 | cid = params > 1 ? cid_of_response(argv[params-1]) : 0; | 464 | cid = params > 1 ? cid_of_response(argv[params - 1]) : 0; |
| 465 | if (cid < 0) { | 465 | if (cid < 0) { |
| 466 | gigaset_add_event(cs, &cs->at_state, RSP_INVAL, | 466 | gigaset_add_event(cs, &cs->at_state, RSP_INVAL, |
| 467 | NULL, 0, NULL); | 467 | NULL, 0, NULL); |
| @@ -550,7 +550,7 @@ void gigaset_handle_modem_response(struct cardstate *cs) · 82 unmodified lines | |||
| 550 | event->parameter = zr->code; | 550 | event->parameter = zr->code; |
| 551 | if (!zr->str) | 551 | if (!zr->str) |
| 552 | dev_warn(cs->dev, | 552 | dev_warn(cs->dev, |
| 553 | "%s: unknown parameter %s after ZSAU\n", | 553 | "%s: unknown parameter %s after ZSAU\n", |
| 554 | __func__, argv[curarg]); | 554 | __func__, argv[curarg]); |
| 555 | ++curarg; | 555 | ++curarg; |
| 556 | break; | 556 | break; |
| @@ -648,8 +648,8 @@ static void disconnect(struct at_state_t **at_state_p) · 91 unmodified lines | |||
| 648 | static inline struct at_state_t *get_free_channel(struct cardstate *cs, | 648 | static inline struct at_state_t *get_free_channel(struct cardstate *cs, |
| 649 | int cid) | 649 | int cid) |
| 650 | /* cids: >0: siemens-cid | 650 | /* cids: >0: siemens-cid |
| 651 | 0: without cid | 651 | 0: without cid |
| 652 | -1: no cid assigned yet | 652 | -1: no cid assigned yet |
| 653 | */ | 653 | */ |
| 654 | { | 654 | { |
| 655 | unsigned long flags; | 655 | unsigned long flags; |
| @@ -722,12 +722,12 @@ static void send_command(struct cardstate *cs, const char *cmd, int cid, · 66 unmodified lines | |||
| 722 | } | 722 | } |
| 723 | if (cid > 0 && cid <= 65535) | 723 | if (cid > 0 && cid <= 65535) |
| 724 | cb->len = snprintf(cb->buf, buflen, | 724 | cb->len = snprintf(cb->buf, buflen, |
| 725 | dle ? "\020(AT%d%s\020)" : "AT%d%s", | 725 | dle ? "\020(AT%d%s\020)" : "AT%d%s", |
| 726 | cid, cmd); | 726 | cid, cmd); |
| 727 | else | 727 | else |
| 728 | cb->len = snprintf(cb->buf, buflen, | 728 | cb->len = snprintf(cb->buf, buflen, |
| 729 | dle ? "\020(AT%s\020)" : "AT%s", | 729 | dle ? "\020(AT%s\020)" : "AT%s", |
| 730 | cmd); | 730 | cmd); |
| 731 | cb->offset = 0; | 731 | cb->offset = 0; |
| 732 | cb->next = NULL; | 732 | cb->next = NULL; |
| 733 | cb->wake_tasklet = NULL; | 733 | cb->wake_tasklet = NULL; |
| @@ -790,7 +790,7 @@ static void bchannel_up(struct bc_state *bcs) · 56 unmodified lines | |||
| 790 | } | 790 | } |
| 791 | 791 | ||
| 792 | static void start_dial(struct at_state_t *at_state, void *data, | 792 | static void start_dial(struct at_state_t *at_state, void *data, |
| 793 | unsigned seq_index) | 793 | unsigned seq_index) |
| 794 | { | 794 | { |
| 795 | struct bc_state *bcs = at_state->bcs; | 795 | struct bc_state *bcs = at_state->bcs; |
| 796 | struct cardstate *cs = at_state->cs; | 796 | struct cardstate *cs = at_state->cs; |
| @@ -937,10 +937,10 @@ static int reinit_and_retry(struct cardstate *cs, int channel) · 140 unmodified lines | |||
| 937 | 937 | ||
| 938 | if (channel < 0) | 938 | if (channel < 0) |
| 939 | dev_warn(cs->dev, | 939 | dev_warn(cs->dev, |
| 940 | "Could not enter cid mode. Reinit device and try again.\n"); | 940 | "Could not enter cid mode. Reinit device and try again.\n"); |
| 941 | else { | 941 | else { |
| 942 | dev_warn(cs->dev, | 942 | dev_warn(cs->dev, |
| 943 | "Could not get a call id. Reinit device and try again.\n"); | 943 | "Could not get a call id. Reinit device and try again.\n"); |
| 944 | cs->bcs[channel].at_state.pending_commands |= PC_CID; | 944 | cs->bcs[channel].at_state.pending_commands |= PC_CID; |
| 945 | } | 945 | } |
| 946 | schedule_init(cs, MS_INIT); | 946 | schedule_init(cs, MS_INIT); |
| @@ -1155,7 +1155,7 @@ static void do_action(int action, struct cardstate *cs, · 208 unmodified lines | |||
| 1155 | at_state2 = get_free_channel(cs, ev->parameter); | 1155 | at_state2 = get_free_channel(cs, ev->parameter); |
| 1156 | if (!at_state2) { | 1156 | if (!at_state2) { |
| 1157 | dev_warn(cs->dev, | 1157 | dev_warn(cs->dev, |
| 1158 | "RING ignored: could not allocate channel structure\n"); | 1158 | "RING ignored: could not allocate channel structure\n"); |
| 1159 | break; | 1159 | break; |
| 1160 | } | 1160 | } |
| 1161 | 1161 | ||
| @@ -1372,7 +1372,7 @@ static void do_action(int action, struct cardstate *cs, · 210 unmodified lines | |||
| 1372 | ev->parameter, at_state->ConState); | 1372 | ev->parameter, at_state->ConState); |
| 1373 | break; | 1373 | break; |
| 1374 | 1374 | ||
| 1375 | /* events from the LL */ | 1375 | /* events from the LL */ |
| 1376 | case ACT_DIAL: | 1376 | case ACT_DIAL: |
| 1377 | start_dial(at_state, ev->ptr, ev->parameter); | 1377 | start_dial(at_state, ev->ptr, ev->parameter); |
| 1378 | break; | 1378 | break; |
| @@ -1385,7 +1385,7 @@ static void do_action(int action, struct cardstate *cs, · 6 unmodified lines | |||
| 1385 | cs->commands_pending = 1; | 1385 | cs->commands_pending = 1; |
| 1386 | break; | 1386 | break; |
| 1387 | 1387 | ||
| 1388 | /* hotplug events */ | 1388 | /* hotplug events */ |
| 1389 | case ACT_STOP: | 1389 | case ACT_STOP: |
| 1390 | do_stop(cs); | 1390 | do_stop(cs); |
| 1391 | break; | 1391 | break; |
| @@ -1393,7 +1393,7 @@ static void do_action(int action, struct cardstate *cs, · 1 unmodified line | |||
| 1393 | do_start(cs); | 1393 | do_start(cs); |
| 1394 | break; | 1394 | break; |
| 1395 | 1395 | ||
| 1396 | /* events from the interface */ | 1396 | /* events from the interface */ |
| 1397 | case ACT_IF_LOCK: | 1397 | case ACT_IF_LOCK: |
| 1398 | cs->cmd_result = ev->parameter ? do_lock(cs) : do_unlock(cs); | 1398 | cs->cmd_result = ev->parameter ? do_lock(cs) : do_unlock(cs); |
| 1399 | cs->waiting = 0; | 1399 | cs->waiting = 0; |
| @@ -1412,7 +1412,7 @@ static void do_action(int action, struct cardstate *cs, · 12 unmodified lines | |||
| 1412 | wake_up(&cs->waitqueue); | 1412 | wake_up(&cs->waitqueue); |
| 1413 | break; | 1413 | break; |
| 1414 | 1414 | ||
| 1415 | /* events from the proc file system */ | 1415 | /* events from the proc file system */ |
| 1416 | case ACT_PROC_CIDMODE: | 1416 | case ACT_PROC_CIDMODE: |
| 1417 | spin_lock_irqsave(&cs->lock, flags); | 1417 | spin_lock_irqsave(&cs->lock, flags); |
| 1418 | if (ev->parameter != cs->cidmode) { | 1418 | if (ev->parameter != cs->cidmode) { |
| @@ -1431,7 +1431,7 @@ static void do_action(int action, struct cardstate *cs, · 12 unmodified lines | |||
| 1431 | wake_up(&cs->waitqueue); | 1431 | wake_up(&cs->waitqueue); |
| 1432 | break; | 1432 | break; |
| 1433 | 1433 | ||
| 1434 | /* events from the hardware drivers */ | 1434 | /* events from the hardware drivers */ |
| 1435 | case ACT_NOTIFY_BC_DOWN: | 1435 | case ACT_NOTIFY_BC_DOWN: |
| 1436 | bchannel_down(bcs); | 1436 | bchannel_down(bcs); |
| 1437 | break; | 1437 | break; |
| @@ -1533,15 +1533,15 @@ static void process_event(struct cardstate *cs, struct event_t *ev) · 95 unmodified lines | |||
| 1533 | if (rcode == RSP_LAST) { | 1533 | if (rcode == RSP_LAST) { |
| 1534 | /* found nothing...*/ | 1534 | /* found nothing...*/ |
| 1535 | dev_warn(cs->dev, "%s: rcode=RSP_LAST: " | 1535 | dev_warn(cs->dev, "%s: rcode=RSP_LAST: " |
| 1536 | "resp_code %d in ConState %d!\n", | 1536 | "resp_code %d in ConState %d!\n", |
| 1537 | __func__, ev->type, at_state->ConState); | 1537 | __func__, ev->type, at_state->ConState); |
| 1538 | return; | 1538 | return; |
| 1539 | } | 1539 | } |
| 1540 | if ((rcode == RSP_ANY || rcode == ev->type) | 1540 | if ((rcode == RSP_ANY || rcode == ev->type) |
| 1541 | && ((int) at_state->ConState >= rep->min_ConState) | 1541 | && ((int) at_state->ConState >= rep->min_ConState) |
| 1542 | && (rep->max_ConState < 0 | 1542 | && (rep->max_ConState < 0 |
| 1543 | || (int) at_state->ConState <= rep->max_ConState) | 1543 | || (int) at_state->ConState <= rep->max_ConState) |
| 1544 | && (rep->parameter < 0 || rep->parameter == ev->parameter)) | 1544 | && (rep->parameter < 0 || rep->parameter == ev->parameter)) |
| 1545 | break; | 1545 | break; |
| 1546 | } | 1546 | } |
| 1547 | 1547 | ||
| @@ -91,11 +91,11 @@ enum debuglevel { · 90 unmodified lines | |||
| 91 | 91 | ||
| 92 | #ifdef CONFIG_GIGASET_DEBUG | 92 | #ifdef CONFIG_GIGASET_DEBUG |
| 93 | 93 | ||
| 94 | #define gig_dbg(level, format, arg...) \ | 94 | #define gig_dbg(level, format, arg...) \ |
| 95 | do { \ | 95 | do { \ |
| 96 | if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \ | 96 | if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \ |
| 97 | printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \ | 97 | printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \ |
| 98 | ## arg); \ | 98 | ## arg); \ |
| 99 | } while (0) | 99 | } while (0) |
| 100 | #define DEBUG_DEFAULT (DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) | 100 | #define DEBUG_DEFAULT (DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) |
| 101 | 101 | ||
| @@ -164,7 +164,7 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, · 62 unmodified lines | |||
| 164 | #define BAS_CORRFRAMES 4 /* flow control multiplicator */ | 164 | #define BAS_CORRFRAMES 4 /* flow control multiplicator */ |
| 165 | 165 | ||
| 166 | #define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES) | 166 | #define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES) |
| 167 | /* size of isoc in buf per URB */ | 167 | /* size of isoc in buf per URB */ |
| 168 | #define BAS_OUTBUFSIZE 4096 /* size of common isoc out buffer */ | 168 | #define BAS_OUTBUFSIZE 4096 /* size of common isoc out buffer */ |
| 169 | #define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isoc out buf */ | 169 | #define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isoc out buf */ |
| 170 | 170 | ||
| @@ -472,17 +472,17 @@ struct cardstate { · 301 unmodified lines | |||
| 472 | int commands_pending; /* flag(s) in xxx.commands_pending have | 472 | int commands_pending; /* flag(s) in xxx.commands_pending have |
| 473 | been set */ | 473 | been set */ |
| 474 | struct tasklet_struct event_tasklet; | 474 | struct tasklet_struct event_tasklet; |
| 475 | /* tasklet for serializing AT commands. | 475 | /* tasklet for serializing AT commands. |
| 476 | * Scheduled | 476 | * Scheduled |
| 477 | * -> for modem reponses (and | 477 | * -> for modem reponses (and |
| 478 | * incoming data for M10x) | 478 | * incoming data for M10x) |
| 479 | * -> on timeout | 479 | * -> on timeout |
| 480 | * -> after setting bits in | 480 | * -> after setting bits in |
| 481 | * xxx.at_state.pending_command | 481 | * xxx.at_state.pending_command |
| 482 | * (e.g. command from LL) */ | 482 | * (e.g. command from LL) */ |
| 483 | struct tasklet_struct write_tasklet; | 483 | struct tasklet_struct write_tasklet; |
| 484 | /* tasklet for serial output | 484 | /* tasklet for serial output |
| 485 | * (not used in base driver) */ | 485 | * (not used in base driver) */ |
| 486 | 486 | ||
| 487 | /* event queue */ | 487 | /* event queue */ |
| 488 | struct event_t events[MAX_EVENTS]; | 488 | struct event_t events[MAX_EVENTS]; |
| @@ -490,7 +490,7 @@ struct cardstate { · 1 unmodified line | |||
| 490 | spinlock_t ev_lock; | 490 | spinlock_t ev_lock; |
| 491 | 491 | ||
| 492 | /* current modem response */ | 492 | /* current modem response */ |
| 493 | unsigned char respdata[MAX_RESP_SIZE+1]; | 493 | unsigned char respdata[MAX_RESP_SIZE + 1]; |
| 494 | unsigned cbytes; | 494 | unsigned cbytes; |
| 495 | 495 | ||
| 496 | /* private data of hardware drivers */ | 496 | /* private data of hardware drivers */ |
| @@ -243,7 +243,7 @@ static int command_from_LL(isdn_ctrl *cntrl) · 242 unmodified lines | |||
| 243 | dev_kfree_skb(bcs->rx_skb); | 243 | dev_kfree_skb(bcs->rx_skb); |
| 244 | gigaset_new_rx_skb(bcs); | 244 | gigaset_new_rx_skb(bcs); |
| 245 | 245 | ||
| 246 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); | 246 | commands = kzalloc(AT_NUM * (sizeof *commands), GFP_ATOMIC); |
| 247 | if (!commands) { | 247 | if (!commands) { |
| 248 | gigaset_free_channel(bcs); | 248 | gigaset_free_channel(bcs); |
| 249 | dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n"); | 249 | dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n"); |
| @@ -261,7 +261,7 @@ static int command_from_LL(isdn_ctrl *cntrl) · 11 unmodified lines | |||
| 261 | if (!commands[AT_TYPE]) | 261 | if (!commands[AT_TYPE]) |
| 262 | goto oom; | 262 | goto oom; |
| 263 | snprintf(commands[AT_DIAL], l, | 263 | snprintf(commands[AT_DIAL], l, |
| 264 | "D%s\r", cntrl->parm.setup.phone+2); | 264 | "D%s\r", cntrl->parm.setup.phone + 2); |
| 265 | } else { | 265 | } else { |
| 266 | commands[AT_TYPE] = kstrdup("^SCTP=1\r", GFP_ATOMIC); | 266 | commands[AT_TYPE] = kstrdup("^SCTP=1\r", GFP_ATOMIC); |
| 267 | if (!commands[AT_TYPE]) | 267 | if (!commands[AT_TYPE]) |
| @@ -482,7 +482,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) · 214 unmodified lines | |||
| 482 | response.parm.setup.si2 = 2; | 482 | response.parm.setup.si2 = 2; |
| 483 | } else { | 483 | } else { |
| 484 | dev_warn(cs->dev, "RING ignored - unsupported BC %s\n", | 484 | dev_warn(cs->dev, "RING ignored - unsupported BC %s\n", |
| 485 | at_state->str_var[STR_ZBC]); | 485 | at_state->str_var[STR_ZBC]); |
| 486 | return ICALL_IGNORE; | 486 | return ICALL_IGNORE; |
| 487 | } | 487 | } |
| 488 | if (at_state->str_var[STR_NMBR]) { | 488 | if (at_state->str_var[STR_NMBR]) { |
| @@ -518,7 +518,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) · 29 unmodified lines | |||
| 518 | return ICALL_REJECT; | 518 | return ICALL_REJECT; |
| 519 | case 3: /* incomplete */ | 519 | case 3: /* incomplete */ |
| 520 | dev_warn(cs->dev, | 520 | dev_warn(cs->dev, |
| 521 | "LL requested unsupported feature: Incomplete Number\n"); | 521 | "LL requested unsupported feature: Incomplete Number\n"); |
| 522 | return ICALL_IGNORE; | 522 | return ICALL_IGNORE; |
| 523 | case 4: /* proceeding */ | 523 | case 4: /* proceeding */ |
| 524 | /* Gigaset will send ALERTING anyway. | 524 | /* Gigaset will send ALERTING anyway. |
| @@ -33,10 +33,10 @@ static int if_lock(struct cardstate *cs, int *arg) · 32 unmodified lines | |||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | if (!cmd && cs->mstate == MS_LOCKED && cs->connected) { | 35 | if (!cmd && cs->mstate == MS_LOCKED && cs->connected) { |
| 36 | cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS); | 36 | cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR | TIOCM_RTS); |
| 37 | cs->ops->baud_rate(cs, B115200); | 37 | cs->ops->baud_rate(cs, B115200); |
| 38 | cs->ops->set_line_ctrl(cs, CS8); | 38 | cs->ops->set_line_ctrl(cs, CS8); |
| 39 | cs->control_state = TIOCM_DTR|TIOCM_RTS; | 39 | cs->control_state = TIOCM_DTR | TIOCM_RTS; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | cs->waiting = 1; | 42 | cs->waiting = 1; |
| @@ -232,17 +232,17 @@ static int if_ioctl(struct tty_struct *tty, · 189 unmodified lines | |||
| 232 | break; | 232 | break; |
| 233 | case GIGASET_BRKCHARS: | 233 | case GIGASET_BRKCHARS: |
| 234 | retval = copy_from_user(&buf, | 234 | retval = copy_from_user(&buf, |
| 235 | (const unsigned char __user *) arg, 6) | 235 | (const unsigned char __user *) arg, 6) |
| 236 | ? -EFAULT : 0; | 236 | ? -EFAULT : 0; |
| 237 | if (retval >= 0) { | 237 | if (retval >= 0) { |
| 238 | gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS", | 238 | gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS", |
| 239 | 6, (const unsigned char *) arg); | 239 | 6, (const unsigned char *) arg); |
| 240 | retval = cs->ops->brkchars(cs, buf); | 240 | retval = cs->ops->brkchars(cs, buf); |
| 241 | } | 241 | } |
| 242 | break; | 242 | break; |
| 243 | case GIGASET_VERSION: | 243 | case GIGASET_VERSION: |
| 244 | retval = copy_from_user(version, | 244 | retval = copy_from_user(version, |
| 245 | (unsigned __user *) arg, sizeof version) | 245 | (unsigned __user *) arg, sizeof version) |
| 246 | ? -EFAULT : 0; | 246 | ? -EFAULT : 0; |
| 247 | if (retval >= 0) | 247 | if (retval >= 0) |
| 248 | retval = if_version(cs, version); | 248 | retval = if_version(cs, version); |
| @@ -273,7 +273,7 @@ static int if_tiocmget(struct tty_struct *tty) · 24 unmodified lines | |||
| 273 | if (mutex_lock_interruptible(&cs->mutex)) | 273 | if (mutex_lock_interruptible(&cs->mutex)) |
| 274 | return -ERESTARTSYS; | 274 | return -ERESTARTSYS; |
| 275 | 275 | ||
| 276 | retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR); | 276 | retval = cs->control_state & (TIOCM_RTS | TIOCM_DTR); |
| 277 | 277 | ||
| 278 | mutex_unlock(&cs->mutex); | 278 | mutex_unlock(&cs->mutex); |
| 279 | 279 | ||
| @@ -297,7 +297,7 @@ static int if_tiocmset(struct tty_struct *tty, · 17 unmodified lines | |||
| 297 | gig_dbg(DEBUG_IF, "not connected"); | 297 | gig_dbg(DEBUG_IF, "not connected"); |
| 298 | retval = -ENODEV; | 298 | retval = -ENODEV; |
| 299 | } else { | 299 | } else { |
| 300 | mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR); | 300 | mc = (cs->control_state | set) & ~clear & (TIOCM_RTS | TIOCM_DTR); |
| 301 | retval = cs->ops->set_modem_ctrl(cs, cs->control_state, mc); | 301 | retval = cs->ops->set_modem_ctrl(cs, cs->control_state, mc); |
| 302 | cs->control_state = mc; | 302 | cs->control_state = mc; |
| 303 | } | 303 | } |
| @@ -593,8 +593,8 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, · 289 unmodified lines | |||
| 593 | if (tty == NULL) | 593 | if (tty == NULL) |
| 594 | goto enomem; | 594 | goto enomem; |
| 595 | 595 | ||
| 596 | tty->type = TTY_DRIVER_TYPE_SERIAL, | 596 | tty->type = TTY_DRIVER_TYPE_SERIAL; |
| 597 | tty->subtype = SERIAL_TYPE_NORMAL, | 597 | tty->subtype = SERIAL_TYPE_NORMAL; |
| 598 | tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; | 598 | tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
| 599 | 599 | ||
| 600 | tty->driver_name = procname; | 600 | tty->driver_name = procname; |
| @@ -250,94 +250,94 @@ static inline void dump_bytes(enum debuglevel level, const char *tag, · 249 unmodified lines | |||
| 250 | */ | 250 | */ |
| 251 | static const u16 stufftab[5 * 256] = { | 251 | static const u16 stufftab[5 * 256] = { |
| 252 | /* previous 1s = 0: */ | 252 | /* previous 1s = 0: */ |
| 253 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, | 253 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, |
| 254 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, | 254 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, |
| 255 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, | 255 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, |
| 256 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x205f, | 256 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x205f, |
| 257 | 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, | 257 | 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, |
| 258 | 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x209f, | 258 | 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x209f, |
| 259 | 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, | 259 | 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, |
| 260 | 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20df, | 260 | 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20df, |
| 261 | 0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x048f, | 261 | 0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x048f, |
| 262 | 0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x251f, | 262 | 0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x251f, |
| 263 | 0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x04af, | 263 | 0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x04af, |
| 264 | 0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x255f, | 264 | 0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x255f, |
| 265 | 0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x08cf, | 265 | 0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x08cf, |
| 266 | 0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x299f, | 266 | 0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x299f, |
| 267 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x0cef, | 267 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x0cef, |
| 268 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x2ddf, | 268 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x2ddf, |
| 269 | 269 | ||
| 270 | /* previous 1s = 1: */ | 270 | /* previous 1s = 1: */ |
| 271 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x200f, | 271 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x200f, |
| 272 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x202f, | 272 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x202f, |
| 273 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x204f, | 273 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x204f, |
| 274 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x206f, | 274 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x206f, |
| 275 | 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x208f, | 275 | 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x208f, |
| 276 | 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20af, | 276 | 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20af, |
| 277 | 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20cf, | 277 | 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20cf, |
| 278 | 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20ef, | 278 | 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20ef, |
| 279 | 0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x250f, | 279 | 0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x250f, |
| 280 | 0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x252f, | 280 | 0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x252f, |
| 281 | 0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x254f, | 281 | 0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x254f, |
| 282 | 0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x256f, | 282 | 0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x256f, |
| 283 | 0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x298f, | 283 | 0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x298f, |
| 284 | 0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29af, | 284 | 0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29af, |
| 285 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dcf, | 285 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dcf, |
| 286 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x31ef, | 286 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x31ef, |
| 287 | 287 | ||
| 288 | /* previous 1s = 2: */ | 288 | /* previous 1s = 2: */ |
| 289 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x2007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x2017, | 289 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x2007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x2017, |
| 290 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x2027, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x2037, | 290 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x2027, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x2037, |
| 291 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x2047, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x2057, | 291 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x2047, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x2057, |
| 292 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x2067, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x2077, | 292 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x2067, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x2077, |
| 293 | 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x2087, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x2097, | 293 | 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x2087, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x2097, |
| 294 | 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x20a7, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20b7, | 294 | 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x20a7, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20b7, |
| 295 | 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x20c7, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20d7, | 295 | 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x20c7, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20d7, |
| 296 | 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x20e7, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20f7, | 296 | 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x20e7, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20f7, |
| 297 | 0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x2507, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x2517, | 297 | 0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x2507, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x2517, |
| 298 | 0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x2527, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x2537, | 298 | 0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x2527, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x2537, |
| 299 | 0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x2547, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x2557, | 299 | 0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x2547, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x2557, |
| 300 | 0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x2567, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x2577, | 300 | 0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x2567, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x2577, |
| 301 | 0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x2987, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x2997, | 301 | 0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x2987, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x2997, |
| 302 | 0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x29a7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29b7, | 302 | 0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x29a7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29b7, |
| 303 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dc7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dd7, | 303 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dc7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dd7, |
| 304 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x31e7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x41f7, | 304 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x31e7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x41f7, |
| 305 | 305 | ||
| 306 | /* previous 1s = 3: */ | 306 | /* previous 1s = 3: */ |
| 307 | 0x0000, 0x0001, 0x0002, 0x2003, 0x0004, 0x0005, 0x0006, 0x200b, 0x0008, 0x0009, 0x000a, 0x2013, 0x000c, 0x000d, 0x000e, 0x201b, | 307 | 0x0000, 0x0001, 0x0002, 0x2003, 0x0004, 0x0005, 0x0006, 0x200b, 0x0008, 0x0009, 0x000a, 0x2013, 0x000c, 0x000d, 0x000e, 0x201b, |
| 308 | 0x0010, 0x0011, 0x0012, 0x2023, 0x0014, 0x0015, 0x0016, 0x202b, 0x0018, 0x0019, 0x001a, 0x2033, 0x001c, 0x001d, 0x001e, 0x203b, | 308 | 0x0010, 0x0011, 0x0012, 0x2023, 0x0014, 0x0015, 0x0016, 0x202b, 0x0018, 0x0019, 0x001a, 0x2033, 0x001c, 0x001d, 0x001e, 0x203b, |
| 309 | 0x0020, 0x0021, 0x0022, 0x2043, 0x0024, 0x0025, 0x0026, 0x204b, 0x0028, 0x0029, 0x002a, 0x2053, 0x002c, 0x002d, 0x002e, 0x205b, | 309 | 0x0020, 0x0021, 0x0022, 0x2043, 0x0024, 0x0025, 0x0026, 0x204b, 0x0028, 0x0029, 0x002a, 0x2053, 0x002c, 0x002d, 0x002e, 0x205b, |
| 310 | 0x0030, 0x0031, 0x0032, 0x2063, 0x0034, 0x0035, 0x0036, 0x206b, 0x0038, 0x0039, 0x003a, 0x2073, 0x003c, 0x003d, 0x203e, 0x207b, | 310 | 0x0030, 0x0031, 0x0032, 0x2063, 0x0034, 0x0035, 0x0036, 0x206b, 0x0038, 0x0039, 0x003a, 0x2073, 0x003c, 0x003d, 0x203e, 0x207b, |
| 311 | 0x0040, 0x0041, 0x0042, 0x2083, 0x0044, 0x0045, 0x0046, 0x208b, 0x0048, 0x0049, 0x004a, 0x2093, 0x004c, 0x004d, 0x004e, 0x209b, | 311 | 0x0040, 0x0041, 0x0042, 0x2083, 0x0044, 0x0045, 0x0046, 0x208b, 0x0048, 0x0049, 0x004a, 0x2093, 0x004c, 0x004d, 0x004e, 0x209b, |
| 312 | 0x0050, 0x0051, 0x0052, 0x20a3, 0x0054, 0x0055, 0x0056, 0x20ab, 0x0058, 0x0059, 0x005a, 0x20b3, 0x005c, 0x005d, 0x005e, 0x20bb, | 312 | 0x0050, 0x0051, 0x0052, 0x20a3, 0x0054, 0x0055, 0x0056, 0x20ab, 0x0058, 0x0059, 0x005a, 0x20b3, 0x005c, 0x005d, 0x005e, 0x20bb, |
| 313 | 0x0060, 0x0061, 0x0062, 0x20c3, 0x0064, 0x0065, 0x0066, 0x20cb, 0x0068, 0x0069, 0x006a, 0x20d3, 0x006c, 0x006d, 0x006e, 0x20db, | 313 | 0x0060, 0x0061, 0x0062, 0x20c3, 0x0064, 0x0065, 0x0066, 0x20cb, 0x0068, 0x0069, 0x006a, 0x20d3, 0x006c, 0x006d, 0x006e, 0x20db, |
| 314 | 0x0070, 0x0071, 0x0072, 0x20e3, 0x0074, 0x0075, 0x0076, 0x20eb, 0x0078, 0x0079, 0x007a, 0x20f3, 0x207c, 0x207d, 0x20be, 0x40fb, | 314 | 0x0070, 0x0071, 0x0072, 0x20e3, 0x0074, 0x0075, 0x0076, 0x20eb, 0x0078, 0x0079, 0x007a, 0x20f3, 0x207c, 0x207d, 0x20be, 0x40fb, |
| 315 | 0x0480, 0x0481, 0x0482, 0x2503, 0x0484, 0x0485, 0x0486, 0x250b, 0x0488, 0x0489, 0x048a, 0x2513, 0x048c, 0x048d, 0x048e, 0x251b, | 315 | 0x0480, 0x0481, 0x0482, 0x2503, 0x0484, 0x0485, 0x0486, 0x250b, 0x0488, 0x0489, 0x048a, 0x2513, 0x048c, 0x048d, 0x048e, 0x251b, |
| 316 | 0x0490, 0x0491, 0x0492, 0x2523, 0x0494, 0x0495, 0x0496, 0x252b, 0x0498, 0x0499, 0x049a, 0x2533, 0x049c, 0x049d, 0x049e, 0x253b, | 316 | 0x0490, 0x0491, 0x0492, 0x2523, 0x0494, 0x0495, 0x0496, 0x252b, 0x0498, 0x0499, 0x049a, 0x2533, 0x049c, 0x049d, 0x049e, 0x253b, |
| 317 | 0x04a0, 0x04a1, 0x04a2, 0x2543, 0x04a4, 0x04a5, 0x04a6, 0x254b, 0x04a8, 0x04a9, 0x04aa, 0x2553, 0x04ac, 0x04ad, 0x04ae, 0x255b, | 317 | 0x04a0, 0x04a1, 0x04a2, 0x2543, 0x04a4, 0x04a5, 0x04a6, 0x254b, 0x04a8, 0x04a9, 0x04aa, 0x2553, 0x04ac, 0x04ad, 0x04ae, 0x255b, |
| 318 | 0x04b0, 0x04b1, 0x04b2, 0x2563, 0x04b4, 0x04b5, 0x04b6, 0x256b, 0x04b8, 0x04b9, 0x04ba, 0x2573, 0x04bc, 0x04bd, 0x253e, 0x257b, | 318 | 0x04b0, 0x04b1, 0x04b2, 0x2563, 0x04b4, 0x04b5, 0x04b6, 0x256b, 0x04b8, 0x04b9, 0x04ba, 0x2573, 0x04bc, 0x04bd, 0x253e, 0x257b, |
| 319 | 0x08c0, 0x08c1, 0x08c2, 0x2983, 0x08c4, 0x08c5, 0x08c6, 0x298b, 0x08c8, 0x08c9, 0x08ca, 0x2993, 0x08cc, 0x08cd, 0x08ce, 0x299b, | 319 | 0x08c0, 0x08c1, 0x08c2, 0x2983, 0x08c4, 0x08c5, 0x08c6, 0x298b, 0x08c8, 0x08c9, 0x08ca, 0x2993, 0x08cc, 0x08cd, 0x08ce, 0x299b, |
| 320 | 0x08d0, 0x08d1, 0x08d2, 0x29a3, 0x08d4, 0x08d5, 0x08d6, 0x29ab, 0x08d8, 0x08d9, 0x08da, 0x29b3, 0x08dc, 0x08dd, 0x08de, 0x29bb, | 320 | 0x08d0, 0x08d1, 0x08d2, 0x29a3, 0x08d4, 0x08d5, 0x08d6, 0x29ab, 0x08d8, 0x08d9, 0x08da, 0x29b3, 0x08dc, 0x08dd, 0x08de, 0x29bb, |
| 321 | 0x0ce0, 0x0ce1, 0x0ce2, 0x2dc3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dcb, 0x0ce8, 0x0ce9, 0x0cea, 0x2dd3, 0x0cec, 0x0ced, 0x0cee, 0x2ddb, | 321 | 0x0ce0, 0x0ce1, 0x0ce2, 0x2dc3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dcb, 0x0ce8, 0x0ce9, 0x0cea, 0x2dd3, 0x0cec, 0x0ced, 0x0cee, 0x2ddb, |
| 322 | 0x10f0, 0x10f1, 0x10f2, 0x31e3, 0x10f4, 0x10f5, 0x10f6, 0x31eb, 0x20f8, 0x20f9, 0x20fa, 0x41f3, 0x257c, 0x257d, 0x29be, 0x46fb, | 322 | 0x10f0, 0x10f1, 0x10f2, 0x31e3, 0x10f4, 0x10f5, 0x10f6, 0x31eb, 0x20f8, 0x20f9, 0x20fa, 0x41f3, 0x257c, 0x257d, 0x29be, 0x46fb, |
| 323 | 323 | ||
| 324 | /* previous 1s = 4: */ | 324 | /* previous 1s = 4: */ |
| 325 | 0x0000, 0x2001, 0x0002, 0x2005, 0x0004, 0x2009, 0x0006, 0x200d, 0x0008, 0x2011, 0x000a, 0x2015, 0x000c, 0x2019, 0x000e, 0x201d, | 325 | 0x0000, 0x2001, 0x0002, 0x2005, 0x0004, 0x2009, 0x0006, 0x200d, 0x0008, 0x2011, 0x000a, 0x2015, 0x000c, 0x2019, 0x000e, 0x201d, |
| 326 | 0x0010, 0x2021, 0x0012, 0x2025, 0x0014, 0x2029, 0x0016, 0x202d, 0x0018, 0x2031, 0x001a, 0x2035, 0x001c, 0x2039, 0x001e, 0x203d, | 326 | 0x0010, 0x2021, 0x0012, 0x2025, 0x0014, 0x2029, 0x0016, 0x202d, 0x0018, 0x2031, 0x001a, 0x2035, 0x001c, 0x2039, 0x001e, 0x203d, |
| 327 | 0x0020, 0x2041, 0x0022, 0x2045, 0x0024, 0x2049, 0x0026, 0x204d, 0x0028, 0x2051, 0x002a, 0x2055, 0x002c, 0x2059, 0x002e, 0x205d, | 327 | 0x0020, 0x2041, 0x0022, 0x2045, 0x0024, 0x2049, 0x0026, 0x204d, 0x0028, 0x2051, 0x002a, 0x2055, 0x002c, 0x2059, 0x002e, 0x205d, |
| 328 | 0x0030, 0x2061, 0x0032, 0x2065, 0x0034, 0x2069, 0x0036, 0x206d, 0x0038, 0x2071, 0x003a, 0x2075, 0x003c, 0x2079, 0x203e, 0x407d, | 328 | 0x0030, 0x2061, 0x0032, 0x2065, 0x0034, 0x2069, 0x0036, 0x206d, 0x0038, 0x2071, 0x003a, 0x2075, 0x003c, 0x2079, 0x203e, 0x407d, |
| 329 | 0x0040, 0x2081, 0x0042, 0x2085, 0x0044, 0x2089, 0x0046, 0x208d, 0x0048, 0x2091, 0x004a, 0x2095, 0x004c, 0x2099, 0x004e, 0x209d, | 329 | 0x0040, 0x2081, 0x0042, 0x2085, 0x0044, 0x2089, 0x0046, 0x208d, 0x0048, 0x2091, 0x004a, 0x2095, 0x004c, 0x2099, 0x004e, 0x209d, |
| 330 | 0x0050, 0x20a1, 0x0052, 0x20a5, 0x0054, 0x20a9, 0x0056, 0x20ad, 0x0058, 0x20b1, 0x005a, 0x20b5, 0x005c, 0x20b9, 0x005e, 0x20bd, | 330 | 0x0050, 0x20a1, 0x0052, 0x20a5, 0x0054, 0x20a9, 0x0056, 0x20ad, 0x0058, 0x20b1, 0x005a, 0x20b5, 0x005c, 0x20b9, 0x005e, 0x20bd, |
| 331 | 0x0060, 0x20c1, 0x0062, 0x20c5, 0x0064, 0x20c9, 0x0066, 0x20cd, 0x0068, 0x20d1, 0x006a, 0x20d5, 0x006c, 0x20d9, 0x006e, 0x20dd, | 331 | 0x0060, 0x20c1, 0x0062, 0x20c5, 0x0064, 0x20c9, 0x0066, 0x20cd, 0x0068, 0x20d1, 0x006a, 0x20d5, 0x006c, 0x20d9, 0x006e, 0x20dd, |
| 332 | 0x0070, 0x20e1, 0x0072, 0x20e5, 0x0074, 0x20e9, 0x0076, 0x20ed, 0x0078, 0x20f1, 0x007a, 0x20f5, 0x207c, 0x40f9, 0x20be, 0x417d, | 332 | 0x0070, 0x20e1, 0x0072, 0x20e5, 0x0074, 0x20e9, 0x0076, 0x20ed, 0x0078, 0x20f1, 0x007a, 0x20f5, 0x207c, 0x40f9, 0x20be, 0x417d, |
| 333 | 0x0480, 0x2501, 0x0482, 0x2505, 0x0484, 0x2509, 0x0486, 0x250d, 0x0488, 0x2511, 0x048a, 0x2515, 0x048c, 0x2519, 0x048e, 0x251d, | 333 | 0x0480, 0x2501, 0x0482, 0x2505, 0x0484, 0x2509, 0x0486, 0x250d, 0x0488, 0x2511, 0x048a, 0x2515, 0x048c, 0x2519, 0x048e, 0x251d, |
| 334 | 0x0490, 0x2521, 0x0492, 0x2525, 0x0494, 0x2529, 0x0496, 0x252d, 0x0498, 0x2531, 0x049a, 0x2535, 0x049c, 0x2539, 0x049e, 0x253d, | 334 | 0x0490, 0x2521, 0x0492, 0x2525, 0x0494, 0x2529, 0x0496, 0x252d, 0x0498, 0x2531, 0x049a, 0x2535, 0x049c, 0x2539, 0x049e, 0x253d, |
| 335 | 0x04a0, 0x2541, 0x04a2, 0x2545, 0x04a4, 0x2549, 0x04a6, 0x254d, 0x04a8, 0x2551, 0x04aa, 0x2555, 0x04ac, 0x2559, 0x04ae, 0x255d, | 335 | 0x04a0, 0x2541, 0x04a2, 0x2545, 0x04a4, 0x2549, 0x04a6, 0x254d, 0x04a8, 0x2551, 0x04aa, 0x2555, 0x04ac, 0x2559, 0x04ae, 0x255d, |
| 336 | 0x04b0, 0x2561, 0x04b2, 0x2565, 0x04b4, 0x2569, 0x04b6, 0x256d, 0x04b8, 0x2571, 0x04ba, 0x2575, 0x04bc, 0x2579, 0x253e, 0x467d, | 336 | 0x04b0, 0x2561, 0x04b2, 0x2565, 0x04b4, 0x2569, 0x04b6, 0x256d, 0x04b8, 0x2571, 0x04ba, 0x2575, 0x04bc, 0x2579, 0x253e, 0x467d, |
| 337 | 0x08c0, 0x2981, 0x08c2, 0x2985, 0x08c4, 0x2989, 0x08c6, 0x298d, 0x08c8, 0x2991, 0x08ca, 0x2995, 0x08cc, 0x2999, 0x08ce, 0x299d, | 337 | 0x08c0, 0x2981, 0x08c2, 0x2985, 0x08c4, 0x2989, 0x08c6, 0x298d, 0x08c8, 0x2991, 0x08ca, 0x2995, 0x08cc, 0x2999, 0x08ce, 0x299d, |
| 338 | 0x08d0, 0x29a1, 0x08d2, 0x29a5, 0x08d4, 0x29a9, 0x08d6, 0x29ad, 0x08d8, 0x29b1, 0x08da, 0x29b5, 0x08dc, 0x29b9, 0x08de, 0x29bd, | 338 | 0x08d0, 0x29a1, 0x08d2, 0x29a5, 0x08d4, 0x29a9, 0x08d6, 0x29ad, 0x08d8, 0x29b1, 0x08da, 0x29b5, 0x08dc, 0x29b9, 0x08de, 0x29bd, |
| 339 | 0x0ce0, 0x2dc1, 0x0ce2, 0x2dc5, 0x0ce4, 0x2dc9, 0x0ce6, 0x2dcd, 0x0ce8, 0x2dd1, 0x0cea, 0x2dd5, 0x0cec, 0x2dd9, 0x0cee, 0x2ddd, | 339 | 0x0ce0, 0x2dc1, 0x0ce2, 0x2dc5, 0x0ce4, 0x2dc9, 0x0ce6, 0x2dcd, 0x0ce8, 0x2dd1, 0x0cea, 0x2dd5, 0x0cec, 0x2dd9, 0x0cee, 0x2ddd, |
| 340 | 0x10f0, 0x31e1, 0x10f2, 0x31e5, 0x10f4, 0x31e9, 0x10f6, 0x31ed, 0x20f8, 0x41f1, 0x20fa, 0x41f5, 0x257c, 0x46f9, 0x29be, 0x4b7d | 340 | 0x10f0, 0x31e1, 0x10f2, 0x31e5, 0x10f4, 0x31e9, 0x10f6, 0x31ed, 0x20f8, 0x41f1, 0x20fa, 0x41f5, 0x257c, 0x46f9, 0x29be, 0x4b7d |
| 341 | }; | 341 | }; |
| 342 | 342 | ||
| 343 | /* hdlc_bitstuff_byte | 343 | /* hdlc_bitstuff_byte |
| @@ -598,22 +598,22 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits) · 254 unmodified lines | |||
| 598 | * bit 7 set if there are 5 or more "interior" consecutive '1' bits | 598 | * bit 7 set if there are 5 or more "interior" consecutive '1' bits |
| 599 | */ | 599 | */ |
| 600 | static const unsigned char bitcounts[256] = { | 600 | static const unsigned char bitcounts[256] = { |
| 601 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, | 601 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, |
| 602 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, | 602 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, |
| 603 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, | 603 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, |
| 604 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x80, 0x06, | 604 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x80, 0x06, |
| 605 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, | 605 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, |
| 606 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, | 606 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, |
| 607 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, | 607 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, |
| 608 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x80, 0x81, 0x80, 0x07, | 608 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x80, 0x81, 0x80, 0x07, |
| 609 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14, | 609 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14, |
| 610 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x15, | 610 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x15, |
| 611 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14, | 611 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14, |
| 612 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x90, 0x16, | 612 | 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x90, 0x16, |
| 613 | 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x24, | 613 | 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x24, |
| 614 | 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x25, | 614 | 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x25, |
| 615 | 0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x34, | 615 | 0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x34, |
| 616 | 0x40, 0x41, 0x40, 0x42, 0x40, 0x41, 0x40, 0x43, 0x50, 0x51, 0x50, 0x52, 0x60, 0x61, 0x70, 0x78 | 616 | 0x40, 0x41, 0x40, 0x42, 0x40, 0x41, 0x40, 0x43, 0x50, 0x51, 0x50, 0x52, 0x60, 0x61, 0x70, 0x78 |
| 617 | }; | 617 | }; |
| 618 | 618 | ||
| 619 | /* hdlc_unpack | 619 | /* hdlc_unpack |
| @@ -35,7 +35,7 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, · 34 unmodified lines | |||
| 35 | if (!isspace(*end++)) | 35 | if (!isspace(*end++)) |
| 36 | return -EINVAL; | 36 | return -EINVAL; |
| 37 | if (value < 0 || value > 1) | 37 | if (value < 0 || value > 1) |
| 38 | return -EINVAL; | 38 | return -EINVAL; |
| 39 | 39 | ||
| 40 | if (mutex_lock_interruptible(&cs->mutex)) | 40 | if (mutex_lock_interruptible(&cs->mutex)) |
| 41 | return -ERESTARTSYS; | 41 | return -ERESTARTSYS; |
| @@ -56,7 +56,7 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, · 14 unmodified lines | |||
| 56 | return count; | 56 | return count; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode); | 59 | static DEVICE_ATTR(cidmode, S_IRUGO | S_IWUSR, show_cidmode, set_cidmode); |
| 60 | 60 | ||
| 61 | /* free sysfs for device */ | 61 | /* free sysfs for device */ |
| 62 | void gigaset_free_dev_sysfs(struct cardstate *cs) | 62 | void gigaset_free_dev_sysfs(struct cardstate *cs) |
| @@ -246,7 +246,7 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) · 245 unmodified lines | |||
| 246 | unsigned long flags; | 246 | unsigned long flags; |
| 247 | 247 | ||
| 248 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? | 248 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? |
| 249 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, | 249 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, |
| 250 | "CMD Transmit", cb->len, cb->buf); | 250 | "CMD Transmit", cb->len, cb->buf); |
| 251 | 251 | ||
| 252 | spin_lock_irqsave(&cs->cmdlock, flags); | 252 | spin_lock_irqsave(&cs->cmdlock, flags); |
| @@ -773,8 +773,8 @@ static int __init ser_gigaset_init(void) · 520 unmodified lines | |||
| 773 | 773 | ||
| 774 | /* allocate memory for our driver state and initialize it */ | 774 | /* allocate memory for our driver state and initialize it */ |
| 775 | driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, | 775 | driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, |
| 776 | GIGASET_MODULENAME, GIGASET_DEVNAME, | 776 | GIGASET_MODULENAME, GIGASET_DEVNAME, |
| 777 | &ops, THIS_MODULE); | 777 | &ops, THIS_MODULE); |
| 778 | if (!driver) | 778 | if (!driver) |
| 779 | goto error; | 779 | goto error; |
| 780 | 780 | ||
| @@ -184,7 +184,7 @@ static int set_value(struct cardstate *cs, u8 req, u16 val) · 183 unmodified lines | |||
| 184 | (unsigned)req, (unsigned)val); | 184 | (unsigned)req, (unsigned)val); |
| 185 | r = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x12, 0x41, | 185 | r = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x12, 0x41, |
| 186 | 0xf /*?*/, 0, NULL, 0, 2000 /*?*/); | 186 | 0xf /*?*/, 0, NULL, 0, 2000 /*?*/); |
| 187 | /* no idea what this does */ | 187 | /* no idea what this does */ |
| 188 | if (r < 0) { | 188 | if (r < 0) { |
| 189 | dev_err(&udev->dev, "error %d on request 0x12\n", -r); | 189 | dev_err(&udev->dev, "error %d on request 0x12\n", -r); |
| 190 | return r; | 190 | return r; |
| @@ -365,7 +365,7 @@ static void gigaset_read_int_callback(struct urb *urb) · 174 unmodified lines | |||
| 365 | src = cs->hw.usb->rcvbuf; | 365 | src = cs->hw.usb->rcvbuf; |
| 366 | if (unlikely(*src)) | 366 | if (unlikely(*src)) |
| 367 | dev_warn(cs->dev, | 367 | dev_warn(cs->dev, |
| 368 | "%s: There was no leading 0, but 0x%02x!\n", | 368 | "%s: There was no leading 0, but 0x%02x!\n", |
| 369 | __func__, (unsigned) *src); | 369 | __func__, (unsigned) *src); |
| 370 | ++src; /* skip leading 0x00 */ | 370 | ++src; /* skip leading 0x00 */ |
| 371 | --numbytes; | 371 | --numbytes; |
| @@ -465,7 +465,7 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb) · 93 unmodified lines | |||
| 465 | 465 | ||
| 466 | usb_fill_bulk_urb(ucs->bulk_out_urb, ucs->udev, | 466 | usb_fill_bulk_urb(ucs->bulk_out_urb, ucs->udev, |
| 467 | usb_sndbulkpipe(ucs->udev, | 467 | usb_sndbulkpipe(ucs->udev, |
| 468 | ucs->bulk_out_endpointAddr & 0x0f), | 468 | ucs->bulk_out_endpointAddr & 0x0f), |
| 469 | cb->buf + cb->offset, count, | 469 | cb->buf + cb->offset, count, |
| 470 | gigaset_write_bulk_callback, cs); | 470 | gigaset_write_bulk_callback, cs); |
| 471 | 471 | ||
| @@ -499,7 +499,7 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) · 27 unmodified lines | |||
| 499 | unsigned long flags; | 499 | unsigned long flags; |
| 500 | 500 | ||
| 501 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? | 501 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? |
| 502 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, | 502 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, |
| 503 | "CMD Transmit", cb->len, cb->buf); | 503 | "CMD Transmit", cb->len, cb->buf); |
| 504 | 504 | ||
| 505 | spin_lock_irqsave(&cs->cmdlock, flags); | 505 | spin_lock_irqsave(&cs->cmdlock, flags); |
| @@ -44,12 +44,12 @@ static void avmcs_detach(struct pcmcia_device *p_dev); · 43 unmodified lines | |||
| 44 | 44 | ||
| 45 | static int avmcs_probe(struct pcmcia_device *p_dev) | 45 | static int avmcs_probe(struct pcmcia_device *p_dev) |
| 46 | { | 46 | { |
| 47 | /* General socket configuration */ | 47 | /* General socket configuration */ |
| 48 | p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; | 48 | p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
| 49 | p_dev->config_index = 1; | 49 | p_dev->config_index = 1; |
| 50 | p_dev->config_regs = PRESENT_OPTION; | 50 | p_dev->config_regs = PRESENT_OPTION; |
| 51 | 51 | ||
| 52 | return avmcs_config(p_dev); | 52 | return avmcs_config(p_dev); |
| 53 | } /* avmcs_attach */ | 53 | } /* avmcs_attach */ |
| 54 | 54 | ||
| 55 | 55 | ||
| @@ -69,75 +69,75 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data) · 13 unmodified lines | |||
| 69 | 69 | ||
| 70 | static int avmcs_config(struct pcmcia_device *link) | 70 | static int avmcs_config(struct pcmcia_device *link) |
| 71 | { | 71 | { |
| 72 | int i = -1; | 72 | int i = -1; |
| 73 | char devname[128]; | 73 | char devname[128]; |
| 74 | int cardtype; | 74 | int cardtype; |
| 75 | int (*addcard)(unsigned int port, unsigned irq); | 75 | int (*addcard)(unsigned int port, unsigned irq); |
| 76 | 76 | ||
| 77 | devname[0] = 0; | 77 | devname[0] = 0; |
| 78 | if (link->prod_id[1]) | 78 | if (link->prod_id[1]) |
| 79 | strlcpy(devname, link->prod_id[1], sizeof(devname)); | 79 | strlcpy(devname, link->prod_id[1], sizeof(devname)); |
| 80 | |||
| 81 | /* | ||
| 82 | * find IO port | ||
| 83 | */ | ||
| 84 | if (pcmcia_loop_config(link, avmcs_configcheck, NULL)) | ||
| 85 | return -ENODEV; | ||
| 86 | |||
| 87 | do { | ||
| 88 | if (!link->irq) { | ||
| 89 | /* undo */ | ||
| 90 | pcmcia_disable_device(link); | ||
| 91 | break; | ||
| 92 | } | ||
| 93 | 80 | ||
| 94 | /* | 81 | /* |
| 95 | * configure the PCMCIA socket | 82 | * find IO port |
| 96 | */ | 83 | */ |
| 97 | i = pcmcia_enable_device(link); | 84 | if (pcmcia_loop_config(link, avmcs_configcheck, NULL)) |
| 85 | return -ENODEV; | ||
| 86 | |||
| 87 | do { | ||
| 88 | if (!link->irq) { | ||
| 89 | /* undo */ | ||
| 90 | pcmcia_disable_device(link); | ||
| 91 | break; | ||
| 92 | } | ||
| 93 | |||
| 94 | /* | ||
| 95 | * configure the PCMCIA socket | ||
| 96 | */ | ||
| 97 | i = pcmcia_enable_device(link); | ||
| 98 | if (i != 0) { | ||
| 99 | pcmcia_disable_device(link); | ||
| 100 | break; | ||
| 101 | } | ||
| 102 | |||
| 103 | } while (0); | ||
| 104 | |||
| 105 | if (devname[0]) { | ||
| 106 | char *s = strrchr(devname, ' '); | ||
| 107 | if (!s) | ||
| 108 | s = devname; | ||
| 109 | else s++; | ||
| 110 | if (strcmp("M1", s) == 0) { | ||
| 111 | cardtype = AVM_CARDTYPE_M1; | ||
| 112 | } else if (strcmp("M2", s) == 0) { | ||
| 113 | cardtype = AVM_CARDTYPE_M2; | ||
| 114 | } else { | ||
| 115 | cardtype = AVM_CARDTYPE_B1; | ||
| 116 | } | ||
| 117 | } else | ||
| 118 | cardtype = AVM_CARDTYPE_B1; | ||
| 119 | |||
| 120 | /* If any step failed, release any partially configured state */ | ||
| 98 | if (i != 0) { | 121 | if (i != 0) { |
| 99 | pcmcia_disable_device(link); | 122 | avmcs_release(link); |
| 100 | break; | 123 | return -ENODEV; |
| 101 | } | ||
| 102 | |||
| 103 | } while (0); | ||
| 104 | |||
| 105 | if (devname[0]) { | ||
| 106 | char *s = strrchr(devname, ' '); | ||
| 107 | if (!s) | ||
| 108 | s = devname; | ||
| 109 | else s++; | ||
| 110 | if (strcmp("M1", s) == 0) { | ||
| 111 | cardtype = AVM_CARDTYPE_M1; | ||
| 112 | } else if (strcmp("M2", s) == 0) { | ||
| 113 | cardtype = AVM_CARDTYPE_M2; | ||
| 114 | } else { | ||
| 115 | cardtype = AVM_CARDTYPE_B1; | ||
| 116 | } | 124 | } |
| 117 | } else | ||
| 118 | cardtype = AVM_CARDTYPE_B1; | ||
| 119 | |||
| 120 | /* If any step failed, release any partially configured state */ | ||
| 121 | if (i != 0) { | ||
| 122 | avmcs_release(link); | ||
| 123 | return -ENODEV; | ||
| 124 | } | ||
| 125 | 125 | ||
| 126 | 126 | ||
| 127 | switch (cardtype) { | 127 | switch (cardtype) { |
| 128 | case AVM_CARDTYPE_M1: addcard = b1pcmcia_addcard_m1; break; | 128 | case AVM_CARDTYPE_M1: addcard = b1pcmcia_addcard_m1; break; |
| 129 | case AVM_CARDTYPE_M2: addcard = b1pcmcia_addcard_m2; break; | 129 | case AVM_CARDTYPE_M2: addcard = b1pcmcia_addcard_m2; break; |
| 130 | default: | 130 | default: |
| 131 | case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; | 131 | case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; |
| 132 | } | 132 | } |
| 133 | if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) { | 133 | if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) { |
| 134 | dev_err(&link->dev, | 134 | dev_err(&link->dev, |
| 135 | "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", | 135 | "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", |
| 136 | (unsigned int) link->resource[0]->start, link->irq); | 136 | (unsigned int) link->resource[0]->start, link->irq); |
| 137 | avmcs_release(link); | 137 | avmcs_release(link); |
| 138 | return -ENODEV; | 138 | return -ENODEV; |
| 139 | } | 139 | } |
| 140 | return 0; | 140 | return 0; |
| 141 | 141 | ||
| 142 | } /* avmcs_config */ | 142 | } /* avmcs_config */ |
| 143 | 143 | ||
| @@ -44,16 +44,16 @@ enum avmcardtype { · 43 unmodified lines | |||
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | typedef struct avmcard_dmabuf { | 46 | typedef struct avmcard_dmabuf { |
| 47 | long size; | 47 | long size; |
| 48 | u8 *dmabuf; | 48 | u8 *dmabuf; |
| 49 | dma_addr_t dmaaddr; | 49 | dma_addr_t dmaaddr; |
| 50 | } avmcard_dmabuf; | 50 | } avmcard_dmabuf; |
| 51 | 51 | ||
| 52 | typedef struct avmcard_dmainfo { | 52 | typedef struct avmcard_dmainfo { |
| 53 | u32 recvlen; | 53 | u32 recvlen; |
| 54 | avmcard_dmabuf recvbuf; | 54 | avmcard_dmabuf recvbuf; |
| 55 | 55 | ||
| 56 | avmcard_dmabuf sendbuf; | 56 | avmcard_dmabuf sendbuf; |
| 57 | struct sk_buff_head send_queue; | 57 | struct sk_buff_head send_queue; |
| 58 | 58 | ||
| 59 | struct pci_dev *pcidev; | 59 | struct pci_dev *pcidev; |
| @@ -61,22 +61,22 @@ typedef struct avmcard_dmainfo { · 1 unmodified line | |||
| 61 | 61 | ||
| 62 | typedef struct avmctrl_info { | 62 | typedef struct avmctrl_info { |
| 63 | char cardname[32]; | 63 | char cardname[32]; |
| 64 | 64 | ||
| 65 | int versionlen; | 65 | int versionlen; |
| 66 | char versionbuf[1024]; | 66 | char versionbuf[1024]; |
| 67 | char *version[AVM_MAXVERSION]; | 67 | char *version[AVM_MAXVERSION]; |
| 68 | 68 | ||
| 69 | char infobuf[128]; /* for function procinfo */ | 69 | char infobuf[128]; /* for function procinfo */ |
| 70 | 70 | ||
| 71 | struct avmcard *card; | 71 | struct avmcard *card; |
| 72 | struct capi_ctr capi_ctrl; | 72 | struct capi_ctr capi_ctrl; |
| 73 | 73 | ||
| 74 | struct list_head ncci_head; | 74 | struct list_head ncci_head; |
| 75 | } avmctrl_info; | 75 | } avmctrl_info; |
| 76 | 76 | ||
| 77 | typedef struct avmcard { | 77 | typedef struct avmcard { |
| 78 | char name[32]; | 78 | char name[32]; |
| 79 | 79 | ||
| 80 | spinlock_t lock; | 80 | spinlock_t lock; |
| 81 | unsigned int port; | 81 | unsigned int port; |
| 82 | unsigned irq; | 82 | unsigned irq; |
| @@ -103,95 +103,95 @@ typedef struct avmcard { · 20 unmodified lines | |||
| 103 | extern int b1_irq_table[16]; | 103 | extern int b1_irq_table[16]; |
| 104 | 104 | ||
| 105 | /* | 105 | /* |
| 106 | * LLI Messages to the ISDN-ControllerISDN Controller | 106 | * LLI Messages to the ISDN-ControllerISDN Controller |
| 107 | */ | 107 | */ |
| 108 | 108 | ||
| 109 | #define SEND_POLL 0x72 /* | 109 | #define SEND_POLL 0x72 /* |
| 110 | * after load <- RECEIVE_POLL | 110 | * after load <- RECEIVE_POLL |
| 111 | */ | 111 | */ |
| 112 | #define SEND_INIT 0x11 /* | 112 | #define SEND_INIT 0x11 /* |
| 113 | * first message <- RECEIVE_INIT | 113 | * first message <- RECEIVE_INIT |
| 114 | * int32 NumApplications int32 | 114 | * int32 NumApplications int32 |
| 115 | * NumNCCIs int32 BoardNumber | 115 | * NumNCCIs int32 BoardNumber |
| 116 | */ | 116 | */ |
| 117 | #define SEND_REGISTER 0x12 /* | 117 | #define SEND_REGISTER 0x12 /* |
| 118 | * register an application int32 | 118 | * register an application int32 |
| 119 | * ApplIDId int32 NumMessages | 119 | * ApplIDId int32 NumMessages |
| 120 | * int32 NumB3Connections int32 | 120 | * int32 NumB3Connections int32 |
| 121 | * NumB3Blocks int32 B3Size | 121 | * NumB3Blocks int32 B3Size |
| 122 | * | 122 | * |
| 123 | * AnzB3Connection != 0 && | 123 | * AnzB3Connection != 0 && |
| 124 | * AnzB3Blocks >= 1 && B3Size >= 1 | 124 | * AnzB3Blocks >= 1 && B3Size >= 1 |
| 125 | */ | 125 | */ |
| 126 | #define SEND_RELEASE 0x14 /* | 126 | #define SEND_RELEASE 0x14 /* |
| 127 | * deregister an application int32 | 127 | * deregister an application int32 |
| 128 | * ApplID | 128 | * ApplID |
| 129 | */ | 129 | */ |
| 130 | #define SEND_MESSAGE 0x15 /* | 130 | #define SEND_MESSAGE 0x15 /* |
| 131 | * send capi-message int32 length | 131 | * send capi-message int32 length |
| 132 | * capi-data ... | 132 | * capi-data ... |
| 133 | */ | 133 | */ |
| 134 | #define SEND_DATA_B3_REQ 0x13 /* | 134 | #define SEND_DATA_B3_REQ 0x13 /* |
| 135 | * send capi-data-message int32 | 135 | * send capi-data-message int32 |
| 136 | * MsgLength capi-data ... int32 | 136 | * MsgLength capi-data ... int32 |
| 137 | * B3Length data .... | 137 | * B3Length data .... |
| 138 | */ | 138 | */ |
| 139 | 139 | ||
| 140 | #define SEND_CONFIG 0x21 /* | 140 | #define SEND_CONFIG 0x21 /* |
| 141 | */ | 141 | */ |
| 142 | 142 | ||
| 143 | #define SEND_POLLACK 0x73 /* T1 Watchdog */ | 143 | #define SEND_POLLACK 0x73 /* T1 Watchdog */ |
| 144 | 144 | ||
| 145 | /* | 145 | /* |
| 146 | * LLI Messages from the ISDN-ControllerISDN Controller | 146 | * LLI Messages from the ISDN-ControllerISDN Controller |
| 147 | */ | 147 | */ |
| 148 | 148 | ||
| 149 | #define RECEIVE_POLL 0x32 /* | 149 | #define RECEIVE_POLL 0x32 /* |
| 150 | * <- after SEND_POLL | 150 | * <- after SEND_POLL |
| 151 | */ | 151 | */ |
| 152 | #define RECEIVE_INIT 0x27 /* | 152 | #define RECEIVE_INIT 0x27 /* |
| 153 | * <- after SEND_INIT int32 length | 153 | * <- after SEND_INIT int32 length |
| 154 | * byte total length b1struct board | 154 | * byte total length b1struct board |
| 155 | * driver revision b1struct card | 155 | * driver revision b1struct card |
| 156 | * type b1struct reserved b1struct | 156 | * type b1struct reserved b1struct |
| 157 | * serial number b1struct driver | 157 | * serial number b1struct driver |
| 158 | * capability b1struct d-channel | 158 | * capability b1struct d-channel |
| 159 | * protocol b1struct CAPI-2.0 | 159 | * protocol b1struct CAPI-2.0 |
| 160 | * profile b1struct capi version | 160 | * profile b1struct capi version |
| 161 | */ | 161 | */ |
| 162 | #define RECEIVE_MESSAGE 0x21 /* | 162 | #define RECEIVE_MESSAGE 0x21 /* |
| 163 | * <- after SEND_MESSAGE int32 | 163 | * <- after SEND_MESSAGE int32 |
| 164 | * AppllID int32 Length capi-data | 164 | * AppllID int32 Length capi-data |
| 165 | * .... | 165 | * .... |
| 166 | */ | 166 | */ |
| 167 | #define RECEIVE_DATA_B3_IND 0x22 /* | 167 | #define RECEIVE_DATA_B3_IND 0x22 /* |
| 168 | * received data int32 AppllID | 168 | * received data int32 AppllID |
| 169 | * int32 Length capi-data ... | 169 | * int32 Length capi-data ... |
| 170 | * int32 B3Length data ... | 170 | * int32 B3Length data ... |
| 171 | */ | 171 | */ |
| 172 | #define RECEIVE_START 0x23 /* | 172 | #define RECEIVE_START 0x23 /* |
| 173 | * Handshake | 173 | * Handshake |
| 174 | */ | 174 | */ |
| 175 | #define RECEIVE_STOP 0x24 /* | 175 | #define RECEIVE_STOP 0x24 /* |
| 176 | * Handshake | 176 | * Handshake |
| 177 | */ | 177 | */ |
| 178 | #define RECEIVE_NEW_NCCI 0x25 /* | 178 | #define RECEIVE_NEW_NCCI 0x25 /* |
| 179 | * int32 AppllID int32 NCCI int32 | 179 | * int32 AppllID int32 NCCI int32 |
| 180 | * WindowSize | 180 | * WindowSize |
| 181 | */ | 181 | */ |
| 182 | #define RECEIVE_FREE_NCCI 0x26 /* | 182 | #define RECEIVE_FREE_NCCI 0x26 /* |
| 183 | * int32 AppllID int32 NCCI | 183 | * int32 AppllID int32 NCCI |
| 184 | */ | 184 | */ |
| 185 | #define RECEIVE_RELEASE 0x26 /* | 185 | #define RECEIVE_RELEASE 0x26 /* |
| 186 | * int32 AppllID int32 0xffffffff | 186 | * int32 AppllID int32 0xffffffff |
| 187 | */ | 187 | */ |
| 188 | #define RECEIVE_TASK_READY 0x31 /* | 188 | #define RECEIVE_TASK_READY 0x31 /* |
| 189 | * int32 tasknr | 189 | * int32 tasknr |
| 190 | * int32 Length Taskname ... | 190 | * int32 Length Taskname ... |
| 191 | */ | 191 | */ |
| 192 | #define RECEIVE_DEBUGMSG 0x71 /* | 192 | #define RECEIVE_DEBUGMSG 0x71 /* |
| 193 | * int32 Length message | 193 | * int32 Length message |
| 194 | * | 194 | * |
| 195 | */ | 195 | */ |
| 196 | #define RECEIVE_POLLDWORD 0x75 /* t1pci in dword mode */ | 196 | #define RECEIVE_POLLDWORD 0x75 /* t1pci in dword mode */ |
| 197 | 197 | ||
| @@ -264,7 +264,7 @@ static inline void b1_put_byte(unsigned int base, unsigned char val) · 66 unmodified lines | |||
| 264 | static inline int b1_save_put_byte(unsigned int base, unsigned char val) | 264 | static inline int b1_save_put_byte(unsigned int base, unsigned char val) |
| 265 | { | 265 | { |
| 266 | unsigned long stop = jiffies + 2 * HZ; | 266 | unsigned long stop = jiffies + 2 * HZ; |
| 267 | while (!b1_tx_empty(base) && time_before(jiffies,stop)); | 267 | while (!b1_tx_empty(base) && time_before(jiffies, stop)); |
| 268 | if (!b1_tx_empty(base)) return -1; | 268 | if (!b1_tx_empty(base)) return -1; |
| 269 | b1outp(base, B1_WRITE, val); | 269 | b1outp(base, B1_WRITE, val); |
| 270 | return 0; | 270 | return 0; |
| @@ -298,21 +298,21 @@ static inline void b1_put_slice(unsigned int base, · 27 unmodified lines | |||
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | static void b1_wr_reg(unsigned int base, | 300 | static void b1_wr_reg(unsigned int base, |
| 301 | unsigned int reg, | 301 | unsigned int reg, |
| 302 | unsigned int value) | 302 | unsigned int value) |
| 303 | { | 303 | { |
| 304 | b1_put_byte(base, WRITE_REGISTER); | 304 | b1_put_byte(base, WRITE_REGISTER); |
| 305 | b1_put_word(base, reg); | 305 | b1_put_word(base, reg); |
| 306 | b1_put_word(base, value); | 306 | b1_put_word(base, value); |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | static inline unsigned int b1_rd_reg(unsigned int base, | 309 | static inline unsigned int b1_rd_reg(unsigned int base, |
| 310 | unsigned int reg) | 310 | unsigned int reg) |
| 311 | { | 311 | { |
| 312 | b1_put_byte(base, READ_REGISTER); | 312 | b1_put_byte(base, READ_REGISTER); |
| 313 | b1_put_word(base, reg); | 313 | b1_put_word(base, reg); |
| 314 | return b1_get_word(base); | 314 | return b1_get_word(base); |
| 315 | 315 | ||
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | static inline void b1_reset(unsigned int base) | 318 | static inline void b1_reset(unsigned int base) |
| @@ -338,13 +338,13 @@ static inline void b1_set_test_bit(unsigned int base, · 19 unmodified lines | |||
| 338 | enum avmcardtype cardtype, | 338 | enum avmcardtype cardtype, |
| 339 | int onoff) | 339 | int onoff) |
| 340 | { | 340 | { |
| 341 | b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20); | 341 | b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | static inline int b1_get_test_bit(unsigned int base, | 344 | static inline int b1_get_test_bit(unsigned int base, |
| 345 | enum avmcardtype cardtype) | 345 | enum avmcardtype cardtype) |
| 346 | { | 346 | { |
| 347 | return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0; | 347 | return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0; |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | /* ---------------------------------------------------------------- */ | 350 | /* ---------------------------------------------------------------- */ |
| @@ -391,7 +391,7 @@ static inline void t1outp(unsigned int base, · 40 unmodified lines | |||
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | static inline unsigned char t1inp(unsigned int base, | 393 | static inline unsigned char t1inp(unsigned int base, |
| 394 | unsigned short offset) | 394 | unsigned short offset) |
| 395 | { | 395 | { |
| 396 | return inb(base + offset); | 396 | return inb(base + offset); |
| 397 | } | 397 | } |
| @@ -415,42 +415,42 @@ static inline unsigned int t1_get_slice(unsigned int base, · 17 unmodified lines | |||
| 415 | #endif | 415 | #endif |
| 416 | 416 | ||
| 417 | len = i = b1_get_word(base); | 417 | len = i = b1_get_word(base); |
| 418 | if (t1_isfastlink(base)) { | 418 | if (t1_isfastlink(base)) { |
| 419 | int status; | 419 | int status; |
| 420 | while (i > 0) { | 420 | while (i > 0) { |
| 421 | status = t1_fifostatus(base) & (T1F_IREADY|T1F_IHALF); | 421 | status = t1_fifostatus(base) & (T1F_IREADY | T1F_IHALF); |
| 422 | if (i >= FIFO_INPBSIZE) status |= T1F_IFULL; | 422 | if (i >= FIFO_INPBSIZE) status |= T1F_IFULL; |
| 423 | 423 | ||
| 424 | switch (status) { | 424 | switch (status) { |
| 425 | case T1F_IREADY|T1F_IHALF|T1F_IFULL: | 425 | case T1F_IREADY | T1F_IHALF | T1F_IFULL: |
| 426 | insb(base+B1_READ, dp, FIFO_INPBSIZE); | 426 | insb(base + B1_READ, dp, FIFO_INPBSIZE); |
| 427 | dp += FIFO_INPBSIZE; | 427 | dp += FIFO_INPBSIZE; |
| 428 | i -= FIFO_INPBSIZE; | 428 | i -= FIFO_INPBSIZE; |
| 429 | #ifdef FASTLINK_DEBUG | 429 | #ifdef FASTLINK_DEBUG |
| 430 | wcnt += FIFO_INPBSIZE; | 430 | wcnt += FIFO_INPBSIZE; |
| 431 | #endif | 431 | #endif |
| 432 | break; | 432 | break; |
| 433 | case T1F_IREADY|T1F_IHALF: | 433 | case T1F_IREADY | T1F_IHALF: |
| 434 | insb(base+B1_READ,dp, i); | 434 | insb(base + B1_READ, dp, i); |
| 435 | #ifdef FASTLINK_DEBUG | 435 | #ifdef FASTLINK_DEBUG |
| 436 | wcnt += i; | 436 | wcnt += i; |
| 437 | #endif | 437 | #endif |
| 438 | dp += i; | 438 | dp += i; |
| 439 | i = 0; | 439 | i = 0; |
| 440 | break; | 440 | break; |
| 441 | default: | 441 | default: |
| 442 | *dp++ = b1_get_byte(base); | 442 | *dp++ = b1_get_byte(base); |
| 443 | i--; | 443 | i--; |
| 444 | #ifdef FASTLINK_DEBUG | 444 | #ifdef FASTLINK_DEBUG |
| 445 | bcnt++; | 445 | bcnt++; |
| 446 | #endif | 446 | #endif |
| 447 | break; | 447 | break; |
| 448 | } | 448 | } |
| 449 | } | 449 | } |
| 450 | #ifdef FASTLINK_DEBUG | 450 | #ifdef FASTLINK_DEBUG |
| 451 | if (wcnt) | 451 | if (wcnt) |
| 452 | printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n", | 452 | printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n", |
| 453 | base, len, wcnt, bcnt); | 453 | base, len, wcnt, bcnt); |
| 454 | #endif | 454 | #endif |
| 455 | } else { | 455 | } else { |
| 456 | while (i-- > 0) | 456 | while (i-- > 0) |
| @@ -464,26 +464,26 @@ static inline void t1_put_slice(unsigned int base, · 7 unmodified lines | |||
| 464 | { | 464 | { |
| 465 | unsigned i = len; | 465 | unsigned i = len; |
| 466 | b1_put_word(base, i); | 466 | b1_put_word(base, i); |
| 467 | if (t1_isfastlink(base)) { | 467 | if (t1_isfastlink(base)) { |
| 468 | int status; | 468 | int status; |
| 469 | while (i > 0) { | 469 | while (i > 0) { |
| 470 | status = t1_fifostatus(base) & (T1F_OREADY|T1F_OHALF); | 470 | status = t1_fifostatus(base) & (T1F_OREADY | T1F_OHALF); |
| 471 | if (i >= FIFO_OUTBSIZE) status |= T1F_OEMPTY; | 471 | if (i >= FIFO_OUTBSIZE) status |= T1F_OEMPTY; |
| 472 | switch (status) { | 472 | switch (status) { |
| 473 | case T1F_OREADY|T1F_OHALF|T1F_OEMPTY: | 473 | case T1F_OREADY | T1F_OHALF | T1F_OEMPTY: |
| 474 | outsb(base+B1_WRITE, dp, FIFO_OUTBSIZE); | 474 | outsb(base + B1_WRITE, dp, FIFO_OUTBSIZE); |
| 475 | dp += FIFO_OUTBSIZE; | 475 | dp += FIFO_OUTBSIZE; |
| 476 | i -= FIFO_OUTBSIZE; | 476 | i -= FIFO_OUTBSIZE; |
| 477 | break; | 477 | break; |
| 478 | case T1F_OREADY|T1F_OHALF: | 478 | case T1F_OREADY | T1F_OHALF: |
| 479 | outsb(base+B1_WRITE, dp, i); | 479 | outsb(base + B1_WRITE, dp, i); |
| 480 | dp += i; | 480 | dp += i; |
| 481 | i = 0; | 481 | i = 0; |
| 482 | break; | 482 | break; |
| 483 | default: | 483 | default: |
| 484 | b1_put_byte(base, *dp++); | 484 | b1_put_byte(base, *dp++); |
| 485 | i--; | 485 | i--; |
| 486 | break; | 486 | break; |
| 487 | } | 487 | } |
| 488 | } | 488 | } |
| 489 | } else { | 489 | } else { |
| @@ -494,18 +494,18 @@ static inline void t1_put_slice(unsigned int base, · 4 unmodified lines | |||
| 494 | 494 | ||
| 495 | static inline void t1_disable_irq(unsigned int base) | 495 | static inline void t1_disable_irq(unsigned int base) |
| 496 | { | 496 | { |
| 497 | t1outp(base, T1_IRQMASTER, 0x00); | 497 | t1outp(base, T1_IRQMASTER, 0x00); |
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | static inline void t1_reset(unsigned int base) | 500 | static inline void t1_reset(unsigned int base) |
| 501 | { | 501 | { |
| 502 | /* reset T1 Controller */ | 502 | /* reset T1 Controller */ |
| 503 | b1_reset(base); | 503 | b1_reset(base); |
| 504 | /* disable irq on HEMA */ | 504 | /* disable irq on HEMA */ |
| 505 | t1outp(base, B1_INSTAT, 0x00); | 505 | t1outp(base, B1_INSTAT, 0x00); |
| 506 | t1outp(base, B1_OUTSTAT, 0x00); | 506 | t1outp(base, B1_OUTSTAT, 0x00); |
| 507 | t1outp(base, T1_IRQMASTER, 0x00); | 507 | t1outp(base, T1_IRQMASTER, 0x00); |
| 508 | /* reset HEMA board configuration */ | 508 | /* reset HEMA board configuration */ |
| 509 | t1outp(base, T1_RESETBOARD, 0xf); | 509 | t1outp(base, T1_RESETBOARD, 0xf); |
| 510 | } | 510 | } |
| 511 | 511 | ||
| @@ -513,29 +513,29 @@ static inline void b1_setinterrupt(unsigned int base, unsigned irq, · 1 unmodified line | |||
| 513 | enum avmcardtype cardtype) | 513 | enum avmcardtype cardtype) |
| 514 | { | 514 | { |
| 515 | switch (cardtype) { | 515 | switch (cardtype) { |
| 516 | case avm_t1isa: | 516 | case avm_t1isa: |
| 517 | t1outp(base, B1_INSTAT, 0x00); | 517 | t1outp(base, B1_INSTAT, 0x00); |
| 518 | t1outp(base, B1_INSTAT, 0x02); | 518 | t1outp(base, B1_INSTAT, 0x02); |
| 519 | t1outp(base, T1_IRQMASTER, 0x08); | 519 | t1outp(base, T1_IRQMASTER, 0x08); |
| 520 | break; | 520 | break; |
| 521 | case avm_b1isa: | 521 | case avm_b1isa: |
| 522 | b1outp(base, B1_INSTAT, 0x00); | 522 | b1outp(base, B1_INSTAT, 0x00); |
| 523 | b1outp(base, B1_RESET, b1_irq_table[irq]); | 523 | b1outp(base, B1_RESET, b1_irq_table[irq]); |
| 524 | b1outp(base, B1_INSTAT, 0x02); | 524 | b1outp(base, B1_INSTAT, 0x02); |
| 525 | break; | 525 | break; |
| 526 | default: | 526 | default: |
| 527 | case avm_m1: | 527 | case avm_m1: |
| 528 | case avm_m2: | 528 | case avm_m2: |
| 529 | case avm_b1pci: | 529 | case avm_b1pci: |
| 530 | b1outp(base, B1_INSTAT, 0x00); | 530 | b1outp(base, B1_INSTAT, 0x00); |
| 531 | b1outp(base, B1_RESET, 0xf0); | 531 | b1outp(base, B1_RESET, 0xf0); |
| 532 | b1outp(base, B1_INSTAT, 0x02); | 532 | b1outp(base, B1_INSTAT, 0x02); |
| 533 | break; | 533 | break; |
| 534 | case avm_c4: | 534 | case avm_c4: |
| 535 | case avm_t1pci: | 535 | case avm_t1pci: |
| 536 | b1outp(base, B1_RESET, 0xf0); | 536 | b1outp(base, B1_RESET, 0xf0); |
| 537 | break; | 537 | break; |
| 538 | } | 538 | } |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | /* b1.c */ | 541 | /* b1.c */ |
| @@ -543,14 +543,14 @@ avmcard *b1_alloc_card(int nr_controllers); · 1 unmodified line | |||
| 543 | void b1_free_card(avmcard *card); | 543 | void b1_free_card(avmcard *card); |
| 544 | int b1_detect(unsigned int base, enum avmcardtype cardtype); | 544 | int b1_detect(unsigned int base, enum avmcardtype cardtype); |
| 545 | void b1_getrevision(avmcard *card); | 545 | void b1_getrevision(avmcard *card); |
| 546 | int b1_load_t4file(avmcard *card, capiloaddatapart * t4file); | 546 | int b1_load_t4file(avmcard *card, capiloaddatapart *t4file); |
| 547 | int b1_load_config(avmcard *card, capiloaddatapart * config); | 547 | int b1_load_config(avmcard *card, capiloaddatapart *config); |
| 548 | int b1_loaded(avmcard *card); | 548 | int b1_loaded(avmcard *card); |
| 549 | 549 | ||
| 550 | int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data); | 550 | int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data); |
| 551 | void b1_reset_ctr(struct capi_ctr *ctrl); | 551 | void b1_reset_ctr(struct capi_ctr *ctrl); |
| 552 | void b1_register_appl(struct capi_ctr *ctrl, u16 appl, | 552 | void b1_register_appl(struct capi_ctr *ctrl, u16 appl, |
| 553 | capi_register_params *rp); | 553 | capi_register_params *rp); |
| 554 | void b1_release_appl(struct capi_ctr *ctrl, u16 appl); | 554 | void b1_release_appl(struct capi_ctr *ctrl, u16 appl); |
| 555 | u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); | 555 | u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); |
| 556 | void b1_parse_version(avmctrl_info *card); | 556 | void b1_parse_version(avmctrl_info *card); |
| @@ -572,8 +572,8 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data); · 15 unmodified lines | |||
| 572 | void b1dma_reset_ctr(struct capi_ctr *ctrl); | 572 | void b1dma_reset_ctr(struct capi_ctr *ctrl); |
| 573 | void b1dma_remove_ctr(struct capi_ctr *ctrl); | 573 | void b1dma_remove_ctr(struct capi_ctr *ctrl); |
| 574 | void b1dma_register_appl(struct capi_ctr *ctrl, | 574 | void b1dma_register_appl(struct capi_ctr *ctrl, |
| 575 | u16 appl, | 575 | u16 appl, |
| 576 | capi_register_params *rp); | 576 | capi_register_params *rp); |
| 577 | void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl); | 577 | void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl); |
| 578 | u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); | 578 | u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); |
| 579 | extern const struct file_operations b1dmactl_proc_fops; | 579 | extern const struct file_operations b1dmactl_proc_fops; |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* $Id: b1.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ | 1 | /* $Id: b1.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Common module for AVM B1 cards. | 3 | * Common module for AVM B1 cards. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| @@ -60,7 +60,7 @@ int b1_irq_table[16] = · 52 unmodified lines | |||
| 60 | 112, /* irq 15 */ | 60 | 112, /* irq 15 */ |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | /* ------------------------------------------------------------- */ | 63 | /* ------------------------------------------------------------- */ |
| 64 | 64 | ||
| 65 | avmcard *b1_alloc_card(int nr_controllers) | 65 | avmcard *b1_alloc_card(int nr_controllers) |
| 66 | { | 66 | { |
| @@ -104,13 +104,13 @@ int b1_detect(unsigned int base, enum avmcardtype cardtype) · 37 unmodified lines | |||
| 104 | int onoff, i; | 104 | int onoff, i; |
| 105 | 105 | ||
| 106 | /* | 106 | /* |
| 107 | * Statusregister 0000 00xx | 107 | * Statusregister 0000 00xx |
| 108 | */ | 108 | */ |
| 109 | if ((inb(base + B1_INSTAT) & 0xfc) | 109 | if ((inb(base + B1_INSTAT) & 0xfc) |
| 110 | || (inb(base + B1_OUTSTAT) & 0xfc)) | 110 | || (inb(base + B1_OUTSTAT) & 0xfc)) |
| 111 | return 1; | 111 | return 1; |
| 112 | /* | 112 | /* |
| 113 | * Statusregister 0000 001x | 113 | * Statusregister 0000 001x |
| 114 | */ | 114 | */ |
| 115 | b1outp(base, B1_INSTAT, 0x2); /* enable irq */ | 115 | b1outp(base, B1_INSTAT, 0x2); /* enable irq */ |
| 116 | /* b1outp(base, B1_OUTSTAT, 0x2); */ | 116 | /* b1outp(base, B1_OUTSTAT, 0x2); */ |
| @@ -118,38 +118,38 @@ int b1_detect(unsigned int base, enum avmcardtype cardtype) · 1 unmodified line | |||
| 118 | /* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */) | 118 | /* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */) |
| 119 | return 2; | 119 | return 2; |
| 120 | /* | 120 | /* |
| 121 | * Statusregister 0000 000x | 121 | * Statusregister 0000 000x |
| 122 | */ | 122 | */ |
| 123 | b1outp(base, B1_INSTAT, 0x0); /* disable irq */ | 123 | b1outp(base, B1_INSTAT, 0x0); /* disable irq */ |
| 124 | b1outp(base, B1_OUTSTAT, 0x0); | 124 | b1outp(base, B1_OUTSTAT, 0x0); |
| 125 | if ((inb(base + B1_INSTAT) & 0xfe) | 125 | if ((inb(base + B1_INSTAT) & 0xfe) |
| 126 | || (inb(base + B1_OUTSTAT) & 0xfe)) | 126 | || (inb(base + B1_OUTSTAT) & 0xfe)) |
| 127 | return 3; | 127 | return 3; |
| 128 | 128 | ||
| 129 | for (onoff = !0, i= 0; i < 10 ; i++) { | 129 | for (onoff = !0, i = 0; i < 10; i++) { |
| 130 | b1_set_test_bit(base, cardtype, onoff); | 130 | b1_set_test_bit(base, cardtype, onoff); |
| 131 | if (b1_get_test_bit(base, cardtype) != onoff) | 131 | if (b1_get_test_bit(base, cardtype) != onoff) |
| 132 | return 4; | 132 | return 4; |
| 133 | onoff = !onoff; | 133 | onoff = !onoff; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | if (cardtype == avm_m1) | 136 | if (cardtype == avm_m1) |
| 137 | return 0; | 137 | return 0; |
| 138 | 138 | ||
| 139 | if ((b1_rd_reg(base, B1_STAT1(cardtype)) & 0x0f) != 0x01) | 139 | if ((b1_rd_reg(base, B1_STAT1(cardtype)) & 0x0f) != 0x01) |
| 140 | return 5; | 140 | return 5; |
| 141 | 141 | ||
| 142 | return 0; | 142 | return 0; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | void b1_getrevision(avmcard *card) | 145 | void b1_getrevision(avmcard *card) |
| 146 | { | 146 | { |
| 147 | card->class = inb(card->port + B1_ANALYSE); | 147 | card->class = inb(card->port + B1_ANALYSE); |
| 148 | card->revision = inb(card->port + B1_REVISION); | 148 | card->revision = inb(card->port + B1_REVISION); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | #define FWBUF_SIZE 256 | 151 | #define FWBUF_SIZE 256 |
| 152 | int b1_load_t4file(avmcard *card, capiloaddatapart * t4file) | 152 | int b1_load_t4file(avmcard *card, capiloaddatapart *t4file) |
| 153 | { | 153 | { |
| 154 | unsigned char buf[FWBUF_SIZE]; | 154 | unsigned char buf[FWBUF_SIZE]; |
| 155 | unsigned char *dp; | 155 | unsigned char *dp; |
| @@ -168,7 +168,7 @@ int b1_load_t4file(avmcard *card, capiloaddatapart * t4file) · 12 unmodified lines | |||
| 168 | for (i = 0; i < FWBUF_SIZE; i++) | 168 | for (i = 0; i < FWBUF_SIZE; i++) |
| 169 | if (b1_save_put_byte(base, buf[i]) < 0) { | 169 | if (b1_save_put_byte(base, buf[i]) < 0) { |
| 170 | printk(KERN_ERR "%s: corrupted firmware file ?\n", | 170 | printk(KERN_ERR "%s: corrupted firmware file ?\n", |
| 171 | card->name); | 171 | card->name); |
| 172 | return -EIO; | 172 | return -EIO; |
| 173 | } | 173 | } |
| 174 | left -= FWBUF_SIZE; | 174 | left -= FWBUF_SIZE; |
| @@ -184,14 +184,14 @@ int b1_load_t4file(avmcard *card, capiloaddatapart * t4file) · 9 unmodified lines | |||
| 184 | for (i = 0; i < left; i++) | 184 | for (i = 0; i < left; i++) |
| 185 | if (b1_save_put_byte(base, buf[i]) < 0) { | 185 | if (b1_save_put_byte(base, buf[i]) < 0) { |
| 186 | printk(KERN_ERR "%s: corrupted firmware file ?\n", | 186 | printk(KERN_ERR "%s: corrupted firmware file ?\n", |
| 187 | card->name); | 187 | card->name); |
| 188 | return -EIO; | 188 | return -EIO; |
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| 191 | return 0; | 191 | return 0; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | int b1_load_config(avmcard *card, capiloaddatapart * config) | 194 | int b1_load_config(avmcard *card, capiloaddatapart *config) |
| 195 | { | 195 | { |
| 196 | unsigned char buf[FWBUF_SIZE]; | 196 | unsigned char buf[FWBUF_SIZE]; |
| 197 | unsigned char *dp; | 197 | unsigned char *dp; |
| @@ -202,9 +202,9 @@ int b1_load_config(avmcard *card, capiloaddatapart * config) · 4 unmodified lines | |||
| 202 | left = config->len; | 202 | left = config->len; |
| 203 | if (left) { | 203 | if (left) { |
| 204 | b1_put_byte(base, SEND_CONFIG); | 204 | b1_put_byte(base, SEND_CONFIG); |
| 205 | b1_put_word(base, 1); | 205 | b1_put_word(base, 1); |
| 206 | b1_put_byte(base, SEND_CONFIG); | 206 | b1_put_byte(base, SEND_CONFIG); |
| 207 | b1_put_word(base, left); | 207 | b1_put_word(base, left); |
| 208 | } | 208 | } |
| 209 | while (left > FWBUF_SIZE) { | 209 | while (left > FWBUF_SIZE) { |
| 210 | if (config->user) { | 210 | if (config->user) { |
| @@ -215,7 +215,7 @@ int b1_load_config(avmcard *card, capiloaddatapart * config) · 4 unmodified lines | |||
| 215 | } | 215 | } |
| 216 | for (i = 0; i < FWBUF_SIZE; ) { | 216 | for (i = 0; i < FWBUF_SIZE; ) { |
| 217 | b1_put_byte(base, SEND_CONFIG); | 217 | b1_put_byte(base, SEND_CONFIG); |
| 218 | for (j=0; j < 4; j++) { | 218 | for (j = 0; j < 4; j++) { |
| 219 | b1_put_byte(base, buf[i++]); | 219 | b1_put_byte(base, buf[i++]); |
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| @@ -231,7 +231,7 @@ int b1_load_config(avmcard *card, capiloaddatapart * config) · 9 unmodified lines | |||
| 231 | } | 231 | } |
| 232 | for (i = 0; i < left; ) { | 232 | for (i = 0; i < left; ) { |
| 233 | b1_put_byte(base, SEND_CONFIG); | 233 | b1_put_byte(base, SEND_CONFIG); |
| 234 | for (j=0; j < 4; j++) { | 234 | for (j = 0; j < 4; j++) { |
| 235 | if (i < left) | 235 | if (i < left) |
| 236 | b1_put_byte(base, buf[i++]); | 236 | b1_put_byte(base, buf[i++]); |
| 237 | else | 237 | else |
| @@ -255,7 +255,7 @@ int b1_loaded(avmcard *card) · 17 unmodified lines | |||
| 255 | } | 255 | } |
| 256 | if (!b1_tx_empty(base)) { | 256 | if (!b1_tx_empty(base)) { |
| 257 | printk(KERN_ERR "%s: b1_loaded: tx err, corrupted t4 file ?\n", | 257 | printk(KERN_ERR "%s: b1_loaded: tx err, corrupted t4 file ?\n", |
| 258 | card->name); | 258 | card->name); |
| 259 | return 0; | 259 | return 0; |
| 260 | } | 260 | } |
| 261 | b1_put_byte(base, SEND_POLL); | 261 | b1_put_byte(base, SEND_POLL); |
| @@ -265,7 +265,7 @@ int b1_loaded(avmcard *card) · 3 unmodified lines | |||
| 265 | return 1; | 265 | return 1; |
| 266 | } | 266 | } |
| 267 | printk(KERN_ERR "%s: b1_loaded: got 0x%x, firmware not running\n", | 267 | printk(KERN_ERR "%s: b1_loaded: got 0x%x, firmware not running\n", |
| 268 | card->name, ans); | 268 | card->name, ans); |
| 269 | return 0; | 269 | return 0; |
| 270 | } | 270 | } |
| 271 | } | 271 | } |
| @@ -288,7 +288,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 16 unmodified lines | |||
| 288 | if ((retval = b1_load_t4file(card, &data->firmware))) { | 288 | if ((retval = b1_load_t4file(card, &data->firmware))) { |
| 289 | b1_reset(port); | 289 | b1_reset(port); |
| 290 | printk(KERN_ERR "%s: failed to load t4file!!\n", | 290 | printk(KERN_ERR "%s: failed to load t4file!!\n", |
| 291 | card->name); | 291 | card->name); |
| 292 | return retval; | 292 | return retval; |
| 293 | } | 293 | } |
| 294 | 294 | ||
| @@ -298,7 +298,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 3 unmodified lines | |||
| 298 | if ((retval = b1_load_config(card, &data->configuration))) { | 298 | if ((retval = b1_load_config(card, &data->configuration))) { |
| 299 | b1_reset(port); | 299 | b1_reset(port); |
| 300 | printk(KERN_ERR "%s: failed to load config!!\n", | 300 | printk(KERN_ERR "%s: failed to load config!!\n", |
| 301 | card->name); | 301 | card->name); |
| 302 | return retval; | 302 | return retval; |
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| @@ -312,7 +312,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 7 unmodified lines | |||
| 312 | b1_setinterrupt(port, card->irq, card->cardtype); | 312 | b1_setinterrupt(port, card->irq, card->cardtype); |
| 313 | b1_put_byte(port, SEND_INIT); | 313 | b1_put_byte(port, SEND_INIT); |
| 314 | b1_put_word(port, CAPI_MAXAPPL); | 314 | b1_put_word(port, CAPI_MAXAPPL); |
| 315 | b1_put_word(port, AVM_NCCI_PER_CHANNEL*2); | 315 | b1_put_word(port, AVM_NCCI_PER_CHANNEL * 2); |
| 316 | b1_put_word(port, ctrl->cnr - 1); | 316 | b1_put_word(port, ctrl->cnr - 1); |
| 317 | spin_unlock_irqrestore(&card->lock, flags); | 317 | spin_unlock_irqrestore(&card->lock, flags); |
| 318 | 318 | ||
| @@ -337,8 +337,8 @@ void b1_reset_ctr(struct capi_ctr *ctrl) · 18 unmodified lines | |||
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | void b1_register_appl(struct capi_ctr *ctrl, | 339 | void b1_register_appl(struct capi_ctr *ctrl, |
| 340 | u16 appl, | 340 | u16 appl, |
| 341 | capi_register_params *rp) | 341 | capi_register_params *rp) |
| 342 | { | 342 | { |
| 343 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); | 343 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); |
| 344 | avmcard *card = cinfo->card; | 344 | avmcard *card = cinfo->card; |
| @@ -353,7 +353,7 @@ void b1_register_appl(struct capi_ctr *ctrl, · 8 unmodified lines | |||
| 353 | spin_lock_irqsave(&card->lock, flags); | 353 | spin_lock_irqsave(&card->lock, flags); |
| 354 | b1_put_byte(port, SEND_REGISTER); | 354 | b1_put_byte(port, SEND_REGISTER); |
| 355 | b1_put_word(port, appl); | 355 | b1_put_word(port, appl); |
| 356 | b1_put_word(port, 1024 * (nconn+1)); | 356 | b1_put_word(port, 1024 * (nconn + 1)); |
| 357 | b1_put_word(port, nconn); | 357 | b1_put_word(port, nconn); |
| 358 | b1_put_word(port, rp->datablkcnt); | 358 | b1_put_word(port, rp->datablkcnt); |
| 359 | b1_put_word(port, rp->datablklen); | 359 | b1_put_word(port, rp->datablklen); |
| @@ -430,7 +430,7 @@ void b1_parse_version(avmctrl_info *cinfo) · 70 unmodified lines | |||
| 430 | cinfo->version[j] = &cinfo->versionbuf[i + 1]; | 430 | cinfo->version[j] = &cinfo->versionbuf[i + 1]; |
| 431 | 431 | ||
| 432 | strlcpy(ctrl->serial, cinfo->version[VER_SERIAL], sizeof(ctrl->serial)); | 432 | strlcpy(ctrl->serial, cinfo->version[VER_SERIAL], sizeof(ctrl->serial)); |
| 433 | memcpy(&ctrl->profile, cinfo->version[VER_PROFILE],sizeof(capi_profile)); | 433 | memcpy(&ctrl->profile, cinfo->version[VER_PROFILE], sizeof(capi_profile)); |
| 434 | strlcpy(ctrl->manu, "AVM GmbH", sizeof(ctrl->manu)); | 434 | strlcpy(ctrl->manu, "AVM GmbH", sizeof(ctrl->manu)); |
| 435 | dversion = cinfo->version[VER_DRIVER]; | 435 | dversion = cinfo->version[VER_DRIVER]; |
| 436 | ctrl->version.majorversion = 2; | 436 | ctrl->version.majorversion = 2; |
| @@ -439,49 +439,49 @@ void b1_parse_version(avmctrl_info *cinfo) · 2 unmodified lines | |||
| 439 | ctrl->version.majormanuversion |= ((dversion[2] - '0') & 0xf); | 439 | ctrl->version.majormanuversion |= ((dversion[2] - '0') & 0xf); |
| 440 | ctrl->version.minormanuversion = (dversion[3] - '0') << 4; | 440 | ctrl->version.minormanuversion = (dversion[3] - '0') << 4; |
| 441 | ctrl->version.minormanuversion |= | 441 | ctrl->version.minormanuversion |= |
| 442 | (dversion[5] - '0') * 10 + ((dversion[6] - '0') & 0xf); | 442 | (dversion[5] - '0') * 10 + ((dversion[6] - '0') & 0xf); |
| 443 | 443 | ||
| 444 | profp = &ctrl->profile; | 444 | profp = &ctrl->profile; |
| 445 | 445 | ||
| 446 | flag = ((u8 *)(profp->manu))[1]; | 446 | flag = ((u8 *)(profp->manu))[1]; |
| 447 | switch (flag) { | 447 | switch (flag) { |
| 448 | case 0: if (cinfo->version[VER_CARDTYPE]) | 448 | case 0: if (cinfo->version[VER_CARDTYPE]) |
| 449 | strcpy(cinfo->cardname, cinfo->version[VER_CARDTYPE]); | 449 | strcpy(cinfo->cardname, cinfo->version[VER_CARDTYPE]); |
| 450 | else strcpy(cinfo->cardname, "B1"); | 450 | else strcpy(cinfo->cardname, "B1"); |
| 451 | break; | 451 | break; |
| 452 | case 3: strcpy(cinfo->cardname,"PCMCIA B"); break; | 452 | case 3: strcpy(cinfo->cardname, "PCMCIA B"); break; |
| 453 | case 4: strcpy(cinfo->cardname,"PCMCIA M1"); break; | 453 | case 4: strcpy(cinfo->cardname, "PCMCIA M1"); break; |
| 454 | case 5: strcpy(cinfo->cardname,"PCMCIA M2"); break; | 454 | case 5: strcpy(cinfo->cardname, "PCMCIA M2"); break; |
| 455 | case 6: strcpy(cinfo->cardname,"B1 V3.0"); break; | 455 | case 6: strcpy(cinfo->cardname, "B1 V3.0"); break; |
| 456 | case 7: strcpy(cinfo->cardname,"B1 PCI"); break; | 456 | case 7: strcpy(cinfo->cardname, "B1 PCI"); break; |
| 457 | default: sprintf(cinfo->cardname, "AVM?%u", (unsigned int)flag); break; | 457 | default: sprintf(cinfo->cardname, "AVM?%u", (unsigned int)flag); break; |
| 458 | } | 458 | } |
| 459 | printk(KERN_NOTICE "%s: card %d \"%s\" ready.\n", | 459 | printk(KERN_NOTICE "%s: card %d \"%s\" ready.\n", |
| 460 | card->name, ctrl->cnr, cinfo->cardname); | 460 | card->name, ctrl->cnr, cinfo->cardname); |
| 461 | 461 | ||
| 462 | flag = ((u8 *)(profp->manu))[3]; | 462 | flag = ((u8 *)(profp->manu))[3]; |
| 463 | if (flag) | 463 | if (flag) |
| 464 | printk(KERN_NOTICE "%s: card %d Protocol:%s%s%s%s%s%s%s\n", | 464 | printk(KERN_NOTICE "%s: card %d Protocol:%s%s%s%s%s%s%s\n", |
| 465 | card->name, | 465 | card->name, |
| 466 | ctrl->cnr, | 466 | ctrl->cnr, |
| 467 | (flag & 0x01) ? " DSS1" : "", | 467 | (flag & 0x01) ? " DSS1" : "", |
| 468 | (flag & 0x02) ? " CT1" : "", | 468 | (flag & 0x02) ? " CT1" : "", |
| 469 | (flag & 0x04) ? " VN3" : "", | 469 | (flag & 0x04) ? " VN3" : "", |
| 470 | (flag & 0x08) ? " NI1" : "", | 470 | (flag & 0x08) ? " NI1" : "", |
| 471 | (flag & 0x10) ? " AUSTEL" : "", | 471 | (flag & 0x10) ? " AUSTEL" : "", |
| 472 | (flag & 0x20) ? " ESS" : "", | 472 | (flag & 0x20) ? " ESS" : "", |
| 473 | (flag & 0x40) ? " 1TR6" : "" | 473 | (flag & 0x40) ? " 1TR6" : "" |
| 474 | ); | 474 | ); |
| 475 | 475 | ||
| 476 | flag = ((u8 *)(profp->manu))[5]; | 476 | flag = ((u8 *)(profp->manu))[5]; |
| 477 | if (flag) | 477 | if (flag) |
| 478 | printk(KERN_NOTICE "%s: card %d Linetype:%s%s%s%s\n", | 478 | printk(KERN_NOTICE "%s: card %d Linetype:%s%s%s%s\n", |
| 479 | card->name, | 479 | card->name, |
| 480 | ctrl->cnr, | 480 | ctrl->cnr, |
| 481 | (flag & 0x01) ? " point to point" : "", | 481 | (flag & 0x01) ? " point to point" : "", |
| 482 | (flag & 0x02) ? " point to multipoint" : "", | 482 | (flag & 0x02) ? " point to multipoint" : "", |
| 483 | (flag & 0x08) ? " leased line without D-channel" : "", | 483 | (flag & 0x08) ? " leased line without D-channel" : "", |
| 484 | (flag & 0x04) ? " leased line with D-channel" : "" | 484 | (flag & 0x04) ? " leased line with D-channel" : "" |
| 485 | ); | 485 | ); |
| 486 | } | 486 | } |
| 487 | 487 | ||
| @@ -521,13 +521,13 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) · 33 unmodified lines | |||
| 521 | spin_unlock_irqrestore(&card->lock, flags); | 521 | spin_unlock_irqrestore(&card->lock, flags); |
| 522 | 522 | ||
| 523 | if (MsgLen < 30) { /* not CAPI 64Bit */ | 523 | if (MsgLen < 30) { /* not CAPI 64Bit */ |
| 524 | memset(card->msgbuf+MsgLen, 0, 30-MsgLen); | 524 | memset(card->msgbuf + MsgLen, 0, 30-MsgLen); |
| 525 | MsgLen = 30; | 525 | MsgLen = 30; |
| 526 | CAPIMSG_SETLEN(card->msgbuf, 30); | 526 | CAPIMSG_SETLEN(card->msgbuf, 30); |
| 527 | } | 527 | } |
| 528 | if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { | 528 | if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { |
| 529 | printk(KERN_ERR "%s: incoming packet dropped\n", | 529 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 530 | card->name); | 530 | card->name); |
| 531 | } else { | 531 | } else { |
| 532 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 532 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| 533 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); | 533 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); |
| @@ -541,7 +541,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) · 7 unmodified lines | |||
| 541 | MsgLen = b1_get_slice(card->port, card->msgbuf); | 541 | MsgLen = b1_get_slice(card->port, card->msgbuf); |
| 542 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { | 542 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { |
| 543 | printk(KERN_ERR "%s: incoming packet dropped\n", | 543 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 544 | card->name); | 544 | card->name); |
| 545 | spin_unlock_irqrestore(&card->lock, flags); | 545 | spin_unlock_irqrestore(&card->lock, flags); |
| 546 | } else { | 546 | } else { |
| 547 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 547 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| @@ -573,7 +573,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) · 25 unmodified lines | |||
| 573 | break; | 573 | break; |
| 574 | 574 | ||
| 575 | case RECEIVE_START: | 575 | case RECEIVE_START: |
| 576 | /* b1_put_byte(card->port, SEND_POLLACK); */ | 576 | /* b1_put_byte(card->port, SEND_POLLACK); */ |
| 577 | spin_unlock_irqrestore(&card->lock, flags); | 577 | spin_unlock_irqrestore(&card->lock, flags); |
| 578 | capi_ctr_resume_output(ctrl); | 578 | capi_ctr_resume_output(ctrl); |
| 579 | break; | 579 | break; |
| @@ -600,24 +600,24 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) · 20 unmodified lines | |||
| 600 | MsgLen = b1_get_slice(card->port, card->msgbuf); | 600 | MsgLen = b1_get_slice(card->port, card->msgbuf); |
| 601 | spin_unlock_irqrestore(&card->lock, flags); | 601 | spin_unlock_irqrestore(&card->lock, flags); |
| 602 | card->msgbuf[MsgLen] = 0; | 602 | card->msgbuf[MsgLen] = 0; |
| 603 | while ( MsgLen > 0 | 603 | while (MsgLen > 0 |
| 604 | && ( card->msgbuf[MsgLen-1] == '\n' | 604 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 605 | || card->msgbuf[MsgLen-1] == '\r')) { | 605 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 606 | card->msgbuf[MsgLen-1] = 0; | 606 | card->msgbuf[MsgLen - 1] = 0; |
| 607 | MsgLen--; | 607 | MsgLen--; |
| 608 | } | 608 | } |
| 609 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", | 609 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", |
| 610 | card->name, ApplId, card->msgbuf); | 610 | card->name, ApplId, card->msgbuf); |
| 611 | break; | 611 | break; |
| 612 | 612 | ||
| 613 | case RECEIVE_DEBUGMSG: | 613 | case RECEIVE_DEBUGMSG: |
| 614 | MsgLen = b1_get_slice(card->port, card->msgbuf); | 614 | MsgLen = b1_get_slice(card->port, card->msgbuf); |
| 615 | spin_unlock_irqrestore(&card->lock, flags); | 615 | spin_unlock_irqrestore(&card->lock, flags); |
| 616 | card->msgbuf[MsgLen] = 0; | 616 | card->msgbuf[MsgLen] = 0; |
| 617 | while ( MsgLen > 0 | 617 | while (MsgLen > 0 |
| 618 | && ( card->msgbuf[MsgLen-1] == '\n' | 618 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 619 | || card->msgbuf[MsgLen-1] == '\r')) { | 619 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 620 | card->msgbuf[MsgLen-1] = 0; | 620 | card->msgbuf[MsgLen - 1] = 0; |
| 621 | MsgLen--; | 621 | MsgLen--; |
| 622 | } | 622 | } |
| 623 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); | 623 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); |
| @@ -630,7 +630,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) · 6 unmodified lines | |||
| 630 | default: | 630 | default: |
| 631 | spin_unlock_irqrestore(&card->lock, flags); | 631 | spin_unlock_irqrestore(&card->lock, flags); |
| 632 | printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", | 632 | printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", |
| 633 | card->name, b1cmd); | 633 | card->name, b1cmd); |
| 634 | return IRQ_HANDLED; | 634 | return IRQ_HANDLED; |
| 635 | } | 635 | } |
| 636 | return IRQ_HANDLED; | 636 | return IRQ_HANDLED; |
| @@ -671,29 +671,29 @@ static int b1ctl_proc_show(struct seq_file *m, void *v) · 34 unmodified lines | |||
| 671 | seq_printf(m, "%-16s %s\n", "ver_serial", s); | 671 | seq_printf(m, "%-16s %s\n", "ver_serial", s); |
| 672 | 672 | ||
| 673 | if (card->cardtype != avm_m1) { | 673 | if (card->cardtype != avm_m1) { |
| 674 | flag = ((u8 *)(ctrl->profile.manu))[3]; | 674 | flag = ((u8 *)(ctrl->profile.manu))[3]; |
| 675 | if (flag) | 675 | if (flag) |
| 676 | seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", | 676 | seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", |
| 677 | "protocol", | 677 | "protocol", |
| 678 | (flag & 0x01) ? " DSS1" : "", | 678 | (flag & 0x01) ? " DSS1" : "", |
| 679 | (flag & 0x02) ? " CT1" : "", | 679 | (flag & 0x02) ? " CT1" : "", |
| 680 | (flag & 0x04) ? " VN3" : "", | 680 | (flag & 0x04) ? " VN3" : "", |
| 681 | (flag & 0x08) ? " NI1" : "", | 681 | (flag & 0x08) ? " NI1" : "", |
| 682 | (flag & 0x10) ? " AUSTEL" : "", | 682 | (flag & 0x10) ? " AUSTEL" : "", |
| 683 | (flag & 0x20) ? " ESS" : "", | 683 | (flag & 0x20) ? " ESS" : "", |
| 684 | (flag & 0x40) ? " 1TR6" : "" | 684 | (flag & 0x40) ? " 1TR6" : "" |
| 685 | ); | 685 | ); |
| 686 | } | 686 | } |
| 687 | if (card->cardtype != avm_m1) { | 687 | if (card->cardtype != avm_m1) { |
| 688 | flag = ((u8 *)(ctrl->profile.manu))[5]; | 688 | flag = ((u8 *)(ctrl->profile.manu))[5]; |
| 689 | if (flag) | 689 | if (flag) |
| 690 | seq_printf(m, "%-16s%s%s%s%s\n", | 690 | seq_printf(m, "%-16s%s%s%s%s\n", |
| 691 | "linetype", | 691 | "linetype", |
| 692 | (flag & 0x01) ? " point to point" : "", | 692 | (flag & 0x01) ? " point to point" : "", |
| 693 | (flag & 0x02) ? " point to multipoint" : "", | 693 | (flag & 0x02) ? " point to multipoint" : "", |
| 694 | (flag & 0x08) ? " leased line without D-channel" : "", | 694 | (flag & 0x08) ? " leased line without D-channel" : "", |
| 695 | (flag & 0x04) ? " leased line with D-channel" : "" | 695 | (flag & 0x04) ? " leased line with D-channel" : "" |
| 696 | ); | 696 | ); |
| 697 | } | 697 | } |
| 698 | seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); | 698 | seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); |
| 699 | 699 | ||
| @@ -750,12 +750,12 @@ avmcard_dma_alloc(char *name, struct pci_dev *pdev, long rsize, long ssize) · 50 unmodified lines | |||
| 750 | 750 | ||
| 751 | return p; | 751 | return p; |
| 752 | 752 | ||
| 753 | err_free_consistent: | 753 | err_free_consistent: |
| 754 | pci_free_consistent(p->pcidev, p->recvbuf.size, | 754 | pci_free_consistent(p->pcidev, p->recvbuf.size, |
| 755 | p->recvbuf.dmabuf, p->recvbuf.dmaaddr); | 755 | p->recvbuf.dmabuf, p->recvbuf.dmaaddr); |
| 756 | err_kfree: | 756 | err_kfree: |
| 757 | kfree(p); | 757 | kfree(p); |
| 758 | err: | 758 | err: |
| 759 | return NULL; | 759 | return NULL; |
| 760 | } | 760 | } |
| 761 | 761 | ||
| @@ -800,7 +800,7 @@ static int __init b1_init(void) · 38 unmodified lines | |||
| 800 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 800 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 801 | strlcpy(rev, p + 2, 32); | 801 | strlcpy(rev, p + 2, 32); |
| 802 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 802 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 803 | *(p-1) = 0; | 803 | *(p - 1) = 0; |
| 804 | } else | 804 | } else |
| 805 | strcpy(rev, "1.0"); | 805 | strcpy(rev, "1.0"); |
| 806 | 806 | ||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* $Id: b1dma.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ | 1 | /* $Id: b1dma.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Common module for AVM B1 cards that support dma with AMCC | 3 | * Common module for AVM B1 cards that support dma with AMCC |
| 4 | * | 4 | * |
| 5 | * Copyright 2000 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 2000 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -110,11 +110,11 @@ static int b1dma_tolink(avmcard *card, void *buf, unsigned int len) · 100 unmodified lines | |||
| 110 | unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */ | 110 | unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */ |
| 111 | unsigned char *s = (unsigned char *)buf; | 111 | unsigned char *s = (unsigned char *)buf; |
| 112 | while (len--) { | 112 | while (len--) { |
| 113 | while ( !b1dma_tx_empty(card->port) | 113 | while (!b1dma_tx_empty(card->port) |
| 114 | && time_before(jiffies, stop)); | 114 | && time_before(jiffies, stop)); |
| 115 | if (!b1dma_tx_empty(card->port)) | 115 | if (!b1dma_tx_empty(card->port)) |
| 116 | return -1; | 116 | return -1; |
| 117 | t1outp(card->port, 0x01, *s++); | 117 | t1outp(card->port, 0x01, *s++); |
| 118 | } | 118 | } |
| 119 | return 0; | 119 | return 0; |
| 120 | } | 120 | } |
| @@ -124,11 +124,11 @@ static int b1dma_fromlink(avmcard *card, void *buf, unsigned int len) · 3 unmodified lines | |||
| 124 | unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */ | 124 | unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */ |
| 125 | unsigned char *s = (unsigned char *)buf; | 125 | unsigned char *s = (unsigned char *)buf; |
| 126 | while (len--) { | 126 | while (len--) { |
| 127 | while ( !b1dma_rx_full(card->port) | 127 | while (!b1dma_rx_full(card->port) |
| 128 | && time_before(jiffies, stop)); | 128 | && time_before(jiffies, stop)); |
| 129 | if (!b1dma_rx_full(card->port)) | 129 | if (!b1dma_rx_full(card->port)) |
| 130 | return -1; | 130 | return -1; |
| 131 | *s++ = t1inp(card->port, 0x00); | 131 | *s++ = t1inp(card->port, 0x00); |
| 132 | } | 132 | } |
| 133 | return 0; | 133 | return 0; |
| 134 | } | 134 | } |
| @@ -136,7 +136,7 @@ static int b1dma_fromlink(avmcard *card, void *buf, unsigned int len) · 1 unmodified line | |||
| 136 | static int WriteReg(avmcard *card, u32 reg, u8 val) | 136 | static int WriteReg(avmcard *card, u32 reg, u8 val) |
| 137 | { | 137 | { |
| 138 | u8 cmd = 0x00; | 138 | u8 cmd = 0x00; |
| 139 | if ( b1dma_tolink(card, &cmd, 1) == 0 | 139 | if (b1dma_tolink(card, &cmd, 1) == 0 |
| 140 | && b1dma_tolink(card, ®, 4) == 0) { | 140 | && b1dma_tolink(card, ®, 4) == 0) { |
| 141 | u32 tmp = val; | 141 | u32 tmp = val; |
| 142 | return b1dma_tolink(card, &tmp, 4); | 142 | return b1dma_tolink(card, &tmp, 4); |
| @@ -147,7 +147,7 @@ static int WriteReg(avmcard *card, u32 reg, u8 val) · 4 unmodified lines | |||
| 147 | static u8 ReadReg(avmcard *card, u32 reg) | 147 | static u8 ReadReg(avmcard *card, u32 reg) |
| 148 | { | 148 | { |
| 149 | u8 cmd = 0x01; | 149 | u8 cmd = 0x01; |
| 150 | if ( b1dma_tolink(card, &cmd, 1) == 0 | 150 | if (b1dma_tolink(card, &cmd, 1) == 0 |
| 151 | && b1dma_tolink(card, ®, 4) == 0) { | 151 | && b1dma_tolink(card, ®, 4) == 0) { |
| 152 | u32 tmp; | 152 | u32 tmp; |
| 153 | if (b1dma_fromlink(card, &tmp, 4) == 0) | 153 | if (b1dma_fromlink(card, &tmp, 4) == 0) |
| @@ -258,30 +258,30 @@ static int b1dma_detect(avmcard *card) · 104 unmodified lines | |||
| 258 | 258 | ||
| 259 | b1dma_writel(card, 0xffffffff, AMCC_RXPTR); | 259 | b1dma_writel(card, 0xffffffff, AMCC_RXPTR); |
| 260 | b1dma_writel(card, 0xffffffff, AMCC_TXPTR); | 260 | b1dma_writel(card, 0xffffffff, AMCC_TXPTR); |
| 261 | if ( b1dma_readl(card, AMCC_RXPTR) != 0xfffffffc | 261 | if (b1dma_readl(card, AMCC_RXPTR) != 0xfffffffc |
| 262 | || b1dma_readl(card, AMCC_TXPTR) != 0xfffffffc) | 262 | || b1dma_readl(card, AMCC_TXPTR) != 0xfffffffc) |
| 263 | return 2; | 263 | return 2; |
| 264 | 264 | ||
| 265 | b1dma_writel(card, 0x0, AMCC_RXPTR); | 265 | b1dma_writel(card, 0x0, AMCC_RXPTR); |
| 266 | b1dma_writel(card, 0x0, AMCC_TXPTR); | 266 | b1dma_writel(card, 0x0, AMCC_TXPTR); |
| 267 | if ( b1dma_readl(card, AMCC_RXPTR) != 0x0 | 267 | if (b1dma_readl(card, AMCC_RXPTR) != 0x0 |
| 268 | || b1dma_readl(card, AMCC_TXPTR) != 0x0) | 268 | || b1dma_readl(card, AMCC_TXPTR) != 0x0) |
| 269 | return 3; | 269 | return 3; |
| 270 | 270 | ||
| 271 | t1outp(card->port, 0x10, 0x00); | 271 | t1outp(card->port, 0x10, 0x00); |
| 272 | t1outp(card->port, 0x07, 0x00); | 272 | t1outp(card->port, 0x07, 0x00); |
| 273 | 273 | ||
| 274 | t1outp(card->port, 0x02, 0x02); | 274 | t1outp(card->port, 0x02, 0x02); |
| 275 | t1outp(card->port, 0x03, 0x02); | 275 | t1outp(card->port, 0x03, 0x02); |
| 276 | 276 | ||
| 277 | if ( (t1inp(card->port, 0x02) & 0xFE) != 0x02 | 277 | if ((t1inp(card->port, 0x02) & 0xFE) != 0x02 |
| 278 | || t1inp(card->port, 0x3) != 0x03) | 278 | || t1inp(card->port, 0x3) != 0x03) |
| 279 | return 4; | 279 | return 4; |
| 280 | 280 | ||
| 281 | t1outp(card->port, 0x02, 0x00); | 281 | t1outp(card->port, 0x02, 0x00); |
| 282 | t1outp(card->port, 0x03, 0x00); | 282 | t1outp(card->port, 0x03, 0x00); |
| 283 | 283 | ||
| 284 | if ( (t1inp(card->port, 0x02) & 0xFE) != 0x00 | 284 | if ((t1inp(card->port, 0x02) & 0xFE) != 0x00 |
| 285 | || t1inp(card->port, 0x3) != 0x01) | 285 | || t1inp(card->port, 0x3) != 0x01) |
| 286 | return 5; | 286 | return 5; |
| 287 | 287 | ||
| @@ -294,28 +294,28 @@ int t1pci_detect(avmcard *card) · 6 unmodified lines | |||
| 294 | 294 | ||
| 295 | if ((ret = b1dma_detect(card)) != 0) | 295 | if ((ret = b1dma_detect(card)) != 0) |
| 296 | return ret; | 296 | return ret; |
| 297 | 297 | ||
| 298 | /* Transputer test */ | 298 | /* Transputer test */ |
| 299 | 299 | ||
| 300 | if ( WriteReg(card, 0x80001000, 0x11) != 0 | 300 | if (WriteReg(card, 0x80001000, 0x11) != 0 |
| 301 | || WriteReg(card, 0x80101000, 0x22) != 0 | 301 | || WriteReg(card, 0x80101000, 0x22) != 0 |
| 302 | || WriteReg(card, 0x80201000, 0x33) != 0 | 302 | || WriteReg(card, 0x80201000, 0x33) != 0 |
| 303 | || WriteReg(card, 0x80301000, 0x44) != 0) | 303 | || WriteReg(card, 0x80301000, 0x44) != 0) |
| 304 | return 6; | 304 | return 6; |
| 305 | 305 | ||
| 306 | if ( ReadReg(card, 0x80001000) != 0x11 | 306 | if (ReadReg(card, 0x80001000) != 0x11 |
| 307 | || ReadReg(card, 0x80101000) != 0x22 | 307 | || ReadReg(card, 0x80101000) != 0x22 |
| 308 | || ReadReg(card, 0x80201000) != 0x33 | 308 | || ReadReg(card, 0x80201000) != 0x33 |
| 309 | || ReadReg(card, 0x80301000) != 0x44) | 309 | || ReadReg(card, 0x80301000) != 0x44) |
| 310 | return 7; | 310 | return 7; |
| 311 | 311 | ||
| 312 | if ( WriteReg(card, 0x80001000, 0x55) != 0 | 312 | if (WriteReg(card, 0x80001000, 0x55) != 0 |
| 313 | || WriteReg(card, 0x80101000, 0x66) != 0 | 313 | || WriteReg(card, 0x80101000, 0x66) != 0 |
| 314 | || WriteReg(card, 0x80201000, 0x77) != 0 | 314 | || WriteReg(card, 0x80201000, 0x77) != 0 |
| 315 | || WriteReg(card, 0x80301000, 0x88) != 0) | 315 | || WriteReg(card, 0x80301000, 0x88) != 0) |
| 316 | return 8; | 316 | return 8; |
| 317 | 317 | ||
| 318 | if ( ReadReg(card, 0x80001000) != 0x55 | 318 | if (ReadReg(card, 0x80001000) != 0x55 |
| 319 | || ReadReg(card, 0x80101000) != 0x66 | 319 | || ReadReg(card, 0x80101000) != 0x66 |
| 320 | || ReadReg(card, 0x80201000) != 0x77 | 320 | || ReadReg(card, 0x80201000) != 0x77 |
| 321 | || ReadReg(card, 0x80301000) != 0x88) | 321 | || ReadReg(card, 0x80301000) != 0x88) |
| @@ -330,20 +330,20 @@ int b1pciv4_detect(avmcard *card) · 8 unmodified lines | |||
| 330 | 330 | ||
| 331 | if ((ret = b1dma_detect(card)) != 0) | 331 | if ((ret = b1dma_detect(card)) != 0) |
| 332 | return ret; | 332 | return ret; |
| 333 | 333 | ||
| 334 | for (i=0; i < 5 ; i++) { | 334 | for (i = 0; i < 5; i++) { |
| 335 | if (WriteReg(card, 0x80A00000, 0x21) != 0) | 335 | if (WriteReg(card, 0x80A00000, 0x21) != 0) |
| 336 | return 6; | 336 | return 6; |
| 337 | if ((ReadReg(card, 0x80A00000) & 0x01) != 0x01) | 337 | if ((ReadReg(card, 0x80A00000) & 0x01) != 0x01) |
| 338 | return 7; | 338 | return 7; |
| 339 | } | 339 | } |
| 340 | for (i=0; i < 5 ; i++) { | 340 | for (i = 0; i < 5; i++) { |
| 341 | if (WriteReg(card, 0x80A00000, 0x20) != 0) | 341 | if (WriteReg(card, 0x80A00000, 0x20) != 0) |
| 342 | return 8; | 342 | return 8; |
| 343 | if ((ReadReg(card, 0x80A00000) & 0x01) != 0x00) | 343 | if ((ReadReg(card, 0x80A00000) & 0x01) != 0x00) |
| 344 | return 9; | 344 | return 9; |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | return 0; | 347 | return 0; |
| 348 | } | 348 | } |
| 349 | 349 | ||
| @@ -373,7 +373,7 @@ static void b1dma_dispatch_tx(avmcard *card) · 23 unmodified lines | |||
| 373 | u16 len; | 373 | u16 len; |
| 374 | u32 txlen; | 374 | u32 txlen; |
| 375 | void *p; | 375 | void *p; |
| 376 | 376 | ||
| 377 | skb = skb_dequeue(&dma->send_queue); | 377 | skb = skb_dequeue(&dma->send_queue); |
| 378 | 378 | ||
| 379 | len = CAPIMSG_LEN(skb->data); | 379 | len = CAPIMSG_LEN(skb->data); |
| @@ -398,13 +398,13 @@ static void b1dma_dispatch_tx(avmcard *card) · 18 unmodified lines | |||
| 398 | printk(KERN_DEBUG "tx: put msg len=%d\n", txlen); | 398 | printk(KERN_DEBUG "tx: put msg len=%d\n", txlen); |
| 399 | #endif | 399 | #endif |
| 400 | } else { | 400 | } else { |
| 401 | txlen = skb->len-2; | 401 | txlen = skb->len - 2; |
| 402 | #ifdef AVM_B1DMA_POLLDEBUG | 402 | #ifdef AVM_B1DMA_POLLDEBUG |
| 403 | if (skb->data[2] == SEND_POLLACK) | 403 | if (skb->data[2] == SEND_POLLACK) |
| 404 | printk(KERN_INFO "%s: send ack\n", card->name); | 404 | printk(KERN_INFO "%s: send ack\n", card->name); |
| 405 | #endif | 405 | #endif |
| 406 | #ifdef AVM_B1DMA_DEBUG | 406 | #ifdef AVM_B1DMA_DEBUG |
| 407 | printk(KERN_DEBUG "tx: put 0x%x len=%d\n", | 407 | printk(KERN_DEBUG "tx: put 0x%x len=%d\n", |
| 408 | skb->data[2], txlen); | 408 | skb->data[2], txlen); |
| 409 | #endif | 409 | #endif |
| 410 | skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, | 410 | skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, |
| @@ -430,7 +430,7 @@ static void queue_pollack(avmcard *card) · 19 unmodified lines | |||
| 430 | skb = alloc_skb(3, GFP_ATOMIC); | 430 | skb = alloc_skb(3, GFP_ATOMIC); |
| 431 | if (!skb) { | 431 | if (!skb) { |
| 432 | printk(KERN_CRIT "%s: no memory, lost poll ack\n", | 432 | printk(KERN_CRIT "%s: no memory, lost poll ack\n", |
| 433 | card->name); | 433 | card->name); |
| 434 | return; | 434 | return; |
| 435 | } | 435 | } |
| 436 | p = skb->data; | 436 | p = skb->data; |
| @@ -450,14 +450,14 @@ static void b1dma_handle_rx(avmcard *card) · 13 unmodified lines | |||
| 450 | avmcard_dmainfo *dma = card->dma; | 450 | avmcard_dmainfo *dma = card->dma; |
| 451 | struct capi_ctr *ctrl = &cinfo->capi_ctrl; | 451 | struct capi_ctr *ctrl = &cinfo->capi_ctrl; |
| 452 | struct sk_buff *skb; | 452 | struct sk_buff *skb; |
| 453 | void *p = dma->recvbuf.dmabuf+4; | 453 | void *p = dma->recvbuf.dmabuf + 4; |
| 454 | u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize; | 454 | u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize; |
| 455 | u8 b1cmd = _get_byte(&p); | 455 | u8 b1cmd = _get_byte(&p); |
| 456 | 456 | ||
| 457 | #ifdef AVM_B1DMA_DEBUG | 457 | #ifdef AVM_B1DMA_DEBUG |
| 458 | printk(KERN_DEBUG "rx: 0x%x %lu\n", b1cmd, (unsigned long)dma->recvlen); | 458 | printk(KERN_DEBUG "rx: 0x%x %lu\n", b1cmd, (unsigned long)dma->recvlen); |
| 459 | #endif | 459 | #endif |
| 460 | 460 | ||
| 461 | switch (b1cmd) { | 461 | switch (b1cmd) { |
| 462 | case RECEIVE_DATA_B3_IND: | 462 | case RECEIVE_DATA_B3_IND: |
| 463 | 463 | ||
| @@ -466,13 +466,13 @@ static void b1dma_handle_rx(avmcard *card) · 2 unmodified lines | |||
| 466 | DataB3Len = _get_slice(&p, card->databuf); | 466 | DataB3Len = _get_slice(&p, card->databuf); |
| 467 | 467 | ||
| 468 | if (MsgLen < 30) { /* not CAPI 64Bit */ | 468 | if (MsgLen < 30) { /* not CAPI 64Bit */ |
| 469 | memset(card->msgbuf+MsgLen, 0, 30-MsgLen); | 469 | memset(card->msgbuf + MsgLen, 0, 30 - MsgLen); |
| 470 | MsgLen = 30; | 470 | MsgLen = 30; |
| 471 | CAPIMSG_SETLEN(card->msgbuf, 30); | 471 | CAPIMSG_SETLEN(card->msgbuf, 30); |
| 472 | } | 472 | } |
| 473 | if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) { | 473 | if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { |
| 474 | printk(KERN_ERR "%s: incoming packet dropped\n", | 474 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 475 | card->name); | 475 | card->name); |
| 476 | } else { | 476 | } else { |
| 477 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 477 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| 478 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); | 478 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); |
| @@ -486,14 +486,14 @@ static void b1dma_handle_rx(avmcard *card) · 7 unmodified lines | |||
| 486 | MsgLen = _get_slice(&p, card->msgbuf); | 486 | MsgLen = _get_slice(&p, card->msgbuf); |
| 487 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { | 487 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { |
| 488 | printk(KERN_ERR "%s: incoming packet dropped\n", | 488 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 489 | card->name); | 489 | card->name); |
| 490 | } else { | 490 | } else { |
| 491 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 491 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| 492 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) { | 492 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) { |
| 493 | spin_lock(&card->lock); | 493 | spin_lock(&card->lock); |
| 494 | capilib_data_b3_conf(&cinfo->ncci_head, ApplId, | 494 | capilib_data_b3_conf(&cinfo->ncci_head, ApplId, |
| 495 | CAPIMSG_NCCI(skb->data), | 495 | CAPIMSG_NCCI(skb->data), |
| 496 | CAPIMSG_MSGID(skb->data)); | 496 | CAPIMSG_MSGID(skb->data)); |
| 497 | spin_unlock(&card->lock); | 497 | spin_unlock(&card->lock); |
| 498 | } | 498 | } |
| 499 | capi_ctr_handle_message(ctrl, ApplId, skb); | 499 | capi_ctr_handle_message(ctrl, ApplId, skb); |
| @@ -550,23 +550,23 @@ static void b1dma_handle_rx(avmcard *card) · 50 unmodified lines | |||
| 550 | ApplId = (unsigned) _get_word(&p); | 550 | ApplId = (unsigned) _get_word(&p); |
| 551 | MsgLen = _get_slice(&p, card->msgbuf); | 551 | MsgLen = _get_slice(&p, card->msgbuf); |
| 552 | card->msgbuf[MsgLen] = 0; | 552 | card->msgbuf[MsgLen] = 0; |
| 553 | while ( MsgLen > 0 | 553 | while (MsgLen > 0 |
| 554 | && ( card->msgbuf[MsgLen-1] == '\n' | 554 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 555 | || card->msgbuf[MsgLen-1] == '\r')) { | 555 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 556 | card->msgbuf[MsgLen-1] = 0; | 556 | card->msgbuf[MsgLen - 1] = 0; |
| 557 | MsgLen--; | 557 | MsgLen--; |
| 558 | } | 558 | } |
| 559 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", | 559 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", |
| 560 | card->name, ApplId, card->msgbuf); | 560 | card->name, ApplId, card->msgbuf); |
| 561 | break; | 561 | break; |
| 562 | 562 | ||
| 563 | case RECEIVE_DEBUGMSG: | 563 | case RECEIVE_DEBUGMSG: |
| 564 | MsgLen = _get_slice(&p, card->msgbuf); | 564 | MsgLen = _get_slice(&p, card->msgbuf); |
| 565 | card->msgbuf[MsgLen] = 0; | 565 | card->msgbuf[MsgLen] = 0; |
| 566 | while ( MsgLen > 0 | 566 | while (MsgLen > 0 |
| 567 | && ( card->msgbuf[MsgLen-1] == '\n' | 567 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 568 | || card->msgbuf[MsgLen-1] == '\r')) { | 568 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 569 | card->msgbuf[MsgLen-1] = 0; | 569 | card->msgbuf[MsgLen - 1] = 0; |
| 570 | MsgLen--; | 570 | MsgLen--; |
| 571 | } | 571 | } |
| 572 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); | 572 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); |
| @@ -574,7 +574,7 @@ static void b1dma_handle_rx(avmcard *card) · 1 unmodified line | |||
| 574 | 574 | ||
| 575 | default: | 575 | default: |
| 576 | printk(KERN_ERR "%s: b1dma_interrupt: 0x%x ???\n", | 576 | printk(KERN_ERR "%s: b1dma_interrupt: 0x%x ???\n", |
| 577 | card->name, b1cmd); | 577 | card->name, b1cmd); |
| 578 | return; | 578 | return; |
| 579 | } | 579 | } |
| 580 | } | 580 | } |
| @@ -594,7 +594,7 @@ static void b1dma_handle_interrupt(avmcard *card) · 13 unmodified lines | |||
| 594 | return; | 594 | return; |
| 595 | } | 595 | } |
| 596 | 596 | ||
| 597 | newcsr = card->csr | (status & ALL_INT); | 597 | newcsr = card->csr | (status & ALL_INT); |
| 598 | if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT; | 598 | if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT; |
| 599 | if (status & RX_TC_INT) newcsr &= ~EN_RX_TC_INT; | 599 | if (status & RX_TC_INT) newcsr &= ~EN_RX_TC_INT; |
| 600 | b1dma_writel(card, newcsr, AMCC_INTCSR); | 600 | b1dma_writel(card, newcsr, AMCC_INTCSR); |
| @@ -602,23 +602,23 @@ static void b1dma_handle_interrupt(avmcard *card) · 1 unmodified line | |||
| 602 | if ((status & RX_TC_INT) != 0) { | 602 | if ((status & RX_TC_INT) != 0) { |
| 603 | struct avmcard_dmainfo *dma = card->dma; | 603 | struct avmcard_dmainfo *dma = card->dma; |
| 604 | u32 rxlen; | 604 | u32 rxlen; |
| 605 | if (card->dma->recvlen == 0) { | 605 | if (card->dma->recvlen == 0) { |
| 606 | rxlen = b1dma_readl(card, AMCC_RXLEN); | 606 | rxlen = b1dma_readl(card, AMCC_RXLEN); |
| 607 | if (rxlen == 0) { | 607 | if (rxlen == 0) { |
| 608 | dma->recvlen = *((u32 *)dma->recvbuf.dmabuf); | 608 | dma->recvlen = *((u32 *)dma->recvbuf.dmabuf); |
| 609 | rxlen = (dma->recvlen + 3) & ~3; | 609 | rxlen = (dma->recvlen + 3) & ~3; |
| 610 | b1dma_writel(card, dma->recvbuf.dmaaddr+4, AMCC_RXPTR); | 610 | b1dma_writel(card, dma->recvbuf.dmaaddr + 4, AMCC_RXPTR); |
| 611 | b1dma_writel(card, rxlen, AMCC_RXLEN); | 611 | b1dma_writel(card, rxlen, AMCC_RXLEN); |
| 612 | #ifdef AVM_B1DMA_DEBUG | 612 | #ifdef AVM_B1DMA_DEBUG |
| 613 | } else { | 613 | } else { |
| 614 | printk(KERN_ERR "%s: rx not complete (%d).\n", | 614 | printk(KERN_ERR "%s: rx not complete (%d).\n", |
| 615 | card->name, rxlen); | 615 | card->name, rxlen); |
| 616 | #endif | 616 | #endif |
| 617 | } | 617 | } |
| 618 | } else { | 618 | } else { |
| 619 | spin_unlock(&card->lock); | 619 | spin_unlock(&card->lock); |
| 620 | b1dma_handle_rx(card); | 620 | b1dma_handle_rx(card); |
| 621 | dma->recvlen = 0; | 621 | dma->recvlen = 0; |
| 622 | spin_lock(&card->lock); | 622 | spin_lock(&card->lock); |
| 623 | b1dma_writel(card, dma->recvbuf.dmaaddr, AMCC_RXPTR); | 623 | b1dma_writel(card, dma->recvbuf.dmaaddr, AMCC_RXPTR); |
| 624 | b1dma_writel(card, 4, AMCC_RXLEN); | 624 | b1dma_writel(card, 4, AMCC_RXLEN); |
| @@ -659,7 +659,7 @@ static int b1dma_loaded(avmcard *card) · 34 unmodified lines | |||
| 659 | } | 659 | } |
| 660 | if (!b1_tx_empty(base)) { | 660 | if (!b1_tx_empty(base)) { |
| 661 | printk(KERN_ERR "%s: b1dma_loaded: tx err, corrupted t4 file ?\n", | 661 | printk(KERN_ERR "%s: b1dma_loaded: tx err, corrupted t4 file ?\n", |
| 662 | card->name); | 662 | card->name); |
| 663 | return 0; | 663 | return 0; |
| 664 | } | 664 | } |
| 665 | b1_put_byte(base, SEND_POLLACK); | 665 | b1_put_byte(base, SEND_POLLACK); |
| @@ -686,7 +686,7 @@ static void b1dma_send_init(avmcard *card) · 20 unmodified lines | |||
| 686 | skb = alloc_skb(15, GFP_ATOMIC); | 686 | skb = alloc_skb(15, GFP_ATOMIC); |
| 687 | if (!skb) { | 687 | if (!skb) { |
| 688 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", | 688 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", |
| 689 | card->name); | 689 | card->name); |
| 690 | return; | 690 | return; |
| 691 | } | 691 | } |
| 692 | p = skb->data; | 692 | p = skb->data; |
| @@ -694,7 +694,7 @@ static void b1dma_send_init(avmcard *card) · 1 unmodified line | |||
| 694 | _put_byte(&p, 0); | 694 | _put_byte(&p, 0); |
| 695 | _put_byte(&p, SEND_INIT); | 695 | _put_byte(&p, SEND_INIT); |
| 696 | _put_word(&p, CAPI_MAXAPPL); | 696 | _put_word(&p, CAPI_MAXAPPL); |
| 697 | _put_word(&p, AVM_NCCI_PER_CHANNEL*30); | 697 | _put_word(&p, AVM_NCCI_PER_CHANNEL * 30); |
| 698 | _put_word(&p, card->cardnr - 1); | 698 | _put_word(&p, card->cardnr - 1); |
| 699 | skb_put(skb, (u8 *)p - (u8 *)skb->data); | 699 | skb_put(skb, (u8 *)p - (u8 *)skb->data); |
| 700 | 700 | ||
| @@ -712,7 +712,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 11 unmodified lines | |||
| 712 | if ((retval = b1_load_t4file(card, &data->firmware))) { | 712 | if ((retval = b1_load_t4file(card, &data->firmware))) { |
| 713 | b1dma_reset(card); | 713 | b1dma_reset(card); |
| 714 | printk(KERN_ERR "%s: failed to load t4file!!\n", | 714 | printk(KERN_ERR "%s: failed to load t4file!!\n", |
| 715 | card->name); | 715 | card->name); |
| 716 | return retval; | 716 | return retval; |
| 717 | } | 717 | } |
| 718 | 718 | ||
| @@ -720,7 +720,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 1 unmodified line | |||
| 720 | if ((retval = b1_load_config(card, &data->configuration))) { | 720 | if ((retval = b1_load_config(card, &data->configuration))) { |
| 721 | b1dma_reset(card); | 721 | b1dma_reset(card); |
| 722 | printk(KERN_ERR "%s: failed to load config!!\n", | 722 | printk(KERN_ERR "%s: failed to load config!!\n", |
| 723 | card->name); | 723 | card->name); |
| 724 | return retval; | 724 | return retval; |
| 725 | } | 725 | } |
| 726 | } | 726 | } |
| @@ -733,8 +733,8 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 6 unmodified lines | |||
| 733 | 733 | ||
| 734 | card->csr = AVM_FLAG; | 734 | card->csr = AVM_FLAG; |
| 735 | b1dma_writel(card, card->csr, AMCC_INTCSR); | 735 | b1dma_writel(card, card->csr, AMCC_INTCSR); |
| 736 | b1dma_writel(card, EN_A2P_TRANSFERS|EN_P2A_TRANSFERS|A2P_HI_PRIORITY| | 736 | b1dma_writel(card, EN_A2P_TRANSFERS | EN_P2A_TRANSFERS | A2P_HI_PRIORITY | |
| 737 | P2A_HI_PRIORITY|RESET_A2P_FLAGS|RESET_P2A_FLAGS, | 737 | P2A_HI_PRIORITY | RESET_A2P_FLAGS | RESET_P2A_FLAGS, |
| 738 | AMCC_MCSR); | 738 | AMCC_MCSR); |
| 739 | t1outp(card->port, 0x07, 0x30); | 739 | t1outp(card->port, 0x07, 0x30); |
| 740 | t1outp(card->port, 0x10, 0xF0); | 740 | t1outp(card->port, 0x10, 0xF0); |
| @@ -745,7 +745,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 4 unmodified lines | |||
| 745 | card->csr |= EN_RX_TC_INT; | 745 | card->csr |= EN_RX_TC_INT; |
| 746 | b1dma_writel(card, card->csr, AMCC_INTCSR); | 746 | b1dma_writel(card, card->csr, AMCC_INTCSR); |
| 747 | 747 | ||
| 748 | b1dma_send_init(card); | 748 | b1dma_send_init(card); |
| 749 | 749 | ||
| 750 | return 0; | 750 | return 0; |
| 751 | } | 751 | } |
| @@ -757,7 +757,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) · 5 unmodified lines | |||
| 757 | unsigned long flags; | 757 | unsigned long flags; |
| 758 | 758 | ||
| 759 | spin_lock_irqsave(&card->lock, flags); | 759 | spin_lock_irqsave(&card->lock, flags); |
| 760 | b1dma_reset(card); | 760 | b1dma_reset(card); |
| 761 | 761 | ||
| 762 | memset(cinfo->version, 0, sizeof(cinfo->version)); | 762 | memset(cinfo->version, 0, sizeof(cinfo->version)); |
| 763 | capilib_release(&cinfo->ncci_head); | 763 | capilib_release(&cinfo->ncci_head); |
| @@ -768,8 +768,8 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) · 4 unmodified lines | |||
| 768 | /* ------------------------------------------------------------- */ | 768 | /* ------------------------------------------------------------- */ |
| 769 | 769 | ||
| 770 | void b1dma_register_appl(struct capi_ctr *ctrl, | 770 | void b1dma_register_appl(struct capi_ctr *ctrl, |
| 771 | u16 appl, | 771 | u16 appl, |
| 772 | capi_register_params *rp) | 772 | capi_register_params *rp) |
| 773 | { | 773 | { |
| 774 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); | 774 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); |
| 775 | avmcard *card = cinfo->card; | 775 | avmcard *card = cinfo->card; |
| @@ -785,7 +785,7 @@ void b1dma_register_appl(struct capi_ctr *ctrl, · 9 unmodified lines | |||
| 785 | skb = alloc_skb(23, GFP_ATOMIC); | 785 | skb = alloc_skb(23, GFP_ATOMIC); |
| 786 | if (!skb) { | 786 | if (!skb) { |
| 787 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", | 787 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", |
| 788 | card->name); | 788 | card->name); |
| 789 | return; | 789 | return; |
| 790 | } | 790 | } |
| 791 | p = skb->data; | 791 | p = skb->data; |
| @@ -793,7 +793,7 @@ void b1dma_register_appl(struct capi_ctr *ctrl, · 1 unmodified line | |||
| 793 | _put_byte(&p, 0); | 793 | _put_byte(&p, 0); |
| 794 | _put_byte(&p, SEND_REGISTER); | 794 | _put_byte(&p, SEND_REGISTER); |
| 795 | _put_word(&p, appl); | 795 | _put_word(&p, appl); |
| 796 | _put_word(&p, 1024 * (nconn+1)); | 796 | _put_word(&p, 1024 * (nconn + 1)); |
| 797 | _put_word(&p, nconn); | 797 | _put_word(&p, nconn); |
| 798 | _put_word(&p, rp->datablkcnt); | 798 | _put_word(&p, rp->datablkcnt); |
| 799 | _put_word(&p, rp->datablklen); | 799 | _put_word(&p, rp->datablklen); |
| @@ -819,7 +819,7 @@ void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl) · 19 unmodified lines | |||
| 819 | skb = alloc_skb(7, GFP_ATOMIC); | 819 | skb = alloc_skb(7, GFP_ATOMIC); |
| 820 | if (!skb) { | 820 | if (!skb) { |
| 821 | printk(KERN_CRIT "%s: no memory, lost release appl.\n", | 821 | printk(KERN_CRIT "%s: no memory, lost release appl.\n", |
| 822 | card->name); | 822 | card->name); |
| 823 | return; | 823 | return; |
| 824 | } | 824 | } |
| 825 | p = skb->data; | 825 | p = skb->data; |
| @@ -841,7 +841,7 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) · 15 unmodified lines | |||
| 841 | avmcard *card = cinfo->card; | 841 | avmcard *card = cinfo->card; |
| 842 | u16 retval = CAPI_NOERROR; | 842 | u16 retval = CAPI_NOERROR; |
| 843 | 843 | ||
| 844 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { | 844 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { |
| 845 | unsigned long flags; | 845 | unsigned long flags; |
| 846 | spin_lock_irqsave(&card->lock, flags); | 846 | spin_lock_irqsave(&card->lock, flags); |
| 847 | retval = capilib_data_b3_req(&cinfo->ncci_head, | 847 | retval = capilib_data_b3_req(&cinfo->ncci_head, |
| @@ -850,7 +850,7 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) · 2 unmodified lines | |||
| 850 | CAPIMSG_MSGID(skb->data)); | 850 | CAPIMSG_MSGID(skb->data)); |
| 851 | spin_unlock_irqrestore(&card->lock, flags); | 851 | spin_unlock_irqrestore(&card->lock, flags); |
| 852 | } | 852 | } |
| 853 | if (retval == CAPI_NOERROR) | 853 | if (retval == CAPI_NOERROR) |
| 854 | b1dma_queue_tx(card, skb); | 854 | b1dma_queue_tx(card, skb); |
| 855 | 855 | ||
| 856 | return retval; | 856 | return retval; |
| @@ -893,29 +893,29 @@ static int b1dmactl_proc_show(struct seq_file *m, void *v) · 36 unmodified lines | |||
| 893 | seq_printf(m, "%-16s %s\n", "ver_serial", s); | 893 | seq_printf(m, "%-16s %s\n", "ver_serial", s); |
| 894 | 894 | ||
| 895 | if (card->cardtype != avm_m1) { | 895 | if (card->cardtype != avm_m1) { |
| 896 | flag = ((u8 *)(ctrl->profile.manu))[3]; | 896 | flag = ((u8 *)(ctrl->profile.manu))[3]; |
| 897 | if (flag) | 897 | if (flag) |
| 898 | seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", | 898 | seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", |
| 899 | "protocol", | 899 | "protocol", |
| 900 | (flag & 0x01) ? " DSS1" : "", | 900 | (flag & 0x01) ? " DSS1" : "", |
| 901 | (flag & 0x02) ? " CT1" : "", | 901 | (flag & 0x02) ? " CT1" : "", |
| 902 | (flag & 0x04) ? " VN3" : "", | 902 | (flag & 0x04) ? " VN3" : "", |
| 903 | (flag & 0x08) ? " NI1" : "", | 903 | (flag & 0x08) ? " NI1" : "", |
| 904 | (flag & 0x10) ? " AUSTEL" : "", | 904 | (flag & 0x10) ? " AUSTEL" : "", |
| 905 | (flag & 0x20) ? " ESS" : "", | 905 | (flag & 0x20) ? " ESS" : "", |
| 906 | (flag & 0x40) ? " 1TR6" : "" | 906 | (flag & 0x40) ? " 1TR6" : "" |
| 907 | ); | 907 | ); |
| 908 | } | 908 | } |
| 909 | if (card->cardtype != avm_m1) { | 909 | if (card->cardtype != avm_m1) { |
| 910 | flag = ((u8 *)(ctrl->profile.manu))[5]; | 910 | flag = ((u8 *)(ctrl->profile.manu))[5]; |
| 911 | if (flag) | 911 | if (flag) |
| 912 | seq_printf(m, "%-16s%s%s%s%s\n", | 912 | seq_printf(m, "%-16s%s%s%s%s\n", |
| 913 | "linetype", | 913 | "linetype", |
| 914 | (flag & 0x01) ? " point to point" : "", | 914 | (flag & 0x01) ? " point to point" : "", |
| 915 | (flag & 0x02) ? " point to multipoint" : "", | 915 | (flag & 0x02) ? " point to multipoint" : "", |
| 916 | (flag & 0x08) ? " leased line without D-channel" : "", | 916 | (flag & 0x08) ? " leased line without D-channel" : "", |
| 917 | (flag & 0x04) ? " leased line with D-channel" : "" | 917 | (flag & 0x04) ? " leased line with D-channel" : "" |
| 918 | ); | 918 | ); |
| 919 | } | 919 | } |
| 920 | seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); | 920 | seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); |
| 921 | 921 | ||
| @@ -977,7 +977,7 @@ static int __init b1dma_init(void) · 55 unmodified lines | |||
| 977 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 977 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 978 | strlcpy(rev, p + 2, sizeof(rev)); | 978 | strlcpy(rev, p + 2, sizeof(rev)); |
| 979 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 979 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 980 | *(p-1) = 0; | 980 | *(p - 1) = 0; |
| 981 | } else | 981 | } else |
| 982 | strcpy(rev, "1.0"); | 982 | strcpy(rev, "1.0"); |
| 983 | 983 | ||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* $Id: b1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ | 1 | /* $Id: b1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Module for AVM B1 ISA-card. | 3 | * Module for AVM B1 ISA-card. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -80,7 +80,7 @@ static int b1isa_probe(struct pci_dev *pdev) · 70 unmodified lines | |||
| 80 | card->cardtype = avm_b1isa; | 80 | card->cardtype = avm_b1isa; |
| 81 | sprintf(card->name, "b1isa-%x", card->port); | 81 | sprintf(card->name, "b1isa-%x", card->port); |
| 82 | 82 | ||
| 83 | if ( card->port != 0x150 && card->port != 0x250 | 83 | if (card->port != 0x150 && card->port != 0x250 |
| 84 | && card->port != 0x300 && card->port != 0x340) { | 84 | && card->port != 0x300 && card->port != 0x340) { |
| 85 | printk(KERN_WARNING "b1isa: invalid port 0x%x.\n", card->port); | 85 | printk(KERN_WARNING "b1isa: invalid port 0x%x.\n", card->port); |
| 86 | retval = -EINVAL; | 86 | retval = -EINVAL; |
| @@ -136,13 +136,13 @@ static int b1isa_probe(struct pci_dev *pdev) · 49 unmodified lines | |||
| 136 | pci_set_drvdata(pdev, cinfo); | 136 | pci_set_drvdata(pdev, cinfo); |
| 137 | return 0; | 137 | return 0; |
| 138 | 138 | ||
| 139 | err_free_irq: | 139 | err_free_irq: |
| 140 | free_irq(card->irq, card); | 140 | free_irq(card->irq, card); |
| 141 | err_release_region: | 141 | err_release_region: |
| 142 | release_region(card->port, AVMB1_PORTLEN); | 142 | release_region(card->port, AVMB1_PORTLEN); |
| 143 | err_free: | 143 | err_free: |
| 144 | b1_free_card(card); | 144 | b1_free_card(card); |
| 145 | err: | 145 | err: |
| 146 | return retval; | 146 | return retval; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| @@ -206,7 +206,7 @@ static int __init b1isa_init(void) · 57 unmodified lines | |||
| 206 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 206 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 207 | strlcpy(rev, p + 2, 32); | 207 | strlcpy(rev, p + 2, 32); |
| 208 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 208 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 209 | *(p-1) = 0; | 209 | *(p - 1) = 0; |
| 210 | } else | 210 | } else |
| 211 | strcpy(rev, "1.0"); | 211 | strcpy(rev, "1.0"); |
| 212 | 212 | ||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* $Id: b1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ | 1 | /* $Id: b1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Module for AVM B1 PCI-card. | 3 | * Module for AVM B1 PCI-card. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -79,7 +79,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) · 69 unmodified lines | |||
| 79 | card->port = p->port; | 79 | card->port = p->port; |
| 80 | card->irq = p->irq; | 80 | card->irq = p->irq; |
| 81 | card->cardtype = avm_b1pci; | 81 | card->cardtype = avm_b1pci; |
| 82 | 82 | ||
| 83 | if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { | 83 | if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { |
| 84 | printk(KERN_WARNING "b1pci: ports 0x%03x-0x%03x in use.\n", | 84 | printk(KERN_WARNING "b1pci: ports 0x%03x-0x%03x in use.\n", |
| 85 | card->port, card->port + AVMB1_PORTLEN); | 85 | card->port, card->port + AVMB1_PORTLEN); |
| @@ -96,14 +96,14 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) · 10 unmodified lines | |||
| 96 | } | 96 | } |
| 97 | b1_reset(card->port); | 97 | b1_reset(card->port); |
| 98 | b1_getrevision(card); | 98 | b1_getrevision(card); |
| 99 | 99 | ||
| 100 | retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card); | 100 | retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card); |
| 101 | if (retval) { | 101 | if (retval) { |
| 102 | printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq); | 102 | printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq); |
| 103 | retval = -EBUSY; | 103 | retval = -EBUSY; |
| 104 | goto err_release_region; | 104 | goto err_release_region; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | cinfo->capi_ctrl.driver_name = "b1pci"; | 107 | cinfo->capi_ctrl.driver_name = "b1pci"; |
| 108 | cinfo->capi_ctrl.driverdata = cinfo; | 108 | cinfo->capi_ctrl.driverdata = cinfo; |
| 109 | cinfo->capi_ctrl.register_appl = b1_register_appl; | 109 | cinfo->capi_ctrl.register_appl = b1_register_appl; |
| @@ -133,13 +133,13 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) · 23 unmodified lines | |||
| 133 | pci_set_drvdata(pdev, card); | 133 | pci_set_drvdata(pdev, card); |
| 134 | return 0; | 134 | return 0; |
| 135 | 135 | ||
| 136 | err_free_irq: | 136 | err_free_irq: |
| 137 | free_irq(card->irq, card); | 137 | free_irq(card->irq, card); |
| 138 | err_release_region: | 138 | err_release_region: |
| 139 | release_region(card->port, AVMB1_PORTLEN); | 139 | release_region(card->port, AVMB1_PORTLEN); |
| 140 | err_free: | 140 | err_free: |
| 141 | b1_free_card(card); | 141 | b1_free_card(card); |
| 142 | err: | 142 | err: |
| 143 | return retval; | 143 | return retval; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| @@ -193,7 +193,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev) · 47 unmodified lines | |||
| 193 | goto err; | 193 | goto err; |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | card->dma = avmcard_dma_alloc("b1pci", pdev, 2048+128, 2048+128); | 196 | card->dma = avmcard_dma_alloc("b1pci", pdev, 2048 + 128, 2048 + 128); |
| 197 | if (!card->dma) { | 197 | if (!card->dma) { |
| 198 | printk(KERN_WARNING "b1pci: dma alloc.\n"); | 198 | printk(KERN_WARNING "b1pci: dma alloc.\n"); |
| 199 | retval = -ENOMEM; | 199 | retval = -ENOMEM; |
| @@ -267,17 +267,17 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev) · 67 unmodified lines | |||
| 267 | pci_set_drvdata(pdev, card); | 267 | pci_set_drvdata(pdev, card); |
| 268 | return 0; | 268 | return 0; |
| 269 | 269 | ||
| 270 | err_free_irq: | 270 | err_free_irq: |
| 271 | free_irq(card->irq, card); | 271 | free_irq(card->irq, card); |
| 272 | err_unmap: | 272 | err_unmap: |
| 273 | iounmap(card->mbase); | 273 | iounmap(card->mbase); |
| 274 | err_release_region: | 274 | err_release_region: |
| 275 | release_region(card->port, AVMB1_PORTLEN); | 275 | release_region(card->port, AVMB1_PORTLEN); |
| 276 | err_free_dma: | 276 | err_free_dma: |
| 277 | avmcard_dma_free(card->dma); | 277 | avmcard_dma_free(card->dma); |
| 278 | err_free: | 278 | err_free: |
| 279 | b1_free_card(card); | 279 | b1_free_card(card); |
| 280 | err: | 280 | err: |
| 281 | return retval; | 281 | return retval; |
| 282 | 282 | ||
| 283 | } | 283 | } |
| @@ -287,13 +287,13 @@ static void b1pciv4_remove(struct pci_dev *pdev) · 3 unmodified lines | |||
| 287 | avmcard *card = pci_get_drvdata(pdev); | 287 | avmcard *card = pci_get_drvdata(pdev); |
| 288 | avmctrl_info *cinfo = card->ctrlinfo; | 288 | avmctrl_info *cinfo = card->ctrlinfo; |
| 289 | 289 | ||
| 290 | b1dma_reset(card); | 290 | b1dma_reset(card); |
| 291 | 291 | ||
| 292 | detach_capi_ctr(&cinfo->capi_ctrl); | 292 | detach_capi_ctr(&cinfo->capi_ctrl); |
| 293 | free_irq(card->irq, card); | 293 | free_irq(card->irq, card); |
| 294 | iounmap(card->mbase); | 294 | iounmap(card->mbase); |
| 295 | release_region(card->port, AVMB1_PORTLEN); | 295 | release_region(card->port, AVMB1_PORTLEN); |
| 296 | avmcard_dma_free(card->dma); | 296 | avmcard_dma_free(card->dma); |
| 297 | b1_free_card(card); | 297 | b1_free_card(card); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| @@ -326,7 +326,7 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev, · 26 unmodified lines | |||
| 326 | retval = b1pci_probe(¶m, pdev); | 326 | retval = b1pci_probe(¶m, pdev); |
| 327 | #endif | 327 | #endif |
| 328 | if (retval != 0) { | 328 | if (retval != 0) { |
| 329 | printk(KERN_ERR "b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n", | 329 | printk(KERN_ERR "b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n", |
| 330 | param.port, param.irq, param.membase); | 330 | param.port, param.irq, param.membase); |
| 331 | } | 331 | } |
| 332 | } else { | 332 | } else { |
| @@ -337,7 +337,7 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev, · 4 unmodified lines | |||
| 337 | param.port, param.irq); | 337 | param.port, param.irq); |
| 338 | retval = b1pci_probe(¶m, pdev); | 338 | retval = b1pci_probe(¶m, pdev); |
| 339 | if (retval != 0) { | 339 | if (retval != 0) { |
| 340 | printk(KERN_ERR "b1pci: no AVM-B1 at i/o %#x, irq %d detected\n", | 340 | printk(KERN_ERR "b1pci: no AVM-B1 at i/o %#x, irq %d detected\n", |
| 341 | param.port, param.irq); | 341 | param.port, param.irq); |
| 342 | } | 342 | } |
| 343 | } | 343 | } |
| @@ -385,7 +385,7 @@ static int __init b1pci_init(void) · 41 unmodified lines | |||
| 385 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 385 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 386 | strlcpy(rev, p + 2, 32); | 386 | strlcpy(rev, p + 2, 32); |
| 387 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 387 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 388 | *(p-1) = 0; | 388 | *(p - 1) = 0; |
| 389 | } else | 389 | } else |
| 390 | strcpy(rev, "1.0"); | 390 | strcpy(rev, "1.0"); |
| 391 | 391 | ||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* $Id: b1pcmcia.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ | 1 | /* $Id: b1pcmcia.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Module for AVM B1/M1/M2 PCMCIA-card. | 3 | * Module for AVM B1/M1/M2 PCMCIA-card. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -74,9 +74,9 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, · 64 unmodified lines | |||
| 74 | cinfo = card->ctrlinfo; | 74 | cinfo = card->ctrlinfo; |
| 75 | 75 | ||
| 76 | switch (cardtype) { | 76 | switch (cardtype) { |
| 77 | case avm_m1: sprintf(card->name, "m1-%x", port); break; | 77 | case avm_m1: sprintf(card->name, "m1-%x", port); break; |
| 78 | case avm_m2: sprintf(card->name, "m2-%x", port); break; | 78 | case avm_m2: sprintf(card->name, "m2-%x", port); break; |
| 79 | default: sprintf(card->name, "b1pcmcia-%x", port); break; | 79 | default: sprintf(card->name, "b1pcmcia-%x", port); break; |
| 80 | } | 80 | } |
| 81 | card->port = port; | 81 | card->port = port; |
| 82 | card->irq = irq; | 82 | card->irq = irq; |
| @@ -117,9 +117,9 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, · 34 unmodified lines | |||
| 117 | goto err_free_irq; | 117 | goto err_free_irq; |
| 118 | } | 118 | } |
| 119 | switch (cardtype) { | 119 | switch (cardtype) { |
| 120 | case avm_m1: cardname = "M1"; break; | 120 | case avm_m1: cardname = "M1"; break; |
| 121 | case avm_m2: cardname = "M2"; break; | 121 | case avm_m2: cardname = "M2"; break; |
| 122 | default : cardname = "B1 PCMCIA"; break; | 122 | default: cardname = "B1 PCMCIA"; break; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | printk(KERN_INFO "b1pcmcia: AVM %s at i/o %#x, irq %d, revision %d\n", | 125 | printk(KERN_INFO "b1pcmcia: AVM %s at i/o %#x, irq %d, revision %d\n", |
| @@ -128,11 +128,11 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, · 2 unmodified lines | |||
| 128 | list_add(&card->list, &cards); | 128 | list_add(&card->list, &cards); |
| 129 | return cinfo->capi_ctrl.cnr; | 129 | return cinfo->capi_ctrl.cnr; |
| 130 | 130 | ||
| 131 | err_free_irq: | 131 | err_free_irq: |
| 132 | free_irq(card->irq, card); | 132 | free_irq(card->irq, card); |
| 133 | err_free: | 133 | err_free: |
| 134 | b1_free_card(card); | 134 | b1_free_card(card); |
| 135 | err: | 135 | err: |
| 136 | return retval; | 136 | return retval; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| @@ -175,7 +175,7 @@ int b1pcmcia_delcard(unsigned int port, unsigned irq) · 36 unmodified lines | |||
| 175 | { | 175 | { |
| 176 | struct list_head *l; | 176 | struct list_head *l; |
| 177 | avmcard *card; | 177 | avmcard *card; |
| 178 | 178 | ||
| 179 | list_for_each(l, &cards) { | 179 | list_for_each(l, &cards) { |
| 180 | card = list_entry(l, avmcard, list); | 180 | card = list_entry(l, avmcard, list); |
| 181 | if (card->port == port && card->irq == irq) { | 181 | if (card->port == port && card->irq == irq) { |
| @@ -204,7 +204,7 @@ static int __init b1pcmcia_init(void) · 22 unmodified lines | |||
| 204 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 204 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 205 | strlcpy(rev, p + 2, 32); | 205 | strlcpy(rev, p + 2, 32); |
| 206 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 206 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 207 | *(p-1) = 0; | 207 | *(p - 1) = 0; |
| 208 | } else | 208 | } else |
| 209 | strcpy(rev, "1.0"); | 209 | strcpy(rev, "1.0"); |
| 210 | 210 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* $Id: c4.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ | 1 | /* $Id: c4.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Module for AVM C4 & C2 card. | 3 | * Module for AVM C4 & C2 card. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| @@ -129,8 +129,8 @@ static void c4_dispatch_tx(avmcard *card); · 121 unmodified lines | |||
| 129 | 129 | ||
| 130 | /* ------------------------------------------------------------- */ | 130 | /* ------------------------------------------------------------- */ |
| 131 | 131 | ||
| 132 | #define RESET_TIMEOUT (15*HZ) /* 15 sec */ | 132 | #define RESET_TIMEOUT (15 * HZ) /* 15 sec */ |
| 133 | #define PEEK_POKE_TIMEOUT (HZ/10) /* 0.1 sec */ | 133 | #define PEEK_POKE_TIMEOUT (HZ / 10) /* 0.1 sec */ |
| 134 | 134 | ||
| 135 | /* ------------------------------------------------------------- */ | 135 | /* ------------------------------------------------------------- */ |
| 136 | 136 | ||
| @@ -148,7 +148,7 @@ static inline int wait_for_doorbell(avmcard *card, unsigned long t) · 11 unmodified lines | |||
| 148 | unsigned long stop; | 148 | unsigned long stop; |
| 149 | 149 | ||
| 150 | stop = jiffies + t; | 150 | stop = jiffies + t; |
| 151 | while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) { | 151 | while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) { |
| 152 | if (!time_before(jiffies, stop)) | 152 | if (!time_before(jiffies, stop)) |
| 153 | return -1; | 153 | return -1; |
| 154 | mb(); | 154 | mb(); |
| @@ -159,40 +159,40 @@ static inline int wait_for_doorbell(avmcard *card, unsigned long t) · 4 unmodified lines | |||
| 159 | static int c4_poke(avmcard *card, unsigned long off, unsigned long value) | 159 | static int c4_poke(avmcard *card, unsigned long off, unsigned long value) |
| 160 | { | 160 | { |
| 161 | 161 | ||
| 162 | if (wait_for_doorbell(card, HZ/10) < 0) | 162 | if (wait_for_doorbell(card, HZ / 10) < 0) |
| 163 | return -1; | 163 | return -1; |
| 164 | |||
| 165 | c4outmeml(card->mbase+MBOX_PEEK_POKE, off); | ||
| 166 | c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); | ||
| 167 | 164 | ||
| 168 | if (wait_for_doorbell(card, HZ/10) < 0) | 165 | c4outmeml(card->mbase + MBOX_PEEK_POKE, off); |
| 166 | c4outmeml(card->mbase + DOORBELL, DBELL_ADDR); | ||
| 167 | |||
| 168 | if (wait_for_doorbell(card, HZ / 10) < 0) | ||
| 169 | return -1; | 169 | return -1; |
| 170 | 170 | ||
| 171 | c4outmeml(card->mbase+MBOX_PEEK_POKE, value); | 171 | c4outmeml(card->mbase + MBOX_PEEK_POKE, value); |
| 172 | c4outmeml(card->mbase+DOORBELL, DBELL_DATA | DBELL_ADDR); | 172 | c4outmeml(card->mbase + DOORBELL, DBELL_DATA | DBELL_ADDR); |
| 173 | 173 | ||
| 174 | return 0; | 174 | return 0; |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | static int c4_peek(avmcard *card, unsigned long off, unsigned long *valuep) | 177 | static int c4_peek(avmcard *card, unsigned long off, unsigned long *valuep) |
| 178 | { | 178 | { |
| 179 | if (wait_for_doorbell(card, HZ/10) < 0) | 179 | if (wait_for_doorbell(card, HZ / 10) < 0) |
| 180 | return -1; | 180 | return -1; |
| 181 | 181 | ||
| 182 | c4outmeml(card->mbase+MBOX_PEEK_POKE, off); | 182 | c4outmeml(card->mbase + MBOX_PEEK_POKE, off); |
| 183 | c4outmeml(card->mbase+DOORBELL, DBELL_RNWR | DBELL_ADDR); | 183 | c4outmeml(card->mbase + DOORBELL, DBELL_RNWR | DBELL_ADDR); |
| 184 | 184 | ||
| 185 | if (wait_for_doorbell(card, HZ/10) < 0) | 185 | if (wait_for_doorbell(card, HZ / 10) < 0) |
| 186 | return -1; | 186 | return -1; |
| 187 | 187 | ||
| 188 | *valuep = c4inmeml(card->mbase+MBOX_PEEK_POKE); | 188 | *valuep = c4inmeml(card->mbase + MBOX_PEEK_POKE); |
| 189 | 189 | ||
| 190 | return 0; | 190 | return 0; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | /* ------------------------------------------------------------- */ | 193 | /* ------------------------------------------------------------- */ |
| 194 | 194 | ||
| 195 | static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) | 195 | static int c4_load_t4file(avmcard *card, capiloaddatapart *t4file) |
| 196 | { | 196 | { |
| 197 | u32 val; | 197 | u32 val; |
| 198 | unsigned char *dp; | 198 | unsigned char *dp; |
| @@ -202,7 +202,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) · 3 unmodified lines | |||
| 202 | dp = t4file->data; | 202 | dp = t4file->data; |
| 203 | left = t4file->len; | 203 | left = t4file->len; |
| 204 | while (left >= sizeof(u32)) { | 204 | while (left >= sizeof(u32)) { |
| 205 | if (t4file->user) { | 205 | if (t4file->user) { |
| 206 | if (copy_from_user(&val, dp, sizeof(val))) | 206 | if (copy_from_user(&val, dp, sizeof(val))) |
| 207 | return -EFAULT; | 207 | return -EFAULT; |
| 208 | } else { | 208 | } else { |
| @@ -210,7 +210,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) · 1 unmodified line | |||
| 210 | } | 210 | } |
| 211 | if (c4_poke(card, loadoff, val)) { | 211 | if (c4_poke(card, loadoff, val)) { |
| 212 | printk(KERN_ERR "%s: corrupted firmware file ?\n", | 212 | printk(KERN_ERR "%s: corrupted firmware file ?\n", |
| 213 | card->name); | 213 | card->name); |
| 214 | return -EIO; | 214 | return -EIO; |
| 215 | } | 215 | } |
| 216 | left -= sizeof(u32); | 216 | left -= sizeof(u32); |
| @@ -227,7 +227,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) · 10 unmodified lines | |||
| 227 | } | 227 | } |
| 228 | if (c4_poke(card, loadoff, val)) { | 228 | if (c4_poke(card, loadoff, val)) { |
| 229 | printk(KERN_ERR "%s: corrupted firmware file ?\n", | 229 | printk(KERN_ERR "%s: corrupted firmware file ?\n", |
| 230 | card->name); | 230 | card->name); |
| 231 | return -EIO; | 231 | return -EIO; |
| 232 | } | 232 | } |
| 233 | } | 233 | } |
| @@ -297,13 +297,13 @@ static void c4_reset(avmcard *card) · 63 unmodified lines | |||
| 297 | { | 297 | { |
| 298 | unsigned long stop; | 298 | unsigned long stop; |
| 299 | 299 | ||
| 300 | c4outmeml(card->mbase+DOORBELL, DBELL_RESET_ARM); | 300 | c4outmeml(card->mbase + DOORBELL, DBELL_RESET_ARM); |
| 301 | 301 | ||
| 302 | stop = jiffies + HZ*10; | 302 | stop = jiffies + HZ * 10; |
| 303 | while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) { | 303 | while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) { |
| 304 | if (!time_before(jiffies, stop)) | 304 | if (!time_before(jiffies, stop)) |
| 305 | return; | 305 | return; |
| 306 | c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); | 306 | c4outmeml(card->mbase + DOORBELL, DBELL_ADDR); |
| 307 | mb(); | 307 | mb(); |
| 308 | } | 308 | } |
| 309 | 309 | ||
| @@ -317,89 +317,89 @@ static int c4_detect(avmcard *card) · 7 unmodified lines | |||
| 317 | { | 317 | { |
| 318 | unsigned long stop, dummy; | 318 | unsigned long stop, dummy; |
| 319 | 319 | ||
| 320 | c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c); | 320 | c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x0c); |
| 321 | if (c4inmeml(card->mbase+PCI_OUT_INT_MASK) != 0x0c) | 321 | if (c4inmeml(card->mbase + PCI_OUT_INT_MASK) != 0x0c) |
| 322 | return 1; | 322 | return 1; |
| 323 | 323 | ||
| 324 | c4outmeml(card->mbase+DOORBELL, DBELL_RESET_ARM); | 324 | c4outmeml(card->mbase + DOORBELL, DBELL_RESET_ARM); |
| 325 | 325 | ||
| 326 | stop = jiffies + HZ*10; | 326 | stop = jiffies + HZ * 10; |
| 327 | while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) { | 327 | while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) { |
| 328 | if (!time_before(jiffies, stop)) | 328 | if (!time_before(jiffies, stop)) |
| 329 | return 2; | 329 | return 2; |
| 330 | c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); | 330 | c4outmeml(card->mbase + DOORBELL, DBELL_ADDR); |
| 331 | mb(); | 331 | mb(); |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | c4_poke(card, DC21285_ARMCSR_BASE + CHAN_1_CONTROL, 0); | 334 | c4_poke(card, DC21285_ARMCSR_BASE + CHAN_1_CONTROL, 0); |
| 335 | c4_poke(card, DC21285_ARMCSR_BASE + CHAN_2_CONTROL, 0); | 335 | c4_poke(card, DC21285_ARMCSR_BASE + CHAN_2_CONTROL, 0); |
| 336 | 336 | ||
| 337 | c4outmeml(card->mbase+MAILBOX_0, 0x55aa55aa); | 337 | c4outmeml(card->mbase + MAILBOX_0, 0x55aa55aa); |
| 338 | if (c4inmeml(card->mbase+MAILBOX_0) != 0x55aa55aa) return 3; | 338 | if (c4inmeml(card->mbase + MAILBOX_0) != 0x55aa55aa) return 3; |
| 339 | 339 | ||
| 340 | c4outmeml(card->mbase+MAILBOX_0, 0xaa55aa55); | 340 | c4outmeml(card->mbase + MAILBOX_0, 0xaa55aa55); |
| 341 | if (c4inmeml(card->mbase+MAILBOX_0) != 0xaa55aa55) return 4; | 341 | if (c4inmeml(card->mbase + MAILBOX_0) != 0xaa55aa55) return 4; |
| 342 | 342 | ||
| 343 | if (c4_poke(card, DC21285_ARMCSR_BASE+DBELL_SA_MASK, 0)) return 5; | 343 | if (c4_poke(card, DC21285_ARMCSR_BASE + DBELL_SA_MASK, 0)) return 5; |
| 344 | if (c4_poke(card, DC21285_ARMCSR_BASE+DBELL_PCI_MASK, 0)) return 6; | 344 | if (c4_poke(card, DC21285_ARMCSR_BASE + DBELL_PCI_MASK, 0)) return 6; |
| 345 | if (c4_poke(card, DC21285_ARMCSR_BASE+SA_CONTROL, SA_CTL_ALLRIGHT)) | 345 | if (c4_poke(card, DC21285_ARMCSR_BASE + SA_CONTROL, SA_CTL_ALLRIGHT)) |
| 346 | return 7; | 346 | return 7; |
| 347 | if (c4_poke(card, DC21285_ARMCSR_BASE+XBUS_CYCLE, INIT_XBUS_CYCLE)) | 347 | if (c4_poke(card, DC21285_ARMCSR_BASE + XBUS_CYCLE, INIT_XBUS_CYCLE)) |
| 348 | return 8; | 348 | return 8; |
| 349 | if (c4_poke(card, DC21285_ARMCSR_BASE+XBUS_STROBE, INIT_XBUS_STROBE)) | 349 | if (c4_poke(card, DC21285_ARMCSR_BASE + XBUS_STROBE, INIT_XBUS_STROBE)) |
| 350 | return 8; | 350 | return 8; |
| 351 | if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_TIMING, 0)) return 9; | 351 | if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_TIMING, 0)) return 9; |
| 352 | 352 | ||
| 353 | mdelay(1); | 353 | mdelay(1); |
| 354 | 354 | ||
| 355 | if (c4_peek(card, DC21285_DRAM_A0MR, &dummy)) return 10; | 355 | if (c4_peek(card, DC21285_DRAM_A0MR, &dummy)) return 10; |
| 356 | if (c4_peek(card, DC21285_DRAM_A1MR, &dummy)) return 11; | 356 | if (c4_peek(card, DC21285_DRAM_A1MR, &dummy)) return 11; |
| 357 | if (c4_peek(card, DC21285_DRAM_A2MR, &dummy)) return 12; | 357 | if (c4_peek(card, DC21285_DRAM_A2MR, &dummy)) return 12; |
| 358 | if (c4_peek(card, DC21285_DRAM_A3MR, &dummy)) return 13; | 358 | if (c4_peek(card, DC21285_DRAM_A3MR, &dummy)) return 13; |
| 359 | 359 | ||
| 360 | if (c4_poke(card, DC21285_DRAM_A0MR+CAS_OFFSET, 0)) return 14; | 360 | if (c4_poke(card, DC21285_DRAM_A0MR + CAS_OFFSET, 0)) return 14; |
| 361 | if (c4_poke(card, DC21285_DRAM_A1MR+CAS_OFFSET, 0)) return 15; | 361 | if (c4_poke(card, DC21285_DRAM_A1MR + CAS_OFFSET, 0)) return 15; |
| 362 | if (c4_poke(card, DC21285_DRAM_A2MR+CAS_OFFSET, 0)) return 16; | 362 | if (c4_poke(card, DC21285_DRAM_A2MR + CAS_OFFSET, 0)) return 16; |
| 363 | if (c4_poke(card, DC21285_DRAM_A3MR+CAS_OFFSET, 0)) return 17; | 363 | if (c4_poke(card, DC21285_DRAM_A3MR + CAS_OFFSET, 0)) return 17; |
| 364 | 364 | ||
| 365 | mdelay(1); | 365 | mdelay(1); |
| 366 | 366 | ||
| 367 | if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_TIMING, DRAM_TIMING_DEF)) | 367 | if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_TIMING, DRAM_TIMING_DEF)) |
| 368 | return 18; | 368 | return 18; |
| 369 | 369 | ||
| 370 | if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_0,DRAM_AD_SZ_DEF0)) | 370 | if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_0, DRAM_AD_SZ_DEF0)) |
| 371 | return 19; | 371 | return 19; |
| 372 | if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_1,DRAM_AD_SZ_NULL)) | 372 | if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_1, DRAM_AD_SZ_NULL)) |
| 373 | return 20; | 373 | return 20; |
| 374 | if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_2,DRAM_AD_SZ_NULL)) | 374 | if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_2, DRAM_AD_SZ_NULL)) |
| 375 | return 21; | 375 | return 21; |
| 376 | if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_3,DRAM_AD_SZ_NULL)) | 376 | if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_3, DRAM_AD_SZ_NULL)) |
| 377 | return 22; | 377 | return 22; |
| 378 | 378 | ||
| 379 | /* Transputer test */ | 379 | /* Transputer test */ |
| 380 | 380 | ||
| 381 | if ( c4_poke(card, 0x000000, 0x11111111) | 381 | if (c4_poke(card, 0x000000, 0x11111111) |
| 382 | || c4_poke(card, 0x400000, 0x22222222) | 382 | || c4_poke(card, 0x400000, 0x22222222) |
| 383 | || c4_poke(card, 0x800000, 0x33333333) | 383 | || c4_poke(card, 0x800000, 0x33333333) |
| 384 | || c4_poke(card, 0xC00000, 0x44444444)) | 384 | || c4_poke(card, 0xC00000, 0x44444444)) |
| 385 | return 23; | 385 | return 23; |
| 386 | 386 | ||
| 387 | if ( c4_peek(card, 0x000000, &dummy) || dummy != 0x11111111 | 387 | if (c4_peek(card, 0x000000, &dummy) || dummy != 0x11111111 |
| 388 | || c4_peek(card, 0x400000, &dummy) || dummy != 0x22222222 | 388 | || c4_peek(card, 0x400000, &dummy) || dummy != 0x22222222 |
| 389 | || c4_peek(card, 0x800000, &dummy) || dummy != 0x33333333 | 389 | || c4_peek(card, 0x800000, &dummy) || dummy != 0x33333333 |
| 390 | || c4_peek(card, 0xC00000, &dummy) || dummy != 0x44444444) | 390 | || c4_peek(card, 0xC00000, &dummy) || dummy != 0x44444444) |
| 391 | return 24; | 391 | return 24; |
| 392 | 392 | ||
| 393 | if ( c4_poke(card, 0x000000, 0x55555555) | 393 | if (c4_poke(card, 0x000000, 0x55555555) |
| 394 | || c4_poke(card, 0x400000, 0x66666666) | 394 | || c4_poke(card, 0x400000, 0x66666666) |
| 395 | || c4_poke(card, 0x800000, 0x77777777) | 395 | || c4_poke(card, 0x800000, 0x77777777) |
| 396 | || c4_poke(card, 0xC00000, 0x88888888)) | 396 | || c4_poke(card, 0xC00000, 0x88888888)) |
| 397 | return 25; | 397 | return 25; |
| 398 | 398 | ||
| 399 | if ( c4_peek(card, 0x000000, &dummy) || dummy != 0x55555555 | 399 | if (c4_peek(card, 0x000000, &dummy) || dummy != 0x55555555 |
| 400 | || c4_peek(card, 0x400000, &dummy) || dummy != 0x66666666 | 400 | || c4_peek(card, 0x400000, &dummy) || dummy != 0x66666666 |
| 401 | || c4_peek(card, 0x800000, &dummy) || dummy != 0x77777777 | 401 | || c4_peek(card, 0x800000, &dummy) || dummy != 0x77777777 |
| 402 | || c4_peek(card, 0xC00000, &dummy) || dummy != 0x88888888) | 402 | || c4_peek(card, 0xC00000, &dummy) || dummy != 0x88888888) |
| 403 | return 26; | 403 | return 26; |
| 404 | 404 | ||
| 405 | return 0; | 405 | return 0; |
| @@ -451,26 +451,26 @@ static void c4_dispatch_tx(avmcard *card) · 45 unmodified lines | |||
| 451 | printk(KERN_DEBUG "%s: tx put msg len=%d\n", card->name, txlen); | 451 | printk(KERN_DEBUG "%s: tx put msg len=%d\n", card->name, txlen); |
| 452 | #endif | 452 | #endif |
| 453 | } else { | 453 | } else { |
| 454 | txlen = skb->len-2; | 454 | txlen = skb->len - 2; |
| 455 | #ifdef AVM_C4_POLLDEBUG | 455 | #ifdef AVM_C4_POLLDEBUG |
| 456 | if (skb->data[2] == SEND_POLLACK) | 456 | if (skb->data[2] == SEND_POLLACK) |
| 457 | printk(KERN_INFO "%s: ack to c4\n", card->name); | 457 | printk(KERN_INFO "%s: ack to c4\n", card->name); |
| 458 | #endif | 458 | #endif |
| 459 | #ifdef AVM_C4_DEBUG | 459 | #ifdef AVM_C4_DEBUG |
| 460 | printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n", | 460 | printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n", |
| 461 | card->name, skb->data[2], txlen); | 461 | card->name, skb->data[2], txlen); |
| 462 | #endif | 462 | #endif |
| 463 | skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, | 463 | skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, |
| 464 | skb->len - 2); | 464 | skb->len - 2); |
| 465 | } | 465 | } |
| 466 | txlen = (txlen + 3) & ~3; | 466 | txlen = (txlen + 3) & ~3; |
| 467 | 467 | ||
| 468 | c4outmeml(card->mbase+MBOX_DOWN_ADDR, dma->sendbuf.dmaaddr); | 468 | c4outmeml(card->mbase + MBOX_DOWN_ADDR, dma->sendbuf.dmaaddr); |
| 469 | c4outmeml(card->mbase+MBOX_DOWN_LEN, txlen); | 469 | c4outmeml(card->mbase + MBOX_DOWN_LEN, txlen); |
| 470 | 470 | ||
| 471 | card->csr |= DBELL_DOWN_ARM; | 471 | card->csr |= DBELL_DOWN_ARM; |
| 472 | 472 | ||
| 473 | c4outmeml(card->mbase+DOORBELL, DBELL_DOWN_ARM); | 473 | c4outmeml(card->mbase + DOORBELL, DBELL_DOWN_ARM); |
| 474 | 474 | ||
| 475 | dev_kfree_skb_any(skb); | 475 | dev_kfree_skb_any(skb); |
| 476 | } | 476 | } |
| @@ -485,7 +485,7 @@ static void queue_pollack(avmcard *card) · 8 unmodified lines | |||
| 485 | skb = alloc_skb(3, GFP_ATOMIC); | 485 | skb = alloc_skb(3, GFP_ATOMIC); |
| 486 | if (!skb) { | 486 | if (!skb) { |
| 487 | printk(KERN_CRIT "%s: no memory, lost poll ack\n", | 487 | printk(KERN_CRIT "%s: no memory, lost poll ack\n", |
| 488 | card->name); | 488 | card->name); |
| 489 | return; | 489 | return; |
| 490 | } | 490 | } |
| 491 | p = skb->data; | 491 | p = skb->data; |
| @@ -514,9 +514,9 @@ static void c4_handle_rx(avmcard *card) · 22 unmodified lines | |||
| 514 | 514 | ||
| 515 | #ifdef AVM_C4_DEBUG | 515 | #ifdef AVM_C4_DEBUG |
| 516 | printk(KERN_DEBUG "%s: rx 0x%x len=%lu\n", card->name, | 516 | printk(KERN_DEBUG "%s: rx 0x%x len=%lu\n", card->name, |
| 517 | b1cmd, (unsigned long)dma->recvlen); | 517 | b1cmd, (unsigned long)dma->recvlen); |
| 518 | #endif | 518 | #endif |
| 519 | 519 | ||
| 520 | switch (b1cmd) { | 520 | switch (b1cmd) { |
| 521 | case RECEIVE_DATA_B3_IND: | 521 | case RECEIVE_DATA_B3_IND: |
| 522 | 522 | ||
| @@ -528,13 +528,13 @@ static void c4_handle_rx(avmcard *card) · 5 unmodified lines | |||
| 528 | ctrl = &card->ctrlinfo[cidx].capi_ctrl; | 528 | ctrl = &card->ctrlinfo[cidx].capi_ctrl; |
| 529 | 529 | ||
| 530 | if (MsgLen < 30) { /* not CAPI 64Bit */ | 530 | if (MsgLen < 30) { /* not CAPI 64Bit */ |
| 531 | memset(card->msgbuf+MsgLen, 0, 30-MsgLen); | 531 | memset(card->msgbuf + MsgLen, 0, 30 - MsgLen); |
| 532 | MsgLen = 30; | 532 | MsgLen = 30; |
| 533 | CAPIMSG_SETLEN(card->msgbuf, 30); | 533 | CAPIMSG_SETLEN(card->msgbuf, 30); |
| 534 | } | 534 | } |
| 535 | if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) { | 535 | if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { |
| 536 | printk(KERN_ERR "%s: incoming packet dropped\n", | 536 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 537 | card->name); | 537 | card->name); |
| 538 | } else { | 538 | } else { |
| 539 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 539 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| 540 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); | 540 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); |
| @@ -553,7 +553,7 @@ static void c4_handle_rx(avmcard *card) · 12 unmodified lines | |||
| 553 | 553 | ||
| 554 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { | 554 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { |
| 555 | printk(KERN_ERR "%s: incoming packet dropped\n", | 555 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 556 | card->name); | 556 | card->name); |
| 557 | } else { | 557 | } else { |
| 558 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 558 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| 559 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) | 559 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) |
| @@ -570,7 +570,7 @@ static void c4_handle_rx(avmcard *card) · 10 unmodified lines | |||
| 570 | ApplId = _get_word(&p); | 570 | ApplId = _get_word(&p); |
| 571 | NCCI = _get_word(&p); | 571 | NCCI = _get_word(&p); |
| 572 | WindowSize = _get_word(&p); | 572 | WindowSize = _get_word(&p); |
| 573 | cidx = (NCCI&0x7f) - card->cardnr; | 573 | cidx = (NCCI & 0x7f) - card->cardnr; |
| 574 | if (cidx >= card->nlogcontr) cidx = 0; | 574 | if (cidx >= card->nlogcontr) cidx = 0; |
| 575 | 575 | ||
| 576 | capilib_new_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI, WindowSize); | 576 | capilib_new_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI, WindowSize); |
| @@ -583,7 +583,7 @@ static void c4_handle_rx(avmcard *card) · 6 unmodified lines | |||
| 583 | NCCI = _get_word(&p); | 583 | NCCI = _get_word(&p); |
| 584 | 584 | ||
| 585 | if (NCCI != 0xffffffff) { | 585 | if (NCCI != 0xffffffff) { |
| 586 | cidx = (NCCI&0x7f) - card->cardnr; | 586 | cidx = (NCCI & 0x7f) - card->cardnr; |
| 587 | if (cidx >= card->nlogcontr) cidx = 0; | 587 | if (cidx >= card->nlogcontr) cidx = 0; |
| 588 | capilib_free_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI); | 588 | capilib_free_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI); |
| 589 | } | 589 | } |
| @@ -595,14 +595,14 @@ static void c4_handle_rx(avmcard *card) · 5 unmodified lines | |||
| 595 | #endif | 595 | #endif |
| 596 | if (!suppress_pollack) | 596 | if (!suppress_pollack) |
| 597 | queue_pollack(card); | 597 | queue_pollack(card); |
| 598 | for (cidx=0; cidx < card->nr_controllers; cidx++) { | 598 | for (cidx = 0; cidx < card->nr_controllers; cidx++) { |
| 599 | ctrl = &card->ctrlinfo[cidx].capi_ctrl; | 599 | ctrl = &card->ctrlinfo[cidx].capi_ctrl; |
| 600 | capi_ctr_resume_output(ctrl); | 600 | capi_ctr_resume_output(ctrl); |
| 601 | } | 601 | } |
| 602 | break; | 602 | break; |
| 603 | 603 | ||
| 604 | case RECEIVE_STOP: | 604 | case RECEIVE_STOP: |
| 605 | for (cidx=0; cidx < card->nr_controllers; cidx++) { | 605 | for (cidx = 0; cidx < card->nr_controllers; cidx++) { |
| 606 | ctrl = &card->ctrlinfo[cidx].capi_ctrl; | 606 | ctrl = &card->ctrlinfo[cidx].capi_ctrl; |
| 607 | capi_ctr_suspend_output(ctrl); | 607 | capi_ctr_suspend_output(ctrl); |
| 608 | } | 608 | } |
| @@ -610,14 +610,14 @@ static void c4_handle_rx(avmcard *card) · 1 unmodified line | |||
| 610 | 610 | ||
| 611 | case RECEIVE_INIT: | 611 | case RECEIVE_INIT: |
| 612 | 612 | ||
| 613 | cidx = card->nlogcontr; | 613 | cidx = card->nlogcontr; |
| 614 | if (cidx >= card->nr_controllers) { | 614 | if (cidx >= card->nr_controllers) { |
| 615 | printk(KERN_ERR "%s: card with %d controllers ??\n", | 615 | printk(KERN_ERR "%s: card with %d controllers ??\n", |
| 616 | card->name, cidx+1); | 616 | card->name, cidx + 1); |
| 617 | break; | 617 | break; |
| 618 | } | 618 | } |
| 619 | card->nlogcontr++; | 619 | card->nlogcontr++; |
| 620 | cinfo = &card->ctrlinfo[cidx]; | 620 | cinfo = &card->ctrlinfo[cidx]; |
| 621 | ctrl = &cinfo->capi_ctrl; | 621 | ctrl = &cinfo->capi_ctrl; |
| 622 | cinfo->versionlen = _get_slice(&p, cinfo->versionbuf); | 622 | cinfo->versionlen = _get_slice(&p, cinfo->versionbuf); |
| 623 | b1_parse_version(cinfo); | 623 | b1_parse_version(cinfo); |
| @@ -632,23 +632,23 @@ static void c4_handle_rx(avmcard *card) · 8 unmodified lines | |||
| 632 | ApplId = (unsigned) _get_word(&p); | 632 | ApplId = (unsigned) _get_word(&p); |
| 633 | MsgLen = _get_slice(&p, card->msgbuf); | 633 | MsgLen = _get_slice(&p, card->msgbuf); |
| 634 | card->msgbuf[MsgLen] = 0; | 634 | card->msgbuf[MsgLen] = 0; |
| 635 | while ( MsgLen > 0 | 635 | while (MsgLen > 0 |
| 636 | && ( card->msgbuf[MsgLen-1] == '\n' | 636 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 637 | || card->msgbuf[MsgLen-1] == '\r')) { | 637 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 638 | card->msgbuf[MsgLen-1] = 0; | 638 | card->msgbuf[MsgLen - 1] = 0; |
| 639 | MsgLen--; | 639 | MsgLen--; |
| 640 | } | 640 | } |
| 641 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", | 641 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", |
| 642 | card->name, ApplId, card->msgbuf); | 642 | card->name, ApplId, card->msgbuf); |
| 643 | break; | 643 | break; |
| 644 | 644 | ||
| 645 | case RECEIVE_DEBUGMSG: | 645 | case RECEIVE_DEBUGMSG: |
| 646 | MsgLen = _get_slice(&p, card->msgbuf); | 646 | MsgLen = _get_slice(&p, card->msgbuf); |
| 647 | card->msgbuf[MsgLen] = 0; | 647 | card->msgbuf[MsgLen] = 0; |
| 648 | while ( MsgLen > 0 | 648 | while (MsgLen > 0 |
| 649 | && ( card->msgbuf[MsgLen-1] == '\n' | 649 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 650 | || card->msgbuf[MsgLen-1] == '\r')) { | 650 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 651 | card->msgbuf[MsgLen-1] = 0; | 651 | card->msgbuf[MsgLen - 1] = 0; |
| 652 | MsgLen--; | 652 | MsgLen--; |
| 653 | } | 653 | } |
| 654 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); | 654 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); |
| @@ -656,7 +656,7 @@ static void c4_handle_rx(avmcard *card) · 1 unmodified line | |||
| 656 | 656 | ||
| 657 | default: | 657 | default: |
| 658 | printk(KERN_ERR "%s: c4_interrupt: 0x%x ???\n", | 658 | printk(KERN_ERR "%s: c4_interrupt: 0x%x ???\n", |
| 659 | card->name, b1cmd); | 659 | card->name, b1cmd); |
| 660 | return; | 660 | return; |
| 661 | } | 661 | } |
| 662 | } | 662 | } |
| @@ -669,16 +669,16 @@ static irqreturn_t c4_handle_interrupt(avmcard *card) · 6 unmodified lines | |||
| 669 | u32 status; | 669 | u32 status; |
| 670 | 670 | ||
| 671 | spin_lock_irqsave(&card->lock, flags); | 671 | spin_lock_irqsave(&card->lock, flags); |
| 672 | status = c4inmeml(card->mbase+DOORBELL); | 672 | status = c4inmeml(card->mbase + DOORBELL); |
| 673 | 673 | ||
| 674 | if (status & DBELL_RESET_HOST) { | 674 | if (status & DBELL_RESET_HOST) { |
| 675 | u_int i; | 675 | u_int i; |
| 676 | c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c); | 676 | c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x0c); |
| 677 | spin_unlock_irqrestore(&card->lock, flags); | 677 | spin_unlock_irqrestore(&card->lock, flags); |
| 678 | if (card->nlogcontr == 0) | 678 | if (card->nlogcontr == 0) |
| 679 | return IRQ_HANDLED; | 679 | return IRQ_HANDLED; |
| 680 | printk(KERN_ERR "%s: unexpected reset\n", card->name); | 680 | printk(KERN_ERR "%s: unexpected reset\n", card->name); |
| 681 | for (i=0; i < card->nr_controllers; i++) { | 681 | for (i = 0; i < card->nr_controllers; i++) { |
| 682 | avmctrl_info *cinfo = &card->ctrlinfo[i]; | 682 | avmctrl_info *cinfo = &card->ctrlinfo[i]; |
| 683 | memset(cinfo->version, 0, sizeof(cinfo->version)); | 683 | memset(cinfo->version, 0, sizeof(cinfo->version)); |
| 684 | spin_lock_irqsave(&card->lock, flags); | 684 | spin_lock_irqsave(&card->lock, flags); |
| @@ -695,23 +695,23 @@ static irqreturn_t c4_handle_interrupt(avmcard *card) · 10 unmodified lines | |||
| 695 | spin_unlock_irqrestore(&card->lock, flags); | 695 | spin_unlock_irqrestore(&card->lock, flags); |
| 696 | return IRQ_HANDLED; | 696 | return IRQ_HANDLED; |
| 697 | } | 697 | } |
| 698 | c4outmeml(card->mbase+DOORBELL, status); | 698 | c4outmeml(card->mbase + DOORBELL, status); |
| 699 | 699 | ||
| 700 | if ((status & DBELL_UP_HOST) != 0) { | 700 | if ((status & DBELL_UP_HOST) != 0) { |
| 701 | card->dma->recvlen = c4inmeml(card->mbase+MBOX_UP_LEN); | 701 | card->dma->recvlen = c4inmeml(card->mbase + MBOX_UP_LEN); |
| 702 | c4outmeml(card->mbase+MBOX_UP_LEN, 0); | 702 | c4outmeml(card->mbase + MBOX_UP_LEN, 0); |
| 703 | c4_handle_rx(card); | 703 | c4_handle_rx(card); |
| 704 | card->dma->recvlen = 0; | 704 | card->dma->recvlen = 0; |
| 705 | c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size); | 705 | c4outmeml(card->mbase + MBOX_UP_LEN, card->dma->recvbuf.size); |
| 706 | c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM); | 706 | c4outmeml(card->mbase + DOORBELL, DBELL_UP_ARM); |
| 707 | } | 707 | } |
| 708 | 708 | ||
| 709 | if ((status & DBELL_DOWN_HOST) != 0) { | 709 | if ((status & DBELL_DOWN_HOST) != 0) { |
| 710 | card->csr &= ~DBELL_DOWN_ARM; | 710 | card->csr &= ~DBELL_DOWN_ARM; |
| 711 | c4_dispatch_tx(card); | 711 | c4_dispatch_tx(card); |
| 712 | } else if (card->csr & DBELL_DOWN_HOST) { | 712 | } else if (card->csr & DBELL_DOWN_HOST) { |
| 713 | if (c4inmeml(card->mbase+MBOX_DOWN_LEN) == 0) { | 713 | if (c4inmeml(card->mbase + MBOX_DOWN_LEN) == 0) { |
| 714 | card->csr &= ~DBELL_DOWN_ARM; | 714 | card->csr &= ~DBELL_DOWN_ARM; |
| 715 | c4_dispatch_tx(card); | 715 | c4_dispatch_tx(card); |
| 716 | } | 716 | } |
| 717 | } | 717 | } |
| @@ -737,7 +737,7 @@ static void c4_send_init(avmcard *card) · 19 unmodified lines | |||
| 737 | skb = alloc_skb(15, GFP_ATOMIC); | 737 | skb = alloc_skb(15, GFP_ATOMIC); |
| 738 | if (!skb) { | 738 | if (!skb) { |
| 739 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", | 739 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", |
| 740 | card->name); | 740 | card->name); |
| 741 | return; | 741 | return; |
| 742 | } | 742 | } |
| 743 | p = skb->data; | 743 | p = skb->data; |
| @@ -745,7 +745,7 @@ static void c4_send_init(avmcard *card) · 1 unmodified line | |||
| 745 | _put_byte(&p, 0); | 745 | _put_byte(&p, 0); |
| 746 | _put_byte(&p, SEND_INIT); | 746 | _put_byte(&p, SEND_INIT); |
| 747 | _put_word(&p, CAPI_MAXAPPL); | 747 | _put_word(&p, CAPI_MAXAPPL); |
| 748 | _put_word(&p, AVM_NCCI_PER_CHANNEL*30); | 748 | _put_word(&p, AVM_NCCI_PER_CHANNEL * 30); |
| 749 | _put_word(&p, card->cardnr - 1); | 749 | _put_word(&p, card->cardnr - 1); |
| 750 | skb_put(skb, (u8 *)p - (u8 *)skb->data); | 750 | skb_put(skb, (u8 *)p - (u8 *)skb->data); |
| 751 | 751 | ||
| @@ -761,10 +761,10 @@ static int queue_sendconfigword(avmcard *card, u32 val) · 9 unmodified lines | |||
| 761 | unsigned long flags; | 761 | unsigned long flags; |
| 762 | void *p; | 762 | void *p; |
| 763 | 763 | ||
| 764 | skb = alloc_skb(3+4, GFP_ATOMIC); | 764 | skb = alloc_skb(3 + 4, GFP_ATOMIC); |
| 765 | if (!skb) { | 765 | if (!skb) { |
| 766 | printk(KERN_CRIT "%s: no memory, send config\n", | 766 | printk(KERN_CRIT "%s: no memory, send config\n", |
| 767 | card->name); | 767 | card->name); |
| 768 | return -ENOMEM; | 768 | return -ENOMEM; |
| 769 | } | 769 | } |
| 770 | p = skb->data; | 770 | p = skb->data; |
| @@ -787,10 +787,10 @@ static int queue_sendconfig(avmcard *card, char cval[4]) · 16 unmodified lines | |||
| 787 | unsigned long flags; | 787 | unsigned long flags; |
| 788 | void *p; | 788 | void *p; |
| 789 | 789 | ||
| 790 | skb = alloc_skb(3+4, GFP_ATOMIC); | 790 | skb = alloc_skb(3 + 4, GFP_ATOMIC); |
| 791 | if (!skb) { | 791 | if (!skb) { |
| 792 | printk(KERN_CRIT "%s: no memory, send config\n", | 792 | printk(KERN_CRIT "%s: no memory, send config\n", |
| 793 | card->name); | 793 | card->name); |
| 794 | return -ENOMEM; | 794 | return -ENOMEM; |
| 795 | } | 795 | } |
| 796 | p = skb->data; | 796 | p = skb->data; |
| @@ -804,20 +804,20 @@ static int queue_sendconfig(avmcard *card, char cval[4]) · 7 unmodified lines | |||
| 804 | skb_put(skb, (u8 *)p - (u8 *)skb->data); | 804 | skb_put(skb, (u8 *)p - (u8 *)skb->data); |
| 805 | 805 | ||
| 806 | skb_queue_tail(&card->dma->send_queue, skb); | 806 | skb_queue_tail(&card->dma->send_queue, skb); |
| 807 | 807 | ||
| 808 | spin_lock_irqsave(&card->lock, flags); | 808 | spin_lock_irqsave(&card->lock, flags); |
| 809 | c4_dispatch_tx(card); | 809 | c4_dispatch_tx(card); |
| 810 | spin_unlock_irqrestore(&card->lock, flags); | 810 | spin_unlock_irqrestore(&card->lock, flags); |
| 811 | return 0; | 811 | return 0; |
| 812 | } | 812 | } |
| 813 | 813 | ||
| 814 | static int c4_send_config(avmcard *card, capiloaddatapart * config) | 814 | static int c4_send_config(avmcard *card, capiloaddatapart *config) |
| 815 | { | 815 | { |
| 816 | u8 val[4]; | 816 | u8 val[4]; |
| 817 | unsigned char *dp; | 817 | unsigned char *dp; |
| 818 | u_int left; | 818 | u_int left; |
| 819 | int retval; | 819 | int retval; |
| 820 | 820 | ||
| 821 | if ((retval = queue_sendconfigword(card, 1)) != 0) | 821 | if ((retval = queue_sendconfigword(card, 1)) != 0) |
| 822 | return retval; | 822 | return retval; |
| 823 | if ((retval = queue_sendconfigword(card, config->len)) != 0) | 823 | if ((retval = queue_sendconfigword(card, config->len)) != 0) |
| @@ -826,7 +826,7 @@ static int c4_send_config(avmcard *card, capiloaddatapart * config) · 2 unmodified lines | |||
| 826 | dp = config->data; | 826 | dp = config->data; |
| 827 | left = config->len; | 827 | left = config->len; |
| 828 | while (left >= sizeof(u32)) { | 828 | while (left >= sizeof(u32)) { |
| 829 | if (config->user) { | 829 | if (config->user) { |
| 830 | if (copy_from_user(val, dp, sizeof(val))) | 830 | if (copy_from_user(val, dp, sizeof(val))) |
| 831 | return -EFAULT; | 831 | return -EFAULT; |
| 832 | } else { | 832 | } else { |
| @@ -860,37 +860,37 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 27 unmodified lines | |||
| 860 | 860 | ||
| 861 | if ((retval = c4_load_t4file(card, &data->firmware))) { | 861 | if ((retval = c4_load_t4file(card, &data->firmware))) { |
| 862 | printk(KERN_ERR "%s: failed to load t4file!!\n", | 862 | printk(KERN_ERR "%s: failed to load t4file!!\n", |
| 863 | card->name); | 863 | card->name); |
| 864 | c4_reset(card); | 864 | c4_reset(card); |
| 865 | return retval; | 865 | return retval; |
| 866 | } | 866 | } |
| 867 | 867 | ||
| 868 | card->csr = 0; | 868 | card->csr = 0; |
| 869 | c4outmeml(card->mbase+MBOX_UP_LEN, 0); | 869 | c4outmeml(card->mbase + MBOX_UP_LEN, 0); |
| 870 | c4outmeml(card->mbase+MBOX_DOWN_LEN, 0); | 870 | c4outmeml(card->mbase + MBOX_DOWN_LEN, 0); |
| 871 | c4outmeml(card->mbase+DOORBELL, DBELL_INIT); | 871 | c4outmeml(card->mbase + DOORBELL, DBELL_INIT); |
| 872 | mdelay(1); | 872 | mdelay(1); |
| 873 | c4outmeml(card->mbase+DOORBELL, | 873 | c4outmeml(card->mbase + DOORBELL, |
| 874 | DBELL_UP_HOST | DBELL_DOWN_HOST | DBELL_RESET_HOST); | 874 | DBELL_UP_HOST | DBELL_DOWN_HOST | DBELL_RESET_HOST); |
| 875 | 875 | ||
| 876 | c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x08); | 876 | c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x08); |
| 877 | 877 | ||
| 878 | card->dma->recvlen = 0; | 878 | card->dma->recvlen = 0; |
| 879 | c4outmeml(card->mbase+MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr); | 879 | c4outmeml(card->mbase + MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr); |
| 880 | c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size); | 880 | c4outmeml(card->mbase + MBOX_UP_LEN, card->dma->recvbuf.size); |
| 881 | c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM); | 881 | c4outmeml(card->mbase + DOORBELL, DBELL_UP_ARM); |
| 882 | 882 | ||
| 883 | if (data->configuration.len > 0 && data->configuration.data) { | 883 | if (data->configuration.len > 0 && data->configuration.data) { |
| 884 | retval = c4_send_config(card, &data->configuration); | 884 | retval = c4_send_config(card, &data->configuration); |
| 885 | if (retval) { | 885 | if (retval) { |
| 886 | printk(KERN_ERR "%s: failed to set config!!\n", | 886 | printk(KERN_ERR "%s: failed to set config!!\n", |
| 887 | card->name); | 887 | card->name); |
| 888 | c4_reset(card); | 888 | c4_reset(card); |
| 889 | return retval; | 889 | return retval; |
| 890 | } | 890 | } |
| 891 | } | 891 | } |
| 892 | 892 | ||
| 893 | c4_send_init(card); | 893 | c4_send_init(card); |
| 894 | 894 | ||
| 895 | return 0; | 895 | return 0; |
| 896 | } | 896 | } |
| @@ -905,11 +905,11 @@ static void c4_reset_ctr(struct capi_ctr *ctrl) · 8 unmodified lines | |||
| 905 | 905 | ||
| 906 | spin_lock_irqsave(&card->lock, flags); | 906 | spin_lock_irqsave(&card->lock, flags); |
| 907 | 907 | ||
| 908 | c4_reset(card); | 908 | c4_reset(card); |
| 909 | 909 | ||
| 910 | spin_unlock_irqrestore(&card->lock, flags); | 910 | spin_unlock_irqrestore(&card->lock, flags); |
| 911 | 911 | ||
| 912 | for (i=0; i < card->nr_controllers; i++) { | 912 | for (i = 0; i < card->nr_controllers; i++) { |
| 913 | cinfo = &card->ctrlinfo[i]; | 913 | cinfo = &card->ctrlinfo[i]; |
| 914 | memset(cinfo->version, 0, sizeof(cinfo->version)); | 914 | memset(cinfo->version, 0, sizeof(cinfo->version)); |
| 915 | capi_ctr_down(&cinfo->capi_ctrl); | 915 | capi_ctr_down(&cinfo->capi_ctrl); |
| @@ -926,9 +926,9 @@ static void c4_remove(struct pci_dev *pdev) · 10 unmodified lines | |||
| 926 | if (!card) | 926 | if (!card) |
| 927 | return; | 927 | return; |
| 928 | 928 | ||
| 929 | c4_reset(card); | 929 | c4_reset(card); |
| 930 | 930 | ||
| 931 | for (i=0; i < card->nr_controllers; i++) { | 931 | for (i = 0; i < card->nr_controllers; i++) { |
| 932 | cinfo = &card->ctrlinfo[i]; | 932 | cinfo = &card->ctrlinfo[i]; |
| 933 | detach_capi_ctr(&cinfo->capi_ctrl); | 933 | detach_capi_ctr(&cinfo->capi_ctrl); |
| 934 | } | 934 | } |
| @@ -936,8 +936,8 @@ static void c4_remove(struct pci_dev *pdev) · 1 unmodified line | |||
| 936 | free_irq(card->irq, card); | 936 | free_irq(card->irq, card); |
| 937 | iounmap(card->mbase); | 937 | iounmap(card->mbase); |
| 938 | release_region(card->port, AVMB1_PORTLEN); | 938 | release_region(card->port, AVMB1_PORTLEN); |
| 939 | avmcard_dma_free(card->dma); | 939 | avmcard_dma_free(card->dma); |
| 940 | pci_set_drvdata(pdev, NULL); | 940 | pci_set_drvdata(pdev, NULL); |
| 941 | b1_free_card(card); | 941 | b1_free_card(card); |
| 942 | } | 942 | } |
| 943 | 943 | ||
| @@ -945,8 +945,8 @@ static void c4_remove(struct pci_dev *pdev) · 1 unmodified line | |||
| 945 | 945 | ||
| 946 | 946 | ||
| 947 | static void c4_register_appl(struct capi_ctr *ctrl, | 947 | static void c4_register_appl(struct capi_ctr *ctrl, |
| 948 | u16 appl, | 948 | u16 appl, |
| 949 | capi_register_params *rp) | 949 | capi_register_params *rp) |
| 950 | { | 950 | { |
| 951 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); | 951 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); |
| 952 | avmcard *card = cinfo->card; | 952 | avmcard *card = cinfo->card; |
| @@ -965,7 +965,7 @@ static void c4_register_appl(struct capi_ctr *ctrl, · 12 unmodified lines | |||
| 965 | skb = alloc_skb(23, GFP_ATOMIC); | 965 | skb = alloc_skb(23, GFP_ATOMIC); |
| 966 | if (!skb) { | 966 | if (!skb) { |
| 967 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", | 967 | printk(KERN_CRIT "%s: no memory, lost register appl.\n", |
| 968 | card->name); | 968 | card->name); |
| 969 | return; | 969 | return; |
| 970 | } | 970 | } |
| 971 | p = skb->data; | 971 | p = skb->data; |
| @@ -973,14 +973,14 @@ static void c4_register_appl(struct capi_ctr *ctrl, · 1 unmodified line | |||
| 973 | _put_byte(&p, 0); | 973 | _put_byte(&p, 0); |
| 974 | _put_byte(&p, SEND_REGISTER); | 974 | _put_byte(&p, SEND_REGISTER); |
| 975 | _put_word(&p, appl); | 975 | _put_word(&p, appl); |
| 976 | _put_word(&p, 1024 * (nconn+1)); | 976 | _put_word(&p, 1024 * (nconn + 1)); |
| 977 | _put_word(&p, nconn); | 977 | _put_word(&p, nconn); |
| 978 | _put_word(&p, rp->datablkcnt); | 978 | _put_word(&p, rp->datablkcnt); |
| 979 | _put_word(&p, rp->datablklen); | 979 | _put_word(&p, rp->datablklen); |
| 980 | skb_put(skb, (u8 *)p - (u8 *)skb->data); | 980 | skb_put(skb, (u8 *)p - (u8 *)skb->data); |
| 981 | 981 | ||
| 982 | skb_queue_tail(&card->dma->send_queue, skb); | 982 | skb_queue_tail(&card->dma->send_queue, skb); |
| 983 | 983 | ||
| 984 | spin_lock_irqsave(&card->lock, flags); | 984 | spin_lock_irqsave(&card->lock, flags); |
| 985 | c4_dispatch_tx(card); | 985 | c4_dispatch_tx(card); |
| 986 | spin_unlock_irqrestore(&card->lock, flags); | 986 | spin_unlock_irqrestore(&card->lock, flags); |
| @@ -1005,7 +1005,7 @@ static void c4_release_appl(struct capi_ctr *ctrl, u16 appl) · 18 unmodified lines | |||
| 1005 | skb = alloc_skb(7, GFP_ATOMIC); | 1005 | skb = alloc_skb(7, GFP_ATOMIC); |
| 1006 | if (!skb) { | 1006 | if (!skb) { |
| 1007 | printk(KERN_CRIT "%s: no memory, lost release appl.\n", | 1007 | printk(KERN_CRIT "%s: no memory, lost release appl.\n", |
| 1008 | card->name); | 1008 | card->name); |
| 1009 | return; | 1009 | return; |
| 1010 | } | 1010 | } |
| 1011 | p = skb->data; | 1011 | p = skb->data; |
| @@ -1098,29 +1098,29 @@ static int c4_proc_show(struct seq_file *m, void *v) · 86 unmodified lines | |||
| 1098 | seq_printf(m, "%-16s %s\n", "ver_serial", s); | 1098 | seq_printf(m, "%-16s %s\n", "ver_serial", s); |
| 1099 | 1099 | ||
| 1100 | if (card->cardtype != avm_m1) { | 1100 | if (card->cardtype != avm_m1) { |
| 1101 | flag = ((u8 *)(ctrl->profile.manu))[3]; | 1101 | flag = ((u8 *)(ctrl->profile.manu))[3]; |
| 1102 | if (flag) | 1102 | if (flag) |
| 1103 | seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", | 1103 | seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", |
| 1104 | "protocol", | 1104 | "protocol", |
| 1105 | (flag & 0x01) ? " DSS1" : "", | 1105 | (flag & 0x01) ? " DSS1" : "", |
| 1106 | (flag & 0x02) ? " CT1" : "", | 1106 | (flag & 0x02) ? " CT1" : "", |
| 1107 | (flag & 0x04) ? " VN3" : "", | 1107 | (flag & 0x04) ? " VN3" : "", |
| 1108 | (flag & 0x08) ? " NI1" : "", | 1108 | (flag & 0x08) ? " NI1" : "", |
| 1109 | (flag & 0x10) ? " AUSTEL" : "", | 1109 | (flag & 0x10) ? " AUSTEL" : "", |
| 1110 | (flag & 0x20) ? " ESS" : "", | 1110 | (flag & 0x20) ? " ESS" : "", |
| 1111 | (flag & 0x40) ? " 1TR6" : "" | 1111 | (flag & 0x40) ? " 1TR6" : "" |
| 1112 | ); | 1112 | ); |
| 1113 | } | 1113 | } |
| 1114 | if (card->cardtype != avm_m1) { | 1114 | if (card->cardtype != avm_m1) { |
| 1115 | flag = ((u8 *)(ctrl->profile.manu))[5]; | 1115 | flag = ((u8 *)(ctrl->profile.manu))[5]; |
| 1116 | if (flag) | 1116 | if (flag) |
| 1117 | seq_printf(m, "%-16s%s%s%s%s\n", | 1117 | seq_printf(m, "%-16s%s%s%s%s\n", |
| 1118 | "linetype", | 1118 | "linetype", |
| 1119 | (flag & 0x01) ? " point to point" : "", | 1119 | (flag & 0x01) ? " point to point" : "", |
| 1120 | (flag & 0x02) ? " point to multipoint" : "", | 1120 | (flag & 0x02) ? " point to multipoint" : "", |
| 1121 | (flag & 0x08) ? " leased line without D-channel" : "", | 1121 | (flag & 0x08) ? " leased line without D-channel" : "", |
| 1122 | (flag & 0x04) ? " leased line with D-channel" : "" | 1122 | (flag & 0x04) ? " leased line with D-channel" : "" |
| 1123 | ); | 1123 | ); |
| 1124 | } | 1124 | } |
| 1125 | seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); | 1125 | seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); |
| 1126 | 1126 | ||
| @@ -1156,7 +1156,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, · 29 unmodified lines | |||
| 1156 | retval = -ENOMEM; | 1156 | retval = -ENOMEM; |
| 1157 | goto err; | 1157 | goto err; |
| 1158 | } | 1158 | } |
| 1159 | card->dma = avmcard_dma_alloc("c4", dev, 2048+128, 2048+128); | 1159 | card->dma = avmcard_dma_alloc("c4", dev, 2048 + 128, 2048 + 128); |
| 1160 | if (!card->dma) { | 1160 | if (!card->dma) { |
| 1161 | printk(KERN_WARNING "c4: no memory.\n"); | 1161 | printk(KERN_WARNING "c4: no memory.\n"); |
| 1162 | retval = -ENOMEM; | 1162 | retval = -ENOMEM; |
| @@ -1195,12 +1195,12 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, · 32 unmodified lines | |||
| 1195 | 1195 | ||
| 1196 | retval = request_irq(card->irq, c4_interrupt, IRQF_SHARED, card->name, card); | 1196 | retval = request_irq(card->irq, c4_interrupt, IRQF_SHARED, card->name, card); |
| 1197 | if (retval) { | 1197 | if (retval) { |
| 1198 | printk(KERN_ERR "c4: unable to get IRQ %d.\n",card->irq); | 1198 | printk(KERN_ERR "c4: unable to get IRQ %d.\n", card->irq); |
| 1199 | retval = -EBUSY; | 1199 | retval = -EBUSY; |
| 1200 | goto err_unmap; | 1200 | goto err_unmap; |
| 1201 | } | 1201 | } |
| 1202 | 1202 | ||
| 1203 | for (i=0; i < nr_controllers ; i++) { | 1203 | for (i = 0; i < nr_controllers; i++) { |
| 1204 | cinfo = &card->ctrlinfo[i]; | 1204 | cinfo = &card->ctrlinfo[i]; |
| 1205 | cinfo->capi_ctrl.owner = THIS_MODULE; | 1205 | cinfo->capi_ctrl.owner = THIS_MODULE; |
| 1206 | cinfo->capi_ctrl.driver_name = "c4"; | 1206 | cinfo->capi_ctrl.driver_name = "c4"; |
| @@ -1233,17 +1233,17 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, · 26 unmodified lines | |||
| 1233 | pci_set_drvdata(dev, card); | 1233 | pci_set_drvdata(dev, card); |
| 1234 | return 0; | 1234 | return 0; |
| 1235 | 1235 | ||
| 1236 | err_free_irq: | 1236 | err_free_irq: |
| 1237 | free_irq(card->irq, card); | 1237 | free_irq(card->irq, card); |
| 1238 | err_unmap: | 1238 | err_unmap: |
| 1239 | iounmap(card->mbase); | 1239 | iounmap(card->mbase); |
| 1240 | err_release_region: | 1240 | err_release_region: |
| 1241 | release_region(card->port, AVMB1_PORTLEN); | 1241 | release_region(card->port, AVMB1_PORTLEN); |
| 1242 | err_free_dma: | 1242 | err_free_dma: |
| 1243 | avmcard_dma_free(card->dma); | 1243 | avmcard_dma_free(card->dma); |
| 1244 | err_free: | 1244 | err_free: |
| 1245 | b1_free_card(card); | 1245 | b1_free_card(card); |
| 1246 | err: | 1246 | err: |
| 1247 | return retval; | 1247 | return retval; |
| 1248 | } | 1248 | } |
| 1249 | 1249 | ||
| @@ -1265,10 +1265,10 @@ static int __devinit c4_probe(struct pci_dev *dev, · 15 unmodified lines | |||
| 1265 | param.port = pci_resource_start(dev, 1); | 1265 | param.port = pci_resource_start(dev, 1); |
| 1266 | param.irq = dev->irq; | 1266 | param.irq = dev->irq; |
| 1267 | param.membase = pci_resource_start(dev, 0); | 1267 | param.membase = pci_resource_start(dev, 0); |
| 1268 | 1268 | ||
| 1269 | printk(KERN_INFO "c4: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n", | 1269 | printk(KERN_INFO "c4: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n", |
| 1270 | nr, param.port, param.irq, param.membase); | 1270 | nr, param.port, param.irq, param.membase); |
| 1271 | 1271 | ||
| 1272 | retval = c4_add_card(¶m, dev, nr); | 1272 | retval = c4_add_card(¶m, dev, nr); |
| 1273 | if (retval != 0) { | 1273 | if (retval != 0) { |
| 1274 | printk(KERN_ERR "c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n", | 1274 | printk(KERN_ERR "c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n", |
| @@ -1280,10 +1280,10 @@ static int __devinit c4_probe(struct pci_dev *dev, · 5 unmodified lines | |||
| 1280 | } | 1280 | } |
| 1281 | 1281 | ||
| 1282 | static struct pci_driver c4_pci_driver = { | 1282 | static struct pci_driver c4_pci_driver = { |
| 1283 | .name = "c4", | 1283 | .name = "c4", |
| 1284 | .id_table = c4_pci_tbl, | 1284 | .id_table = c4_pci_tbl, |
| 1285 | .probe = c4_probe, | 1285 | .probe = c4_probe, |
| 1286 | .remove = c4_remove, | 1286 | .remove = c4_remove, |
| 1287 | }; | 1287 | }; |
| 1288 | 1288 | ||
| 1289 | static struct capi_driver capi_driver_c2 = { | 1289 | static struct capi_driver capi_driver_c2 = { |
| @@ -1305,7 +1305,7 @@ static int __init c4_init(void) · 15 unmodified lines | |||
| 1305 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 1305 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 1306 | strlcpy(rev, p + 2, 32); | 1306 | strlcpy(rev, p + 2, 32); |
| 1307 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 1307 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 1308 | *(p-1) = 0; | 1308 | *(p - 1) = 0; |
| 1309 | } else | 1309 | } else |
| 1310 | strcpy(rev, "1.0"); | 1310 | strcpy(rev, "1.0"); |
| 1311 | 1311 | ||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* $Id: t1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ | 1 | /* $Id: t1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Module for AVM T1 HEMA-card. | 3 | * Module for AVM T1 HEMA-card. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -67,7 +67,7 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr) · 57 unmodified lines | |||
| 67 | int i; | 67 | int i; |
| 68 | 68 | ||
| 69 | reverse_cardnr = ((cardnr & 0x01) << 3) | ((cardnr & 0x02) << 1) | 69 | reverse_cardnr = ((cardnr & 0x01) << 3) | ((cardnr & 0x02) << 1) |
| 70 | | ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3); | 70 | | ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3); |
| 71 | cregs[0] = (HEMA_VERSION_ID << 4) | (reverse_cardnr & 0xf); | 71 | cregs[0] = (HEMA_VERSION_ID << 4) | (reverse_cardnr & 0xf); |
| 72 | cregs[1] = 0x00; /* fast & slow link connected to CON1 */ | 72 | cregs[1] = 0x00; /* fast & slow link connected to CON1 */ |
| 73 | cregs[2] = 0x05; /* fast link 20MBit, slow link 20 MBit */ | 73 | cregs[2] = 0x05; /* fast link 20MBit, slow link 20 MBit */ |
| @@ -86,50 +86,50 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr) · 12 unmodified lines | |||
| 86 | /* board reset */ | 86 | /* board reset */ |
| 87 | t1outp(base, T1_RESETBOARD, 0xf); | 87 | t1outp(base, T1_RESETBOARD, 0xf); |
| 88 | mdelay(100); | 88 | mdelay(100); |
| 89 | dummy = t1inp(base, T1_FASTLINK+T1_OUTSTAT); /* first read */ | 89 | dummy = t1inp(base, T1_FASTLINK + T1_OUTSTAT); /* first read */ |
| 90 | 90 | ||
| 91 | /* write config */ | 91 | /* write config */ |
| 92 | dummy = (base >> 4) & 0xff; | 92 | dummy = (base >> 4) & 0xff; |
| 93 | for (i=1;i<=0xf;i++) t1outp(base, i, dummy); | 93 | for (i = 1; i <= 0xf; i++) t1outp(base, i, dummy); |
| 94 | t1outp(base, HEMA_PAL_ID & 0xf, dummy); | 94 | t1outp(base, HEMA_PAL_ID & 0xf, dummy); |
| 95 | t1outp(base, HEMA_PAL_ID >> 4, cregs[0]); | 95 | t1outp(base, HEMA_PAL_ID >> 4, cregs[0]); |
| 96 | for(i=1;i<7;i++) t1outp(base, 0, cregs[i]); | 96 | for (i = 1; i < 7; i++) t1outp(base, 0, cregs[i]); |
| 97 | t1outp(base, ((base >> 4)) & 0x3, cregs[7]); | 97 | t1outp(base, ((base >> 4)) & 0x3, cregs[7]); |
| 98 | /* restore_flags(flags); */ | 98 | /* restore_flags(flags); */ |
| 99 | 99 | ||
| 100 | mdelay(100); | 100 | mdelay(100); |
| 101 | t1outp(base, T1_FASTLINK+T1_RESETLINK, 0); | 101 | t1outp(base, T1_FASTLINK + T1_RESETLINK, 0); |
| 102 | t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0); | 102 | t1outp(base, T1_SLOWLINK + T1_RESETLINK, 0); |
| 103 | mdelay(10); | 103 | mdelay(10); |
| 104 | t1outp(base, T1_FASTLINK+T1_RESETLINK, 1); | 104 | t1outp(base, T1_FASTLINK + T1_RESETLINK, 1); |
| 105 | t1outp(base, T1_SLOWLINK+T1_RESETLINK, 1); | 105 | t1outp(base, T1_SLOWLINK + T1_RESETLINK, 1); |
| 106 | mdelay(100); | 106 | mdelay(100); |
| 107 | t1outp(base, T1_FASTLINK+T1_RESETLINK, 0); | 107 | t1outp(base, T1_FASTLINK + T1_RESETLINK, 0); |
| 108 | t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0); | 108 | t1outp(base, T1_SLOWLINK + T1_RESETLINK, 0); |
| 109 | mdelay(10); | 109 | mdelay(10); |
| 110 | t1outp(base, T1_FASTLINK+T1_ANALYSE, 0); | 110 | t1outp(base, T1_FASTLINK + T1_ANALYSE, 0); |
| 111 | mdelay(5); | 111 | mdelay(5); |
| 112 | t1outp(base, T1_SLOWLINK+T1_ANALYSE, 0); | 112 | t1outp(base, T1_SLOWLINK + T1_ANALYSE, 0); |
| 113 | 113 | ||
| 114 | if (t1inp(base, T1_FASTLINK+T1_OUTSTAT) != 0x1) /* tx empty */ | 114 | if (t1inp(base, T1_FASTLINK + T1_OUTSTAT) != 0x1) /* tx empty */ |
| 115 | return 1; | 115 | return 1; |
| 116 | if (t1inp(base, T1_FASTLINK+T1_INSTAT) != 0x0) /* rx empty */ | 116 | if (t1inp(base, T1_FASTLINK + T1_INSTAT) != 0x0) /* rx empty */ |
| 117 | return 2; | 117 | return 2; |
| 118 | if (t1inp(base, T1_FASTLINK+T1_IRQENABLE) != 0x0) | 118 | if (t1inp(base, T1_FASTLINK + T1_IRQENABLE) != 0x0) |
| 119 | return 3; | 119 | return 3; |
| 120 | if ((t1inp(base, T1_FASTLINK+T1_FIFOSTAT) & 0xf0) != 0x70) | 120 | if ((t1inp(base, T1_FASTLINK + T1_FIFOSTAT) & 0xf0) != 0x70) |
| 121 | return 4; | 121 | return 4; |
| 122 | if ((t1inp(base, T1_FASTLINK+T1_IRQMASTER) & 0x0e) != 0) | 122 | if ((t1inp(base, T1_FASTLINK + T1_IRQMASTER) & 0x0e) != 0) |
| 123 | return 5; | 123 | return 5; |
| 124 | if ((t1inp(base, T1_FASTLINK+T1_IDENT) & 0x7d) != 1) | 124 | if ((t1inp(base, T1_FASTLINK + T1_IDENT) & 0x7d) != 1) |
| 125 | return 6; | 125 | return 6; |
| 126 | if (t1inp(base, T1_SLOWLINK+T1_OUTSTAT) != 0x1) /* tx empty */ | 126 | if (t1inp(base, T1_SLOWLINK + T1_OUTSTAT) != 0x1) /* tx empty */ |
| 127 | return 7; | 127 | return 7; |
| 128 | if ((t1inp(base, T1_SLOWLINK+T1_IRQMASTER) & 0x0e) != 0) | 128 | if ((t1inp(base, T1_SLOWLINK + T1_IRQMASTER) & 0x0e) != 0) |
| 129 | return 8; | 129 | return 8; |
| 130 | if ((t1inp(base, T1_SLOWLINK+T1_IDENT) & 0x7d) != 0) | 130 | if ((t1inp(base, T1_SLOWLINK + T1_IDENT) & 0x7d) != 0) |
| 131 | return 9; | 131 | return 9; |
| 132 | return 0; | 132 | return 0; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) | 135 | static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) |
| @@ -163,13 +163,13 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) · 27 unmodified lines | |||
| 163 | spin_unlock_irqrestore(&card->lock, flags); | 163 | spin_unlock_irqrestore(&card->lock, flags); |
| 164 | 164 | ||
| 165 | if (MsgLen < 30) { /* not CAPI 64Bit */ | 165 | if (MsgLen < 30) { /* not CAPI 64Bit */ |
| 166 | memset(card->msgbuf+MsgLen, 0, 30-MsgLen); | 166 | memset(card->msgbuf + MsgLen, 0, 30 - MsgLen); |
| 167 | MsgLen = 30; | 167 | MsgLen = 30; |
| 168 | CAPIMSG_SETLEN(card->msgbuf, 30); | 168 | CAPIMSG_SETLEN(card->msgbuf, 30); |
| 169 | } | 169 | } |
| 170 | if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) { | 170 | if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { |
| 171 | printk(KERN_ERR "%s: incoming packet dropped\n", | 171 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 172 | card->name); | 172 | card->name); |
| 173 | } else { | 173 | } else { |
| 174 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 174 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| 175 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); | 175 | memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); |
| @@ -184,7 +184,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) · 8 unmodified lines | |||
| 184 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { | 184 | if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { |
| 185 | spin_unlock_irqrestore(&card->lock, flags); | 185 | spin_unlock_irqrestore(&card->lock, flags); |
| 186 | printk(KERN_ERR "%s: incoming packet dropped\n", | 186 | printk(KERN_ERR "%s: incoming packet dropped\n", |
| 187 | card->name); | 187 | card->name); |
| 188 | } else { | 188 | } else { |
| 189 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 189 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
| 190 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3) | 190 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3) |
| @@ -242,24 +242,24 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) · 51 unmodified lines | |||
| 242 | MsgLen = t1_get_slice(card->port, card->msgbuf); | 242 | MsgLen = t1_get_slice(card->port, card->msgbuf); |
| 243 | spin_unlock_irqrestore(&card->lock, flags); | 243 | spin_unlock_irqrestore(&card->lock, flags); |
| 244 | card->msgbuf[MsgLen] = 0; | 244 | card->msgbuf[MsgLen] = 0; |
| 245 | while ( MsgLen > 0 | 245 | while (MsgLen > 0 |
| 246 | && ( card->msgbuf[MsgLen-1] == '\n' | 246 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 247 | || card->msgbuf[MsgLen-1] == '\r')) { | 247 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 248 | card->msgbuf[MsgLen-1] = 0; | 248 | card->msgbuf[MsgLen - 1] = 0; |
| 249 | MsgLen--; | 249 | MsgLen--; |
| 250 | } | 250 | } |
| 251 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", | 251 | printk(KERN_INFO "%s: task %d \"%s\" ready.\n", |
| 252 | card->name, ApplId, card->msgbuf); | 252 | card->name, ApplId, card->msgbuf); |
| 253 | break; | 253 | break; |
| 254 | 254 | ||
| 255 | case RECEIVE_DEBUGMSG: | 255 | case RECEIVE_DEBUGMSG: |
| 256 | MsgLen = t1_get_slice(card->port, card->msgbuf); | 256 | MsgLen = t1_get_slice(card->port, card->msgbuf); |
| 257 | spin_unlock_irqrestore(&card->lock, flags); | 257 | spin_unlock_irqrestore(&card->lock, flags); |
| 258 | card->msgbuf[MsgLen] = 0; | 258 | card->msgbuf[MsgLen] = 0; |
| 259 | while ( MsgLen > 0 | 259 | while (MsgLen > 0 |
| 260 | && ( card->msgbuf[MsgLen-1] == '\n' | 260 | && (card->msgbuf[MsgLen - 1] == '\n' |
| 261 | || card->msgbuf[MsgLen-1] == '\r')) { | 261 | || card->msgbuf[MsgLen - 1] == '\r')) { |
| 262 | card->msgbuf[MsgLen-1] = 0; | 262 | card->msgbuf[MsgLen - 1] = 0; |
| 263 | MsgLen--; | 263 | MsgLen--; |
| 264 | } | 264 | } |
| 265 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); | 265 | printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); |
| @@ -273,7 +273,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) · 7 unmodified lines | |||
| 273 | default: | 273 | default: |
| 274 | spin_unlock_irqrestore(&card->lock, flags); | 274 | spin_unlock_irqrestore(&card->lock, flags); |
| 275 | printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", | 275 | printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", |
| 276 | card->name, b1cmd); | 276 | card->name, b1cmd); |
| 277 | return IRQ_NONE; | 277 | return IRQ_NONE; |
| 278 | } | 278 | } |
| 279 | } | 279 | } |
| @@ -296,7 +296,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 16 unmodified lines | |||
| 296 | if ((retval = b1_load_t4file(card, &data->firmware))) { | 296 | if ((retval = b1_load_t4file(card, &data->firmware))) { |
| 297 | b1_reset(port); | 297 | b1_reset(port); |
| 298 | printk(KERN_ERR "%s: failed to load t4file!!\n", | 298 | printk(KERN_ERR "%s: failed to load t4file!!\n", |
| 299 | card->name); | 299 | card->name); |
| 300 | return retval; | 300 | return retval; |
| 301 | } | 301 | } |
| 302 | 302 | ||
| @@ -304,7 +304,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 1 unmodified line | |||
| 304 | if ((retval = b1_load_config(card, &data->configuration))) { | 304 | if ((retval = b1_load_config(card, &data->configuration))) { |
| 305 | b1_reset(port); | 305 | b1_reset(port); |
| 306 | printk(KERN_ERR "%s: failed to load config!!\n", | 306 | printk(KERN_ERR "%s: failed to load config!!\n", |
| 307 | card->name); | 307 | card->name); |
| 308 | return retval; | 308 | return retval; |
| 309 | } | 309 | } |
| 310 | } | 310 | } |
| @@ -318,7 +318,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) · 7 unmodified lines | |||
| 318 | b1_setinterrupt(port, card->irq, card->cardtype); | 318 | b1_setinterrupt(port, card->irq, card->cardtype); |
| 319 | b1_put_byte(port, SEND_INIT); | 319 | b1_put_byte(port, SEND_INIT); |
| 320 | b1_put_word(port, CAPI_MAXAPPL); | 320 | b1_put_word(port, CAPI_MAXAPPL); |
| 321 | b1_put_word(port, AVM_NCCI_PER_CHANNEL*30); | 321 | b1_put_word(port, AVM_NCCI_PER_CHANNEL * 30); |
| 322 | b1_put_word(port, ctrl->cnr - 1); | 322 | b1_put_word(port, ctrl->cnr - 1); |
| 323 | spin_unlock_irqrestore(&card->lock, flags); | 323 | spin_unlock_irqrestore(&card->lock, flags); |
| 324 | 324 | ||
| @@ -347,7 +347,7 @@ static void t1isa_remove(struct pci_dev *pdev) · 22 unmodified lines | |||
| 347 | { | 347 | { |
| 348 | avmctrl_info *cinfo = pci_get_drvdata(pdev); | 348 | avmctrl_info *cinfo = pci_get_drvdata(pdev); |
| 349 | avmcard *card; | 349 | avmcard *card; |
| 350 | 350 | ||
| 351 | if (!cinfo) | 351 | if (!cinfo) |
| 352 | return; | 352 | return; |
| 353 | 353 | ||
| @@ -393,7 +393,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) · 39 unmodified lines | |||
| 393 | printk(KERN_WARNING "t1isa: invalid port 0x%x.\n", card->port); | 393 | printk(KERN_WARNING "t1isa: invalid port 0x%x.\n", card->port); |
| 394 | retval = -EINVAL; | 394 | retval = -EINVAL; |
| 395 | goto err_free; | 395 | goto err_free; |
| 396 | } | 396 | } |
| 397 | if (hema_irq_table[card->irq & 0xf] == 0) { | 397 | if (hema_irq_table[card->irq & 0xf] == 0) { |
| 398 | printk(KERN_WARNING "t1isa: irq %d not valid.\n", card->irq); | 398 | printk(KERN_WARNING "t1isa: irq %d not valid.\n", card->irq); |
| 399 | retval = -EINVAL; | 399 | retval = -EINVAL; |
| @@ -412,7 +412,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) · 12 unmodified lines | |||
| 412 | goto err_release_region; | 412 | goto err_release_region; |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) { | 415 | if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) { |
| 416 | printk(KERN_INFO "t1isa: NO card at 0x%x (%d)\n", | 416 | printk(KERN_INFO "t1isa: NO card at 0x%x (%d)\n", |
| 417 | card->port, retval); | 417 | card->port, retval); |
| 418 | retval = -ENODEV; | 418 | retval = -ENODEV; |
| @@ -445,13 +445,13 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) · 26 unmodified lines | |||
| 445 | pci_set_drvdata(pdev, cinfo); | 445 | pci_set_drvdata(pdev, cinfo); |
| 446 | return 0; | 446 | return 0; |
| 447 | 447 | ||
| 448 | err_free_irq: | 448 | err_free_irq: |
| 449 | free_irq(card->irq, card); | 449 | free_irq(card->irq, card); |
| 450 | err_release_region: | 450 | err_release_region: |
| 451 | release_region(card->port, AVMB1_PORTLEN); | 451 | release_region(card->port, AVMB1_PORTLEN); |
| 452 | err_free: | 452 | err_free: |
| 453 | b1_free_card(card); | 453 | b1_free_card(card); |
| 454 | err: | 454 | err: |
| 455 | return retval; | 455 | return retval; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| @@ -555,7 +555,7 @@ static int __init t1isa_init(void) · 97 unmodified lines | |||
| 555 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 555 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 556 | strlcpy(rev, p + 2, 32); | 556 | strlcpy(rev, p + 2, 32); |
| 557 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 557 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 558 | *(p-1) = 0; | 558 | *(p - 1) = 0; |
| 559 | } else | 559 | } else |
| 560 | strcpy(rev, "1.0"); | 560 | strcpy(rev, "1.0"); |
| 561 | 561 | ||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* $Id: t1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ | 1 | /* $Id: t1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ |
| 2 | * | 2 | * |
| 3 | * Module for AVM T1 PCI-card. | 3 | * Module for AVM T1 PCI-card. |
| 4 | * | 4 | * |
| 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> | 5 | * Copyright 1999 by Carsten Paeth <calle@calle.de> |
| 6 | * | 6 | * |
| 7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
| 8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
| 9 | * | 9 | * |
| @@ -59,7 +59,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev) · 49 unmodified lines | |||
| 59 | goto err; | 59 | goto err; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | card->dma = avmcard_dma_alloc("t1pci", pdev, 2048+128, 2048+128); | 62 | card->dma = avmcard_dma_alloc("t1pci", pdev, 2048 + 128, 2048 + 128); |
| 63 | if (!card->dma) { | 63 | if (!card->dma) { |
| 64 | printk(KERN_WARNING "t1pci: no memory.\n"); | 64 | printk(KERN_WARNING "t1pci: no memory.\n"); |
| 65 | retval = -ENOMEM; | 65 | retval = -ENOMEM; |
| @@ -136,17 +136,17 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev) · 70 unmodified lines | |||
| 136 | pci_set_drvdata(pdev, card); | 136 | pci_set_drvdata(pdev, card); |
| 137 | return 0; | 137 | return 0; |
| 138 | 138 | ||
| 139 | err_free_irq: | 139 | err_free_irq: |
| 140 | free_irq(card->irq, card); | 140 | free_irq(card->irq, card); |
| 141 | err_unmap: | 141 | err_unmap: |
| 142 | iounmap(card->mbase); | 142 | iounmap(card->mbase); |
| 143 | err_release_region: | 143 | err_release_region: |
| 144 | release_region(card->port, AVMB1_PORTLEN); | 144 | release_region(card->port, AVMB1_PORTLEN); |
| 145 | err_free_dma: | 145 | err_free_dma: |
| 146 | avmcard_dma_free(card->dma); | 146 | avmcard_dma_free(card->dma); |
| 147 | err_free: | 147 | err_free: |
| 148 | b1_free_card(card); | 148 | b1_free_card(card); |
| 149 | err: | 149 | err: |
| 150 | return retval; | 150 | return retval; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| @@ -157,7 +157,7 @@ static void t1pci_remove(struct pci_dev *pdev) · 4 unmodified lines | |||
| 157 | avmcard *card = pci_get_drvdata(pdev); | 157 | avmcard *card = pci_get_drvdata(pdev); |
| 158 | avmctrl_info *cinfo = card->ctrlinfo; | 158 | avmctrl_info *cinfo = card->ctrlinfo; |
| 159 | 159 | ||
| 160 | b1dma_reset(card); | 160 | b1dma_reset(card); |
| 161 | 161 | ||
| 162 | detach_capi_ctr(&cinfo->capi_ctrl); | 162 | detach_capi_ctr(&cinfo->capi_ctrl); |
| 163 | free_irq(card->irq, card); | 163 | free_irq(card->irq, card); |
| @@ -217,10 +217,10 @@ static int __devinit t1pci_probe(struct pci_dev *dev, · 53 unmodified lines | |||
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | static struct pci_driver t1pci_pci_driver = { | 219 | static struct pci_driver t1pci_pci_driver = { |
| 220 | .name = "t1pci", | 220 | .name = "t1pci", |
| 221 | .id_table = t1pci_pci_tbl, | 221 | .id_table = t1pci_pci_tbl, |
| 222 | .probe = t1pci_probe, | 222 | .probe = t1pci_probe, |
| 223 | .remove = t1pci_remove, | 223 | .remove = t1pci_remove, |
| 224 | }; | 224 | }; |
| 225 | 225 | ||
| 226 | static struct capi_driver capi_driver_t1pci = { | 226 | static struct capi_driver capi_driver_t1pci = { |
| @@ -237,7 +237,7 @@ static int __init t1pci_init(void) · 10 unmodified lines | |||
| 237 | if ((p = strchr(revision, ':')) != NULL && p[1]) { | 237 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
| 238 | strlcpy(rev, p + 2, 32); | 238 | strlcpy(rev, p + 2, 32); |
| 239 | if ((p = strchr(rev, '$')) != NULL && p > rev) | 239 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
| 240 | *(p-1) = 0; | 240 | *(p - 1) = 0; |
| 241 | } else | 241 | } else |
| 242 | strcpy(rev, "1.0"); | 242 | strcpy(rev, "1.0"); |
| 243 | 243 | ||
| @@ -1,74 +1,74 @@ | |||
| 1 | 1 | ||
| 2 | /* | 2 | /* |
| 3 | * | 3 | * |
| 4 | Copyright (c) Eicon Networks, 2002. | 4 | Copyright (c) Eicon Networks, 2002. |
| 5 | * | 5 | * |
| 6 | This source file is supplied for the use with | 6 | This source file is supplied for the use with |
| 7 | Eicon Networks range of DIVA Server Adapters. | 7 | Eicon Networks range of DIVA Server Adapters. |
| 8 | * | 8 | * |
| 9 | Eicon File Revision : 2.1 | 9 | Eicon File Revision : 2.1 |
| 10 | * | 10 | * |
| 11 | This program is free software; you can redistribute it and/or modify | 11 | This program is free software; you can redistribute it and/or modify |
| 12 | it under the terms of the GNU General Public License as published by | 12 | it under the terms of the GNU General Public License as published by |
| 13 | the Free Software Foundation; either version 2, or (at your option) | 13 | the Free Software Foundation; either version 2, or (at your option) |
| 14 | any later version. | 14 | any later version. |
| 15 | * | 15 | * |
| 16 | This program is distributed in the hope that it will be useful, | 16 | This program is distributed in the hope that it will be useful, |
| 17 | but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY | 17 | but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY |
| 18 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 19 | See the GNU General Public License for more details. | 19 | See the GNU General Public License for more details. |
| 20 | * | 20 | * |
| 21 | You should have received a copy of the GNU General Public License | 21 | You should have received a copy of the GNU General Public License |
| 22 | along with this program; if not, write to the Free Software | 22 | along with this program; if not, write to the Free Software |
| 23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | * | 24 | * |
| 25 | */ | 25 | */ |
| 26 | #ifndef _INC_CAPI20 | 26 | #ifndef _INC_CAPI20 |
| 27 | #define _INC_CAPI20 | 27 | #define _INC_CAPI20 |
| 28 | /* operations on message queues */ | 28 | /* operations on message queues */ |
| 29 | /* the common device type for CAPI20 drivers */ | 29 | /* the common device type for CAPI20 drivers */ |
| 30 | #define FILE_DEVICE_CAPI20 0x8001 | 30 | #define FILE_DEVICE_CAPI20 0x8001 |
| 31 | /* DEVICE_CONTROL codes for user and kernel mode applications */ | 31 | /* DEVICE_CONTROL codes for user and kernel mode applications */ |
| 32 | #define CAPI20_CTL_REGISTER 0x0801 | 32 | #define CAPI20_CTL_REGISTER 0x0801 |
| 33 | #define CAPI20_CTL_RELEASE 0x0802 | 33 | #define CAPI20_CTL_RELEASE 0x0802 |
| 34 | #define CAPI20_CTL_GET_MANUFACTURER 0x0805 | 34 | #define CAPI20_CTL_GET_MANUFACTURER 0x0805 |
| 35 | #define CAPI20_CTL_GET_VERSION 0x0806 | 35 | #define CAPI20_CTL_GET_VERSION 0x0806 |
| 36 | #define CAPI20_CTL_GET_SERIAL 0x0807 | 36 | #define CAPI20_CTL_GET_SERIAL 0x0807 |
| 37 | #define CAPI20_CTL_GET_PROFILE 0x0808 | 37 | #define CAPI20_CTL_GET_PROFILE 0x0808 |
| 38 | /* INTERNAL_DEVICE_CONTROL codes for kernel mode applicatios only */ | 38 | /* INTERNAL_DEVICE_CONTROL codes for kernel mode applicatios only */ |
| 39 | #define CAPI20_CTL_PUT_MESSAGE 0x0803 | 39 | #define CAPI20_CTL_PUT_MESSAGE 0x0803 |
| 40 | #define CAPI20_CTL_GET_MESSAGE 0x0804 | 40 | #define CAPI20_CTL_GET_MESSAGE 0x0804 |
| 41 | /* the wrapped codes as required by the system */ | 41 | /* the wrapped codes as required by the system */ |
| 42 | #define CAPI_CTL_CODE(f,m) CTL_CODE(FILE_DEVICE_CAPI20,f,m,FILE_ANY_ACCESS) | 42 | #define CAPI_CTL_CODE(f, m) CTL_CODE(FILE_DEVICE_CAPI20, f, m, FILE_ANY_ACCESS) |
| 43 | #define IOCTL_CAPI_REGISTER CAPI_CTL_CODE(CAPI20_CTL_REGISTER,METHOD_BUFFERED) | 43 | #define IOCTL_CAPI_REGISTER CAPI_CTL_CODE(CAPI20_CTL_REGISTER, METHOD_BUFFERED) |
| 44 | #define IOCTL_CAPI_RELEASE CAPI_CTL_CODE(CAPI20_CTL_RELEASE,METHOD_BUFFERED) | 44 | #define IOCTL_CAPI_RELEASE CAPI_CTL_CODE(CAPI20_CTL_RELEASE, METHOD_BUFFERED) |
| 45 | #define IOCTL_CAPI_GET_MANUFACTURER CAPI_CTL_CODE(CAPI20_CTL_GET_MANUFACTURER,METHOD_BUFFERED) | 45 | #define IOCTL_CAPI_GET_MANUFACTURER CAPI_CTL_CODE(CAPI20_CTL_GET_MANUFACTURER, METHOD_BUFFERED) |
| 46 | #define IOCTL_CAPI_GET_VERSION CAPI_CTL_CODE(CAPI20_CTL_GET_VERSION,METHOD_BUFFERED) | 46 | #define IOCTL_CAPI_GET_VERSION CAPI_CTL_CODE(CAPI20_CTL_GET_VERSION, METHOD_BUFFERED) |
| 47 | #define IOCTL_CAPI_GET_SERIAL CAPI_CTL_CODE(CAPI20_CTL_GET_SERIAL,METHOD_BUFFERED) | 47 | #define IOCTL_CAPI_GET_SERIAL CAPI_CTL_CODE(CAPI20_CTL_GET_SERIAL, METHOD_BUFFERED) |
| 48 | #define IOCTL_CAPI_GET_PROFILE CAPI_CTL_CODE(CAPI20_CTL_GET_PROFILE,METHOD_BUFFERED) | 48 | #define IOCTL_CAPI_GET_PROFILE CAPI_CTL_CODE(CAPI20_CTL_GET_PROFILE, METHOD_BUFFERED) |
| 49 | #define IOCTL_CAPI_PUT_MESSAGE CAPI_CTL_CODE(CAPI20_CTL_PUT_MESSAGE,METHOD_BUFFERED) | 49 | #define IOCTL_CAPI_PUT_MESSAGE CAPI_CTL_CODE(CAPI20_CTL_PUT_MESSAGE, METHOD_BUFFERED) |
| 50 | #define IOCTL_CAPI_GET_MESSAGE CAPI_CTL_CODE(CAPI20_CTL_GET_MESSAGE,METHOD_BUFFERED) | 50 | #define IOCTL_CAPI_GET_MESSAGE CAPI_CTL_CODE(CAPI20_CTL_GET_MESSAGE, METHOD_BUFFERED) |
| 51 | struct divas_capi_register_params { | 51 | struct divas_capi_register_params { |
| 52 | word MessageBufferSize; | 52 | word MessageBufferSize; |
| 53 | word maxLogicalConnection; | 53 | word maxLogicalConnection; |
| 54 | word maxBDataBlocks; | 54 | word maxBDataBlocks; |
| 55 | word maxBDataLen; | 55 | word maxBDataLen; |
| 56 | }; | 56 | }; |
| 57 | struct divas_capi_version { | 57 | struct divas_capi_version { |
| 58 | word CapiMajor; | 58 | word CapiMajor; |
| 59 | word CapiMinor; | 59 | word CapiMinor; |
| 60 | word ManuMajor; | 60 | word ManuMajor; |
| 61 | word ManuMinor; | 61 | word ManuMinor; |
| 62 | }; | 62 | }; |
| 63 | typedef struct api_profile_s { | 63 | typedef struct api_profile_s { |
| 64 | word Number; | 64 | word Number; |
| 65 | word Channels; | 65 | word Channels; |
| 66 | dword Global_Options; | 66 | dword Global_Options; |
| 67 | dword B1_Protocols; | 67 | dword B1_Protocols; |
| 68 | dword B2_Protocols; | 68 | dword B2_Protocols; |
| 69 | dword B3_Protocols; | 69 | dword B3_Protocols; |
| 70 | } API_PROFILE; | 70 | } API_PROFILE; |
| 71 | /* ISDN Common API message types */ | 71 | /* ISDN Common API message types */ |
| 72 | #define _ALERT_R 0x8001 | 72 | #define _ALERT_R 0x8001 |
| 73 | #define _CONNECT_R 0x8002 | 73 | #define _CONNECT_R 0x8002 |
| 74 | #define _CONNECT_I 0x8202 | 74 | #define _CONNECT_I 0x8202 |
| @@ -93,9 +93,9 @@ typedef struct api_profile_s { · 18 unmodified lines | |||
| 93 | #define _CONNECT_B3_T90_ACTIVE_I 0x8288 | 93 | #define _CONNECT_B3_T90_ACTIVE_I 0x8288 |
| 94 | #define _MANUFACTURER_R 0x80ff | 94 | #define _MANUFACTURER_R 0x80ff |
| 95 | #define _MANUFACTURER_I 0x82ff | 95 | #define _MANUFACTURER_I 0x82ff |
| 96 | /* OR this to convert a REQUEST to a CONFIRM */ | 96 | /* OR this to convert a REQUEST to a CONFIRM */ |
| 97 | #define CONFIRM 0x0100 | 97 | #define CONFIRM 0x0100 |
| 98 | /* OR this to convert a INDICATION to a RESPONSE */ | 98 | /* OR this to convert a INDICATION to a RESPONSE */ |
| 99 | #define RESPONSE 0x0100 | 99 | #define RESPONSE 0x0100 |
| 100 | /*------------------------------------------------------------------*/ | 100 | /*------------------------------------------------------------------*/ |
| 101 | /* diehl isdn private MANUFACTURER codes */ | 101 | /* diehl isdn private MANUFACTURER codes */ |
| @@ -115,248 +115,248 @@ typedef struct api_profile_s { · 13 unmodified lines | |||
| 115 | /*------------------------------------------------------------------*/ | 115 | /*------------------------------------------------------------------*/ |
| 116 | /* parameter structures */ | 116 | /* parameter structures */ |
| 117 | /*------------------------------------------------------------------*/ | 117 | /*------------------------------------------------------------------*/ |
| 118 | /* ALERT-REQUEST */ | 118 | /* ALERT-REQUEST */ |
| 119 | typedef struct { | 119 | typedef struct { |
| 120 | byte structs[1]; /* Additional Info */ | 120 | byte structs[0]; /* Additional Info */ |
| 121 | } _ALT_REQP; | 121 | } _ALT_REQP; |
| 122 | /* ALERT-CONFIRM */ | 122 | /* ALERT-CONFIRM */ |
| 123 | typedef struct { | 123 | typedef struct { |
| 124 | word Info; | 124 | word Info; |
| 125 | } _ALT_CONP; | 125 | } _ALT_CONP; |
| 126 | /* CONNECT-REQUEST */ | 126 | /* CONNECT-REQUEST */ |
| 127 | typedef struct { | 127 | typedef struct { |
| 128 | word CIP_Value; | 128 | word CIP_Value; |
| 129 | byte structs[1]; /* Called party number, | 129 | byte structs[0]; /* Called party number, |
| 130 | Called party subaddress, | 130 | Called party subaddress, |
| 131 | Calling party number, | 131 | Calling party number, |
| 132 | Calling party subaddress, | 132 | Calling party subaddress, |
| 133 | B_protocol, | 133 | B_protocol, |
| 134 | BC, | 134 | BC, |
| 135 | LLC, | 135 | LLC, |
| 136 | HLC, | 136 | HLC, |
| 137 | Additional Info */ | 137 | Additional Info */ |
| 138 | } _CON_REQP; | 138 | } _CON_REQP; |
| 139 | /* CONNECT-CONFIRM */ | 139 | /* CONNECT-CONFIRM */ |
| 140 | typedef struct { | 140 | typedef struct { |
| 141 | word Info; | 141 | word Info; |
| 142 | } _CON_CONP; | 142 | } _CON_CONP; |
| 143 | /* CONNECT-INDICATION */ | 143 | /* CONNECT-INDICATION */ |
| 144 | typedef struct { | 144 | typedef struct { |
| 145 | word CIP_Value; | 145 | word CIP_Value; |
| 146 | byte structs[1]; /* Called party number, | 146 | byte structs[0]; /* Called party number, |
| 147 | Called party subaddress, | 147 | Called party subaddress, |
| 148 | Calling party number, | 148 | Calling party number, |
| 149 | Calling party subaddress, | 149 | Calling party subaddress, |
| 150 | BC, | 150 | BC, |
| 151 | LLC, | 151 | LLC, |
| 152 | HLC, | 152 | HLC, |
| 153 | Additional Info */ | 153 | Additional Info */ |
| 154 | } _CON_INDP; | 154 | } _CON_INDP; |
| 155 | /* CONNECT-RESPONSE */ | 155 | /* CONNECT-RESPONSE */ |
| 156 | typedef struct { | 156 | typedef struct { |
| 157 | word Accept; | 157 | word Accept; |
| 158 | byte structs[1]; /* B_protocol, | 158 | byte structs[0]; /* B_protocol, |
| 159 | Connected party number, | 159 | Connected party number, |
| 160 | Connected party subaddress, | 160 | Connected party subaddress, |
| 161 | LLC */ | 161 | LLC */ |
| 162 | } _CON_RESP; | 162 | } _CON_RESP; |
| 163 | /* CONNECT-ACTIVE-INDICATION */ | 163 | /* CONNECT-ACTIVE-INDICATION */ |
| 164 | typedef struct { | 164 | typedef struct { |
| 165 | byte structs[1]; /* Connected party number, | 165 | byte structs[0]; /* Connected party number, |
| 166 | Connected party subaddress, | 166 | Connected party subaddress, |
| 167 | LLC */ | 167 | LLC */ |
| 168 | } _CON_A_INDP; | 168 | } _CON_A_INDP; |
| 169 | /* CONNECT-ACTIVE-RESPONSE */ | 169 | /* CONNECT-ACTIVE-RESPONSE */ |
| 170 | typedef struct { | 170 | typedef struct { |
| 171 | byte structs[1]; /* empty */ | 171 | byte structs[0]; /* empty */ |
| 172 | } _CON_A_RESP; | 172 | } _CON_A_RESP; |
| 173 | /* DISCONNECT-REQUEST */ | 173 | /* DISCONNECT-REQUEST */ |
| 174 | typedef struct { | 174 | typedef struct { |
| 175 | byte structs[1]; /* Additional Info */ | 175 | byte structs[0]; /* Additional Info */ |
| 176 | } _DIS_REQP; | 176 | } _DIS_REQP; |
| 177 | /* DISCONNECT-CONFIRM */ | 177 | /* DISCONNECT-CONFIRM */ |
| 178 | typedef struct { | 178 | typedef struct { |
| 179 | word Info; | 179 | word Info; |
| 180 | } _DIS_CONP; | 180 | } _DIS_CONP; |
| 181 | /* DISCONNECT-INDICATION */ | 181 | /* DISCONNECT-INDICATION */ |
| 182 | typedef struct { | 182 | typedef struct { |
| 183 | word Info; | 183 | word Info; |
| 184 | } _DIS_INDP; | 184 | } _DIS_INDP; |
| 185 | /* DISCONNECT-RESPONSE */ | 185 | /* DISCONNECT-RESPONSE */ |
| 186 | typedef struct { | 186 | typedef struct { |
| 187 | byte structs[1]; /* empty */ | 187 | byte structs[0]; /* empty */ |
| 188 | } _DIS_RESP; | 188 | } _DIS_RESP; |
| 189 | /* LISTEN-REQUEST */ | 189 | /* LISTEN-REQUEST */ |
| 190 | typedef struct { | 190 | typedef struct { |
| 191 | dword Info_Mask; | 191 | dword Info_Mask; |
| 192 | dword CIP_Mask; | 192 | dword CIP_Mask; |
| 193 | byte structs[1]; /* Calling party number, | 193 | byte structs[0]; /* Calling party number, |
| 194 | Calling party subaddress */ | 194 | Calling party subaddress */ |
| 195 | } _LIS_REQP; | 195 | } _LIS_REQP; |
| 196 | /* LISTEN-CONFIRM */ | 196 | /* LISTEN-CONFIRM */ |
| 197 | typedef struct { | 197 | typedef struct { |
| 198 | word Info; | 198 | word Info; |
| 199 | } _LIS_CONP; | 199 | } _LIS_CONP; |
| 200 | /* INFO-REQUEST */ | 200 | /* INFO-REQUEST */ |
| 201 | typedef struct { | 201 | typedef struct { |
| 202 | byte structs[1]; /* Called party number, | 202 | byte structs[0]; /* Called party number, |
| 203 | Additional Info */ | 203 | Additional Info */ |
| 204 | } _INF_REQP; | 204 | } _INF_REQP; |
| 205 | /* INFO-CONFIRM */ | 205 | /* INFO-CONFIRM */ |
| 206 | typedef struct { | 206 | typedef struct { |
| 207 | word Info; | 207 | word Info; |
| 208 | } _INF_CONP; | 208 | } _INF_CONP; |
| 209 | /* INFO-INDICATION */ | 209 | /* INFO-INDICATION */ |
| 210 | typedef struct { | 210 | typedef struct { |
| 211 | word Number; | 211 | word Number; |
| 212 | byte structs[1]; /* Info element */ | 212 | byte structs[0]; /* Info element */ |
| 213 | } _INF_INDP; | 213 | } _INF_INDP; |
| 214 | /* INFO-RESPONSE */ | 214 | /* INFO-RESPONSE */ |
| 215 | typedef struct { | 215 | typedef struct { |
| 216 | byte structs[1]; /* empty */ | 216 | byte structs[0]; /* empty */ |
| 217 | } _INF_RESP; | 217 | } _INF_RESP; |
| 218 | /* SELECT-B-REQUEST */ | 218 | /* SELECT-B-REQUEST */ |
| 219 | typedef struct { | 219 | typedef struct { |
| 220 | byte structs[1]; /* B-protocol */ | 220 | byte structs[0]; /* B-protocol */ |
| 221 | } _SEL_B_REQP; | 221 | } _SEL_B_REQP; |
| 222 | /* SELECT-B-CONFIRM */ | 222 | /* SELECT-B-CONFIRM */ |
| 223 | typedef struct { | 223 | typedef struct { |
| 224 | word Info; | 224 | word Info; |
| 225 | } _SEL_B_CONP; | 225 | } _SEL_B_CONP; |
| 226 | /* FACILITY-REQUEST */ | 226 | /* FACILITY-REQUEST */ |
| 227 | typedef struct { | 227 | typedef struct { |
| 228 | word Selector; | 228 | word Selector; |
| 229 | byte structs[1]; /* Facility parameters */ | 229 | byte structs[0]; /* Facility parameters */ |
| 230 | } _FAC_REQP; | 230 | } _FAC_REQP; |
| 231 | /* FACILITY-CONFIRM STRUCT FOR SUPPLEMENT. SERVICES */ | 231 | /* FACILITY-CONFIRM STRUCT FOR SUPPLEMENT. SERVICES */ |
| 232 | typedef struct { | 232 | typedef struct { |
| 233 | byte struct_length; | 233 | byte struct_length; |
| 234 | word function; | 234 | word function; |
| 235 | byte length; | 235 | byte length; |
| 236 | word SupplementaryServiceInfo; | 236 | word SupplementaryServiceInfo; |
| 237 | dword SupportedServices; | 237 | dword SupportedServices; |
| 238 | } _FAC_CON_STRUCTS; | 238 | } _FAC_CON_STRUCTS; |
| 239 | /* FACILITY-CONFIRM */ | 239 | /* FACILITY-CONFIRM */ |
| 240 | typedef struct { | 240 | typedef struct { |
| 241 | word Info; | 241 | word Info; |
| 242 | word Selector; | 242 | word Selector; |
| 243 | byte structs[1]; /* Facility parameters */ | 243 | byte structs[0]; /* Facility parameters */ |
| 244 | } _FAC_CONP; | 244 | } _FAC_CONP; |
| 245 | /* FACILITY-INDICATION */ | 245 | /* FACILITY-INDICATION */ |
| 246 | typedef struct { | 246 | typedef struct { |
| 247 | word Selector; | 247 | word Selector; |
| 248 | byte structs[1]; /* Facility parameters */ | 248 | byte structs[0]; /* Facility parameters */ |
| 249 | } _FAC_INDP; | 249 | } _FAC_INDP; |
| 250 | /* FACILITY-RESPONSE */ | 250 | /* FACILITY-RESPONSE */ |
| 251 | typedef struct { | 251 | typedef struct { |
| 252 | word Selector; | 252 | word Selector; |
| 253 | byte structs[1]; /* Facility parameters */ | 253 | byte structs[0]; /* Facility parameters */ |
| 254 | } _FAC_RESP; | 254 | } _FAC_RESP; |
| 255 | /* CONNECT-B3-REQUEST */ | 255 | /* CONNECT-B3-REQUEST */ |
| 256 | typedef struct { | 256 | typedef struct { |
| 257 | byte structs[1]; /* NCPI */ | 257 | byte structs[0]; /* NCPI */ |
| 258 | } _CON_B3_REQP; | 258 | } _CON_B3_REQP; |
| 259 | /* CONNECT-B3-CONFIRM */ | 259 | /* CONNECT-B3-CONFIRM */ |
| 260 | typedef struct { | 260 | typedef struct { |
| 261 | word Info; | 261 | word Info; |
| 262 | } _CON_B3_CONP; | 262 | } _CON_B3_CONP; |
| 263 | /* CONNECT-B3-INDICATION */ | 263 | /* CONNECT-B3-INDICATION */ |
| 264 | typedef struct { | 264 | typedef struct { |
| 265 | byte structs[1]; /* NCPI */ | 265 | byte structs[0]; /* NCPI */ |
| 266 | } _CON_B3_INDP; | 266 | } _CON_B3_INDP; |
| 267 | /* CONNECT-B3-RESPONSE */ | 267 | /* CONNECT-B3-RESPONSE */ |
| 268 | typedef struct { | 268 | typedef struct { |
| 269 | word Accept; | 269 | word Accept; |
| 270 | byte structs[1]; /* NCPI */ | 270 | byte structs[0]; /* NCPI */ |
| 271 | } _CON_B3_RESP; | 271 | } _CON_B3_RESP; |
| 272 | /* CONNECT-B3-ACTIVE-INDICATION */ | 272 | /* CONNECT-B3-ACTIVE-INDICATION */ |
| 273 | typedef struct { | 273 | typedef struct { |
| 274 | byte structs[1]; /* NCPI */ | 274 | byte structs[0]; /* NCPI */ |
| 275 | } _CON_B3_A_INDP; | 275 | } _CON_B3_A_INDP; |
| 276 | /* CONNECT-B3-ACTIVE-RESPONSE */ | 276 | /* CONNECT-B3-ACTIVE-RESPONSE */ |
| 277 | typedef struct { | 277 | typedef struct { |
| 278 | byte structs[1]; /* empty */ | 278 | byte structs[0]; /* empty */ |
| 279 | } _CON_B3_A_RESP; | 279 | } _CON_B3_A_RESP; |
| 280 | /* DISCONNECT-B3-REQUEST */ | 280 | /* DISCONNECT-B3-REQUEST */ |
| 281 | typedef struct { | 281 | typedef struct { |
| 282 | byte structs[1]; /* NCPI */ | 282 | byte structs[0]; /* NCPI */ |
| 283 | } _DIS_B3_REQP; | 283 | } _DIS_B3_REQP; |
| 284 | /* DISCONNECT-B3-CONFIRM */ | 284 | /* DISCONNECT-B3-CONFIRM */ |
| 285 | typedef struct { | 285 | typedef struct { |
| 286 | word Info; | 286 | word Info; |
| 287 | } _DIS_B3_CONP; | 287 | } _DIS_B3_CONP; |
| 288 | /* DISCONNECT-B3-INDICATION */ | 288 | /* DISCONNECT-B3-INDICATION */ |
| 289 | typedef struct { | 289 | typedef struct { |
| 290 | word Info; | 290 | word Info; |
| 291 | byte structs[1]; /* NCPI */ | 291 | byte structs[0]; /* NCPI */ |
| 292 | } _DIS_B3_INDP; | 292 | } _DIS_B3_INDP; |
| 293 | /* DISCONNECT-B3-RESPONSE */ | 293 | /* DISCONNECT-B3-RESPONSE */ |
| 294 | typedef struct { | 294 | typedef struct { |
| 295 | byte structs[1]; /* empty */ | 295 | byte structs[0]; /* empty */ |
| 296 | } _DIS_B3_RESP; | 296 | } _DIS_B3_RESP; |
| 297 | /* DATA-B3-REQUEST */ | 297 | /* DATA-B3-REQUEST */ |
| 298 | typedef struct { | 298 | typedef struct { |
| 299 | dword Data; | 299 | dword Data; |
| 300 | word Data_Length; | 300 | word Data_Length; |
| 301 | word Number; | 301 | word Number; |
| 302 | word Flags; | 302 | word Flags; |
| 303 | } _DAT_B3_REQP; | 303 | } _DAT_B3_REQP; |
| 304 | /* DATA-B3-REQUEST 64 BIT Systems */ | 304 | /* DATA-B3-REQUEST 64 BIT Systems */ |
| 305 | typedef struct { | 305 | typedef struct { |
| 306 | dword Data; | 306 | dword Data; |
| 307 | word Data_Length; | 307 | word Data_Length; |
| 308 | word Number; | 308 | word Number; |
| 309 | word Flags; | 309 | word Flags; |
| 310 | void *pData; | 310 | void *pData; |
| 311 | } _DAT_B3_REQ64P; | 311 | } _DAT_B3_REQ64P; |
| 312 | /* DATA-B3-CONFIRM */ | 312 | /* DATA-B3-CONFIRM */ |
| 313 | typedef struct { | 313 | typedef struct { |
| 314 | word Number; | 314 | word Number; |
| 315 | word Info; | 315 | word Info; |
| 316 | } _DAT_B3_CONP; | 316 | } _DAT_B3_CONP; |
| 317 | /* DATA-B3-INDICATION */ | 317 | /* DATA-B3-INDICATION */ |
| 318 | typedef struct { | 318 | typedef struct { |
| 319 | dword Data; | 319 | dword Data; |
| 320 | word Data_Length; | 320 | word Data_Length; |
| 321 | word Number; | 321 | word Number; |
| 322 | word Flags; | 322 | word Flags; |
| 323 | } _DAT_B3_INDP; | 323 | } _DAT_B3_INDP; |
| 324 | /* DATA-B3-INDICATION 64 BIT Systems */ | 324 | /* DATA-B3-INDICATION 64 BIT Systems */ |
| 325 | typedef struct { | 325 | typedef struct { |
| 326 | dword Data; | 326 | dword Data; |
| 327 | word Data_Length; | 327 | word Data_Length; |
| 328 | word Number; | 328 | word Number; |
| 329 | word Flags; | 329 | word Flags; |
| 330 | void *pData; | 330 | void *pData; |
| 331 | } _DAT_B3_IND64P; | 331 | } _DAT_B3_IND64P; |
| 332 | /* DATA-B3-RESPONSE */ | 332 | /* DATA-B3-RESPONSE */ |
| 333 | typedef struct { | 333 | typedef struct { |
| 334 | word Number; | 334 | word Number; |
| 335 | } _DAT_B3_RESP; | 335 | } _DAT_B3_RESP; |
| 336 | /* RESET-B3-REQUEST */ | 336 | /* RESET-B3-REQUEST */ |
| 337 | typedef struct { | 337 | typedef struct { |
| 338 | byte structs[1]; /* NCPI */ | 338 | byte structs[0]; /* NCPI */ |
| 339 | } _RES_B3_REQP; | 339 | } _RES_B3_REQP; |
| 340 | /* RESET-B3-CONFIRM */ | 340 | /* RESET-B3-CONFIRM */ |
| 341 | typedef struct { | 341 | typedef struct { |
| 342 | word Info; | 342 | word Info; |
| 343 | } _RES_B3_CONP; | 343 | } _RES_B3_CONP; |
| 344 | /* RESET-B3-INDICATION */ | 344 | /* RESET-B3-INDICATION */ |
| 345 | typedef struct { | 345 | typedef struct { |
| 346 | byte structs[1]; /* NCPI */ | 346 | byte structs[0]; /* NCPI */ |
| 347 | } _RES_B3_INDP; | 347 | } _RES_B3_INDP; |
| 348 | /* RESET-B3-RESPONSE */ | 348 | /* RESET-B3-RESPONSE */ |
| 349 | typedef struct { | 349 | typedef struct { |
| 350 | byte structs[1]; /* empty */ | 350 | byte structs[0]; /* empty */ |
| 351 | } _RES_B3_RESP; | 351 | } _RES_B3_RESP; |
| 352 | /* CONNECT-B3-T90-ACTIVE-INDICATION */ | 352 | /* CONNECT-B3-T90-ACTIVE-INDICATION */ |
| 353 | typedef struct { | 353 | typedef struct { |
| 354 | byte structs[1]; /* NCPI */ | 354 | byte structs[0]; /* NCPI */ |
| 355 | } _CON_B3_T90_A_INDP; | 355 | } _CON_B3_T90_A_INDP; |
| 356 | /* CONNECT-B3-T90-ACTIVE-RESPONSE */ | 356 | /* CONNECT-B3-T90-ACTIVE-RESPONSE */ |
| 357 | typedef struct { | 357 | typedef struct { |
| 358 | word Reject; | 358 | word Reject; |
| 359 | byte structs[1]; /* NCPI */ | 359 | byte structs[0]; /* NCPI */ |
| 360 | } _CON_B3_T90_A_RESP; | 360 | } _CON_B3_T90_A_RESP; |
| 361 | /*------------------------------------------------------------------*/ | 361 | /*------------------------------------------------------------------*/ |
| 362 | /* message structure */ | 362 | /* message structure */ |
| @@ -364,64 +364,64 @@ typedef struct { · 1 unmodified line | |||
| 364 | typedef struct _API_MSG CAPI_MSG; | 364 | typedef struct _API_MSG CAPI_MSG; |
| 365 | typedef struct _MSG_HEADER CAPI_MSG_HEADER; | 365 | typedef struct _MSG_HEADER CAPI_MSG_HEADER; |
| 366 | struct _API_MSG { | 366 | struct _API_MSG { |
| 367 | struct _MSG_HEADER { | 367 | struct _MSG_HEADER { |
| 368 | word length; | 368 | word length; |
| 369 | word appl_id; | 369 | word appl_id; |
| 370 | word command; | 370 | word command; |
| 371 | word number; | 371 | word number; |
| 372 | byte controller; | 372 | byte controller; |
| 373 | byte plci; | 373 | byte plci; |
| 374 | word ncci; | 374 | word ncci; |
| 375 | } header; | 375 | } header; |
| 376 | union { | 376 | union { |
| 377 | _ALT_REQP alert_req; | 377 | _ALT_REQP alert_req; |
| 378 | _ALT_CONP alert_con; | 378 | _ALT_CONP alert_con; |
| 379 | _CON_REQP connect_req; | 379 | _CON_REQP connect_req; |
| 380 | _CON_CONP connect_con; | 380 | _CON_CONP connect_con; |
| 381 | _CON_INDP connect_ind; | 381 | _CON_INDP connect_ind; |
| 382 | _CON_RESP connect_res; | 382 | _CON_RESP connect_res; |
| 383 | _CON_A_INDP connect_a_ind; | 383 | _CON_A_INDP connect_a_ind; |
| 384 | _CON_A_RESP connect_a_res; | 384 | _CON_A_RESP connect_a_res; |
| 385 | _DIS_REQP disconnect_req; | 385 | _DIS_REQP disconnect_req; |
| 386 | _DIS_CONP disconnect_con; | 386 | _DIS_CONP disconnect_con; |
| 387 | _DIS_INDP disconnect_ind; | 387 | _DIS_INDP disconnect_ind; |
| 388 | _DIS_RESP disconnect_res; | 388 | _DIS_RESP disconnect_res; |
| 389 | _LIS_REQP listen_req; | 389 | _LIS_REQP listen_req; |
| 390 | _LIS_CONP listen_con; | 390 | _LIS_CONP listen_con; |
| 391 | _INF_REQP info_req; | 391 | _INF_REQP info_req; |
| 392 | _INF_CONP info_con; | 392 | _INF_CONP info_con; |
| 393 | _INF_INDP info_ind; | 393 | _INF_INDP info_ind; |
| 394 | _INF_RESP info_res; | 394 | _INF_RESP info_res; |
| 395 | _SEL_B_REQP select_b_req; | 395 | _SEL_B_REQP select_b_req; |
| 396 | _SEL_B_CONP select_b_con; | 396 | _SEL_B_CONP select_b_con; |
| 397 | _FAC_REQP facility_req; | 397 | _FAC_REQP facility_req; |
| 398 | _FAC_CONP facility_con; | 398 | _FAC_CONP facility_con; |
| 399 | _FAC_INDP facility_ind; | 399 | _FAC_INDP facility_ind; |
| 400 | _FAC_RESP facility_res; | 400 | _FAC_RESP facility_res; |
| 401 | _CON_B3_REQP connect_b3_req; | 401 | _CON_B3_REQP connect_b3_req; |
| 402 | _CON_B3_CONP connect_b3_con; | 402 | _CON_B3_CONP connect_b3_con; |
| 403 | _CON_B3_INDP connect_b3_ind; | 403 | _CON_B3_INDP connect_b3_ind; |
| 404 | _CON_B3_RESP connect_b3_res; | 404 | _CON_B3_RESP connect_b3_res; |
| 405 | _CON_B3_A_INDP connect_b3_a_ind; | 405 | _CON_B3_A_INDP connect_b3_a_ind; |
| 406 | _CON_B3_A_RESP connect_b3_a_res; | 406 | _CON_B3_A_RESP connect_b3_a_res; |
| 407 | _DIS_B3_REQP disconnect_b3_req; | 407 | _DIS_B3_REQP disconnect_b3_req; |
| 408 | _DIS_B3_CONP disconnect_b3_con; | 408 | _DIS_B3_CONP disconnect_b3_con; |
| 409 | _DIS_B3_INDP disconnect_b3_ind; | 409 | _DIS_B3_INDP disconnect_b3_ind; |
| 410 | _DIS_B3_RESP disconnect_b3_res; | 410 | _DIS_B3_RESP disconnect_b3_res; |
| 411 | _DAT_B3_REQP data_b3_req; | 411 | _DAT_B3_REQP data_b3_req; |
| 412 | _DAT_B3_REQ64P data_b3_req64; | 412 | _DAT_B3_REQ64P data_b3_req64; |
| 413 | _DAT_B3_CONP data_b3_con; | 413 | _DAT_B3_CONP data_b3_con; |
| 414 | _DAT_B3_INDP data_b3_ind; | 414 | _DAT_B3_INDP data_b3_ind; |
| 415 | _DAT_B3_IND64P data_b3_ind64; | 415 | _DAT_B3_IND64P data_b3_ind64; |
| 416 | _DAT_B3_RESP data_b3_res; | 416 | _DAT_B3_RESP data_b3_res; |
| 417 | _RES_B3_REQP reset_b3_req; | 417 | _RES_B3_REQP reset_b3_req; |
| 418 | _RES_B3_CONP reset_b3_con; | 418 | _RES_B3_CONP reset_b3_con; |
| 419 | _RES_B3_INDP reset_b3_ind; | 419 | _RES_B3_INDP reset_b3_ind; |
| 420 | _RES_B3_RESP reset_b3_res; | 420 | _RES_B3_RESP reset_b3_res; |
| 421 | _CON_B3_T90_A_INDP connect_b3_t90_a_ind; | 421 | _CON_B3_T90_A_INDP connect_b3_t90_a_ind; |
| 422 | _CON_B3_T90_A_RESP connect_b3_t90_a_res; | 422 | _CON_B3_T90_A_RESP connect_b3_t90_a_res; |
| 423 | byte b[200]; | 423 | byte b[200]; |
| 424 | } info; | 424 | } info; |
| 425 | }; | 425 | }; |
| 426 | /*------------------------------------------------------------------*/ | 426 | /*------------------------------------------------------------------*/ |
| 427 | /* non-fatal errors */ | 427 | /* non-fatal errors */ |
| @@ -696,4 +696,4 @@ struct _API_MSG { · 268 unmodified lines | |||
| 696 | /* function prototypes */ | 696 | /* function prototypes */ |
| 697 | /*------------------------------------------------------------------*/ | 697 | /*------------------------------------------------------------------*/ |
| 698 | /*------------------------------------------------------------------*/ | 698 | /*------------------------------------------------------------------*/ |
| 699 | #endif /* _INC_CAPI20 */ | 699 | #endif /* _INC_CAPI20 */ |
| @@ -1,34 +1,34 @@ | |||
| 1 | 1 | ||
| 2 | /* | 2 | /* |
| 3 | * | 3 | * |
| 4 | Copyright (c) Eicon Networks, 2002. | 4 | Copyright (c) Eicon Networks, 2002. |
| 5 | * | 5 | * |
| 6 | This source file is supplied for the use with | 6 | This source file is supplied for the use with |
| 7 | Eicon Networks range of DIVA Server Adapters. | 7 | Eicon Networks range of DIVA Server Adapters. |
| 8 | * | 8 | * |
| 9 | Eicon File Revision : 2.1 | 9 | Eicon File Revision : 2.1 |
| 10 | * | 10 | * |
| 11 | This program is free software; you can redistribute it and/or modify | 11 | This program is free software; you can redistribute it and/or modify |
| 12 | it under the terms of the GNU General Public License as published by | 12 | it under the terms of the GNU General Public License as published by |
| 13 | the Free Software Foundation; either version 2, or (at your option) | 13 | the Free Software Foundation; either version 2, or (at your option) |
| 14 | any later version. | 14 | any later version. |
| 15 | * | 15 | * |
| 16 | This program is distributed in the hope that it will be useful, | 16 | This program is distributed in the hope that it will be useful, |
| 17 | but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY | 17 | but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY |
| 18 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 19 | See the GNU General Public License for more details. | 19 | See the GNU General Public License for more details. |
| 20 | * | 20 | * |
| 21 | You should have received a copy of the GNU General Public License | 21 | You should have received a copy of the GNU General Public License |
| 22 | along with this program; if not, write to the Free Software | 22 | along with this program; if not, write to the Free Software |
| 23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | * | 24 | * |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include "platform.h" | 27 | #include "platform.h" |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | 34 | ||
| @@ -51,74 +51,74 @@ · 16 unmodified lines | |||
| 51 | 51 | ||
| 52 | static short capidtmf_expand_table_alaw[0x0100] = | 52 | static short capidtmf_expand_table_alaw[0x0100] = |
| 53 | { | 53 | { |
| 54 | -5504, 5504, -344, 344, -22016, 22016, -1376, 1376, | 54 | -5504, 5504, -344, 344, -22016, 22016, -1376, 1376, |
| 55 | -2752, 2752, -88, 88, -11008, 11008, -688, 688, | 55 | -2752, 2752, -88, 88, -11008, 11008, -688, 688, |
| 56 | -7552, 7552, -472, 472, -30208, 30208, -1888, 1888, | 56 | -7552, 7552, -472, 472, -30208, 30208, -1888, 1888, |
| 57 | -3776, 3776, -216, 216, -15104, 15104, -944, 944, | 57 | -3776, 3776, -216, 216, -15104, 15104, -944, 944, |
| 58 | -4480, 4480, -280, 280, -17920, 17920, -1120, 1120, | 58 | -4480, 4480, -280, 280, -17920, 17920, -1120, 1120, |
| 59 | -2240, 2240, -24, 24, -8960, 8960, -560, 560, | 59 | -2240, 2240, -24, 24, -8960, 8960, -560, 560, |
| 60 | -6528, 6528, -408, 408, -26112, 26112, -1632, 1632, | 60 | -6528, 6528, -408, 408, -26112, 26112, -1632, 1632, |
| 61 | -3264, 3264, -152, 152, -13056, 13056, -816, 816, | 61 | -3264, 3264, -152, 152, -13056, 13056, -816, 816, |
| 62 | -6016, 6016, -376, 376, -24064, 24064, -1504, 1504, | 62 | -6016, 6016, -376, 376, -24064, 24064, -1504, 1504, |
| 63 | -3008, 3008, -120, 120, -12032, 12032, -752, 752, | 63 | -3008, 3008, -120, 120, -12032, 12032, -752, 752, |
| 64 | -8064, 8064, -504, 504, -32256, 32256, -2016, 2016, | 64 | -8064, 8064, -504, 504, -32256, 32256, -2016, 2016, |
| 65 | -4032, 4032, -248, 248, -16128, 16128, -1008, 1008, | 65 | -4032, 4032, -248, 248, -16128, 16128, -1008, 1008, |
| 66 | -4992, 4992, -312, 312, -19968, 19968, -1248, 1248, | 66 | -4992, 4992, -312, 312, -19968, 19968, -1248, 1248, |
| 67 | -2496, 2496, -56, 56, -9984, 9984, -624, 624, | 67 | -2496, 2496, -56, 56, -9984, 9984, -624, 624, |
| 68 | -7040, 7040, -440, 440, -28160, 28160, -1760, 1760, | 68 | -7040, 7040, -440, 440, -28160, 28160, -1760, 1760, |
| 69 | -3520, 3520, -184, 184, -14080, 14080, -880, 880, | 69 | -3520, 3520, -184, 184, -14080, 14080, -880, 880, |
| 70 | -5248, 5248, -328, 328, -20992, 20992, -1312, 1312, | 70 | -5248, 5248, -328, 328, -20992, 20992, -1312, 1312, |
| 71 | -2624, 2624, -72, 72, -10496, 10496, -656, 656, | 71 | -2624, 2624, -72, 72, -10496, 10496, -656, 656, |
| 72 | -7296, 7296, -456, 456, -29184, 29184, -1824, 1824, | 72 | -7296, 7296, -456, 456, -29184, 29184, -1824, 1824, |
| 73 | -3648, 3648, -200, 200, -14592, 14592, -912, 912, | 73 | -3648, 3648, -200, 200, -14592, 14592, -912, 912, |
| 74 | -4224, 4224, -264, 264, -16896, 16896, -1056, 1056, | 74 | -4224, 4224, -264, 264, -16896, 16896, -1056, 1056, |
| 75 | -2112, 2112, -8, 8, -8448, 8448, -528, 528, | 75 | -2112, 2112, -8, 8, -8448, 8448, -528, 528, |
| 76 | -6272, 6272, -392, 392, -25088, 25088, -1568, 1568, | 76 | -6272, 6272, -392, 392, -25088, 25088, -1568, 1568, |
| 77 | -3136, 3136, -136, 136, -12544, 12544, -784, 784, | 77 | -3136, 3136, -136, 136, -12544, 12544, -784, 784, |
| 78 | -5760, 5760, -360, 360, -23040, 23040, -1440, 1440, | 78 | -5760, 5760, -360, 360, -23040, 23040, -1440, 1440, |
| 79 | -2880, 2880, -104, 104, -11520, 11520, -720, 720, | 79 | -2880, 2880, -104, 104, -11520, 11520, -720, 720, |
| 80 | -7808, 7808, -488, 488, -31232, 31232, -1952, 1952, | 80 | -7808, 7808, -488, 488, -31232, 31232, -1952, 1952, |
| 81 | -3904, 3904, -232, 232, -15616, 15616, -976, 976, | 81 | -3904, 3904, -232, 232, -15616, 15616, -976, 976, |
| 82 | -4736, 4736, -296, 296, -18944, 18944, -1184, 1184, | 82 | -4736, 4736, -296, 296, -18944, 18944, -1184, 1184, |
| 83 | -2368, 2368, -40, 40, -9472, 9472, -592, 592, | 83 | -2368, 2368, -40, 40, -9472, 9472, -592, 592, |
| 84 | -6784, 6784, -424, 424, -27136, 27136, -1696, 1696, | 84 | -6784, 6784, -424, 424, -27136, 27136, -1696, 1696, |
| 85 | -3392, 3392, -168, 168, -13568, 13568, -848, 848 | 85 | -3392, 3392, -168, 168, -13568, 13568, -848, 848 |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | static short capidtmf_expand_table_ulaw[0x0100] = | 88 | static short capidtmf_expand_table_ulaw[0x0100] = |
| 89 | { | 89 | { |
| 90 | -32124, 32124, -1884, 1884, -7932, 7932, -372, 372, | 90 | -32124, 32124, -1884, 1884, -7932, 7932, -372, 372, |
| 91 | -15996, 15996, -876, 876, -3900, 3900, -120, 120, | 91 | -15996, 15996, -876, 876, -3900, 3900, -120, 120, |
| 92 | -23932, 23932, -1372, 1372, -5884, 5884, -244, 244, | 92 | -23932, 23932, -1372, 1372, -5884, 5884, -244, 244, |
| 93 | -11900, 11900, -620, 620, -2876, 2876, -56, 56, | 93 | -11900, 11900, -620, 620, -2876, 2876, -56, 56, |
| 94 | -28028, 28028, -1628, 1628, -6908, 6908, -308, 308, | 94 | -28028, 28028, -1628, 1628, -6908, 6908, -308, 308, |
| 95 | -13948, 13948, -748, 748, -3388, 3388, -88, 88, | 95 | -13948, 13948, -748, 748, -3388, 3388, -88, 88, |
| 96 | -19836, 19836, -1116, 1116, -4860, 4860, -180, 180, | 96 | -19836, 19836, -1116, 1116, -4860, 4860, -180, 180, |
| 97 | -9852, 9852, -492, 492, -2364, 2364, -24, 24, | 97 | -9852, 9852, -492, 492, -2364, 2364, -24, 24, |
| 98 | -30076, 30076, -1756, 1756, -7420, 7420, -340, 340, | 98 | -30076, 30076, -1756, 1756, -7420, 7420, -340, 340, |
| 99 | -14972, 14972, -812, 812, -3644, 3644, -104, 104, | 99 | -14972, 14972, -812, 812, -3644, 3644, -104, 104, |
| 100 | -21884, 21884, -1244, 1244, -5372, 5372, -212, 212, | 100 | -21884, 21884, -1244, 1244, -5372, 5372, -212, 212, |
| 101 | -10876, 10876, -556, 556, -2620, 2620, -40, 40, | 101 | -10876, 10876, -556, 556, -2620, 2620, -40, 40, |
| 102 | -25980, 25980, -1500, 1500, -6396, 6396, -276, 276, | 102 | -25980, 25980, -1500, 1500, -6396, 6396, -276, 276, |
| 103 | -12924, 12924, -684, 684, -3132, 3132, -72, 72, | 103 | -12924, 12924, -684, 684, -3132, 3132, -72, 72, |
| 104 | -17788, 17788, -988, 988, -4348, 4348, -148, 148, | 104 | -17788, 17788, -988, 988, -4348, 4348, -148, 148, |
| 105 | -8828, 8828, -428, 428, -2108, 2108, -8, 8, | 105 | -8828, 8828, -428, 428, -2108, 2108, -8, 8, |
| 106 | -31100, 31100, -1820, 1820, -7676, 7676, -356, 356, | 106 | -31100, 31100, -1820, 1820, -7676, 7676, -356, 356, |
| 107 | -15484, 15484, -844, 844, -3772, 3772, -112, 112, | 107 | -15484, 15484, -844, 844, -3772, 3772, -112, 112, |
| 108 | -22908, 22908, -1308, 1308, -5628, 5628, -228, 228, | 108 | -22908, 22908, -1308, 1308, -5628, 5628, -228, 228, |
| 109 | -11388, 11388, -588, 588, -2748, 2748, -48, 48, | 109 | -11388, 11388, -588, 588, -2748, 2748, -48, 48, |
| 110 | -27004, 27004, -1564, 1564, -6652, 6652, -292, 292, | 110 | -27004, 27004, -1564, 1564, -6652, 6652, -292, 292, |
| 111 | -13436, 13436, -716, 716, -3260, 3260, -80, 80, | 111 | -13436, 13436, -716, 716, -3260, 3260, -80, 80, |
| 112 | -18812, 18812, -1052, 1052, -4604, 4604, -164, 164, | 112 | -18812, 18812, -1052, 1052, -4604, 4604, -164, 164, |
| 113 | -9340, 9340, -460, 460, -2236, 2236, -16, 16, | 113 | -9340, 9340, -460, 460, -2236, 2236, -16, 16, |
| 114 | -29052, 29052, -1692, 1692, -7164, 7164, -324, 324, | 114 | -29052, 29052, -1692, 1692, -7164, 7164, -324, 324, |
| 115 | -14460, 14460, -780, 780, -3516, 3516, -96, 96, | 115 | -14460, 14460, -780, 780, -3516, 3516, -96, 96, |
| 116 | -20860, 20860, -1180, 1180, -5116, 5116, -196, 196, | 116 | -20860, 20860, -1180, 1180, -5116, 5116, -196, 196, |
| 117 | -10364, 10364, -524, 524, -2492, 2492, -32, 32, | 117 | -10364, 10364, -524, 524, -2492, 2492, -32, 32, |
| 118 | -24956, 24956, -1436, 1436, -6140, 6140, -260, 260, | 118 | -24956, 24956, -1436, 1436, -6140, 6140, -260, 260, |
| 119 | -12412, 12412, -652, 652, -3004, 3004, -64, 64, | 119 | -12412, 12412, -652, 652, -3004, 3004, -64, 64, |
| 120 | -16764, 16764, -924, 924, -4092, 4092, -132, 132, | 120 | -16764, 16764, -924, 924, -4092, 4092, -132, 132, |
| 121 | -8316, 8316, -396, 396, -1980, 1980, 0, 0 | 121 | -8316, 8316, -396, 396, -1980, 1980, 0, 0 |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | 124 | ||
| @@ -126,52 +126,52 @@ static short capidtmf_expand_table_ulaw[0x0100] = · 1 unmodified line | |||
| 126 | 126 | ||
| 127 | static short capidtmf_recv_window_function[CAPIDTMF_RECV_ACCUMULATE_CYCLES] = | 127 | static short capidtmf_recv_window_function[CAPIDTMF_RECV_ACCUMULATE_CYCLES] = |
| 128 | { | 128 | { |
| 129 | -500L, -999L, -1499L, -1998L, -2496L, -2994L, -3491L, -3988L, | 129 | -500L, -999L, -1499L, -1998L, -2496L, -2994L, -3491L, -3988L, |
| 130 | -4483L, -4978L, -5471L, -5963L, -6454L, -6943L, -7431L, -7917L, | 130 | -4483L, -4978L, -5471L, -5963L, -6454L, -6943L, -7431L, -7917L, |
| 131 | -8401L, -8883L, -9363L, -9840L, -10316L, -10789L, -11259L, -11727L, | 131 | -8401L, -8883L, -9363L, -9840L, -10316L, -10789L, -11259L, -11727L, |
| 132 | -12193L, -12655L, -13115L, -13571L, -14024L, -14474L, -14921L, -15364L, | 132 | -12193L, -12655L, -13115L, -13571L, -14024L, -14474L, -14921L, -15364L, |
| 133 | -15804L, -16240L, -16672L, -17100L, -17524L, -17944L, -18360L, -18772L, | 133 | -15804L, -16240L, -16672L, -17100L, -17524L, -17944L, -18360L, -18772L, |
| 134 | -19180L, -19583L, -19981L, -20375L, -20764L, -21148L, -21527L, -21901L, | 134 | -19180L, -19583L, -19981L, -20375L, -20764L, -21148L, -21527L, -21901L, |
| 135 | -22270L, -22634L, -22993L, -23346L, -23694L, -24037L, -24374L, -24705L, | 135 | -22270L, -22634L, -22993L, -23346L, -23694L, -24037L, -24374L, -24705L, |
| 136 | -25030L, -25350L, -25664L, -25971L, -26273L, -26568L, -26858L, -27141L, | 136 | -25030L, -25350L, -25664L, -25971L, -26273L, -26568L, -26858L, -27141L, |
| 137 | -27418L, -27688L, -27952L, -28210L, -28461L, -28705L, -28943L, -29174L, | 137 | -27418L, -27688L, -27952L, -28210L, -28461L, -28705L, -28943L, -29174L, |
| 138 | -29398L, -29615L, -29826L, -30029L, -30226L, -30415L, -30598L, -30773L, | 138 | -29398L, -29615L, -29826L, -30029L, -30226L, -30415L, -30598L, -30773L, |
| 139 | -30941L, -31102L, -31256L, -31402L, -31541L, -31673L, -31797L, -31914L, | 139 | -30941L, -31102L, -31256L, -31402L, -31541L, -31673L, -31797L, -31914L, |
| 140 | -32024L, -32126L, -32221L, -32308L, -32388L, -32460L, -32524L, -32581L, | 140 | -32024L, -32126L, -32221L, -32308L, -32388L, -32460L, -32524L, -32581L, |
| 141 | -32631L, -32673L, -32707L, -32734L, -32753L, -32764L, -32768L, -32764L, | 141 | -32631L, -32673L, -32707L, -32734L, -32753L, -32764L, -32768L, -32764L, |
| 142 | -32753L, -32734L, -32707L, -32673L, -32631L, -32581L, -32524L, -32460L, | 142 | -32753L, -32734L, -32707L, -32673L, -32631L, -32581L, -32524L, -32460L, |
| 143 | -32388L, -32308L, -32221L, -32126L, -32024L, -31914L, -31797L, -31673L, | 143 | -32388L, -32308L, -32221L, -32126L, -32024L, -31914L, -31797L, -31673L, |
| 144 | -31541L, -31402L, -31256L, -31102L, -30941L, -30773L, -30598L, -30415L, | 144 | -31541L, -31402L, -31256L, -31102L, -30941L, -30773L, -30598L, -30415L, |
| 145 | -30226L, -30029L, -29826L, -29615L, -29398L, -29174L, -28943L, -28705L, | 145 | -30226L, -30029L, -29826L, -29615L, -29398L, -29174L, -28943L, -28705L, |
| 146 | -28461L, -28210L, -27952L, -27688L, -27418L, -27141L, -26858L, -26568L, | 146 | -28461L, -28210L, -27952L, -27688L, -27418L, -27141L, -26858L, -26568L, |
| 147 | -26273L, -25971L, -25664L, -25350L, -25030L, -24705L, -24374L, -24037L, | 147 | -26273L, -25971L, -25664L, -25350L, -25030L, -24705L, -24374L, -24037L, |
| 148 | -23694L, -23346L, -22993L, -22634L, -22270L, -21901L, -21527L, -21148L, | 148 | -23694L, -23346L, -22993L, -22634L, -22270L, -21901L, -21527L, -21148L, |
| 149 | -20764L, -20375L, -19981L, -19583L, -19180L, -18772L, -18360L, -17944L, | 149 | -20764L, -20375L, -19981L, -19583L, -19180L, -18772L, -18360L, -17944L, |
| 150 | -17524L, -17100L, -16672L, -16240L, -15804L, -15364L, -14921L, -14474L, | 150 | -17524L, -17100L, -16672L, -16240L, -15804L, -15364L, -14921L, -14474L, |
| 151 | -14024L, -13571L, -13115L, -12655L, -12193L, -11727L, -11259L, -10789L, | 151 | -14024L, -13571L, -13115L, -12655L, -12193L, -11727L, -11259L, -10789L, |
| 152 | -10316L, -9840L, -9363L, -8883L, -8401L, -7917L, -7431L, -6943L, | 152 | -10316L, -9840L, -9363L, -8883L, -8401L, -7917L, -7431L, -6943L, |
| 153 | -6454L, -5963L, -5471L, -4978L, -4483L, -3988L, -3491L, -2994L, | 153 | -6454L, -5963L, -5471L, -4978L, -4483L, -3988L, -3491L, -2994L, |
| 154 | -2496L, -1998L, -1499L, -999L, -500L, | 154 | -2496L, -1998L, -1499L, -999L, -500L, |
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | static byte capidtmf_leading_zeroes_table[0x100] = | 157 | static byte capidtmf_leading_zeroes_table[0x100] = |
| 158 | { | 158 | { |
| 159 | 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, | 159 | 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, |
| 160 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | 160 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 161 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 161 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 162 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 162 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 163 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 163 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 164 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 164 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 165 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 165 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 166 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 166 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 167 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 167 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 168 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 168 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 169 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 169 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 170 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 170 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 171 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 171 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 172 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 172 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 173 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 173 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 174 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | 174 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | #define capidtmf_byte_leading_zeroes(b) (capidtmf_leading_zeroes_table[(BYTE)(b)]) | 177 | #define capidtmf_byte_leading_zeroes(b) (capidtmf_leading_zeroes_table[(BYTE)(b)]) |
| @@ -182,140 +182,140 @@ static byte capidtmf_leading_zeroes_table[0x100] = · 4 unmodified lines | |||
| 182 | /*---------------------------------------------------------------------------*/ | 182 | /*---------------------------------------------------------------------------*/ |
| 183 | 183 | ||
| 184 | 184 | ||
| 185 | static void capidtmf_goertzel_loop (long *buffer, long *coeffs, short *sample, long count) | 185 | static void capidtmf_goertzel_loop(long *buffer, long *coeffs, short *sample, long count) |
| 186 | { | 186 | { |
| 187 | int i, j; | 187 | int i, j; |
| 188 | long c, d, q0, q1, q2; | 188 | long c, d, q0, q1, q2; |
| 189 | 189 | ||
| 190 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - 1; i++) | 190 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - 1; i++) |
| 191 | { | 191 | { |
| 192 | q1 = buffer[i]; | 192 | q1 = buffer[i]; |
| 193 | q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; | 193 | q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; |
| 194 | d = coeffs[i] >> 1; | 194 | d = coeffs[i] >> 1; |
| 195 | c = d << 1; | 195 | c = d << 1; |
| 196 | if (c >= 0) | 196 | if (c >= 0) |
| 197 | { | 197 | { |
| 198 | for (j = 0; j < count; j++) | 198 | for (j = 0; j < count; j++) |
| 199 | { | 199 | { |
| 200 | q0 = sample[j] - q2 + (c * (q1 >> 16)) + (((dword)(((dword) d) * ((dword)(q1 & 0xffff)))) >> 15); | 200 | q0 = sample[j] - q2 + (c * (q1 >> 16)) + (((dword)(((dword) d) * ((dword)(q1 & 0xffff)))) >> 15); |
| 201 | q2 = q1; | 201 | q2 = q1; |
| 202 | q1 = q0; | 202 | q1 = q0; |
| 203 | } | 203 | } |
| 204 | } | 204 | } |
| 205 | else | 205 | else |
| 206 | { | 206 | { |
| 207 | c = -c; | 207 | c = -c; |
| 208 | d = -d; | 208 | d = -d; |
| 209 | for (j = 0; j < count; j++) | 209 | for (j = 0; j < count; j++) |
| 210 | { | 210 | { |
| 211 | q0 = sample[j] - q2 - ((c * (q1 >> 16)) + (((dword)(((dword) d) * ((dword)(q1 & 0xffff)))) >> 15)); | 211 | q0 = sample[j] - q2 - ((c * (q1 >> 16)) + (((dword)(((dword) d) * ((dword)(q1 & 0xffff)))) >> 15)); |
| 212 | q2 = q1; | 212 | q2 = q1; |
| 213 | q1 = q0; | 213 | q1 = q0; |
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | buffer[i] = q1; | 216 | buffer[i] = q1; |
| 217 | buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = q2; | 217 | buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = q2; |
| 218 | } | 218 | } |
| 219 | q1 = buffer[i]; | 219 | q1 = buffer[i]; |
| 220 | q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; | 220 | q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; |
| 221 | c = (coeffs[i] >> 1) << 1; | 221 | c = (coeffs[i] >> 1) << 1; |
| 222 | if (c >= 0) | 222 | if (c >= 0) |
| 223 | { | 223 | { |
| 224 | for (j = 0; j < count; j++) | 224 | for (j = 0; j < count; j++) |
| 225 | { | 225 | { |
| 226 | q0 = sample[j] - q2 + (c * (q1 >> 16)) + (((dword)(((dword)(c >> 1)) * ((dword)(q1 & 0xffff)))) >> 15); | 226 | q0 = sample[j] - q2 + (c * (q1 >> 16)) + (((dword)(((dword)(c >> 1)) * ((dword)(q1 & 0xffff)))) >> 15); |
| 227 | q2 = q1; | 227 | q2 = q1; |
| 228 | q1 = q0; | 228 | q1 = q0; |
| 229 | c -= CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT; | 229 | c -= CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT; |
| 230 | } | 230 | } |
| 231 | } | 231 | } |
| 232 | else | 232 | else |
| 233 | { | 233 | { |
| 234 | c = -c; | 234 | c = -c; |
| 235 | for (j = 0; j < count; j++) | 235 | for (j = 0; j < count; j++) |
| 236 | { | 236 | { |
| 237 | q0 = sample[j] - q2 - ((c * (q1 >> 16)) + (((dword)(((dword)(c >> 1)) * ((dword)(q1 & 0xffff)))) >> 15)); | 237 | q0 = sample[j] - q2 - ((c * (q1 >> 16)) + (((dword)(((dword)(c >> 1)) * ((dword)(q1 & 0xffff)))) >> 15)); |
| 238 | q2 = q1; | 238 | q2 = q1; |
| 239 | q1 = q0; | 239 | q1 = q0; |
| 240 | c += CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT; | 240 | c += CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT; |
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| 243 | coeffs[i] = c; | 243 | coeffs[i] = c; |
| 244 | buffer[i] = q1; | 244 | buffer[i] = q1; |
| 245 | buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = q2; | 245 | buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = q2; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | 248 | ||
| 249 | static void capidtmf_goertzel_result (long *buffer, long *coeffs) | 249 | static void capidtmf_goertzel_result(long *buffer, long *coeffs) |
| 250 | { | 250 | { |
| 251 | int i; | 251 | int i; |
| 252 | long d, e, q1, q2, lo, mid, hi; | 252 | long d, e, q1, q2, lo, mid, hi; |
| 253 | dword k; | 253 | dword k; |
| 254 | 254 | ||
| 255 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) | 255 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) |
| 256 | { | 256 | { |
| 257 | q1 = buffer[i]; | 257 | q1 = buffer[i]; |
| 258 | q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; | 258 | q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; |
| 259 | d = coeffs[i] >> 1; | 259 | d = coeffs[i] >> 1; |
| 260 | if (d >= 0) | 260 | if (d >= 0) |
| 261 | d = ((d << 1) * (-q1 >> 16)) + (((dword)(((dword) d) * ((dword)(-q1 & 0xffff)))) >> 15); | 261 | d = ((d << 1) * (-q1 >> 16)) + (((dword)(((dword) d) * ((dword)(-q1 & 0xffff)))) >> 15); |
| 262 | else | 262 | else |
| 263 | d = ((-d << 1) * (-q1 >> 16)) + (((dword)(((dword) -d) * ((dword)(-q1 & 0xffff)))) >> 15); | 263 | d = ((-d << 1) * (-q1 >> 16)) + (((dword)(((dword) -d) * ((dword)(-q1 & 0xffff)))) >> 15); |
| 264 | e = (q2 >= 0) ? q2 : -q2; | 264 | e = (q2 >= 0) ? q2 : -q2; |
| 265 | if (d >= 0) | 265 | if (d >= 0) |
| 266 | { | 266 | { |
| 267 | k = ((dword)(d & 0xffff)) * ((dword)(e & 0xffff)); | 267 | k = ((dword)(d & 0xffff)) * ((dword)(e & 0xffff)); |
| 268 | lo = k & 0xffff; | 268 | lo = k & 0xffff; |
| 269 | mid = k >> 16; | 269 | mid = k >> 16; |
| 270 | k = ((dword)(d >> 16)) * ((dword)(e & 0xffff)); | 270 | k = ((dword)(d >> 16)) * ((dword)(e & 0xffff)); |
| 271 | mid += k & 0xffff; | 271 | mid += k & 0xffff; |
| 272 | hi = k >> 16; | 272 | hi = k >> 16; |
| 273 | k = ((dword)(d & 0xffff)) * ((dword)(e >> 16)); | 273 | k = ((dword)(d & 0xffff)) * ((dword)(e >> 16)); |
| 274 | mid += k & 0xffff; | 274 | mid += k & 0xffff; |
| 275 | hi += k >> 16; | 275 | hi += k >> 16; |
| 276 | hi += ((dword)(d >> 16)) * ((dword)(e >> 16)); | 276 | hi += ((dword)(d >> 16)) * ((dword)(e >> 16)); |
| 277 | } | 277 | } |
| 278 | else | 278 | else |
| 279 | { | 279 | { |
| 280 | d = -d; | 280 | d = -d; |
| 281 | k = ((dword)(d & 0xffff)) * ((dword)(e & 0xffff)); | 281 | k = ((dword)(d & 0xffff)) * ((dword)(e & 0xffff)); |
| 282 | lo = -((long)(k & 0xffff)); | 282 | lo = -((long)(k & 0xffff)); |
| 283 | mid = -((long)(k >> 16)); | 283 | mid = -((long)(k >> 16)); |
| 284 | k = ((dword)(d >> 16)) * ((dword)(e & 0xffff)); | 284 | k = ((dword)(d >> 16)) * ((dword)(e & 0xffff)); |
| 285 | mid -= k & 0xffff; | 285 | mid -= k & 0xffff; |
| 286 | hi = -((long)(k >> 16)); | 286 | hi = -((long)(k >> 16)); |
| 287 | k = ((dword)(d & 0xffff)) * ((dword)(e >> 16)); | 287 | k = ((dword)(d & 0xffff)) * ((dword)(e >> 16)); |
| 288 | mid -= k & 0xffff; | 288 | mid -= k & 0xffff; |
| 289 | hi -= k >> 16; | 289 | hi -= k >> 16; |
| 290 | hi -= ((dword)(d >> 16)) * ((dword)(e >> 16)); | 290 | hi -= ((dword)(d >> 16)) * ((dword)(e >> 16)); |
| 291 | } | 291 | } |
| 292 | if (q2 < 0) | 292 | if (q2 < 0) |
| 293 | { | 293 | { |
| 294 | lo = -lo; | 294 | lo = -lo; |
| 295 | mid = -mid; | 295 | mid = -mid; |
| 296 | hi = -hi; | 296 | hi = -hi; |
| 297 | } | 297 | } |
| 298 | d = (q1 >= 0) ? q1 : -q1; | 298 | d = (q1 >= 0) ? q1 : -q1; |
| 299 | k = ((dword)(d & 0xffff)) * ((dword)(d & 0xffff)); | 299 | k = ((dword)(d & 0xffff)) * ((dword)(d & 0xffff)); |
| 300 | lo += k & 0xffff; | 300 | lo += k & 0xffff; |
| 301 | mid += k >> 16; | 301 | mid += k >> 16; |
| 302 | k = ((dword)(d >> 16)) * ((dword)(d & 0xffff)); | 302 | k = ((dword)(d >> 16)) * ((dword)(d & 0xffff)); |
| 303 | mid += (k & 0xffff) << 1; | 303 | mid += (k & 0xffff) << 1; |
| 304 | hi += (k >> 16) << 1; | 304 | hi += (k >> 16) << 1; |
| 305 | hi += ((dword)(d >> 16)) * ((dword)(d >> 16)); | 305 | hi += ((dword)(d >> 16)) * ((dword)(d >> 16)); |
| 306 | d = (q2 >= 0) ? q2 : -q2; | 306 | d = (q2 >= 0) ? q2 : -q2; |
| 307 | k = ((dword)(d & 0xffff)) * ((dword)(d & 0xffff)); | 307 | k = ((dword)(d & 0xffff)) * ((dword)(d & 0xffff)); |
| 308 | lo += k & 0xffff; | 308 | lo += k & 0xffff; |
| 309 | mid += k >> 16; | 309 | mid += k >> 16; |
| 310 | k = ((dword)(d >> 16)) * ((dword)(d & 0xffff)); | 310 | k = ((dword)(d >> 16)) * ((dword)(d & 0xffff)); |
| 311 | mid += (k & 0xffff) << 1; | 311 | mid += (k & 0xffff) << 1; |
| 312 | hi += (k >> 16) << 1; | 312 | hi += (k >> 16) << 1; |
| 313 | hi += ((dword)(d >> 16)) * ((dword)(d >> 16)); | 313 | hi += ((dword)(d >> 16)) * ((dword)(d >> 16)); |
| 314 | mid += lo >> 16; | 314 | mid += lo >> 16; |
| 315 | hi += mid >> 16; | 315 | hi += mid >> 16; |
| 316 | buffer[i] = (lo & 0xffff) | (mid << 16); | 316 | buffer[i] = (lo & 0xffff) | (mid << 16); |
| 317 | buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = hi; | 317 | buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = hi; |
| 318 | } | 318 | } |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | 321 | ||
| @@ -346,339 +346,339 @@ static void capidtmf_goertzel_result (long *buffer, long *coeffs) · 24 unmodified lines | |||
| 346 | 346 | ||
| 347 | static long capidtmf_recv_goertzel_coef_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = | 347 | static long capidtmf_recv_goertzel_coef_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = |
| 348 | { | 348 | { |
| 349 | 0xda97L * 2, /* 697 Hz (Low group 697 Hz) */ | 349 | 0xda97L * 2, /* 697 Hz (Low group 697 Hz) */ |
| 350 | 0xd299L * 2, /* 770 Hz (Low group 770 Hz) */ | 350 | 0xd299L * 2, /* 770 Hz (Low group 770 Hz) */ |
| 351 | 0xc8cbL * 2, /* 852 Hz (Low group 852 Hz) */ | 351 | 0xc8cbL * 2, /* 852 Hz (Low group 852 Hz) */ |
| 352 | 0xbd36L * 2, /* 941 Hz (Low group 941 Hz) */ | 352 | 0xbd36L * 2, /* 941 Hz (Low group 941 Hz) */ |
| 353 | 0x9501L * 2, /* 1209 Hz (High group 1209 Hz) */ | 353 | 0x9501L * 2, /* 1209 Hz (High group 1209 Hz) */ |
| 354 | 0x7f89L * 2, /* 1336 Hz (High group 1336 Hz) */ | 354 | 0x7f89L * 2, /* 1336 Hz (High group 1336 Hz) */ |
| 355 | 0x6639L * 2, /* 1477 Hz (High group 1477 Hz) */ | 355 | 0x6639L * 2, /* 1477 Hz (High group 1477 Hz) */ |
| 356 | 0x48c6L * 2, /* 1633 Hz (High group 1633 Hz) */ | 356 | 0x48c6L * 2, /* 1633 Hz (High group 1633 Hz) */ |
| 357 | 0xe14cL * 2, /* 630 Hz (Lower guard of low group 631 Hz) */ | 357 | 0xe14cL * 2, /* 630 Hz (Lower guard of low group 631 Hz) */ |
| 358 | 0xb2e0L * 2, /* 1015 Hz (Upper guard of low group 1039 Hz) */ | 358 | 0xb2e0L * 2, /* 1015 Hz (Upper guard of low group 1039 Hz) */ |
| 359 | 0xa1a0L * 2, /* 1130 Hz (Lower guard of high group 1140 Hz) */ | 359 | 0xa1a0L * 2, /* 1130 Hz (Lower guard of high group 1140 Hz) */ |
| 360 | 0x8a87L * 2, /* 1272 Hz (Guard between 1209 Hz and 1336 Hz: 1271 Hz) */ | 360 | 0x8a87L * 2, /* 1272 Hz (Guard between 1209 Hz and 1336 Hz: 1271 Hz) */ |
| 361 | 0x7353L * 2, /* 1405 Hz (2nd harmonics of 697 Hz and guard between 1336 Hz and 1477 Hz: 1405 Hz) */ | 361 | 0x7353L * 2, /* 1405 Hz (2nd harmonics of 697 Hz and guard between 1336 Hz and 1477 Hz: 1405 Hz) */ |
| 362 | 0x583bL * 2, /* 1552 Hz (2nd harmonics of 770 Hz and guard between 1477 Hz and 1633 Hz: 1553 Hz) */ | 362 | 0x583bL * 2, /* 1552 Hz (2nd harmonics of 770 Hz and guard between 1477 Hz and 1633 Hz: 1553 Hz) */ |
| 363 | 0x37d8L * 2, /* 1720 Hz (2nd harmonics of 852 Hz and upper guard of high group: 1715 Hz) */ | 363 | 0x37d8L * 2, /* 1720 Hz (2nd harmonics of 852 Hz and upper guard of high group: 1715 Hz) */ |
| 364 | 0x0000L * 2 /* 100-630 Hz (fundamentals) */ | 364 | 0x0000L * 2 /* 100-630 Hz (fundamentals) */ |
| 365 | }; | 365 | }; |
| 366 | 366 | ||
| 367 | 367 | ||
| 368 | static word capidtmf_recv_guard_snr_low_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = | 368 | static word capidtmf_recv_guard_snr_low_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = |
| 369 | { | 369 | { |
| 370 | 14, /* Low group peak versus 697 Hz */ | 370 | 14, /* Low group peak versus 697 Hz */ |
| 371 | 14, /* Low group peak versus 770 Hz */ | 371 | 14, /* Low group peak versus 770 Hz */ |
| 372 | 16, /* Low group peak versus 852 Hz */ | 372 | 16, /* Low group peak versus 852 Hz */ |
| 373 | 16, /* Low group peak versus 941 Hz */ | 373 | 16, /* Low group peak versus 941 Hz */ |
| 374 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1209 Hz */ | 374 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1209 Hz */ |
| 375 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1336 Hz */ | 375 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1336 Hz */ |
| 376 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1477 Hz */ | 376 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1477 Hz */ |
| 377 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1633 Hz */ | 377 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1633 Hz */ |
| 378 | 14, /* Low group peak versus 635 Hz */ | 378 | 14, /* Low group peak versus 635 Hz */ |
| 379 | 16, /* Low group peak versus 1010 Hz */ | 379 | 16, /* Low group peak versus 1010 Hz */ |
| 380 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1140 Hz */ | 380 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1140 Hz */ |
| 381 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1272 Hz */ | 381 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1272 Hz */ |
| 382 | DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 8, /* Low group peak versus 1405 Hz */ | 382 | DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 8, /* Low group peak versus 1405 Hz */ |
| 383 | DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 4, /* Low group peak versus 1555 Hz */ | 383 | DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 4, /* Low group peak versus 1555 Hz */ |
| 384 | DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 4, /* Low group peak versus 1715 Hz */ | 384 | DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 4, /* Low group peak versus 1715 Hz */ |
| 385 | 12 /* Low group peak versus 100-630 Hz */ | 385 | 12 /* Low group peak versus 100-630 Hz */ |
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 388 | 388 | ||
| 389 | static word capidtmf_recv_guard_snr_high_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = | 389 | static word capidtmf_recv_guard_snr_high_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = |
| 390 | { | 390 | { |
| 391 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 697 Hz */ | 391 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 697 Hz */ |
| 392 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 770 Hz */ | 392 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 770 Hz */ |
| 393 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 852 Hz */ | 393 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 852 Hz */ |
| 394 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 941 Hz */ | 394 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 941 Hz */ |
| 395 | 20, /* High group peak versus 1209 Hz */ | 395 | 20, /* High group peak versus 1209 Hz */ |
| 396 | 20, /* High group peak versus 1336 Hz */ | 396 | 20, /* High group peak versus 1336 Hz */ |
| 397 | 20, /* High group peak versus 1477 Hz */ | 397 | 20, /* High group peak versus 1477 Hz */ |
| 398 | 20, /* High group peak versus 1633 Hz */ | 398 | 20, /* High group peak versus 1633 Hz */ |
| 399 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 635 Hz */ | 399 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 635 Hz */ |
| 400 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 1010 Hz */ | 400 | CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 1010 Hz */ |
| 401 | 16, /* High group peak versus 1140 Hz */ | 401 | 16, /* High group peak versus 1140 Hz */ |
| 402 | 4, /* High group peak versus 1272 Hz */ | 402 | 4, /* High group peak versus 1272 Hz */ |
| 403 | 6, /* High group peak versus 1405 Hz */ | 403 | 6, /* High group peak versus 1405 Hz */ |
| 404 | 8, /* High group peak versus 1555 Hz */ | 404 | 8, /* High group peak versus 1555 Hz */ |
| 405 | 16, /* High group peak versus 1715 Hz */ | 405 | 16, /* High group peak versus 1715 Hz */ |
| 406 | 12 /* High group peak versus 100-630 Hz */ | 406 | 12 /* High group peak versus 100-630 Hz */ |
| 407 | }; | 407 | }; |
| 408 | 408 | ||
| 409 | 409 | ||
| 410 | /*---------------------------------------------------------------------------*/ | 410 | /*---------------------------------------------------------------------------*/ |
| 411 | 411 | ||
| 412 | static void capidtmf_recv_init (t_capidtmf_state *p_state) | 412 | static void capidtmf_recv_init(t_capidtmf_state *p_state) |
| 413 | { | 413 | { |
| 414 | p_state->recv.min_gap_duration = 1; | 414 | p_state->recv.min_gap_duration = 1; |
| 415 | p_state->recv.min_digit_duration = 1; | 415 | p_state->recv.min_digit_duration = 1; |
| 416 | 416 | ||
| 417 | p_state->recv.cycle_counter = 0; | 417 | p_state->recv.cycle_counter = 0; |
| 418 | p_state->recv.current_digit_on_time = 0; | 418 | p_state->recv.current_digit_on_time = 0; |
| 419 | p_state->recv.current_digit_off_time = 0; | 419 | p_state->recv.current_digit_off_time = 0; |
| 420 | p_state->recv.current_digit_value = CAPIDTMF_RECV_NO_DIGIT; | 420 | p_state->recv.current_digit_value = CAPIDTMF_RECV_NO_DIGIT; |
| 421 | 421 | ||
| 422 | p_state->recv.digit_write_pos = 0; | 422 | p_state->recv.digit_write_pos = 0; |
| 423 | p_state->recv.digit_read_pos = 0; | 423 | p_state->recv.digit_read_pos = 0; |
| 424 | p_state->recv.indication_state = 0; | 424 | p_state->recv.indication_state = 0; |
| 425 | p_state->recv.indication_state_ack = 0; | 425 | p_state->recv.indication_state_ack = 0; |
| 426 | p_state->recv.state = CAPIDTMF_RECV_STATE_IDLE; | 426 | p_state->recv.state = CAPIDTMF_RECV_STATE_IDLE; |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | 429 | ||
| 430 | void capidtmf_recv_enable (t_capidtmf_state *p_state, word min_digit_duration, word min_gap_duration) | 430 | void capidtmf_recv_enable(t_capidtmf_state *p_state, word min_digit_duration, word min_gap_duration) |
| 431 | { | 431 | { |
| 432 | p_state->recv.indication_state_ack &= CAPIDTMF_RECV_INDICATION_DIGIT; | 432 | p_state->recv.indication_state_ack &= CAPIDTMF_RECV_INDICATION_DIGIT; |
| 433 | p_state->recv.min_digit_duration = (word)(((((dword) min_digit_duration) * 8) + | 433 | p_state->recv.min_digit_duration = (word)(((((dword) min_digit_duration) * 8) + |
| 434 | ((dword)(CAPIDTMF_RECV_TIME_GRANULARITY / 2))) / ((dword) CAPIDTMF_RECV_TIME_GRANULARITY)); | 434 | ((dword)(CAPIDTMF_RECV_TIME_GRANULARITY / 2))) / ((dword) CAPIDTMF_RECV_TIME_GRANULARITY)); |
| 435 | if (p_state->recv.min_digit_duration <= 1) | 435 | if (p_state->recv.min_digit_duration <= 1) |
| 436 | p_state->recv.min_digit_duration = 1; | 436 | p_state->recv.min_digit_duration = 1; |
| 437 | else | 437 | else |
| 438 | (p_state->recv.min_digit_duration)--; | 438 | (p_state->recv.min_digit_duration)--; |
| 439 | p_state->recv.min_gap_duration = | 439 | p_state->recv.min_gap_duration = |
| 440 | (word)((((dword) min_gap_duration) * 8) / ((dword) CAPIDTMF_RECV_TIME_GRANULARITY)); | 440 | (word)((((dword) min_gap_duration) * 8) / ((dword) CAPIDTMF_RECV_TIME_GRANULARITY)); |
| 441 | if (p_state->recv.min_gap_duration <= 1) | 441 | if (p_state->recv.min_gap_duration <= 1) |
| 442 | p_state->recv.min_gap_duration = 1; | 442 | p_state->recv.min_gap_duration = 1; |
| 443 | else | 443 | else |
| 444 | (p_state->recv.min_gap_duration)--; | 444 | (p_state->recv.min_gap_duration)--; |
| 445 | p_state->recv.state |= CAPIDTMF_RECV_STATE_DTMF_ACTIVE; | 445 | p_state->recv.state |= CAPIDTMF_RECV_STATE_DTMF_ACTIVE; |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | 448 | ||
| 449 | void capidtmf_recv_disable (t_capidtmf_state *p_state) | 449 | void capidtmf_recv_disable(t_capidtmf_state *p_state) |
| 450 | { | 450 | { |
| 451 | p_state->recv.state &= ~CAPIDTMF_RECV_STATE_DTMF_ACTIVE; | 451 | p_state->recv.state &= ~CAPIDTMF_RECV_STATE_DTMF_ACTIVE; |
| 452 | if (p_state->recv.state == CAPIDTMF_RECV_STATE_IDLE) | 452 | if (p_state->recv.state == CAPIDTMF_RECV_STATE_IDLE) |
| 453 | capidtmf_recv_init (p_state); | 453 | capidtmf_recv_init(p_state); |
| 454 | else | 454 | else |
| 455 | { | 455 | { |
| 456 | p_state->recv.cycle_counter = 0; | 456 | p_state->recv.cycle_counter = 0; |
| 457 | p_state->recv.current_digit_on_time = 0; | 457 | p_state->recv.current_digit_on_time = 0; |
| 458 | p_state->recv.current_digit_off_time = 0; | 458 | p_state->recv.current_digit_off_time = 0; |
| 459 | p_state->recv.current_digit_value = CAPIDTMF_RECV_NO_DIGIT; | 459 | p_state->recv.current_digit_value = CAPIDTMF_RECV_NO_DIGIT; |
| 460 | } | 460 | } |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | 463 | ||
| 464 | word capidtmf_recv_indication (t_capidtmf_state *p_state, byte *buffer) | 464 | word capidtmf_recv_indication(t_capidtmf_state *p_state, byte *buffer) |
| 465 | { | 465 | { |
| 466 | word i, j, k, flags; | 466 | word i, j, k, flags; |
| 467 | 467 | ||
| 468 | flags = p_state->recv.indication_state ^ p_state->recv.indication_state_ack; | 468 | flags = p_state->recv.indication_state ^ p_state->recv.indication_state_ack; |
| 469 | p_state->recv.indication_state_ack ^= flags & CAPIDTMF_RECV_INDICATION_DIGIT; | 469 | p_state->recv.indication_state_ack ^= flags & CAPIDTMF_RECV_INDICATION_DIGIT; |
| 470 | if (p_state->recv.digit_write_pos != p_state->recv.digit_read_pos) | 470 | if (p_state->recv.digit_write_pos != p_state->recv.digit_read_pos) |
| 471 | { | 471 | { |
| 472 | i = 0; | 472 | i = 0; |
| 473 | k = p_state->recv.digit_write_pos; | 473 | k = p_state->recv.digit_write_pos; |
| 474 | j = p_state->recv.digit_read_pos; | 474 | j = p_state->recv.digit_read_pos; |
| 475 | do | 475 | do |
| 476 | { | 476 | { |
| 477 | buffer[i++] = p_state->recv.digit_buffer[j]; | 477 | buffer[i++] = p_state->recv.digit_buffer[j]; |
| 478 | j = (j == CAPIDTMF_RECV_DIGIT_BUFFER_SIZE - 1) ? 0 : j + 1; | 478 | j = (j == CAPIDTMF_RECV_DIGIT_BUFFER_SIZE - 1) ? 0 : j + 1; |
| 479 | } while (j != k); | 479 | } while (j != k); |
| 480 | p_state->recv.digit_read_pos = k; | 480 | p_state->recv.digit_read_pos = k; |
| 481 | return (i); | 481 | return (i); |
| 482 | } | 482 | } |
| 483 | p_state->recv.indication_state_ack ^= flags; | 483 | p_state->recv.indication_state_ack ^= flags; |
| 484 | return (0); | 484 | return (0); |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | 487 | ||
| 488 | #define CAPIDTMF_RECV_WINDOWED_SAMPLES 32 | 488 | #define CAPIDTMF_RECV_WINDOWED_SAMPLES 32 |
| 489 | 489 | ||
| 490 | void capidtmf_recv_block (t_capidtmf_state *p_state, byte *buffer, word length) | 490 | void capidtmf_recv_block(t_capidtmf_state *p_state, byte *buffer, word length) |
| 491 | { | 491 | { |
| 492 | byte result_digit; | 492 | byte result_digit; |
| 493 | word sample_number, cycle_counter, n, i; | 493 | word sample_number, cycle_counter, n, i; |
| 494 | word low_peak, high_peak; | 494 | word low_peak, high_peak; |
| 495 | dword lo, hi; | 495 | dword lo, hi; |
| 496 | byte *p; | 496 | byte *p; |
| 497 | short *q; | 497 | short *q; |
| 498 | byte goertzel_result_buffer[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; | 498 | byte goertzel_result_buffer[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT]; |
| 499 | short windowed_sample_buffer[CAPIDTMF_RECV_WINDOWED_SAMPLES]; | 499 | short windowed_sample_buffer[CAPIDTMF_RECV_WINDOWED_SAMPLES]; |
| 500 | 500 | ||
| 501 | 501 | ||
| 502 | if (p_state->recv.state & CAPIDTMF_RECV_STATE_DTMF_ACTIVE) | 502 | if (p_state->recv.state & CAPIDTMF_RECV_STATE_DTMF_ACTIVE) |
| 503 | { | 503 | { |
| 504 | cycle_counter = p_state->recv.cycle_counter; | 504 | cycle_counter = p_state->recv.cycle_counter; |
| 505 | sample_number = 0; | 505 | sample_number = 0; |
| 506 | while (sample_number < length) | 506 | while (sample_number < length) |
| 507 | { | 507 | { |
| 508 | if (cycle_counter < CAPIDTMF_RECV_ACCUMULATE_CYCLES) | 508 | if (cycle_counter < CAPIDTMF_RECV_ACCUMULATE_CYCLES) |
| 509 | { | 509 | { |
| 510 | if (cycle_counter == 0) | 510 | if (cycle_counter == 0) |
| 511 | { | 511 | { |
| 512 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) | 512 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) |
| 513 | { | 513 | { |
| 514 | p_state->recv.goertzel_buffer[0][i] = 0; | 514 | p_state->recv.goertzel_buffer[0][i] = 0; |
| 515 | p_state->recv.goertzel_buffer[1][i] = 0; | 515 | p_state->recv.goertzel_buffer[1][i] = 0; |
| 516 | } | 516 | } |
| 517 | } | 517 | } |
| 518 | n = CAPIDTMF_RECV_ACCUMULATE_CYCLES - cycle_counter; | 518 | n = CAPIDTMF_RECV_ACCUMULATE_CYCLES - cycle_counter; |
| 519 | if (n > length - sample_number) | 519 | if (n > length - sample_number) |
| 520 | n = length - sample_number; | 520 | n = length - sample_number; |
| 521 | if (n > CAPIDTMF_RECV_WINDOWED_SAMPLES) | 521 | if (n > CAPIDTMF_RECV_WINDOWED_SAMPLES) |
| 522 | n = CAPIDTMF_RECV_WINDOWED_SAMPLES; | 522 | n = CAPIDTMF_RECV_WINDOWED_SAMPLES; |
| 523 | p = buffer + sample_number; | 523 | p = buffer + sample_number; |
| 524 | q = capidtmf_recv_window_function + cycle_counter; | 524 | q = capidtmf_recv_window_function + cycle_counter; |
| 525 | if (p_state->ulaw) | 525 | if (p_state->ulaw) |
| 526 | { | 526 | { |
| 527 | for (i = 0; i < n; i++) | 527 | for (i = 0; i < n; i++) |
| 528 | { | 528 | { |
| 529 | windowed_sample_buffer[i] = | 529 | windowed_sample_buffer[i] = |
| 530 | (short)((capidtmf_expand_table_ulaw[p[i]] * ((long)(q[i]))) >> 15); | 530 | (short)((capidtmf_expand_table_ulaw[p[i]] * ((long)(q[i]))) >> 15); |
| 531 | } | 531 | } |
| 532 | } | 532 | } |
| 533 | else | 533 | else |
| 534 | { | 534 | { |
| 535 | for (i = 0; i < n; i++) | 535 | for (i = 0; i < n; i++) |
| 536 | { | 536 | { |
| 537 | windowed_sample_buffer[i] = | 537 | windowed_sample_buffer[i] = |
| 538 | (short)((capidtmf_expand_table_alaw[p[i]] * ((long)(q[i]))) >> 15); | 538 | (short)((capidtmf_expand_table_alaw[p[i]] * ((long)(q[i]))) >> 15); |
| 539 | } | 539 | } |
| 540 | } | 540 | } |
| 541 | capidtmf_recv_goertzel_coef_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - 1] = CAPIDTMF_RECV_FUNDAMENTAL_OFFSET; | 541 | capidtmf_recv_goertzel_coef_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - 1] = CAPIDTMF_RECV_FUNDAMENTAL_OFFSET; |
| 542 | capidtmf_goertzel_loop (p_state->recv.goertzel_buffer[0], | 542 | capidtmf_goertzel_loop(p_state->recv.goertzel_buffer[0], |
| 543 | capidtmf_recv_goertzel_coef_table, windowed_sample_buffer, n); | 543 | capidtmf_recv_goertzel_coef_table, windowed_sample_buffer, n); |
| 544 | cycle_counter += n; | 544 | cycle_counter += n; |
| 545 | sample_number += n; | 545 | sample_number += n; |
| 546 | } | 546 | } |
| 547 | else | 547 | else |
| 548 | { | 548 | { |
| 549 | capidtmf_goertzel_result (p_state->recv.goertzel_buffer[0], | 549 | capidtmf_goertzel_result(p_state->recv.goertzel_buffer[0], |
| 550 | capidtmf_recv_goertzel_coef_table); | 550 | capidtmf_recv_goertzel_coef_table); |
| 551 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) | 551 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) |
| 552 | { | 552 | { |
| 553 | lo = (dword)(p_state->recv.goertzel_buffer[0][i]); | 553 | lo = (dword)(p_state->recv.goertzel_buffer[0][i]); |
| 554 | hi = (dword)(p_state->recv.goertzel_buffer[1][i]); | 554 | hi = (dword)(p_state->recv.goertzel_buffer[1][i]); |
| 555 | if (hi != 0) | 555 | if (hi != 0) |
| 556 | { | 556 | { |
| 557 | n = capidtmf_dword_leading_zeroes (hi); | 557 | n = capidtmf_dword_leading_zeroes(hi); |
| 558 | hi = (hi << n) | (lo >> (32 - n)); | 558 | hi = (hi << n) | (lo >> (32 - n)); |
| 559 | } | 559 | } |
| 560 | else | 560 | else |
| 561 | { | 561 | { |
| 562 | n = capidtmf_dword_leading_zeroes (lo); | 562 | n = capidtmf_dword_leading_zeroes(lo); |
| 563 | hi = lo << n; | 563 | hi = lo << n; |
| 564 | n += 32; | 564 | n += 32; |
| 565 | } | 565 | } |
| 566 | n = 195 - 3 * n; | 566 | n = 195 - 3 * n; |
| 567 | if (hi >= 0xcb300000L) | 567 | if (hi >= 0xcb300000L) |
| 568 | n += 2; | 568 | n += 2; |
| 569 | else if (hi >= 0xa1450000L) | 569 | else if (hi >= 0xa1450000L) |
| 570 | n++; | 570 | n++; |
| 571 | goertzel_result_buffer[i] = (byte) n; | 571 | goertzel_result_buffer[i] = (byte) n; |
| 572 | } | 572 | } |
| 573 | low_peak = DSPDTMF_RX_SENSITIVITY_LOW_DEFAULT; | 573 | low_peak = DSPDTMF_RX_SENSITIVITY_LOW_DEFAULT; |
| 574 | result_digit = CAPIDTMF_RECV_NO_DIGIT; | 574 | result_digit = CAPIDTMF_RECV_NO_DIGIT; |
| 575 | for (i = 0; i < CAPIDTMF_LOW_GROUP_FREQUENCIES; i++) | 575 | for (i = 0; i < CAPIDTMF_LOW_GROUP_FREQUENCIES; i++) |
| 576 | { | 576 | { |
| 577 | if (goertzel_result_buffer[i] > low_peak) | 577 | if (goertzel_result_buffer[i] > low_peak) |
| 578 | { | 578 | { |
| 579 | low_peak = goertzel_result_buffer[i]; | 579 | low_peak = goertzel_result_buffer[i]; |
| 580 | result_digit = (byte) i; | 580 | result_digit = (byte) i; |
| 581 | } | 581 | } |
| 582 | } | 582 | } |
| 583 | high_peak = DSPDTMF_RX_SENSITIVITY_HIGH_DEFAULT; | 583 | high_peak = DSPDTMF_RX_SENSITIVITY_HIGH_DEFAULT; |
| 584 | n = CAPIDTMF_RECV_NO_DIGIT; | 584 | n = CAPIDTMF_RECV_NO_DIGIT; |
| 585 | for (i = CAPIDTMF_LOW_GROUP_FREQUENCIES; i < CAPIDTMF_RECV_BASE_FREQUENCY_COUNT; i++) | 585 | for (i = CAPIDTMF_LOW_GROUP_FREQUENCIES; i < CAPIDTMF_RECV_BASE_FREQUENCY_COUNT; i++) |
| 586 | { | 586 | { |
| 587 | if (goertzel_result_buffer[i] > high_peak) | 587 | if (goertzel_result_buffer[i] > high_peak) |
| 588 | { | 588 | { |
| 589 | high_peak = goertzel_result_buffer[i]; | 589 | high_peak = goertzel_result_buffer[i]; |
| 590 | n = (i - CAPIDTMF_LOW_GROUP_FREQUENCIES) << 2; | 590 | n = (i - CAPIDTMF_LOW_GROUP_FREQUENCIES) << 2; |
| 591 | } | 591 | } |
| 592 | } | 592 | } |
| 593 | result_digit |= (byte) n; | 593 | result_digit |= (byte) n; |
| 594 | if (low_peak + DSPDTMF_RX_HIGH_EXCEEDING_LOW_DEFAULT < high_peak) | 594 | if (low_peak + DSPDTMF_RX_HIGH_EXCEEDING_LOW_DEFAULT < high_peak) |
| 595 | result_digit = CAPIDTMF_RECV_NO_DIGIT; | 595 | result_digit = CAPIDTMF_RECV_NO_DIGIT; |
| 596 | if (high_peak + DSPDTMF_RX_LOW_EXCEEDING_HIGH_DEFAULT < low_peak) | 596 | if (high_peak + DSPDTMF_RX_LOW_EXCEEDING_HIGH_DEFAULT < low_peak) |
| 597 | result_digit = CAPIDTMF_RECV_NO_DIGIT; | 597 | result_digit = CAPIDTMF_RECV_NO_DIGIT; |
| 598 | n = 0; | 598 | n = 0; |
| 599 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) | 599 | for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++) |
| 600 | { | 600 | { |
| 601 | if ((((short)(low_peak - goertzel_result_buffer[i] - capidtmf_recv_guard_snr_low_table[i])) < 0) | 601 | if ((((short)(low_peak - goertzel_result_buffer[i] - capidtmf_recv_guard_snr_low_table[i])) < 0) |
| 602 | || (((short)(high_peak - goertzel_result_buffer[i] - capidtmf_recv_guard_snr_high_table[i])) < 0)) | 602 | || (((short)(high_peak - goertzel_result_buffer[i] - capidtmf_recv_guard_snr_high_table[i])) < 0)) |
| 603 | { | 603 | { |
| 604 | n++; | 604 | n++; |
| 605 | } | 605 | } |
| 606 | } | 606 | } |
| 607 | if (n != 2) | 607 | if (n != 2) |
| 608 | result_digit = CAPIDTMF_RECV_NO_DIGIT; | 608 | result_digit = CAPIDTMF_RECV_NO_DIGIT; |
| 609 | 609 | ||
| 610 | if (result_digit == CAPIDTMF_RECV_NO_DIGIT) | 610 | if (result_digit == CAPIDTMF_RECV_NO_DIGIT) |
| 611 | { | 611 | { |
| 612 | if (p_state->recv.current_digit_on_time != 0) | 612 | if (p_state->recv.current_digit_on_time != 0) |
| 613 | { | 613 | { |
| 614 | if (++(p_state->recv.current_digit_off_time) >= p_state->recv.min_gap_duration) | 614 | if (++(p_state->recv.current_digit_off_time) >= p_state->recv.min_gap_duration) |
| 615 | { | 615 | { |
| 616 | p_state->recv.current_digit_on_time = 0; | 616 | p_state->recv.current_digit_on_time = 0; |
| 617 | p_state->recv.current_digit_off_time = 0; | 617 | p_state->recv.current_digit_off_time = 0; |
| 618 | } | 618 | } |
| 619 | } | 619 | } |
| 620 | else | 620 | else |
| 621 | { | 621 | { |
| 622 | if (p_state->recv.current_digit_off_time != 0) | 622 | if (p_state->recv.current_digit_off_time != 0) |
| 623 | (p_state->recv.current_digit_off_time)--; | 623 | (p_state->recv.current_digit_off_time)--; |
| 624 | } | 624 | } |
| 625 | } | 625 | } |
| 626 | else | 626 | else |
| 627 | { | 627 | { |
| 628 | if ((p_state->recv.current_digit_on_time == 0) | 628 | if ((p_state->recv.current_digit_on_time == 0) |
| 629 | && (p_state->recv.current_digit_off_time != 0)) | ||
| 630 | { | ||
| 631 | (p_state->recv.current_digit_off_time)--; | ||
| 632 | } | ||
| 633 | else | ||
| 634 | { | ||
| 635 | n = p_state->recv.current_digit_off_time; | ||
| 636 | if ((p_state->recv.current_digit_on_time != 0) | ||
| 637 | && (result_digit != p_state->recv.current_digit_value)) | ||
| 638 | { | ||
| 639 | p_state->recv.current_digit_on_time = 0; | ||
| 640 | n = 0; | ||
| 641 | } | ||
| 642 | p_state->recv.current_digit_value = result_digit; | ||
| 643 | p_state->recv.current_digit_off_time = 0; | ||
| 644 | if (p_state->recv.current_digit_on_time != 0xffff) | ||
| 645 | { | ||
| 646 | p_state->recv.current_digit_on_time += n + 1; | ||
| 647 | if (p_state->recv.current_digit_on_time >= p_state->recv.min_digit_duration) | ||
| 648 | { | ||
| 649 | p_state->recv.current_digit_on_time = 0xffff; | ||
| 650 | i = (p_state->recv.digit_write_pos == CAPIDTMF_RECV_DIGIT_BUFFER_SIZE - 1) ? | ||
| 651 | 0 : p_state->recv.digit_write_pos + 1; | ||
| 652 | if (i == p_state->recv.digit_read_pos) | ||
| 653 | { | ||
| 654 | trace (dprintf ("%s,%d: Receive digit overrun", | ||
| 655 | (char *)(FILE_), __LINE__)); | ||
| 656 | } | ||
| 657 | else | ||
| 658 | { | ||
| 659 | p_state->recv.digit_buffer[p_state->recv.digit_write_pos] = result_digit; | ||
| 660 | p_state->recv.digit_write_pos = i; | ||
| 661 | p_state->recv.indication_state = | ||
| 662 | (p_state->recv.indication_state & ~CAPIDTMF_RECV_INDICATION_DIGIT) | | ||
| 663 | (~p_state->recv.indication_state_ack & CAPIDTMF_RECV_INDICATION_DIGIT); | ||
| 664 | } | ||
| 665 | } | ||
| 666 | } | ||
| 667 | } | ||
| 668 | } | ||
| 669 | cycle_counter = 0; | ||
| 670 | sample_number++; | ||
| 671 | } | ||
| 672 | } | ||
| 673 | p_state->recv.cycle_counter = cycle_counter; | ||
| 674 | } | ||
59 more lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 625 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 1599 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 652 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 3840 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 233 lines aren’t shown here.
This diff is large: its 352 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 1539 lines aren’t shown here.
This diff is large: its 189 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 216 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 363 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 774 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 352 lines aren’t shown here.
This diff is large: its 163 lines aren’t shown here.
This diff is large: its 713 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 360 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 1544 lines aren’t shown here.
This diff is large: its 566 lines aren’t shown here.
This diff is large: its 400 lines aren’t shown here.
This diff is large: its 325 lines aren’t shown here.
This diff is large: its 3258 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 138 lines aren’t shown here.
This diff is large: its 29086 lines aren’t shown here.
This diff is large: its 142 lines aren’t shown here.
This diff is large: its 304 lines aren’t shown here.
This diff is large: its 840 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 660 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 897 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 355 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 203 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 275 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 732 lines aren’t shown here.
This diff is large: its 326 lines aren’t shown here.
This diff is large: its 353 lines aren’t shown here.
This diff is large: its 178 lines aren’t shown here.
This diff is large: its 516 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 266 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 3426 lines aren’t shown here.
This diff is large: its 1043 lines aren’t shown here.
This diff is large: its 1181 lines aren’t shown here.
This diff is large: its 189 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 460 lines aren’t shown here.
This diff is large: its 735 lines aren’t shown here.
This diff is large: its 322 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 356 lines aren’t shown here.
This diff is large: its 1033 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 251 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 253 lines aren’t shown here.
This diff is large: its 552 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 305 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 1404 lines aren’t shown here.
This diff is large: its 412 lines aren’t shown here.
This diff is large: its 741 lines aren’t shown here.
This diff is large: its 861 lines aren’t shown here.
This diff is large: its 228 lines aren’t shown here.
This diff is large: its 488 lines aren’t shown here.
This diff is large: its 338 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 688 lines aren’t shown here.
This diff is large: its 975 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 764 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 359 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 969 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 1485 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 941 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 173 lines aren’t shown here.
This diff is large: its 385 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 343 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 454 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 1019 lines aren’t shown here.
This diff is large: its 456 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 2301 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 419 lines aren’t shown here.
This diff is large: its 647 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 308 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 246 lines aren’t shown here.
This diff is large: its 225 lines aren’t shown here.
This diff is large: its 293 lines aren’t shown here.
This diff is large: its 198 lines aren’t shown here.
This diff is large: its 131 lines aren’t shown here.
This diff is large: its 318 lines aren’t shown here.
This diff is large: its 2736 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 2729 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 145 lines aren’t shown here.
This diff is large: its 1090 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 219 lines aren’t shown here.
This diff is large: its 228 lines aren’t shown here.
This diff is large: its 196 lines aren’t shown here.
This diff is large: its 452 lines aren’t shown here.
This diff is large: its 205 lines aren’t shown here.
This diff is large: its 241 lines aren’t shown here.
This diff is large: its 644 lines aren’t shown here.
This diff is large: its 220 lines aren’t shown here.
This diff is large: its 221 lines aren’t shown here.
This diff is large: its 259 lines aren’t shown here.
This diff is large: its 318 lines aren’t shown here.
This diff is large: its 395 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 572 lines aren’t shown here.
This diff is large: its 222 lines aren’t shown here.
This diff is large: its 218 lines aren’t shown here.
This diff is large: its 246 lines aren’t shown here.
This diff is large: its 309 lines aren’t shown here.
This diff is large: its 195 lines aren’t shown here.
This diff is large: its 214 lines aren’t shown here.
This diff is large: its 555 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 692 lines aren’t shown here.
This diff is large: its 361 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 304 lines aren’t shown here.
This diff is large: its 800 lines aren’t shown here.
This diff is large: its 1930 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 2255 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 2644 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 3224 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 1400 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 430 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 398 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 1054 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 1229 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 1668 lines aren’t shown here.
This diff is large: its 636 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 255 lines aren’t shown here.
This diff is large: its 122 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 1263 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 362 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 282 lines aren’t shown here.
This diff is large: its 333 lines aren’t shown here.
This diff is large: its 416 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 456 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 871 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 763 lines aren’t shown here.
This diff is large: its 501 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 357 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 318 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 371 lines aren’t shown here.
This diff is large: its 286 lines aren’t shown here.
This diff is large: its 518 lines aren’t shown here.
This diff is large: its 221 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 235 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 120 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 216 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 206 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 593 lines aren’t shown here.
This diff is large: its 754 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 210 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 3 lines aren’t shown here.
This diff is large: its 900 lines aren’t shown here.
This diff is large: its 952 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 1037 lines aren’t shown here.
This diff is large: its 179 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 196 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 215 lines aren’t shown here.
This diff is large: its 1162 lines aren’t shown here.
This diff is large: its 385 lines aren’t shown here.
This diff is large: its 859 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 819 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 187 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 454 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 2499 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 523 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 625 lines aren’t shown here.
This diff is large: its 193 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 2543 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 280 lines aren’t shown here.
This diff is large: its 372 lines aren’t shown here.
This diff is large: its 220 lines aren’t shown here.
This diff is large: its 281 lines aren’t shown here.
This diff is large: its 1838 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 517 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 1711 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 233 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 179 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 331 lines aren’t shown here.
This diff is large: its 282 lines aren’t shown here.
This diff is large: its 348 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 326 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 1256 lines aren’t shown here.
This diff is large: its 1478 lines aren’t shown here.
This diff is large: its 368 lines aren’t shown here.
This diff is large: its 1710 lines aren’t shown here.
This diff is large: its 644 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 890 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 256 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 472 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 431 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 930 lines aren’t shown here.
This diff is large: its 4394 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 1605 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 328 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 503 lines aren’t shown here.
This diff is large: its 406 lines aren’t shown here.
This diff is large: its 128 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 676 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 320 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 213 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 225 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 4591 lines aren’t shown here.
This diff is large: its 628 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 1693 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 316 lines aren’t shown here.
This diff is large: its 188 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 426 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 269 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 416 lines aren’t shown here.
This diff is large: its 3732 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 668 lines aren’t shown here.
This diff is large: its 929 lines aren’t shown here.
This diff is large: its 216 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 333 lines aren’t shown here.
This diff is large: its 347 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 1644 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 256 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 118 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 1020 lines aren’t shown here.
This diff is large: its 642 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 509 lines aren’t shown here.
This diff is large: its 1670 lines aren’t shown here.
This diff is large: its 239 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 272 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 210 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 472 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 1545 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 300 lines aren’t shown here.
This diff is large: its 396 lines aren’t shown here.
This diff is large: its 662 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 467 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 1051 lines aren’t shown here.
This diff is large: its 388 lines aren’t shown here.
This diff is large: its 365 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 149 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 968 lines aren’t shown here.
This diff is large: its 433 lines aren’t shown here.
This diff is large: its 771 lines aren’t shown here.
This diff is large: its 239 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 291 lines aren’t shown here.
This diff is large: its 248 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 316 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 215 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 1828 lines aren’t shown here.
This diff is large: its 238 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 1834 lines aren’t shown here.
This diff is large: its 505 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 134 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 558 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 159 lines aren’t shown here.
This diff is large: its 248 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 479 lines aren’t shown here.
This diff is large: its 302 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 238 lines aren’t shown here.
This diff is large: its 557 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 282 lines aren’t shown here.
This diff is large: its 668 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 162 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 134 lines aren’t shown here.
This diff is large: its 658 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 1622 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 365 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 780 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 498 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 2100 lines aren’t shown here.
This diff is large: its 191 lines aren’t shown here.
This diff is large: its 999 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is larger than a page shows: the files after these aren’t listed. Clone the repository to see all of it.