moving openairITS from trunk to extras
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7778 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
## INSTRUCTIONS
|
||||
## - check the coherence of the OPENAIRITS_DIR and MOD_DIR with YOUR platform
|
||||
## - configure the module dependencies by running the following command:
|
||||
## sudo depmod -a
|
||||
## - install 'iw' by the following command:
|
||||
## sudo apt-get install iw
|
||||
## - allow Ubuntu to reply to a PING in Broadcast by the following command:
|
||||
## echo 0 | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
|
||||
## run the following shell
|
||||
## voila !!
|
||||
|
||||
#Path configuration
|
||||
MOD_DIR=/lib/modules/`uname -r`/kernel
|
||||
#MOD_DIR=/lib/modules/2.6.32.11+drm33.2.openairinterface.bigphys.rtai/updates
|
||||
|
||||
#Modules compilation
|
||||
cd ${OPENAIRITS_DIR}/mac/DOT11/
|
||||
sudo make clean
|
||||
sudo make MAC=1
|
||||
|
||||
sudo rm ${MOD_DIR}/compat/compat.ko
|
||||
sudo rm ${MOD_DIR}/net/wireless/cfg80211.ko
|
||||
sudo rm ${MOD_DIR}/net/mac80211/mac80211_eurecom.ko
|
||||
|
||||
sudo mkdir ${MOD_DIR}/compat
|
||||
sudo mkdir ${MOD_DIR}/net/wireless
|
||||
sudo mkdir ${MOD_DIR}/net/mac80211
|
||||
|
||||
sudo cp ${OPENAIRITS_DIR}/mac/DOT11/compat/compat.ko ${MOD_DIR}/compat/compat.ko
|
||||
sudo cp ${OPENAIRITS_DIR}/mac/DOT11/net/wireless/cfg80211.ko ${MOD_DIR}/net/wireless/cfg80211.ko
|
||||
sudo cp ${OPENAIRITS_DIR}/mac/DOT11/net/mac80211/mac80211_eurecom.ko ${MOD_DIR}/net/mac80211/mac80211_eurecom.ko
|
||||
|
||||
cd ${OPENAIRITS_DIR}/phy/DRIVERS/
|
||||
sudo make clean
|
||||
sudo make
|
||||
|
||||
#Go back to the source directory
|
||||
cd ${OPENAIRITS_DIR}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
## INSTRUCTIONS
|
||||
## - check the coherence of the OPENAIRITS_DIR and MOD_DIR with YOUR platform
|
||||
## - configure the module dependencies by running the following command:
|
||||
## sudo depmod -a
|
||||
## - install 'iw' by the following command:
|
||||
## sudo apt-get install iw
|
||||
## - allow Ubuntu to reply to a PING in Broadcast by the following command:
|
||||
## echo 0 | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
|
||||
## run the following shell
|
||||
## voila !!
|
||||
|
||||
# Interface configuration (interface type, MAC address, IP address, disable ARP)
|
||||
sudo iw phy phy0 interface add wlan0 type ibss 4addr off
|
||||
sudo ifconfig wlan0 hw ether 10:11:12:13:14:15
|
||||
sudo ifconfig wlan0 192.168.1.1 up -arp
|
||||
|
||||
# Static ARP table
|
||||
sudo arp -i wlan0 -s 192.168.1.2 10:21:22:23:24:25
|
||||
sudo arp -i wlan0 -s 192.168.1.255 FF:FF:FF:FF:FF:FF
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Module loading
|
||||
sudo depmod -a
|
||||
sudo modprobe mac80211_eurecom
|
||||
sudo insmod ${OPENAIRITS_DIR}/phy/DRIVERS/ieee80211p.ko
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
## INSTRUCTIONS
|
||||
## - check the coherence of the OPENAIRITS_DIR and MOD_DIR with YOUR platform
|
||||
## - configure the module dependencies by running the following command:
|
||||
## sudo depmod -a
|
||||
## - install 'iw' by the following command:
|
||||
## sudo apt-get install iw
|
||||
## - allow Ubuntu to reply to a PING in Broadcast by the following command:
|
||||
## echo 0 | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
|
||||
## run the following shell
|
||||
## voila !!
|
||||
|
||||
#Environment variables
|
||||
export OPENAIR_HOME=/home/thales/openair4G
|
||||
export OPENAIR1_DIR=$OPENAIR_HOME/openair1
|
||||
export OPENAIR2_DIR=$OPENAIR_HOME/openair2
|
||||
export OPENAIR3_DIR=$OPENAIR_HOME/openair3
|
||||
export OPENAIR_TARGETS=$OPENAIR_HOME/targets
|
||||
export OPENAIRITS_DIR=$OPENAIR_HOME/openairITS
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
drivers
|
||||
mac80211
|
||||
bluetooth
|
||||
include
|
||||
net
|
||||
compat
|
||||
udev
|
||||
*~
|
||||
git-describe
|
||||
compat-release
|
||||
master-tag
|
||||
Module.symvers
|
||||
module.order
|
||||
.pc
|
||||
code-metrics.txt
|
||||
compat_base_tree
|
||||
compat_base_tree_version
|
||||
compat_version
|
||||
.compat_autoconf_compat-*
|
||||
.config
|
||||
.config.mk_md5sum.txt
|
||||
.tmp_versions/
|
||||
MAINTAINERS
|
||||
modules
|
||||
modules.order
|
||||
@@ -1,356 +0,0 @@
|
||||
|
||||
NOTE! This copyright does *not* cover user programs that use kernel
|
||||
services by normal system calls - this is merely considered normal use
|
||||
of the kernel, and does *not* fall under the heading of "derived work".
|
||||
Also note that the GPL below is copyrighted by the Free Software
|
||||
Foundation, but the instance of code that it refers to (the Linux
|
||||
kernel) is copyrighted by me and others who actually wrote it.
|
||||
|
||||
Also note that the only valid version of the GPL as far as the kernel
|
||||
is concerned is _this_ particular version of the license (ie v2, not
|
||||
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
|
||||
|
||||
Linus Torvalds
|
||||
|
||||
----------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,248 +0,0 @@
|
||||
export KMODDIR?= updates
|
||||
KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
|
||||
ifneq ($(origin KLIB), undefined)
|
||||
KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
|
||||
else
|
||||
export KLIB:= /lib/modules/$(shell uname -r)
|
||||
endif
|
||||
export KLIB_BUILD ?= $(KLIB)/build
|
||||
export MAKE
|
||||
|
||||
DESTDIR?=
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
|
||||
-include $(COMPAT_CONFIG)
|
||||
include $(COMPAT_CONFIG_CW)
|
||||
|
||||
NOSTDINC_FLAGS := -I$(M)/include/ \
|
||||
-include $(M)/include/linux/compat-2.6.h \
|
||||
$(CFLAGS)
|
||||
|
||||
obj-y := compat/
|
||||
|
||||
#obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
|
||||
|
||||
ifeq ($(BT),)
|
||||
obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
|
||||
#obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/
|
||||
|
||||
#obj-$(CONFIG_COMPAT_NET_USB_MODULES) += drivers/net/usb/
|
||||
|
||||
#obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/atheros/
|
||||
#obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/broadcom/
|
||||
|
||||
#obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/
|
||||
#obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/bcma/
|
||||
#obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/misc/eeprom/
|
||||
|
||||
ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
#obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
|
||||
#obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
|
||||
|
||||
else
|
||||
|
||||
export PWD := $(shell pwd)
|
||||
|
||||
# The build will fail if there is any space in PWD.
|
||||
ifneq (,$(findstring $() ,$(PWD)))
|
||||
$(error "The path to this compat-wireless directory has spaces in it." \
|
||||
"Please put it somewhere where there is no space")
|
||||
endif
|
||||
|
||||
export CFLAGS += \
|
||||
-DCOMPAT_BASE_TREE="\"$(shell cat $(PWD)/compat_base_tree)\"" \
|
||||
-DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(PWD)/compat_base_tree_version)\"" \
|
||||
-DCOMPAT_PROJECT="\"Compat-wireless\"" \
|
||||
-DCOMPAT_VERSION="\"$(shell cat $(PWD)/compat_version)\""
|
||||
|
||||
# These exported as they are used by the scripts
|
||||
# to check config and compat autoconf
|
||||
export COMPAT_CONFIG_CW=$(PWD)/config.mk
|
||||
export COMPAT_CONFIG=$(PWD)/.config
|
||||
export CONFIG_CHECK=$(PWD)/.config.mk_md5sum.txt
|
||||
export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
|
||||
export CREL=$(shell cat $(PWD)/compat_version)
|
||||
export CREL_PRE:=.compat_autoconf_
|
||||
export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL)
|
||||
|
||||
all: modules
|
||||
|
||||
$(COMPAT_CONFIG): ;
|
||||
|
||||
modules: $(CREL_CHECK)
|
||||
$(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
|
||||
@touch $@
|
||||
|
||||
bt: $(CREL_CHECK)
|
||||
+@./scripts/check_config.sh
|
||||
$(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules
|
||||
@touch $@
|
||||
|
||||
# We use a CREL_CHECK variable which will depend on the environment used to
|
||||
# build. If the environment requirements change it forces a reconfiguration
|
||||
# check. This means we force a new reconfiguration check if a the user gets a
|
||||
# new updates of compat-wireless or when the user updates the $(COMPAT_CONFIG)
|
||||
# file.
|
||||
# XXX: add kernel target to the CREL_CHECK mix, this would ensure we also
|
||||
# reconfigure and build again fresh if we detect a new target kernel is
|
||||
# being used.
|
||||
$(CREL_CHECK):
|
||||
@# Force to regenerate compat autoconf
|
||||
+@./compat/scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
|
||||
@rm -f $(CONFIG_CHECK)
|
||||
+@./scripts/check_config.sh
|
||||
@md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK)
|
||||
@touch $@
|
||||
|
||||
btinstall: btuninstall bt-install-modules
|
||||
|
||||
bt-install-modules: bt
|
||||
$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
|
||||
modules_install
|
||||
@/sbin/depmod -ae
|
||||
@echo
|
||||
@echo Now run:
|
||||
@echo
|
||||
@echo sudo make btunload:
|
||||
@echo
|
||||
@echo And then load the needed bluetooth modules. If unsure reboot.
|
||||
@echo
|
||||
|
||||
btuninstall:
|
||||
@# New location, matches upstream
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/net/bluetooth/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/drivers/bluetooth/
|
||||
@# Lets only remove the stuff we are sure we are providing
|
||||
@# on the misc directory.
|
||||
@/sbin/depmod -ae
|
||||
@echo
|
||||
|
||||
btclean:
|
||||
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
|
||||
@rm -f $(CREL_PRE)*
|
||||
|
||||
install: uninstall install-modules install-scripts
|
||||
|
||||
install-modules: modules
|
||||
$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
|
||||
modules_install
|
||||
@./scripts/update-initramfs
|
||||
|
||||
install-scripts:
|
||||
@# All the scripts we can use
|
||||
@mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
|
||||
@install scripts/modlib.sh $(DESTDIR)/usr/lib/compat-wireless/
|
||||
@install scripts/madwifi-unload $(DESTDIR)/usr/sbin/
|
||||
@# This is to allow switching between drivers without blacklisting
|
||||
@install scripts/athenable $(DESTDIR)/usr/sbin/
|
||||
@install scripts/b43enable $(DESTDIR)/usr/sbin/
|
||||
@install scripts/iwl-enable $(DESTDIR)/usr/sbin/
|
||||
@install scripts/alx-enable $(DESTDIR)/usr/sbin/
|
||||
@install scripts/athload $(DESTDIR)/usr/sbin/
|
||||
@install scripts/b43load $(DESTDIR)/usr/sbin/
|
||||
@install scripts/iwl-load $(DESTDIR)/usr/sbin/
|
||||
@if [ $(shell modinfo ath_pci > /dev/null 2>&1 && echo 1) ]; then \
|
||||
echo -n "Note: madwifi detected, we're going to disable it. " ;\
|
||||
echo "If you would like to enable it later you can run:" ;\
|
||||
echo " sudo athenable madwifi" ;\
|
||||
echo ;\
|
||||
echo Running athenable ath5k...;\
|
||||
$(DESTDIR)/usr/sbin/athenable ath5k ;\
|
||||
fi
|
||||
@if [ $(shell modinfo iwl4965 > /dev/null 2>&1 && echo 1) ]; then \
|
||||
echo ;\
|
||||
echo -n "Note: iwl4965 detected, we're going to disable it. " ;\
|
||||
echo "If you would like to enable it later you can run:" ;\
|
||||
echo " sudo iwl-load iwl4965" ;\
|
||||
echo ;\
|
||||
echo Running iwl-enable iwlagn...;\
|
||||
$(DESTDIR)/usr/sbin/iwl-enable iwlagn ;\
|
||||
fi
|
||||
@if [ $(shell modinfo iwlagn > /dev/null 2>&1 && echo 1) ] \
|
||||
&& [ $(shell modinfo iwlwifi > /dev/null 2>&1 && echo 1) ]; then \
|
||||
echo ;\
|
||||
echo -n "Note: iwlagn detected, we're going to disable it. " ;\
|
||||
echo "If you would like to enable it later you can run:" ;\
|
||||
echo " sudo iwl-load iwlagn" ;\
|
||||
echo ;\
|
||||
echo Running iwl-enable iwlwifi...;\
|
||||
$(DESTDIR)/usr/sbin/iwl-enable iwlwifi ;\
|
||||
fi
|
||||
@if [ $(shell modinfo atl1c > /dev/null 2>&1 && echo 1) ]; then \
|
||||
echo ;\
|
||||
echo -n "Note: atl1c detected, we're going to disable it. " ;\
|
||||
echo "If you would like to enable it later you can run:" ;\
|
||||
echo " sudo alx-load atl1c" ;\
|
||||
echo ;\
|
||||
echo Running alx-enable alx...;\
|
||||
$(DESTDIR)/usr/sbin/alx-enable alx;\
|
||||
fi
|
||||
@# If on distributions like Mandriva which like to
|
||||
@# compress their modules this will find out and do
|
||||
@# it for you. Reason is some old version of modutils
|
||||
@# won't know mac80211.ko should be used instead of
|
||||
@# mac80211.ko.gz
|
||||
@./scripts/compress_modules
|
||||
@# Mandrake doesn't have a depmod.d/ conf file to prefer
|
||||
@# the updates/ dir which is what we use so we add one for it
|
||||
@# (or any other distribution that doens't have this).
|
||||
@./scripts/check_depmod
|
||||
@# Udev stuff needed for the new compat_firmware_class.
|
||||
@./compat/scripts/compat_firmware_install
|
||||
@/sbin/depmod -a
|
||||
@echo
|
||||
@echo Now run:
|
||||
@echo
|
||||
@echo sudo make unload to unload all: wireless, bluetooth and ethernet modules
|
||||
@echo sudo make wlunload to unload wireless modules
|
||||
@echo sudo make btunload to unload bluetooth modules
|
||||
@echo
|
||||
@echo Run sudo modprobe 'driver-name' to load your desired driver.
|
||||
@echo If unsure reboot.
|
||||
@echo
|
||||
|
||||
uninstall:
|
||||
@# New location, matches upstream
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/compat/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/net/rfkill/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/net/wireless/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/usb/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/drivers/staging/
|
||||
@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/atl*
|
||||
@# Lets only remove the stuff we are sure we are providing
|
||||
@# on the misc directory.
|
||||
@rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom/eeprom_93cx6.ko*
|
||||
@rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom_93cx6.ko*
|
||||
@rm -f $(KLIB)/$(KMODDIR)/drivers/net/b44.ko*
|
||||
@/sbin/depmod -a
|
||||
@echo
|
||||
|
||||
clean:
|
||||
@if [ -d net -a -d $(KLIB_BUILD) ]; then \
|
||||
$(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\
|
||||
fi
|
||||
@rm -f $(CREL_PRE)*
|
||||
unload:
|
||||
@./scripts/unload.sh
|
||||
|
||||
btunload:
|
||||
@./scripts/btunload.sh
|
||||
|
||||
wlunload:
|
||||
@./scripts/wlunload.sh
|
||||
|
||||
|
||||
.PHONY: all clean install uninstall unload btunload wlunload modules bt Makefile
|
||||
|
||||
endif
|
||||
|
||||
clean-files += Module.symvers Module.markers modules modules.order
|
||||
clean-files += $(CREL_CHECK) $(CONFIG_CHECK) $(COMPAT_CONFIG)
|
||||
@@ -1,417 +0,0 @@
|
||||
|
||||
Linux Wireless compatibility package
|
||||
=====================================
|
||||
|
||||
This is a Linux wireless compatibility package which provides the latest
|
||||
Linux wireless subsystem enhancements for kernels 2.6.24 and above.
|
||||
It is technically possible to support kernels < 2.6.24 but more
|
||||
work is required for that.
|
||||
It also provides Linux bluetooth subsystem enhancements for kernels 2.6.27 and above.
|
||||
|
||||
With a local git repository you can update the compatibility package yourself.
|
||||
For more information on how to do this please refer the Developers section below.
|
||||
|
||||
Documentation
|
||||
------------
|
||||
|
||||
This package is also documented online and has more-up-to date
|
||||
information online than on this README file. You should read the wiki page
|
||||
and not rely on this README:
|
||||
|
||||
http://wireless.kernel.org/en/users/Download
|
||||
|
||||
Subscribe to the wiki page to get updates on the documentation.
|
||||
|
||||
Where to get the latest
|
||||
-----------------------
|
||||
|
||||
This package lets you build your own 'latest', all you need is a local git
|
||||
repository. The process is documented in the Developers section of this document.
|
||||
However since not many users are expected to keep a local git repository we
|
||||
provide daily snapshots of this package + the wireless and bluetooth subsystem
|
||||
code. You can find the latest snapshot at:
|
||||
|
||||
linux-next.git version:
|
||||
http://wireless.kernel.org/en/users/Download
|
||||
|
||||
stable version:
|
||||
http://wireless.kernel.org/en/users/Download/stable/
|
||||
|
||||
Versions
|
||||
--------
|
||||
|
||||
There are two different versions of this package available.
|
||||
* Version based on latest linux-next.git tree named compat-wireless-YYYY-MM-DD.tar.bz2
|
||||
* Version based on linux-2.6-stable.git tree named compat-wireless-2.6.CC.DD.tar.bz2
|
||||
|
||||
Both versions should work for every kernel > 2.6.24. The differences are the
|
||||
code they are containing. The version based on linux-next.git contains the
|
||||
wireless and bluetooth subsystem out of linux-next.git and the stable version
|
||||
the wireless subsystem out of the corresponding linux stable version.
|
||||
|
||||
Selecting your driver
|
||||
---------------------
|
||||
|
||||
If you know the driver you want you can select it with our
|
||||
helper script:
|
||||
|
||||
./scripts/driver-select
|
||||
|
||||
Run that script to see more information.
|
||||
Not all drivers are currently enabled via driver-select.
|
||||
|
||||
Building, and installing
|
||||
------------------------
|
||||
|
||||
Build: compile the latest linux wireless subsystem
|
||||
|
||||
make
|
||||
|
||||
Install:
|
||||
|
||||
We use the updates/ directory so your distribution's drivers are left intact.
|
||||
|
||||
sudo make install
|
||||
|
||||
Uninstall:
|
||||
|
||||
This nukes our changes to updates/ so you can go back to using your
|
||||
distribution's supported drivers.
|
||||
|
||||
sudo make uninstall
|
||||
|
||||
Load:
|
||||
|
||||
Reboot unless you know what you are doing.
|
||||
(Usually modprobe 'driver-name' is the way to go)
|
||||
|
||||
|
||||
Bluetooth modules can be separately compiled and installed using below commands
|
||||
Bluetooth drivers are also available via ./scripts/driver-select
|
||||
|
||||
Build:
|
||||
make bt
|
||||
|
||||
Install:
|
||||
sudo make btinstall
|
||||
|
||||
Uninstall:
|
||||
sudo make btuninstall
|
||||
|
||||
Unload:
|
||||
sudo make btunload
|
||||
|
||||
Load:
|
||||
modprobe driver-name. If unsure, reboot.
|
||||
|
||||
Drivers
|
||||
-------
|
||||
|
||||
This is the list of drivers the package currently provides. It adds
|
||||
all new drivers or drivers which keep being updated which you might
|
||||
be interested in.
|
||||
|
||||
Drivers list:
|
||||
|
||||
adm8211
|
||||
ar9170usb
|
||||
at76c50x-usb
|
||||
ath5k
|
||||
ath6kl
|
||||
ath9k
|
||||
ath9k_htc
|
||||
b43
|
||||
b43legacy
|
||||
b44
|
||||
carl9170
|
||||
brcm80211
|
||||
ipw2100
|
||||
ipw2200
|
||||
iwl3945
|
||||
iwlagn
|
||||
iwlcore
|
||||
iwmc3200wifi
|
||||
libertas
|
||||
libertas_cs
|
||||
libertas_sdio
|
||||
libertas_spi
|
||||
libertas_tf
|
||||
libertas_tf_usb
|
||||
libipw
|
||||
mwl8k
|
||||
orinoco_cs
|
||||
orinoco_nortel
|
||||
orinoco_pci
|
||||
orinoco_plx
|
||||
orinoco_tld
|
||||
orinoco_usb
|
||||
orinoco
|
||||
p54common
|
||||
p54pci
|
||||
p54spi
|
||||
p54usb
|
||||
rt2400pci
|
||||
rt2500pci
|
||||
rt2500usb
|
||||
rt2800pci
|
||||
rt2800usb
|
||||
rt61pci
|
||||
rt73usb
|
||||
rtl8180
|
||||
rtl8187
|
||||
rtlwifi
|
||||
rtl8192ce
|
||||
spectrum_cs
|
||||
ssb
|
||||
wl1251
|
||||
wl12xx
|
||||
zd1211rw
|
||||
|
||||
This package also provides more drivers which may be documented here
|
||||
|
||||
For a complete list see:
|
||||
|
||||
http://wireless.kernel.org/en/users/Download
|
||||
|
||||
Non-wireless drivers
|
||||
--------------------
|
||||
|
||||
Atheros Ethernet drivers:
|
||||
|
||||
atl1
|
||||
atl1c
|
||||
atl1e
|
||||
atl2
|
||||
|
||||
To support b43 ssb is also provided, and since ssb is also provided
|
||||
we provide b44 (the ethernet driver).
|
||||
|
||||
The new rfkill drivers also provided and backported.
|
||||
|
||||
Bluetooth drivers:
|
||||
|
||||
ath3k
|
||||
bcm203x
|
||||
bluecard_cs
|
||||
bluetooth
|
||||
bnep
|
||||
bpa10x
|
||||
bt3c_cs
|
||||
btmrvl
|
||||
btmrvl_sdio
|
||||
btsdio
|
||||
btusb
|
||||
btuart_cs
|
||||
cmtp
|
||||
dtl1_cs
|
||||
hidp
|
||||
hci_vhci
|
||||
hci_uart
|
||||
l2cap
|
||||
rfcomm
|
||||
sco
|
||||
|
||||
Firmware:
|
||||
---------
|
||||
|
||||
If your driver needs firmware please be sure to check the driver page
|
||||
for that driver here:
|
||||
|
||||
http://wireless.kernel.org/en/users/Drivers
|
||||
|
||||
Why?
|
||||
----
|
||||
|
||||
For users or developers stuck on older kernels that want to help test or
|
||||
patch wireless work. Additionally if you're on a recent kernel this lets
|
||||
you get the latest and greatest linux-next git work without much effort.
|
||||
This may mean new drivers for some users. Last but not least we hope this
|
||||
will encourage vendors and developers to post patches upstream first
|
||||
rather than forking or maintaining their own mac80211 releases with
|
||||
their own patches for their own drivers.
|
||||
|
||||
Building for external kernels
|
||||
----------------------------------
|
||||
|
||||
If you have a kernel you do not have installed but yet want to build the
|
||||
compat-wireless-2.6 drivers for it you can use this syntax:
|
||||
|
||||
make KLIB=/home/mcgrof/kernels/linux-2.6.23.9 KLIB_BUILD=/home/mcgrof/kernels/linux-2.6.23.9
|
||||
|
||||
If you have a kernel installed, which is not your currently running kernel (e.g. via
|
||||
distro updates; plus its corresponding kernel-dev package), you can use this syntax:
|
||||
|
||||
make KLIB=/lib/modules/2.6.30.6-53.fc11.x86_64
|
||||
|
||||
and to install to your system's root path for the non-running kernel:
|
||||
|
||||
make KLIB=/lib/modules/2.6.30.6-53.fc11.x86_64 KMODPATH_ARG='INSTALL_MOD_PATH=' install
|
||||
|
||||
Bugs
|
||||
-----
|
||||
|
||||
If you've found a bug please report it to our linux-wireless mailing list:
|
||||
|
||||
linux-wireless@vger.kernel.org
|
||||
|
||||
Report the bug if you are working with the latest and greatest.
|
||||
If your bug is compatibility-related then we should still try to fix
|
||||
it within the compat.[ch] work.
|
||||
|
||||
ChangeLog
|
||||
---------
|
||||
|
||||
Here you see the list of changes to all wireless drivers, the wireless core and mac80211.
|
||||
|
||||
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=log;
|
||||
|
||||
This views all the changes on wireless-testing.git.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This work is a subset of the Linux kernel as such we keep the kernel's
|
||||
Copyright practice. Some files have their own copyright and in those
|
||||
cases the license is mentioned in the file. All additional work made
|
||||
to building this package is licensed under the GPLv2.
|
||||
|
||||
Developers
|
||||
----------
|
||||
|
||||
Compatibility work goes into compat/compat.[ch]. If using those files do
|
||||
not suffice additional actual code changes can go into patches/*.patch.
|
||||
|
||||
An extended and more up to date version can be found at:
|
||||
|
||||
http://wireless.kernel.org/en/users/Download/hacking
|
||||
|
||||
This section deals with development details of compat-wireless and the other
|
||||
trees it uses. If you want to make your own compat-wireless tarballs, or if you
|
||||
see something busted with compat-wireless or just want to add something new or
|
||||
an enhancement this is the guide for you.
|
||||
|
||||
Git trees you will need
|
||||
-----------------------
|
||||
|
||||
compat-wireless backports both the bluetooth and 802.11 subsystems down to older
|
||||
kernels. To be able to synchronize backporting the latest and greatest the
|
||||
linux-next.git tree is used as its main source for kernel updates. General Linux
|
||||
kernel compatibility is addressed through a general kernel compatibility tree,
|
||||
compat.git. compat-wireless then has its own tree for specific wireless
|
||||
compatibility. You will then need to checkout three trees to start hacking on
|
||||
compat-wireless:
|
||||
|
||||
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
|
||||
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat.git
|
||||
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat-wireless-2.6.git
|
||||
|
||||
Linux next
|
||||
----------
|
||||
|
||||
The linux-next.git tree brings all subsystems being worked on for the next
|
||||
kernel release into one tree. So if the current rc kernel is 2.6.33-rc5, this
|
||||
means linux-next will have what people today are working on for the 2.6.34
|
||||
kernel release.
|
||||
|
||||
compat.git
|
||||
----------
|
||||
|
||||
The compat git tree is a general kernel compatibility layer which can be shared
|
||||
amongst different compatibility projects, or drivers. compat-wireless is just
|
||||
one of the kernel compatibility projects using compat.git. compat.git builds a
|
||||
general compatibility module, compat, and any additional modules to let you get
|
||||
new general kernel updates from future kernels on your old kernels.
|
||||
|
||||
compat.git modules
|
||||
------------------
|
||||
|
||||
compat.git provides a few modules and headers to help with general kernel
|
||||
compatibility.
|
||||
|
||||
compat
|
||||
------
|
||||
|
||||
Provides all exported symbols implemented in each respective kernel
|
||||
compat-2.6.xy.c files. Upon module load it just initializes the Linux kernel's
|
||||
''power management Quality Of Service'' (aka '''pm-qos''') Interface interface
|
||||
added as of the 2.6.24 kernel. No other things are initialized, the rest of the
|
||||
compat module just acts as a library of exported symbols.
|
||||
|
||||
compat_firmware_class
|
||||
---------------------
|
||||
|
||||
Another module which compat.git provides is a backport of the firmware_class
|
||||
module which got updated recently newer with a new request_firmware_nowait()
|
||||
to allow better asynchronous firmware uploading. This was added as of the 2.6.33
|
||||
kernel. The firmware_class module has been backported into a new module called
|
||||
compat_firmware_class. A separate module has been defined instead of a direct
|
||||
replacement for firmware_class since your system may have old drivers which use
|
||||
the old request_firmware_nowait() and would bust if they used the new
|
||||
request_firmware_nowait(). The compat_firmware_class module registers its own
|
||||
sysfs subsystem and as such also gets udev events sent through a separate
|
||||
subsystem. Because of this a new udev rules file is required and provided.
|
||||
|
||||
compat-wireless.git
|
||||
-------------------
|
||||
|
||||
Anything that is not general kernel compatibility but instead specific to 802.11
|
||||
or bluetooth goes into compat-wireless.git. After you've cloned all three trees,
|
||||
linux-next.git, compat.git and compat-wireless.git you need to change into the
|
||||
compat-wireless directory and tell compat-wireless where you linux-next and
|
||||
compat.git trees are. You do this with environment variables GIT_TREE and
|
||||
GIT_COMPAT_TREE. You can do for example:
|
||||
|
||||
export GIT_TREE=/home/user/wireless-testing/
|
||||
export GIT_COMPAT_TREE=/home/users/compat.git/
|
||||
|
||||
Then you can update your local sources based on these linux-next.git and
|
||||
compat.git trees:
|
||||
|
||||
scripts/admin-clean.sh - Cleans the compat-wireless-2.6 tree
|
||||
scripts/admin-update.sh - Updates compat-wireless-2.6 with your git tree
|
||||
scripts/admin-refresh.sh - Does the above two
|
||||
|
||||
Adding new drivers
|
||||
------------------
|
||||
|
||||
Most new drivers are enabled for compilation. If see a driver you would like
|
||||
enabled try it into the mix, test them and if they work enable them and send
|
||||
the respective patches.
|
||||
|
||||
Sending patches
|
||||
---------------
|
||||
|
||||
Remember there are three trees. linux-next itself is a conglomeration of kernel
|
||||
git trees itself, so patches for linux-next.git should be sent to each
|
||||
respective subsystem for which the patches are targeted for. So for example for
|
||||
802.11 you will want to send them to John Linville and cc linux-wireless, for
|
||||
further guidelines on this see the Submitting Patches guidelines for 802.11.
|
||||
http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches
|
||||
As another example, for bluetooth you will want to send them to Marcel
|
||||
Holtmann and cc the linux-bluetooth mailing list. If your patch touches on
|
||||
others areas of the kernel refer to the MAINTAINERS file on the kernel.
|
||||
|
||||
For compat.git and compat-wireless.git please send patches against to:
|
||||
|
||||
To: Luis R. Rodriguez <mcgrof@kernel.org>
|
||||
CC: linux-wireless@vger.kernel.org, linux-bluetooth@vger.kernel.org
|
||||
Subject: [PATCH] compat-2.6: fix foo
|
||||
|
||||
For patches for compat.git please use a subject like the following:
|
||||
|
||||
Subject: [PATCH] compat: fix foo
|
||||
|
||||
For compat-wireless.git please use a subject like the following:
|
||||
|
||||
Subject: [PATCH] compat-wireless: fix foo
|
||||
|
||||
Patches are preferred sent with a clear commit log entry, if unfamiliar with
|
||||
how to send patches please refer to
|
||||
http://wireless.kernel.org/en/developers/Documentation/git-guide.
|
||||
|
||||
|
||||
TODO
|
||||
-----
|
||||
* Dialog (make menuconfig) option for this package
|
||||
* Compatibility work for 2.6.18 --> 2.6.24
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
[36mcompat-wireless code metrics[00m
|
||||
|
||||
[35m 829063[00m - Total upstream lines of code being pulled
|
||||
[01;32m 2748[00m - backport code changes
|
||||
[01;32m 2333[00m - backport code additions
|
||||
[01;32m 415[00m - backport code deletions
|
||||
[01;32m 9575[00m - backport from compat module
|
||||
[01;32m 12323[00m - total backport code
|
||||
[31m 1.4864[00m - % of code consists of backport work
|
||||
|
||||
Base tree: [01;32mlinux-stable.git[00m
|
||||
Base tree version: [35mv3.4-rc3[00m
|
||||
compat-wireless release: [01;33mcompat-wireless-v3.4-rc3-1[00m
|
||||
@@ -1,102 +0,0 @@
|
||||
ifdef MAC
|
||||
obj-m += compat.o
|
||||
#compat-objs :=
|
||||
|
||||
#obj-$(CONFIG_COMPAT_FIRMWARE_CLASS) += compat_firmware_class.o
|
||||
|
||||
compat-y += main.o
|
||||
|
||||
# Compat kernel compatibility code
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_14) += compat-2.6.14.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_18) += compat-2.6.18.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_19) += compat-2.6.19.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_21) += compat-2.6.21.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_22) += compat-2.6.22.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_23) += compat-2.6.23.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_24) += compat-2.6.24.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_25) += \
|
||||
compat-2.6.25.o \
|
||||
pm_qos_params.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_26) += compat-2.6.26.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_27) += compat-2.6.27.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_28) += compat-2.6.28.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_29) += compat-2.6.29.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_32) += compat-2.6.32.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_33) += compat-2.6.33.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_35) += compat-2.6.35.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += compat-2.6.36.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_KFIFO) += kfifo.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_37) += compat-2.6.37.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_38) += compat-2.6.38.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \
|
||||
compat-2.6.39.o \
|
||||
kstrtox.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_0) += compat-3.0.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_2) += compat-3.2.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_3) += compat-3.3.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_5) += compat-3.5.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_CORDIC) += cordic.o
|
||||
compat-$(CONFIG_COMPAT_CRC8) += crc8.o
|
||||
|
||||
ifndef CONFIG_64BIT
|
||||
ifndef CONFIG_GENERIC_ATOMIC64
|
||||
compat-y += compat_atomic.o
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ALL
|
||||
obj-m += compat.o
|
||||
#compat-objs :=
|
||||
|
||||
obj-$(CONFIG_COMPAT_FIRMWARE_CLASS) += compat_firmware_class.o
|
||||
|
||||
compat-y += main.o
|
||||
|
||||
# Compat kernel compatibility code
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_14) += compat-2.6.14.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_18) += compat-2.6.18.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_19) += compat-2.6.19.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_21) += compat-2.6.21.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_22) += compat-2.6.22.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_23) += compat-2.6.23.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_24) += compat-2.6.24.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_25) += \
|
||||
compat-2.6.25.o \
|
||||
pm_qos_params.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_26) += compat-2.6.26.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_27) += compat-2.6.27.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_28) += compat-2.6.28.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_29) += compat-2.6.29.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_32) += compat-2.6.32.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_33) += compat-2.6.33.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_35) += compat-2.6.35.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += compat-2.6.36.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_KFIFO) += kfifo.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_37) += compat-2.6.37.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_38) += compat-2.6.38.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \
|
||||
compat-2.6.39.o \
|
||||
kstrtox.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_0) += compat-3.0.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_2) += compat-3.2.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_3) += compat-3.3.o
|
||||
compat-$(CONFIG_COMPAT_KERNEL_3_5) += compat-3.5.o
|
||||
|
||||
compat-$(CONFIG_COMPAT_CORDIC) += cordic.o
|
||||
compat-$(CONFIG_COMPAT_CRC8) += crc8.o
|
||||
|
||||
ifndef CONFIG_64BIT
|
||||
ifndef CONFIG_GENERIC_ATOMIC64
|
||||
compat-y += compat_atomic.o
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.14.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
|
||||
/* 2.6.14 compat code goes here */
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.18.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
|
||||
/* 2.6.18 compat code goes here */
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.19.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
|
||||
/* 2.6.19 compat code goes here */
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.21.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
|
||||
/* 2.6.21 compat code goes here */
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.22.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
|
||||
/* 2.6.22 compat code goes here */
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.23.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
|
||||
/* On net/core/dev.c as of 2.6.24 */
|
||||
int __dev_addr_delete(struct dev_addr_list **list, int *count,
|
||||
void *addr, int alen, int glbl)
|
||||
{
|
||||
struct dev_addr_list *da;
|
||||
|
||||
for (; (da = *list) != NULL; list = &da->next) {
|
||||
if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
|
||||
alen == da->da_addrlen) {
|
||||
if (glbl) {
|
||||
int old_glbl = da->da_gusers;
|
||||
da->da_gusers = 0;
|
||||
if (old_glbl == 0)
|
||||
break;
|
||||
}
|
||||
if (--da->da_users)
|
||||
return 0;
|
||||
|
||||
*list = da->next;
|
||||
kfree(da);
|
||||
(*count)--;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__dev_addr_delete);
|
||||
|
||||
/* On net/core/dev.c as of 2.6.24. This is not yet used by mac80211 but
|
||||
* might as well add it */
|
||||
int __dev_addr_add(struct dev_addr_list **list, int *count,
|
||||
void *addr, int alen, int glbl)
|
||||
{
|
||||
struct dev_addr_list *da;
|
||||
|
||||
for (da = *list; da != NULL; da = da->next) {
|
||||
if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
|
||||
da->da_addrlen == alen) {
|
||||
if (glbl) {
|
||||
int old_glbl = da->da_gusers;
|
||||
da->da_gusers = 1;
|
||||
if (old_glbl)
|
||||
return 0;
|
||||
}
|
||||
da->da_users++;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
da = kmalloc(sizeof(*da), GFP_ATOMIC);
|
||||
if (da == NULL)
|
||||
return -ENOMEM;
|
||||
memcpy(da->da_addr, addr, alen);
|
||||
da->da_addrlen = alen;
|
||||
da->da_users = 1;
|
||||
da->da_gusers = glbl ? 1 : 0;
|
||||
da->next = *list;
|
||||
*list = da;
|
||||
(*count)++;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__dev_addr_add);
|
||||
|
||||
|
||||
/* Part of net/core/dev_mcast.c as of 2.6.23. This is a slightly different version.
|
||||
* Since da->da_synced is not part of 2.6.22 we need to take longer route when
|
||||
* syncing */
|
||||
|
||||
/**
|
||||
* dev_mc_sync - Synchronize device's multicast list to another device
|
||||
* @to: destination device
|
||||
* @from: source device
|
||||
*
|
||||
* Add newly added addresses to the destination device and release
|
||||
* addresses that have no users left. The source device must be
|
||||
* locked by netif_tx_lock_bh.
|
||||
*
|
||||
* This function is intended to be called from the dev->set_multicast_list
|
||||
* function of layered software devices.
|
||||
*/
|
||||
int dev_mc_sync(struct net_device *to, struct net_device *from)
|
||||
{
|
||||
struct dev_addr_list *da, *next, *da_to;
|
||||
int err = 0;
|
||||
|
||||
netif_tx_lock_bh(to);
|
||||
da = from->mc_list;
|
||||
while (da != NULL) {
|
||||
int synced = 0;
|
||||
next = da->next;
|
||||
da_to = to->mc_list;
|
||||
/* 2.6.22 does not have da->da_synced so lets take the long route */
|
||||
while (da_to != NULL) {
|
||||
if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
|
||||
da->da_addrlen == da_to->da_addrlen)
|
||||
synced = 1;
|
||||
break;
|
||||
}
|
||||
if (!synced) {
|
||||
err = __dev_addr_add(&to->mc_list, &to->mc_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
if (err < 0)
|
||||
break;
|
||||
da->da_users++;
|
||||
} else if (da->da_users == 1) {
|
||||
__dev_addr_delete(&to->mc_list, &to->mc_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
__dev_addr_delete(&from->mc_list, &from->mc_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
}
|
||||
da = next;
|
||||
}
|
||||
if (!err)
|
||||
__dev_set_rx_mode(to);
|
||||
netif_tx_unlock_bh(to);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_mc_sync);
|
||||
|
||||
|
||||
/* Part of net/core/dev_mcast.c as of 2.6.23. This is a slighty different version.
|
||||
* Since da->da_synced is not part of 2.6.22 we need to take longer route when
|
||||
* unsyncing */
|
||||
|
||||
/**
|
||||
* dev_mc_unsync - Remove synchronized addresses from the destination
|
||||
* device
|
||||
* @to: destination device
|
||||
* @from: source device
|
||||
*
|
||||
* Remove all addresses that were added to the destination device by
|
||||
* dev_mc_sync(). This function is intended to be called from the
|
||||
* dev->stop function of layered software devices.
|
||||
*/
|
||||
void dev_mc_unsync(struct net_device *to, struct net_device *from)
|
||||
{
|
||||
struct dev_addr_list *da, *next, *da_to;
|
||||
|
||||
netif_tx_lock_bh(from);
|
||||
netif_tx_lock_bh(to);
|
||||
|
||||
da = from->mc_list;
|
||||
while (da != NULL) {
|
||||
bool synced = false;
|
||||
next = da->next;
|
||||
da_to = to->mc_list;
|
||||
/* 2.6.22 does not have da->da_synced so lets take the long route */
|
||||
while (da_to != NULL) {
|
||||
if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
|
||||
da->da_addrlen == da_to->da_addrlen)
|
||||
synced = true;
|
||||
break;
|
||||
}
|
||||
if (!synced) {
|
||||
da = next;
|
||||
continue;
|
||||
}
|
||||
__dev_addr_delete(&to->mc_list, &to->mc_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
__dev_addr_delete(&from->mc_list, &from->mc_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
da = next;
|
||||
}
|
||||
__dev_set_rx_mode(to);
|
||||
|
||||
netif_tx_unlock_bh(to);
|
||||
netif_tx_unlock_bh(from);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_mc_unsync);
|
||||
|
||||
/* Added as of 2.6.23 on net/core/dev.c. Slightly modifed, no dev->set_rx_mode on
|
||||
* 2.6.22 so ignore that. */
|
||||
|
||||
/*
|
||||
* Upload unicast and multicast address lists to device and
|
||||
* configure RX filtering. When the device doesn't support unicast
|
||||
* filtering it is put in promiscous mode while unicast addresses
|
||||
* are present.
|
||||
*/
|
||||
void __dev_set_rx_mode(struct net_device *dev)
|
||||
{
|
||||
/* dev_open will call this function so the list will stay sane. */
|
||||
if (!(dev->flags&IFF_UP))
|
||||
return;
|
||||
|
||||
if (!netif_device_present(dev))
|
||||
return;
|
||||
|
||||
/* This needs to be ported to 2.6.22 framework */
|
||||
#if 0
|
||||
/* Unicast addresses changes may only happen under the rtnl,
|
||||
* therefore calling __dev_set_promiscuity here is safe.
|
||||
*/
|
||||
if (dev->uc_count > 0 && !dev->uc_promisc) {
|
||||
__dev_set_promiscuity(dev, 1);
|
||||
dev->uc_promisc = 1;
|
||||
} else if (dev->uc_count == 0 && dev->uc_promisc) {
|
||||
__dev_set_promiscuity(dev, -1);
|
||||
dev->uc_promisc = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dev->set_multicast_list)
|
||||
dev->set_multicast_list(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* pci_try_set_mwi - enables memory-write-invalidate PCI transaction
|
||||
* @dev: the PCI device for which MWI is enabled
|
||||
*
|
||||
* Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
|
||||
* Callers are not required to check the return value.
|
||||
*
|
||||
* RETURNS: An appropriate -ERRNO error value on error, or zero for success.
|
||||
*/
|
||||
int pci_try_set_mwi(struct pci_dev *dev)
|
||||
{
|
||||
int rc = 0;
|
||||
#ifdef HAVE_PCI_SET_MWI
|
||||
rc = pci_set_mwi(dev);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_try_set_mwi);
|
||||
#endif
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.24.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
#include <net/arp.h>
|
||||
|
||||
/*
|
||||
* We simply won't use it though, just declare it for our wrappers and
|
||||
* for usage with tons of code that makes mention to it.
|
||||
*/
|
||||
struct net init_net;
|
||||
EXPORT_SYMBOL_GPL(init_net);
|
||||
|
||||
/* 2.6.22 and 2.6.23 have eth_header_cache_update defined as extern in include/linux/etherdevice.h
|
||||
* and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */
|
||||
|
||||
/**
|
||||
* eth_header_cache_update - update cache entry
|
||||
* @hh: destination cache entry
|
||||
* @dev: network device
|
||||
* @haddr: new hardware address
|
||||
*
|
||||
* Called by Address Resolution module to notify changes in address.
|
||||
*/
|
||||
void eth_header_cache_update(struct hh_cache *hh,
|
||||
struct net_device *dev,
|
||||
unsigned char *haddr)
|
||||
{
|
||||
memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
|
||||
haddr, ETH_ALEN);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(eth_header_cache_update);
|
||||
|
||||
/* 2.6.22 and 2.6.23 have eth_header_cache defined as extern in include/linux/etherdevice.h
|
||||
* and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */
|
||||
|
||||
/**
|
||||
* eth_header_cache - fill cache entry from neighbour
|
||||
* @neigh: source neighbour
|
||||
* @hh: destination cache entry
|
||||
* Create an Ethernet header template from the neighbour.
|
||||
*/
|
||||
int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh)
|
||||
{
|
||||
__be16 type = hh->hh_type;
|
||||
struct ethhdr *eth;
|
||||
const struct net_device *dev = neigh->dev;
|
||||
|
||||
eth = (struct ethhdr *)
|
||||
(((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth))));
|
||||
|
||||
if (type == htons(ETH_P_802_3))
|
||||
return -1;
|
||||
|
||||
eth->h_proto = type;
|
||||
memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
|
||||
memcpy(eth->h_dest, neigh->ha, ETH_ALEN);
|
||||
hh->hh_len = ETH_HLEN;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(eth_header_cache);
|
||||
|
||||
/* 2.6.22 and 2.6.23 have eth_header() defined as extern in include/linux/etherdevice.h
|
||||
* and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */
|
||||
|
||||
/**
|
||||
* eth_header - create the Ethernet header
|
||||
* @skb: buffer to alter
|
||||
* @dev: source device
|
||||
* @type: Ethernet type field
|
||||
* @daddr: destination address (NULL leave destination address)
|
||||
* @saddr: source address (NULL use device source address)
|
||||
* @len: packet length (<= skb->len)
|
||||
*
|
||||
*
|
||||
* Set the protocol type. For a packet of type ETH_P_802_3 we put the length
|
||||
* in here instead. It is up to the 802.2 layer to carry protocol information.
|
||||
*/
|
||||
int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
|
||||
void *daddr, void *saddr, unsigned len)
|
||||
{
|
||||
struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN);
|
||||
|
||||
if (type != ETH_P_802_3)
|
||||
eth->h_proto = htons(type);
|
||||
else
|
||||
eth->h_proto = htons(len);
|
||||
|
||||
/*
|
||||
* Set the source hardware address.
|
||||
*/
|
||||
|
||||
if (!saddr)
|
||||
saddr = dev->dev_addr;
|
||||
memcpy(eth->h_source, saddr, dev->addr_len);
|
||||
|
||||
if (daddr) {
|
||||
memcpy(eth->h_dest, daddr, dev->addr_len);
|
||||
return ETH_HLEN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Anyway, the loopback-device should never use this function...
|
||||
*/
|
||||
|
||||
if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
|
||||
memset(eth->h_dest, 0, dev->addr_len);
|
||||
return ETH_HLEN;
|
||||
}
|
||||
|
||||
return -ETH_HLEN;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(eth_header);
|
||||
|
||||
/* 2.6.22 and 2.6.23 have eth_rebuild_header defined as extern in include/linux/etherdevice.h
|
||||
* and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */
|
||||
|
||||
/**
|
||||
* eth_rebuild_header- rebuild the Ethernet MAC header.
|
||||
* @skb: socket buffer to update
|
||||
*
|
||||
* This is called after an ARP or IPV6 ndisc it's resolution on this
|
||||
* sk_buff. We now let protocol (ARP) fill in the other fields.
|
||||
*
|
||||
* This routine CANNOT use cached dst->neigh!
|
||||
* Really, it is used only when dst->neigh is wrong.
|
||||
*/
|
||||
int eth_rebuild_header(struct sk_buff *skb)
|
||||
{
|
||||
struct ethhdr *eth = (struct ethhdr *)skb->data;
|
||||
struct net_device *dev = skb->dev;
|
||||
|
||||
switch (eth->h_proto) {
|
||||
#ifdef CONFIG_INET
|
||||
case __constant_htons(ETH_P_IP):
|
||||
return arp_find(eth->h_dest, skb);
|
||||
#endif
|
||||
default:
|
||||
printk(KERN_DEBUG
|
||||
"%s: unable to resolve type %X addresses.\n",
|
||||
dev->name, (int)eth->h_proto);
|
||||
|
||||
memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(eth_rebuild_header);
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007-2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.25.
|
||||
*/
|
||||
|
||||
#include <linux/miscdevice.h>
|
||||
|
||||
/**
|
||||
* The following things are out of ./lib/vsprintf.c
|
||||
* The new iwlwifi driver is using them.
|
||||
*/
|
||||
|
||||
/**
|
||||
* strict_strtoul - convert a string to an unsigned long strictly
|
||||
* @cp: The string to be converted
|
||||
* @base: The number base to use
|
||||
* @res: The converted result value
|
||||
*
|
||||
* strict_strtoul converts a string to an unsigned long only if the
|
||||
* string is really an unsigned long string, any string containing
|
||||
* any invalid char at the tail will be rejected and -EINVAL is returned,
|
||||
* only a newline char at the tail is acceptible because people generally
|
||||
* change a module parameter in the following way:
|
||||
*
|
||||
* echo 1024 > /sys/module/e1000/parameters/copybreak
|
||||
*
|
||||
* echo will append a newline to the tail.
|
||||
*
|
||||
* It returns 0 if conversion is successful and *res is set to the converted
|
||||
* value, otherwise it returns -EINVAL and *res is set to 0.
|
||||
*
|
||||
* simple_strtoul just ignores the successive invalid characters and
|
||||
* return the converted value of prefix part of the string.
|
||||
*/
|
||||
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
|
||||
|
||||
/**
|
||||
* strict_strtol - convert a string to a long strictly
|
||||
* @cp: The string to be converted
|
||||
* @base: The number base to use
|
||||
* @res: The converted result value
|
||||
*
|
||||
* strict_strtol is similiar to strict_strtoul, but it allows the first
|
||||
* character of a string is '-'.
|
||||
*
|
||||
* It returns 0 if conversion is successful and *res is set to the converted
|
||||
* value, otherwise it returns -EINVAL and *res is set to 0.
|
||||
*/
|
||||
int strict_strtol(const char *cp, unsigned int base, long *res);
|
||||
|
||||
#define define_strict_strtoux(type, valtype) \
|
||||
int strict_strtou##type(const char *cp, unsigned int base, valtype *res)\
|
||||
{ \
|
||||
char *tail; \
|
||||
valtype val; \
|
||||
size_t len; \
|
||||
\
|
||||
*res = 0; \
|
||||
len = strlen(cp); \
|
||||
if (len == 0) \
|
||||
return -EINVAL; \
|
||||
\
|
||||
val = simple_strtou##type(cp, &tail, base); \
|
||||
if ((*tail == '\0') || \
|
||||
((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\
|
||||
*res = val; \
|
||||
return 0; \
|
||||
} \
|
||||
\
|
||||
return -EINVAL; \
|
||||
} \
|
||||
|
||||
#define define_strict_strtox(type, valtype) \
|
||||
int strict_strto##type(const char *cp, unsigned int base, valtype *res) \
|
||||
{ \
|
||||
int ret; \
|
||||
if (*cp == '-') { \
|
||||
ret = strict_strtou##type(cp+1, base, res); \
|
||||
if (!ret) \
|
||||
*res = -(*res); \
|
||||
} else \
|
||||
ret = strict_strtou##type(cp, base, res); \
|
||||
\
|
||||
return ret; \
|
||||
} \
|
||||
|
||||
define_strict_strtoux(l, unsigned long)
|
||||
define_strict_strtox(l, long)
|
||||
|
||||
EXPORT_SYMBOL_GPL(strict_strtoul);
|
||||
EXPORT_SYMBOL_GPL(strict_strtol);
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007-2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.26.
|
||||
*
|
||||
* Copyright holders from ported work:
|
||||
*
|
||||
* Copyright (c) 2002-2003 Patrick Mochel <mochel@osdl.org>
|
||||
* Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com>
|
||||
* Copyright (c) 2006-2007 Novell Inc.
|
||||
*/
|
||||
|
||||
#include <net/compat.h>
|
||||
|
||||
/* 2.6.24 does not have the struct kobject with a name */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
|
||||
|
||||
/**
|
||||
* kobject_set_name_vargs - Set the name of an kobject
|
||||
* @kobj: struct kobject to set the name of
|
||||
* @fmt: format string used to build the name
|
||||
* @vargs: vargs to format the string.
|
||||
*/
|
||||
static
|
||||
int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
|
||||
va_list vargs)
|
||||
{
|
||||
const char *old_name = kobj->name;
|
||||
char *s;
|
||||
|
||||
if (kobj->name && !fmt)
|
||||
return 0;
|
||||
|
||||
kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
|
||||
if (!kobj->name)
|
||||
return -ENOMEM;
|
||||
|
||||
/* ewww... some of these buggers have '/' in the name ... */
|
||||
while ((s = strchr(kobj->name, '/')))
|
||||
s[0] = '!';
|
||||
|
||||
kfree(old_name);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static
|
||||
int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
|
||||
va_list vargs)
|
||||
{
|
||||
struct device *dev;
|
||||
unsigned int len;
|
||||
va_list aq;
|
||||
|
||||
dev = container_of(kobj, struct device, kobj);
|
||||
|
||||
va_copy(aq, vargs);
|
||||
len = vsnprintf(NULL, 0, fmt, aq);
|
||||
va_end(aq);
|
||||
|
||||
len = len < BUS_ID_SIZE ? (len + 1) : BUS_ID_SIZE;
|
||||
|
||||
vsnprintf(dev->bus_id, len, fmt, vargs);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* dev_set_name - set a device name
|
||||
* @dev: device
|
||||
* @fmt: format string for the device's name
|
||||
*/
|
||||
int dev_set_name(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
int err;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
err = kobject_set_name_vargs(&dev->kobj, fmt, vargs);
|
||||
va_end(vargs);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_set_name);
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.27
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/pci.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
#include <linux/mmc/sdio.h>
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include <linux/mmc/card.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#endif
|
||||
|
||||
/* rfkill notification chain */
|
||||
#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
|
||||
switch has changed */
|
||||
|
||||
/*
|
||||
* e5899e1b7d73e67de758a32174a859cc2586c0b9 made pci_pme_capable() external,
|
||||
* it was defined internally, some drivers want access to this information.
|
||||
*
|
||||
* Unfortunately the old kernels do not have ->pm_cap or ->pme_support so
|
||||
* we have to call the PCI routines directly.
|
||||
*/
|
||||
|
||||
/**
|
||||
* pci_pme_capable - check the capability of PCI device to generate PME#
|
||||
* @dev: PCI device to handle.
|
||||
* @state: PCI state from which device will issue PME#.
|
||||
*
|
||||
* This is the backport code for older kernels for compat-wireless, we read stuff
|
||||
* from the initialization stuff from pci_pm_init().
|
||||
*/
|
||||
bool pci_pme_capable(struct pci_dev *dev, pci_power_t state)
|
||||
{
|
||||
int pm;
|
||||
u16 pmc = 0;
|
||||
u16 pme_support; /* as from the pci dev */
|
||||
/* find PCI PM capability in list */
|
||||
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
|
||||
if (!pm)
|
||||
return false;
|
||||
|
||||
if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
|
||||
dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n",
|
||||
pmc & PCI_PM_CAP_VER_MASK);
|
||||
return false;
|
||||
}
|
||||
|
||||
pmc &= PCI_PM_CAP_PME_MASK;
|
||||
|
||||
if (!pmc)
|
||||
return false;
|
||||
|
||||
pme_support = pmc >> PCI_PM_CAP_PME_SHIFT;
|
||||
|
||||
/* Check device's ability to generate PME# */
|
||||
|
||||
return !!(pme_support & (1 << state));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_pme_capable);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
/**
|
||||
* mmc_align_data_size - pads a transfer size to a more optimal value
|
||||
* @card: the MMC card associated with the data transfer
|
||||
* @sz: original transfer size
|
||||
*
|
||||
* Pads the original data size with a number of extra bytes in
|
||||
* order to avoid controller bugs and/or performance hits
|
||||
* (e.g. some controllers revert to PIO for certain sizes).
|
||||
*
|
||||
* Returns the improved size, which might be unmodified.
|
||||
*
|
||||
* Note that this function is only relevant when issuing a
|
||||
* single scatter gather entry.
|
||||
*/
|
||||
unsigned int mmc_align_data_size(struct mmc_card *card, unsigned int sz)
|
||||
{
|
||||
/*
|
||||
* FIXME: We don't have a system for the controller to tell
|
||||
* the core about its problems yet, so for now we just 32-bit
|
||||
* align the size.
|
||||
*/
|
||||
sz = ((sz + 3) / 4) * 4;
|
||||
|
||||
return sz;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mmc_align_data_size);
|
||||
|
||||
/*
|
||||
* Calculate the maximum byte mode transfer size
|
||||
*/
|
||||
static inline unsigned int sdio_max_byte_size(struct sdio_func *func)
|
||||
{
|
||||
unsigned int mval = (unsigned int) min(func->card->host->max_seg_size,
|
||||
func->card->host->max_blk_size);
|
||||
mval = min(mval, func->max_blksize);
|
||||
return min(mval, 512u); /* maximum size for byte mode */
|
||||
}
|
||||
|
||||
/**
|
||||
* sdio_align_size - pads a transfer size to a more optimal value
|
||||
* @func: SDIO function
|
||||
* @sz: original transfer size
|
||||
*
|
||||
* Pads the original data size with a number of extra bytes in
|
||||
* order to avoid controller bugs and/or performance hits
|
||||
* (e.g. some controllers revert to PIO for certain sizes).
|
||||
*
|
||||
* If possible, it will also adjust the size so that it can be
|
||||
* handled in just a single request.
|
||||
*
|
||||
* Returns the improved size, which might be unmodified.
|
||||
*/
|
||||
unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz)
|
||||
{
|
||||
unsigned int orig_sz;
|
||||
unsigned int blk_sz, byte_sz;
|
||||
unsigned chunk_sz;
|
||||
|
||||
orig_sz = sz;
|
||||
|
||||
/*
|
||||
* Do a first check with the controller, in case it
|
||||
* wants to increase the size up to a point where it
|
||||
* might need more than one block.
|
||||
*/
|
||||
sz = mmc_align_data_size(func->card, sz);
|
||||
|
||||
/*
|
||||
* If we can still do this with just a byte transfer, then
|
||||
* we're done.
|
||||
*/
|
||||
if (sz <= sdio_max_byte_size(func))
|
||||
return sz;
|
||||
|
||||
if (func->card->cccr.multi_block) {
|
||||
/*
|
||||
* Check if the transfer is already block aligned
|
||||
*/
|
||||
if ((sz % func->cur_blksize) == 0)
|
||||
return sz;
|
||||
|
||||
/*
|
||||
* Realign it so that it can be done with one request,
|
||||
* and recheck if the controller still likes it.
|
||||
*/
|
||||
blk_sz = ((sz + func->cur_blksize - 1) /
|
||||
func->cur_blksize) * func->cur_blksize;
|
||||
blk_sz = mmc_align_data_size(func->card, blk_sz);
|
||||
|
||||
/*
|
||||
* This value is only good if it is still just
|
||||
* one request.
|
||||
*/
|
||||
if ((blk_sz % func->cur_blksize) == 0)
|
||||
return blk_sz;
|
||||
|
||||
/*
|
||||
* We failed to do one request, but at least try to
|
||||
* pad the remainder properly.
|
||||
*/
|
||||
byte_sz = mmc_align_data_size(func->card,
|
||||
sz % func->cur_blksize);
|
||||
if (byte_sz <= sdio_max_byte_size(func)) {
|
||||
blk_sz = sz / func->cur_blksize;
|
||||
return blk_sz * func->cur_blksize + byte_sz;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We need multiple requests, so first check that the
|
||||
* controller can handle the chunk size;
|
||||
*/
|
||||
chunk_sz = mmc_align_data_size(func->card,
|
||||
sdio_max_byte_size(func));
|
||||
if (chunk_sz == sdio_max_byte_size(func)) {
|
||||
/*
|
||||
* Fix up the size of the remainder (if any)
|
||||
*/
|
||||
byte_sz = orig_sz % chunk_sz;
|
||||
if (byte_sz) {
|
||||
byte_sz = mmc_align_data_size(func->card,
|
||||
byte_sz);
|
||||
}
|
||||
|
||||
return (orig_sz / chunk_sz) * chunk_sz + byte_sz;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The controller is simply incapable of transferring the size
|
||||
* we want in decent manner, so just return the original size.
|
||||
*/
|
||||
return orig_sz;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sdio_align_size);
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
/*
|
||||
* Backport of debugfs_remove_recursive() without using the internals globals
|
||||
* which are used by the kernel's version with:
|
||||
* simple_release_fs(&debugfs_mount, &debugfs_mount_count);
|
||||
*/
|
||||
void debugfs_remove_recursive(struct dentry *dentry)
|
||||
{
|
||||
struct dentry *last = NULL;
|
||||
|
||||
/* Sanity checks */
|
||||
if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode)
|
||||
return;
|
||||
|
||||
while (dentry != last) {
|
||||
struct dentry *child = dentry;
|
||||
|
||||
/* Find a child without children */
|
||||
while (!list_empty(&child->d_subdirs))
|
||||
child = list_entry(child->d_subdirs.next,
|
||||
struct dentry,
|
||||
d_u.d_child);
|
||||
|
||||
/* Bail out if we already tried to remove that entry */
|
||||
if (child == last)
|
||||
return;
|
||||
|
||||
last = child;
|
||||
debugfs_remove(child);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
|
||||
#endif /* CONFIG_DEBUG_FS */
|
||||
|
||||
@@ -1,463 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.28.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/tty.h>
|
||||
#include <asm/poll.h>
|
||||
|
||||
/* 2.6.28 compat code goes here */
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
|
||||
#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
|
||||
/*
|
||||
* Compat-wireless notes for USB backport stuff:
|
||||
*
|
||||
* urb->reject exists on 2.6.27, the poison/unpoison helpers
|
||||
* did not though. The anchor poison does not exist so we cannot use them.
|
||||
*
|
||||
* USB anchor poising seems to exist to prevent future driver sumbissions
|
||||
* of usb_anchor_urb() to an anchor marked as poisoned. For older kernels
|
||||
* we cannot use that, so new usb_anchor_urb()s will be anchored. The down
|
||||
* side to this should be submission of URBs will continue being anchored
|
||||
* on an anchor instead of having them being rejected immediately when the
|
||||
* driver realized we needed to stop. For ar9170 we poison URBs upon the
|
||||
* ar9170 mac80211 stop callback(), don't think this should be so bad.
|
||||
* It mean there is period of time in older kernels for which we continue
|
||||
* to anchor new URBs to a known stopped anchor. We have two anchors
|
||||
* (TX, and RX)
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* usb_poison_urb - reliably kill a transfer and prevent further use of an URB
|
||||
* @urb: pointer to URB describing a previously submitted request,
|
||||
* may be NULL
|
||||
*
|
||||
* This routine cancels an in-progress request. It is guaranteed that
|
||||
* upon return all completion handlers will have finished and the URB
|
||||
* will be totally idle and cannot be reused. These features make
|
||||
* this an ideal way to stop I/O in a disconnect() callback.
|
||||
* If the request has not already finished or been unlinked
|
||||
* the completion handler will see urb->status == -ENOENT.
|
||||
*
|
||||
* After and while the routine runs, attempts to resubmit the URB will fail
|
||||
* with error -EPERM. Thus even if the URB's completion handler always
|
||||
* tries to resubmit, it will not succeed and the URB will become idle.
|
||||
*
|
||||
* This routine may not be used in an interrupt context (such as a bottom
|
||||
* half or a completion handler), or when holding a spinlock, or in other
|
||||
* situations where the caller can't schedule().
|
||||
*
|
||||
* This routine should not be called by a driver after its disconnect
|
||||
* method has returned.
|
||||
*/
|
||||
void usb_poison_urb(struct urb *urb)
|
||||
{
|
||||
might_sleep();
|
||||
if (!(urb && urb->dev && urb->ep))
|
||||
return;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
|
||||
spin_lock_irq(&usb_reject_lock);
|
||||
#endif
|
||||
++urb->reject;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
|
||||
spin_unlock_irq(&usb_reject_lock);
|
||||
#endif
|
||||
/*
|
||||
* XXX: usb_hcd_unlink_urb() needs backporting... this is defined
|
||||
* on usb hcd.c but urb.c gets access to it. That is, older kernels
|
||||
* have usb_hcd_unlink_urb() but its not exported, nor can we
|
||||
* re-implement it exactly. This essentially dequeues the urb from
|
||||
* hw, we need to figure out a way to backport this.
|
||||
*/
|
||||
//usb_hcd_unlink_urb(urb, -ENOENT);
|
||||
|
||||
wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_poison_urb);
|
||||
#endif
|
||||
#endif /* CONFIG_USB */
|
||||
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
|
||||
#include <pcmcia/ds.h>
|
||||
struct pcmcia_cfg_mem {
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
u8 buf[256];
|
||||
cistpl_cftable_entry_t dflt;
|
||||
};
|
||||
/**
|
||||
* pcmcia_loop_config() - loop over configuration options
|
||||
* @p_dev: the struct pcmcia_device which we need to loop for.
|
||||
* @conf_check: function to call for each configuration option.
|
||||
* It gets passed the struct pcmcia_device, the CIS data
|
||||
* describing the configuration option, and private data
|
||||
* being passed to pcmcia_loop_config()
|
||||
* @priv_data: private data to be passed to the conf_check function.
|
||||
*
|
||||
* pcmcia_loop_config() loops over all configuration options, and calls
|
||||
* the driver-specific conf_check() for each one, checking whether
|
||||
* it is a valid one. Returns 0 on success or errorcode otherwise.
|
||||
*/
|
||||
int pcmcia_loop_config(struct pcmcia_device *p_dev,
|
||||
int (*conf_check) (struct pcmcia_device *p_dev,
|
||||
cistpl_cftable_entry_t *cfg,
|
||||
cistpl_cftable_entry_t *dflt,
|
||||
unsigned int vcc,
|
||||
void *priv_data),
|
||||
void *priv_data)
|
||||
{
|
||||
struct pcmcia_cfg_mem *cfg_mem;
|
||||
|
||||
tuple_t *tuple;
|
||||
int ret;
|
||||
unsigned int vcc;
|
||||
|
||||
cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL);
|
||||
if (cfg_mem == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
/* get the current Vcc setting */
|
||||
vcc = p_dev->socket->socket.Vcc;
|
||||
|
||||
tuple = &cfg_mem->tuple;
|
||||
tuple->TupleData = cfg_mem->buf;
|
||||
tuple->TupleDataMax = 255;
|
||||
tuple->TupleOffset = 0;
|
||||
tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple->Attributes = 0;
|
||||
|
||||
ret = pcmcia_get_first_tuple(p_dev, tuple);
|
||||
while (!ret) {
|
||||
cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry;
|
||||
|
||||
if (pcmcia_get_tuple_data(p_dev, tuple))
|
||||
goto next_entry;
|
||||
|
||||
if (pcmcia_parse_tuple(tuple, &cfg_mem->parse))
|
||||
goto next_entry;
|
||||
|
||||
/* default values */
|
||||
p_dev->conf.ConfigIndex = cfg->index;
|
||||
if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
|
||||
cfg_mem->dflt = *cfg;
|
||||
|
||||
ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data);
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
next_entry:
|
||||
ret = pcmcia_get_next_tuple(p_dev, tuple);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pcmcia_loop_config);
|
||||
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
|
||||
#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
|
||||
|
||||
void usb_unpoison_urb(struct urb *urb)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
|
||||
unsigned long flags;
|
||||
#endif
|
||||
|
||||
if (!urb)
|
||||
return;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
|
||||
spin_lock_irqsave(&usb_reject_lock, flags);
|
||||
#endif
|
||||
--urb->reject;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
|
||||
spin_unlock_irqrestore(&usb_reject_lock, flags);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_unpoison_urb);
|
||||
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* usb_poison_anchored_urbs - cease all traffic from an anchor
|
||||
* @anchor: anchor the requests are bound to
|
||||
*
|
||||
* this allows all outstanding URBs to be poisoned starting
|
||||
* from the back of the queue. Newly added URBs will also be
|
||||
* poisoned
|
||||
*
|
||||
* This routine should not be called by a driver after its disconnect
|
||||
* method has returned.
|
||||
*/
|
||||
void usb_poison_anchored_urbs(struct usb_anchor *anchor)
|
||||
{
|
||||
struct urb *victim;
|
||||
|
||||
spin_lock_irq(&anchor->lock);
|
||||
// anchor->poisoned = 1; /* XXX: Cannot backport */
|
||||
while (!list_empty(&anchor->urb_list)) {
|
||||
victim = list_entry(anchor->urb_list.prev, struct urb,
|
||||
anchor_list);
|
||||
/* we must make sure the URB isn't freed before we kill it*/
|
||||
usb_get_urb(victim);
|
||||
spin_unlock_irq(&anchor->lock);
|
||||
/* this will unanchor the URB */
|
||||
usb_poison_urb(victim);
|
||||
usb_put_urb(victim);
|
||||
spin_lock_irq(&anchor->lock);
|
||||
}
|
||||
spin_unlock_irq(&anchor->lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* usb_anchor_empty - is an anchor empty
|
||||
* @anchor: the anchor you want to query
|
||||
*
|
||||
* returns 1 if the anchor has no urbs associated with it
|
||||
*/
|
||||
int usb_anchor_empty(struct usb_anchor *anchor)
|
||||
{
|
||||
return list_empty(&anchor->urb_list);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(usb_anchor_empty);
|
||||
#endif /* CONFIG_USB */
|
||||
#endif
|
||||
|
||||
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
|
||||
{
|
||||
/*
|
||||
* Make sure the BAR is actually a memory resource, not an IO resource
|
||||
*/
|
||||
if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
|
||||
WARN_ON(1);
|
||||
return NULL;
|
||||
}
|
||||
return ioremap_nocache(pci_resource_start(pdev, bar),
|
||||
pci_resource_len(pdev, bar));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_ioremap_bar);
|
||||
|
||||
static unsigned long round_jiffies_common(unsigned long j, int cpu,
|
||||
bool force_up)
|
||||
{
|
||||
int rem;
|
||||
unsigned long original = j;
|
||||
|
||||
/*
|
||||
* We don't want all cpus firing their timers at once hitting the
|
||||
* same lock or cachelines, so we skew each extra cpu with an extra
|
||||
* 3 jiffies. This 3 jiffies came originally from the mm/ code which
|
||||
* already did this.
|
||||
* The skew is done by adding 3*cpunr, then round, then subtract this
|
||||
* extra offset again.
|
||||
*/
|
||||
j += cpu * 3;
|
||||
|
||||
rem = j % HZ;
|
||||
|
||||
/*
|
||||
* If the target jiffie is just after a whole second (which can happen
|
||||
* due to delays of the timer irq, long irq off times etc etc) then
|
||||
* we should round down to the whole second, not up. Use 1/4th second
|
||||
* as cutoff for this rounding as an extreme upper bound for this.
|
||||
* But never round down if @force_up is set.
|
||||
*/
|
||||
if (rem < HZ/4 && !force_up) /* round down */
|
||||
j = j - rem;
|
||||
else /* round up */
|
||||
j = j - rem + HZ;
|
||||
|
||||
/* now that we have rounded, subtract the extra skew again */
|
||||
j -= cpu * 3;
|
||||
|
||||
if (j <= jiffies) /* rounding ate our timeout entirely; */
|
||||
return original;
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* round_jiffies_up - function to round jiffies up to a full second
|
||||
* @j: the time in (absolute) jiffies that should be rounded
|
||||
*
|
||||
* This is the same as round_jiffies() except that it will never
|
||||
* round down. This is useful for timeouts for which the exact time
|
||||
* of firing does not matter too much, as long as they don't fire too
|
||||
* early.
|
||||
*/
|
||||
unsigned long round_jiffies_up(unsigned long j)
|
||||
{
|
||||
return round_jiffies_common(j, raw_smp_processor_id(), true);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(round_jiffies_up);
|
||||
|
||||
void v2_6_28_skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
|
||||
int size)
|
||||
{
|
||||
skb_fill_page_desc(skb, i, page, off, size);
|
||||
skb->len += size;
|
||||
skb->data_len += size;
|
||||
skb->truesize += size;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v2_6_28_skb_add_rx_frag);
|
||||
|
||||
void tty_write_unlock(struct tty_struct *tty)
|
||||
{
|
||||
mutex_unlock(&tty->atomic_write_lock);
|
||||
wake_up_interruptible_poll(&tty->write_wait, POLLOUT);
|
||||
}
|
||||
|
||||
int tty_write_lock(struct tty_struct *tty, int ndelay)
|
||||
{
|
||||
if (!mutex_trylock(&tty->atomic_write_lock)) {
|
||||
if (ndelay)
|
||||
return -EAGAIN;
|
||||
if (mutex_lock_interruptible(&tty->atomic_write_lock))
|
||||
return -ERESTARTSYS;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* send_prio_char - send priority character
|
||||
*
|
||||
* Send a high priority character to the tty even if stopped
|
||||
*
|
||||
* Locking: none for xchar method, write ordering for write method.
|
||||
*/
|
||||
|
||||
static int send_prio_char(struct tty_struct *tty, char ch)
|
||||
{
|
||||
int was_stopped = tty->stopped;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
|
||||
if (tty->ops->send_xchar) {
|
||||
tty->ops->send_xchar(tty, ch);
|
||||
#else
|
||||
if (tty->driver->send_xchar) {
|
||||
tty->driver->send_xchar(tty, ch);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tty_write_lock(tty, 0) < 0)
|
||||
return -ERESTARTSYS;
|
||||
|
||||
if (was_stopped)
|
||||
start_tty(tty);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
|
||||
tty->ops->write(tty, &ch, 1);
|
||||
#else
|
||||
tty->driver->write(tty, &ch, 1);
|
||||
#endif
|
||||
if (was_stopped)
|
||||
stop_tty(tty);
|
||||
tty_write_unlock(tty);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
|
||||
unsigned long flags;
|
||||
#endif
|
||||
int retval;
|
||||
|
||||
switch (cmd) {
|
||||
case TCXONC:
|
||||
retval = tty_check_change(tty);
|
||||
if (retval)
|
||||
return retval;
|
||||
switch (arg) {
|
||||
case TCOOFF:
|
||||
if (!tty->flow_stopped) {
|
||||
tty->flow_stopped = 1;
|
||||
stop_tty(tty);
|
||||
}
|
||||
break;
|
||||
case TCOON:
|
||||
if (tty->flow_stopped) {
|
||||
tty->flow_stopped = 0;
|
||||
start_tty(tty);
|
||||
}
|
||||
break;
|
||||
case TCIOFF:
|
||||
if (STOP_CHAR(tty) != __DISABLED_CHAR)
|
||||
return send_prio_char(tty, STOP_CHAR(tty));
|
||||
break;
|
||||
case TCION:
|
||||
if (START_CHAR(tty) != __DISABLED_CHAR)
|
||||
return send_prio_char(tty, START_CHAR(tty));
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
case TCFLSH:
|
||||
return tty_perform_flush(tty, arg);
|
||||
case TIOCPKT:
|
||||
{
|
||||
int pktmode;
|
||||
|
||||
if (tty->driver->type != TTY_DRIVER_TYPE_PTY ||
|
||||
tty->driver->subtype != PTY_TYPE_MASTER)
|
||||
return -ENOTTY;
|
||||
if (get_user(pktmode, (int __user *) arg))
|
||||
return -EFAULT;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
|
||||
spin_lock_irqsave(&tty->ctrl_lock, flags);
|
||||
#endif
|
||||
if (pktmode) {
|
||||
if (!tty->packet) {
|
||||
tty->packet = 1;
|
||||
tty->link->ctrl_status = 0;
|
||||
}
|
||||
} else
|
||||
tty->packet = 0;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
|
||||
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
/* Try the mode commands */
|
||||
return tty_mode_ioctl(tty, file, cmd, arg);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(n_tty_ioctl_helper);
|
||||
|
||||
/**
|
||||
* pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold
|
||||
* @dev: PCI device to prepare
|
||||
* @enable: True to enable wake-up event generation; false to disable
|
||||
*
|
||||
* Many drivers want the device to wake up the system from D3_hot or D3_cold
|
||||
* and this function allows them to set that up cleanly - pci_enable_wake()
|
||||
* should not be called twice in a row to enable wake-up due to PCI PM vs ACPI
|
||||
* ordering constraints.
|
||||
*
|
||||
* This function only returns error code if the device is not capable of
|
||||
* generating PME# from both D3_hot and D3_cold, and the platform is unable to
|
||||
* enable wake-up power for it.
|
||||
*/
|
||||
int pci_wake_from_d3(struct pci_dev *dev, bool enable)
|
||||
{
|
||||
return pci_pme_capable(dev, PCI_D3cold) ?
|
||||
pci_enable_wake(dev, PCI_D3cold, enable) :
|
||||
pci_enable_wake(dev, PCI_D3hot, enable);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_wake_from_d3);
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007-2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.29.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/etherdevice.h>
|
||||
|
||||
/*
|
||||
* If you don't see your net_device_ops implemented on
|
||||
* netdev_attach_ops() then you are shit out of luck and
|
||||
* you must do the nasty ifdef magic, unless you figure
|
||||
* out a way to squeze your hacks into this routine :)
|
||||
*/
|
||||
void netdev_attach_ops(struct net_device *dev,
|
||||
const struct net_device_ops *ops)
|
||||
{
|
||||
dev->open = ops->ndo_open;
|
||||
dev->init = ops->ndo_init;
|
||||
dev->stop = ops->ndo_stop;
|
||||
dev->hard_start_xmit = ops->ndo_start_xmit;
|
||||
dev->change_rx_flags = ops->ndo_change_rx_flags;
|
||||
dev->set_multicast_list = ops->ndo_set_multicast_list;
|
||||
dev->validate_addr = ops->ndo_validate_addr;
|
||||
dev->do_ioctl = ops->ndo_do_ioctl;
|
||||
dev->set_config = ops->ndo_set_config;
|
||||
dev->change_mtu = ops->ndo_change_mtu;
|
||||
dev->set_mac_address = ops->ndo_set_mac_address;
|
||||
dev->tx_timeout = ops->ndo_tx_timeout;
|
||||
if (ops->ndo_get_stats)
|
||||
dev->get_stats = ops->ndo_get_stats;
|
||||
dev->vlan_rx_register = ops->ndo_vlan_rx_register;
|
||||
dev->vlan_rx_add_vid = ops->ndo_vlan_rx_add_vid;
|
||||
dev->vlan_rx_kill_vid = ops->ndo_vlan_rx_kill_vid;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = ops->ndo_poll_controller;
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
dev->select_queue = ops->ndo_select_queue;
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(netdev_attach_ops);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
|
||||
#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
|
||||
/**
|
||||
* usb_unpoison_anchored_urbs - let an anchor be used successfully again
|
||||
* @anchor: anchor the requests are bound to
|
||||
*
|
||||
* Reverses the effect of usb_poison_anchored_urbs
|
||||
* the anchor can be used normally after it returns
|
||||
*/
|
||||
void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct urb *lazarus;
|
||||
|
||||
spin_lock_irqsave(&anchor->lock, flags);
|
||||
list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) {
|
||||
usb_unpoison_urb(lazarus);
|
||||
}
|
||||
//anchor->poisoned = 0; /* XXX: cannot backport */
|
||||
spin_unlock_irqrestore(&anchor->lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
|
||||
#endif /* CONFIG_USB */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* eth_mac_addr - set new Ethernet hardware address
|
||||
* @dev: network device
|
||||
* @p: socket address
|
||||
* Change hardware address of device.
|
||||
*
|
||||
* This doesn't change hardware matching, so needs to be overridden
|
||||
* for most real devices.
|
||||
*/
|
||||
int eth_mac_addr(struct net_device *dev, void *p)
|
||||
{
|
||||
struct sockaddr *addr = p;
|
||||
|
||||
if (netif_running(dev))
|
||||
return -EBUSY;
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(eth_mac_addr);
|
||||
|
||||
/**
|
||||
* eth_change_mtu - set new MTU size
|
||||
* @dev: network device
|
||||
* @new_mtu: new Maximum Transfer Unit
|
||||
*
|
||||
* Allow changing MTU size. Needs to be overridden for devices
|
||||
* supporting jumbo frames.
|
||||
*/
|
||||
int eth_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if (new_mtu < 68 || new_mtu > ETH_DATA_LEN)
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(eth_change_mtu);
|
||||
|
||||
int eth_validate_addr(struct net_device *dev)
|
||||
{
|
||||
if (!is_valid_ether_addr(dev->dev_addr))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(eth_validate_addr);
|
||||
/* Source: net/ethernet/eth.c */
|
||||
|
||||
#define NETREG_DUMMY 5
|
||||
/**
|
||||
* init_dummy_netdev - init a dummy network device for NAPI
|
||||
* @dev: device to init
|
||||
*
|
||||
* This takes a network device structure and initialize the minimum
|
||||
* amount of fields so it can be used to schedule NAPI polls without
|
||||
* registering a full blown interface. This is to be used by drivers
|
||||
* that need to tie several hardware interfaces to a single NAPI
|
||||
* poll scheduler due to HW limitations.
|
||||
*/
|
||||
int init_dummy_netdev(struct net_device *dev)
|
||||
{
|
||||
/* Clear everything. Note we don't initialize spinlocks
|
||||
* are they aren't supposed to be taken by any of the
|
||||
* NAPI code and this dummy netdev is supposed to be
|
||||
* only ever used for NAPI polls
|
||||
*/
|
||||
memset(dev, 0, sizeof(struct net_device));
|
||||
|
||||
/* make sure we BUG if trying to hit standard
|
||||
* register/unregister code path
|
||||
*/
|
||||
dev->reg_state = NETREG_DUMMY;
|
||||
|
||||
/* initialize the ref count */
|
||||
atomic_set(&dev->refcnt, 1);
|
||||
|
||||
#ifdef CONFIG_NETPOLL
|
||||
/* NAPI wants this */
|
||||
INIT_LIST_HEAD(&dev->napi_list);
|
||||
#endif
|
||||
|
||||
/* a dummy interface is started by default */
|
||||
set_bit(__LINK_STATE_PRESENT, &dev->state);
|
||||
set_bit(__LINK_STATE_START, &dev->state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(init_dummy_netdev);
|
||||
/* Source: net/core/dev.c */
|
||||
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.32.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
int __dev_addr_add(struct dev_addr_list **list, int *count,
|
||||
void *addr, int alen, int glbl)
|
||||
{
|
||||
struct dev_addr_list *da;
|
||||
|
||||
for (da = *list; da != NULL; da = da->next) {
|
||||
if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
|
||||
da->da_addrlen == alen) {
|
||||
if (glbl) {
|
||||
int old_glbl = da->da_gusers;
|
||||
da->da_gusers = 1;
|
||||
if (old_glbl)
|
||||
return 0;
|
||||
}
|
||||
da->da_users++;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
da = kzalloc(sizeof(*da), GFP_ATOMIC);
|
||||
if (da == NULL)
|
||||
return -ENOMEM;
|
||||
memcpy(da->da_addr, addr, alen);
|
||||
da->da_addrlen = alen;
|
||||
da->da_users = 1;
|
||||
da->da_gusers = glbl ? 1 : 0;
|
||||
da->next = *list;
|
||||
*list = da;
|
||||
(*count)++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __dev_addr_delete(struct dev_addr_list **list, int *count,
|
||||
void *addr, int alen, int glbl)
|
||||
{
|
||||
struct dev_addr_list *da;
|
||||
|
||||
for (; (da = *list) != NULL; list = &da->next) {
|
||||
if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
|
||||
alen == da->da_addrlen) {
|
||||
if (glbl) {
|
||||
int old_glbl = da->da_gusers;
|
||||
da->da_gusers = 0;
|
||||
if (old_glbl == 0)
|
||||
break;
|
||||
}
|
||||
if (--da->da_users)
|
||||
return 0;
|
||||
|
||||
*list = da->next;
|
||||
kfree(da);
|
||||
(*count)--;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
int __dev_addr_sync(struct dev_addr_list **to, int *to_count,
|
||||
struct dev_addr_list **from, int *from_count)
|
||||
{
|
||||
struct dev_addr_list *da, *next;
|
||||
int err = 0;
|
||||
|
||||
da = *from;
|
||||
while (da != NULL) {
|
||||
next = da->next;
|
||||
if (!da->da_synced) {
|
||||
err = __dev_addr_add(to, to_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
if (err < 0)
|
||||
break;
|
||||
da->da_synced = 1;
|
||||
da->da_users++;
|
||||
} else if (da->da_users == 1) {
|
||||
__dev_addr_delete(to, to_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
__dev_addr_delete(from, from_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
}
|
||||
da = next;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__dev_addr_sync);
|
||||
|
||||
void __dev_addr_unsync(struct dev_addr_list **to, int *to_count,
|
||||
struct dev_addr_list **from, int *from_count)
|
||||
{
|
||||
struct dev_addr_list *da, *next;
|
||||
|
||||
da = *from;
|
||||
while (da != NULL) {
|
||||
next = da->next;
|
||||
if (da->da_synced) {
|
||||
__dev_addr_delete(to, to_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
da->da_synced = 0;
|
||||
__dev_addr_delete(from, from_count,
|
||||
da->da_addr, da->da_addrlen, 0);
|
||||
}
|
||||
da = next;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__dev_addr_unsync);
|
||||
|
||||
/*
|
||||
* Nonzero if YEAR is a leap year (every 4 years,
|
||||
* except every 100th isn't, and every 400th is).
|
||||
*/
|
||||
static int __isleap(long year)
|
||||
{
|
||||
return (year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0);
|
||||
}
|
||||
|
||||
/* do a mathdiv for long type */
|
||||
static long math_div(long a, long b)
|
||||
{
|
||||
return a / b - (a % b < 0);
|
||||
}
|
||||
|
||||
/* How many leap years between y1 and y2, y1 must less or equal to y2 */
|
||||
static long leaps_between(long y1, long y2)
|
||||
{
|
||||
long leaps1 = math_div(y1 - 1, 4) - math_div(y1 - 1, 100)
|
||||
+ math_div(y1 - 1, 400);
|
||||
long leaps2 = math_div(y2 - 1, 4) - math_div(y2 - 1, 100)
|
||||
+ math_div(y2 - 1, 400);
|
||||
return leaps2 - leaps1;
|
||||
}
|
||||
|
||||
/* How many days come before each month (0-12). */
|
||||
static const unsigned short __mon_yday[2][13] = {
|
||||
/* Normal years. */
|
||||
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
|
||||
/* Leap years. */
|
||||
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
|
||||
};
|
||||
|
||||
#define SECS_PER_HOUR (60 * 60)
|
||||
#define SECS_PER_DAY (SECS_PER_HOUR * 24)
|
||||
|
||||
/**
|
||||
* time_to_tm - converts the calendar time to local broken-down time
|
||||
*
|
||||
* @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
|
||||
* Coordinated Universal Time (UTC).
|
||||
* @offset offset seconds adding to totalsecs.
|
||||
* @result pointer to struct tm variable to receive broken-down time
|
||||
*/
|
||||
void time_to_tm(time_t totalsecs, int offset, struct tm *result)
|
||||
{
|
||||
long days, rem, y;
|
||||
const unsigned short *ip;
|
||||
|
||||
days = totalsecs / SECS_PER_DAY;
|
||||
rem = totalsecs % SECS_PER_DAY;
|
||||
rem += offset;
|
||||
while (rem < 0) {
|
||||
rem += SECS_PER_DAY;
|
||||
--days;
|
||||
}
|
||||
while (rem >= SECS_PER_DAY) {
|
||||
rem -= SECS_PER_DAY;
|
||||
++days;
|
||||
}
|
||||
|
||||
result->tm_hour = rem / SECS_PER_HOUR;
|
||||
rem %= SECS_PER_HOUR;
|
||||
result->tm_min = rem / 60;
|
||||
result->tm_sec = rem % 60;
|
||||
|
||||
/* January 1, 1970 was a Thursday. */
|
||||
result->tm_wday = (4 + days) % 7;
|
||||
if (result->tm_wday < 0)
|
||||
result->tm_wday += 7;
|
||||
|
||||
y = 1970;
|
||||
|
||||
while (days < 0 || days >= (__isleap(y) ? 366 : 365)) {
|
||||
/* Guess a corrected year, assuming 365 days per year. */
|
||||
long yg = y + math_div(days, 365);
|
||||
|
||||
/* Adjust DAYS and Y to match the guessed year. */
|
||||
days -= (yg - y) * 365 + leaps_between(y, yg);
|
||||
y = yg;
|
||||
}
|
||||
|
||||
result->tm_year = y - 1900;
|
||||
|
||||
result->tm_yday = days;
|
||||
|
||||
ip = __mon_yday[__isleap(y)];
|
||||
for (y = 11; days < ip[y]; y--)
|
||||
continue;
|
||||
days -= ip[y];
|
||||
|
||||
result->tm_mon = y;
|
||||
result->tm_mday = days + 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(time_to_tm);
|
||||
/* source: kernel/time/timeconv.c*/
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.33.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/autoconf.h>
|
||||
|
||||
#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
|
||||
|
||||
/**
|
||||
* pccard_loop_tuple() - loop over tuples in the CIS
|
||||
* @s: the struct pcmcia_socket where the card is inserted
|
||||
* @function: the device function we loop for
|
||||
* @code: which CIS code shall we look for?
|
||||
* @parse: buffer where the tuple shall be parsed (or NULL, if no parse)
|
||||
* @priv_data: private data to be passed to the loop_tuple function.
|
||||
* @loop_tuple: function to call for each CIS entry of type @function. IT
|
||||
* gets passed the raw tuple, the paresed tuple (if @parse is
|
||||
* set) and @priv_data.
|
||||
*
|
||||
* pccard_loop_tuple() loops over all CIS entries of type @function, and
|
||||
* calls the @loop_tuple function for each entry. If the call to @loop_tuple
|
||||
* returns 0, the loop exits. Returns 0 on success or errorcode otherwise.
|
||||
*/
|
||||
int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
|
||||
cisdata_t code, cisparse_t *parse, void *priv_data,
|
||||
int (*loop_tuple) (tuple_t *tuple,
|
||||
cisparse_t *parse,
|
||||
void *priv_data))
|
||||
{
|
||||
tuple_t tuple;
|
||||
cisdata_t *buf;
|
||||
int ret;
|
||||
|
||||
buf = kzalloc(256, GFP_KERNEL);
|
||||
if (buf == NULL) {
|
||||
dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = code;
|
||||
tuple.Attributes = 0;
|
||||
|
||||
ret = pccard_get_first_tuple(s, function, &tuple);
|
||||
while (!ret) {
|
||||
if (pccard_get_tuple_data(s, &tuple))
|
||||
goto next_entry;
|
||||
|
||||
if (parse)
|
||||
if (pcmcia_parse_tuple(&tuple, parse))
|
||||
goto next_entry;
|
||||
|
||||
ret = loop_tuple(&tuple, parse, priv_data);
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
next_entry:
|
||||
ret = pccard_get_next_tuple(s, function, &tuple);
|
||||
}
|
||||
|
||||
kfree(buf);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pccard_loop_tuple);
|
||||
/* Source: drivers/pcmcia/cistpl.c */
|
||||
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
|
||||
struct pcmcia_loop_mem {
|
||||
struct pcmcia_device *p_dev;
|
||||
void *priv_data;
|
||||
int (*loop_tuple) (struct pcmcia_device *p_dev,
|
||||
tuple_t *tuple,
|
||||
void *priv_data);
|
||||
};
|
||||
|
||||
/**
|
||||
* pcmcia_do_loop_tuple() - internal helper for pcmcia_loop_config()
|
||||
*
|
||||
* pcmcia_do_loop_tuple() is the internal callback for the call from
|
||||
* pcmcia_loop_tuple() to pccard_loop_tuple(). Data is transferred
|
||||
* by a struct pcmcia_cfg_mem.
|
||||
*/
|
||||
static int pcmcia_do_loop_tuple(tuple_t *tuple, cisparse_t *parse, void *priv)
|
||||
{
|
||||
struct pcmcia_loop_mem *loop = priv;
|
||||
|
||||
return loop->loop_tuple(loop->p_dev, tuple, loop->priv_data);
|
||||
};
|
||||
|
||||
/**
|
||||
* pcmcia_loop_tuple() - loop over tuples in the CIS
|
||||
* @p_dev: the struct pcmcia_device which we need to loop for.
|
||||
* @code: which CIS code shall we look for?
|
||||
* @priv_data: private data to be passed to the loop_tuple function.
|
||||
* @loop_tuple: function to call for each CIS entry of type @function. IT
|
||||
* gets passed the raw tuple and @priv_data.
|
||||
*
|
||||
* pcmcia_loop_tuple() loops over all CIS entries of type @function, and
|
||||
* calls the @loop_tuple function for each entry. If the call to @loop_tuple
|
||||
* returns 0, the loop exits. Returns 0 on success or errorcode otherwise.
|
||||
*/
|
||||
int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
|
||||
int (*loop_tuple) (struct pcmcia_device *p_dev,
|
||||
tuple_t *tuple,
|
||||
void *priv_data),
|
||||
void *priv_data)
|
||||
{
|
||||
struct pcmcia_loop_mem loop = {
|
||||
.p_dev = p_dev,
|
||||
.loop_tuple = loop_tuple,
|
||||
.priv_data = priv_data};
|
||||
|
||||
return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL,
|
||||
&loop, pcmcia_do_loop_tuple);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pcmcia_loop_tuple);
|
||||
/* Source: drivers/pcmcia/pcmcia_resource.c */
|
||||
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
|
||||
#endif /* CONFIG_PCCARD */
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Kshitij Kulshreshtha <kkhere.geo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.35.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
/**
|
||||
* hex_to_bin - convert a hex digit to its real value
|
||||
* @ch: ascii character represents hex digit
|
||||
*
|
||||
* hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
|
||||
* input.
|
||||
*/
|
||||
int compat_hex_to_bin(char ch)
|
||||
{
|
||||
if ((ch >= '0') && (ch <= '9'))
|
||||
return ch - '0';
|
||||
ch = tolower(ch);
|
||||
if ((ch >= 'a') && (ch <= 'f'))
|
||||
return ch - 'a' + 10;
|
||||
return -1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_hex_to_bin);
|
||||
|
||||
/**
|
||||
* noop_llseek - No Operation Performed llseek implementation
|
||||
* @file: file structure to seek on
|
||||
* @offset: file offset to seek to
|
||||
* @origin: type of seek
|
||||
*
|
||||
* This is an implementation of ->llseek useable for the rare special case when
|
||||
* userspace expects the seek to succeed but the (device) file is actually not
|
||||
* able to perform the seek. In this case you use noop_llseek() instead of
|
||||
* falling back to the default implementation of ->llseek.
|
||||
*/
|
||||
loff_t noop_llseek(struct file *file, loff_t offset, int origin)
|
||||
{
|
||||
return file->f_pos;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(noop_llseek);
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.36.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/usb.h>
|
||||
|
||||
#ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX
|
||||
/* Callers must hold anchor->lock */
|
||||
static void __usb_unanchor_urb(struct urb *urb, struct usb_anchor *anchor)
|
||||
{
|
||||
urb->anchor = NULL;
|
||||
list_del(&urb->anchor_list);
|
||||
usb_put_urb(urb);
|
||||
if (list_empty(&anchor->urb_list))
|
||||
wake_up(&anchor->wait);
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse
|
||||
* @anchor: anchor the requests are bound to
|
||||
*
|
||||
* this allows all outstanding URBs to be unlinked starting
|
||||
* from the back of the queue. This function is asynchronous.
|
||||
* The unlinking is just tiggered. It may happen after this
|
||||
* function has returned.
|
||||
*
|
||||
* This routine should not be called by a driver after its disconnect
|
||||
* method has returned.
|
||||
*/
|
||||
void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor)
|
||||
{
|
||||
struct urb *victim;
|
||||
|
||||
while ((victim = usb_get_from_anchor(anchor)) != NULL) {
|
||||
usb_unlink_urb(victim);
|
||||
usb_put_urb(victim);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_usb_unlink_anchored_urbs);
|
||||
|
||||
/**
|
||||
* usb_get_from_anchor - get an anchor's oldest urb
|
||||
* @anchor: the anchor whose urb you want
|
||||
*
|
||||
* this will take the oldest urb from an anchor,
|
||||
* unanchor and return it
|
||||
*/
|
||||
struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor)
|
||||
{
|
||||
struct urb *victim;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&anchor->lock, flags);
|
||||
if (!list_empty(&anchor->urb_list)) {
|
||||
victim = list_entry(anchor->urb_list.next, struct urb,
|
||||
anchor_list);
|
||||
usb_get_urb(victim);
|
||||
__usb_unanchor_urb(victim, anchor);
|
||||
} else {
|
||||
victim = NULL;
|
||||
}
|
||||
spin_unlock_irqrestore(&anchor->lock, flags);
|
||||
|
||||
return victim;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_usb_get_from_anchor);
|
||||
|
||||
/**
|
||||
* usb_scuttle_anchored_urbs - unanchor all an anchor's urbs
|
||||
* @anchor: the anchor whose urbs you want to unanchor
|
||||
*
|
||||
* use this to get rid of all an anchor's urbs
|
||||
*/
|
||||
void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
|
||||
{
|
||||
struct urb *victim;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&anchor->lock, flags);
|
||||
while (!list_empty(&anchor->urb_list)) {
|
||||
victim = list_entry(anchor->urb_list.prev, struct urb,
|
||||
anchor_list);
|
||||
__usb_unanchor_urb(victim, anchor);
|
||||
}
|
||||
spin_unlock_irqrestore(&anchor->lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_usb_scuttle_anchored_urbs);
|
||||
|
||||
#endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */
|
||||
|
||||
struct workqueue_struct *system_wq __read_mostly;
|
||||
struct workqueue_struct *system_long_wq __read_mostly;
|
||||
struct workqueue_struct *system_nrt_wq __read_mostly;
|
||||
EXPORT_SYMBOL_GPL(system_wq);
|
||||
EXPORT_SYMBOL_GPL(system_long_wq);
|
||||
EXPORT_SYMBOL_GPL(system_nrt_wq);
|
||||
|
||||
int compat_schedule_work(struct work_struct *work)
|
||||
{
|
||||
return queue_work(system_wq, work);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_schedule_work);
|
||||
|
||||
int compat_schedule_work_on(int cpu, struct work_struct *work)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
return queue_work_on(cpu, system_wq, work);
|
||||
#else
|
||||
return queue_work(system_wq, work);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_schedule_work_on);
|
||||
|
||||
int compat_schedule_delayed_work(struct delayed_work *dwork,
|
||||
unsigned long delay)
|
||||
{
|
||||
return queue_delayed_work(system_wq, dwork, delay);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_schedule_delayed_work);
|
||||
|
||||
int compat_schedule_delayed_work_on(int cpu,
|
||||
struct delayed_work *dwork,
|
||||
unsigned long delay)
|
||||
{
|
||||
return queue_delayed_work_on(cpu, system_wq, dwork, delay);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_schedule_delayed_work_on);
|
||||
|
||||
void compat_flush_scheduled_work(void)
|
||||
{
|
||||
/*
|
||||
* It is debatable which one we should prioritize first, lets
|
||||
* go with the old kernel's one first for now (keventd_wq) and
|
||||
* if think its reasonable later we can flip this around.
|
||||
*/
|
||||
flush_workqueue(system_wq);
|
||||
flush_scheduled_work();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_flush_scheduled_work);
|
||||
|
||||
/**
|
||||
* work_busy - test whether a work is currently pending or running
|
||||
* @work: the work to be tested
|
||||
*
|
||||
* Test whether @work is currently pending or running. There is no
|
||||
* synchronization around this function and the test result is
|
||||
* unreliable and only useful as advisory hints or for debugging.
|
||||
* Especially for reentrant wqs, the pending state might hide the
|
||||
* running state.
|
||||
*
|
||||
* RETURNS:
|
||||
* OR'd bitmask of WORK_BUSY_* bits.
|
||||
*/
|
||||
unsigned int work_busy(struct work_struct *work)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
|
||||
if (work_pending(work))
|
||||
ret |= WORK_BUSY_PENDING;
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(work_busy);
|
||||
|
||||
void compat_system_workqueue_create()
|
||||
{
|
||||
system_wq = alloc_workqueue("events", 0, 0);
|
||||
system_long_wq = alloc_workqueue("events_long", 0, 0);
|
||||
system_nrt_wq = create_singlethread_workqueue("events_nrt");
|
||||
BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq);
|
||||
}
|
||||
|
||||
void compat_system_workqueue_destroy()
|
||||
{
|
||||
destroy_workqueue(system_wq);
|
||||
destroy_workqueue(system_long_wq);
|
||||
destroy_workqueue(system_nrt_wq);
|
||||
}
|
||||
@@ -1,358 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.37.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <net/sock.h>
|
||||
#include <linux/nsproxy.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
|
||||
static const void *net_current_ns(void)
|
||||
{
|
||||
return current->nsproxy->net_ns;
|
||||
}
|
||||
|
||||
static const void *net_initial_ns(void)
|
||||
{
|
||||
return &init_net;
|
||||
}
|
||||
|
||||
static const void *net_netlink_ns(struct sock *sk)
|
||||
{
|
||||
return sock_net(sk);
|
||||
}
|
||||
|
||||
struct kobj_ns_type_operations net_ns_type_operations = {
|
||||
.type = KOBJ_NS_TYPE_NET,
|
||||
.current_ns = net_current_ns,
|
||||
.netlink_ns = net_netlink_ns,
|
||||
.initial_ns = net_initial_ns,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(net_ns_type_operations);
|
||||
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)*/
|
||||
|
||||
#undef genl_info
|
||||
#undef genl_unregister_family
|
||||
|
||||
static LIST_HEAD(compat_nl_fam);
|
||||
|
||||
static struct genl_ops *genl_get_cmd(u8 cmd, struct genl_family *family)
|
||||
{
|
||||
struct genl_ops *ops;
|
||||
|
||||
list_for_each_entry(ops, &family->family.ops_list, ops.ops_list)
|
||||
if (ops->cmd == cmd)
|
||||
return ops;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static int nl_doit_wrapper(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct compat_genl_info compat_info;
|
||||
struct genl_family *family;
|
||||
struct genl_ops *ops;
|
||||
int err;
|
||||
|
||||
list_for_each_entry(family, &compat_nl_fam, list) {
|
||||
if (family->id == info->nlhdr->nlmsg_type)
|
||||
goto found;
|
||||
}
|
||||
return -ENOENT;
|
||||
|
||||
found:
|
||||
ops = genl_get_cmd(info->genlhdr->cmd, family);
|
||||
if (!ops)
|
||||
return -ENOENT;
|
||||
|
||||
memset(&compat_info.user_ptr, 0, sizeof(compat_info.user_ptr));
|
||||
compat_info.info = info;
|
||||
#define __copy(_field) compat_info._field = info->_field
|
||||
__copy(snd_seq);
|
||||
__copy(snd_pid);
|
||||
__copy(genlhdr);
|
||||
__copy(attrs);
|
||||
#undef __copy
|
||||
if (family->pre_doit) {
|
||||
err = family->pre_doit(ops, skb, &compat_info);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = ops->doit(skb, &compat_info);
|
||||
|
||||
if (family->post_doit)
|
||||
family->post_doit(ops, skb, &compat_info);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int compat_genl_register_family_with_ops(struct genl_family *family,
|
||||
struct genl_ops *ops, size_t n_ops)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
#define __copy(_field) family->family._field = family->_field
|
||||
__copy(id);
|
||||
__copy(hdrsize);
|
||||
__copy(version);
|
||||
__copy(maxattr);
|
||||
strncpy(family->family.name, family->name, sizeof(family->family.name));
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
|
||||
__copy(netnsok);
|
||||
#endif
|
||||
#undef __copy
|
||||
|
||||
ret = genl_register_family(&family->family);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
family->attrbuf = family->family.attrbuf;
|
||||
family->id = family->family.id;
|
||||
|
||||
for (i = 0; i < n_ops; i++) {
|
||||
#define __copy(_field) ops[i].ops._field = ops[i]._field
|
||||
__copy(cmd);
|
||||
__copy(flags);
|
||||
__copy(policy);
|
||||
__copy(dumpit);
|
||||
__copy(done);
|
||||
#undef __copy
|
||||
if (ops[i].doit)
|
||||
ops[i].ops.doit = nl_doit_wrapper;
|
||||
ret = genl_register_ops(&family->family, &ops[i].ops);
|
||||
if (ret < 0)
|
||||
goto error_ops;
|
||||
}
|
||||
list_add(&family->list, &compat_nl_fam);
|
||||
|
||||
return ret;
|
||||
|
||||
error_ops:
|
||||
compat_genl_unregister_family(family);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_genl_register_family_with_ops);
|
||||
|
||||
int compat_genl_unregister_family(struct genl_family *family)
|
||||
{
|
||||
int err;
|
||||
err = genl_unregister_family(&family->family);
|
||||
list_del(&family->list);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_genl_unregister_family);
|
||||
|
||||
#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
|
||||
|
||||
#undef led_brightness_set
|
||||
#undef led_classdev_unregister
|
||||
|
||||
static DEFINE_SPINLOCK(led_lock);
|
||||
static LIST_HEAD(led_timers);
|
||||
|
||||
struct led_timer {
|
||||
struct list_head list;
|
||||
struct led_classdev *cdev;
|
||||
struct timer_list blink_timer;
|
||||
unsigned long blink_delay_on;
|
||||
unsigned long blink_delay_off;
|
||||
int blink_brightness;
|
||||
};
|
||||
|
||||
static void led_brightness_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
led_cdev->brightness = brightness;
|
||||
led_cdev->brightness_set(led_cdev, brightness);
|
||||
}
|
||||
|
||||
static struct led_timer *led_get_timer(struct led_classdev *led_cdev)
|
||||
{
|
||||
struct led_timer *p;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&led_lock, flags);
|
||||
list_for_each_entry(p, &led_timers, list) {
|
||||
if (p->cdev == led_cdev)
|
||||
goto found;
|
||||
}
|
||||
p = NULL;
|
||||
found:
|
||||
spin_unlock_irqrestore(&led_lock, flags);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void led_stop_software_blink(struct led_timer *led)
|
||||
{
|
||||
del_timer_sync(&led->blink_timer);
|
||||
led->blink_delay_on = 0;
|
||||
led->blink_delay_off = 0;
|
||||
}
|
||||
|
||||
static void led_timer_function(unsigned long data)
|
||||
{
|
||||
struct led_timer *led = (struct led_timer *)data;
|
||||
unsigned long brightness;
|
||||
unsigned long delay;
|
||||
|
||||
if (!led->blink_delay_on || !led->blink_delay_off) {
|
||||
led->cdev->brightness_set(led->cdev, LED_OFF);
|
||||
return;
|
||||
}
|
||||
|
||||
brightness = led->cdev->brightness;
|
||||
if (!brightness) {
|
||||
/* Time to switch the LED on. */
|
||||
brightness = led->blink_brightness;
|
||||
delay = led->blink_delay_on;
|
||||
} else {
|
||||
/* Store the current brightness value to be able
|
||||
* to restore it when the delay_off period is over.
|
||||
*/
|
||||
led->blink_brightness = brightness;
|
||||
brightness = LED_OFF;
|
||||
delay = led->blink_delay_off;
|
||||
}
|
||||
|
||||
led_brightness_set(led->cdev, brightness);
|
||||
mod_timer(&led->blink_timer, jiffies + msecs_to_jiffies(delay));
|
||||
}
|
||||
|
||||
static struct led_timer *led_new_timer(struct led_classdev *led_cdev)
|
||||
{
|
||||
struct led_timer *led;
|
||||
unsigned long flags;
|
||||
|
||||
led = kzalloc(sizeof(struct led_timer), GFP_ATOMIC);
|
||||
if (!led)
|
||||
return NULL;
|
||||
|
||||
led->cdev = led_cdev;
|
||||
init_timer(&led->blink_timer);
|
||||
led->blink_timer.function = led_timer_function;
|
||||
led->blink_timer.data = (unsigned long) led;
|
||||
|
||||
spin_lock_irqsave(&led_lock, flags);
|
||||
list_add(&led->list, &led_timers);
|
||||
spin_unlock_irqrestore(&led_lock, flags);
|
||||
|
||||
return led;
|
||||
}
|
||||
|
||||
void led_blink_set(struct led_classdev *led_cdev,
|
||||
unsigned long *delay_on,
|
||||
unsigned long *delay_off)
|
||||
{
|
||||
struct led_timer *led;
|
||||
int current_brightness;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
|
||||
if (led_cdev->blink_set &&
|
||||
!led_cdev->blink_set(led_cdev, delay_on, delay_off))
|
||||
return;
|
||||
#endif
|
||||
|
||||
led = led_get_timer(led_cdev);
|
||||
if (!led) {
|
||||
led = led_new_timer(led_cdev);
|
||||
if (!led)
|
||||
return;
|
||||
}
|
||||
|
||||
/* blink with 1 Hz as default if nothing specified */
|
||||
if (!*delay_on && !*delay_off)
|
||||
*delay_on = *delay_off = 500;
|
||||
|
||||
if (led->blink_delay_on == *delay_on &&
|
||||
led->blink_delay_off == *delay_off)
|
||||
return;
|
||||
|
||||
current_brightness = led_cdev->brightness;
|
||||
if (current_brightness)
|
||||
led->blink_brightness = current_brightness;
|
||||
if (!led->blink_brightness)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
|
||||
led->blink_brightness = led_cdev->max_brightness;
|
||||
#else
|
||||
led->blink_brightness = LED_FULL;
|
||||
#endif
|
||||
|
||||
led_stop_software_blink(led);
|
||||
led->blink_delay_on = *delay_on;
|
||||
led->blink_delay_off = *delay_off;
|
||||
|
||||
/* never on - don't blink */
|
||||
if (!*delay_on)
|
||||
return;
|
||||
|
||||
/* never off - just set to brightness */
|
||||
if (!*delay_off) {
|
||||
led_brightness_set(led_cdev, led->blink_brightness);
|
||||
return;
|
||||
}
|
||||
|
||||
mod_timer(&led->blink_timer, jiffies + 1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(led_blink_set);
|
||||
|
||||
void compat_led_brightness_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct led_timer *led = led_get_timer(led_cdev);
|
||||
|
||||
if (led)
|
||||
led_stop_software_blink(led);
|
||||
|
||||
return led_cdev->brightness_set(led_cdev, brightness);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_led_brightness_set);
|
||||
|
||||
void compat_led_classdev_unregister(struct led_classdev *led_cdev)
|
||||
{
|
||||
struct led_timer *led = led_get_timer(led_cdev);
|
||||
unsigned long flags;
|
||||
|
||||
if (led) {
|
||||
del_timer_sync(&led->blink_timer);
|
||||
spin_lock_irqsave(&led_lock, flags);
|
||||
list_del(&led->list);
|
||||
spin_unlock_irqrestore(&led_lock, flags);
|
||||
kfree(led);
|
||||
}
|
||||
|
||||
led_classdev_unregister(led_cdev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_led_classdev_unregister);
|
||||
|
||||
/**
|
||||
* vzalloc - allocate virtually contiguous memory with zero fill
|
||||
* @size: allocation size
|
||||
* Allocate enough pages to cover @size from the page level
|
||||
* allocator and map them into contiguous kernel virtual space.
|
||||
* The memory allocated is set to zero.
|
||||
*
|
||||
* For tight control over page level allocator and protection flags
|
||||
* use __vmalloc() instead.
|
||||
*/
|
||||
void *compat_vzalloc(unsigned long size)
|
||||
{
|
||||
void *buf;
|
||||
buf = vmalloc(size);
|
||||
if (buf)
|
||||
memset(buf, 0, size);
|
||||
return buf;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_vzalloc);
|
||||
|
||||
#endif
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.38.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
/**
|
||||
* ewma_init() - Initialize EWMA parameters
|
||||
* @avg: Average structure
|
||||
* @factor: Factor to use for the scaled up internal value. The maximum value
|
||||
* of averages can be ULONG_MAX/(factor*weight).
|
||||
* @weight: Exponential weight, or decay rate. This defines how fast the
|
||||
* influence of older values decreases. Has to be bigger than 1.
|
||||
*
|
||||
* Initialize the EWMA parameters for a given struct ewma @avg.
|
||||
*/
|
||||
void ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight)
|
||||
{
|
||||
WARN_ON(weight <= 1 || factor == 0);
|
||||
avg->internal = 0;
|
||||
avg->weight = weight;
|
||||
avg->factor = factor;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ewma_init);
|
||||
|
||||
/**
|
||||
* ewma_add() - Exponentially weighted moving average (EWMA)
|
||||
* @avg: Average structure
|
||||
* @val: Current value
|
||||
*
|
||||
* Add a sample to the average.
|
||||
*/
|
||||
struct ewma *ewma_add(struct ewma *avg, unsigned long val)
|
||||
{
|
||||
avg->internal = avg->internal ?
|
||||
(((avg->internal * (avg->weight - 1)) +
|
||||
(val * avg->factor)) / avg->weight) :
|
||||
(val * avg->factor);
|
||||
return avg;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ewma_add);
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 2.6.39.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
/*
|
||||
* Termios Helper Methods
|
||||
*/
|
||||
static void unset_locked_termios(struct ktermios *termios,
|
||||
struct ktermios *old,
|
||||
struct ktermios *locked)
|
||||
{
|
||||
int i;
|
||||
|
||||
#define NOSET_MASK(x, y, z) (x = ((x) & ~(z)) | ((y) & (z)))
|
||||
|
||||
if (!locked) {
|
||||
printk(KERN_WARNING "Warning?!? termios_locked is NULL.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
NOSET_MASK(termios->c_iflag, old->c_iflag, locked->c_iflag);
|
||||
NOSET_MASK(termios->c_oflag, old->c_oflag, locked->c_oflag);
|
||||
NOSET_MASK(termios->c_cflag, old->c_cflag, locked->c_cflag);
|
||||
NOSET_MASK(termios->c_lflag, old->c_lflag, locked->c_lflag);
|
||||
termios->c_line = locked->c_line ? old->c_line : termios->c_line;
|
||||
for (i = 0; i < NCCS; i++)
|
||||
termios->c_cc[i] = locked->c_cc[i] ?
|
||||
old->c_cc[i] : termios->c_cc[i];
|
||||
/* FIXME: What should we do for i/ospeed */
|
||||
}
|
||||
|
||||
/**
|
||||
* tty_set_termios - update termios values
|
||||
* @tty: tty to update
|
||||
* @new_termios: desired new value
|
||||
*
|
||||
* Perform updates to the termios values set on this terminal. There
|
||||
* is a bit of layering violation here with n_tty in terms of the
|
||||
* internal knowledge of this function.
|
||||
*
|
||||
* Locking: termios_mutex
|
||||
*/
|
||||
int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
|
||||
{
|
||||
struct ktermios old_termios;
|
||||
struct tty_ldisc *ld;
|
||||
unsigned long flags;
|
||||
|
||||
/*
|
||||
* Perform the actual termios internal changes under lock.
|
||||
*/
|
||||
|
||||
|
||||
/* FIXME: we need to decide on some locking/ordering semantics
|
||||
for the set_termios notification eventually */
|
||||
mutex_lock(&tty->termios_mutex);
|
||||
old_termios = *tty->termios;
|
||||
*tty->termios = *new_termios;
|
||||
unset_locked_termios(tty->termios, &old_termios, tty->termios_locked);
|
||||
|
||||
/* See if packet mode change of state. */
|
||||
if (tty->link && tty->link->packet) {
|
||||
int extproc = (old_termios.c_lflag & EXTPROC) |
|
||||
(tty->termios->c_lflag & EXTPROC);
|
||||
int old_flow = ((old_termios.c_iflag & IXON) &&
|
||||
(old_termios.c_cc[VSTOP] == '\023') &&
|
||||
(old_termios.c_cc[VSTART] == '\021'));
|
||||
int new_flow = (I_IXON(tty) &&
|
||||
STOP_CHAR(tty) == '\023' &&
|
||||
START_CHAR(tty) == '\021');
|
||||
if ((old_flow != new_flow) || extproc) {
|
||||
spin_lock_irqsave(&tty->ctrl_lock, flags);
|
||||
if (old_flow != new_flow) {
|
||||
tty->ctrl_status &= ~(TIOCPKT_DOSTOP | TIOCPKT_NOSTOP);
|
||||
if (new_flow)
|
||||
tty->ctrl_status |= TIOCPKT_DOSTOP;
|
||||
else
|
||||
tty->ctrl_status |= TIOCPKT_NOSTOP;
|
||||
}
|
||||
if (extproc)
|
||||
tty->ctrl_status |= TIOCPKT_IOCTL;
|
||||
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
|
||||
wake_up_interruptible(&tty->link->read_wait);
|
||||
}
|
||||
}
|
||||
|
||||
if (tty->ops->set_termios)
|
||||
(*tty->ops->set_termios)(tty, &old_termios);
|
||||
else
|
||||
tty_termios_copy_hw(tty->termios, &old_termios);
|
||||
|
||||
ld = tty_ldisc_ref(tty);
|
||||
if (ld != NULL) {
|
||||
if (ld->ops->set_termios)
|
||||
(ld->ops->set_termios)(tty, &old_termios);
|
||||
tty_ldisc_deref(ld);
|
||||
}
|
||||
mutex_unlock(&tty->termios_mutex);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tty_set_termios);
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) */
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
* Copyright 2011 Alexey Dobriyan <adobriyan@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 3.0.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
int mac_pton(const char *s, u8 *mac)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* XX:XX:XX:XX:XX:XX */
|
||||
if (strlen(s) < 3 * ETH_ALEN - 1)
|
||||
return 0;
|
||||
|
||||
/* Don't dirty result unless string is valid MAC. */
|
||||
for (i = 0; i < ETH_ALEN; i++) {
|
||||
if (!strchr("0123456789abcdefABCDEF", s[i * 3]))
|
||||
return 0;
|
||||
if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1]))
|
||||
return 0;
|
||||
if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':')
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < ETH_ALEN; i++) {
|
||||
mac[i] = (hex_to_bin(s[i * 3]) << 4) | hex_to_bin(s[i * 3 + 1]);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mac_pton);
|
||||
|
||||
#define kstrto_from_user(f, g, type) \
|
||||
int f(const char __user *s, size_t count, unsigned int base, type *res) \
|
||||
{ \
|
||||
/* sign, base 2 representation, newline, terminator */ \
|
||||
char buf[1 + sizeof(type) * 8 + 1 + 1]; \
|
||||
\
|
||||
count = min(count, sizeof(buf) - 1); \
|
||||
if (copy_from_user(buf, s, count)) \
|
||||
return -EFAULT; \
|
||||
buf[count] = '\0'; \
|
||||
return g(buf, base, res); \
|
||||
} \
|
||||
EXPORT_SYMBOL_GPL(f)
|
||||
|
||||
kstrto_from_user(kstrtoull_from_user, kstrtoull, unsigned long long);
|
||||
kstrto_from_user(kstrtoll_from_user, kstrtoll, long long);
|
||||
kstrto_from_user(kstrtoul_from_user, kstrtoul, unsigned long);
|
||||
kstrto_from_user(kstrtol_from_user, kstrtol, long);
|
||||
kstrto_from_user(kstrtouint_from_user, kstrtouint, unsigned int);
|
||||
kstrto_from_user(kstrtoint_from_user, kstrtoint, int);
|
||||
kstrto_from_user(kstrtou16_from_user, kstrtou16, u16);
|
||||
kstrto_from_user(kstrtos16_from_user, kstrtos16, s16);
|
||||
kstrto_from_user(kstrtou8_from_user, kstrtou8, u8);
|
||||
kstrto_from_user(kstrtos8_from_user, kstrtos8, s8);
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 3.2.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
int __netdev_printk(const char *level, const struct net_device *dev,
|
||||
struct va_format *vaf)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (dev && dev->dev.parent)
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35))
|
||||
r = dev_printk(level, dev->dev.parent, "%s: %pV",
|
||||
netdev_name(dev), vaf);
|
||||
#else
|
||||
/* XXX: this could likely be done better but I'm lazy */
|
||||
r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
|
||||
#endif
|
||||
else if (dev)
|
||||
r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
|
||||
else
|
||||
r = printk("%s(NULL net_device): %pV", level, vaf);
|
||||
|
||||
return r;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__netdev_printk);
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 3.3.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/module.h>
|
||||
#include <net/dst.h>
|
||||
#include <net/xfrm.h>
|
||||
|
||||
static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
|
||||
{
|
||||
new->tstamp = old->tstamp;
|
||||
new->dev = old->dev;
|
||||
new->transport_header = old->transport_header;
|
||||
new->network_header = old->network_header;
|
||||
new->mac_header = old->mac_header;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
|
||||
skb_dst_copy(new, old);
|
||||
new->rxhash = old->rxhash;
|
||||
#else
|
||||
skb_dst_set(new, dst_clone(skb_dst(old)));
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
|
||||
new->ooo_okay = old->ooo_okay;
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
|
||||
new->l4_rxhash = old->l4_rxhash;
|
||||
#endif
|
||||
#ifdef CONFIG_XFRM
|
||||
new->sp = secpath_get(old->sp);
|
||||
#endif
|
||||
memcpy(new->cb, old->cb, sizeof(old->cb));
|
||||
new->csum = old->csum;
|
||||
new->local_df = old->local_df;
|
||||
new->pkt_type = old->pkt_type;
|
||||
new->ip_summed = old->ip_summed;
|
||||
skb_copy_queue_mapping(new, old);
|
||||
new->priority = old->priority;
|
||||
#if IS_ENABLED(CONFIG_IP_VS)
|
||||
new->ipvs_property = old->ipvs_property;
|
||||
#endif
|
||||
new->protocol = old->protocol;
|
||||
new->mark = old->mark;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
|
||||
new->skb_iif = old->skb_iif;
|
||||
#endif
|
||||
__nf_copy(new, old);
|
||||
#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE)
|
||||
new->nf_trace = old->nf_trace;
|
||||
#endif
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
new->tc_index = old->tc_index;
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
new->tc_verd = old->tc_verd;
|
||||
#endif
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
new->vlan_tci = old->vlan_tci;
|
||||
#endif
|
||||
|
||||
skb_copy_secmark(new, old);
|
||||
}
|
||||
|
||||
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
|
||||
{
|
||||
#ifndef NET_SKBUFF_DATA_USES_OFFSET
|
||||
/*
|
||||
* Shift between the two data areas in bytes
|
||||
*/
|
||||
unsigned long offset = new->data - old->data;
|
||||
#endif
|
||||
|
||||
__copy_skb_header(new, old);
|
||||
|
||||
#ifndef NET_SKBUFF_DATA_USES_OFFSET
|
||||
/* {transport,network,mac}_header are relative to skb->head */
|
||||
new->transport_header += offset;
|
||||
new->network_header += offset;
|
||||
if (skb_mac_header_was_set(new))
|
||||
new->mac_header += offset;
|
||||
#endif
|
||||
skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
|
||||
skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
|
||||
skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
|
||||
}
|
||||
|
||||
static void skb_clone_fraglist(struct sk_buff *skb)
|
||||
{
|
||||
struct sk_buff *list;
|
||||
|
||||
skb_walk_frags(skb, list)
|
||||
skb_get(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* __pskb_copy - create copy of an sk_buff with private head.
|
||||
* @skb: buffer to copy
|
||||
* @headroom: headroom of new skb
|
||||
* @gfp_mask: allocation priority
|
||||
*
|
||||
* Make a copy of both an &sk_buff and part of its data, located
|
||||
* in header. Fragmented data remain shared. This is used when
|
||||
* the caller wishes to modify only header of &sk_buff and needs
|
||||
* private copy of the header to alter. Returns %NULL on failure
|
||||
* or the pointer to the buffer on success.
|
||||
* The returned buffer has a reference count of 1.
|
||||
*/
|
||||
|
||||
struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask)
|
||||
{
|
||||
unsigned int size = skb_headlen(skb) + headroom;
|
||||
struct sk_buff *n = alloc_skb(size, gfp_mask);
|
||||
|
||||
if (!n)
|
||||
goto out;
|
||||
|
||||
/* Set the data pointer */
|
||||
skb_reserve(n, headroom);
|
||||
/* Set the tail pointer and length */
|
||||
skb_put(n, skb_headlen(skb));
|
||||
/* Copy the bytes */
|
||||
skb_copy_from_linear_data(skb, n->data, n->len);
|
||||
|
||||
n->truesize += skb->data_len;
|
||||
n->data_len = skb->data_len;
|
||||
n->len = skb->len;
|
||||
|
||||
if (skb_shinfo(skb)->nr_frags) {
|
||||
int i;
|
||||
|
||||
/*
|
||||
* SKBTX_DEV_ZEROCOPY was added on 3.1 as well but requires ubuf
|
||||
* stuff added to the skb which we do not have
|
||||
*/
|
||||
#if 0
|
||||
if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
|
||||
if (skb_copy_ubufs(skb, gfp_mask)) {
|
||||
kfree_skb(n);
|
||||
n = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i];
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
|
||||
skb_frag_ref(skb, i);
|
||||
#else
|
||||
get_page(skb_shinfo(skb)->frags[i].page);
|
||||
#endif
|
||||
}
|
||||
skb_shinfo(n)->nr_frags = i;
|
||||
}
|
||||
|
||||
if (skb_has_frag_list(skb)) {
|
||||
skb_shinfo(n)->frag_list = skb_shinfo(skb)->frag_list;
|
||||
skb_clone_fraglist(n);
|
||||
}
|
||||
|
||||
copy_skb_header(n, skb);
|
||||
out:
|
||||
return n;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__pskb_copy);
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Compatibility file for Linux wireless for kernels 3.5.
|
||||
*/
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
int simple_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
if (inode->i_private)
|
||||
file->private_data = inode->i_private;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(simple_open);
|
||||
@@ -1,33 +0,0 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && (defined(CONFIG_UML) || defined(CONFIG_X86))) && !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) && defined(CONFIG_ARM) && !defined(CONFIG_GENERIC_ATOMIC64))
|
||||
|
||||
static DEFINE_SPINLOCK(lock);
|
||||
|
||||
long long atomic64_read(const atomic64_t *v)
|
||||
{
|
||||
unsigned long flags;
|
||||
long long val;
|
||||
|
||||
spin_lock_irqsave(&lock, flags);
|
||||
val = v->counter;
|
||||
spin_unlock_irqrestore(&lock, flags);
|
||||
return val;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(atomic64_read);
|
||||
|
||||
long long atomic64_add_return(long long a, atomic64_t *v)
|
||||
{
|
||||
unsigned long flags;
|
||||
long long val;
|
||||
|
||||
spin_lock_irqsave(&lock, flags);
|
||||
val = v->counter += a;
|
||||
spin_unlock_irqrestore(&lock, flags);
|
||||
return val;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(atomic64_add_return);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,759 +0,0 @@
|
||||
/*
|
||||
* firmware_class.c - Multi purpose firmware loading support
|
||||
*
|
||||
* Copyright (c) 2003 Manuel Estrada Sainz
|
||||
*
|
||||
* Please see Documentation/firmware_class/ for more information.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define compat_firmware_to_dev(obj) container_of(obj, struct device, kobj)
|
||||
|
||||
MODULE_AUTHOR("Manuel Estrada Sainz");
|
||||
MODULE_DESCRIPTION("Multi purpose firmware loading support");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
/* Builtin firmware support */
|
||||
|
||||
//#ifdef CONFIG_FW_LOADER
|
||||
#if 0
|
||||
|
||||
extern struct builtin_fw __start_builtin_fw[];
|
||||
extern struct builtin_fw __end_builtin_fw[];
|
||||
|
||||
static bool fw_get_builtin_firmware(struct firmware *fw, const char *name)
|
||||
{
|
||||
struct builtin_fw *b_fw;
|
||||
|
||||
for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
|
||||
if (strcmp(name, b_fw->name) == 0) {
|
||||
fw->size = b_fw->size;
|
||||
fw->data = b_fw->data;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool fw_is_builtin_firmware(const struct firmware *fw)
|
||||
{
|
||||
struct builtin_fw *b_fw;
|
||||
|
||||
for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++)
|
||||
if (fw->data == b_fw->data)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#else /* Module case - no builtin firmware support */
|
||||
|
||||
static inline bool fw_get_builtin_firmware(struct firmware *fw, const char *name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool fw_is_builtin_firmware(const struct firmware *fw)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
enum {
|
||||
FW_STATUS_LOADING,
|
||||
FW_STATUS_DONE,
|
||||
FW_STATUS_ABORT,
|
||||
};
|
||||
|
||||
static int loading_timeout = 60; /* In seconds */
|
||||
|
||||
/* fw_lock could be moved to 'struct firmware_priv' but since it is just
|
||||
* guarding for corner cases a global lock should be OK */
|
||||
static DEFINE_MUTEX(fw_lock);
|
||||
|
||||
struct firmware_priv {
|
||||
struct completion completion;
|
||||
struct firmware *fw;
|
||||
unsigned long status;
|
||||
struct page **pages;
|
||||
int nr_pages;
|
||||
int page_array_size;
|
||||
struct timer_list timeout;
|
||||
struct device dev;
|
||||
bool nowait;
|
||||
char fw_id[];
|
||||
};
|
||||
|
||||
static struct firmware_priv *to_firmware_priv(struct device *dev)
|
||||
{
|
||||
return container_of(dev, struct firmware_priv, dev);
|
||||
}
|
||||
|
||||
static void fw_load_abort(struct firmware_priv *fw_priv)
|
||||
{
|
||||
set_bit(FW_STATUS_ABORT, &fw_priv->status);
|
||||
wmb();
|
||||
complete(&fw_priv->completion);
|
||||
}
|
||||
|
||||
static ssize_t firmware_timeout_show(struct class *class,
|
||||
char *buf)
|
||||
{
|
||||
return sprintf(buf, "%d\n", loading_timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* firmware_timeout_store - set number of seconds to wait for firmware
|
||||
* @class: device class pointer
|
||||
* @buf: buffer to scan for timeout value
|
||||
* @count: number of bytes in @buf
|
||||
*
|
||||
* Sets the number of seconds to wait for the firmware. Once
|
||||
* this expires an error will be returned to the driver and no
|
||||
* firmware will be provided.
|
||||
*
|
||||
* Note: zero means 'wait forever'.
|
||||
**/
|
||||
static ssize_t firmware_timeout_store(struct class *class,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
loading_timeout = simple_strtol(buf, NULL, 10);
|
||||
if (loading_timeout < 0)
|
||||
loading_timeout = 0;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct class_attribute firmware_class_attrs[] = {
|
||||
__ATTR(timeout, S_IWUSR | S_IRUGO,
|
||||
firmware_timeout_show, firmware_timeout_store),
|
||||
__ATTR_NULL
|
||||
};
|
||||
|
||||
static void fw_dev_release(struct device *dev)
|
||||
{
|
||||
struct firmware_priv *fw_priv = to_firmware_priv(dev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fw_priv->nr_pages; i++)
|
||||
__free_page(fw_priv->pages[i]);
|
||||
kfree(fw_priv->pages);
|
||||
kfree(fw_priv);
|
||||
|
||||
module_put(THIS_MODULE);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
struct firmware_priv *fw_priv = to_firmware_priv(dev);
|
||||
|
||||
if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->fw_id))
|
||||
return -ENOMEM;
|
||||
if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout))
|
||||
return -ENOMEM;
|
||||
if (add_uevent_var(env, "ASYNC=%d", fw_priv->nowait))
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int firmware_uevent(struct device *dev, char **envp,
|
||||
int num_envp, char *buf, int size)
|
||||
{
|
||||
struct firmware_priv *fw_priv = to_firmware_priv(dev);
|
||||
int error, len = 0, i = 0;
|
||||
|
||||
error = add_uevent_var(envp, num_envp, &i,
|
||||
buf, size, &len,
|
||||
"FIRMWARE=%s", fw_priv->fw_id);
|
||||
if (error)
|
||||
goto exit;
|
||||
|
||||
error = add_uevent_var(envp, num_envp, &i,
|
||||
buf, size, &len,
|
||||
"TIMEOUT=%i", loading_timeout);
|
||||
if (error)
|
||||
goto exit;
|
||||
error = add_uevent_var(envp, num_envp, &i,
|
||||
buf, size, &len,
|
||||
"ASYNC=%i", fw_priv->nowait);
|
||||
if (error)
|
||||
goto exit;
|
||||
|
||||
return 0;
|
||||
exit:
|
||||
envp[i] = NULL;
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct class firmware_class = {
|
||||
.name = "compat_firmware",
|
||||
.class_attrs = firmware_class_attrs,
|
||||
.dev_uevent = firmware_uevent,
|
||||
.dev_release = fw_dev_release,
|
||||
};
|
||||
|
||||
static ssize_t firmware_loading_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct firmware_priv *fw_priv = to_firmware_priv(dev);
|
||||
int loading = test_bit(FW_STATUS_LOADING, &fw_priv->status);
|
||||
|
||||
return sprintf(buf, "%d\n", loading);
|
||||
}
|
||||
|
||||
static void firmware_free_data(const struct firmware *fw)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
|
||||
int i;
|
||||
vunmap(fw->data);
|
||||
if (fw->pages) {
|
||||
for (i = 0; i < PFN_UP(fw->size); i++)
|
||||
__free_page(fw->pages[i]);
|
||||
kfree(fw->pages);
|
||||
}
|
||||
#else
|
||||
vunmap(fw->data);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Some architectures don't have PAGE_KERNEL_RO */
|
||||
#ifndef PAGE_KERNEL_RO
|
||||
#define PAGE_KERNEL_RO PAGE_KERNEL
|
||||
#endif
|
||||
/**
|
||||
* firmware_loading_store - set value in the 'loading' control file
|
||||
* @dev: device pointer
|
||||
* @buf: buffer to scan for loading control value
|
||||
* @count: number of bytes in @buf
|
||||
*
|
||||
* The relevant values are:
|
||||
*
|
||||
* 1: Start a load, discarding any previous partial load.
|
||||
* 0: Conclude the load and hand the data to the driver code.
|
||||
* -1: Conclude the load with an error and discard any written data.
|
||||
**/
|
||||
static ssize_t firmware_loading_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct firmware_priv *fw_priv = to_firmware_priv(dev);
|
||||
int loading = simple_strtol(buf, NULL, 10);
|
||||
int i;
|
||||
|
||||
switch (loading) {
|
||||
case 1:
|
||||
mutex_lock(&fw_lock);
|
||||
if (!fw_priv->fw) {
|
||||
mutex_unlock(&fw_lock);
|
||||
break;
|
||||
}
|
||||
firmware_free_data(fw_priv->fw);
|
||||
memset(fw_priv->fw, 0, sizeof(struct firmware));
|
||||
/* If the pages are not owned by 'struct firmware' */
|
||||
for (i = 0; i < fw_priv->nr_pages; i++)
|
||||
__free_page(fw_priv->pages[i]);
|
||||
kfree(fw_priv->pages);
|
||||
fw_priv->pages = NULL;
|
||||
fw_priv->page_array_size = 0;
|
||||
fw_priv->nr_pages = 0;
|
||||
set_bit(FW_STATUS_LOADING, &fw_priv->status);
|
||||
mutex_unlock(&fw_lock);
|
||||
break;
|
||||
case 0:
|
||||
if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
|
||||
vunmap(fw_priv->fw->data);
|
||||
fw_priv->fw->data = vmap(fw_priv->pages,
|
||||
fw_priv->nr_pages,
|
||||
0, PAGE_KERNEL_RO);
|
||||
if (!fw_priv->fw->data) {
|
||||
dev_err(dev, "%s: vmap() failed\n", __func__);
|
||||
goto err;
|
||||
}
|
||||
/* Pages are now owned by 'struct firmware' */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
|
||||
fw_priv->fw->pages = fw_priv->pages;
|
||||
fw_priv->pages = NULL;
|
||||
#endif
|
||||
|
||||
fw_priv->page_array_size = 0;
|
||||
fw_priv->nr_pages = 0;
|
||||
complete(&fw_priv->completion);
|
||||
clear_bit(FW_STATUS_LOADING, &fw_priv->status);
|
||||
break;
|
||||
}
|
||||
/* fallthrough */
|
||||
default:
|
||||
dev_err(dev, "%s: unexpected value (%d)\n", __func__, loading);
|
||||
/* fallthrough */
|
||||
case -1:
|
||||
err:
|
||||
fw_load_abort(fw_priv);
|
||||
break;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);
|
||||
|
||||
#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP)
|
||||
static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
char *buffer, loff_t offset, size_t count)
|
||||
#else
|
||||
static ssize_t firmware_data_read(struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
char *buffer, loff_t offset, size_t count)
|
||||
#endif
|
||||
{
|
||||
struct device *dev = compat_firmware_to_dev(kobj);
|
||||
struct firmware_priv *fw_priv = to_firmware_priv(dev);
|
||||
struct firmware *fw;
|
||||
ssize_t ret_count;
|
||||
|
||||
mutex_lock(&fw_lock);
|
||||
fw = fw_priv->fw;
|
||||
if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
|
||||
ret_count = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
if (offset > fw->size) {
|
||||
ret_count = 0;
|
||||
goto out;
|
||||
}
|
||||
if (count > fw->size - offset)
|
||||
count = fw->size - offset;
|
||||
|
||||
ret_count = count;
|
||||
|
||||
while (count) {
|
||||
void *page_data;
|
||||
int page_nr = offset >> PAGE_SHIFT;
|
||||
int page_ofs = offset & (PAGE_SIZE-1);
|
||||
int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
|
||||
|
||||
page_data = kmap(fw_priv->pages[page_nr]);
|
||||
|
||||
memcpy(buffer, page_data + page_ofs, page_cnt);
|
||||
|
||||
kunmap(fw_priv->pages[page_nr]);
|
||||
buffer += page_cnt;
|
||||
offset += page_cnt;
|
||||
count -= page_cnt;
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&fw_lock);
|
||||
return ret_count;
|
||||
}
|
||||
|
||||
static int fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
|
||||
{
|
||||
int pages_needed = ALIGN(min_size, PAGE_SIZE) >> PAGE_SHIFT;
|
||||
|
||||
/* If the array of pages is too small, grow it... */
|
||||
if (fw_priv->page_array_size < pages_needed) {
|
||||
int new_array_size = max(pages_needed,
|
||||
fw_priv->page_array_size * 2);
|
||||
struct page **new_pages;
|
||||
|
||||
new_pages = kmalloc(new_array_size * sizeof(void *),
|
||||
GFP_KERNEL);
|
||||
if (!new_pages) {
|
||||
fw_load_abort(fw_priv);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(new_pages, fw_priv->pages,
|
||||
fw_priv->page_array_size * sizeof(void *));
|
||||
memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) *
|
||||
(new_array_size - fw_priv->page_array_size));
|
||||
kfree(fw_priv->pages);
|
||||
fw_priv->pages = new_pages;
|
||||
fw_priv->page_array_size = new_array_size;
|
||||
}
|
||||
|
||||
while (fw_priv->nr_pages < pages_needed) {
|
||||
fw_priv->pages[fw_priv->nr_pages] =
|
||||
alloc_page(GFP_KERNEL | __GFP_HIGHMEM);
|
||||
|
||||
if (!fw_priv->pages[fw_priv->nr_pages]) {
|
||||
fw_load_abort(fw_priv);
|
||||
return -ENOMEM;
|
||||
}
|
||||
fw_priv->nr_pages++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* firmware_data_write - write method for firmware
|
||||
* @kobj: kobject for the device
|
||||
* @bin_attr: bin_attr structure
|
||||
* @buffer: buffer being written
|
||||
* @offset: buffer offset for write in total data store area
|
||||
* @count: buffer size
|
||||
*
|
||||
* Data written to the 'data' attribute will be later handed to
|
||||
* the driver as a firmware image.
|
||||
**/
|
||||
#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP)
|
||||
static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
char *buffer, loff_t offset, size_t count)
|
||||
#else
|
||||
static ssize_t firmware_data_write(struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
char *buffer, loff_t offset, size_t count)
|
||||
#endif
|
||||
{
|
||||
struct device *dev = compat_firmware_to_dev(kobj);
|
||||
struct firmware_priv *fw_priv = to_firmware_priv(dev);
|
||||
struct firmware *fw;
|
||||
ssize_t retval;
|
||||
|
||||
if (!capable(CAP_SYS_RAWIO))
|
||||
return -EPERM;
|
||||
|
||||
mutex_lock(&fw_lock);
|
||||
fw = fw_priv->fw;
|
||||
if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
|
||||
retval = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
retval = fw_realloc_buffer(fw_priv, offset + count);
|
||||
if (retval)
|
||||
goto out;
|
||||
|
||||
retval = count;
|
||||
|
||||
while (count) {
|
||||
void *page_data;
|
||||
int page_nr = offset >> PAGE_SHIFT;
|
||||
int page_ofs = offset & (PAGE_SIZE - 1);
|
||||
int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
|
||||
|
||||
page_data = kmap(fw_priv->pages[page_nr]);
|
||||
|
||||
memcpy(page_data + page_ofs, buffer, page_cnt);
|
||||
|
||||
kunmap(fw_priv->pages[page_nr]);
|
||||
buffer += page_cnt;
|
||||
offset += page_cnt;
|
||||
count -= page_cnt;
|
||||
}
|
||||
|
||||
fw->size = max_t(size_t, offset, fw->size);
|
||||
out:
|
||||
mutex_unlock(&fw_lock);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static struct bin_attribute firmware_attr_data = {
|
||||
.attr = { .name = "data", .mode = 0644 },
|
||||
.size = 0,
|
||||
.read = firmware_data_read,
|
||||
.write = firmware_data_write,
|
||||
};
|
||||
|
||||
static void firmware_class_timeout(u_long data)
|
||||
{
|
||||
struct firmware_priv *fw_priv = (struct firmware_priv *) data;
|
||||
|
||||
fw_load_abort(fw_priv);
|
||||
}
|
||||
|
||||
static struct firmware_priv *
|
||||
fw_create_instance(struct firmware *firmware, const char *fw_name,
|
||||
struct device *device, bool uevent, bool nowait)
|
||||
{
|
||||
struct firmware_priv *fw_priv;
|
||||
struct device *f_dev;
|
||||
int error;
|
||||
|
||||
fw_priv = kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL);
|
||||
if (!fw_priv) {
|
||||
dev_err(device, "%s: kmalloc failed\n", __func__);
|
||||
error = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
fw_priv->fw = firmware;
|
||||
fw_priv->nowait = nowait;
|
||||
strcpy(fw_priv->fw_id, fw_name);
|
||||
init_completion(&fw_priv->completion);
|
||||
setup_timer(&fw_priv->timeout,
|
||||
firmware_class_timeout, (u_long) fw_priv);
|
||||
|
||||
f_dev = &fw_priv->dev;
|
||||
|
||||
device_initialize(f_dev);
|
||||
dev_set_name(f_dev, "%s", dev_name(device));
|
||||
f_dev->parent = device;
|
||||
f_dev->class = &firmware_class;
|
||||
|
||||
dev_set_uevent_suppress(f_dev, true);
|
||||
|
||||
/* Need to pin this module until class device is destroyed */
|
||||
__module_get(THIS_MODULE);
|
||||
|
||||
error = device_add(f_dev);
|
||||
if (error) {
|
||||
dev_err(device, "%s: device_register failed\n", __func__);
|
||||
goto err_put_dev;
|
||||
}
|
||||
|
||||
error = device_create_bin_file(f_dev, &firmware_attr_data);
|
||||
if (error) {
|
||||
dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__);
|
||||
goto err_del_dev;
|
||||
}
|
||||
|
||||
error = device_create_file(f_dev, &dev_attr_loading);
|
||||
if (error) {
|
||||
dev_err(device, "%s: device_create_file failed\n", __func__);
|
||||
goto err_del_bin_attr;
|
||||
}
|
||||
|
||||
if (uevent)
|
||||
dev_set_uevent_suppress(f_dev, false);
|
||||
|
||||
return fw_priv;
|
||||
|
||||
err_del_bin_attr:
|
||||
device_remove_bin_file(f_dev, &firmware_attr_data);
|
||||
err_del_dev:
|
||||
device_del(f_dev);
|
||||
err_put_dev:
|
||||
put_device(f_dev);
|
||||
err_out:
|
||||
return ERR_PTR(error);
|
||||
}
|
||||
|
||||
static void fw_destroy_instance(struct firmware_priv *fw_priv)
|
||||
{
|
||||
struct device *f_dev = &fw_priv->dev;
|
||||
|
||||
device_remove_file(f_dev, &dev_attr_loading);
|
||||
device_remove_bin_file(f_dev, &firmware_attr_data);
|
||||
device_unregister(f_dev);
|
||||
}
|
||||
|
||||
static int _request_firmware(const struct firmware **firmware_p,
|
||||
const char *name, struct device *device,
|
||||
bool uevent, bool nowait)
|
||||
{
|
||||
struct firmware_priv *fw_priv;
|
||||
struct firmware *firmware;
|
||||
int retval = 0;
|
||||
|
||||
if (!firmware_p)
|
||||
return -EINVAL;
|
||||
|
||||
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
|
||||
if (!firmware) {
|
||||
dev_err(device, "%s: kmalloc(struct firmware) failed\n",
|
||||
__func__);
|
||||
retval = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fw_get_builtin_firmware(firmware, name)) {
|
||||
dev_dbg(device, "firmware: using built-in firmware %s\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (uevent)
|
||||
dev_dbg(device, "firmware: requesting %s\n", name);
|
||||
|
||||
fw_priv = fw_create_instance(firmware, name, device, uevent, nowait);
|
||||
if (IS_ERR(fw_priv)) {
|
||||
retval = PTR_ERR(fw_priv);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (uevent) {
|
||||
if (loading_timeout > 0)
|
||||
mod_timer(&fw_priv->timeout,
|
||||
round_jiffies_up(jiffies +
|
||||
loading_timeout * HZ));
|
||||
|
||||
kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
|
||||
}
|
||||
|
||||
wait_for_completion(&fw_priv->completion);
|
||||
|
||||
set_bit(FW_STATUS_DONE, &fw_priv->status);
|
||||
del_timer_sync(&fw_priv->timeout);
|
||||
|
||||
mutex_lock(&fw_lock);
|
||||
if (!fw_priv->fw->size || test_bit(FW_STATUS_ABORT, &fw_priv->status))
|
||||
retval = -ENOENT;
|
||||
fw_priv->fw = NULL;
|
||||
mutex_unlock(&fw_lock);
|
||||
|
||||
fw_destroy_instance(fw_priv);
|
||||
|
||||
out:
|
||||
if (retval) {
|
||||
release_firmware(firmware);
|
||||
*firmware_p = NULL;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* request_firmware: - send firmware request and wait for it
|
||||
* @firmware_p: pointer to firmware image
|
||||
* @name: name of firmware file
|
||||
* @device: device for which firmware is being loaded
|
||||
*
|
||||
* @firmware_p will be used to return a firmware image by the name
|
||||
* of @name for device @device.
|
||||
*
|
||||
* Should be called from user context where sleeping is allowed.
|
||||
*
|
||||
* @name will be used as $FIRMWARE in the uevent environment and
|
||||
* should be distinctive enough not to be confused with any other
|
||||
* firmware image for this or any other device.
|
||||
**/
|
||||
int
|
||||
compat_request_firmware(const struct firmware **firmware_p, const char *name,
|
||||
struct device *device)
|
||||
{
|
||||
int uevent = 1;
|
||||
return _request_firmware(firmware_p, name, device, uevent, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* release_firmware: - release the resource associated with a firmware image
|
||||
* @fw: firmware resource to release
|
||||
**/
|
||||
void compat_release_firmware(const struct firmware *fw)
|
||||
{
|
||||
if (fw) {
|
||||
if (!fw_is_builtin_firmware(fw))
|
||||
firmware_free_data(fw);
|
||||
kfree(fw);
|
||||
}
|
||||
}
|
||||
|
||||
/* Async support */
|
||||
struct firmware_work {
|
||||
struct work_struct work;
|
||||
struct module *module;
|
||||
const char *name;
|
||||
struct device *device;
|
||||
void *context;
|
||||
void (*cont)(const struct firmware *fw, void *context);
|
||||
int uevent;
|
||||
};
|
||||
|
||||
static int request_firmware_work_func(void *arg)
|
||||
{
|
||||
struct firmware_work *fw_work = arg;
|
||||
const struct firmware *fw;
|
||||
int ret;
|
||||
|
||||
if (!arg) {
|
||||
WARN_ON(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = _request_firmware(&fw, fw_work->name, fw_work->device,
|
||||
fw_work->uevent, true);
|
||||
fw_work->cont(fw, fw_work->context);
|
||||
|
||||
module_put(fw_work->module);
|
||||
kfree(fw_work);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* request_firmware_nowait - asynchronous version of request_firmware
|
||||
* @module: module requesting the firmware
|
||||
* @uevent: sends uevent to copy the firmware image if this flag
|
||||
* is non-zero else the firmware copy must be done manually.
|
||||
* @name: name of firmware file
|
||||
* @device: device for which firmware is being loaded
|
||||
* @gfp: allocation flags
|
||||
* @context: will be passed over to @cont, and
|
||||
* @fw may be %NULL if firmware request fails.
|
||||
* @cont: function will be called asynchronously when the firmware
|
||||
* request is over.
|
||||
*
|
||||
* Asynchronous variant of request_firmware() for user contexts where
|
||||
* it is not possible to sleep for long time. It can't be called
|
||||
* in atomic contexts.
|
||||
**/
|
||||
int
|
||||
compat_request_firmware_nowait(
|
||||
struct module *module, int uevent,
|
||||
const char *name, struct device *device, gfp_t gfp, void *context,
|
||||
void (*cont)(const struct firmware *fw, void *context))
|
||||
{
|
||||
struct task_struct *task;
|
||||
struct firmware_work *fw_work;
|
||||
|
||||
fw_work = kzalloc(sizeof (struct firmware_work), gfp);
|
||||
if (!fw_work)
|
||||
return -ENOMEM;
|
||||
|
||||
fw_work->module = module;
|
||||
fw_work->name = name;
|
||||
fw_work->device = device;
|
||||
fw_work->context = context;
|
||||
fw_work->cont = cont;
|
||||
fw_work->uevent = uevent;
|
||||
|
||||
if (!try_module_get(module)) {
|
||||
kfree(fw_work);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
task = kthread_run(request_firmware_work_func, fw_work,
|
||||
"firmware/%s", name);
|
||||
if (IS_ERR(task)) {
|
||||
fw_work->cont(NULL, fw_work->context);
|
||||
module_put(fw_work->module);
|
||||
kfree(fw_work);
|
||||
return PTR_ERR(task);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init firmware_class_init(void)
|
||||
{
|
||||
return class_register(&firmware_class);
|
||||
}
|
||||
|
||||
static void __exit firmware_class_exit(void)
|
||||
{
|
||||
class_unregister(&firmware_class);
|
||||
}
|
||||
|
||||
fs_initcall(firmware_class_init);
|
||||
module_exit(firmware_class_exit);
|
||||
|
||||
EXPORT_SYMBOL_GPL(release_firmware);
|
||||
EXPORT_SYMBOL_GPL(request_firmware);
|
||||
EXPORT_SYMBOL_GPL(request_firmware_nowait);
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Broadcom Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/cordic.h>
|
||||
|
||||
#define CORDIC_ANGLE_GEN 39797
|
||||
#define CORDIC_PRECISION_SHIFT 16
|
||||
#define CORDIC_NUM_ITER (CORDIC_PRECISION_SHIFT + 2)
|
||||
|
||||
#define FIXED(X) ((s32)((X) << CORDIC_PRECISION_SHIFT))
|
||||
#define FLOAT(X) (((X) >= 0) \
|
||||
? ((((X) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1) \
|
||||
: -((((-(X)) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1))
|
||||
|
||||
static const s32 arctan_table[] = {
|
||||
2949120,
|
||||
1740967,
|
||||
919879,
|
||||
466945,
|
||||
234379,
|
||||
117304,
|
||||
58666,
|
||||
29335,
|
||||
14668,
|
||||
7334,
|
||||
3667,
|
||||
1833,
|
||||
917,
|
||||
458,
|
||||
229,
|
||||
115,
|
||||
57,
|
||||
29
|
||||
};
|
||||
|
||||
/*
|
||||
* cordic_calc_iq() - calculates the i/q coordinate for given angle
|
||||
*
|
||||
* theta: angle in degrees for which i/q coordinate is to be calculated
|
||||
* coord: function output parameter holding the i/q coordinate
|
||||
*/
|
||||
struct cordic_iq cordic_calc_iq(s32 theta)
|
||||
{
|
||||
struct cordic_iq coord;
|
||||
s32 angle, valtmp;
|
||||
unsigned iter;
|
||||
int signx = 1;
|
||||
int signtheta;
|
||||
|
||||
coord.i = CORDIC_ANGLE_GEN;
|
||||
coord.q = 0;
|
||||
angle = 0;
|
||||
|
||||
theta = FIXED(theta);
|
||||
signtheta = (theta < 0) ? -1 : 1;
|
||||
theta = ((theta + FIXED(180) * signtheta) % FIXED(360)) -
|
||||
FIXED(180) * signtheta;
|
||||
|
||||
if (FLOAT(theta) > 90) {
|
||||
theta -= FIXED(180);
|
||||
signx = -1;
|
||||
} else if (FLOAT(theta) < -90) {
|
||||
theta += FIXED(180);
|
||||
signx = -1;
|
||||
}
|
||||
|
||||
for (iter = 0; iter < CORDIC_NUM_ITER; iter++) {
|
||||
if (theta > angle) {
|
||||
valtmp = coord.i - (coord.q >> iter);
|
||||
coord.q += (coord.i >> iter);
|
||||
angle += arctan_table[iter];
|
||||
} else {
|
||||
valtmp = coord.i + (coord.q >> iter);
|
||||
coord.q -= (coord.i >> iter);
|
||||
angle -= arctan_table[iter];
|
||||
}
|
||||
coord.i = valtmp;
|
||||
}
|
||||
|
||||
coord.i *= signx;
|
||||
coord.q *= signx;
|
||||
return coord;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cordic_calc_iq);
|
||||
|
||||
MODULE_DESCRIPTION("Cordic functions");
|
||||
MODULE_AUTHOR("Broadcom Corporation");
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Broadcom Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/crc8.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
/*
|
||||
* crc8_populate_msb - fill crc table for given polynomial in reverse bit order.
|
||||
*
|
||||
* table: table to be filled.
|
||||
* polynomial: polynomial for which table is to be filled.
|
||||
*/
|
||||
void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
||||
{
|
||||
int i, j;
|
||||
const u8 msbit = 0x80;
|
||||
u8 t = msbit;
|
||||
|
||||
table[0] = 0;
|
||||
|
||||
for (i = 1; i < CRC8_TABLE_SIZE; i *= 2) {
|
||||
t = (t << 1) ^ (t & msbit ? polynomial : 0);
|
||||
for (j = 0; j < i; j++)
|
||||
table[i+j] = table[j] ^ t;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crc8_populate_msb);
|
||||
|
||||
/*
|
||||
* crc8_populate_lsb - fill crc table for given polynomial in regular bit order.
|
||||
*
|
||||
* table: table to be filled.
|
||||
* polynomial: polynomial for which table is to be filled.
|
||||
*/
|
||||
void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
||||
{
|
||||
int i, j;
|
||||
u8 t = 1;
|
||||
|
||||
table[0] = 0;
|
||||
|
||||
for (i = (CRC8_TABLE_SIZE >> 1); i; i >>= 1) {
|
||||
t = (t >> 1) ^ (t & 1 ? polynomial : 0);
|
||||
for (j = 0; j < CRC8_TABLE_SIZE; j += 2*i)
|
||||
table[i+j] = table[j] ^ t;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crc8_populate_lsb);
|
||||
|
||||
/*
|
||||
* crc8 - calculate a crc8 over the given input data.
|
||||
*
|
||||
* table: crc table used for calculation.
|
||||
* pdata: pointer to data buffer.
|
||||
* nbytes: number of bytes in data buffer.
|
||||
* crc: previous returned crc8 value.
|
||||
*/
|
||||
u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc)
|
||||
{
|
||||
/* loop over the buffer data */
|
||||
while (nbytes-- > 0)
|
||||
crc = table[(crc ^ *pdata++) & 0xff];
|
||||
|
||||
return crc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crc8);
|
||||
|
||||
MODULE_DESCRIPTION("CRC8 (by Williams, Ross N.) function");
|
||||
MODULE_AUTHOR("Broadcom Corporation");
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
@@ -1,608 +0,0 @@
|
||||
/*
|
||||
* A generic kernel FIFO implementation
|
||||
*
|
||||
* Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/kfifo.h>
|
||||
|
||||
/*
|
||||
* internal helper to calculate the unused elements in a fifo
|
||||
*/
|
||||
static inline unsigned int kfifo_unused(struct __kfifo *fifo)
|
||||
{
|
||||
return (fifo->mask + 1) - (fifo->in - fifo->out);
|
||||
}
|
||||
|
||||
int __kfifo_alloc(struct __kfifo *fifo, unsigned int size,
|
||||
size_t esize, gfp_t gfp_mask)
|
||||
{
|
||||
/*
|
||||
* round down to the next power of 2, since our 'let the indices
|
||||
* wrap' technique works only in this case.
|
||||
*/
|
||||
if (!is_power_of_2(size))
|
||||
size = rounddown_pow_of_two(size);
|
||||
|
||||
fifo->in = 0;
|
||||
fifo->out = 0;
|
||||
fifo->esize = esize;
|
||||
|
||||
if (size < 2) {
|
||||
fifo->data = NULL;
|
||||
fifo->mask = 0;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fifo->data = kmalloc(size * esize, gfp_mask);
|
||||
|
||||
if (!fifo->data) {
|
||||
fifo->mask = 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
fifo->mask = size - 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_alloc);
|
||||
|
||||
void __kfifo_free(struct __kfifo *fifo)
|
||||
{
|
||||
kfree(fifo->data);
|
||||
fifo->in = 0;
|
||||
fifo->out = 0;
|
||||
fifo->esize = 0;
|
||||
fifo->data = NULL;
|
||||
fifo->mask = 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_free);
|
||||
|
||||
int __kfifo_init(struct __kfifo *fifo, void *buffer,
|
||||
unsigned int size, size_t esize)
|
||||
{
|
||||
size /= esize;
|
||||
|
||||
if (!is_power_of_2(size))
|
||||
size = rounddown_pow_of_two(size);
|
||||
|
||||
fifo->in = 0;
|
||||
fifo->out = 0;
|
||||
fifo->esize = esize;
|
||||
fifo->data = buffer;
|
||||
|
||||
if (size < 2) {
|
||||
fifo->mask = 0;
|
||||
return -EINVAL;
|
||||
}
|
||||
fifo->mask = size - 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_init);
|
||||
|
||||
static void kfifo_copy_in(struct __kfifo *fifo, const void *src,
|
||||
unsigned int len, unsigned int off)
|
||||
{
|
||||
unsigned int size = fifo->mask + 1;
|
||||
unsigned int esize = fifo->esize;
|
||||
unsigned int l;
|
||||
|
||||
off &= fifo->mask;
|
||||
if (esize != 1) {
|
||||
off *= esize;
|
||||
size *= esize;
|
||||
len *= esize;
|
||||
}
|
||||
l = min(len, size - off);
|
||||
|
||||
memcpy(fifo->data + off, src, l);
|
||||
memcpy(fifo->data, src + l, len - l);
|
||||
/*
|
||||
* make sure that the data in the fifo is up to date before
|
||||
* incrementing the fifo->in index counter
|
||||
*/
|
||||
smp_wmb();
|
||||
}
|
||||
|
||||
unsigned int __kfifo_in(struct __kfifo *fifo,
|
||||
const void *buf, unsigned int len)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
l = kfifo_unused(fifo);
|
||||
if (len > l)
|
||||
len = l;
|
||||
|
||||
kfifo_copy_in(fifo, buf, len, fifo->in);
|
||||
fifo->in += len;
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_in);
|
||||
|
||||
static void kfifo_copy_out(struct __kfifo *fifo, void *dst,
|
||||
unsigned int len, unsigned int off)
|
||||
{
|
||||
unsigned int size = fifo->mask + 1;
|
||||
unsigned int esize = fifo->esize;
|
||||
unsigned int l;
|
||||
|
||||
off &= fifo->mask;
|
||||
if (esize != 1) {
|
||||
off *= esize;
|
||||
size *= esize;
|
||||
len *= esize;
|
||||
}
|
||||
l = min(len, size - off);
|
||||
|
||||
memcpy(dst, fifo->data + off, l);
|
||||
memcpy(dst + l, fifo->data, len - l);
|
||||
/*
|
||||
* make sure that the data is copied before
|
||||
* incrementing the fifo->out index counter
|
||||
*/
|
||||
smp_wmb();
|
||||
}
|
||||
|
||||
unsigned int __kfifo_out_peek(struct __kfifo *fifo,
|
||||
void *buf, unsigned int len)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
l = fifo->in - fifo->out;
|
||||
if (len > l)
|
||||
len = l;
|
||||
|
||||
kfifo_copy_out(fifo, buf, len, fifo->out);
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_out_peek);
|
||||
|
||||
unsigned int __kfifo_out(struct __kfifo *fifo,
|
||||
void *buf, unsigned int len)
|
||||
{
|
||||
len = __kfifo_out_peek(fifo, buf, len);
|
||||
fifo->out += len;
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_out);
|
||||
|
||||
static unsigned long kfifo_copy_from_user(struct __kfifo *fifo,
|
||||
const void __user *from, unsigned int len, unsigned int off,
|
||||
unsigned int *copied)
|
||||
{
|
||||
unsigned int size = fifo->mask + 1;
|
||||
unsigned int esize = fifo->esize;
|
||||
unsigned int l;
|
||||
unsigned long ret;
|
||||
|
||||
off &= fifo->mask;
|
||||
if (esize != 1) {
|
||||
off *= esize;
|
||||
size *= esize;
|
||||
len *= esize;
|
||||
}
|
||||
l = min(len, size - off);
|
||||
|
||||
ret = copy_from_user(fifo->data + off, from, l);
|
||||
if (unlikely(ret))
|
||||
ret = DIV_ROUND_UP(ret + len - l, esize);
|
||||
else {
|
||||
ret = copy_from_user(fifo->data, from + l, len - l);
|
||||
if (unlikely(ret))
|
||||
ret = DIV_ROUND_UP(ret, esize);
|
||||
}
|
||||
/*
|
||||
* make sure that the data in the fifo is up to date before
|
||||
* incrementing the fifo->in index counter
|
||||
*/
|
||||
smp_wmb();
|
||||
*copied = len - ret;
|
||||
/* return the number of elements which are not copied */
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __kfifo_from_user(struct __kfifo *fifo, const void __user *from,
|
||||
unsigned long len, unsigned int *copied)
|
||||
{
|
||||
unsigned int l;
|
||||
unsigned long ret;
|
||||
unsigned int esize = fifo->esize;
|
||||
int err;
|
||||
|
||||
if (esize != 1)
|
||||
len /= esize;
|
||||
|
||||
l = kfifo_unused(fifo);
|
||||
if (len > l)
|
||||
len = l;
|
||||
|
||||
ret = kfifo_copy_from_user(fifo, from, len, fifo->in, copied);
|
||||
if (unlikely(ret)) {
|
||||
len -= ret;
|
||||
err = -EFAULT;
|
||||
} else
|
||||
err = 0;
|
||||
fifo->in += len;
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_from_user);
|
||||
|
||||
static unsigned long kfifo_copy_to_user(struct __kfifo *fifo, void __user *to,
|
||||
unsigned int len, unsigned int off, unsigned int *copied)
|
||||
{
|
||||
unsigned int l;
|
||||
unsigned long ret;
|
||||
unsigned int size = fifo->mask + 1;
|
||||
unsigned int esize = fifo->esize;
|
||||
|
||||
off &= fifo->mask;
|
||||
if (esize != 1) {
|
||||
off *= esize;
|
||||
size *= esize;
|
||||
len *= esize;
|
||||
}
|
||||
l = min(len, size - off);
|
||||
|
||||
ret = copy_to_user(to, fifo->data + off, l);
|
||||
if (unlikely(ret))
|
||||
ret = DIV_ROUND_UP(ret + len - l, esize);
|
||||
else {
|
||||
ret = copy_to_user(to + l, fifo->data, len - l);
|
||||
if (unlikely(ret))
|
||||
ret = DIV_ROUND_UP(ret, esize);
|
||||
}
|
||||
/*
|
||||
* make sure that the data is copied before
|
||||
* incrementing the fifo->out index counter
|
||||
*/
|
||||
smp_wmb();
|
||||
*copied = len - ret;
|
||||
/* return the number of elements which are not copied */
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __kfifo_to_user(struct __kfifo *fifo, void __user *to,
|
||||
unsigned long len, unsigned int *copied)
|
||||
{
|
||||
unsigned int l;
|
||||
unsigned long ret;
|
||||
unsigned int esize = fifo->esize;
|
||||
int err;
|
||||
|
||||
if (esize != 1)
|
||||
len /= esize;
|
||||
|
||||
l = fifo->in - fifo->out;
|
||||
if (len > l)
|
||||
len = l;
|
||||
ret = kfifo_copy_to_user(fifo, to, len, fifo->out, copied);
|
||||
if (unlikely(ret)) {
|
||||
len -= ret;
|
||||
err = -EFAULT;
|
||||
} else
|
||||
err = 0;
|
||||
fifo->out += len;
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_to_user);
|
||||
|
||||
static int setup_sgl_buf(struct scatterlist *sgl, void *buf,
|
||||
int nents, unsigned int len)
|
||||
{
|
||||
int n;
|
||||
unsigned int l;
|
||||
unsigned int off;
|
||||
struct page *page;
|
||||
|
||||
if (!nents)
|
||||
return 0;
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
n = 0;
|
||||
page = virt_to_page(buf);
|
||||
off = offset_in_page(buf);
|
||||
l = 0;
|
||||
|
||||
while (len >= l + PAGE_SIZE - off) {
|
||||
struct page *npage;
|
||||
|
||||
l += PAGE_SIZE;
|
||||
buf += PAGE_SIZE;
|
||||
npage = virt_to_page(buf);
|
||||
if (page_to_phys(page) != page_to_phys(npage) - l) {
|
||||
sg_set_page(sgl, page, l - off, off);
|
||||
sgl = sg_next(sgl);
|
||||
if (++n == nents || sgl == NULL)
|
||||
return n;
|
||||
page = npage;
|
||||
len -= l - off;
|
||||
l = off = 0;
|
||||
}
|
||||
}
|
||||
sg_set_page(sgl, page, len, off);
|
||||
return n + 1;
|
||||
}
|
||||
|
||||
static unsigned int setup_sgl(struct __kfifo *fifo, struct scatterlist *sgl,
|
||||
int nents, unsigned int len, unsigned int off)
|
||||
{
|
||||
unsigned int size = fifo->mask + 1;
|
||||
unsigned int esize = fifo->esize;
|
||||
unsigned int l;
|
||||
unsigned int n;
|
||||
|
||||
off &= fifo->mask;
|
||||
if (esize != 1) {
|
||||
off *= esize;
|
||||
size *= esize;
|
||||
len *= esize;
|
||||
}
|
||||
l = min(len, size - off);
|
||||
|
||||
n = setup_sgl_buf(sgl, fifo->data + off, nents, l);
|
||||
n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo,
|
||||
struct scatterlist *sgl, int nents, unsigned int len)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
l = kfifo_unused(fifo);
|
||||
if (len > l)
|
||||
len = l;
|
||||
|
||||
return setup_sgl(fifo, sgl, nents, len, fifo->in);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_dma_in_prepare);
|
||||
|
||||
unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo,
|
||||
struct scatterlist *sgl, int nents, unsigned int len)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
l = fifo->in - fifo->out;
|
||||
if (len > l)
|
||||
len = l;
|
||||
|
||||
return setup_sgl(fifo, sgl, nents, len, fifo->out);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_dma_out_prepare);
|
||||
|
||||
unsigned int __kfifo_max_r(unsigned int len, size_t recsize)
|
||||
{
|
||||
unsigned int max = (1 << (recsize << 3)) - 1;
|
||||
|
||||
if (len > max)
|
||||
return max;
|
||||
return len;
|
||||
}
|
||||
|
||||
#define __KFIFO_PEEK(data, out, mask) \
|
||||
((data)[(out) & (mask)])
|
||||
/*
|
||||
* __kfifo_peek_n internal helper function for determinate the length of
|
||||
* the next record in the fifo
|
||||
*/
|
||||
static unsigned int __kfifo_peek_n(struct __kfifo *fifo, size_t recsize)
|
||||
{
|
||||
unsigned int l;
|
||||
unsigned int mask = fifo->mask;
|
||||
unsigned char *data = fifo->data;
|
||||
|
||||
l = __KFIFO_PEEK(data, fifo->out, mask);
|
||||
|
||||
if (--recsize)
|
||||
l |= __KFIFO_PEEK(data, fifo->out + 1, mask) << 8;
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
#define __KFIFO_POKE(data, in, mask, val) \
|
||||
( \
|
||||
(data)[(in) & (mask)] = (unsigned char)(val) \
|
||||
)
|
||||
|
||||
/*
|
||||
* __kfifo_poke_n internal helper function for storeing the length of
|
||||
* the record into the fifo
|
||||
*/
|
||||
static void __kfifo_poke_n(struct __kfifo *fifo, unsigned int n, size_t recsize)
|
||||
{
|
||||
unsigned int mask = fifo->mask;
|
||||
unsigned char *data = fifo->data;
|
||||
|
||||
__KFIFO_POKE(data, fifo->in, mask, n);
|
||||
|
||||
if (recsize > 1)
|
||||
__KFIFO_POKE(data, fifo->in + 1, mask, n >> 8);
|
||||
}
|
||||
|
||||
unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize)
|
||||
{
|
||||
return __kfifo_peek_n(fifo, recsize);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_len_r);
|
||||
|
||||
unsigned int __kfifo_in_r(struct __kfifo *fifo, const void *buf,
|
||||
unsigned int len, size_t recsize)
|
||||
{
|
||||
if (len + recsize > kfifo_unused(fifo))
|
||||
return 0;
|
||||
|
||||
__kfifo_poke_n(fifo, len, recsize);
|
||||
|
||||
kfifo_copy_in(fifo, buf, len, fifo->in + recsize);
|
||||
fifo->in += len + recsize;
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_in_r);
|
||||
|
||||
static unsigned int kfifo_out_copy_r(struct __kfifo *fifo,
|
||||
void *buf, unsigned int len, size_t recsize, unsigned int *n)
|
||||
{
|
||||
*n = __kfifo_peek_n(fifo, recsize);
|
||||
|
||||
if (len > *n)
|
||||
len = *n;
|
||||
|
||||
kfifo_copy_out(fifo, buf, len, fifo->out + recsize);
|
||||
return len;
|
||||
}
|
||||
|
||||
unsigned int __kfifo_out_peek_r(struct __kfifo *fifo, void *buf,
|
||||
unsigned int len, size_t recsize)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
if (fifo->in == fifo->out)
|
||||
return 0;
|
||||
|
||||
return kfifo_out_copy_r(fifo, buf, len, recsize, &n);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_out_peek_r);
|
||||
|
||||
unsigned int __kfifo_out_r(struct __kfifo *fifo, void *buf,
|
||||
unsigned int len, size_t recsize)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
if (fifo->in == fifo->out)
|
||||
return 0;
|
||||
|
||||
len = kfifo_out_copy_r(fifo, buf, len, recsize, &n);
|
||||
fifo->out += n + recsize;
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_out_r);
|
||||
|
||||
void __kfifo_skip_r(struct __kfifo *fifo, size_t recsize)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
n = __kfifo_peek_n(fifo, recsize);
|
||||
fifo->out += n + recsize;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_skip_r);
|
||||
|
||||
int __kfifo_from_user_r(struct __kfifo *fifo, const void __user *from,
|
||||
unsigned long len, unsigned int *copied, size_t recsize)
|
||||
{
|
||||
unsigned long ret;
|
||||
|
||||
len = __kfifo_max_r(len, recsize);
|
||||
|
||||
if (len + recsize > kfifo_unused(fifo)) {
|
||||
*copied = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__kfifo_poke_n(fifo, len, recsize);
|
||||
|
||||
ret = kfifo_copy_from_user(fifo, from, len, fifo->in + recsize, copied);
|
||||
if (unlikely(ret)) {
|
||||
*copied = 0;
|
||||
return -EFAULT;
|
||||
}
|
||||
fifo->in += len + recsize;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_from_user_r);
|
||||
|
||||
int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to,
|
||||
unsigned long len, unsigned int *copied, size_t recsize)
|
||||
{
|
||||
unsigned long ret;
|
||||
unsigned int n;
|
||||
|
||||
if (fifo->in == fifo->out) {
|
||||
*copied = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
n = __kfifo_peek_n(fifo, recsize);
|
||||
if (len > n)
|
||||
len = n;
|
||||
|
||||
ret = kfifo_copy_to_user(fifo, to, len, fifo->out + recsize, copied);
|
||||
if (unlikely(ret)) {
|
||||
*copied = 0;
|
||||
return -EFAULT;
|
||||
}
|
||||
fifo->out += n + recsize;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_to_user_r);
|
||||
|
||||
unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo,
|
||||
struct scatterlist *sgl, int nents, unsigned int len, size_t recsize)
|
||||
{
|
||||
if (!nents)
|
||||
BUG();
|
||||
|
||||
len = __kfifo_max_r(len, recsize);
|
||||
|
||||
if (len + recsize > kfifo_unused(fifo))
|
||||
return 0;
|
||||
|
||||
return setup_sgl(fifo, sgl, nents, len, fifo->in + recsize);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_dma_in_prepare_r);
|
||||
|
||||
void __kfifo_dma_in_finish_r(struct __kfifo *fifo,
|
||||
unsigned int len, size_t recsize)
|
||||
{
|
||||
len = __kfifo_max_r(len, recsize);
|
||||
__kfifo_poke_n(fifo, len, recsize);
|
||||
fifo->in += len + recsize;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_dma_in_finish_r);
|
||||
|
||||
unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo,
|
||||
struct scatterlist *sgl, int nents, unsigned int len, size_t recsize)
|
||||
{
|
||||
if (!nents)
|
||||
BUG();
|
||||
|
||||
len = __kfifo_max_r(len, recsize);
|
||||
|
||||
if (len + recsize > fifo->in - fifo->out)
|
||||
return 0;
|
||||
|
||||
return setup_sgl(fifo, sgl, nents, len, fifo->out + recsize);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_dma_out_prepare_r);
|
||||
|
||||
void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
len = __kfifo_peek_n(fifo, recsize);
|
||||
fifo->out += len + recsize;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__kfifo_dma_out_finish_r);
|
||||
@@ -1,236 +0,0 @@
|
||||
/*
|
||||
* Convert integer string representation to an integer.
|
||||
* If an integer doesn't fit into specified type, -E is returned.
|
||||
*
|
||||
* Integer starts with optional sign.
|
||||
* kstrtou*() functions do not accept sign "-".
|
||||
*
|
||||
* Radix 0 means autodetection: leading "0x" implies radix 16,
|
||||
* leading "0" implies radix 8, otherwise radix is 10.
|
||||
* Autodetection hints work after optional sign, but not before.
|
||||
*
|
||||
* If -E is returned, result is not touched.
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
/*
|
||||
* kstrto* was included in kernel 2.6.38.4 and causes conflicts with the
|
||||
* version included in compat-wireless. We use strict_strtol to check if
|
||||
* kstrto* is already available.
|
||||
*/
|
||||
#ifndef strict_strtol
|
||||
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/math64.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
static inline char _tolower(const char c)
|
||||
{
|
||||
return c | 0x20;
|
||||
}
|
||||
|
||||
static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
|
||||
{
|
||||
unsigned long long acc;
|
||||
int ok;
|
||||
|
||||
if (base == 0) {
|
||||
if (s[0] == '0') {
|
||||
if (_tolower(s[1]) == 'x' && isxdigit(s[2]))
|
||||
base = 16;
|
||||
else
|
||||
base = 8;
|
||||
} else
|
||||
base = 10;
|
||||
}
|
||||
if (base == 16 && s[0] == '0' && _tolower(s[1]) == 'x')
|
||||
s += 2;
|
||||
|
||||
acc = 0;
|
||||
ok = 0;
|
||||
while (*s) {
|
||||
unsigned int val;
|
||||
|
||||
if ('0' <= *s && *s <= '9')
|
||||
val = *s - '0';
|
||||
else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
|
||||
val = _tolower(*s) - 'a' + 10;
|
||||
else if (*s == '\n') {
|
||||
if (*(s + 1) == '\0')
|
||||
break;
|
||||
else
|
||||
return -EINVAL;
|
||||
} else
|
||||
return -EINVAL;
|
||||
|
||||
if (val >= base)
|
||||
return -EINVAL;
|
||||
if (acc > div_u64(ULLONG_MAX - val, base))
|
||||
return -ERANGE;
|
||||
acc = acc * base + val;
|
||||
ok = 1;
|
||||
|
||||
s++;
|
||||
}
|
||||
if (!ok)
|
||||
return -EINVAL;
|
||||
*res = acc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kstrtoull(const char *s, unsigned int base, unsigned long long *res)
|
||||
{
|
||||
if (s[0] == '+')
|
||||
s++;
|
||||
return _kstrtoull(s, base, res);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtoull);
|
||||
|
||||
int kstrtoll(const char *s, unsigned int base, long long *res)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
int rv;
|
||||
|
||||
if (s[0] == '-') {
|
||||
rv = _kstrtoull(s + 1, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if ((long long)(-tmp) >= 0)
|
||||
return -ERANGE;
|
||||
*res = -tmp;
|
||||
} else {
|
||||
rv = kstrtoull(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if ((long long)tmp < 0)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtoll);
|
||||
|
||||
/* Internal, do not use. */
|
||||
int _kstrtoul(const char *s, unsigned int base, unsigned long *res)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoull(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (unsigned long long)(unsigned long)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(_kstrtoul);
|
||||
|
||||
/* Internal, do not use. */
|
||||
int _kstrtol(const char *s, unsigned int base, long *res)
|
||||
{
|
||||
long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoll(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (long long)(long)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(_kstrtol);
|
||||
|
||||
int kstrtouint(const char *s, unsigned int base, unsigned int *res)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoull(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (unsigned long long)(unsigned int)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtouint);
|
||||
|
||||
int kstrtoint(const char *s, unsigned int base, int *res)
|
||||
{
|
||||
long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoll(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (long long)(int)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtoint);
|
||||
|
||||
int kstrtou16(const char *s, unsigned int base, u16 *res)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoull(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (unsigned long long)(u16)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtou16);
|
||||
|
||||
int kstrtos16(const char *s, unsigned int base, s16 *res)
|
||||
{
|
||||
long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoll(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (long long)(s16)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtos16);
|
||||
|
||||
int kstrtou8(const char *s, unsigned int base, u8 *res)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoull(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (unsigned long long)(u8)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtou8);
|
||||
|
||||
int kstrtos8(const char *s, unsigned int base, s8 *res)
|
||||
{
|
||||
long long tmp;
|
||||
int rv;
|
||||
|
||||
rv = kstrtoll(s, base, &tmp);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
if (tmp != (long long)(s8)tmp)
|
||||
return -ERANGE;
|
||||
*res = tmp;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kstrtos8);
|
||||
#endif /* #ifndef strict_strtol */
|
||||
@@ -1,66 +0,0 @@
|
||||
#include <linux/module.h>
|
||||
|
||||
MODULE_AUTHOR("Luis R. Rodriguez");
|
||||
MODULE_DESCRIPTION("Kernel compatibility module");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
#ifndef COMPAT_BASE_TREE
|
||||
#error "You need a COMPAT_BASE_TREE"
|
||||
#endif
|
||||
|
||||
#ifndef COMPAT_BASE_TREE_VERSION
|
||||
#error "You need a COMPAT_BASE_TREE_VERSION"
|
||||
#endif
|
||||
|
||||
#ifndef COMPAT_VERSION
|
||||
#error "You need a COMPAT_VERSION"
|
||||
#endif
|
||||
|
||||
static char *compat_base_tree = COMPAT_BASE_TREE;
|
||||
static char *compat_base_tree_version = COMPAT_BASE_TREE_VERSION;
|
||||
static char *compat_version = COMPAT_VERSION;
|
||||
|
||||
module_param(compat_base_tree, charp, 0400);
|
||||
MODULE_PARM_DESC(compat_base_tree,
|
||||
"The upstream tree used as base for this backport");
|
||||
|
||||
module_param(compat_base_tree_version, charp, 0400);
|
||||
MODULE_PARM_DESC(compat_base_tree_version,
|
||||
"The git-describe of the upstream base tree");
|
||||
|
||||
module_param(compat_version, charp, 0400);
|
||||
MODULE_PARM_DESC(compat_version,
|
||||
"Version of the kernel compat backport work");
|
||||
|
||||
void compat_dependency_symbol(void)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_dependency_symbol);
|
||||
|
||||
static int __init compat_init(void)
|
||||
{
|
||||
/* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */
|
||||
compat_pm_qos_power_init();
|
||||
compat_system_workqueue_create();
|
||||
|
||||
printk(KERN_INFO
|
||||
COMPAT_PROJECT " backport release: "
|
||||
COMPAT_VERSION
|
||||
"\n");
|
||||
printk(KERN_INFO "Backport based on "
|
||||
COMPAT_BASE_TREE " " COMPAT_BASE_TREE_VERSION
|
||||
"\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(compat_init);
|
||||
|
||||
static void __exit compat_exit(void)
|
||||
{
|
||||
compat_pm_qos_power_deinit();
|
||||
compat_system_workqueue_destroy();
|
||||
|
||||
return;
|
||||
}
|
||||
module_exit(compat_exit);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
kernel//home/thales/openair4G/openairITS/mac/DOT11/compat/compat.ko
|
||||
@@ -1,477 +0,0 @@
|
||||
#include <net/compat.h>
|
||||
|
||||
/* This is the backport of pm-qos params for kernels <= 2.6.25 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
|
||||
|
||||
/*
|
||||
* This module exposes the interface to kernel space for specifying
|
||||
* QoS dependencies. It provides infrastructure for registration of:
|
||||
*
|
||||
* Dependents on a QoS value : register requirements
|
||||
* Watchers of QoS value : get notified when target QoS value changes
|
||||
*
|
||||
* This QoS design is best effort based. Dependents register their QoS needs.
|
||||
* Watchers register to keep track of the current QoS needs of the system.
|
||||
*
|
||||
* There are 3 basic classes of QoS parameter: latency, timeout, throughput
|
||||
* each have defined units:
|
||||
* latency: usec
|
||||
* timeout: usec <-- currently not used.
|
||||
* throughput: kbs (kilo byte / sec)
|
||||
*
|
||||
* There are lists of pm_qos_objects each one wrapping requirements, notifiers
|
||||
*
|
||||
* User mode requirements on a QOS parameter register themselves to the
|
||||
* subsystem by opening the device node /dev/... and writing there request to
|
||||
* the node. As long as the process holds a file handle open to the node the
|
||||
* client continues to be accounted for. Upon file release the usermode
|
||||
* requirement is removed and a new qos target is computed. This way when the
|
||||
* requirement that the application has is cleaned up when closes the file
|
||||
* pointer or exits the pm_qos_object will get an opportunity to clean up.
|
||||
*
|
||||
* Mark Gross <mgross@linux.intel.com>
|
||||
*/
|
||||
|
||||
#include <linux/pm_qos_params.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
/*
|
||||
* locking rule: all changes to requirements or notifiers lists
|
||||
* or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock
|
||||
* held, taken with _irqsave. One lock to rule them all
|
||||
*/
|
||||
struct requirement_list {
|
||||
struct list_head list;
|
||||
union {
|
||||
s32 value;
|
||||
s32 usec;
|
||||
s32 kbps;
|
||||
};
|
||||
char *name;
|
||||
};
|
||||
|
||||
static s32 max_compare(s32 v1, s32 v2);
|
||||
static s32 min_compare(s32 v1, s32 v2);
|
||||
|
||||
struct pm_qos_object {
|
||||
struct requirement_list requirements;
|
||||
struct blocking_notifier_head *notifiers;
|
||||
struct miscdevice pm_qos_power_miscdev;
|
||||
char *name;
|
||||
s32 default_value;
|
||||
atomic_t target_value;
|
||||
s32 (*comparitor)(s32, s32);
|
||||
};
|
||||
|
||||
static struct pm_qos_object null_pm_qos;
|
||||
static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier);
|
||||
static struct pm_qos_object cpu_dma_pm_qos = {
|
||||
.requirements = {LIST_HEAD_INIT(cpu_dma_pm_qos.requirements.list)},
|
||||
.notifiers = &cpu_dma_lat_notifier,
|
||||
.name = "cpu_dma_latency",
|
||||
.default_value = 2000 * USEC_PER_SEC,
|
||||
.target_value = ATOMIC_INIT(2000 * USEC_PER_SEC),
|
||||
.comparitor = min_compare
|
||||
};
|
||||
|
||||
static BLOCKING_NOTIFIER_HEAD(network_lat_notifier);
|
||||
static struct pm_qos_object network_lat_pm_qos = {
|
||||
.requirements = {LIST_HEAD_INIT(network_lat_pm_qos.requirements.list)},
|
||||
.notifiers = &network_lat_notifier,
|
||||
.name = "network_latency",
|
||||
.default_value = 2000 * USEC_PER_SEC,
|
||||
.target_value = ATOMIC_INIT(2000 * USEC_PER_SEC),
|
||||
.comparitor = min_compare
|
||||
};
|
||||
|
||||
|
||||
static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier);
|
||||
static struct pm_qos_object network_throughput_pm_qos = {
|
||||
.requirements =
|
||||
{LIST_HEAD_INIT(network_throughput_pm_qos.requirements.list)},
|
||||
.notifiers = &network_throughput_notifier,
|
||||
.name = "network_throughput",
|
||||
.default_value = 0,
|
||||
.target_value = ATOMIC_INIT(0),
|
||||
.comparitor = max_compare
|
||||
};
|
||||
|
||||
static BLOCKING_NOTIFIER_HEAD(system_bus_freq_notifier);
|
||||
static struct pm_qos_object system_bus_freq_pm_qos = {
|
||||
.requirements =
|
||||
{LIST_HEAD_INIT(system_bus_freq_pm_qos.requirements.list)},
|
||||
.notifiers = &system_bus_freq_notifier,
|
||||
.name = "system_bus_freq",
|
||||
.default_value = 0,
|
||||
.target_value = ATOMIC_INIT(0),
|
||||
.comparitor = max_compare
|
||||
};
|
||||
|
||||
|
||||
static struct pm_qos_object *pm_qos_array[PM_QOS_NUM_CLASSES] = {
|
||||
[PM_QOS_RESERVED] = &null_pm_qos,
|
||||
[PM_QOS_CPU_DMA_LATENCY] = &cpu_dma_pm_qos,
|
||||
[PM_QOS_NETWORK_LATENCY] = &network_lat_pm_qos,
|
||||
[PM_QOS_NETWORK_THROUGHPUT] = &network_throughput_pm_qos,
|
||||
[PM_QOS_SYSTEM_BUS_FREQ] = &system_bus_freq_pm_qos,
|
||||
};
|
||||
|
||||
static DEFINE_SPINLOCK(pm_qos_lock);
|
||||
|
||||
static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
|
||||
size_t count, loff_t *f_pos);
|
||||
static int pm_qos_power_open(struct inode *inode, struct file *filp);
|
||||
static int pm_qos_power_release(struct inode *inode, struct file *filp);
|
||||
|
||||
static const struct file_operations pm_qos_power_fops = {
|
||||
.write = pm_qos_power_write,
|
||||
.open = pm_qos_power_open,
|
||||
.release = pm_qos_power_release,
|
||||
};
|
||||
|
||||
/* static helper functions */
|
||||
static s32 max_compare(s32 v1, s32 v2)
|
||||
{
|
||||
return max(v1, v2);
|
||||
}
|
||||
|
||||
static s32 min_compare(s32 v1, s32 v2)
|
||||
{
|
||||
return min(v1, v2);
|
||||
}
|
||||
|
||||
|
||||
static void update_target(int target)
|
||||
{
|
||||
s32 extreme_value;
|
||||
struct requirement_list *node;
|
||||
unsigned long flags;
|
||||
int call_notifier = 0;
|
||||
|
||||
spin_lock_irqsave(&pm_qos_lock, flags);
|
||||
extreme_value = pm_qos_array[target]->default_value;
|
||||
list_for_each_entry(node,
|
||||
&pm_qos_array[target]->requirements.list, list) {
|
||||
extreme_value = pm_qos_array[target]->comparitor(
|
||||
extreme_value, node->value);
|
||||
}
|
||||
if (atomic_read(&pm_qos_array[target]->target_value) != extreme_value) {
|
||||
call_notifier = 1;
|
||||
atomic_set(&pm_qos_array[target]->target_value, extreme_value);
|
||||
pr_debug(KERN_ERR "new target for qos %d is %d\n", target,
|
||||
atomic_read(&pm_qos_array[target]->target_value));
|
||||
}
|
||||
spin_unlock_irqrestore(&pm_qos_lock, flags);
|
||||
|
||||
if (call_notifier)
|
||||
blocking_notifier_call_chain(pm_qos_array[target]->notifiers,
|
||||
(unsigned long) extreme_value, NULL);
|
||||
}
|
||||
|
||||
static int register_pm_qos_misc(struct pm_qos_object *qos)
|
||||
{
|
||||
qos->pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR;
|
||||
qos->pm_qos_power_miscdev.name = qos->name;
|
||||
qos->pm_qos_power_miscdev.fops = &pm_qos_power_fops;
|
||||
|
||||
return misc_register(&qos->pm_qos_power_miscdev);
|
||||
}
|
||||
|
||||
static int find_pm_qos_object_by_minor(int minor)
|
||||
{
|
||||
int pm_qos_class;
|
||||
|
||||
for (pm_qos_class = 0;
|
||||
pm_qos_class < PM_QOS_NUM_CLASSES; pm_qos_class++) {
|
||||
if (minor ==
|
||||
pm_qos_array[pm_qos_class]->pm_qos_power_miscdev.minor)
|
||||
return pm_qos_class;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_qos_requirement - returns current system wide qos expectation
|
||||
* @pm_qos_class: identification of which qos value is requested
|
||||
*
|
||||
* This function returns the current target value in an atomic manner.
|
||||
*/
|
||||
int pm_qos_requirement(int pm_qos_class)
|
||||
{
|
||||
return atomic_read(&pm_qos_array[pm_qos_class]->target_value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_qos_requirement);
|
||||
|
||||
/**
|
||||
* pm_qos_add_requirement - inserts new qos request into the list
|
||||
* @pm_qos_class: identifies which list of qos request to us
|
||||
* @name: identifies the request
|
||||
* @value: defines the qos request
|
||||
*
|
||||
* This function inserts a new entry in the pm_qos_class list of requested qos
|
||||
* performance characteristics. It recomputes the aggregate QoS expectations
|
||||
* for the pm_qos_class of parameters.
|
||||
*/
|
||||
int pm_qos_add_requirement(int pm_qos_class, char *name, s32 value)
|
||||
{
|
||||
struct requirement_list *dep;
|
||||
unsigned long flags;
|
||||
|
||||
dep = kzalloc(sizeof(struct requirement_list), GFP_KERNEL);
|
||||
if (dep) {
|
||||
if (value == PM_QOS_DEFAULT_VALUE)
|
||||
dep->value = pm_qos_array[pm_qos_class]->default_value;
|
||||
else
|
||||
dep->value = value;
|
||||
dep->name = kstrdup(name, GFP_KERNEL);
|
||||
if (!dep->name)
|
||||
goto cleanup;
|
||||
|
||||
spin_lock_irqsave(&pm_qos_lock, flags);
|
||||
list_add(&dep->list,
|
||||
&pm_qos_array[pm_qos_class]->requirements.list);
|
||||
spin_unlock_irqrestore(&pm_qos_lock, flags);
|
||||
update_target(pm_qos_class);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
kfree(dep);
|
||||
return -ENOMEM;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_qos_add_requirement);
|
||||
|
||||
/**
|
||||
* pm_qos_update_requirement - modifies an existing qos request
|
||||
* @pm_qos_class: identifies which list of qos request to us
|
||||
* @name: identifies the request
|
||||
* @value: defines the qos request
|
||||
*
|
||||
* Updates an existing qos requirement for the pm_qos_class of parameters along
|
||||
* with updating the target pm_qos_class value.
|
||||
*
|
||||
* If the named request isn't in the list then no change is made.
|
||||
*/
|
||||
int pm_qos_update_requirement(int pm_qos_class, char *name, s32 new_value)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct requirement_list *node;
|
||||
int pending_update = 0;
|
||||
|
||||
spin_lock_irqsave(&pm_qos_lock, flags);
|
||||
list_for_each_entry(node,
|
||||
&pm_qos_array[pm_qos_class]->requirements.list, list) {
|
||||
if (strcmp(node->name, name) == 0) {
|
||||
if (new_value == PM_QOS_DEFAULT_VALUE)
|
||||
node->value =
|
||||
pm_qos_array[pm_qos_class]->default_value;
|
||||
else
|
||||
node->value = new_value;
|
||||
pending_update = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&pm_qos_lock, flags);
|
||||
if (pending_update)
|
||||
update_target(pm_qos_class);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_qos_update_requirement);
|
||||
|
||||
/**
|
||||
* pm_qos_remove_requirement - modifies an existing qos request
|
||||
* @pm_qos_class: identifies which list of qos request to us
|
||||
* @name: identifies the request
|
||||
*
|
||||
* Will remove named qos request from pm_qos_class list of parameters and
|
||||
* recompute the current target value for the pm_qos_class.
|
||||
*/
|
||||
void pm_qos_remove_requirement(int pm_qos_class, char *name)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct requirement_list *node;
|
||||
int pending_update = 0;
|
||||
|
||||
spin_lock_irqsave(&pm_qos_lock, flags);
|
||||
list_for_each_entry(node,
|
||||
&pm_qos_array[pm_qos_class]->requirements.list, list) {
|
||||
if (strcmp(node->name, name) == 0) {
|
||||
kfree(node->name);
|
||||
list_del(&node->list);
|
||||
kfree(node);
|
||||
pending_update = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&pm_qos_lock, flags);
|
||||
if (pending_update)
|
||||
update_target(pm_qos_class);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_qos_remove_requirement);
|
||||
|
||||
/**
|
||||
* pm_qos_add_notifier - sets notification entry for changes to target value
|
||||
* @pm_qos_class: identifies which qos target changes should be notified.
|
||||
* @notifier: notifier block managed by caller.
|
||||
*
|
||||
* will register the notifier into a notification chain that gets called
|
||||
* upon changes to the pm_qos_class target value.
|
||||
*/
|
||||
int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = blocking_notifier_chain_register(
|
||||
pm_qos_array[pm_qos_class]->notifiers, notifier);
|
||||
|
||||
return retval;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_qos_add_notifier);
|
||||
|
||||
/**
|
||||
* pm_qos_remove_notifier - deletes notification entry from chain.
|
||||
* @pm_qos_class: identifies which qos target changes are notified.
|
||||
* @notifier: notifier block to be removed.
|
||||
*
|
||||
* will remove the notifier from the notification chain that gets called
|
||||
* upon changes to the pm_qos_class target value.
|
||||
*/
|
||||
int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = blocking_notifier_chain_unregister(
|
||||
pm_qos_array[pm_qos_class]->notifiers, notifier);
|
||||
|
||||
return retval;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_qos_remove_notifier);
|
||||
|
||||
#define PID_NAME_LEN 32
|
||||
|
||||
static int pm_qos_power_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int ret;
|
||||
long pm_qos_class;
|
||||
char name[PID_NAME_LEN];
|
||||
|
||||
pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
|
||||
if (pm_qos_class >= 0) {
|
||||
filp->private_data = (void *)pm_qos_class;
|
||||
snprintf(name, PID_NAME_LEN, "process_%d", current->pid);
|
||||
ret = pm_qos_add_requirement(pm_qos_class, name,
|
||||
PM_QOS_DEFAULT_VALUE);
|
||||
if (ret >= 0)
|
||||
return 0;
|
||||
}
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
static int pm_qos_power_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int pm_qos_class;
|
||||
char name[PID_NAME_LEN];
|
||||
|
||||
pm_qos_class = (long)filp->private_data;
|
||||
snprintf(name, PID_NAME_LEN, "process_%d", current->pid);
|
||||
pm_qos_remove_requirement(pm_qos_class, name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
|
||||
size_t count, loff_t *f_pos)
|
||||
{
|
||||
s32 value;
|
||||
int pm_qos_class;
|
||||
char name[PID_NAME_LEN];
|
||||
|
||||
pm_qos_class = (long)filp->private_data;
|
||||
if (count != sizeof(s32))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&value, buf, sizeof(s32)))
|
||||
return -EFAULT;
|
||||
snprintf(name, PID_NAME_LEN, "process_%d", current->pid);
|
||||
pm_qos_update_requirement(pm_qos_class, name, value);
|
||||
|
||||
return sizeof(s32);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This initializes pm-qos for older kernels.
|
||||
*/
|
||||
int compat_pm_qos_power_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = register_pm_qos_misc(&cpu_dma_pm_qos);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "pm_qos_param: cpu_dma_latency setup failed\n");
|
||||
return ret;
|
||||
}
|
||||
ret = register_pm_qos_misc(&network_lat_pm_qos);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "pm_qos_param: network_latency setup failed\n");
|
||||
return ret;
|
||||
}
|
||||
ret = register_pm_qos_misc(&network_throughput_pm_qos);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR
|
||||
"pm_qos_param: network_throughput setup failed\n");
|
||||
return ret;
|
||||
}
|
||||
ret = register_pm_qos_misc(&system_bus_freq_pm_qos);
|
||||
if (ret < 0)
|
||||
printk(KERN_ERR
|
||||
"pm_qos_param: system_bus_freq setup failed\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int compat_pm_qos_power_deinit(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = misc_deregister(&cpu_dma_pm_qos.pm_qos_power_miscdev);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "pm_qos_param: cpu_dma_latency deinit failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = misc_deregister(&network_lat_pm_qos.pm_qos_power_miscdev);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "pm_qos_param: network_latency deinit failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = misc_deregister(&network_throughput_pm_qos.pm_qos_power_miscdev);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR
|
||||
"pm_qos_param: network_throughput deinit failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = misc_deregister(&system_bus_freq_pm_qos.pm_qos_power_miscdev);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR
|
||||
"pm_qos_param: system_bus_freq deinit failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) */
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /usr/bin/lsb_release ]; then
|
||||
LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
|
||||
else
|
||||
LSB_RED_ID="Unknown"
|
||||
fi
|
||||
|
||||
case $LSB_RED_ID in
|
||||
"Ubuntu")
|
||||
mkdir -p /lib/udev/ /lib/udev/rules.d/
|
||||
cp udev/ubuntu/compat_firmware.sh /lib/udev/
|
||||
cp udev/ubuntu/50-compat_firmware.rules /lib/udev/rules.d/
|
||||
;;
|
||||
*)
|
||||
mkdir -p /lib/udev/ /lib/udev/rules.d/
|
||||
cp udev/compat_firmware.sh /lib/udev/
|
||||
cp udev/50-compat_firmware.rules /lib/udev/rules.d/
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org>
|
||||
# Copyright 2011 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
# Copyright 2011 John W. Linville <linville@tuxdriver.com>
|
||||
#
|
||||
# Use this to parse a small .config equivalent looking file to generate
|
||||
# our own autoconf.h. This file has defines for each config option
|
||||
# just like the kernels include/linux/autoconf.h
|
||||
#
|
||||
# XXX: consider using scripts/kconfig/confdata.c instead.
|
||||
# On the downside this would require the user to have libc though.
|
||||
|
||||
# This indicates which is the oldest kernel we support
|
||||
# Update this if you are adding support for older kernels.
|
||||
OLDEST_KERNEL_SUPPORTED="2.6.24"
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage $0 config-file"
|
||||
exit
|
||||
fi
|
||||
|
||||
COMPAT_CONFIG="$1"
|
||||
|
||||
if [ ! -f $COMPAT_CONFIG ]; then
|
||||
echo "File $1 is not a file"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Defines a CONFIG_ option if not defined yet, this helps respect
|
||||
# linux/autoconf.h
|
||||
function define_config {
|
||||
VAR=$1
|
||||
VALUE=$2
|
||||
case $VALUE in
|
||||
n) # Try to undefine it
|
||||
echo "#undef $VAR"
|
||||
;;
|
||||
y)
|
||||
echo "#ifndef $VAR"
|
||||
echo "#define $VAR 1"
|
||||
echo "#endif /* $VAR */"
|
||||
;;
|
||||
m)
|
||||
echo "#ifndef $VAR"
|
||||
echo "#define $VAR 1"
|
||||
echo "#endif /* $VAR */"
|
||||
;;
|
||||
*) # Assume string
|
||||
# XXX: add better checks to make sure what was on
|
||||
# the right was indeed a string
|
||||
echo "#ifndef $VAR"
|
||||
echo "#define $VAR \"$VALUE\""
|
||||
echo "#endif /* $VAR */"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function kernel_version_req {
|
||||
VERSION=$(echo $1 | sed -e 's/\./,/g')
|
||||
echo "#if (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION))"
|
||||
echo "#error compat requirement: Linux >= $VERSION"
|
||||
echo "#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION) */"
|
||||
}
|
||||
|
||||
cat <<EOF
|
||||
#ifndef COMPAT_AUTOCONF_INCLUDED
|
||||
#define COMPAT_AUTOCONF_INCLUDED
|
||||
/*
|
||||
* Automatically generated C config: don't edit
|
||||
*/
|
||||
EOF
|
||||
|
||||
# Checks user is compiling against a kernel we support
|
||||
kernel_version_req $OLDEST_KERNEL_SUPPORTED
|
||||
|
||||
# For each CONFIG_FOO=x option
|
||||
for i in $(egrep '^CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG | sed 's/ /+/'); do
|
||||
case $i in
|
||||
'ifdef+CONFIG_'* )
|
||||
echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(3,\2,0))/' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(ifdef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (defined(RHEL_MAJOR) \&\& RHEL_MAJOR == \2 \&\& RHEL_MINOR >= \3)/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/'
|
||||
continue
|
||||
;;
|
||||
'ifndef+CONFIG_'* )
|
||||
echo "#$i" | sed -e 's/+/ /' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,\2,0))/' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,\2))/' -e 's/\(ifndef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (!defined(RHEL_MAJOR) || RHEL_MAJOR != \2 || RHEL_MINOR < \3)/' -e 's/\(#ifndef \)\(CONFIG_[^:space:]*\)/#if !defined(\2) \&\& !defined(\2_MODULE)/'
|
||||
continue
|
||||
;;
|
||||
'else+#CONFIG_'* | 'endif+#CONFIG_'* )
|
||||
echo "#$i */" |sed -e 's/+#/ \/* /g'
|
||||
continue
|
||||
;;
|
||||
CONFIG_* )
|
||||
# Get the element on the left of the "="
|
||||
VAR=$(echo $i | cut -d"=" -f 1)
|
||||
# Get the element on the right of the "="
|
||||
VALUE=$(echo $i | cut -d"=" -f 2)
|
||||
|
||||
# Any other module which can *definitely* be built as a module goes here
|
||||
define_config $VAR $VALUE
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "#endif /* COMPAT_AUTOCONF_INCLUDED */"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org>
|
||||
# Copyright 2012 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
#
|
||||
# This generates a bunch of CONFIG_COMPAT_KERNEL_2_6_22
|
||||
# CONFIG_COMPAT_KERNEL_3_0 .. etc for each kernel release you need an object
|
||||
# for.
|
||||
#
|
||||
# Note: this is part of the compat.git project, not compat-wireless.git,
|
||||
# send patches against compat.git.
|
||||
|
||||
if [[ ! -f ${KLIB_BUILD}/Makefile ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Actual kernel version
|
||||
KERNEL_VERSION=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p')
|
||||
|
||||
# 3.0 kernel stuff
|
||||
COMPAT_LATEST_VERSION="5"
|
||||
KERNEL_SUBLEVEL="-1"
|
||||
|
||||
# Note that this script will export all variables explicitly,
|
||||
# trying to export all with a blanket "export" statement at
|
||||
# the top of the generated file causes the build to slow down
|
||||
# by an order of magnitude.
|
||||
|
||||
if [[ ${KERNEL_VERSION} -eq "3" ]]; then
|
||||
KERNEL_SUBLEVEL=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^3\.\([0-9]\+\).*/\1/p')
|
||||
else
|
||||
COMPAT_26LATEST_VERSION="39"
|
||||
KERNEL_26SUBLEVEL=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
|
||||
let KERNEL_26SUBLEVEL=${KERNEL_26SUBLEVEL}+1
|
||||
|
||||
for i in $(seq ${KERNEL_26SUBLEVEL} ${COMPAT_26LATEST_VERSION}); do
|
||||
eval CONFIG_COMPAT_KERNEL_2_6_${i}=y
|
||||
echo "export CONFIG_COMPAT_KERNEL_2_6_${i}=y"
|
||||
done
|
||||
fi
|
||||
|
||||
let KERNEL_SUBLEVEL=${KERNEL_SUBLEVEL}+1
|
||||
for i in $(seq ${KERNEL_SUBLEVEL} ${COMPAT_LATEST_VERSION}); do
|
||||
eval CONFIG_COMPAT_KERNEL_3_${i}=y
|
||||
echo "export CONFIG_COMPAT_KERNEL_3_${i}=y"
|
||||
done
|
||||
|
||||
# The purpose of these seem to be the inverse of the above other varibales.
|
||||
# The RHEL checks seem to annotate the existance of RHEL minor versions.
|
||||
RHEL_MAJOR=$(grep ^RHEL_MAJOR ${KLIB_BUILD}/Makefile | sed -n 's/.*= *\(.*\)/\1/p')
|
||||
if [[ ! -z ${RHEL_MAJOR} ]]; then
|
||||
RHEL_MINOR=$(grep ^RHEL_MINOR $(KLIB_BUILD)/Makefile | sed -n 's/.*= *\(.*\)/\1/p')
|
||||
for i in $(seq 0 ${RHEL_MINOR}); do
|
||||
eval CONFIG_COMPAT_${RHEL_MAJOR}_${i}=y
|
||||
echo "export CONFIG_COMPAT_${RHEL_MAJOR}_${i}=y"
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ ${CONFIG_COMPAT_KERNEL_2_6_33} = "y" ]]; then
|
||||
echo "export CONFIG_COMPAT_FIRMWARE_CLASS=m"
|
||||
fi
|
||||
|
||||
if [[ ${CONFIG_COMPAT_KERNEL_2_6_36} = "y" ]]; then
|
||||
echo "export CONFIG_COMPAT_KFIFO=y"
|
||||
fi
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
perl -pe 's|(\e)\[(\d+)(;*)(\d*)(\w)||g'
|
||||
@@ -1 +0,0 @@
|
||||
linux-stable.git
|
||||
@@ -1 +0,0 @@
|
||||
v3.4-rc3
|
||||
@@ -1 +0,0 @@
|
||||
compat-wireless-v3.4-rc3-1
|
||||
@@ -1,677 +0,0 @@
|
||||
ifeq ($(wildcard $(KLIB_BUILD)/.config),)
|
||||
# These will be ignored by compat autoconf
|
||||
export CONFIG_PCI=y
|
||||
export CONFIG_USB=y
|
||||
export CONFIG_PCMCIA=y
|
||||
export CONFIG_SSB=m
|
||||
else
|
||||
include $(KLIB_BUILD)/.config
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard $(KLIB_BUILD)/Makefile),)
|
||||
|
||||
KERNEL_VERSION := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p')
|
||||
|
||||
ifneq ($(KERNEL_VERSION),2)
|
||||
else
|
||||
KERNEL_26SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
|
||||
endif
|
||||
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_24
|
||||
$(error "ERROR: compat-wireless by default supports kernels >= 2.6.24, try enabling only one driver though")
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_24
|
||||
|
||||
ifeq ($(CONFIG_CFG80211),y)
|
||||
$(error "ERROR: your kernel has CONFIG_CFG80211=y, you should have it CONFIG_CFG80211=m if you want to use this thing.")
|
||||
endif
|
||||
|
||||
|
||||
# 2.6.27 has FTRACE_DYNAMIC borked, so we will complain if
|
||||
# you have it enabled, otherwise you will very likely run into
|
||||
# a kernel panic.
|
||||
# XXX: move this to compat_autoconf.h script generation
|
||||
ifeq ($(KERNEL_VERSION),2)
|
||||
ifeq ($(shell test $(KERNEL_VERSION) -eq 2 -a $(KERNEL_26SUBLEVEL) -eq 27 && echo yes),yes)
|
||||
ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
|
||||
$(error "ERROR: Your 2.6.27 kernel has CONFIG_DYNAMIC_FTRACE, please upgrade your distribution kernel as newer ones should not have this enabled (and if so report a bug) or remove this warning if you know what you are doing")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# This is because with CONFIG_MAC80211 include/linux/skbuff.h will
|
||||
# enable on 2.6.27 a new attribute:
|
||||
#
|
||||
# skb->do_not_encrypt
|
||||
#
|
||||
# and on 2.6.28 another new attribute:
|
||||
#
|
||||
# skb->requeue
|
||||
#
|
||||
# In kernel 2.6.32 both attributes were removed.
|
||||
#
|
||||
# XXX: move this to compat_autoconf.h script generation
|
||||
ifeq ($(KERNEL_VERSION),2)
|
||||
ifeq ($(shell test $(KERNEL_VERSION) -eq 2 -a $(KERNEL_26SUBLEVEL) -ge 27 -a $(KERNEL_26SUBLEVEL) -le 31 && echo yes),yes)
|
||||
ifeq ($(CONFIG_MAC80211),)
|
||||
$(error "ERROR: Your >=2.6.27 and <= 2.6.31 kernel has CONFIG_MAC80211 disabled, you should have it CONFIG_MAC80211=m if you want to use this thing.")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(KERNELRELEASE),) # This prevents a warning
|
||||
|
||||
# We will warn when you don't have MQ support or NET_SCHED enabled.
|
||||
#
|
||||
# We could consider just quiting if MQ and NET_SCHED is disabled
|
||||
# as I suspect all users of this package want 802.11e (WME) and
|
||||
# 802.11n (HT) support.
|
||||
ifeq ($(CONFIG_NET_SCHED),)
|
||||
QOS_REQS_MISSING+=CONFIG_NET_SCHED
|
||||
endif
|
||||
|
||||
ifneq ($(QOS_REQS_MISSING),) # Complain about our missing dependencies
|
||||
$(warning "WARNING: You are running a kernel >= 2.6.23, you should enable in it $(QOS_REQS_MISSING) for 802.11[ne] support")
|
||||
endif
|
||||
|
||||
endif # build check
|
||||
endif # kernel Makefile check
|
||||
|
||||
# These both are needed by compat-wireless || compat-bluetooth so enable them
|
||||
export CONFIG_COMPAT_RFKILL=y
|
||||
|
||||
ifeq ($(CONFIG_MAC80211),y)
|
||||
$(error "ERROR: you have MAC80211 compiled into the kernel, CONFIG_MAC80211=y, as such you cannot replace its mac80211 driver. You need this set to CONFIG_MAC80211=m. If you are using Fedora upgrade your kernel as later version should this set as modular. For further information on Fedora see https://bugzilla.redhat.com/show_bug.cgi?id=470143. If you are using your own kernel recompile it and make mac80211 modular")
|
||||
else
|
||||
export CONFIG_COMPAT_WIRELESS=y
|
||||
export CONFIG_COMPAT_WIRELESS_MODULES=m
|
||||
export CONFIG_COMPAT_VAR_MODULES=m
|
||||
# We could technically separate these but not yet, we only have b44
|
||||
# Note that we don't intend on backporting network drivers that
|
||||
# use Multiqueue as that was a pain to backport to kernels older than
|
||||
# 2.6.27. But -- we could just disable those drivers from kernels
|
||||
# older than 2.6.27
|
||||
export CONFIG_COMPAT_NETWORK_MODULES=m
|
||||
export CONFIG_COMPAT_NET_USB_MODULES=m
|
||||
endif
|
||||
|
||||
# The Bluetooth compatibility only builds on kernels >= 2.6.27 for now
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_27
|
||||
ifeq ($(CONFIG_BT),y)
|
||||
# we'll ignore compiling bluetooth
|
||||
else
|
||||
export CONFIG_COMPAT_BLUETOOTH=y
|
||||
export CONFIG_COMPAT_BLUETOOTH_MODULES=m
|
||||
endif
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
|
||||
#
|
||||
# CONFIG_COMPAT_FIRMWARE_CLASS definition has no leading whitespace,
|
||||
# because it gets passed-on through compat_autoconf.h.
|
||||
#
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_33
|
||||
ifndef CONFIG_COMPAT_RHEL_6_1
|
||||
ifdef CONFIG_FW_LOADER
|
||||
export CONFIG_COMPAT_FIRMWARE_CLASS=m
|
||||
endif #CONFIG_FW_LOADER
|
||||
endif #CONFIG_COMPAT_RHEL_6_1
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_33
|
||||
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_36
|
||||
ifndef CONFIG_COMPAT_RHEL_6_1
|
||||
export CONFIG_COMPAT_KFIFO=y
|
||||
endif #CONFIG_COMPAT_RHEL_6_1
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_36
|
||||
|
||||
#
|
||||
# CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN definitions have no leading
|
||||
# whitespace, because they get passed-on through compat_autoconf.h.
|
||||
#
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_33
|
||||
export CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_33
|
||||
ifdef CONFIG_COMPAT_RHEL_6_0
|
||||
export CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN=y
|
||||
endif #CONFIG_COMPAT_RHEL_6_0
|
||||
|
||||
#
|
||||
# CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP definition has no leading
|
||||
# whitespace, because it gets passed-on through compat_autoconf.h.
|
||||
#
|
||||
ifdef CONFIG_COMPAT_RHEL_6_0
|
||||
export CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP=y
|
||||
endif #CONFIG_COMPAT_RHEL_6_0
|
||||
|
||||
# Wireless subsystem stuff
|
||||
export CONFIG_MAC80211=m
|
||||
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_33
|
||||
export CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_33
|
||||
|
||||
# CONFIG_MAC80211_DEBUGFS=y
|
||||
# CONFIG_MAC80211_NOINLINE=y
|
||||
# CONFIG_MAC80211_VERBOSE_DEBUG=y
|
||||
# CONFIG_MAC80211_HT_DEBUG=y
|
||||
# CONFIG_MAC80211_TKIP_DEBUG=y
|
||||
# CONFIG_MAC80211_IBSS_DEBUG=y
|
||||
# CONFIG_MAC80211_VERBOSE_PS_DEBUG=y
|
||||
# CONFIG_MAC80211_VERBOSE_MPL_DEBUG=y
|
||||
# CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG=y
|
||||
# CONFIG_MAC80211_VERBOSE_TDLS_DEBUG
|
||||
# CONFIG_MAC80211_DEBUG_COUNTERS=y
|
||||
|
||||
# choose between pid and minstrel as default rate control algorithm
|
||||
export CONFIG_MAC80211_RC_DEFAULT=minstrel_ht
|
||||
export CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
|
||||
# CONFIG_MAC80211_RC_DEFAULT_PID=y
|
||||
# This is the one used by our compat-wireless net/mac80211/rate.c
|
||||
# in case you have and old kernel which is overriding this to pid.
|
||||
export CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstrel_ht
|
||||
export CONFIG_MAC80211_RC_PID=y
|
||||
export CONFIG_MAC80211_RC_MINSTREL=y
|
||||
export CONFIG_MAC80211_RC_MINSTREL_HT=y
|
||||
ifdef CONFIG_LEDS_TRIGGERS
|
||||
export CONFIG_MAC80211_LEDS=y
|
||||
endif #CONFIG_LEDS_TRIGGERS
|
||||
|
||||
# enable mesh networking too
|
||||
export CONFIG_MAC80211_MESH=y
|
||||
|
||||
export CONFIG_CFG80211=m
|
||||
export CONFIG_CFG80211_DEFAULT_PS=y
|
||||
# CONFIG_CFG80211_DEBUGFS=y
|
||||
# CONFIG_NL80211_TESTMODE=y
|
||||
# CONFIG_CFG80211_DEVELOPER_WARNINGS=y
|
||||
# CONFIG_CFG80211_REG_DEBUG=y
|
||||
# CONFIG_CFG80211_INTERNAL_REGDB=y
|
||||
# See below for wext stuff
|
||||
|
||||
export CONFIG_LIB80211=m
|
||||
export CONFIG_LIB80211_CRYPT_WEP=m
|
||||
export CONFIG_LIB80211_CRYPT_CCMP=m
|
||||
export CONFIG_LIB80211_CRYPT_TKIP=m
|
||||
# CONFIG_LIB80211_DEBUG=y
|
||||
|
||||
export CONFIG_BT=m
|
||||
export CONFIG_BT_RFCOMM=m
|
||||
export CONFIG_BT_RFCOMM_TTY=y
|
||||
export CONFIG_BT_BNEP=m
|
||||
export CONFIG_BT_BNEP_MC_FILTER=y
|
||||
export CONFIG_BT_BNEP_PROTO_FILTER=y
|
||||
# CONFIG_BT_CMTP depends on ISDN_CAPI
|
||||
ifdef CONFIG_ISDN_CAPI
|
||||
export CONFIG_BT_CMTP=m
|
||||
endif #CONFIG_ISDN_CAPI
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_28
|
||||
export CONFIG_COMPAT_BT_HIDP=m
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_28
|
||||
|
||||
export CONFIG_BT_HCIUART=M
|
||||
export CONFIG_BT_HCIUART_H4=y
|
||||
export CONFIG_BT_HCIUART_BCSP=y
|
||||
export CONFIG_BT_HCIUART_ATH3K=y
|
||||
export CONFIG_BT_HCIUART_LL=y
|
||||
|
||||
export CONFIG_BT_HCIVHCI=m
|
||||
export CONFIG_BT_MRVL=m
|
||||
|
||||
ifdef CONFIG_PCMCIA
|
||||
export CONFIG_BT_HCIDTL1=m
|
||||
export CONFIG_BT_HCIBT3C=m
|
||||
export CONFIG_BT_HCIBLUECARD=m
|
||||
export CONFIG_BT_HCIBTUART=m
|
||||
endif #CONFIG_PCMCIA
|
||||
|
||||
|
||||
# We need CONFIG_WIRELESS_EXT for CONFIG_CFG80211_WEXT for every kernel
|
||||
# version. The new way CONFIG_CFG80211_WEXT is called from the kernel
|
||||
# does not work with compat-wireless because it calls some callback
|
||||
# function on struct wiphy. This struct is shipped with compat-wireless
|
||||
# and changes from kernel version to version. We are using the
|
||||
# wireless_handlers attribute which will be activated by
|
||||
# CONFIG_WIRELESS_EXT.
|
||||
ifdef CONFIG_WIRELESS_EXT
|
||||
export CONFIG_CFG80211_WEXT=y
|
||||
else #CONFIG_CFG80211_WEXT
|
||||
$(warning "WARNING: CONFIG_CFG80211_WEXT will be deactivated or not working because kernel was compiled with CONFIG_WIRELESS_EXT=n. Tools using wext interface like iwconfig will not work. To activate it build your kernel e.g. with CONFIG_LIBIPW=m.")
|
||||
endif #CONFIG_WIRELESS_EXT
|
||||
|
||||
ifdef CONFIG_STAGING
|
||||
export CONFIG_COMPAT_STAGING=m
|
||||
endif #CONFIG_STAGING
|
||||
|
||||
# mac80211 test driver
|
||||
export CONFIG_MAC80211_HWSIM=m
|
||||
|
||||
export CONFIG_ATH5K=m
|
||||
# CONFIG_ATH5K_DEBUG=y
|
||||
# CONFIG_ATH5K_TRACER=y
|
||||
# CONFIG_ATH5K_AHB=y
|
||||
|
||||
export CONFIG_ATH9K=m
|
||||
export CONFIG_ATH9K_HW=m
|
||||
export CONFIG_ATH9K_COMMON=m
|
||||
# CONFIG_ATH9K_DEBUGFS=y
|
||||
# CONFIG_ATH9K_AHB=y
|
||||
# CONFIG_ATH9K_PKTLOG=y
|
||||
|
||||
# Disable this to get minstrel as default, we leave the ath9k
|
||||
# rate control algorithm as the default for now as that is also
|
||||
# default upstream on the kernel. We will move this to minstrel
|
||||
# as default once we get minstrel properly tested and blessed by
|
||||
# our systems engineering team. CCK rates also need to be used
|
||||
# for long range considerations.
|
||||
export CONFIG_COMPAT_ATH9K_RATE_CONTROL=y
|
||||
|
||||
export CONFIG_ATH9K_BTCOEX_SUPPORT=y
|
||||
|
||||
# PCI Drivers
|
||||
ifdef CONFIG_PCI
|
||||
|
||||
export CONFIG_ATH5K_PCI=y
|
||||
export CONFIG_ATH9K_PCI=y
|
||||
|
||||
export CONFIG_IWLWIFI=m
|
||||
export CONFIG_IWLWIFI_P2P=y
|
||||
# CONFIG_IWLWIFI_DEBUG=y
|
||||
# CONFIG_IWLWIFI_DEBUGFS=y
|
||||
# CONFIG_IWLWIFI_DEVICE_TRACING=y
|
||||
# CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE=y
|
||||
|
||||
export CONFIG_IWLEGACY=m
|
||||
export CONFIG_COMPAT_IWL4965=m
|
||||
export CONFIG_IWL3945=m
|
||||
# CONFIG_IWLEGACY_DEBUG=y
|
||||
# CONFIG_IWLEGACY_DEBUGFS=y
|
||||
|
||||
|
||||
export CONFIG_B43=m
|
||||
export CONFIG_B43_HWRNG=y
|
||||
export CONFIG_B43_PCI_AUTOSELECT=y
|
||||
ifdef CONFIG_PCMCIA
|
||||
export CONFIG_B43_PCMCIA=y
|
||||
endif #CONFIG_PCMCIA
|
||||
ifdef CONFIG_MAC80211_LEDS
|
||||
export CONFIG_B43_LEDS=y
|
||||
endif #CONFIG_MAC80211_LEDS
|
||||
export CONFIG_B43_PHY_LP=y
|
||||
export CONFIG_B43_PHY_N=y
|
||||
export CONFIG_B43_PHY_HT=y
|
||||
# CONFIG_B43_PHY_LCN=y
|
||||
# CONFIG_B43_DEBUG=y
|
||||
|
||||
export CONFIG_B43LEGACY=m
|
||||
export CONFIG_B43LEGACY_HWRNG=y
|
||||
export CONFIG_B43LEGACY_PCI_AUTOSELECT=y
|
||||
ifdef CONFIG_MAC80211_LEDS
|
||||
export CONFIG_B43LEGACY_LEDS=y
|
||||
endif #CONFIG_MAC80211_LEDS
|
||||
# CONFIG_B43LEGACY_DEBUG=y
|
||||
export CONFIG_B43LEGACY_DMA=y
|
||||
export CONFIG_B43LEGACY_PIO=y
|
||||
|
||||
ifdef CONFIG_WIRELESS_EXT
|
||||
# The Intel ipws
|
||||
export CONFIG_LIBIPW=m
|
||||
# CONFIG_LIBIPW_DEBUG=y
|
||||
|
||||
export CONFIG_IPW2100=m
|
||||
export CONFIG_IPW2100_MONITOR=y
|
||||
# CONFIG_IPW2100_DEBUG=y
|
||||
export CONFIG_IPW2200=m
|
||||
export CONFIG_IPW2200_MONITOR=y
|
||||
export CONFIG_IPW2200_RADIOTAP=y
|
||||
export CONFIG_IPW2200_PROMISCUOUS=y
|
||||
export CONFIG_IPW2200_QOS=y
|
||||
# CONFIG_IPW2200_DEBUG=y
|
||||
# The above enables use a second interface prefixed 'rtap'.
|
||||
# Example usage:
|
||||
#
|
||||
# % modprobe ipw2200 rtap_iface=1
|
||||
# % ifconfig rtap0 up
|
||||
# % tethereal -i rtap0
|
||||
#
|
||||
# If you do not specify 'rtap_iface=1' as a module parameter then
|
||||
# the rtap interface will not be created and you will need to turn
|
||||
# it on via sysfs:
|
||||
#
|
||||
# % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface
|
||||
endif #CONFIG_WIRELESS_EXT
|
||||
|
||||
ifdef CONFIG_SSB
|
||||
# Sonics Silicon Backplane
|
||||
export CONFIG_SSB_SPROM=y
|
||||
|
||||
export CONFIG_SSB_BLOCKIO=y
|
||||
export CONFIG_SSB_PCIHOST=y
|
||||
export CONFIG_SSB_B43_PCI_BRIDGE=y
|
||||
ifdef CONFIG_PCMCIA
|
||||
export CONFIG_SSB_PCMCIAHOST=y
|
||||
endif #CONFIG_PCMCIA
|
||||
# CONFIG_SSB_DEBUG=y
|
||||
export CONFIG_SSB_DRIVER_PCICORE=y
|
||||
export CONFIG_B43_SSB=y
|
||||
endif #CONFIG_SSB
|
||||
|
||||
export CONFIG_BCMA=m
|
||||
export CONFIG_BCMA_BLOCKIO=y
|
||||
export CONFIG_BCMA_HOST_PCI=y
|
||||
# CONFIG_BCMA_DEBUG=y
|
||||
export CONFIG_B43_BCMA=y
|
||||
export CONFIG_B43_BCMA_EXTRA=y
|
||||
|
||||
export CONFIG_P54_PCI=m
|
||||
|
||||
export CONFIG_B44=m
|
||||
export CONFIG_B44_PCI=y
|
||||
|
||||
export CONFIG_RTL8180=m
|
||||
|
||||
export CONFIG_ADM8211=m
|
||||
|
||||
export CONFIG_RT2X00_LIB_PCI=m
|
||||
export CONFIG_RT2400PCI=m
|
||||
export CONFIG_RT2500PCI=m
|
||||
ifdef CONFIG_CRC_CCITT
|
||||
export CONFIG_RT2800PCI=m
|
||||
export CONFIG_RT2800PCI_RT33XX=y
|
||||
export CONFIG_RT2800PCI_RT35XX=y
|
||||
export CONFIG_RT2800PCI_RT53XX=y
|
||||
endif #CONFIG_CRC_CCITT
|
||||
NEED_RT2X00=y
|
||||
|
||||
# Two rt2x00 drivers require firmware: rt61pci and rt73usb. They depend on
|
||||
# CRC to check the firmware. We check here first for the PCI
|
||||
# driver as we're in the PCI section.
|
||||
ifdef CONFIG_CRC_ITU_T
|
||||
export CONFIG_RT61PCI=m
|
||||
endif #CONFIG_CRC_ITU_T
|
||||
|
||||
export CONFIG_MWL8K=m
|
||||
|
||||
# Ethernet drivers go here
|
||||
export CONFIG_ATL1=m
|
||||
export CONFIG_ATL2=m
|
||||
export CONFIG_ATL1E=m
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_ATL1C=n
|
||||
export CONFIG_ALX=m
|
||||
else #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_ATL1C=n
|
||||
export CONFIG_ALX=m
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
|
||||
ifdef CONFIG_WIRELESS_EXT
|
||||
export CONFIG_HERMES=m
|
||||
export CONFIG_HERMES_CACHE_FW_ON_INIT=y
|
||||
ifdef CONFIG_PPC_PMAC
|
||||
export CONFIG_APPLE_AIRPORT=m
|
||||
endif #CONFIG_PPC_PMAC
|
||||
export CONFIG_PLX_HERMES=m
|
||||
export CONFIG_TMD_HERMES=m
|
||||
export CONFIG_NORTEL_HERMES=m
|
||||
export CONFIG_PCI_HERMES=m
|
||||
ifdef CONFIG_PCMCIA
|
||||
export CONFIG_PCMCIA_HERMES=m
|
||||
export CONFIG_PCMCIA_SPECTRUM=m
|
||||
endif #CONFIG_PCMCIA
|
||||
endif #CONFIG_WIRELESS_EXT
|
||||
|
||||
export CONFIG_RTL8192CE=m
|
||||
export CONFIG_RTL8192SE=m
|
||||
export CONFIG_RTL8192DE=m
|
||||
|
||||
export CONFIG_BRCMSMAC=m
|
||||
|
||||
export CONFIG_MWIFIEX_PCIE=m
|
||||
|
||||
endif #CONFIG_PCI
|
||||
## end of PCI
|
||||
|
||||
ifdef CONFIG_PCMCIA
|
||||
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_LIBERTAS=n
|
||||
export CONFIG_LIBERTAS_CS=n
|
||||
else #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_LIBERTAS_CS=m
|
||||
NEED_LIBERTAS=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
|
||||
endif #CONFIG_PCMCIA
|
||||
## end of PCMCIA
|
||||
|
||||
# This is required for some cards
|
||||
export CONFIG_EEPROM_93CX6=m
|
||||
|
||||
# USB Drivers
|
||||
ifdef CONFIG_USB
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_29
|
||||
export CONFIG_COMPAT_ZD1211RW=m
|
||||
# CONFIG_ZD1211RW_DEBUG=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_29
|
||||
|
||||
# Sorry, rndis_wlan uses cancel_work_sync which is new and can't be done in compat...
|
||||
|
||||
# Wireless RNDIS USB support (RTL8185 802.11g) A-Link WL54PC
|
||||
# All of these devices are based on Broadcom 4320 chip which
|
||||
# is only wireless RNDIS chip known to date.
|
||||
# Note: this depends on CONFIG_USB_NET_RNDIS_HOST and CONFIG_USB_NET_CDCETHER
|
||||
# it also requires new RNDIS_HOST and CDC_ETHER modules which we add
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_29
|
||||
export CONFIG_USB_COMPAT_USBNET=n
|
||||
export CONFIG_USB_NET_COMPAT_RNDIS_HOST=n
|
||||
export CONFIG_USB_NET_COMPAT_RNDIS_WLAN=n
|
||||
export CONFIG_USB_NET_COMPAT_CDCETHER=n
|
||||
else #CONFIG_COMPAT_KERNEL_2_6_29
|
||||
export CONFIG_USB_COMPAT_USBNET=m
|
||||
ifdef CONFIG_USB_NET_CDCETHER
|
||||
export CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
|
||||
export CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m
|
||||
endif #CONFIG_USB_NET_CDCETHER
|
||||
ifdef CONFIG_USB_NET_CDCETHER_MODULE
|
||||
export CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
|
||||
export CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m
|
||||
endif #CONFIG_USB_NET_CDCETHER
|
||||
export CONFIG_USB_NET_COMPAT_CDCETHER=m
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_29
|
||||
|
||||
|
||||
export CONFIG_P54_USB=m
|
||||
export CONFIG_RTL8187=m
|
||||
ifdef CONFIG_MAC80211_LEDS
|
||||
export CONFIG_RTL8187_LEDS=y
|
||||
endif #CONFIG_MAC80211_LEDS
|
||||
|
||||
export CONFIG_AT76C50X_USB=m
|
||||
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_29
|
||||
export CONFIG_CARL9170=m
|
||||
ifdef CONFIG_MAC80211_LEDS
|
||||
export CONFIG_CARL9170_LEDS=y
|
||||
endif #CONFIG_MAC80211_LEDS
|
||||
# CONFIG_CARL9170_DEBUGFS=y
|
||||
export CONFIG_CARL9170_WPC=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_29
|
||||
|
||||
# This activates a threading fix for usb urb.
|
||||
# this is mainline commit: b3e670443b7fb8a2d29831b62b44a039c283e351
|
||||
# This fix will be included in some stable releases.
|
||||
export CONFIG_COMPAT_USB_URB_THREAD_FIX=y
|
||||
|
||||
export CONFIG_ATH9K_HTC=m
|
||||
# CONFIG_ATH9K_HTC_DEBUGFS=y
|
||||
|
||||
# RT2500USB does not require firmware
|
||||
export CONFIG_RT2500USB=m
|
||||
ifdef CONFIG_CRC_CCITT
|
||||
export CONFIG_RT2800USB=m
|
||||
export CONFIG_RT2800USB_RT33XX=y
|
||||
export CONFIG_RT2800USB_RT35XX=y
|
||||
export CONFIG_RT2800USB_RT53XX=y
|
||||
export CONFIG_RT2800USB_UNKNOWN=y
|
||||
endif #CONFIG_CRC_CCITT
|
||||
export CONFIG_RT2X00_LIB_USB=m
|
||||
NEED_RT2X00=y
|
||||
# RT73USB requires firmware
|
||||
ifdef CONFIG_CRC_ITU_T
|
||||
export CONFIG_RT73USB=m
|
||||
endif #CONFIG_CRC_ITU_T
|
||||
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_LIBERTAS_THINFIRM_USB=n
|
||||
export CONFIG_LIBERTAS_USB=n
|
||||
NEED_LIBERTAS=n
|
||||
else #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_LIBERTAS_THINFIRM_USB=m
|
||||
export CONFIG_LIBERTAS_USB=m
|
||||
NEED_LIBERTAS=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
|
||||
export CONFIG_ORINOCO_USB=m
|
||||
|
||||
export CONFIG_BT_HCIBTUSB=m
|
||||
export CONFIG_BT_HCIBCM203X=m
|
||||
export CONFIG_BT_HCIBPA10X=m
|
||||
export CONFIG_BT_HCIBFUSB=m
|
||||
export CONFIG_BT_ATH3K=m
|
||||
|
||||
export CONFIG_RTL8192CU=m
|
||||
|
||||
endif #CONFIG_USB end of USB driver list
|
||||
|
||||
ifdef CONFIG_SPI_MASTER
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_25
|
||||
|
||||
ifdef CONFIG_CRC7
|
||||
export CONFIG_WL1251_SPI=m
|
||||
export CONFIG_WL12XX_SPI=m
|
||||
endif #CONFIG_CRC7
|
||||
export CONFIG_P54_SPI=m
|
||||
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_LIBERTAS_SPI=n
|
||||
NEED_LIBERTAS=n
|
||||
else #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_LIBERTAS_SPI=m
|
||||
NEED_LIBERTAS=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_25
|
||||
endif #CONFIG_SPI_MASTER end of SPI driver list
|
||||
|
||||
ifdef CONFIG_MMC
|
||||
|
||||
export CONFIG_SSB_SDIOHOST=y
|
||||
export CONFIG_B43_SDIO=y
|
||||
|
||||
ifdef CONFIG_CRC7
|
||||
ifdef CONFIG_WL12XX_PLATFORM_DATA
|
||||
export CONFIG_COMPAT_WL1251_SDIO=m
|
||||
endif #CONFIG_WL12XX_PLATFORM_DATA
|
||||
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_32
|
||||
ifdef CONFIG_WL12XX_PLATFORM_DATA
|
||||
export CONFIG_COMPAT_WL12XX_SDIO=m
|
||||
endif #CONFIG_WL12XX_PLATFORM_DATA
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_32
|
||||
|
||||
endif #CONFIG_CRC7
|
||||
|
||||
export CONFIG_MWIFIEX_SDIO=m
|
||||
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_32
|
||||
export CONFIG_COMPAT_LIBERTAS_SDIO=m
|
||||
NEED_LIBERTAS=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_32
|
||||
|
||||
export CONFIG_IWM=m
|
||||
# CONFIG_IWM_DEBUG=y
|
||||
# CONFIG_IWM_TRACING=y
|
||||
|
||||
export CONFIG_BT_HCIBTSDIO=m
|
||||
export CONFIG_BT_MRVL_SDIO=m
|
||||
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_ATH6KL=m
|
||||
# CONFIG_ATH6KL_DEBUG=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
|
||||
ifndef CONFIG_COMPAT_KERNEL_2_6_29
|
||||
export CONFIG_BRCMFMAC=m
|
||||
export CONFIG_BRCMFMAC_SDIO=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_29
|
||||
|
||||
endif #CONFIG_MMC
|
||||
|
||||
export CONFIG_RTLWIFI=m
|
||||
export CONFIG_RTL8192C_COMMON=m
|
||||
|
||||
# Common rt2x00 requirements
|
||||
ifeq ($(NEED_RT2X00),y)
|
||||
export CONFIG_RT2X00=y
|
||||
export CONFIG_RT2X00_LIB=m
|
||||
export CONFIG_RT2800_LIB=m
|
||||
export CONFIG_RT2X00_LIB_FIRMWARE=y
|
||||
export CONFIG_RT2X00_LIB_CRYPTO=y
|
||||
# CONFIG_RT2X00_LIB_SOC=y
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_25
|
||||
export CONFIG_RT2X00_LIB_LEDS=n
|
||||
else #CONFIG_COMPAT_KERNEL_2_6_25
|
||||
ifdef CONFIG_LEDS_CLASS
|
||||
export CONFIG_RT2X00_LIB_LEDS=y
|
||||
endif #CONFIG_LEDS_CLASS
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_25
|
||||
# CONFIG_RT2X00_DEBUG=y
|
||||
# CONFIG_RT2X00_LIB_DEBUGFS=y
|
||||
endif
|
||||
|
||||
# p54
|
||||
export CONFIG_P54_COMMON=m
|
||||
ifdef CONFIG_MAC80211_LEDS
|
||||
export CONFIG_P54_LEDS=y
|
||||
endif #CONFIG_MAC80211_LEDS
|
||||
|
||||
# Atheros
|
||||
export CONFIG_ATH_COMMON=m
|
||||
# CONFIG_ATH_DEBUG=y
|
||||
|
||||
export CONFIG_BRCMUTIL=m
|
||||
# CONFIG_BRCMDBG=y
|
||||
|
||||
ifdef CONFIG_CRC7
|
||||
export CONFIG_WL1251=m
|
||||
export CONFIG_WL12XX=m
|
||||
endif #CONFIG_CRC7
|
||||
|
||||
export CONFIG_MWIFIEX=m
|
||||
|
||||
ifndef CONFIG_CORDIC
|
||||
export CONFIG_COMPAT_CORDIC=y
|
||||
endif #CONFIG_CORDIC
|
||||
|
||||
ifndef CONFIG_CRC8
|
||||
export CONFIG_COMPAT_CRC8=y
|
||||
endif #CONFIG_CRC8
|
||||
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_27
|
||||
export CONFIG_LIBERTAS=n
|
||||
else #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
ifeq ($(NEED_LIBERTAS),y)
|
||||
export CONFIG_LIBERTAS_THINFIRM=m
|
||||
export CONFIG_LIBERTAS=m
|
||||
export CONFIG_LIBERTAS_MESH=y
|
||||
# CONFIG_LIBERTAS_DEBUG=y
|
||||
endif
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_27
|
||||
|
||||
# We need the backported rfkill module on kernel < 2.6.31.
|
||||
# In more recent kernel versions use the in kernel rfkill module.
|
||||
ifdef CONFIG_COMPAT_KERNEL_2_6_31
|
||||
export CONFIG_RFKILL_BACKPORT=m
|
||||
ifdef CONFIG_LEDS_TRIGGERS
|
||||
export CONFIG_RFKILL_BACKPORT_LEDS=y
|
||||
endif #CONFIG_LEDS_TRIGGERS
|
||||
export CONFIG_RFKILL_BACKPORT_INPUT=y
|
||||
endif #CONFIG_COMPAT_KERNEL_2_6_31
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#include <linux/version.h>
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
|
||||
#include <pcmcia/cs_types.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
|
||||
#include <pcmcia/cs.h>
|
||||
#endif
|
||||
|
||||
#include_next <pcmcia/cistpl.h>
|
||||
@@ -1,5 +0,0 @@
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
|
||||
#include_next <trace/define_trace.h>
|
||||
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) */
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef _COMPAT_CRYPTO_AES_H
|
||||
#define _COMPAT_CRYPTO_AES_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24))
|
||||
#include_next <crypto/aes.h>
|
||||
#else
|
||||
|
||||
#define AES_MIN_KEY_SIZE 16
|
||||
#define AES_MAX_KEY_SIZE 32
|
||||
#define AES_KEYSIZE_128 16
|
||||
#define AES_KEYSIZE_192 24
|
||||
#define AES_KEYSIZE_256 32
|
||||
#define AES_BLOCK_SIZE 16
|
||||
#define AES_MAX_KEYLENGTH (15 * 16)
|
||||
#define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32))
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24)) */
|
||||
|
||||
#endif
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_ATH9K_PLATFORM_H
|
||||
#define _LINUX_ATH9K_PLATFORM_H
|
||||
|
||||
#define ATH9K_PLAT_EEP_MAX_WORDS 2048
|
||||
|
||||
struct ath9k_platform_data {
|
||||
u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
|
||||
u8 *macaddr;
|
||||
|
||||
int led_pin;
|
||||
u32 gpio_mask;
|
||||
u32 gpio_val;
|
||||
|
||||
bool is_clk_25mhz;
|
||||
int (*get_mac_revision)(void);
|
||||
int (*external_reset)(void);
|
||||
};
|
||||
|
||||
#endif /* _LINUX_ATH9K_PLATFORM_H */
|
||||
@@ -1,46 +0,0 @@
|
||||
#ifndef _COMPAT_LINUX_ATOMIC_H
|
||||
#define _COMPAT_LINUX_ATOMIC_H 1
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
|
||||
#include_next <linux/atomic.h>
|
||||
#else
|
||||
|
||||
#include <asm/atomic.h>
|
||||
|
||||
/**
|
||||
* atomic_inc_not_zero_hint - increment if not null
|
||||
* @v: pointer of type atomic_t
|
||||
* @hint: probable value of the atomic before the increment
|
||||
*
|
||||
* This version of atomic_inc_not_zero() gives a hint of probable
|
||||
* value of the atomic. This helps processor to not read the memory
|
||||
* before doing the atomic read/modify/write cycle, lowering
|
||||
* number of bus transactions on some arches.
|
||||
*
|
||||
* Returns: 0 if increment was not done, 1 otherwise.
|
||||
*/
|
||||
#ifndef atomic_inc_not_zero_hint
|
||||
static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint)
|
||||
{
|
||||
int val, c = hint;
|
||||
|
||||
/* sanity test, should be removed by compiler if hint is a constant */
|
||||
if (!hint)
|
||||
return atomic_inc_not_zero(v);
|
||||
|
||||
do {
|
||||
val = atomic_cmpxchg(v, c, c + 1);
|
||||
if (val == c)
|
||||
return 1;
|
||||
c = val;
|
||||
} while (c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) */
|
||||
|
||||
#endif /* _COMPAT_LINUX_ATOMIC_H */
|
||||
@@ -1,5 +0,0 @@
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
|
||||
#include_next <linux/average.h>
|
||||
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37)) */
|
||||
@@ -1,307 +0,0 @@
|
||||
#ifndef LINUX_BCMA_H_
|
||||
#define LINUX_BCMA_H_
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
|
||||
#include <linux/bcma/bcma_driver_chipcommon.h>
|
||||
#include <linux/bcma/bcma_driver_pci.h>
|
||||
#include <linux/bcma/bcma_driver_mips.h>
|
||||
#include <linux/ssb/ssb.h> /* SPROM sharing */
|
||||
|
||||
#include "bcma_regs.h"
|
||||
|
||||
struct bcma_device;
|
||||
struct bcma_bus;
|
||||
|
||||
enum bcma_hosttype {
|
||||
BCMA_HOSTTYPE_PCI,
|
||||
BCMA_HOSTTYPE_SDIO,
|
||||
BCMA_HOSTTYPE_SOC,
|
||||
};
|
||||
|
||||
struct bcma_chipinfo {
|
||||
u16 id;
|
||||
u8 rev;
|
||||
u8 pkg;
|
||||
};
|
||||
|
||||
enum bcma_clkmode {
|
||||
BCMA_CLKMODE_FAST,
|
||||
BCMA_CLKMODE_DYNAMIC,
|
||||
};
|
||||
|
||||
struct bcma_host_ops {
|
||||
u8 (*read8)(struct bcma_device *core, u16 offset);
|
||||
u16 (*read16)(struct bcma_device *core, u16 offset);
|
||||
u32 (*read32)(struct bcma_device *core, u16 offset);
|
||||
void (*write8)(struct bcma_device *core, u16 offset, u8 value);
|
||||
void (*write16)(struct bcma_device *core, u16 offset, u16 value);
|
||||
void (*write32)(struct bcma_device *core, u16 offset, u32 value);
|
||||
#ifdef CONFIG_BCMA_BLOCKIO
|
||||
void (*block_read)(struct bcma_device *core, void *buffer,
|
||||
size_t count, u16 offset, u8 reg_width);
|
||||
void (*block_write)(struct bcma_device *core, const void *buffer,
|
||||
size_t count, u16 offset, u8 reg_width);
|
||||
#endif
|
||||
/* Agent ops */
|
||||
u32 (*aread32)(struct bcma_device *core, u16 offset);
|
||||
void (*awrite32)(struct bcma_device *core, u16 offset, u32 value);
|
||||
};
|
||||
|
||||
/* Core manufacturers */
|
||||
#define BCMA_MANUF_ARM 0x43B
|
||||
#define BCMA_MANUF_MIPS 0x4A7
|
||||
#define BCMA_MANUF_BCM 0x4BF
|
||||
|
||||
/* Core class values. */
|
||||
#define BCMA_CL_SIM 0x0
|
||||
#define BCMA_CL_EROM 0x1
|
||||
#define BCMA_CL_CORESIGHT 0x9
|
||||
#define BCMA_CL_VERIF 0xB
|
||||
#define BCMA_CL_OPTIMO 0xD
|
||||
#define BCMA_CL_GEN 0xE
|
||||
#define BCMA_CL_PRIMECELL 0xF
|
||||
|
||||
/* Core-ID values. */
|
||||
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
|
||||
#define BCMA_CORE_INVALID 0x700
|
||||
#define BCMA_CORE_CHIPCOMMON 0x800
|
||||
#define BCMA_CORE_ILINE20 0x801
|
||||
#define BCMA_CORE_SRAM 0x802
|
||||
#define BCMA_CORE_SDRAM 0x803
|
||||
#define BCMA_CORE_PCI 0x804
|
||||
#define BCMA_CORE_MIPS 0x805
|
||||
#define BCMA_CORE_ETHERNET 0x806
|
||||
#define BCMA_CORE_V90 0x807
|
||||
#define BCMA_CORE_USB11_HOSTDEV 0x808
|
||||
#define BCMA_CORE_ADSL 0x809
|
||||
#define BCMA_CORE_ILINE100 0x80A
|
||||
#define BCMA_CORE_IPSEC 0x80B
|
||||
#define BCMA_CORE_UTOPIA 0x80C
|
||||
#define BCMA_CORE_PCMCIA 0x80D
|
||||
#define BCMA_CORE_INTERNAL_MEM 0x80E
|
||||
#define BCMA_CORE_MEMC_SDRAM 0x80F
|
||||
#define BCMA_CORE_OFDM 0x810
|
||||
#define BCMA_CORE_EXTIF 0x811
|
||||
#define BCMA_CORE_80211 0x812
|
||||
#define BCMA_CORE_PHY_A 0x813
|
||||
#define BCMA_CORE_PHY_B 0x814
|
||||
#define BCMA_CORE_PHY_G 0x815
|
||||
#define BCMA_CORE_MIPS_3302 0x816
|
||||
#define BCMA_CORE_USB11_HOST 0x817
|
||||
#define BCMA_CORE_USB11_DEV 0x818
|
||||
#define BCMA_CORE_USB20_HOST 0x819
|
||||
#define BCMA_CORE_USB20_DEV 0x81A
|
||||
#define BCMA_CORE_SDIO_HOST 0x81B
|
||||
#define BCMA_CORE_ROBOSWITCH 0x81C
|
||||
#define BCMA_CORE_PARA_ATA 0x81D
|
||||
#define BCMA_CORE_SATA_XORDMA 0x81E
|
||||
#define BCMA_CORE_ETHERNET_GBIT 0x81F
|
||||
#define BCMA_CORE_PCIE 0x820
|
||||
#define BCMA_CORE_PHY_N 0x821
|
||||
#define BCMA_CORE_SRAM_CTL 0x822
|
||||
#define BCMA_CORE_MINI_MACPHY 0x823
|
||||
#define BCMA_CORE_ARM_1176 0x824
|
||||
#define BCMA_CORE_ARM_7TDMI 0x825
|
||||
#define BCMA_CORE_PHY_LP 0x826
|
||||
#define BCMA_CORE_PMU 0x827
|
||||
#define BCMA_CORE_PHY_SSN 0x828
|
||||
#define BCMA_CORE_SDIO_DEV 0x829
|
||||
#define BCMA_CORE_ARM_CM3 0x82A
|
||||
#define BCMA_CORE_PHY_HT 0x82B
|
||||
#define BCMA_CORE_MIPS_74K 0x82C
|
||||
#define BCMA_CORE_MAC_GBIT 0x82D
|
||||
#define BCMA_CORE_DDR12_MEM_CTL 0x82E
|
||||
#define BCMA_CORE_PCIE_RC 0x82F /* PCIe Root Complex */
|
||||
#define BCMA_CORE_OCP_OCP_BRIDGE 0x830
|
||||
#define BCMA_CORE_SHARED_COMMON 0x831
|
||||
#define BCMA_CORE_OCP_AHB_BRIDGE 0x832
|
||||
#define BCMA_CORE_SPI_HOST 0x833
|
||||
#define BCMA_CORE_I2S 0x834
|
||||
#define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */
|
||||
#define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */
|
||||
#define BCMA_CORE_DEFAULT 0xFFF
|
||||
|
||||
#define BCMA_MAX_NR_CORES 16
|
||||
|
||||
struct bcma_device {
|
||||
struct bcma_bus *bus;
|
||||
struct bcma_device_id id;
|
||||
|
||||
struct device dev;
|
||||
struct device *dma_dev;
|
||||
|
||||
unsigned int irq;
|
||||
bool dev_registered;
|
||||
|
||||
u8 core_index;
|
||||
u8 core_unit;
|
||||
|
||||
u32 addr;
|
||||
u32 wrap;
|
||||
|
||||
void __iomem *io_addr;
|
||||
void __iomem *io_wrap;
|
||||
|
||||
void *drvdata;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
static inline void *bcma_get_drvdata(struct bcma_device *core)
|
||||
{
|
||||
return core->drvdata;
|
||||
}
|
||||
static inline void bcma_set_drvdata(struct bcma_device *core, void *drvdata)
|
||||
{
|
||||
core->drvdata = drvdata;
|
||||
}
|
||||
|
||||
struct bcma_driver {
|
||||
const char *name;
|
||||
const struct bcma_device_id *id_table;
|
||||
|
||||
int (*probe)(struct bcma_device *dev);
|
||||
void (*remove)(struct bcma_device *dev);
|
||||
int (*suspend)(struct bcma_device *dev);
|
||||
int (*resume)(struct bcma_device *dev);
|
||||
void (*shutdown)(struct bcma_device *dev);
|
||||
|
||||
struct device_driver drv;
|
||||
};
|
||||
extern
|
||||
int __bcma_driver_register(struct bcma_driver *drv, struct module *owner);
|
||||
#define bcma_driver_register(drv) \
|
||||
__bcma_driver_register(drv, THIS_MODULE)
|
||||
|
||||
extern void bcma_driver_unregister(struct bcma_driver *drv);
|
||||
|
||||
/* Set a fallback SPROM.
|
||||
* See kdoc at the function definition for complete documentation. */
|
||||
extern int bcma_arch_register_fallback_sprom(
|
||||
int (*sprom_callback)(struct bcma_bus *bus,
|
||||
struct ssb_sprom *out));
|
||||
|
||||
struct bcma_bus {
|
||||
/* The MMIO area. */
|
||||
void __iomem *mmio;
|
||||
|
||||
const struct bcma_host_ops *ops;
|
||||
|
||||
enum bcma_hosttype hosttype;
|
||||
union {
|
||||
/* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */
|
||||
struct pci_dev *host_pci;
|
||||
/* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
|
||||
struct sdio_func *host_sdio;
|
||||
};
|
||||
|
||||
struct bcma_chipinfo chipinfo;
|
||||
|
||||
struct bcma_device *mapped_core;
|
||||
struct list_head cores;
|
||||
u8 nr_cores;
|
||||
u8 init_done:1;
|
||||
u8 num;
|
||||
|
||||
struct bcma_drv_cc drv_cc;
|
||||
struct bcma_drv_pci drv_pci;
|
||||
struct bcma_drv_mips drv_mips;
|
||||
|
||||
/* We decided to share SPROM struct with SSB as long as we do not need
|
||||
* any hacks for BCMA. This simplifies drivers code. */
|
||||
struct ssb_sprom sprom;
|
||||
};
|
||||
|
||||
static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->read8(core, offset);
|
||||
}
|
||||
static inline u32 bcma_read16(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->read16(core, offset);
|
||||
}
|
||||
static inline u32 bcma_read32(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->read32(core, offset);
|
||||
}
|
||||
static inline
|
||||
void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->write8(core, offset, value);
|
||||
}
|
||||
static inline
|
||||
void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->write16(core, offset, value);
|
||||
}
|
||||
static inline
|
||||
void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->write32(core, offset, value);
|
||||
}
|
||||
#ifdef CONFIG_BCMA_BLOCKIO
|
||||
static inline void bcma_block_read(struct bcma_device *core, void *buffer,
|
||||
size_t count, u16 offset, u8 reg_width)
|
||||
{
|
||||
core->bus->ops->block_read(core, buffer, count, offset, reg_width);
|
||||
}
|
||||
static inline void bcma_block_write(struct bcma_device *core,
|
||||
const void *buffer, size_t count,
|
||||
u16 offset, u8 reg_width)
|
||||
{
|
||||
core->bus->ops->block_write(core, buffer, count, offset, reg_width);
|
||||
}
|
||||
#endif
|
||||
static inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->aread32(core, offset);
|
||||
}
|
||||
static inline
|
||||
void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->awrite32(core, offset, value);
|
||||
}
|
||||
|
||||
static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask)
|
||||
{
|
||||
bcma_write32(cc, offset, bcma_read32(cc, offset) & mask);
|
||||
}
|
||||
static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set)
|
||||
{
|
||||
bcma_write32(cc, offset, bcma_read32(cc, offset) | set);
|
||||
}
|
||||
static inline void bcma_maskset32(struct bcma_device *cc,
|
||||
u16 offset, u32 mask, u32 set)
|
||||
{
|
||||
bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set);
|
||||
}
|
||||
static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask)
|
||||
{
|
||||
bcma_write16(cc, offset, bcma_read16(cc, offset) & mask);
|
||||
}
|
||||
static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set)
|
||||
{
|
||||
bcma_write16(cc, offset, bcma_read16(cc, offset) | set);
|
||||
}
|
||||
static inline void bcma_maskset16(struct bcma_device *cc,
|
||||
u16 offset, u16 mask, u16 set)
|
||||
{
|
||||
bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
|
||||
}
|
||||
|
||||
extern struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid);
|
||||
extern bool bcma_core_is_enabled(struct bcma_device *core);
|
||||
extern void bcma_core_disable(struct bcma_device *core, u32 flags);
|
||||
extern int bcma_core_enable(struct bcma_device *core, u32 flags);
|
||||
extern void bcma_core_set_clockmode(struct bcma_device *core,
|
||||
enum bcma_clkmode clkmode);
|
||||
extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
|
||||
bool on);
|
||||
#define BCMA_DMA_TRANSLATION_MASK 0xC0000000
|
||||
#define BCMA_DMA_TRANSLATION_NONE 0x00000000
|
||||
#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */
|
||||
#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */
|
||||
extern u32 bcma_core_dma_translation(struct bcma_device *core);
|
||||
|
||||
#endif /* LINUX_BCMA_H_ */
|
||||
@@ -1,415 +0,0 @@
|
||||
#ifndef LINUX_BCMA_DRIVER_CC_H_
|
||||
#define LINUX_BCMA_DRIVER_CC_H_
|
||||
|
||||
/** ChipCommon core registers. **/
|
||||
#define BCMA_CC_ID 0x0000
|
||||
#define BCMA_CC_ID_ID 0x0000FFFF
|
||||
#define BCMA_CC_ID_ID_SHIFT 0
|
||||
#define BCMA_CC_ID_REV 0x000F0000
|
||||
#define BCMA_CC_ID_REV_SHIFT 16
|
||||
#define BCMA_CC_ID_PKG 0x00F00000
|
||||
#define BCMA_CC_ID_PKG_SHIFT 20
|
||||
#define BCMA_CC_ID_NRCORES 0x0F000000
|
||||
#define BCMA_CC_ID_NRCORES_SHIFT 24
|
||||
#define BCMA_CC_ID_TYPE 0xF0000000
|
||||
#define BCMA_CC_ID_TYPE_SHIFT 28
|
||||
#define BCMA_CC_CAP 0x0004 /* Capabilities */
|
||||
#define BCMA_CC_CAP_NRUART 0x00000003 /* # of UARTs */
|
||||
#define BCMA_CC_CAP_MIPSEB 0x00000004 /* MIPS in BigEndian Mode */
|
||||
#define BCMA_CC_CAP_UARTCLK 0x00000018 /* UART clock select */
|
||||
#define BCMA_CC_CAP_UARTCLK_INT 0x00000008 /* UARTs are driven by internal divided clock */
|
||||
#define BCMA_CC_CAP_UARTGPIO 0x00000020 /* UARTs on GPIO 15-12 */
|
||||
#define BCMA_CC_CAP_EXTBUS 0x000000C0 /* External buses present */
|
||||
#define BCMA_CC_CAP_FLASHT 0x00000700 /* Flash Type */
|
||||
#define BCMA_CC_FLASHT_NONE 0x00000000 /* No flash */
|
||||
#define BCMA_CC_FLASHT_STSER 0x00000100 /* ST serial flash */
|
||||
#define BCMA_CC_FLASHT_ATSER 0x00000200 /* Atmel serial flash */
|
||||
#define BCMA_CC_FLASHT_NFLASH 0x00000200
|
||||
#define BCMA_CC_FLASHT_PARA 0x00000700 /* Parallel flash */
|
||||
#define BCMA_CC_CAP_PLLT 0x00038000 /* PLL Type */
|
||||
#define BCMA_PLLTYPE_NONE 0x00000000
|
||||
#define BCMA_PLLTYPE_1 0x00010000 /* 48Mhz base, 3 dividers */
|
||||
#define BCMA_PLLTYPE_2 0x00020000 /* 48Mhz, 4 dividers */
|
||||
#define BCMA_PLLTYPE_3 0x00030000 /* 25Mhz, 2 dividers */
|
||||
#define BCMA_PLLTYPE_4 0x00008000 /* 48Mhz, 4 dividers */
|
||||
#define BCMA_PLLTYPE_5 0x00018000 /* 25Mhz, 4 dividers */
|
||||
#define BCMA_PLLTYPE_6 0x00028000 /* 100/200 or 120/240 only */
|
||||
#define BCMA_PLLTYPE_7 0x00038000 /* 25Mhz, 4 dividers */
|
||||
#define BCMA_CC_CAP_PCTL 0x00040000 /* Power Control */
|
||||
#define BCMA_CC_CAP_OTPS 0x00380000 /* OTP size */
|
||||
#define BCMA_CC_CAP_OTPS_SHIFT 19
|
||||
#define BCMA_CC_CAP_OTPS_BASE 5
|
||||
#define BCMA_CC_CAP_JTAGM 0x00400000 /* JTAG master present */
|
||||
#define BCMA_CC_CAP_BROM 0x00800000 /* Internal boot ROM active */
|
||||
#define BCMA_CC_CAP_64BIT 0x08000000 /* 64-bit Backplane */
|
||||
#define BCMA_CC_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */
|
||||
#define BCMA_CC_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */
|
||||
#define BCMA_CC_CAP_SPROM 0x40000000 /* SPROM present */
|
||||
#define BCMA_CC_CORECTL 0x0008
|
||||
#define BCMA_CC_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */
|
||||
#define BCMA_CC_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
|
||||
#define BCMA_CC_CORECTL_UARTCLKEN 0x00000008 /* UART clock enable (rev >= 21) */
|
||||
#define BCMA_CC_BIST 0x000C
|
||||
#define BCMA_CC_OTPS 0x0010 /* OTP status */
|
||||
#define BCMA_CC_OTPS_PROGFAIL 0x80000000
|
||||
#define BCMA_CC_OTPS_PROTECT 0x00000007
|
||||
#define BCMA_CC_OTPS_HW_PROTECT 0x00000001
|
||||
#define BCMA_CC_OTPS_SW_PROTECT 0x00000002
|
||||
#define BCMA_CC_OTPS_CID_PROTECT 0x00000004
|
||||
#define BCMA_CC_OTPS_GU_PROG_IND 0x00000F00 /* General Use programmed indication */
|
||||
#define BCMA_CC_OTPS_GU_PROG_IND_SHIFT 8
|
||||
#define BCMA_CC_OTPS_GU_PROG_HW 0x00000100 /* HW region programmed */
|
||||
#define BCMA_CC_OTPC 0x0014 /* OTP control */
|
||||
#define BCMA_CC_OTPC_RECWAIT 0xFF000000
|
||||
#define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00
|
||||
#define BCMA_CC_OTPC_PRW_SHIFT 8
|
||||
#define BCMA_CC_OTPC_MAXFAIL 0x00000038
|
||||
#define BCMA_CC_OTPC_VSEL 0x00000006
|
||||
#define BCMA_CC_OTPC_SELVL 0x00000001
|
||||
#define BCMA_CC_OTPP 0x0018 /* OTP prog */
|
||||
#define BCMA_CC_OTPP_COL 0x000000FF
|
||||
#define BCMA_CC_OTPP_ROW 0x0000FF00
|
||||
#define BCMA_CC_OTPP_ROW_SHIFT 8
|
||||
#define BCMA_CC_OTPP_READERR 0x10000000
|
||||
#define BCMA_CC_OTPP_VALUE 0x20000000
|
||||
#define BCMA_CC_OTPP_READ 0x40000000
|
||||
#define BCMA_CC_OTPP_START 0x80000000
|
||||
#define BCMA_CC_OTPP_BUSY 0x80000000
|
||||
#define BCMA_CC_OTPL 0x001C /* OTP layout */
|
||||
#define BCMA_CC_OTPL_GURGN_OFFSET 0x00000FFF /* offset of general use region */
|
||||
#define BCMA_CC_IRQSTAT 0x0020
|
||||
#define BCMA_CC_IRQMASK 0x0024
|
||||
#define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */
|
||||
#define BCMA_CC_IRQ_EXT 0x00000002 /* ro: ext intr pin (corerev >= 3) */
|
||||
#define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */
|
||||
#define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */
|
||||
#define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */
|
||||
#define BCMA_CC_CHIPST_4313_SPROM_PRESENT 1
|
||||
#define BCMA_CC_CHIPST_4313_OTP_PRESENT 2
|
||||
#define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2
|
||||
#define BCMA_CC_CHIPST_4331_OTP_PRESENT 4
|
||||
#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
|
||||
#define BCMA_CC_JCMD_START 0x80000000
|
||||
#define BCMA_CC_JCMD_BUSY 0x80000000
|
||||
#define BCMA_CC_JCMD_PAUSE 0x40000000
|
||||
#define BCMA_CC_JCMD0_ACC_MASK 0x0000F000
|
||||
#define BCMA_CC_JCMD0_ACC_IRDR 0x00000000
|
||||
#define BCMA_CC_JCMD0_ACC_DR 0x00001000
|
||||
#define BCMA_CC_JCMD0_ACC_IR 0x00002000
|
||||
#define BCMA_CC_JCMD0_ACC_RESET 0x00003000
|
||||
#define BCMA_CC_JCMD0_ACC_IRPDR 0x00004000
|
||||
#define BCMA_CC_JCMD0_ACC_PDR 0x00005000
|
||||
#define BCMA_CC_JCMD0_IRW_MASK 0x00000F00
|
||||
#define BCMA_CC_JCMD_ACC_MASK 0x000F0000 /* Changes for corerev 11 */
|
||||
#define BCMA_CC_JCMD_ACC_IRDR 0x00000000
|
||||
#define BCMA_CC_JCMD_ACC_DR 0x00010000
|
||||
#define BCMA_CC_JCMD_ACC_IR 0x00020000
|
||||
#define BCMA_CC_JCMD_ACC_RESET 0x00030000
|
||||
#define BCMA_CC_JCMD_ACC_IRPDR 0x00040000
|
||||
#define BCMA_CC_JCMD_ACC_PDR 0x00050000
|
||||
#define BCMA_CC_JCMD_IRW_MASK 0x00001F00
|
||||
#define BCMA_CC_JCMD_IRW_SHIFT 8
|
||||
#define BCMA_CC_JCMD_DRW_MASK 0x0000003F
|
||||
#define BCMA_CC_JIR 0x0034 /* Rev >= 10 only */
|
||||
#define BCMA_CC_JDR 0x0038 /* Rev >= 10 only */
|
||||
#define BCMA_CC_JCTL 0x003C /* Rev >= 10 only */
|
||||
#define BCMA_CC_JCTL_FORCE_CLK 4 /* Force clock */
|
||||
#define BCMA_CC_JCTL_EXT_EN 2 /* Enable external targets */
|
||||
#define BCMA_CC_JCTL_EN 1 /* Enable Jtag master */
|
||||
#define BCMA_CC_FLASHCTL 0x0040
|
||||
#define BCMA_CC_FLASHCTL_START 0x80000000
|
||||
#define BCMA_CC_FLASHCTL_BUSY BCMA_CC_FLASHCTL_START
|
||||
#define BCMA_CC_FLASHADDR 0x0044
|
||||
#define BCMA_CC_FLASHDATA 0x0048
|
||||
#define BCMA_CC_BCAST_ADDR 0x0050
|
||||
#define BCMA_CC_BCAST_DATA 0x0054
|
||||
#define BCMA_CC_GPIOPULLUP 0x0058 /* Rev >= 20 only */
|
||||
#define BCMA_CC_GPIOPULLDOWN 0x005C /* Rev >= 20 only */
|
||||
#define BCMA_CC_GPIOIN 0x0060
|
||||
#define BCMA_CC_GPIOOUT 0x0064
|
||||
#define BCMA_CC_GPIOOUTEN 0x0068
|
||||
#define BCMA_CC_GPIOCTL 0x006C
|
||||
#define BCMA_CC_GPIOPOL 0x0070
|
||||
#define BCMA_CC_GPIOIRQ 0x0074
|
||||
#define BCMA_CC_WATCHDOG 0x0080
|
||||
#define BCMA_CC_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */
|
||||
#define BCMA_CC_GPIOTIMER_OFFTIME 0x0000FFFF
|
||||
#define BCMA_CC_GPIOTIMER_OFFTIME_SHIFT 0
|
||||
#define BCMA_CC_GPIOTIMER_ONTIME 0xFFFF0000
|
||||
#define BCMA_CC_GPIOTIMER_ONTIME_SHIFT 16
|
||||
#define BCMA_CC_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */
|
||||
#define BCMA_CC_CLOCK_N 0x0090
|
||||
#define BCMA_CC_CLOCK_SB 0x0094
|
||||
#define BCMA_CC_CLOCK_PCI 0x0098
|
||||
#define BCMA_CC_CLOCK_M2 0x009C
|
||||
#define BCMA_CC_CLOCK_MIPS 0x00A0
|
||||
#define BCMA_CC_CLKDIV 0x00A4 /* Rev >= 3 only */
|
||||
#define BCMA_CC_CLKDIV_SFLASH 0x0F000000
|
||||
#define BCMA_CC_CLKDIV_SFLASH_SHIFT 24
|
||||
#define BCMA_CC_CLKDIV_OTP 0x000F0000
|
||||
#define BCMA_CC_CLKDIV_OTP_SHIFT 16
|
||||
#define BCMA_CC_CLKDIV_JTAG 0x00000F00
|
||||
#define BCMA_CC_CLKDIV_JTAG_SHIFT 8
|
||||
#define BCMA_CC_CLKDIV_UART 0x000000FF
|
||||
#define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */
|
||||
#define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */
|
||||
#define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */
|
||||
#define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */
|
||||
#define BCMA_CC_SLOWCLKCTL_SRC 0x00000007 /* slow clock source mask */
|
||||
#define BCMA_CC_SLOWCLKCTL_SRC_LPO 0x00000000 /* source of slow clock is LPO */
|
||||
#define BCMA_CC_SLOWCLKCTL_SRC_XTAL 0x00000001 /* source of slow clock is crystal */
|
||||
#define BCMA_CC_SLOECLKCTL_SRC_PCI 0x00000002 /* source of slow clock is PCI */
|
||||
#define BCMA_CC_SLOWCLKCTL_LPOFREQ 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
|
||||
#define BCMA_CC_SLOWCLKCTL_LPOPD 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */
|
||||
#define BCMA_CC_SLOWCLKCTL_FSLOW 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */
|
||||
#define BCMA_CC_SLOWCLKCTL_IPLL 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */
|
||||
#define BCMA_CC_SLOWCLKCTL_ENXTAL 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */
|
||||
#define BCMA_CC_SLOWCLKCTL_XTALPU 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */
|
||||
#define BCMA_CC_SLOWCLKCTL_CLKDIV 0xFFFF0000 /* ClockDivider (SlowClk = 1/(4+divisor)) */
|
||||
#define BCMA_CC_SLOWCLKCTL_CLKDIV_SHIFT 16
|
||||
#define BCMA_CC_SYSCLKCTL 0x00C0 /* Rev >= 3 only */
|
||||
#define BCMA_CC_SYSCLKCTL_IDLPEN 0x00000001 /* ILPen: Enable Idle Low Power */
|
||||
#define BCMA_CC_SYSCLKCTL_ALPEN 0x00000002 /* ALPen: Enable Active Low Power */
|
||||
#define BCMA_CC_SYSCLKCTL_PLLEN 0x00000004 /* ForcePLLOn */
|
||||
#define BCMA_CC_SYSCLKCTL_FORCEALP 0x00000008 /* Force ALP (or HT if ALPen is not set */
|
||||
#define BCMA_CC_SYSCLKCTL_FORCEHT 0x00000010 /* Force HT */
|
||||
#define BCMA_CC_SYSCLKCTL_CLKDIV 0xFFFF0000 /* ClkDiv (ILP = 1/(4+divisor)) */
|
||||
#define BCMA_CC_SYSCLKCTL_CLKDIV_SHIFT 16
|
||||
#define BCMA_CC_CLKSTSTR 0x00C4 /* Rev >= 3 only */
|
||||
#define BCMA_CC_EROM 0x00FC
|
||||
#define BCMA_CC_PCMCIA_CFG 0x0100
|
||||
#define BCMA_CC_PCMCIA_MEMWAIT 0x0104
|
||||
#define BCMA_CC_PCMCIA_ATTRWAIT 0x0108
|
||||
#define BCMA_CC_PCMCIA_IOWAIT 0x010C
|
||||
#define BCMA_CC_IDE_CFG 0x0110
|
||||
#define BCMA_CC_IDE_MEMWAIT 0x0114
|
||||
#define BCMA_CC_IDE_ATTRWAIT 0x0118
|
||||
#define BCMA_CC_IDE_IOWAIT 0x011C
|
||||
#define BCMA_CC_PROG_CFG 0x0120
|
||||
#define BCMA_CC_PROG_WAITCNT 0x0124
|
||||
#define BCMA_CC_FLASH_CFG 0x0128
|
||||
#define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */
|
||||
#define BCMA_CC_FLASH_WAITCNT 0x012C
|
||||
#define BCMA_CC_SROM_CONTROL 0x0190
|
||||
#define BCMA_CC_SROM_CONTROL_START 0x80000000
|
||||
#define BCMA_CC_SROM_CONTROL_BUSY 0x80000000
|
||||
#define BCMA_CC_SROM_CONTROL_OPCODE 0x60000000
|
||||
#define BCMA_CC_SROM_CONTROL_OP_READ 0x00000000
|
||||
#define BCMA_CC_SROM_CONTROL_OP_WRITE 0x20000000
|
||||
#define BCMA_CC_SROM_CONTROL_OP_WRDIS 0x40000000
|
||||
#define BCMA_CC_SROM_CONTROL_OP_WREN 0x60000000
|
||||
#define BCMA_CC_SROM_CONTROL_OTPSEL 0x00000010
|
||||
#define BCMA_CC_SROM_CONTROL_LOCK 0x00000008
|
||||
#define BCMA_CC_SROM_CONTROL_SIZE_MASK 0x00000006
|
||||
#define BCMA_CC_SROM_CONTROL_SIZE_1K 0x00000000
|
||||
#define BCMA_CC_SROM_CONTROL_SIZE_4K 0x00000002
|
||||
#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004
|
||||
#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1
|
||||
#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001
|
||||
/* 0x1E0 is defined as shared BCMA_CLKCTLST */
|
||||
#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
|
||||
#define BCMA_CC_UART0_DATA 0x0300
|
||||
#define BCMA_CC_UART0_IMR 0x0304
|
||||
#define BCMA_CC_UART0_FCR 0x0308
|
||||
#define BCMA_CC_UART0_LCR 0x030C
|
||||
#define BCMA_CC_UART0_MCR 0x0310
|
||||
#define BCMA_CC_UART0_LSR 0x0314
|
||||
#define BCMA_CC_UART0_MSR 0x0318
|
||||
#define BCMA_CC_UART0_SCRATCH 0x031C
|
||||
#define BCMA_CC_UART1_DATA 0x0400
|
||||
#define BCMA_CC_UART1_IMR 0x0404
|
||||
#define BCMA_CC_UART1_FCR 0x0408
|
||||
#define BCMA_CC_UART1_LCR 0x040C
|
||||
#define BCMA_CC_UART1_MCR 0x0410
|
||||
#define BCMA_CC_UART1_LSR 0x0414
|
||||
#define BCMA_CC_UART1_MSR 0x0418
|
||||
#define BCMA_CC_UART1_SCRATCH 0x041C
|
||||
/* PMU registers (rev >= 20) */
|
||||
#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */
|
||||
#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
|
||||
#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16
|
||||
#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400
|
||||
#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
|
||||
#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
|
||||
#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
|
||||
#define BCMA_CC_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */
|
||||
#define BCMA_CC_PMU_CTL_XTALFREQ_SHIFT 2
|
||||
#define BCMA_CC_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */
|
||||
#define BCMA_CC_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */
|
||||
#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */
|
||||
#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */
|
||||
#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */
|
||||
#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
|
||||
#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
|
||||
#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
|
||||
#define BCMA_CC_PMU_STAT_HAVEHT 0x00000004 /* HT available */
|
||||
#define BCMA_CC_PMU_STAT_RESINIT 0x00000003 /* Res init */
|
||||
#define BCMA_CC_PMU_RES_STAT 0x060C /* PMU res status */
|
||||
#define BCMA_CC_PMU_RES_PEND 0x0610 /* PMU res pending */
|
||||
#define BCMA_CC_PMU_TIMER 0x0614 /* PMU timer */
|
||||
#define BCMA_CC_PMU_MINRES_MSK 0x0618 /* PMU min res mask */
|
||||
#define BCMA_CC_PMU_MAXRES_MSK 0x061C /* PMU max res mask */
|
||||
#define BCMA_CC_PMU_RES_TABSEL 0x0620 /* PMU res table sel */
|
||||
#define BCMA_CC_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */
|
||||
#define BCMA_CC_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */
|
||||
#define BCMA_CC_PMU_RES_TIMER 0x062C /* PMU res timer */
|
||||
#define BCMA_CC_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */
|
||||
#define BCMA_CC_PMU_WATCHDOG 0x0634 /* PMU watchdog */
|
||||
#define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */
|
||||
#define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */
|
||||
#define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */
|
||||
#define BCMA_CC_CHIPCTL_ADDR 0x0650
|
||||
#define BCMA_CC_CHIPCTL_DATA 0x0654
|
||||
#define BCMA_CC_REGCTL_ADDR 0x0658
|
||||
#define BCMA_CC_REGCTL_DATA 0x065C
|
||||
#define BCMA_CC_PLLCTL_ADDR 0x0660
|
||||
#define BCMA_CC_PLLCTL_DATA 0x0664
|
||||
#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
|
||||
|
||||
/* Divider allocation in 4716/47162/5356 */
|
||||
#define BCMA_CC_PMU5_MAINPLL_CPU 1
|
||||
#define BCMA_CC_PMU5_MAINPLL_MEM 2
|
||||
#define BCMA_CC_PMU5_MAINPLL_SSB 3
|
||||
|
||||
/* PLL usage in 4716/47162 */
|
||||
#define BCMA_CC_PMU4716_MAINPLL_PLL0 12
|
||||
|
||||
/* PLL usage in 5356/5357 */
|
||||
#define BCMA_CC_PMU5356_MAINPLL_PLL0 0
|
||||
#define BCMA_CC_PMU5357_MAINPLL_PLL0 0
|
||||
|
||||
/* 4706 PMU */
|
||||
#define BCMA_CC_PMU4706_MAINPLL_PLL0 0
|
||||
|
||||
/* ALP clock on pre-PMU chips */
|
||||
#define BCMA_CC_PMU_ALP_CLOCK 20000000
|
||||
/* HT clock for systems with PMU-enabled chipcommon */
|
||||
#define BCMA_CC_PMU_HT_CLOCK 80000000
|
||||
|
||||
/* PMU rev 5 (& 6) */
|
||||
#define BCMA_CC_PPL_P1P2_OFF 0
|
||||
#define BCMA_CC_PPL_P1_MASK 0x0f000000
|
||||
#define BCMA_CC_PPL_P1_SHIFT 24
|
||||
#define BCMA_CC_PPL_P2_MASK 0x00f00000
|
||||
#define BCMA_CC_PPL_P2_SHIFT 20
|
||||
#define BCMA_CC_PPL_M14_OFF 1
|
||||
#define BCMA_CC_PPL_MDIV_MASK 0x000000ff
|
||||
#define BCMA_CC_PPL_MDIV_WIDTH 8
|
||||
#define BCMA_CC_PPL_NM5_OFF 2
|
||||
#define BCMA_CC_PPL_NDIV_MASK 0xfff00000
|
||||
#define BCMA_CC_PPL_NDIV_SHIFT 20
|
||||
#define BCMA_CC_PPL_FMAB_OFF 3
|
||||
#define BCMA_CC_PPL_MRAT_MASK 0xf0000000
|
||||
#define BCMA_CC_PPL_MRAT_SHIFT 28
|
||||
#define BCMA_CC_PPL_ABRAT_MASK 0x08000000
|
||||
#define BCMA_CC_PPL_ABRAT_SHIFT 27
|
||||
#define BCMA_CC_PPL_FDIV_MASK 0x07ffffff
|
||||
#define BCMA_CC_PPL_PLLCTL_OFF 4
|
||||
#define BCMA_CC_PPL_PCHI_OFF 5
|
||||
#define BCMA_CC_PPL_PCHI_MASK 0x0000003f
|
||||
|
||||
/* BCM4331 ChipControl numbers. */
|
||||
#define BCMA_CHIPCTL_4331_BT_COEXIST BIT(0) /* 0 disable */
|
||||
#define BCMA_CHIPCTL_4331_SECI BIT(1) /* 0 SECI is disabled (JATG functional) */
|
||||
#define BCMA_CHIPCTL_4331_EXT_LNA BIT(2) /* 0 disable */
|
||||
#define BCMA_CHIPCTL_4331_SPROM_GPIO13_15 BIT(3) /* sprom/gpio13-15 mux */
|
||||
#define BCMA_CHIPCTL_4331_EXTPA_EN BIT(4) /* 0 ext pa disable, 1 ext pa enabled */
|
||||
#define BCMA_CHIPCTL_4331_GPIOCLK_ON_SPROMCS BIT(5) /* set drive out GPIO_CLK on sprom_cs pin */
|
||||
#define BCMA_CHIPCTL_4331_PCIE_MDIO_ON_SPROMCS BIT(6) /* use sprom_cs pin as PCIE mdio interface */
|
||||
#define BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5 BIT(7) /* aband extpa will be at gpio2/5 and sprom_dout */
|
||||
#define BCMA_CHIPCTL_4331_OVR_PIPEAUXCLKEN BIT(8) /* override core control on pipe_AuxClkEnable */
|
||||
#define BCMA_CHIPCTL_4331_OVR_PIPEAUXPWRDOWN BIT(9) /* override core control on pipe_AuxPowerDown */
|
||||
#define BCMA_CHIPCTL_4331_PCIE_AUXCLKEN BIT(10) /* pcie_auxclkenable */
|
||||
#define BCMA_CHIPCTL_4331_PCIE_PIPE_PLLDOWN BIT(11) /* pcie_pipe_pllpowerdown */
|
||||
#define BCMA_CHIPCTL_4331_BT_SHD0_ON_GPIO4 BIT(16) /* enable bt_shd0 at gpio4 */
|
||||
#define BCMA_CHIPCTL_4331_BT_SHD1_ON_GPIO5 BIT(17) /* enable bt_shd1 at gpio5 */
|
||||
|
||||
/* Data for the PMU, if available.
|
||||
* Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
|
||||
*/
|
||||
struct bcma_chipcommon_pmu {
|
||||
u8 rev; /* PMU revision */
|
||||
u32 crystalfreq; /* The active crystal frequency (in kHz) */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BCMA_DRIVER_MIPS
|
||||
struct bcma_pflash {
|
||||
u8 buswidth;
|
||||
u32 window;
|
||||
u32 window_size;
|
||||
};
|
||||
|
||||
struct bcma_serial_port {
|
||||
void *regs;
|
||||
unsigned long clockspeed;
|
||||
unsigned int irq;
|
||||
unsigned int baud_base;
|
||||
unsigned int reg_shift;
|
||||
};
|
||||
#endif /* CONFIG_BCMA_DRIVER_MIPS */
|
||||
|
||||
struct bcma_drv_cc {
|
||||
struct bcma_device *core;
|
||||
u32 status;
|
||||
u32 capabilities;
|
||||
u32 capabilities_ext;
|
||||
u8 setup_done:1;
|
||||
/* Fast Powerup Delay constant */
|
||||
u16 fast_pwrup_delay;
|
||||
struct bcma_chipcommon_pmu pmu;
|
||||
#ifdef CONFIG_BCMA_DRIVER_MIPS
|
||||
struct bcma_pflash pflash;
|
||||
|
||||
int nr_serial_ports;
|
||||
struct bcma_serial_port serial_ports[4];
|
||||
#endif /* CONFIG_BCMA_DRIVER_MIPS */
|
||||
};
|
||||
|
||||
/* Register access */
|
||||
#define bcma_cc_read32(cc, offset) \
|
||||
bcma_read32((cc)->core, offset)
|
||||
#define bcma_cc_write32(cc, offset, val) \
|
||||
bcma_write32((cc)->core, offset, val)
|
||||
|
||||
#define bcma_cc_mask32(cc, offset, mask) \
|
||||
bcma_cc_write32(cc, offset, bcma_cc_read32(cc, offset) & (mask))
|
||||
#define bcma_cc_set32(cc, offset, set) \
|
||||
bcma_cc_write32(cc, offset, bcma_cc_read32(cc, offset) | (set))
|
||||
#define bcma_cc_maskset32(cc, offset, mask, set) \
|
||||
bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
|
||||
|
||||
extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
|
||||
|
||||
extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
|
||||
extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
|
||||
|
||||
void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
|
||||
|
||||
extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc,
|
||||
u32 ticks);
|
||||
|
||||
void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
|
||||
|
||||
u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask);
|
||||
|
||||
/* Chipcommon GPIO pin access. */
|
||||
u32 bcma_chipco_gpio_in(struct bcma_drv_cc *cc, u32 mask);
|
||||
u32 bcma_chipco_gpio_out(struct bcma_drv_cc *cc, u32 mask, u32 value);
|
||||
u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value);
|
||||
u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value);
|
||||
u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value);
|
||||
u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value);
|
||||
|
||||
/* PMU support */
|
||||
extern void bcma_pmu_init(struct bcma_drv_cc *cc);
|
||||
|
||||
extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
|
||||
u32 value);
|
||||
extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset,
|
||||
u32 mask, u32 set);
|
||||
extern void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc,
|
||||
u32 offset, u32 mask, u32 set);
|
||||
extern void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc,
|
||||
u32 offset, u32 mask, u32 set);
|
||||
|
||||
#endif /* LINUX_BCMA_DRIVER_CC_H_ */
|
||||
@@ -1,51 +0,0 @@
|
||||
#ifndef LINUX_BCMA_DRIVER_MIPS_H_
|
||||
#define LINUX_BCMA_DRIVER_MIPS_H_
|
||||
|
||||
#define BCMA_MIPS_IPSFLAG 0x0F08
|
||||
/* which sbflags get routed to mips interrupt 1 */
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ1 0x0000003F
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ1_SHIFT 0
|
||||
/* which sbflags get routed to mips interrupt 2 */
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ2 0x00003F00
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ2_SHIFT 8
|
||||
/* which sbflags get routed to mips interrupt 3 */
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ3 0x003F0000
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ3_SHIFT 16
|
||||
/* which sbflags get routed to mips interrupt 4 */
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ4 0x3F000000
|
||||
#define BCMA_MIPS_IPSFLAG_IRQ4_SHIFT 24
|
||||
|
||||
/* MIPS 74K core registers */
|
||||
#define BCMA_MIPS_MIPS74K_CORECTL 0x0000
|
||||
#define BCMA_MIPS_MIPS74K_EXCEPTBASE 0x0004
|
||||
#define BCMA_MIPS_MIPS74K_BIST 0x000C
|
||||
#define BCMA_MIPS_MIPS74K_INTMASK_INT0 0x0014
|
||||
#define BCMA_MIPS_MIPS74K_INTMASK(int) \
|
||||
((int) * 4 + BCMA_MIPS_MIPS74K_INTMASK_INT0)
|
||||
#define BCMA_MIPS_MIPS74K_NMIMASK 0x002C
|
||||
#define BCMA_MIPS_MIPS74K_GPIOSEL 0x0040
|
||||
#define BCMA_MIPS_MIPS74K_GPIOOUT 0x0044
|
||||
#define BCMA_MIPS_MIPS74K_GPIOEN 0x0048
|
||||
#define BCMA_MIPS_MIPS74K_CLKCTLST 0x01E0
|
||||
|
||||
#define BCMA_MIPS_OOBSELOUTA30 0x100
|
||||
|
||||
struct bcma_device;
|
||||
|
||||
struct bcma_drv_mips {
|
||||
struct bcma_device *core;
|
||||
u8 setup_done:1;
|
||||
unsigned int assigned_irqs;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BCMA_DRIVER_MIPS
|
||||
extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
|
||||
#else
|
||||
static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
|
||||
#endif
|
||||
|
||||
extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
|
||||
|
||||
extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
|
||||
|
||||
#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */
|
||||
@@ -1,214 +0,0 @@
|
||||
#ifndef LINUX_BCMA_DRIVER_PCI_H_
|
||||
#define LINUX_BCMA_DRIVER_PCI_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct pci_dev;
|
||||
|
||||
/** PCI core registers. **/
|
||||
#define BCMA_CORE_PCI_CTL 0x0000 /* PCI Control */
|
||||
#define BCMA_CORE_PCI_CTL_RST_OE 0x00000001 /* PCI_RESET Output Enable */
|
||||
#define BCMA_CORE_PCI_CTL_RST 0x00000002 /* PCI_RESET driven out to pin */
|
||||
#define BCMA_CORE_PCI_CTL_CLK_OE 0x00000004 /* Clock gate Output Enable */
|
||||
#define BCMA_CORE_PCI_CTL_CLK 0x00000008 /* Gate for clock driven out to pin */
|
||||
#define BCMA_CORE_PCI_ARBCTL 0x0010 /* PCI Arbiter Control */
|
||||
#define BCMA_CORE_PCI_ARBCTL_INTERN 0x00000001 /* Use internal arbiter */
|
||||
#define BCMA_CORE_PCI_ARBCTL_EXTERN 0x00000002 /* Use external arbiter */
|
||||
#define BCMA_CORE_PCI_ARBCTL_PARKID 0x00000006 /* Mask, selects which agent is parked on an idle bus */
|
||||
#define BCMA_CORE_PCI_ARBCTL_PARKID_LAST 0x00000000 /* Last requestor */
|
||||
#define BCMA_CORE_PCI_ARBCTL_PARKID_4710 0x00000002 /* 4710 */
|
||||
#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT0 0x00000004 /* External requestor 0 */
|
||||
#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT1 0x00000006 /* External requestor 1 */
|
||||
#define BCMA_CORE_PCI_ISTAT 0x0020 /* Interrupt status */
|
||||
#define BCMA_CORE_PCI_ISTAT_INTA 0x00000001 /* PCI INTA# */
|
||||
#define BCMA_CORE_PCI_ISTAT_INTB 0x00000002 /* PCI INTB# */
|
||||
#define BCMA_CORE_PCI_ISTAT_SERR 0x00000004 /* PCI SERR# (write to clear) */
|
||||
#define BCMA_CORE_PCI_ISTAT_PERR 0x00000008 /* PCI PERR# (write to clear) */
|
||||
#define BCMA_CORE_PCI_ISTAT_PME 0x00000010 /* PCI PME# */
|
||||
#define BCMA_CORE_PCI_IMASK 0x0024 /* Interrupt mask */
|
||||
#define BCMA_CORE_PCI_IMASK_INTA 0x00000001 /* PCI INTA# */
|
||||
#define BCMA_CORE_PCI_IMASK_INTB 0x00000002 /* PCI INTB# */
|
||||
#define BCMA_CORE_PCI_IMASK_SERR 0x00000004 /* PCI SERR# */
|
||||
#define BCMA_CORE_PCI_IMASK_PERR 0x00000008 /* PCI PERR# */
|
||||
#define BCMA_CORE_PCI_IMASK_PME 0x00000010 /* PCI PME# */
|
||||
#define BCMA_CORE_PCI_MBOX 0x0028 /* Backplane to PCI Mailbox */
|
||||
#define BCMA_CORE_PCI_MBOX_F0_0 0x00000100 /* PCI function 0, INT 0 */
|
||||
#define BCMA_CORE_PCI_MBOX_F0_1 0x00000200 /* PCI function 0, INT 1 */
|
||||
#define BCMA_CORE_PCI_MBOX_F1_0 0x00000400 /* PCI function 1, INT 0 */
|
||||
#define BCMA_CORE_PCI_MBOX_F1_1 0x00000800 /* PCI function 1, INT 1 */
|
||||
#define BCMA_CORE_PCI_MBOX_F2_0 0x00001000 /* PCI function 2, INT 0 */
|
||||
#define BCMA_CORE_PCI_MBOX_F2_1 0x00002000 /* PCI function 2, INT 1 */
|
||||
#define BCMA_CORE_PCI_MBOX_F3_0 0x00004000 /* PCI function 3, INT 0 */
|
||||
#define BCMA_CORE_PCI_MBOX_F3_1 0x00008000 /* PCI function 3, INT 1 */
|
||||
#define BCMA_CORE_PCI_BCAST_ADDR 0x0050 /* Backplane Broadcast Address */
|
||||
#define BCMA_CORE_PCI_BCAST_ADDR_MASK 0x000000FF
|
||||
#define BCMA_CORE_PCI_BCAST_DATA 0x0054 /* Backplane Broadcast Data */
|
||||
#define BCMA_CORE_PCI_GPIO_IN 0x0060 /* rev >= 2 only */
|
||||
#define BCMA_CORE_PCI_GPIO_OUT 0x0064 /* rev >= 2 only */
|
||||
#define BCMA_CORE_PCI_GPIO_ENABLE 0x0068 /* rev >= 2 only */
|
||||
#define BCMA_CORE_PCI_GPIO_CTL 0x006C /* rev >= 2 only */
|
||||
#define BCMA_CORE_PCI_SBTOPCI0 0x0100 /* Backplane to PCI translation 0 (sbtopci0) */
|
||||
#define BCMA_CORE_PCI_SBTOPCI0_MASK 0xFC000000
|
||||
#define BCMA_CORE_PCI_SBTOPCI1 0x0104 /* Backplane to PCI translation 1 (sbtopci1) */
|
||||
#define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000
|
||||
#define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */
|
||||
#define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000
|
||||
#define BCMA_CORE_PCI_CONFIG_ADDR 0x0120 /* pcie config space access */
|
||||
#define BCMA_CORE_PCI_CONFIG_DATA 0x0124 /* pcie config space access */
|
||||
#define BCMA_CORE_PCI_MDIO_CONTROL 0x0128 /* controls the mdio access */
|
||||
#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_MASK 0x7f /* clock to be used on MDIO */
|
||||
#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL 0x2
|
||||
#define BCMA_CORE_PCI_MDIOCTL_PREAM_EN 0x80 /* Enable preamble sequnce */
|
||||
#define BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE 0x100 /* Tranaction complete */
|
||||
#define BCMA_CORE_PCI_MDIO_DATA 0x012c /* Data to the mdio access */
|
||||
#define BCMA_CORE_PCI_MDIODATA_MASK 0x0000ffff /* data 2 bytes */
|
||||
#define BCMA_CORE_PCI_MDIODATA_TA 0x00020000 /* Turnaround */
|
||||
#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD 18 /* Regaddr shift (rev < 10) */
|
||||
#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK_OLD 0x003c0000 /* Regaddr Mask (rev < 10) */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD 22 /* Physmedia devaddr shift (rev < 10) */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK_OLD 0x0fc00000 /* Physmedia devaddr Mask (rev < 10) */
|
||||
#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF 18 /* Regaddr shift */
|
||||
#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK 0x007c0000 /* Regaddr Mask */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF 23 /* Physmedia devaddr shift */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK 0x0f800000 /* Physmedia devaddr Mask */
|
||||
#define BCMA_CORE_PCI_MDIODATA_WRITE 0x10000000 /* write Transaction */
|
||||
#define BCMA_CORE_PCI_MDIODATA_READ 0x20000000 /* Read Transaction */
|
||||
#define BCMA_CORE_PCI_MDIODATA_START 0x40000000 /* start of Transaction */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEV_ADDR 0x0 /* dev address for serdes */
|
||||
#define BCMA_CORE_PCI_MDIODATA_BLK_ADDR 0x1F /* blk address for serdes */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEV_PLL 0x1d /* SERDES PLL Dev */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */
|
||||
#define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */
|
||||
#define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */
|
||||
#define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal regsiter */
|
||||
#define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */
|
||||
#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */
|
||||
#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */
|
||||
#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
|
||||
#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
|
||||
#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
|
||||
|
||||
/* SBtoPCIx */
|
||||
#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000
|
||||
#define BCMA_CORE_PCI_SBTOPCI_IO 0x00000001
|
||||
#define BCMA_CORE_PCI_SBTOPCI_CFG0 0x00000002
|
||||
#define BCMA_CORE_PCI_SBTOPCI_CFG1 0x00000003
|
||||
#define BCMA_CORE_PCI_SBTOPCI_PREF 0x00000004 /* Prefetch enable */
|
||||
#define BCMA_CORE_PCI_SBTOPCI_BURST 0x00000008 /* Burst enable */
|
||||
#define BCMA_CORE_PCI_SBTOPCI_MRM 0x00000020 /* Memory Read Multiple */
|
||||
#define BCMA_CORE_PCI_SBTOPCI_RC 0x00000030 /* Read Command mask (rev >= 11) */
|
||||
#define BCMA_CORE_PCI_SBTOPCI_RC_READ 0x00000000 /* Memory read */
|
||||
#define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */
|
||||
#define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */
|
||||
|
||||
/* PCIE protocol PHY diagnostic registers */
|
||||
#define BCMA_CORE_PCI_PLP_MODEREG 0x200 /* Mode */
|
||||
#define BCMA_CORE_PCI_PLP_STATUSREG 0x204 /* Status */
|
||||
#define BCMA_CORE_PCI_PLP_POLARITYINV_STAT 0x10 /* Status reg PCIE_PLP_STATUSREG */
|
||||
#define BCMA_CORE_PCI_PLP_LTSSMCTRLREG 0x208 /* LTSSM control */
|
||||
#define BCMA_CORE_PCI_PLP_LTLINKNUMREG 0x20c /* Link Training Link number */
|
||||
#define BCMA_CORE_PCI_PLP_LTLANENUMREG 0x210 /* Link Training Lane number */
|
||||
#define BCMA_CORE_PCI_PLP_LTNFTSREG 0x214 /* Link Training N_FTS */
|
||||
#define BCMA_CORE_PCI_PLP_ATTNREG 0x218 /* Attention */
|
||||
#define BCMA_CORE_PCI_PLP_ATTNMASKREG 0x21C /* Attention Mask */
|
||||
#define BCMA_CORE_PCI_PLP_RXERRCTR 0x220 /* Rx Error */
|
||||
#define BCMA_CORE_PCI_PLP_RXFRMERRCTR 0x224 /* Rx Framing Error */
|
||||
#define BCMA_CORE_PCI_PLP_RXERRTHRESHREG 0x228 /* Rx Error threshold */
|
||||
#define BCMA_CORE_PCI_PLP_TESTCTRLREG 0x22C /* Test Control reg */
|
||||
#define BCMA_CORE_PCI_PLP_SERDESCTRLOVRDREG 0x230 /* SERDES Control Override */
|
||||
#define BCMA_CORE_PCI_PLP_TIMINGOVRDREG 0x234 /* Timing param override */
|
||||
#define BCMA_CORE_PCI_PLP_RXTXSMDIAGREG 0x238 /* RXTX State Machine Diag */
|
||||
#define BCMA_CORE_PCI_PLP_LTSSMDIAGREG 0x23C /* LTSSM State Machine Diag */
|
||||
|
||||
/* PCIE protocol DLLP diagnostic registers */
|
||||
#define BCMA_CORE_PCI_DLLP_LCREG 0x100 /* Link Control */
|
||||
#define BCMA_CORE_PCI_DLLP_LSREG 0x104 /* Link Status */
|
||||
#define BCMA_CORE_PCI_DLLP_LAREG 0x108 /* Link Attention */
|
||||
#define BCMA_CORE_PCI_DLLP_LSREG_LINKUP (1 << 16)
|
||||
#define BCMA_CORE_PCI_DLLP_LAMASKREG 0x10C /* Link Attention Mask */
|
||||
#define BCMA_CORE_PCI_DLLP_NEXTTXSEQNUMREG 0x110 /* Next Tx Seq Num */
|
||||
#define BCMA_CORE_PCI_DLLP_ACKEDTXSEQNUMREG 0x114 /* Acked Tx Seq Num */
|
||||
#define BCMA_CORE_PCI_DLLP_PURGEDTXSEQNUMREG 0x118 /* Purged Tx Seq Num */
|
||||
#define BCMA_CORE_PCI_DLLP_RXSEQNUMREG 0x11C /* Rx Sequence Number */
|
||||
#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */
|
||||
#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */
|
||||
#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */
|
||||
#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */
|
||||
#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */
|
||||
#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */
|
||||
#define BCMA_CORE_PCI_DLLP_RTRRWREG 0x138 /* Retry buffer Read/Write */
|
||||
#define BCMA_CORE_PCI_DLLP_ECTHRESHREG 0x13C /* Error Count Threshold */
|
||||
#define BCMA_CORE_PCI_DLLP_TLPERRCTRREG 0x140 /* TLP Error Counter */
|
||||
#define BCMA_CORE_PCI_DLLP_ERRCTRREG 0x144 /* Error Counter */
|
||||
#define BCMA_CORE_PCI_DLLP_NAKRXCTRREG 0x148 /* NAK Received Counter */
|
||||
#define BCMA_CORE_PCI_DLLP_TESTREG 0x14C /* Test */
|
||||
#define BCMA_CORE_PCI_DLLP_PKTBIST 0x150 /* Packet BIST */
|
||||
#define BCMA_CORE_PCI_DLLP_PCIE11 0x154 /* DLLP PCIE 1.1 reg */
|
||||
|
||||
/* SERDES RX registers */
|
||||
#define BCMA_CORE_PCI_SERDES_RX_CTRL 1 /* Rx cntrl */
|
||||
#define BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE 0x80 /* rxpolarity_force */
|
||||
#define BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY 0x40 /* rxpolarity_value */
|
||||
#define BCMA_CORE_PCI_SERDES_RX_TIMER1 2 /* Rx Timer1 */
|
||||
#define BCMA_CORE_PCI_SERDES_RX_CDR 6 /* CDR */
|
||||
#define BCMA_CORE_PCI_SERDES_RX_CDRBW 7 /* CDR BW */
|
||||
|
||||
/* SERDES PLL registers */
|
||||
#define BCMA_CORE_PCI_SERDES_PLL_CTRL 1 /* PLL control reg */
|
||||
#define BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN 0x4000 /* bit 14 is FREQDET on */
|
||||
|
||||
/* PCIcore specific boardflags */
|
||||
#define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */
|
||||
|
||||
/* PCIE Config space accessing MACROS */
|
||||
#define BCMA_CORE_PCI_CFG_BUS_SHIFT 24 /* Bus shift */
|
||||
#define BCMA_CORE_PCI_CFG_SLOT_SHIFT 19 /* Slot/Device shift */
|
||||
#define BCMA_CORE_PCI_CFG_FUN_SHIFT 16 /* Function shift */
|
||||
#define BCMA_CORE_PCI_CFG_OFF_SHIFT 0 /* Register shift */
|
||||
|
||||
#define BCMA_CORE_PCI_CFG_BUS_MASK 0xff /* Bus mask */
|
||||
#define BCMA_CORE_PCI_CFG_SLOT_MASK 0x1f /* Slot/Device mask */
|
||||
#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */
|
||||
#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */
|
||||
|
||||
/* PCIE Root Capability Register bits (Host mode only) */
|
||||
#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001
|
||||
|
||||
struct bcma_drv_pci;
|
||||
|
||||
#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
|
||||
struct bcma_drv_pci_host {
|
||||
struct bcma_drv_pci *pdev;
|
||||
|
||||
u32 host_cfg_addr;
|
||||
spinlock_t cfgspace_lock;
|
||||
|
||||
struct pci_controller pci_controller;
|
||||
struct pci_ops pci_ops;
|
||||
struct resource mem_resource;
|
||||
struct resource io_resource;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct bcma_drv_pci {
|
||||
struct bcma_device *core;
|
||||
u8 setup_done:1;
|
||||
u8 hostmode:1;
|
||||
|
||||
#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
|
||||
struct bcma_drv_pci_host *host_controller;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Register access */
|
||||
#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
|
||||
#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
|
||||
|
||||
extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
|
||||
extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
|
||||
struct bcma_device *core, bool enable);
|
||||
|
||||
extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
|
||||
extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
|
||||
|
||||
#endif /* LINUX_BCMA_DRIVER_PCI_H_ */
|
||||
@@ -1,86 +0,0 @@
|
||||
#ifndef LINUX_BCMA_REGS_H_
|
||||
#define LINUX_BCMA_REGS_H_
|
||||
|
||||
/* Some single registers are shared between many cores */
|
||||
/* BCMA_CLKCTLST: ChipCommon (rev >= 20), PCIe, 80211 */
|
||||
#define BCMA_CLKCTLST 0x01E0 /* Clock control and status */
|
||||
#define BCMA_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */
|
||||
#define BCMA_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */
|
||||
#define BCMA_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */
|
||||
#define BCMA_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
|
||||
#define BCMA_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
|
||||
#define BCMA_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
|
||||
#define BCMA_CLKCTLST_EXTRESREQ 0x00000700 /* Mask of external resource requests */
|
||||
#define BCMA_CLKCTLST_HAVEALP 0x00010000 /* ALP available */
|
||||
#define BCMA_CLKCTLST_HAVEHT 0x00020000 /* HT available */
|
||||
#define BCMA_CLKCTLST_BP_ON_ALP 0x00040000 /* RO: running on ALP clock */
|
||||
#define BCMA_CLKCTLST_BP_ON_HT 0x00080000 /* RO: running on HT clock */
|
||||
#define BCMA_CLKCTLST_EXTRESST 0x07000000 /* Mask of external resource status */
|
||||
/* Is there any BCM4328 on BCMA bus? */
|
||||
#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */
|
||||
#define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
|
||||
|
||||
/* Agent registers (common for every core) */
|
||||
#define BCMA_IOCTL 0x0408 /* IO control */
|
||||
#define BCMA_IOCTL_CLK 0x0001
|
||||
#define BCMA_IOCTL_FGC 0x0002
|
||||
#define BCMA_IOCTL_CORE_BITS 0x3FFC
|
||||
#define BCMA_IOCTL_PME_EN 0x4000
|
||||
#define BCMA_IOCTL_BIST_EN 0x8000
|
||||
#define BCMA_IOST 0x0500 /* IO status */
|
||||
#define BCMA_IOST_CORE_BITS 0x0FFF
|
||||
#define BCMA_IOST_DMA64 0x1000
|
||||
#define BCMA_IOST_GATED_CLK 0x2000
|
||||
#define BCMA_IOST_BIST_ERROR 0x4000
|
||||
#define BCMA_IOST_BIST_DONE 0x8000
|
||||
#define BCMA_RESET_CTL 0x0800
|
||||
#define BCMA_RESET_CTL_RESET 0x0001
|
||||
|
||||
/* BCMA PCI config space registers. */
|
||||
#define BCMA_PCI_PMCSR 0x44
|
||||
#define BCMA_PCI_PE 0x100
|
||||
#define BCMA_PCI_BAR0_WIN 0x80 /* Backplane address space 0 */
|
||||
#define BCMA_PCI_BAR1_WIN 0x84 /* Backplane address space 1 */
|
||||
#define BCMA_PCI_SPROMCTL 0x88 /* SPROM control */
|
||||
#define BCMA_PCI_SPROMCTL_WE 0x10 /* SPROM write enable */
|
||||
#define BCMA_PCI_BAR1_CONTROL 0x8c /* Address space 1 burst control */
|
||||
#define BCMA_PCI_IRQS 0x90 /* PCI interrupts */
|
||||
#define BCMA_PCI_IRQMASK 0x94 /* PCI IRQ control and mask (pcirev >= 6 only) */
|
||||
#define BCMA_PCI_BACKPLANE_IRQS 0x98 /* Backplane Interrupts */
|
||||
#define BCMA_PCI_BAR0_WIN2 0xAC
|
||||
#define BCMA_PCI_GPIO_IN 0xB0 /* GPIO Input (pcirev >= 3 only) */
|
||||
#define BCMA_PCI_GPIO_OUT 0xB4 /* GPIO Output (pcirev >= 3 only) */
|
||||
#define BCMA_PCI_GPIO_OUT_ENABLE 0xB8 /* GPIO Output Enable/Disable (pcirev >= 3 only) */
|
||||
#define BCMA_PCI_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */
|
||||
#define BCMA_PCI_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */
|
||||
#define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */
|
||||
#define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */
|
||||
|
||||
/* SiliconBackplane Address Map.
|
||||
* All regions may not exist on all chips.
|
||||
*/
|
||||
#define BCMA_SOC_SDRAM_BASE 0x00000000U /* Physical SDRAM */
|
||||
#define BCMA_SOC_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */
|
||||
#define BCMA_SOC_PCI_MEM_SZ (64 * 1024 * 1024)
|
||||
#define BCMA_SOC_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */
|
||||
#define BCMA_SOC_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */
|
||||
#define BCMA_SOC_SDRAM_R2 0x80000000U /* Region 2 for sdram (512 MB) */
|
||||
|
||||
|
||||
#define BCMA_SOC_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */
|
||||
#define BCMA_SOC_PCI_DMA2 0x80000000U /* Client Mode sb2pcitranslation2 (1 GB) */
|
||||
#define BCMA_SOC_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */
|
||||
#define BCMA_SOC_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2
|
||||
* (2 ZettaBytes), low 32 bits
|
||||
*/
|
||||
#define BCMA_SOC_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2
|
||||
* (2 ZettaBytes), high 32 bits
|
||||
*/
|
||||
|
||||
#define BCMA_SOC_PCI1_MEM 0x40000000U /* Host Mode sb2pcitranslation0 (64 MB) */
|
||||
#define BCMA_SOC_PCI1_CFG 0x44000000U /* Host Mode sb2pcitranslation1 (64 MB) */
|
||||
#define BCMA_SOC_PCIE1_DMA_H32 0xc0000000U /* PCIE Client Mode sb2pcitranslation2
|
||||
* (2 ZettaBytes), high 32 bits
|
||||
*/
|
||||
|
||||
#endif /* LINUX_BCMA_REGS_H_ */
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef LINUX_BCMA_SOC_H_
|
||||
#define LINUX_BCMA_SOC_H_
|
||||
|
||||
#include <linux/bcma/bcma.h>
|
||||
|
||||
struct bcma_soc {
|
||||
struct bcma_bus bus;
|
||||
struct bcma_device core_cc;
|
||||
struct bcma_device core_mips;
|
||||
};
|
||||
|
||||
int __init bcma_host_soc_register(struct bcma_soc *soc);
|
||||
|
||||
int bcma_bus_register(struct bcma_bus *bus);
|
||||
|
||||
#endif /* LINUX_BCMA_SOC_H_ */
|
||||
@@ -1,211 +0,0 @@
|
||||
#ifndef _LINUX_BITOPS_H
|
||||
#define _LINUX_BITOPS_H
|
||||
#include <asm/types.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
|
||||
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
|
||||
#define BITS_PER_BYTE 8
|
||||
#ifndef BITS_TO_LONGS /* Older kernels define this already */
|
||||
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern unsigned int __sw_hweight8(unsigned int w);
|
||||
extern unsigned int __sw_hweight16(unsigned int w);
|
||||
extern unsigned int __sw_hweight32(unsigned int w);
|
||||
extern unsigned long __sw_hweight64(__u64 w);
|
||||
|
||||
/*
|
||||
* Include this here because some architectures need generic_ffs/fls in
|
||||
* scope
|
||||
*/
|
||||
#include <asm/bitops.h>
|
||||
|
||||
#define for_each_set_bit(bit, addr, size) \
|
||||
for ((bit) = find_first_bit((addr), (size)); \
|
||||
(bit) < (size); \
|
||||
(bit) = find_next_bit((addr), (size), (bit) + 1))
|
||||
|
||||
static __inline__ int get_bitmask_order(unsigned int count)
|
||||
{
|
||||
int order;
|
||||
|
||||
order = fls(count);
|
||||
return order; /* We could be slightly more clever with -1 here... */
|
||||
}
|
||||
|
||||
static __inline__ int get_count_order(unsigned int count)
|
||||
{
|
||||
int order;
|
||||
|
||||
order = fls(count) - 1;
|
||||
if (count & (count - 1))
|
||||
order++;
|
||||
return order;
|
||||
}
|
||||
|
||||
static inline unsigned long hweight_long(unsigned long w)
|
||||
{
|
||||
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* rol32 - rotate a 32-bit value left
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u32 rol32(__u32 word, unsigned int shift)
|
||||
{
|
||||
return (word << shift) | (word >> (32 - shift));
|
||||
}
|
||||
|
||||
/**
|
||||
* ror32 - rotate a 32-bit value right
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u32 ror32(__u32 word, unsigned int shift)
|
||||
{
|
||||
return (word >> shift) | (word << (32 - shift));
|
||||
}
|
||||
|
||||
/**
|
||||
* rol16 - rotate a 16-bit value left
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u16 rol16(__u16 word, unsigned int shift)
|
||||
{
|
||||
return (word << shift) | (word >> (16 - shift));
|
||||
}
|
||||
|
||||
/**
|
||||
* ror16 - rotate a 16-bit value right
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u16 ror16(__u16 word, unsigned int shift)
|
||||
{
|
||||
return (word >> shift) | (word << (16 - shift));
|
||||
}
|
||||
|
||||
/**
|
||||
* rol8 - rotate an 8-bit value left
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u8 rol8(__u8 word, unsigned int shift)
|
||||
{
|
||||
return (word << shift) | (word >> (8 - shift));
|
||||
}
|
||||
|
||||
/**
|
||||
* ror8 - rotate an 8-bit value right
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u8 ror8(__u8 word, unsigned int shift)
|
||||
{
|
||||
return (word >> shift) | (word << (8 - shift));
|
||||
}
|
||||
|
||||
/**
|
||||
* sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit
|
||||
* @value: value to sign extend
|
||||
* @index: 0 based bit index (0<=index<32) to sign bit
|
||||
*/
|
||||
static inline __s32 sign_extend32(__u32 value, int index)
|
||||
{
|
||||
__u8 shift = 31 - index;
|
||||
return (__s32)(value << shift) >> shift;
|
||||
}
|
||||
|
||||
static inline unsigned fls_long(unsigned long l)
|
||||
{
|
||||
if (sizeof(l) == 4)
|
||||
return fls(l);
|
||||
return fls64(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* __ffs64 - find first set bit in a 64 bit word
|
||||
* @word: The 64 bit word
|
||||
*
|
||||
* On 64 bit arches this is a synomyn for __ffs
|
||||
* The result is not defined if no bits are set, so check that @word
|
||||
* is non-zero before calling this.
|
||||
*/
|
||||
static inline unsigned long __ffs64(u64 word)
|
||||
{
|
||||
#if BITS_PER_LONG == 32
|
||||
if (((u32)word) == 0UL)
|
||||
return __ffs((u32)(word >> 32)) + 32;
|
||||
#elif BITS_PER_LONG != 64
|
||||
#error BITS_PER_LONG not 32 or 64
|
||||
#endif
|
||||
return __ffs((unsigned long)word);
|
||||
}
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
|
||||
|
||||
/**
|
||||
* find_first_bit - find the first set bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum size to search
|
||||
*
|
||||
* Returns the bit number of the first set bit.
|
||||
*/
|
||||
extern unsigned long find_first_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
|
||||
/**
|
||||
* find_first_zero_bit - find the first cleared bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum size to search
|
||||
*
|
||||
* Returns the bit number of the first cleared bit.
|
||||
*/
|
||||
extern unsigned long find_first_zero_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
|
||||
|
||||
#ifdef CONFIG_GENERIC_FIND_LAST_BIT
|
||||
/**
|
||||
* find_last_bit - find the last set bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum size to search
|
||||
*
|
||||
* Returns the bit number of the first set bit, or size.
|
||||
*/
|
||||
extern unsigned long find_last_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
#endif /* CONFIG_GENERIC_FIND_LAST_BIT */
|
||||
|
||||
#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
|
||||
|
||||
/**
|
||||
* find_next_bit - find the next set bit in a memory region
|
||||
* @addr: The address to base the search on
|
||||
* @offset: The bitnumber to start searching at
|
||||
* @size: The bitmap size in bits
|
||||
*/
|
||||
extern unsigned long find_next_bit(const unsigned long *addr,
|
||||
unsigned long size, unsigned long offset);
|
||||
|
||||
/**
|
||||
* find_next_zero_bit - find the next cleared bit in a memory region
|
||||
* @addr: The address to base the search on
|
||||
* @offset: The bitnumber to start searching at
|
||||
* @size: The bitmap size in bits
|
||||
*/
|
||||
|
||||
extern unsigned long find_next_zero_bit(const unsigned long *addr,
|
||||
unsigned long size,
|
||||
unsigned long offset);
|
||||
|
||||
#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */
|
||||
#endif /* __KERNEL__ */
|
||||
#endif
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef LINUX_26_14_COMPAT_H
|
||||
#define LINUX_26_14_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.14 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14))
|
||||
|
||||
typedef unsigned int gfp_t;
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) */
|
||||
|
||||
#endif /* LINUX_26_14_COMPAT_H */
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef LINUX_26_18_COMPAT_H
|
||||
#define LINUX_26_18_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.18 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
|
||||
|
||||
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) */
|
||||
|
||||
#endif /* LINUX_26_18_COMPAT_H */
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef LINUX_26_19_COMPAT_H
|
||||
#define LINUX_26_19_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.19 */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
|
||||
|
||||
#include <linux/slab.h>
|
||||
|
||||
static inline int
|
||||
compat_kmem_cache_destroy(struct kmem_cache *cachep)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
|
||||
return kmem_cache_destroy(cachep);
|
||||
#else
|
||||
kmem_cache_destroy(cachep);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) */
|
||||
|
||||
#endif /* LINUX_26_19_COMPAT_H */
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef LINUX_26_20_COMPAT_H
|
||||
#define LINUX_26_20_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.20 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
|
||||
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
typedef void (*work_func_t)(struct work_struct *work);
|
||||
typedef void (*compat_work_func_t)(void *work);
|
||||
static inline void (INIT_WORK)(struct work_struct *work, work_func_t func)
|
||||
{
|
||||
INIT_WORK(work, (compat_work_func_t)func, work);
|
||||
}
|
||||
#undef INIT_WORK
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) */
|
||||
|
||||
#endif /* LINUX_26_20_COMPAT_H */
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef LINUX_26_21_COMPAT_H
|
||||
#define LINUX_26_21_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.21 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
|
||||
|
||||
#include <linux/sysctl.h>
|
||||
|
||||
#define register_sysctl_table(table) \
|
||||
({ \
|
||||
register_sysctl_table((table), 0); \
|
||||
})
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) */
|
||||
|
||||
#endif /* LINUX_26_21_COMPAT_H */
|
||||
@@ -1,104 +0,0 @@
|
||||
#ifndef LINUX_26_22_COMPAT_H
|
||||
#define LINUX_26_22_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.21 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
/* reuse ax25_ptr */
|
||||
#define ieee80211_ptr ax25_ptr
|
||||
|
||||
#ifdef CONFIG_AX25
|
||||
#error Compat reuses the AX.25 pointer so that may not be enabled!
|
||||
#endif
|
||||
|
||||
static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->mac.raw;
|
||||
}
|
||||
|
||||
static inline void skb_set_mac_header(struct sk_buff *skb, int offset)
|
||||
{
|
||||
skb->mac.raw = skb->data + offset;
|
||||
}
|
||||
|
||||
static inline void skb_reset_mac_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->mac.raw = skb->data;
|
||||
}
|
||||
|
||||
static inline void skb_reset_network_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->nh.raw = skb->data;
|
||||
}
|
||||
|
||||
static inline void skb_set_network_header(struct sk_buff *skb, int offset)
|
||||
{
|
||||
skb->nh.raw = skb->data + offset;
|
||||
}
|
||||
|
||||
static inline void skb_set_transport_header(struct sk_buff *skb, int offset)
|
||||
{
|
||||
skb->h.raw = skb->data + offset;
|
||||
}
|
||||
|
||||
static inline unsigned char *skb_transport_header(struct sk_buff *skb)
|
||||
{
|
||||
return skb->h.raw;
|
||||
}
|
||||
|
||||
static inline unsigned char *skb_network_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->nh.raw;
|
||||
}
|
||||
|
||||
static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->tail;
|
||||
}
|
||||
|
||||
static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct iphdr *)skb_network_header(skb);
|
||||
}
|
||||
|
||||
static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
|
||||
void *to,
|
||||
const unsigned int len)
|
||||
{
|
||||
memcpy(to, skb->data, len);
|
||||
}
|
||||
|
||||
static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
|
||||
const int offset, void *to,
|
||||
const unsigned int len)
|
||||
{
|
||||
memcpy(to, skb->data + offset, len);
|
||||
}
|
||||
|
||||
#define __maybe_unused __attribute__((unused))
|
||||
|
||||
#define uninitialized_var(x) x = x
|
||||
|
||||
/* This will lead to very weird behaviour... */
|
||||
#define NLA_BINARY NLA_STRING
|
||||
|
||||
static inline int pci_set_mwi(struct pci_dev *dev)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline void pci_clear_mwi(struct pci_dev *dev)
|
||||
{
|
||||
}
|
||||
|
||||
#define list_first_entry(ptr, type, member) \
|
||||
list_entry((ptr)->next, type, member)
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) */
|
||||
|
||||
#endif /* LINUX_26_22_COMPAT_H */
|
||||
@@ -1,136 +0,0 @@
|
||||
#ifndef LINUX_26_23_COMPAT_H
|
||||
#define LINUX_26_23_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for < 2.6.23 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/genetlink.h>
|
||||
#include <net/sch_generic.h>
|
||||
|
||||
/*
|
||||
* Tell gcc if a function is cold. The compiler will assume any path
|
||||
* directly leading to the call is unlikely.
|
||||
*/
|
||||
|
||||
#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3)
|
||||
/* Mark functions as cold. gcc will assume any path leading to a call
|
||||
* to them will be unlikely. This means a lot of manual unlikely()s
|
||||
* are unnecessary now for any paths leading to the usual suspects
|
||||
* like BUG(), printk(), panic() etc. [but let's keep them for now for
|
||||
* older compilers]
|
||||
*
|
||||
* Early snapshots of gcc 4.3 don't support this and we can't detect this
|
||||
* in the preprocessor, but we can live with this because they're unreleased.
|
||||
* Maketime probing would be overkill here.
|
||||
*
|
||||
* gcc also has a __attribute__((__hot__)) to move hot functions into
|
||||
* a special section, but I don't see any sense in this right now in
|
||||
* the kernel context */
|
||||
#define __cold __attribute__((__cold__))
|
||||
#endif /* gcc 4.3 check */
|
||||
|
||||
#ifndef __cold
|
||||
#define __cold
|
||||
#endif
|
||||
|
||||
/* Added as of 2.6.23 in include/linux/netdevice.h */
|
||||
#define alloc_netdev_mq(sizeof_priv, name, setup, queue) \
|
||||
alloc_netdev(sizeof_priv, name, setup)
|
||||
#define NETIF_F_MULTI_QUEUE 16384
|
||||
|
||||
/* Added as of 2.6.23 on include/linux/netdevice.h */
|
||||
static inline int netif_is_multiqueue(const struct net_device *dev)
|
||||
{
|
||||
return (!!(NETIF_F_MULTI_QUEUE & dev->features));
|
||||
}
|
||||
|
||||
/* 2.6.23 fixed a bug in tcf_destroy_chain and the parameter changed */
|
||||
static inline void tcf_destroy_chain_compat(struct tcf_proto **fl)
|
||||
{
|
||||
struct tcf_proto *tp;
|
||||
|
||||
while ((tp = *fl) != NULL) {
|
||||
*fl = tp->next;
|
||||
tp->ops->destroy(tp);
|
||||
module_put(tp->ops->owner);
|
||||
kfree(tp);
|
||||
}
|
||||
}
|
||||
|
||||
/* dev_mc_list was replaced with dev_addr_list as of 2.6.23,
|
||||
* only new member added is da_synced. */
|
||||
#define dev_addr_list dev_mc_list
|
||||
#define da_addr dmi_addr
|
||||
#define da_addrlen dmi_addrlen
|
||||
#define da_users dmi_users
|
||||
#define da_gusers dmi_gusers
|
||||
|
||||
/* dev_set_promiscuity() was moved to __dev_set_promiscuity() on 2.6.23 and
|
||||
* dev_set_promiscuity() became a wrapper. */
|
||||
#define __dev_set_promiscuity dev_set_promiscuity
|
||||
|
||||
/* Our own 2.6.22 port on compat.c */
|
||||
extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
|
||||
extern int dev_mc_sync(struct net_device *to, struct net_device *from);
|
||||
|
||||
/* Our own 2.6.22 port on compat.c */
|
||||
extern void __dev_set_rx_mode(struct net_device *dev);
|
||||
|
||||
/* Simple to add this */
|
||||
extern int cancel_delayed_work_sync(struct delayed_work *work);
|
||||
|
||||
#define cancel_delayed_work_sync cancel_rearming_delayed_work
|
||||
|
||||
#define debugfs_rename(a, b, c, d) 1
|
||||
|
||||
/* nl80211 requires multicast group support which is new and added on
|
||||
* 2.6.23. We can't add support for it for older kernels to support it
|
||||
* genl_family structure was changed. Lets just let through the
|
||||
* genl_register_mc_group call. This means no multicast group suppport */
|
||||
|
||||
#define genl_register_mc_group(a, b) 0
|
||||
|
||||
/**
|
||||
* struct genl_multicast_group - generic netlink multicast group
|
||||
* @name: name of the multicast group, names are per-family
|
||||
* @id: multicast group ID, assigned by the core, to use with
|
||||
* genlmsg_multicast().
|
||||
* @list: list entry for linking
|
||||
* @family: pointer to family, need not be set before registering
|
||||
*/
|
||||
struct genl_multicast_group
|
||||
{
|
||||
struct genl_family *family; /* private */
|
||||
struct list_head list; /* private */
|
||||
char name[GENL_NAMSIZ];
|
||||
u32 id;
|
||||
};
|
||||
|
||||
|
||||
/* Added as of 2.6.23 */
|
||||
int pci_try_set_mwi(struct pci_dev *dev);
|
||||
|
||||
/* Added as of 2.6.23 */
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
/*
|
||||
* Tell the freezer that the current task should be frozen by it
|
||||
*/
|
||||
static inline void set_freezable(void)
|
||||
{
|
||||
current->flags &= ~PF_NOFREEZE;
|
||||
}
|
||||
|
||||
#else
|
||||
static inline void set_freezable(void) {}
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
#else
|
||||
#define tcf_destroy_chain_compat tcf_destroy_chain
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) */
|
||||
|
||||
#endif /* LINUX_26_23_COMPAT_H */
|
||||
@@ -1,247 +0,0 @@
|
||||
#ifndef LINUX_26_24_COMPAT_H
|
||||
#define LINUX_26_24_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.21, 2.6.22 and 2.6.23 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
|
||||
|
||||
#include <asm/atomic.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#define KEY_BLUETOOTH 237
|
||||
#define KEY_WLAN 238
|
||||
#define KEY_UWB 239
|
||||
|
||||
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
|
||||
|
||||
struct proc_dir_entry;
|
||||
struct net_device;
|
||||
struct net {
|
||||
atomic_t count; /* To decided when the network
|
||||
* namespace should be freed.
|
||||
*/
|
||||
atomic_t use_count; /* To track references we
|
||||
* destroy on demand
|
||||
*/
|
||||
struct list_head list; /* list of network namespaces */
|
||||
struct work_struct work; /* work struct for freeing */
|
||||
|
||||
struct proc_dir_entry *proc_net;
|
||||
struct proc_dir_entry *proc_net_stat;
|
||||
struct proc_dir_entry *proc_net_root;
|
||||
|
||||
struct net_device *loopback_dev; /* The loopback */
|
||||
|
||||
struct list_head dev_base_head;
|
||||
struct hlist_head *dev_name_head;
|
||||
struct hlist_head *dev_index_head;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
/* Init's network namespace */
|
||||
extern struct net init_net;
|
||||
#define INIT_NET_NS(net_ns) .net_ns = &init_net,
|
||||
#else
|
||||
#define INIT_NET_NS(net_ns)
|
||||
#endif
|
||||
|
||||
/* Added on 2.6.24 in include/linux/types.h by Al viro on commit 142956af */
|
||||
typedef unsigned long uintptr_t;
|
||||
|
||||
/* From include/linux/net.h */
|
||||
enum sock_shutdown_cmd {
|
||||
SHUT_RD = 0,
|
||||
SHUT_WR = 1,
|
||||
SHUT_RDWR = 2,
|
||||
};
|
||||
|
||||
#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,23)) /* Local check */
|
||||
/* Added as of 2.6.24 in include/linux/skbuff.h.
|
||||
*
|
||||
* Although 2.6.23 does support for CONFIG_NETDEVICES_MULTIQUEUE
|
||||
* this helper was not added until 2.6.24. This implementation
|
||||
* is exactly as it is on newer kernels.
|
||||
*
|
||||
* For older kernels we use the an internal mac80211 hack.
|
||||
* For details see changes to include/net/mac80211.h through
|
||||
* compat.diff and compat/mq_compat.h */
|
||||
static inline u16 skb_get_queue_mapping(struct sk_buff *skb)
|
||||
{
|
||||
#ifdef CONFIG_NETDEVICES_MULTIQUEUE
|
||||
return skb->queue_mapping;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif /* Local 2.6.23 check */
|
||||
|
||||
/* On older kernels we handle this a bit differently, so we yield to that
|
||||
* code for its implementation in mq_compat.h as we want to make
|
||||
* use of the internal mac80211 __ieee80211_queue_stopped() which itself
|
||||
* uses internal mac80211 data structure hacks. */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) /* Local check */
|
||||
/**
|
||||
* netif_subqueue_stopped - test status of subqueue
|
||||
* @dev: network device
|
||||
* @queue_index: sub queue index
|
||||
*
|
||||
* Check individual transmit queue of a device with multiple transmit queues.
|
||||
*/
|
||||
static inline int __netif_subqueue_stopped(const struct net_device *dev,
|
||||
u16 queue_index)
|
||||
{
|
||||
#ifdef CONFIG_NETDEVICES_MULTIQUEUE
|
||||
return test_bit(__LINK_STATE_XOFF,
|
||||
&dev->egress_subqueue[queue_index].state);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Note: although the backport implementation for netif_subqueue_stopped
|
||||
* on older kernels is identical to upstream __netif_subqueue_stopped()
|
||||
* (except for a const qualifier) we implement netif_subqueue_stopped()
|
||||
* as part of mac80211 as it relies on internal mac80211 structures we
|
||||
* use for MQ support. We this implement it in mq_compat.h */
|
||||
|
||||
#endif /* Local 2.6.23 check */
|
||||
|
||||
/*
|
||||
* Force link bug if constructor is used, can't be done compatibly
|
||||
* because constructor arguments were swapped since then!
|
||||
*/
|
||||
extern void __incompatible_kmem_cache_create(void);
|
||||
|
||||
/* 2.6.21 and 2.6.22 kmem_cache_create() takes 6 arguments */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
|
||||
#define kmem_cache_create(name, objsize, align, flags, ctor) \
|
||||
({ \
|
||||
if (ctor) __incompatible_kmem_cache_create(); \
|
||||
kmem_cache_create((name), (objsize), (align), \
|
||||
(flags), NULL, NULL); \
|
||||
})
|
||||
#endif
|
||||
|
||||
/* 2.6.23 kmem_cache_create() takes 5 arguments */
|
||||
#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,23))
|
||||
#define kmem_cache_create(name, objsize, align, flags, ctor) \
|
||||
({ \
|
||||
if (ctor) __incompatible_kmem_cache_create(); \
|
||||
kmem_cache_create((name), (objsize), (align), \
|
||||
(flags), NULL); \
|
||||
})
|
||||
#endif
|
||||
|
||||
/* From include/linux/mod_devicetable.h */
|
||||
|
||||
/* SSB core, see drivers/ssb/ */
|
||||
#ifndef SSB_DEVICE
|
||||
struct ssb_device_id {
|
||||
__u16 vendor;
|
||||
__u16 coreid;
|
||||
__u8 revision;
|
||||
};
|
||||
#define SSB_DEVICE(_vendor, _coreid, _revision) \
|
||||
{ .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
|
||||
#define SSB_DEVTABLE_END \
|
||||
{ 0, },
|
||||
|
||||
#define SSB_ANY_VENDOR 0xFFFF
|
||||
#define SSB_ANY_ID 0xFFFF
|
||||
#define SSB_ANY_REV 0xFF
|
||||
#endif
|
||||
|
||||
|
||||
/* Namespace stuff, introduced on 2.6.24 */
|
||||
#define dev_get_by_index(a, b) dev_get_by_index(b)
|
||||
#define __dev_get_by_index(a, b) __dev_get_by_index(b)
|
||||
|
||||
extern int eth_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, void *daddr,
|
||||
void *saddr, unsigned len);
|
||||
extern int eth_rebuild_header(struct sk_buff *skb);
|
||||
extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
|
||||
unsigned char * haddr);
|
||||
extern int eth_header_cache(struct neighbour *neigh,
|
||||
struct hh_cache *hh);
|
||||
|
||||
/* This structure is simply not present on 2.6.22 and 2.6.23 */
|
||||
struct header_ops {
|
||||
int (*create) (struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, void *daddr,
|
||||
void *saddr, unsigned len);
|
||||
int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
|
||||
int (*rebuild)(struct sk_buff *skb);
|
||||
#define HAVE_HEADER_CACHE
|
||||
int (*cache)(struct neighbour *neigh, struct hh_cache *hh);
|
||||
void (*cache_update)(struct hh_cache *hh,
|
||||
struct net_device *dev,
|
||||
unsigned char *haddr);
|
||||
};
|
||||
|
||||
/* net/ieee80211/ieee80211_crypt_tkip uses sg_init_table. This was added on
|
||||
* 2.6.24. CONFIG_DEBUG_SG was added in 2.6.24 as well, so lets just ignore
|
||||
* the debug stuff. Note that adding this required changes to the struct
|
||||
* scatterlist on include/asm/scatterlist*, so the right way to port this
|
||||
* is to simply ignore the new structure changes and zero the scatterlist
|
||||
* array. We lave the kdoc intact for reference.
|
||||
*/
|
||||
|
||||
/**
|
||||
* sg_mark_end - Mark the end of the scatterlist
|
||||
* @sg: SG entryScatterlist
|
||||
*
|
||||
* Description:
|
||||
* Marks the passed in sg entry as the termination point for the sg
|
||||
* table. A call to sg_next() on this entry will return NULL.
|
||||
*
|
||||
**/
|
||||
static inline void sg_mark_end(struct scatterlist *sg)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_SG
|
||||
BUG_ON(sg->sg_magic != SG_MAGIC);
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
/*
|
||||
* Set termination bit, clear potential chain bit
|
||||
*/
|
||||
sg->page_link |= 0x02;
|
||||
sg->page_link &= ~0x01;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* sg_init_table - Initialize SG table
|
||||
* @sgl: The SG table
|
||||
* @nents: Number of entries in table
|
||||
*
|
||||
* Notes:
|
||||
* If this is part of a chained sg table, sg_mark_end() should be
|
||||
* used only on the last table part.
|
||||
*
|
||||
**/
|
||||
static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
|
||||
{
|
||||
memset(sgl, 0, sizeof(*sgl) * nents);
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_endpoint_num - get the endpoint's number
|
||||
* @epd: endpoint to be checked
|
||||
*
|
||||
* Returns @epd's number: 0 to 15.
|
||||
*/
|
||||
static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
|
||||
{
|
||||
return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
|
||||
}
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) */
|
||||
|
||||
#endif /* LINUX_26_24_COMPAT_H */
|
||||
@@ -1,274 +0,0 @@
|
||||
#ifndef LINUX_26_25_COMPAT_H
|
||||
#define LINUX_26_25_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* Compat work for 2.6.24 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/hw_random.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/pm.h>
|
||||
#include <asm-generic/bug.h>
|
||||
#include <linux/pm_qos_params.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
/*
|
||||
* Backports 312b1485fb509c9bc32eda28ad29537896658cb8
|
||||
* Author: Sam Ravnborg <sam@ravnborg.org>
|
||||
* Date: Mon Jan 28 20:21:15 2008 +0100
|
||||
*
|
||||
* Introduce new section reference annotations tags: __ref, __refdata, __refconst
|
||||
*/
|
||||
#define __ref __init_refok
|
||||
#define __refdata __initdata_refok
|
||||
|
||||
/*
|
||||
* backports 2658fa803111dae1353602e7f586de8e537803e2
|
||||
* We skip proto_ports_offset() as I'm lazy.
|
||||
*/
|
||||
|
||||
static inline bool ipv4_is_loopback(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xff000000)) == htonl(0x7f000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_multicast(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_local_multicast(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_lbcast(__be32 addr)
|
||||
{
|
||||
/* limited broadcast */
|
||||
return addr == htonl(INADDR_BROADCAST);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_zeronet(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xff000000)) == htonl(0x00000000);
|
||||
}
|
||||
|
||||
/* Special-Use IPv4 Addresses (RFC3330) */
|
||||
|
||||
static inline bool ipv4_is_private_10(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xff000000)) == htonl(0x0a000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_private_172(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xfff00000)) == htonl(0xac100000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_private_192(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffff0000)) == htonl(0xc0a80000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_linklocal_169(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_anycast_6to4(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffffff00)) == htonl(0xc0586300);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_test_192(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffffff00)) == htonl(0xc0000200);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_test_198(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xfffe0000)) == htonl(0xc6120000);
|
||||
}
|
||||
|
||||
/*
|
||||
* phys_addr_t was added as a generic arch typedef on 2.6.28,
|
||||
* that backport is dealt with in compat-2.6.28.h
|
||||
*/
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
|
||||
|
||||
#if defined(CONFIG_64BIT) || defined(CONFIG_X86_PAE) || defined(CONFIG_PHYS_64BIT)
|
||||
typedef u64 phys_addr_t;
|
||||
#else
|
||||
typedef u32 phys_addr_t;
|
||||
#endif
|
||||
|
||||
#endif /* x86 */
|
||||
|
||||
/* The macro below uses a const upstream, this differs */
|
||||
|
||||
/**
|
||||
* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table
|
||||
* @_table: device table name
|
||||
*
|
||||
* This macro is used to create a struct pci_device_id array (a device table)
|
||||
* in a generic manner.
|
||||
*/
|
||||
#define DEFINE_PCI_DEVICE_TABLE(_table) \
|
||||
const struct pci_device_id _table[] __devinitdata
|
||||
|
||||
/*
|
||||
* Backport work for QoS dependencies (kernel/pm_qos_params.c)
|
||||
* pm-qos stuff written by mark gross mgross@linux.intel.com.
|
||||
*
|
||||
* ipw2100 now makes use of:
|
||||
*
|
||||
* pm_qos_add_requirement(),
|
||||
* pm_qos_update_requirement() and
|
||||
* pm_qos_remove_requirement() from it
|
||||
*
|
||||
* mac80211 uses the network latency to determine if to enable or not
|
||||
* dynamic PS. mac80211 also and registers a notifier for when
|
||||
* the latency changes. Since older kernels do no thave pm-qos stuff
|
||||
* we just implement it completley here and register it upon cfg80211
|
||||
* init. I haven't tested ipw2100 on 2.6.24 though.
|
||||
*
|
||||
* This pm-qos implementation is copied verbatim from the kernel
|
||||
* written by mark gross mgross@linux.intel.com. You don't have
|
||||
* to do anythinig to use pm-qos except use the same exported
|
||||
* routines as used in newer kernels. The compat_pm_qos_power_init()
|
||||
* defned below is used by the compat module to initialize pm-qos.
|
||||
*/
|
||||
int compat_pm_qos_power_init(void);
|
||||
int compat_pm_qos_power_deinit(void);
|
||||
|
||||
/*
|
||||
* 2.6.25 adds PM_EVENT_HIBERNATE as well here but
|
||||
* we don't have this on <= 2.6.23)
|
||||
*/
|
||||
#ifndef PM_EVENT_SLEEP /* some distribution have mucked with their own headers to add this.. */
|
||||
#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND)
|
||||
#endif
|
||||
|
||||
/* Although we don't care about wimax this is needed for rfkill input stuff */
|
||||
#define KEY_WIMAX 246
|
||||
|
||||
/* Although pm_qos stuff is not implemented on <= 2.6.24 lets keep the define */
|
||||
#define PM_QOS_DEFAULT_VALUE -1
|
||||
|
||||
#define __WARN(foo) dump_stack()
|
||||
|
||||
#define dev_emerg(dev, format, arg...) \
|
||||
dev_printk(KERN_EMERG , dev , format , ## arg)
|
||||
#define dev_alert(dev, format, arg...) \
|
||||
dev_printk(KERN_ALERT , dev , format , ## arg)
|
||||
#define dev_crit(dev, format, arg...) \
|
||||
dev_printk(KERN_CRIT , dev , format , ## arg)
|
||||
|
||||
extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
|
||||
extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
|
||||
|
||||
#define seq_file_net &init_net;
|
||||
|
||||
enum nf_inet_hooks {
|
||||
NF_INET_PRE_ROUTING = 0,
|
||||
NF_INET_LOCAL_IN = 1,
|
||||
NF_INET_FORWARD = 2,
|
||||
NF_INET_LOCAL_OUT = 3,
|
||||
NF_INET_POST_ROUTING = 4,
|
||||
NF_INET_NUMHOOKS = 5
|
||||
};
|
||||
|
||||
/* The patch:
|
||||
* commit 8b5f6883683c91ad7e1af32b7ceeb604d68e2865
|
||||
* Author: Marcin Slusarz <marcin.slusarz@gmail.com>
|
||||
* Date: Fri Feb 8 04:20:12 2008 -0800
|
||||
*
|
||||
* byteorder: move le32_add_cpu & friends from OCFS2 to core
|
||||
*
|
||||
* moves le*_add_cpu and be*_add_cpu functions from OCFS2 to core
|
||||
* header (1st) and converted some existing code to it. We port
|
||||
* it here as later kernels will most likely use it.
|
||||
*/
|
||||
static inline void le16_add_cpu(__le16 *var, u16 val)
|
||||
{
|
||||
*var = cpu_to_le16(le16_to_cpu(*var) + val);
|
||||
}
|
||||
|
||||
static inline void le32_add_cpu(__le32 *var, u32 val)
|
||||
{
|
||||
*var = cpu_to_le32(le32_to_cpu(*var) + val);
|
||||
}
|
||||
|
||||
static inline void le64_add_cpu(__le64 *var, u64 val)
|
||||
{
|
||||
*var = cpu_to_le64(le64_to_cpu(*var) + val);
|
||||
}
|
||||
|
||||
static inline void be16_add_cpu(__be16 *var, u16 val)
|
||||
{
|
||||
u16 v = be16_to_cpu(*var);
|
||||
*var = cpu_to_be16(v + val);
|
||||
}
|
||||
|
||||
static inline void be32_add_cpu(__be32 *var, u32 val)
|
||||
{
|
||||
u32 v = be32_to_cpu(*var);
|
||||
*var = cpu_to_be32(v + val);
|
||||
}
|
||||
|
||||
static inline void be64_add_cpu(__be64 *var, u64 val)
|
||||
{
|
||||
u64 v = be64_to_cpu(*var);
|
||||
*var = cpu_to_be64(v + val);
|
||||
}
|
||||
|
||||
/* 2.6.25 changes hwrng_unregister()'s behaviour by supporting
|
||||
* suspend of its parent device (the misc device, which is itself the
|
||||
* hardware random number generator). It does this by passing a parameter to
|
||||
* unregister_miscdev() which is not supported in older kernels. The suspend
|
||||
* parameter allows us to enable access to the device's hardware
|
||||
* number generator during suspend. As far as wireless is concerned this means
|
||||
* if a driver goes to suspend it you won't have the HNR available in
|
||||
* older kernels. */
|
||||
static inline void __hwrng_unregister(struct hwrng *rng, bool suspended)
|
||||
{
|
||||
hwrng_unregister(rng);
|
||||
}
|
||||
|
||||
static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
|
||||
{
|
||||
led_classdev_unregister(lcd);
|
||||
}
|
||||
|
||||
/**
|
||||
* The following things are out of ./include/linux/kernel.h
|
||||
* The new iwlwifi driver is using them.
|
||||
*/
|
||||
extern int strict_strtoul(const char *, unsigned int, unsigned long *);
|
||||
extern int strict_strtol(const char *, unsigned int, long *);
|
||||
|
||||
#else
|
||||
/*
|
||||
* Kernels >= 2.6.25 have pm-qos and its initialized as part of
|
||||
* the bootup process
|
||||
*/
|
||||
static inline int compat_pm_qos_power_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int compat_pm_qos_power_deinit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */
|
||||
|
||||
#endif /* LINUX_26_25_COMPAT_H */
|
||||
@@ -1,455 +0,0 @@
|
||||
#ifndef LINUX_26_26_COMPAT_H
|
||||
#define LINUX_26_26_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <net/sock.h>
|
||||
#include <linux/fs.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
#include <net/net_namespace.h>
|
||||
#endif
|
||||
#include <linux/fs.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/div64.h>
|
||||
|
||||
/* These jiffie helpers added as of 2.6.26 */
|
||||
|
||||
/*
|
||||
* These four macros compare jiffies and 'a' for convenience.
|
||||
*/
|
||||
|
||||
/* time_is_before_jiffies(a) return true if a is before jiffies */
|
||||
#define time_is_before_jiffies(a) time_after(jiffies, a)
|
||||
|
||||
/* time_is_after_jiffies(a) return true if a is after jiffies */
|
||||
#define time_is_after_jiffies(a) time_before(jiffies, a)
|
||||
|
||||
/* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/
|
||||
#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
|
||||
|
||||
/* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/
|
||||
#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a)
|
||||
|
||||
/* This comes from include/linux/input.h */
|
||||
#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
|
||||
set = radio enabled */
|
||||
|
||||
/* From kernel.h */
|
||||
#define USHORT_MAX ((u16)(~0U))
|
||||
#define SHORT_MAX ((s16)(USHORT_MAX>>1))
|
||||
#define SHORT_MIN (-SHORT_MAX - 1)
|
||||
|
||||
extern int dev_set_name(struct device *dev, const char *name, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
|
||||
/**
|
||||
* clamp - return a value clamped to a given range with strict typechecking
|
||||
* @val: current value
|
||||
* @min: minimum allowable value
|
||||
* @max: maximum allowable value
|
||||
*
|
||||
* This macro does strict typechecking of min/max to make sure they are of the
|
||||
* same type as val. See the unnecessary pointer comparisons.
|
||||
*/
|
||||
#define clamp(val, min, max) ({ \
|
||||
typeof(val) __val = (val); \
|
||||
typeof(min) __min = (min); \
|
||||
typeof(max) __max = (max); \
|
||||
(void) (&__val == &__min); \
|
||||
(void) (&__val == &__max); \
|
||||
__val = __val < __min ? __min: __val; \
|
||||
__val > __max ? __max: __val; })
|
||||
|
||||
/**
|
||||
* clamp_t - return a value clamped to a given range using a given type
|
||||
* @type: the type of variable to use
|
||||
* @val: current value
|
||||
* @min: minimum allowable value
|
||||
* @max: maximum allowable value
|
||||
*
|
||||
* This macro does no typechecking and uses temporary variables of type
|
||||
* 'type' to make all the comparisons.
|
||||
*/
|
||||
#define clamp_t(type, val, min, max) ({ \
|
||||
type __val = (val); \
|
||||
type __min = (min); \
|
||||
type __max = (max); \
|
||||
__val = __val < __min ? __min: __val; \
|
||||
__val > __max ? __max: __val; })
|
||||
|
||||
|
||||
/* from include/linux/device.h */
|
||||
/* device_create_drvdata() is new */
|
||||
extern struct device *device_create_drvdata(struct class *cls,
|
||||
struct device *parent,
|
||||
dev_t devt,
|
||||
void *drvdata,
|
||||
const char *fmt, ...)
|
||||
__attribute__((format(printf, 5, 6)));
|
||||
|
||||
/* This is from include/linux/list.h */
|
||||
|
||||
/**
|
||||
* list_is_singular - tests whether a list has just one entry.
|
||||
* @head: the list to test.
|
||||
*/
|
||||
static inline int list_is_singular(const struct list_head *head)
|
||||
{
|
||||
return !list_empty(head) && (head->next == head->prev);
|
||||
}
|
||||
|
||||
/* This is from include/linux/device.h, which was added as of 2.6.26 */
|
||||
static inline const char *dev_name(struct device *dev)
|
||||
{
|
||||
/* will be changed into kobject_name(&dev->kobj) in the near future */
|
||||
return dev->bus_id;
|
||||
}
|
||||
|
||||
/* This is from include/linux/kernel.h, which was added as of 2.6.26 */
|
||||
|
||||
/**
|
||||
* clamp_val - return a value clamped to a given range using val's type
|
||||
* @val: current value
|
||||
* @min: minimum allowable value
|
||||
* @max: maximum allowable value
|
||||
*
|
||||
* This macro does no typechecking and uses temporary variables of whatever
|
||||
* type the input argument 'val' is. This is useful when val is an unsigned
|
||||
* type and min and max are literals that will otherwise be assigned a signed
|
||||
* integer type.
|
||||
*/
|
||||
|
||||
#define clamp_val(val, min, max) ({ \
|
||||
typeof(val) __val = (val); \
|
||||
typeof(val) __min = (min); \
|
||||
typeof(val) __max = (max); \
|
||||
__val = __val < __min ? __min: __val; \
|
||||
__val > __max ? __max: __val; })
|
||||
|
||||
/* This comes from include/net/net_namespace.h */
|
||||
|
||||
#ifdef CONFIG_NET_NS
|
||||
static inline
|
||||
int net_eq(const struct net *net1, const struct net *net2)
|
||||
{
|
||||
return net1 == net2;
|
||||
}
|
||||
#else
|
||||
static inline
|
||||
int net_eq(const struct net *net1, const struct net *net2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline
|
||||
void dev_net_set(struct net_device *dev, struct net *net)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
release_net(dev->nd_net);
|
||||
dev->nd_net = hold_net(net);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
struct net *sock_net(const struct sock *sk)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
return sk->sk_net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This comes from include/linux/netdevice.h */
|
||||
|
||||
/*
|
||||
* Net namespace inlines
|
||||
*/
|
||||
static inline
|
||||
struct net *dev_net(const struct net_device *dev)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
/*
|
||||
* compat-wirelss backport note:
|
||||
* For older kernels we may just need to always return init_net,
|
||||
* not sure when we added dev->nd_net.
|
||||
*/
|
||||
return dev->nd_net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 2.6.26 added its own unaligned API which the
|
||||
* new drivers can use. Lets port it here by including it in older
|
||||
* kernels and also deal with the architecture handling here.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ALPHA
|
||||
|
||||
#include <linux/unaligned/be_struct.h>
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* alpha */
|
||||
#ifdef CONFIG_ARM
|
||||
|
||||
/* arm */
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/be_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* arm */
|
||||
#ifdef CONFIG_AVR32
|
||||
|
||||
/*
|
||||
* AVR32 can handle some unaligned accesses, depending on the
|
||||
* implementation. The AVR32 AP implementation can handle unaligned
|
||||
* words, but halfwords must be halfword-aligned, and doublewords must
|
||||
* be word-aligned.
|
||||
*
|
||||
* However, swapped word loads must be word-aligned so we can't
|
||||
* optimize word loads in general.
|
||||
*/
|
||||
|
||||
#include <linux/unaligned/be_struct.h>
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif
|
||||
#ifdef CONFIG_BLACKFIN
|
||||
|
||||
#include <linux/unaligned/le_struct.h>
|
||||
#include <linux/unaligned/be_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* blackfin */
|
||||
#ifdef CONFIG_CRIS
|
||||
|
||||
/*
|
||||
* CRIS can do unaligned accesses itself.
|
||||
*/
|
||||
#include <linux/unaligned/access_ok.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* cris */
|
||||
#ifdef CONFIG_FRV
|
||||
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/be_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* frv */
|
||||
#ifdef CONFIG_H8300
|
||||
|
||||
#include <linux/unaligned/be_memmove.h>
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* h8300 */
|
||||
#ifdef CONFIG_IA64
|
||||
|
||||
#include <linux/unaligned/le_struct.h>
|
||||
#include <linux/unaligned/be_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* ia64 */
|
||||
#ifdef CONFIG_M32R
|
||||
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
# include <linux/unaligned/le_memmove.h>
|
||||
# include <linux/unaligned/be_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
#else
|
||||
# include <linux/unaligned/be_memmove.h>
|
||||
# include <linux/unaligned/le_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
#endif
|
||||
|
||||
#endif /* m32r */
|
||||
#ifdef CONFIG_M68K /* this handles both m68k and m68knommu */
|
||||
|
||||
#ifdef CONFIG_COLDFIRE
|
||||
#include <linux/unaligned/be_struct.h>
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
#else
|
||||
|
||||
/*
|
||||
* The m68k can do unaligned accesses itself.
|
||||
*/
|
||||
#include <linux/unaligned/access_ok.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
#endif
|
||||
|
||||
#endif /* m68k and m68knommu */
|
||||
#ifdef CONFIG_MIPS
|
||||
|
||||
#if defined(__MIPSEB__)
|
||||
# include <linux/unaligned/be_struct.h>
|
||||
# include <linux/unaligned/le_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
# define get_unaligned __get_unaligned_be
|
||||
# define put_unaligned __put_unaligned_be
|
||||
#elif defined(__MIPSEL__)
|
||||
# include <linux/unaligned/le_struct.h>
|
||||
# include <linux/unaligned/be_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
#endif
|
||||
|
||||
#endif /* mips */
|
||||
#ifdef CONFIG_MN10300
|
||||
|
||||
#include <linux/unaligned/access_ok.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* mn10300 */
|
||||
#ifdef CONFIG_PARISC
|
||||
|
||||
#include <linux/unaligned/be_struct.h>
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* parisc */
|
||||
#ifdef CONFIG_PPC
|
||||
/*
|
||||
* The PowerPC can do unaligned accesses itself in big endian mode.
|
||||
*/
|
||||
#include <linux/unaligned/access_ok.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* ppc */
|
||||
#ifdef CONFIG_S390
|
||||
|
||||
/*
|
||||
* The S390 can do unaligned accesses itself.
|
||||
*/
|
||||
#include <linux/unaligned/access_ok.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* s390 */
|
||||
#ifdef CONFIG_SUPERH
|
||||
|
||||
/* SH can't handle unaligned accesses. */
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
# include <linux/unaligned/le_struct.h>
|
||||
# include <linux/unaligned/be_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
#else
|
||||
# include <linux/unaligned/be_struct.h>
|
||||
# include <linux/unaligned/le_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
#endif
|
||||
|
||||
#endif /* sh - SUPERH */
|
||||
#ifdef CONFIG_SPARC
|
||||
|
||||
/* sparc and sparc64 */
|
||||
#include <linux/unaligned/be_struct.h>
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* sparc */
|
||||
#ifdef CONFIG_UML
|
||||
|
||||
#include "asm/arch/unaligned.h"
|
||||
|
||||
#endif /* um - uml */
|
||||
#ifdef CONFIG_V850
|
||||
|
||||
#include <linux/unaligned/be_byteshift.h>
|
||||
#include <linux/unaligned/le_byteshift.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* v850 */
|
||||
#ifdef CONFIG_X86
|
||||
/*
|
||||
* The x86 can do unaligned accesses itself.
|
||||
*/
|
||||
#include <linux/unaligned/access_ok.h>
|
||||
#include <linux/unaligned/generic.h>
|
||||
|
||||
#endif /* x86 */
|
||||
#ifdef CONFIG_XTENSA
|
||||
|
||||
#ifdef __XTENSA_EL__
|
||||
# include <linux/unaligned/le_memmove.h>
|
||||
# include <linux/unaligned/be_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
#elif defined(__XTENSA_EB__)
|
||||
# include <linux/unaligned/be_memmove.h>
|
||||
# include <linux/unaligned/le_byteshift.h>
|
||||
# include <linux/unaligned/generic.h>
|
||||
#else
|
||||
# error processor byte order undefined!
|
||||
#endif
|
||||
|
||||
#endif /* xtensa */
|
||||
|
||||
#define PCIE_LINK_STATE_L0S 1
|
||||
#define PCIE_LINK_STATE_L1 2
|
||||
#define PCIE_LINK_STATE_CLKPM 4
|
||||
|
||||
static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
|
||||
{
|
||||
}
|
||||
/* source: include/linux/pci-aspm.h */
|
||||
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
|
||||
/**
|
||||
* div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
|
||||
*
|
||||
* This is commonly provided by 32bit archs to provide an optimized 64bit
|
||||
* divide.
|
||||
*/
|
||||
static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
|
||||
{
|
||||
*remainder = dividend % divisor;
|
||||
return dividend / divisor;
|
||||
}
|
||||
|
||||
#elif BITS_PER_LONG == 32
|
||||
|
||||
#ifndef div_u64_rem
|
||||
static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
|
||||
{
|
||||
*remainder = do_div(dividend, divisor);
|
||||
return dividend;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BITS_PER_LONG */
|
||||
|
||||
/**
|
||||
* div_u64 - unsigned 64bit divide with 32bit divisor
|
||||
*
|
||||
* This is the most common 64bit divide and should be used if possible,
|
||||
* as many 32bit archs can optimize this variant better than a full 64bit
|
||||
* divide.
|
||||
*/
|
||||
#ifndef div_u64
|
||||
static inline u64 div_u64(u64 dividend, u32 divisor)
|
||||
{
|
||||
u32 remainder;
|
||||
return div_u64_rem(dividend, divisor, &remainder);
|
||||
}
|
||||
#endif
|
||||
/* source: include/math64.h */
|
||||
|
||||
#define hex_asc_lo(x) hex_asc((x) & 0x0f)
|
||||
#define hex_asc_hi(x) hex_asc(((x) & 0xf0) >> 4)
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) */
|
||||
|
||||
#endif /* LINUX_26_26_COMPAT_H */
|
||||
@@ -1,263 +0,0 @@
|
||||
#ifndef LINUX_26_27_COMPAT_H
|
||||
#define LINUX_26_27_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
#include <linux/mmc/sdio.h>
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <net/iw_handler.h>
|
||||
#include <asm-generic/bug.h>
|
||||
#include <linux/wireless.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/sch_generic.h>
|
||||
#include <linux/ethtool.h>
|
||||
|
||||
#define PCI_PM_CAP_PME_SHIFT 11
|
||||
|
||||
/* I can't find a more suitable replacement... */
|
||||
#define flush_work(work) cancel_work_sync(work)
|
||||
|
||||
struct builtin_fw {
|
||||
char *name;
|
||||
void *data;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
/*
|
||||
* On older kernels we do not have net_device Multi Queue support, but
|
||||
* since we no longer use MQ on mac80211 we can simply use the 0 queue.
|
||||
* Note that if other fullmac drivers make use of this they then need
|
||||
* to be backported somehow or deal with just 1 queueue from MQ.
|
||||
*/
|
||||
static inline void netif_tx_wake_all_queues(struct net_device *dev)
|
||||
{
|
||||
netif_wake_queue(dev);
|
||||
}
|
||||
static inline void netif_tx_start_all_queues(struct net_device *dev)
|
||||
{
|
||||
netif_start_queue(dev);
|
||||
}
|
||||
static inline void netif_tx_stop_all_queues(struct net_device *dev)
|
||||
{
|
||||
netif_stop_queue(dev);
|
||||
}
|
||||
|
||||
/* Are all TX queues of the device empty? */
|
||||
static inline bool qdisc_all_tx_empty(const struct net_device *dev)
|
||||
{
|
||||
return skb_queue_empty(&dev->qdisc->q);
|
||||
}
|
||||
|
||||
bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
|
||||
|
||||
/*
|
||||
* The net_device has a spin_lock on newer kernels, on older kernels we're out of luck
|
||||
*/
|
||||
#define netif_addr_lock_bh(dev)
|
||||
#define netif_addr_unlock_bh(dev)
|
||||
|
||||
/*
|
||||
* To port this properly we'd have to port warn_slowpath_null(),
|
||||
* which I'm lazy to do so just do a regular print for now. If you
|
||||
* want to port this read kernel/panic.c
|
||||
*/
|
||||
#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
|
||||
|
||||
/* This is ported directly as-is on newer kernels */
|
||||
#ifndef WARN
|
||||
#define WARN(condition, format...) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
__WARN_printf(format); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
|
||||
/* On 2.6.27 a second argument was added, on older kernels we ignore it */
|
||||
#define dma_mapping_error(pdev, dma_addr) dma_mapping_error(dma_addr)
|
||||
#define pci_dma_mapping_error(pdev, dma_addr) dma_mapping_error(pdev, dma_addr)
|
||||
|
||||
/* This is from include/linux/ieee80211.h */
|
||||
#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
|
||||
|
||||
/* New link list changes added as of 2.6.27, needed for ath9k */
|
||||
|
||||
static inline void __list_cut_position(struct list_head *list,
|
||||
struct list_head *head, struct list_head *entry)
|
||||
{
|
||||
struct list_head *new_first = entry->next;
|
||||
list->next = head->next;
|
||||
list->next->prev = list;
|
||||
list->prev = entry;
|
||||
entry->next = list;
|
||||
head->next = new_first;
|
||||
new_first->prev = head;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_cut_position - cut a list into two
|
||||
* @list: a new list to add all removed entries
|
||||
* @head: a list with entries
|
||||
* @entry: an entry within head, could be the head itself
|
||||
* and if so we won't cut the list
|
||||
*
|
||||
* This helper moves the initial part of @head, up to and
|
||||
* including @entry, from @head to @list. You should
|
||||
* pass on @entry an element you know is on @head. @list
|
||||
* should be an empty list or a list you do not care about
|
||||
* losing its data.
|
||||
*
|
||||
*/
|
||||
static inline void list_cut_position(struct list_head *list,
|
||||
struct list_head *head, struct list_head *entry)
|
||||
{
|
||||
if (list_empty(head))
|
||||
return;
|
||||
if (list_is_singular(head) &&
|
||||
(head->next != entry && head != entry))
|
||||
return;
|
||||
if (entry == head)
|
||||
INIT_LIST_HEAD(list);
|
||||
else
|
||||
__list_cut_position(list, head, entry);
|
||||
}
|
||||
|
||||
|
||||
/* __list_splice as re-implemented on 2.6.27, we backport it */
|
||||
static inline void __compat_list_splice_new_27(const struct list_head *list,
|
||||
struct list_head *prev,
|
||||
struct list_head *next)
|
||||
{
|
||||
struct list_head *first = list->next;
|
||||
struct list_head *last = list->prev;
|
||||
|
||||
first->prev = prev;
|
||||
prev->next = first;
|
||||
|
||||
last->next = next;
|
||||
next->prev = last;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_splice_tail - join two lists, each list being a queue
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
*/
|
||||
static inline void list_splice_tail(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list))
|
||||
__compat_list_splice_new_27(list, head->prev, head);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_splice_tail_init - join two lists and reinitialise the emptied list
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
*
|
||||
* Each of the lists is a queue.
|
||||
* The list at @list is reinitialised
|
||||
*/
|
||||
static inline void list_splice_tail_init(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list)) {
|
||||
__compat_list_splice_new_27(list, head->prev, head);
|
||||
INIT_LIST_HEAD(list);
|
||||
}
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
|
||||
extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */
|
||||
|
||||
#define iwe_stream_add_value(info, event, value, ends, iwe, event_len) iwe_stream_add_value(event, value, ends, iwe, event_len)
|
||||
#define iwe_stream_add_point(info, stream, ends, iwe, extra) iwe_stream_add_point(stream, ends, iwe, extra)
|
||||
#define iwe_stream_add_event(info, stream, ends, iwe, event_len) iwe_stream_add_event(stream, ends, iwe, event_len)
|
||||
|
||||
/* Flags available in struct iw_request_info */
|
||||
#define IW_REQUEST_FLAG_COMPAT 0x0001 /* Compat ioctl call */
|
||||
|
||||
static inline int iwe_stream_lcp_len(struct iw_request_info *info)
|
||||
{
|
||||
#ifdef CONFIG_COMPAT
|
||||
if (info->flags & IW_REQUEST_FLAG_COMPAT)
|
||||
return IW_EV_COMPAT_LCP_LEN;
|
||||
#endif
|
||||
return IW_EV_LCP_LEN;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARM
|
||||
|
||||
/*
|
||||
* The caller asks to handle a range between offset and offset + size,
|
||||
* but we process a larger range from 0 to offset + size due to lack of
|
||||
* offset support.
|
||||
*/
|
||||
|
||||
static inline void dma_sync_single_range_for_cpu(struct device *dev,
|
||||
dma_addr_t handle, unsigned long offset, size_t size,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
dma_sync_single_for_cpu(dev, handle, offset + size, dir);
|
||||
}
|
||||
|
||||
static inline void dma_sync_single_range_for_device(struct device *dev,
|
||||
dma_addr_t handle, unsigned long offset, size_t size,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
dma_sync_single_for_device(dev, handle, offset + size, dir);
|
||||
}
|
||||
|
||||
#endif /* arm */
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
void debugfs_remove_recursive(struct dentry *dentry);
|
||||
#else
|
||||
static inline void debugfs_remove_recursive(struct dentry *dentry)
|
||||
{ }
|
||||
#endif
|
||||
|
||||
#define device_create(cls, parent, devt, drvdata, fmt, ...) \
|
||||
({ \
|
||||
struct device *_dev; \
|
||||
_dev = (device_create)(cls, parent, devt, fmt, __VA_ARGS__); \
|
||||
dev_set_drvdata(_dev, drvdata); \
|
||||
_dev; \
|
||||
})
|
||||
|
||||
#define dev_name(dev) dev_name((struct device *)dev)
|
||||
|
||||
static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
|
||||
__u32 speed)
|
||||
{
|
||||
ep->speed = (__u16)speed;
|
||||
}
|
||||
|
||||
static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
|
||||
{
|
||||
return ep->speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* lower_32_bits - return bits 0-31 of a number
|
||||
* @n: the number we're accessing
|
||||
*/
|
||||
#define lower_32_bits(n) ((u32)(n))
|
||||
|
||||
#define netif_wake_subqueue netif_start_subqueue
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) */
|
||||
|
||||
#endif /* LINUX_26_27_COMPAT_H */
|
||||
@@ -1,268 +0,0 @@
|
||||
#ifndef LINUX_26_28_COMPAT_H
|
||||
#define LINUX_26_28_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
#ifndef ETH_P_PAE
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#endif
|
||||
|
||||
#include <linux/pci.h>
|
||||
|
||||
typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } compat_cpumask_t;
|
||||
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_X86_64) || defined(CONFIG_PPC)
|
||||
/*
|
||||
* CONFIG_PHYS_ADDR_T_64BIT was added as new to all architectures
|
||||
* as of 2.6.28 but x86 and ppc had it already. x86 only got phys_addr_t
|
||||
* as of 2.6.25 but then is backported in compat-2.6.25.h
|
||||
*/
|
||||
#else
|
||||
#if defined(CONFIG_64BIT) || defined(CONFIG_X86_PAE) || defned(CONFIG_PPC64) || defined(CONFIG_PHYS_64BIT)
|
||||
#define CONFIG_PHYS_ADDR_T_64BIT 1
|
||||
typedef u64 phys_addr_t;
|
||||
#else
|
||||
typedef u32 phys_addr_t;
|
||||
#endif
|
||||
|
||||
#endif /* non x86 and ppc */
|
||||
|
||||
#ifndef WARN_ONCE
|
||||
#define WARN_ONCE(condition, format...) ({ \
|
||||
static int __warned; \
|
||||
int __ret_warn_once = !!(condition); \
|
||||
\
|
||||
if (unlikely(__ret_warn_once)) \
|
||||
if (WARN(!__warned, format)) \
|
||||
__warned = 1; \
|
||||
unlikely(__ret_warn_once); \
|
||||
})
|
||||
#endif /* From include/asm-generic/bug.h */
|
||||
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
|
||||
#include <pcmcia/cs_types.h>
|
||||
#include <pcmcia/cs.h>
|
||||
#include <pcmcia/cistpl.h>
|
||||
#ifdef pcmcia_parse_tuple
|
||||
#undef pcmcia_parse_tuple
|
||||
#define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse)
|
||||
#endif
|
||||
|
||||
/* From : include/pcmcia/ds.h */
|
||||
/* loop CIS entries for valid configuration */
|
||||
int pcmcia_loop_config(struct pcmcia_device *p_dev,
|
||||
int (*conf_check) (struct pcmcia_device *p_dev,
|
||||
cistpl_cftable_entry_t *cfg,
|
||||
cistpl_cftable_entry_t *dflt,
|
||||
unsigned int vcc,
|
||||
void *priv_data),
|
||||
void *priv_data);
|
||||
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
|
||||
/* USB anchors were added as of 2.6.23 */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
|
||||
|
||||
#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
|
||||
#if 0
|
||||
extern void usb_poison_urb(struct urb *urb);
|
||||
#endif
|
||||
extern void usb_unpoison_urb(struct urb *urb);
|
||||
|
||||
#if 0
|
||||
extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
|
||||
#endif
|
||||
|
||||
extern int usb_anchor_empty(struct usb_anchor *anchor);
|
||||
#endif /* CONFIG_USB */
|
||||
#endif
|
||||
|
||||
|
||||
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
|
||||
|
||||
/**
|
||||
* skb_queue_is_last - check if skb is the last entry in the queue
|
||||
* @list: queue head
|
||||
* @skb: buffer
|
||||
*
|
||||
* Returns true if @skb is the last buffer on the list.
|
||||
*/
|
||||
static inline bool skb_queue_is_last(const struct sk_buff_head *list,
|
||||
const struct sk_buff *skb)
|
||||
{
|
||||
return (skb->next == (struct sk_buff *) list);
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_queue_next - return the next packet in the queue
|
||||
* @list: queue head
|
||||
* @skb: current buffer
|
||||
*
|
||||
* Return the next packet in @list after @skb. It is only valid to
|
||||
* call this if skb_queue_is_last() evaluates to false.
|
||||
*/
|
||||
static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
|
||||
const struct sk_buff *skb)
|
||||
{
|
||||
/* This BUG_ON may seem severe, but if we just return then we
|
||||
* are going to dereference garbage.
|
||||
*/
|
||||
BUG_ON(skb_queue_is_last(list, skb));
|
||||
return skb->next;
|
||||
}
|
||||
|
||||
/**
|
||||
* __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head
|
||||
* @list: queue to initialize
|
||||
*
|
||||
* This initializes only the list and queue length aspects of
|
||||
* an sk_buff_head object. This allows to initialize the list
|
||||
* aspects of an sk_buff_head without reinitializing things like
|
||||
* the spinlock. It can also be used for on-stack sk_buff_head
|
||||
* objects where the spinlock is known to not be used.
|
||||
*/
|
||||
static inline void __skb_queue_head_init(struct sk_buff_head *list)
|
||||
{
|
||||
list->prev = list->next = (struct sk_buff *)list;
|
||||
list->qlen = 0;
|
||||
}
|
||||
|
||||
static inline void __skb_queue_splice(const struct sk_buff_head *list,
|
||||
struct sk_buff *prev,
|
||||
struct sk_buff *next)
|
||||
{
|
||||
struct sk_buff *first = list->next;
|
||||
struct sk_buff *last = list->prev;
|
||||
|
||||
first->prev = prev;
|
||||
prev->next = first;
|
||||
|
||||
last->next = next;
|
||||
next->prev = last;
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_queue_splice - join two skb lists, this is designed for stacks
|
||||
* @list: the new list to add
|
||||
* @head: the place to add it in the first list
|
||||
*/
|
||||
static inline void skb_queue_splice(const struct sk_buff_head *list,
|
||||
struct sk_buff_head *head)
|
||||
{
|
||||
if (!skb_queue_empty(list)) {
|
||||
__skb_queue_splice(list, (struct sk_buff *) head, head->next);
|
||||
head->qlen += list->qlen;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_queue_splice - join two skb lists and reinitialise the emptied list
|
||||
* @list: the new list to add
|
||||
* @head: the place to add it in the first list
|
||||
*
|
||||
* The list at @list is reinitialised
|
||||
*/
|
||||
static inline void skb_queue_splice_init(struct sk_buff_head *list,
|
||||
struct sk_buff_head *head)
|
||||
{
|
||||
if (!skb_queue_empty(list)) {
|
||||
__skb_queue_splice(list, (struct sk_buff *) head, head->next);
|
||||
head->qlen += list->qlen;
|
||||
__skb_queue_head_init(list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_queue_splice_tail - join two skb lists and reinitialise the emptied list
|
||||
* @list: the new list to add
|
||||
* @head: the place to add it in the first list
|
||||
*
|
||||
* Each of the lists is a queue.
|
||||
* The list at @list is reinitialised
|
||||
*/
|
||||
static inline void skb_queue_splice_tail_init(struct sk_buff_head *list,
|
||||
struct sk_buff_head *head)
|
||||
{
|
||||
if (!skb_queue_empty(list)) {
|
||||
__skb_queue_splice(list, head->prev, (struct sk_buff *) head);
|
||||
head->qlen += list->qlen;
|
||||
__skb_queue_head_init(list);
|
||||
}
|
||||
} /* From include/linux/skbuff.h */
|
||||
|
||||
/**
|
||||
* skb_queue_splice_tail - join two skb lists, each list being a queue
|
||||
* @list: the new list to add
|
||||
* @head: the place to add it in the first list
|
||||
*/
|
||||
static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
|
||||
struct sk_buff_head *head)
|
||||
{
|
||||
if (!skb_queue_empty(list)) {
|
||||
__skb_queue_splice(list, head->prev, (struct sk_buff *) head);
|
||||
head->qlen += list->qlen;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DECLARE_TRACE
|
||||
|
||||
#define TP_PROTO(args...) args
|
||||
#define TP_ARGS(args...) args
|
||||
|
||||
#define DECLARE_TRACE(name, proto, args) \
|
||||
static inline void _do_trace_##name(struct tracepoint *tp, proto) \
|
||||
{ } \
|
||||
static inline void trace_##name(proto) \
|
||||
{ } \
|
||||
static inline int register_trace_##name(void (*probe)(proto)) \
|
||||
{ \
|
||||
return -ENOSYS; \
|
||||
} \
|
||||
static inline int unregister_trace_##name(void (*probe)(proto)) \
|
||||
{ \
|
||||
return -ENOSYS; \
|
||||
}
|
||||
|
||||
#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
|
||||
#define EXPORT_TRACEPOINT_SYMBOL(name)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* openSuse includes round_jiffies_up in it's kernel 2.6.27.
|
||||
* This is needed to prevent conflicts with the openSuse definition.
|
||||
*/
|
||||
#define round_jiffies_up backport_round_jiffies_up
|
||||
|
||||
unsigned long round_jiffies_up(unsigned long j);
|
||||
|
||||
extern void v2_6_28_skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
|
||||
int off, int size);
|
||||
|
||||
#define wake_up_interruptible_poll(x, m) \
|
||||
__wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
|
||||
|
||||
extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
|
||||
int pci_wake_from_d3(struct pci_dev *dev, bool enable);
|
||||
|
||||
#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active)
|
||||
|
||||
#ifndef pr_fmt
|
||||
#define pr_fmt(fmt) fmt
|
||||
#endif
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
|
||||
|
||||
#endif /* LINUX_26_28_COMPAT_H */
|
||||
@@ -1,379 +0,0 @@
|
||||
#ifndef LINUX_26_29_COMPAT_H
|
||||
#define LINUX_26_29_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/if_link.h>
|
||||
|
||||
/*
|
||||
* I kow this looks odd.. but 2.6.32 added the netdev_tx_t
|
||||
* and we backport that there so inlcude that header first
|
||||
* as we need it for the netdev ops.
|
||||
*/
|
||||
#include <linux/compat-2.6.32.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* backports */
|
||||
static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
|
||||
{ }
|
||||
static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
|
||||
{ return 0; }
|
||||
|
||||
#if \
|
||||
defined(CONFIG_ALPHA) || defined(CONFIG_AVR32) || \
|
||||
defined(CONFIG_BLACKFIN) || defined(CONFIG_CRIS) || \
|
||||
defined(CONFIG_H8300) || defined(CONFIG_IA64) || \
|
||||
defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
|
||||
defined(CONFIG_PARISC) || defined(CONFIG_S390) || \
|
||||
defined(CONFIG_PPC64) || defined(CONFIG_PPC32) || \
|
||||
defined(CONFIG_SUPERH) || defined(CONFIG_SPARC) || \
|
||||
defined(CONFIG_FRV) || defined(CONFIG_X86) || \
|
||||
defined(CONFIG_M32R) || defined(CONFIG_M68K) || \
|
||||
defined(CONFIG_MN10300) || defined(CONFIG_XTENSA)
|
||||
#include <asm/atomic.h>
|
||||
#else
|
||||
typedef struct {
|
||||
volatile int counter;
|
||||
} atomic_t;
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
typedef struct {
|
||||
volatile long counter;
|
||||
} atomic64_t;
|
||||
#endif /* CONFIG_64BIT */
|
||||
|
||||
#endif
|
||||
|
||||
#define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */
|
||||
|
||||
/*
|
||||
* Older kernels do not have struct net_device_ops but what we can
|
||||
* do is just define the data structure and use a caller to let us
|
||||
* set the data structure's routines onto the old netdev, essentially
|
||||
* doing it the old way. This avoids huge deltas on our backports.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This structure defines the management hooks for network devices.
|
||||
* The following hooks can be defined; unless noted otherwise, they are
|
||||
* optional and can be filled with a null pointer.
|
||||
*
|
||||
* int (*ndo_init)(struct net_device *dev);
|
||||
* This function is called once when network device is registered.
|
||||
* The network device can use this to any late stage initializaton
|
||||
* or semantic validattion. It can fail with an error code which will
|
||||
* be propogated back to register_netdev
|
||||
*
|
||||
* void (*ndo_uninit)(struct net_device *dev);
|
||||
* This function is called when device is unregistered or when registration
|
||||
* fails. It is not called if init fails.
|
||||
*
|
||||
* int (*ndo_open)(struct net_device *dev);
|
||||
* This function is called when network device transistions to the up
|
||||
* state.
|
||||
*
|
||||
* int (*ndo_stop)(struct net_device *dev);
|
||||
* This function is called when network device transistions to the down
|
||||
* state.
|
||||
*
|
||||
* netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
|
||||
* struct net_device *dev);
|
||||
* Called when a packet needs to be transmitted.
|
||||
* Must return NETDEV_TX_OK , NETDEV_TX_BUSY.
|
||||
* (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
|
||||
* Required can not be NULL.
|
||||
*
|
||||
* u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
|
||||
* Called to decide which queue to when device supports multiple
|
||||
* transmit queues.
|
||||
*
|
||||
* void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
|
||||
* This function is called to allow device receiver to make
|
||||
* changes to configuration when multicast or promiscious is enabled.
|
||||
*
|
||||
* void (*ndo_set_rx_mode)(struct net_device *dev);
|
||||
* This function is called device changes address list filtering.
|
||||
*
|
||||
* void (*ndo_set_multicast_list)(struct net_device *dev);
|
||||
* This function is called when the multicast address list changes.
|
||||
*
|
||||
* int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
|
||||
* This function is called when the Media Access Control address
|
||||
* needs to be changed. If this interface is not defined, the
|
||||
* mac address can not be changed.
|
||||
*
|
||||
* int (*ndo_validate_addr)(struct net_device *dev);
|
||||
* Test if Media Access Control address is valid for the device.
|
||||
*
|
||||
* int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
|
||||
* Called when a user request an ioctl which can't be handled by
|
||||
* the generic interface code. If not defined ioctl's return
|
||||
* not supported error code.
|
||||
*
|
||||
* int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
|
||||
* Used to set network devices bus interface parameters. This interface
|
||||
* is retained for legacy reason, new devices should use the bus
|
||||
* interface (PCI) for low level management.
|
||||
*
|
||||
* int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
|
||||
* Called when a user wants to change the Maximum Transfer Unit
|
||||
* of a device. If not defined, any request to change MTU will
|
||||
* will return an error.
|
||||
*
|
||||
* void (*ndo_tx_timeout)(struct net_device *dev);
|
||||
* Callback uses when the transmitter has not made any progress
|
||||
* for dev->watchdog ticks.
|
||||
*
|
||||
* struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
|
||||
* Called when a user wants to get the network device usage
|
||||
* statistics. If not defined, the counters in dev->stats will
|
||||
* be used.
|
||||
*
|
||||
* void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
|
||||
* If device support VLAN receive accleration
|
||||
* (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
|
||||
* when vlan groups for the device changes. Note: grp is NULL
|
||||
* if no vlan's groups are being used.
|
||||
*
|
||||
* void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
|
||||
* If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
|
||||
* this function is called when a VLAN id is registered.
|
||||
*
|
||||
* void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
|
||||
* If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
|
||||
* this function is called when a VLAN id is unregistered.
|
||||
*
|
||||
* void (*ndo_poll_controller)(struct net_device *dev);
|
||||
*
|
||||
* SR-IOV management functions.
|
||||
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
|
||||
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
|
||||
* int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
|
||||
* int (*ndo_get_vf_config)(struct net_device *dev,
|
||||
* int vf, struct ifla_vf_info *ivf);
|
||||
*/
|
||||
#define HAVE_NET_DEVICE_OPS
|
||||
struct net_device_ops {
|
||||
int (*ndo_init)(struct net_device *dev);
|
||||
void (*ndo_uninit)(struct net_device *dev);
|
||||
int (*ndo_open)(struct net_device *dev);
|
||||
int (*ndo_stop)(struct net_device *dev);
|
||||
netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb,
|
||||
struct net_device *dev);
|
||||
u16 (*ndo_select_queue)(struct net_device *dev,
|
||||
struct sk_buff *skb);
|
||||
void (*ndo_change_rx_flags)(struct net_device *dev,
|
||||
int flags);
|
||||
void (*ndo_set_rx_mode)(struct net_device *dev);
|
||||
void (*ndo_set_multicast_list)(struct net_device *dev);
|
||||
int (*ndo_set_mac_address)(struct net_device *dev,
|
||||
void *addr);
|
||||
int (*ndo_validate_addr)(struct net_device *dev);
|
||||
int (*ndo_do_ioctl)(struct net_device *dev,
|
||||
struct ifreq *ifr, int cmd);
|
||||
int (*ndo_set_config)(struct net_device *dev,
|
||||
struct ifmap *map);
|
||||
int (*ndo_change_mtu)(struct net_device *dev,
|
||||
int new_mtu);
|
||||
int (*ndo_neigh_setup)(struct net_device *dev,
|
||||
struct neigh_parms *);
|
||||
void (*ndo_tx_timeout) (struct net_device *dev);
|
||||
|
||||
struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
|
||||
|
||||
void (*ndo_vlan_rx_register)(struct net_device *dev,
|
||||
struct vlan_group *grp);
|
||||
void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
|
||||
unsigned short vid);
|
||||
void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
|
||||
unsigned short vid);
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
void (*ndo_poll_controller)(struct net_device *dev);
|
||||
#endif
|
||||
int (*ndo_set_vf_mac)(struct net_device *dev,
|
||||
int queue, u8 *mac);
|
||||
int (*ndo_set_vf_vlan)(struct net_device *dev,
|
||||
int queue, u16 vlan, u8 qos);
|
||||
int (*ndo_set_vf_tx_rate)(struct net_device *dev,
|
||||
int vf, int rate);
|
||||
/*
|
||||
* The struct ifla_vf_info was added via b280da8d54b8d82b52f368a8703b7ada6c1744d5
|
||||
* on the v2.6.34-rc1~233^2~338 release
|
||||
*/
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
|
||||
int (*ndo_get_vf_config)(struct net_device *dev,
|
||||
int vf,
|
||||
struct ifla_vf_info *ivf);
|
||||
#endif
|
||||
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
|
||||
int (*ndo_fcoe_enable)(struct net_device *dev);
|
||||
int (*ndo_fcoe_disable)(struct net_device *dev);
|
||||
int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
|
||||
u16 xid,
|
||||
struct scatterlist *sgl,
|
||||
unsigned int sgc);
|
||||
int (*ndo_fcoe_ddp_done)(struct net_device *dev,
|
||||
u16 xid);
|
||||
#define NETDEV_FCOE_WWNN 0
|
||||
#define NETDEV_FCOE_WWPN 1
|
||||
int (*ndo_fcoe_get_wwn)(struct net_device *dev,
|
||||
u64 *wwn, int type);
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline int ndo_do_ioctl(struct net_device *dev,
|
||||
struct ifreq *ifr,
|
||||
int cmd)
|
||||
{
|
||||
if (dev->do_ioctl)
|
||||
return dev->do_ioctl(dev, ifr, cmd);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
|
||||
void netdev_attach_ops(struct net_device *dev,
|
||||
const struct net_device_ops *ops);
|
||||
|
||||
/**
|
||||
* skb_queue_is_first - check if skb is the first entry in the queue
|
||||
* @list: queue head
|
||||
* @skb: buffer
|
||||
*
|
||||
* Returns true if @skb is the first buffer on the list.
|
||||
*/
|
||||
static inline bool skb_queue_is_first(const struct sk_buff_head *list,
|
||||
const struct sk_buff *skb)
|
||||
{
|
||||
return (skb->prev == (struct sk_buff *) list);
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_queue_prev - return the prev packet in the queue
|
||||
* @list: queue head
|
||||
* @skb: current buffer
|
||||
*
|
||||
* Return the prev packet in @list before @skb. It is only valid to
|
||||
* call this if skb_queue_is_first() evaluates to false.
|
||||
*/
|
||||
static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
|
||||
const struct sk_buff *skb)
|
||||
{
|
||||
/* This BUG_ON may seem severe, but if we just return then we
|
||||
* are going to dereference garbage.
|
||||
*/
|
||||
BUG_ON(skb_queue_is_first(list, skb));
|
||||
return skb->prev;
|
||||
}
|
||||
|
||||
|
||||
static inline struct net_device_stats *dev_get_stats(struct net_device *dev)
|
||||
{
|
||||
return dev->get_stats(dev);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
|
||||
#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
|
||||
extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
|
||||
#endif /* CONFIG_USB */
|
||||
#endif
|
||||
|
||||
#define DIV_ROUND_CLOSEST(x, divisor)( \
|
||||
{ \
|
||||
typeof(divisor) __divisor = divisor; \
|
||||
(((x) + ((__divisor) / 2)) / (__divisor)); \
|
||||
} \
|
||||
)
|
||||
|
||||
extern int eth_mac_addr(struct net_device *dev, void *p);
|
||||
extern int eth_change_mtu(struct net_device *dev, int new_mtu);
|
||||
extern int eth_validate_addr(struct net_device *dev);
|
||||
|
||||
#ifdef CONFIG_NET_NS
|
||||
|
||||
static inline void write_pnet(struct net **pnet, struct net *net)
|
||||
{
|
||||
*pnet = net;
|
||||
}
|
||||
|
||||
static inline struct net *read_pnet(struct net * const *pnet)
|
||||
{
|
||||
return *pnet;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define write_pnet(pnet, net) do { (void)(net);} while (0)
|
||||
#define read_pnet(pnet) (&init_net)
|
||||
|
||||
/*
|
||||
* swap - swap value of @a and @b
|
||||
*/
|
||||
#define swap(a, b) \
|
||||
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
|
||||
|
||||
#endif
|
||||
|
||||
extern int init_dummy_netdev(struct net_device *dev);
|
||||
|
||||
#define compat_pci_suspend(fn) \
|
||||
int fn##_compat(struct pci_dev *pdev, pm_message_t state) \
|
||||
{ \
|
||||
int r; \
|
||||
\
|
||||
r = fn(&pdev->dev); \
|
||||
if (r) \
|
||||
return r; \
|
||||
\
|
||||
pci_save_state(pdev); \
|
||||
pci_disable_device(pdev); \
|
||||
pci_set_power_state(pdev, PCI_D3hot); \
|
||||
\
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#define compat_pci_resume(fn) \
|
||||
int fn##_compat(struct pci_dev *pdev) \
|
||||
{ \
|
||||
int r; \
|
||||
\
|
||||
pci_set_power_state(pdev, PCI_D0); \
|
||||
r = pci_enable_device(pdev); \
|
||||
if (r) \
|
||||
return r; \
|
||||
pci_restore_state(pdev); \
|
||||
\
|
||||
return fn(&pdev->dev); \
|
||||
}
|
||||
|
||||
#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */
|
||||
|
||||
/* Kernels >= 2.6.29 follows */
|
||||
|
||||
/* XXX: this can probably just go upstream ! */
|
||||
static inline void netdev_attach_ops(struct net_device *dev,
|
||||
const struct net_device_ops *ops)
|
||||
{
|
||||
dev->netdev_ops = ops;
|
||||
}
|
||||
|
||||
/* XXX: this can probably just go upstream! */
|
||||
static inline int ndo_do_ioctl(struct net_device *dev,
|
||||
struct ifreq *ifr,
|
||||
int cmd)
|
||||
{
|
||||
if (dev->netdev_ops && dev->netdev_ops->ndo_do_ioctl)
|
||||
return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
#define compat_pci_suspend(fn)
|
||||
#define compat_pci_resume(fn)
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */
|
||||
|
||||
#endif /* LINUX_26_29_COMPAT_H */
|
||||
@@ -1,47 +0,0 @@
|
||||
#ifndef LINUX_26_30_COMPAT_H
|
||||
#define LINUX_26_30_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
#ifndef TP_PROTO
|
||||
#define TP_PROTO(args...) TPPROTO(args)
|
||||
#endif
|
||||
#ifndef TP_ARGS
|
||||
#define TP_ARGS(args...) TPARGS(args)
|
||||
#endif
|
||||
|
||||
#define IRQ_WAKE_THREAD (2)
|
||||
|
||||
/* From : include/linux/pm.h */
|
||||
/* How to reorder dpm_list after device_move() */
|
||||
enum dpm_order {
|
||||
DPM_ORDER_NONE,
|
||||
DPM_ORDER_DEV_AFTER_PARENT,
|
||||
DPM_ORDER_PARENT_BEFORE_DEV,
|
||||
DPM_ORDER_DEV_LAST,
|
||||
};
|
||||
|
||||
static inline void dev_set_uevent_suppress(struct device *dev, int val)
|
||||
{
|
||||
dev->uevent_suppress = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a one-time message (analogous to WARN_ONCE() et al):
|
||||
*/
|
||||
#define printk_once(x...) ({ \
|
||||
static bool __print_once; \
|
||||
\
|
||||
if (!__print_once) { \
|
||||
__print_once = true; \
|
||||
printk(x); \
|
||||
} \
|
||||
})
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) */
|
||||
|
||||
#endif /* LINUX_26_30_COMPAT_H */
|
||||
@@ -1,221 +0,0 @@
|
||||
#ifndef LINUX_26_31_COMPAT_H
|
||||
#define LINUX_26_31_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <net/dst.h>
|
||||
#include <net/genetlink.h>
|
||||
#include <linux/ethtool.h>
|
||||
|
||||
/*
|
||||
* These macros allow us to backport rfkill without any
|
||||
* changes on cfg80211 through compat.diff. Note that this
|
||||
* file will be included by rfkill_backport.h so we must
|
||||
* not conflict with things there.
|
||||
*/
|
||||
#define rfkill_get_led_trigger_name backport_rfkill_get_led_trigger_name
|
||||
#define rfkill_set_led_trigger_name backport_rfkill_set_led_trigger_name
|
||||
#define rfkill_set_hw_state backport_rfkill_set_hw_state
|
||||
#define rfkill_set_sw_state backport_rfkill_set_sw_state
|
||||
#define rfkill_init_sw_state backport_rfkill_init_sw_state
|
||||
#define rfkill_set_states backport_rfkill_set_states
|
||||
#define rfkill_pause_polling backport_rfkill_pause_polling
|
||||
#define rfkill_resume_polling backport_rfkill_resume_polling
|
||||
#define rfkill_blocked backport_rfkill_blocked
|
||||
#define rfkill_alloc backport_rfkill_alloc
|
||||
#define rfkill_register backport_rfkill_register
|
||||
#define rfkill_unregister backport_rfkill_unregister
|
||||
#define rfkill_destroy backport_rfkill_destroy
|
||||
|
||||
#ifndef ERFKILL
|
||||
#if !defined(CONFIG_ALPHA) && !defined(CONFIG_MIPS) && !defined(CONFIG_PARISC) && !defined(CONFIG_SPARC)
|
||||
#define ERFKILL 132 /* Operation not possible due to RF-kill */
|
||||
#endif
|
||||
#ifdef CONFIG_ALPHA
|
||||
#define ERFKILL 138 /* Operation not possible due to RF-kill */
|
||||
#endif
|
||||
#ifdef CONFIG_MIPS
|
||||
#define ERFKILL 167 /* Operation not possible due to RF-kill */
|
||||
#endif
|
||||
#ifdef CONFIG_PARISC
|
||||
#define ERFKILL 256 /* Operation not possible due to RF-kill */
|
||||
#endif
|
||||
#ifdef CONFIG_SPARC
|
||||
#define ERFKILL 134 /* Operation not possible due to RF-kill */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NETDEV_PRE_UP
|
||||
#define NETDEV_PRE_UP 0x000D
|
||||
#endif
|
||||
|
||||
#ifndef SDIO_DEVICE_ID_MARVELL_8688WLAN
|
||||
#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
|
||||
#endif
|
||||
|
||||
struct compat_threaded_irq {
|
||||
unsigned int irq;
|
||||
irq_handler_t handler;
|
||||
irq_handler_t thread_fn;
|
||||
void *dev_id;
|
||||
char wq_name[64];
|
||||
struct workqueue_struct *wq;
|
||||
struct work_struct work;
|
||||
};
|
||||
|
||||
/*
|
||||
* kmemleak was introduced on 2.6.31, since older kernels do not have
|
||||
* we simply ignore its tuning.
|
||||
*/
|
||||
static inline void kmemleak_ignore(const void *ptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void kmemleak_not_leak(const void *ptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void kmemleak_no_scan(const void *ptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Added via adf30907d63893e4208dfe3f5c88ae12bc2f25d5
|
||||
*
|
||||
* There is no _sk_dst on older kernels, so just set the
|
||||
* old dst to NULL and release it directly.
|
||||
*/
|
||||
static inline void skb_dst_drop(struct sk_buff *skb)
|
||||
{
|
||||
dst_release(skb->dst);
|
||||
skb->dst = NULL;
|
||||
}
|
||||
|
||||
static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct dst_entry *)skb->dst;
|
||||
}
|
||||
|
||||
static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
|
||||
{
|
||||
skb->dst = dst;
|
||||
}
|
||||
|
||||
static inline struct rtable *skb_rtable(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct rtable *)skb_dst(skb);
|
||||
}
|
||||
|
||||
/* Backport threaded IRQ support */
|
||||
|
||||
static inline
|
||||
void compat_irq_work(struct work_struct *work)
|
||||
{
|
||||
struct compat_threaded_irq *comp = container_of(work, struct compat_threaded_irq, work);
|
||||
comp->thread_fn(comp->irq, comp->dev_id);
|
||||
}
|
||||
|
||||
static inline
|
||||
irqreturn_t compat_irq_dispatcher(int irq, void *dev_id)
|
||||
{
|
||||
struct compat_threaded_irq *comp = dev_id;
|
||||
irqreturn_t res;
|
||||
|
||||
res = comp->handler(irq, comp->dev_id);
|
||||
if (res == IRQ_WAKE_THREAD) {
|
||||
queue_work(comp->wq, &comp->work);
|
||||
res = IRQ_HANDLED;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline
|
||||
int compat_request_threaded_irq(struct compat_threaded_irq *comp,
|
||||
unsigned int irq,
|
||||
irq_handler_t handler,
|
||||
irq_handler_t thread_fn,
|
||||
unsigned long flags,
|
||||
const char *name,
|
||||
void *dev_id)
|
||||
{
|
||||
comp->irq = irq;
|
||||
comp->handler = handler;
|
||||
comp->thread_fn = thread_fn;
|
||||
comp->dev_id = dev_id;
|
||||
INIT_WORK(&comp->work, compat_irq_work);
|
||||
|
||||
if (!comp->wq) {
|
||||
snprintf(comp->wq_name, sizeof(comp->wq_name),
|
||||
"compirq/%u-%s", irq, name);
|
||||
comp->wq = create_singlethread_workqueue(comp->wq_name);
|
||||
if (!comp->wq) {
|
||||
printk(KERN_ERR "Failed to create compat-threaded-IRQ workqueue %s\n",
|
||||
comp->wq_name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
return request_irq(irq, compat_irq_dispatcher, flags, name, comp);
|
||||
}
|
||||
|
||||
static inline
|
||||
void compat_free_threaded_irq(struct compat_threaded_irq *comp)
|
||||
{
|
||||
free_irq(comp->irq, comp);
|
||||
}
|
||||
|
||||
static inline
|
||||
void compat_destroy_threaded_irq(struct compat_threaded_irq *comp)
|
||||
{
|
||||
if (comp->wq)
|
||||
destroy_workqueue(comp->wq);
|
||||
comp->wq = NULL;
|
||||
}
|
||||
|
||||
static inline
|
||||
void compat_synchronize_threaded_irq(struct compat_threaded_irq *comp)
|
||||
{
|
||||
synchronize_irq(comp->irq);
|
||||
cancel_work_sync(&comp->work);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_entry_rcu - get the struct for this entry
|
||||
* @ptr: the &struct list_head pointer.
|
||||
* @type: the type of the struct this is embedded in.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* This primitive may safely run concurrently with the _rcu list-mutation
|
||||
* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
|
||||
*/
|
||||
#define list_entry_rcu(ptr, type, member) \
|
||||
container_of(rcu_dereference(ptr), type, member)
|
||||
|
||||
#define skb_walk_frags(skb, iter) \
|
||||
for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
|
||||
|
||||
#ifndef CONFIG_64BIT
|
||||
|
||||
typedef struct {
|
||||
long long counter;
|
||||
} atomic64_t;
|
||||
|
||||
extern long long atomic64_read(const atomic64_t *v);
|
||||
extern long long atomic64_add_return(long long a, atomic64_t *v);
|
||||
|
||||
#define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
|
||||
|
||||
#endif /* LINUX_26_31_COMPAT_H */
|
||||
@@ -1,178 +0,0 @@
|
||||
#ifndef LINUX_26_32_COMPAT_H
|
||||
#define LINUX_26_32_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32))
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/compat.h>
|
||||
#include <net/iw_handler.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <net/genetlink.h>
|
||||
|
||||
#define SDIO_VENDOR_ID_INTEL 0x0089
|
||||
#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
|
||||
#define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403
|
||||
#define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404
|
||||
#define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405
|
||||
#define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406
|
||||
|
||||
/*
|
||||
* Backports 5e928f77a09a07f9dd595bb8a489965d69a83458
|
||||
* run-time power management cannot really be backported
|
||||
* given that the implementation added bus specific
|
||||
* callbacks that we won't have on older kernels. If
|
||||
* you really want run-time power management or good
|
||||
* power management upgrade your kernel. We'll just
|
||||
* compile this out as if run-time power management was
|
||||
* disabled just as the kernel disables run-time power management
|
||||
* when CONFIG_PM_RUNTIME is disabled.
|
||||
*/
|
||||
static inline void pm_runtime_init(struct device *dev) {}
|
||||
static inline void pm_runtime_remove(struct device *dev) {}
|
||||
static inline int pm_runtime_get(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pm_runtime_get_sync(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pm_runtime_put(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pm_runtime_put_sync(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pm_runtime_set_active(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void pm_runtime_set_suspended(struct device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pm_runtime_disable(struct device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pm_runtime_put_noidle(struct device *dev) {}
|
||||
static inline void pm_runtime_get_noresume(struct device *dev) {}
|
||||
|
||||
static inline void flush_delayed_work(struct delayed_work *dwork)
|
||||
{
|
||||
if (del_timer_sync(&dwork->timer)) {
|
||||
/*
|
||||
* This is what would happen on 2.6.32 but since we don't have
|
||||
* access to the singlethread_cpu we can't really backport this,
|
||||
* so avoid really *flush*ing the work... Oh well. Any better ideas?
|
||||
|
||||
struct cpu_workqueue_struct *cwq;
|
||||
cwq = wq_per_cpu(keventd_wq, get_cpu());
|
||||
__queue_work(cwq, &dwork->work);
|
||||
put_cpu();
|
||||
|
||||
*/
|
||||
}
|
||||
flush_work(&dwork->work);
|
||||
}
|
||||
|
||||
/*
|
||||
* struct genl_multicast_group was made netns aware through
|
||||
* patch "genetlink: make netns aware" by johannes, we just
|
||||
* force this to always use the default init_net
|
||||
*/
|
||||
#define genl_info_net(x) &init_net
|
||||
/* Just use init_net for older kernels */
|
||||
#define get_net_ns_by_pid(x) &init_net
|
||||
|
||||
/* net namespace is lost */
|
||||
#define genlmsg_multicast_netns(a, b, c, d, e) genlmsg_multicast(b, c, d, e)
|
||||
#define genlmsg_multicast_allns(a, b, c, d) genlmsg_multicast(a, b, c, d)
|
||||
#define genlmsg_unicast(net, skb, pid) genlmsg_unicast(skb, pid)
|
||||
|
||||
#define dev_change_net_namespace(a, b, c) (-EOPNOTSUPP)
|
||||
|
||||
#define SET_NETDEV_DEVTYPE(netdev, type)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/* Driver transmit return codes */
|
||||
enum netdev_tx {
|
||||
BACKPORT_NETDEV_TX_OK = NETDEV_TX_OK, /* driver took care of packet */
|
||||
BACKPORT_NETDEV_TX_BUSY = NETDEV_TX_BUSY, /* driver tx path was busy*/
|
||||
BACKPORT_NETDEV_TX_LOCKED = NETDEV_TX_LOCKED, /* driver tx lock was already taken */
|
||||
};
|
||||
typedef enum netdev_tx netdev_tx_t;
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
/*
|
||||
* dev_pm_ops is only available on kernels >= 2.6.29, for
|
||||
* older kernels we rely on reverting the work to old
|
||||
* power management style stuff.
|
||||
*/
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
|
||||
/*
|
||||
* Use this if you want to use the same suspend and resume callbacks for suspend
|
||||
* to RAM and hibernation.
|
||||
*/
|
||||
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
|
||||
struct dev_pm_ops name = { \
|
||||
.suspend = suspend_fn, \
|
||||
.resume = resume_fn, \
|
||||
.freeze = suspend_fn, \
|
||||
.thaw = resume_fn, \
|
||||
.poweroff = suspend_fn, \
|
||||
.restore = resume_fn, \
|
||||
}
|
||||
#else
|
||||
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn)
|
||||
#endif /* >= 2.6.29 */
|
||||
|
||||
#define wireless_send_event(a, b, c, d) wireless_send_event(a, b, c, (char * ) d)
|
||||
|
||||
/* The export symbol in changed in compat/patches/15-symbol-export-conflicts.patch */
|
||||
#define ieee80211_rx(hw, skb) mac80211_ieee80211_rx(hw, skb)
|
||||
|
||||
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
|
||||
|
||||
#define lockdep_assert_held(l) do { } while (0)
|
||||
|
||||
/*
|
||||
* Similar to the struct tm in userspace <time.h>, but it needs to be here so
|
||||
* that the kernel source is self contained.
|
||||
*/
|
||||
struct tm {
|
||||
/*
|
||||
* the number of seconds after the minute, normally in the range
|
||||
* 0 to 59, but can be up to 60 to allow for leap seconds
|
||||
*/
|
||||
int tm_sec;
|
||||
/* the number of minutes after the hour, in the range 0 to 59*/
|
||||
int tm_min;
|
||||
/* the number of hours past midnight, in the range 0 to 23 */
|
||||
int tm_hour;
|
||||
/* the day of the month, in the range 1 to 31 */
|
||||
int tm_mday;
|
||||
/* the number of months since January, in the range 0 to 11 */
|
||||
int tm_mon;
|
||||
/* the number of years since 1900 */
|
||||
long tm_year;
|
||||
/* the number of days since Sunday, in the range 0 to 6 */
|
||||
int tm_wday;
|
||||
/* the number of days since January 1, in the range 0 to 365 */
|
||||
int tm_yday;
|
||||
};
|
||||
|
||||
void time_to_tm(time_t totalsecs, int offset, struct tm *result);
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */
|
||||
|
||||
#endif /* LINUX_26_32_COMPAT_H */
|
||||
@@ -1,172 +0,0 @@
|
||||
#ifndef LINUX_26_33_COMPAT_H
|
||||
#define LINUX_26_33_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/pci.h>
|
||||
#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
|
||||
#include <pcmcia/cs_types.h>
|
||||
#include <pcmcia/cistpl.h>
|
||||
#include <pcmcia/ds.h>
|
||||
#endif
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
|
||||
#define release_firmware compat_release_firmware
|
||||
#define request_firmware compat_request_firmware
|
||||
#define request_firmware_nowait compat_request_firmware_nowait
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
|
||||
int compat_request_firmware(const struct firmware **fw, const char *name,
|
||||
struct device *device);
|
||||
int compat_request_firmware_nowait(
|
||||
struct module *module, int uevent,
|
||||
const char *name, struct device *device, gfp_t gfp, void *context,
|
||||
void (*cont)(const struct firmware *fw, void *context));
|
||||
|
||||
void compat_release_firmware(const struct firmware *fw);
|
||||
#else
|
||||
static inline int compat_request_firmware(const struct firmware **fw,
|
||||
const char *name,
|
||||
struct device *device)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
static inline int compat_request_firmware_nowait(
|
||||
struct module *module, int uevent,
|
||||
const char *name, struct device *device, gfp_t gfp, void *context,
|
||||
void (*cont)(const struct firmware *fw, void *context))
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline void compat_release_firmware(const struct firmware *fw)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* mask KEY_RFKILL as RHEL6 backports this */
|
||||
#if !defined(KEY_RFKILL)
|
||||
#define KEY_RFKILL 247 /* Key that controls all radios */
|
||||
#endif
|
||||
|
||||
#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
|
||||
/* source: include/linux/if.h */
|
||||
|
||||
/* this will never happen on older kernels */
|
||||
#define NETDEV_POST_INIT 0xffff
|
||||
|
||||
/* mask netdev_alloc_skb_ip_align as debian squeeze also backports this */
|
||||
#define netdev_alloc_skb_ip_align(a, b) compat_netdev_alloc_skb_ip_align(a, b)
|
||||
|
||||
static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
|
||||
unsigned int length)
|
||||
{
|
||||
struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN);
|
||||
|
||||
if (NET_IP_ALIGN && skb)
|
||||
skb_reserve(skb, NET_IP_ALIGN);
|
||||
return skb;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
|
||||
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
|
||||
#define pcmcia_request_window(a, b, c) pcmcia_request_window(&a, b, c)
|
||||
|
||||
#define pcmcia_map_mem_page(a, b, c) pcmcia_map_mem_page(b, c)
|
||||
|
||||
/* loop over CIS entries */
|
||||
int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
|
||||
int (*loop_tuple) (struct pcmcia_device *p_dev,
|
||||
tuple_t *tuple,
|
||||
void *priv_data),
|
||||
void *priv_data);
|
||||
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
|
||||
/* loop over CIS entries */
|
||||
int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
|
||||
cisdata_t code, cisparse_t *parse, void *priv_data,
|
||||
int (*loop_tuple) (tuple_t *tuple,
|
||||
cisparse_t *parse,
|
||||
void *priv_data));
|
||||
|
||||
#endif /* CONFIG_PCCARD */
|
||||
|
||||
/**
|
||||
* list_for_each_entry_continue_rcu - continue iteration over list of given type
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Continue to iterate over list of given type, continuing after
|
||||
* the current position.
|
||||
*/
|
||||
#define list_for_each_entry_continue_rcu(pos, head, member) \
|
||||
for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \
|
||||
prefetch(pos->member.next), &pos->member != (head); \
|
||||
pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
|
||||
|
||||
#define sock_recv_ts_and_drops(msg, sk, skb) sock_recv_timestamp(msg, sk, skb)
|
||||
|
||||
/* mask pci_pcie_cap as debian squeeze also backports this */
|
||||
#define pci_pcie_cap(a) compat_pci_pcie_cap(a)
|
||||
|
||||
/**
|
||||
* pci_pcie_cap - get the saved PCIe capability offset
|
||||
* @dev: PCI device
|
||||
*
|
||||
* PCIe capability offset is calculated at PCI device initialization
|
||||
* time and saved in the data structure. This function returns saved
|
||||
* PCIe capability offset. Using this instead of pci_find_capability()
|
||||
* reduces unnecessary search in the PCI configuration space. If you
|
||||
* need to calculate PCIe capability offset from raw device for some
|
||||
* reasons, please use pci_find_capability() instead.
|
||||
*/
|
||||
static inline int pci_pcie_cap(struct pci_dev *dev)
|
||||
{
|
||||
return pci_find_capability(dev, PCI_CAP_ID_EXP);
|
||||
}
|
||||
|
||||
/* mask pci_is_pcie as RHEL6 backports this */
|
||||
#define pci_is_pcie(a) compat_pci_is_pcie(a)
|
||||
|
||||
/**
|
||||
* pci_is_pcie - check if the PCI device is PCI Express capable
|
||||
* @dev: PCI device
|
||||
*
|
||||
* Retrun true if the PCI device is PCI Express capable, false otherwise.
|
||||
*/
|
||||
static inline bool pci_is_pcie(struct pci_dev *dev)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
||||
return dev->is_pcie;
|
||||
#else
|
||||
return !!pci_pcie_cap(dev);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define __always_unused __attribute__((unused))
|
||||
#else
|
||||
#define __always_unused /* unimplemented */
|
||||
#endif
|
||||
|
||||
/* mask IS_ERR_OR_NULL as debian squeeze also backports this */
|
||||
#define IS_ERR_OR_NULL(a) compat_IS_ERR_OR_NULL(a)
|
||||
|
||||
static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
|
||||
{
|
||||
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
|
||||
}
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */
|
||||
|
||||
#endif /* LINUX_26_33_COMPAT_H */
|
||||
@@ -1,309 +0,0 @@
|
||||
#ifndef LINUX_26_34_COMPAT_H
|
||||
#define LINUX_26_34_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34))
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/usb.h>
|
||||
|
||||
#define netdev_mc_count(dev) ((dev)->mc_count)
|
||||
#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)
|
||||
|
||||
#define netdev_for_each_mc_addr(mclist, dev) \
|
||||
for (mclist = dev->mc_list; mclist; mclist = mclist->next)
|
||||
/* source: include/linux/netdevice.h */
|
||||
|
||||
|
||||
/* Logging, debugging and troubleshooting/diagnostic helpers. */
|
||||
|
||||
/* netdev_printk helpers, similar to dev_printk */
|
||||
|
||||
#ifndef netdev_name
|
||||
#define netdev_name(__dev) \
|
||||
((__dev->reg_state != NETREG_REGISTERED) ? \
|
||||
"(unregistered net_device)" : __dev->name)
|
||||
#endif
|
||||
|
||||
#define netdev_printk(level, netdev, format, args...) \
|
||||
dev_printk(level, (netdev)->dev.parent, \
|
||||
"%s: " format, \
|
||||
netdev_name(netdev), ##args)
|
||||
|
||||
#define netdev_emerg(dev, format, args...) \
|
||||
netdev_printk(KERN_EMERG, dev, format, ##args)
|
||||
#define netdev_alert(dev, format, args...) \
|
||||
netdev_printk(KERN_ALERT, dev, format, ##args)
|
||||
#define netdev_crit(dev, format, args...) \
|
||||
netdev_printk(KERN_CRIT, dev, format, ##args)
|
||||
#define netdev_err(dev, format, args...) \
|
||||
netdev_printk(KERN_ERR, dev, format, ##args)
|
||||
#define netdev_warn(dev, format, args...) \
|
||||
netdev_printk(KERN_WARNING, dev, format, ##args)
|
||||
#define netdev_notice(dev, format, args...) \
|
||||
netdev_printk(KERN_NOTICE, dev, format, ##args)
|
||||
#define netdev_info(dev, format, args...) \
|
||||
netdev_printk(KERN_INFO, dev, format, ##args)
|
||||
|
||||
/* mask netdev_dbg as RHEL6 backports this */
|
||||
#if !defined(netdev_dbg)
|
||||
|
||||
#if defined(DEBUG)
|
||||
#define netdev_dbg(__dev, format, args...) \
|
||||
netdev_printk(KERN_DEBUG, __dev, format, ##args)
|
||||
#elif defined(CONFIG_DYNAMIC_DEBUG)
|
||||
#define netdev_dbg(__dev, format, args...) \
|
||||
do { \
|
||||
dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \
|
||||
netdev_name(__dev), ##args); \
|
||||
} while (0)
|
||||
#else
|
||||
#define netdev_dbg(__dev, format, args...) \
|
||||
({ \
|
||||
if (0) \
|
||||
netdev_printk(KERN_DEBUG, __dev, format, ##args); \
|
||||
0; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* mask netdev_vdbg as RHEL6 backports this */
|
||||
#if !defined(netdev_dbg)
|
||||
|
||||
#if defined(VERBOSE_DEBUG)
|
||||
#define netdev_vdbg netdev_dbg
|
||||
#else
|
||||
|
||||
#define netdev_vdbg(dev, format, args...) \
|
||||
({ \
|
||||
if (0) \
|
||||
netdev_printk(KERN_DEBUG, dev, format, ##args); \
|
||||
0; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* netdev_WARN() acts like dev_printk(), but with the key difference
|
||||
* of using a WARN/WARN_ON to get the message out, including the
|
||||
* file/line information and a backtrace.
|
||||
*/
|
||||
#define netdev_WARN(dev, format, args...) \
|
||||
WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args);
|
||||
|
||||
/* netif printk helpers, similar to netdev_printk */
|
||||
|
||||
#define netif_printk(priv, type, level, dev, fmt, args...) \
|
||||
do { \
|
||||
if (netif_msg_##type(priv)) \
|
||||
netdev_printk(level, (dev), fmt, ##args); \
|
||||
} while (0)
|
||||
|
||||
#define netif_emerg(priv, type, dev, fmt, args...) \
|
||||
netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args)
|
||||
#define netif_alert(priv, type, dev, fmt, args...) \
|
||||
netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args)
|
||||
#define netif_crit(priv, type, dev, fmt, args...) \
|
||||
netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args)
|
||||
#define netif_err(priv, type, dev, fmt, args...) \
|
||||
netif_printk(priv, type, KERN_ERR, dev, fmt, ##args)
|
||||
#define netif_warn(priv, type, dev, fmt, args...) \
|
||||
netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args)
|
||||
#define netif_notice(priv, type, dev, fmt, args...) \
|
||||
netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args)
|
||||
#define netif_info(priv, type, dev, fmt, args...) \
|
||||
netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args)
|
||||
|
||||
/* mask netif_dbg as RHEL6 backports this */
|
||||
#if !defined(netif_dbg)
|
||||
|
||||
#if defined(DEBUG)
|
||||
#define netif_dbg(priv, type, dev, format, args...) \
|
||||
netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
|
||||
#elif defined(CONFIG_DYNAMIC_DEBUG)
|
||||
#define netif_dbg(priv, type, netdev, format, args...) \
|
||||
do { \
|
||||
if (netif_msg_##type(priv)) \
|
||||
dynamic_dev_dbg((netdev)->dev.parent, \
|
||||
"%s: " format, \
|
||||
netdev_name(netdev), ##args); \
|
||||
} while (0)
|
||||
#else
|
||||
#define netif_dbg(priv, type, dev, format, args...) \
|
||||
({ \
|
||||
if (0) \
|
||||
netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
|
||||
0; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* mask netif_vdbg as RHEL6 backports this */
|
||||
#if !defined(netif_vdbg)
|
||||
|
||||
#if defined(VERBOSE_DEBUG)
|
||||
#define netif_vdbg netdev_dbg
|
||||
#else
|
||||
#define netif_vdbg(priv, type, dev, format, args...) \
|
||||
({ \
|
||||
if (0) \
|
||||
netif_printk(KERN_DEBUG, dev, format, ##args); \
|
||||
0; \
|
||||
})
|
||||
#endif
|
||||
#endif
|
||||
/* source: include/linux/netdevice.h */
|
||||
|
||||
|
||||
static inline void device_lock(struct device *dev)
|
||||
{
|
||||
#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP)
|
||||
mutex_lock(&dev->mutex);
|
||||
#else
|
||||
down(&dev->sem);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int device_trylock(struct device *dev)
|
||||
{
|
||||
#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP)
|
||||
return mutex_trylock(&dev->mutex);
|
||||
#else
|
||||
return down_trylock(&dev->sem);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void device_unlock(struct device *dev)
|
||||
{
|
||||
#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP)
|
||||
mutex_unlock(&dev->mutex);
|
||||
#else
|
||||
up(&dev->sem);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
#define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \
|
||||
.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \
|
||||
.prod_id = { NULL, NULL, (v3), NULL }, \
|
||||
.prod_id_hash = { 0, 0, (vh3), 0 }, }
|
||||
#endif
|
||||
|
||||
#define rcu_dereference_check(p, c) rcu_dereference(p)
|
||||
|
||||
/**
|
||||
* sysfs_attr_init - initialize a dynamically allocated sysfs attribute
|
||||
* @attr: struct attribute to initialize
|
||||
*
|
||||
* Initialize a dynamically allocated struct attribute so we can
|
||||
* make lockdep happy. This is a new requirement for attributes
|
||||
* and initially this is only needed when lockdep is enabled.
|
||||
* Lockdep gives a nice error when your attribute is added to
|
||||
* sysfs if you don't have this.
|
||||
*/
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
#define sysfs_attr_init(attr) \
|
||||
do { \
|
||||
static struct lock_class_key __key; \
|
||||
\
|
||||
(attr)->key = &__key; \
|
||||
} while(0)
|
||||
#else
|
||||
#define sysfs_attr_init(attr) do {} while(0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute
|
||||
* @attr: struct bin_attribute to initialize
|
||||
*
|
||||
* Initialize a dynamically allocated struct bin_attribute so we
|
||||
* can make lockdep happy. This is a new requirement for
|
||||
* attributes and initially this is only needed when lockdep is
|
||||
* enabled. Lockdep gives a nice error when your attribute is
|
||||
* added to sysfs if you don't have this.
|
||||
*/
|
||||
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
|
||||
|
||||
#define usb_alloc_coherent(dev, size, mem_flags, dma) usb_buffer_alloc(dev, size, mem_flags, dma)
|
||||
#define usb_free_coherent(dev, size, addr, dma) usb_buffer_free(dev, size, addr, dma)
|
||||
|
||||
/* only include this if DEFINE_DMA_UNMAP_ADDR is not set as debian squeeze also backports this */
|
||||
#ifndef DEFINE_DMA_UNMAP_ADDR
|
||||
#ifdef CONFIG_NEED_DMA_MAP_STATE
|
||||
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME
|
||||
#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME
|
||||
#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
|
||||
#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
|
||||
#define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
|
||||
#define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
|
||||
#else
|
||||
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)
|
||||
#define DEFINE_DMA_UNMAP_LEN(LEN_NAME)
|
||||
#define dma_unmap_addr(PTR, ADDR_NAME) (0)
|
||||
#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
|
||||
#define dma_unmap_len(PTR, LEN_NAME) (0)
|
||||
#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* mask dma_set_coherent_mask as debian squeeze also backports this */
|
||||
#define dma_set_coherent_mask(a, b) compat_dma_set_coherent_mask(a, b)
|
||||
|
||||
static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
|
||||
{
|
||||
if (!dma_supported(dev, mask))
|
||||
return -EIO;
|
||||
dev->coherent_dma_mask = mask;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* USB autosuspend and autoresume */
|
||||
static inline int usb_enable_autosuspend(struct usb_device *udev)
|
||||
{ return 0; }
|
||||
static inline int usb_disable_autosuspend(struct usb_device *udev)
|
||||
{ return 0; }
|
||||
|
||||
#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
|
||||
#define sdio_set_host_pm_flags(a, b) 0
|
||||
|
||||
#define rcu_dereference_protected(p, c) (p)
|
||||
#define rcu_access_pointer(p) ACCESS_ONCE(p)
|
||||
|
||||
#define rcu_dereference_raw(p) rcu_dereference(p)
|
||||
|
||||
#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
|
||||
|
||||
/*
|
||||
* This looks more complex than it should be. But we need to
|
||||
* get the type for the ~ right in round_down (it needs to be
|
||||
* as wide as the result!), and we want to evaluate the macro
|
||||
* arguments just once each.
|
||||
*/
|
||||
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
|
||||
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
|
||||
#define round_down(x, y) ((x) & ~__round_mask(x, y))
|
||||
|
||||
static inline int rcu_read_lock_held(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROVE_LOCKING
|
||||
/*
|
||||
* Obviously, this is wrong. But the base kernel will have rtnl_mutex
|
||||
* declared static, with no way to access it. I think this is the best
|
||||
* we can do...
|
||||
*/
|
||||
static inline int lockdep_rtnl_is_held(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif /* #ifdef CONFIG_PROVE_LOCKING */
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
|
||||
|
||||
#endif /* LINUX_26_34_COMPAT_H */
|
||||
@@ -1,59 +0,0 @@
|
||||
#ifndef LINUX_26_35_COMPAT_H
|
||||
#define LINUX_26_35_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
|
||||
#include <linux/etherdevice.h>
|
||||
#include <net/sock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/usb.h>
|
||||
|
||||
/* added on linux/kernel.h */
|
||||
#define USHRT_MAX ((u16)(~0U))
|
||||
#define SHRT_MAX ((s16)(USHRT_MAX>>1))
|
||||
#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
|
||||
|
||||
#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
|
||||
#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
|
||||
|
||||
#define netdev_hw_addr dev_mc_list
|
||||
|
||||
/*
|
||||
* We cannot backport this guy as the IRQ data structure
|
||||
* was modified in the kernel itself to support this. We
|
||||
* treat the system as uni-processor in this case.
|
||||
*/
|
||||
static inline int irq_set_affinity_hint(unsigned int irq,
|
||||
const struct cpumask *m)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline wait_queue_head_t *sk_sleep(struct sock *sk)
|
||||
{
|
||||
return sk->sk_sleep;
|
||||
}
|
||||
|
||||
#define sdio_writeb_readb(func, write_byte, addr, err_ret) sdio_readb(func, addr, err_ret)
|
||||
|
||||
/* mask hex_to_bin as RHEL6 backports this */
|
||||
#define hex_to_bin(a) compat_hex_to_bin(a)
|
||||
|
||||
int hex_to_bin(char ch);
|
||||
|
||||
extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
|
||||
|
||||
#define pm_qos_request(_qos) pm_qos_requirement(_qos)
|
||||
|
||||
static inline struct usb_host_endpoint *
|
||||
usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
|
||||
{
|
||||
struct usb_host_endpoint **eps;
|
||||
eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out;
|
||||
return eps[usb_pipeendpoint(pipe)];
|
||||
}
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) */
|
||||
|
||||
#endif /* LINUX_26_35_COMPAT_H */
|
||||
@@ -1,212 +0,0 @@
|
||||
#ifndef LINUX_26_36_COMPAT_H
|
||||
#define LINUX_26_36_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
|
||||
|
||||
#include <linux/usb.h>
|
||||
#include <pcmcia/cistpl.h>
|
||||
#include <pcmcia/ds.h>
|
||||
#include <linux/pm_qos_params.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#define kparam_block_sysfs_write(a)
|
||||
#define kparam_unblock_sysfs_write(a)
|
||||
|
||||
/* mask va_format as RHEL6 backports this */
|
||||
#define va_format compat_va_format
|
||||
|
||||
struct va_format {
|
||||
const char *fmt;
|
||||
va_list *va;
|
||||
};
|
||||
|
||||
#define device_rename(dev, new_name) device_rename(dev, (char *)new_name)
|
||||
|
||||
#ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX
|
||||
#define usb_scuttle_anchored_urbs(anchor) compat_usb_scuttle_anchored_urbs(anchor)
|
||||
#define usb_get_from_anchor(anchor) compat_usb_get_from_anchor(anchor)
|
||||
#define usb_unlink_anchored_urbs(anchor) compat_usb_unlink_anchored_urbs(anchor)
|
||||
|
||||
extern void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor);
|
||||
extern struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor);
|
||||
extern void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* pcmcia_read_config_byte() - read a byte from a card configuration register
|
||||
*
|
||||
* pcmcia_read_config_byte() reads a byte from a configuration register in
|
||||
* attribute memory.
|
||||
*/
|
||||
static inline int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val)
|
||||
{
|
||||
int ret;
|
||||
conf_reg_t reg = { 0, CS_READ, where, 0 };
|
||||
ret = pcmcia_access_configuration_register(p_dev, ®);
|
||||
*val = reg.Value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* pcmcia_write_config_byte() - write a byte to a card configuration register
|
||||
*
|
||||
* pcmcia_write_config_byte() writes a byte to a configuration register in
|
||||
* attribute memory.
|
||||
*/
|
||||
static inline int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val)
|
||||
{
|
||||
conf_reg_t reg = { 0, CS_WRITE, where, val };
|
||||
return pcmcia_access_configuration_register(p_dev, ®);
|
||||
}
|
||||
|
||||
struct pm_qos_request_list {
|
||||
u32 qos;
|
||||
void *request;
|
||||
};
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
|
||||
|
||||
#define pm_qos_add_request(_req, _class, _value) do { \
|
||||
(_req)->request = #_req; \
|
||||
(_req)->qos = _class; \
|
||||
pm_qos_add_requirement((_class), (_req)->request, (_value)); \
|
||||
} while(0)
|
||||
|
||||
#define pm_qos_update_request(_req, _value) \
|
||||
pm_qos_update_requirement((_req)->qos, (_req)->request, (_value))
|
||||
|
||||
#define pm_qos_remove_request(_req) \
|
||||
pm_qos_remove_requirement((_req)->qos, (_req)->request)
|
||||
|
||||
#else
|
||||
|
||||
#define pm_qos_add_request(_req, _class, _value) do { \
|
||||
(_req)->request = pm_qos_add_request((_class), (_value)); \
|
||||
} while (0)
|
||||
|
||||
#define pm_qos_update_request(_req, _value) \
|
||||
pm_qos_update_request((_req)->request, (_value))
|
||||
|
||||
#define pm_qos_remove_request(_req) \
|
||||
pm_qos_remove_request((_req)->request)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy printk for disabled debugging statements to use whilst maintaining
|
||||
* gcc's format and side-effect checking.
|
||||
*/
|
||||
static inline __attribute__ ((format (printf, 1, 2)))
|
||||
int no_printk(const char *s, ...) { return 0; }
|
||||
|
||||
#ifndef alloc_workqueue
|
||||
#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)
|
||||
#endif
|
||||
|
||||
#define EXTPROC 0200000
|
||||
#define TIOCPKT_IOCTL 64
|
||||
|
||||
static inline void tty_lock(void) __acquires(kernel_lock)
|
||||
{
|
||||
#ifdef CONFIG_LOCK_KERNEL
|
||||
/* kernel_locked is 1 for !CONFIG_LOCK_KERNEL */
|
||||
WARN_ON(kernel_locked());
|
||||
#endif
|
||||
lock_kernel();
|
||||
}
|
||||
static inline void tty_unlock(void) __releases(kernel_lock)
|
||||
{
|
||||
unlock_kernel();
|
||||
}
|
||||
#define tty_locked() (kernel_locked())
|
||||
|
||||
#define usleep_range(_min, _max) msleep((_max) / 1000)
|
||||
|
||||
#define __rcu
|
||||
|
||||
static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
|
||||
|
||||
static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void skb_tx_timestamp(struct sk_buff *skb)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* System-wide workqueues which are always present.
|
||||
*
|
||||
* system_wq is the one used by schedule[_delayed]_work[_on]().
|
||||
* Multi-CPU multi-threaded. There are users which expect relatively
|
||||
* short queue flush time. Don't queue works which can run for too
|
||||
* long.
|
||||
*
|
||||
* system_long_wq is similar to system_wq but may host long running
|
||||
* works. Queue flushing might take relatively long.
|
||||
*
|
||||
* system_nrt_wq is non-reentrant and guarantees that any given work
|
||||
* item is never executed in parallel by multiple CPUs. Queue
|
||||
* flushing might take relatively long.
|
||||
*/
|
||||
extern struct workqueue_struct *system_wq;
|
||||
extern struct workqueue_struct *system_long_wq;
|
||||
extern struct workqueue_struct *system_nrt_wq;
|
||||
|
||||
void compat_system_workqueue_create(void);
|
||||
void compat_system_workqueue_destroy(void);
|
||||
|
||||
int compat_schedule_work(struct work_struct *work);
|
||||
int compat_schedule_work_on(int cpu, struct work_struct *work);
|
||||
int compat_schedule_delayed_work(struct delayed_work *dwork,
|
||||
unsigned long delay);
|
||||
int compat_schedule_delayed_work_on(int cpu,
|
||||
struct delayed_work *dwork,
|
||||
unsigned long delay);
|
||||
void compat_flush_scheduled_work(void);
|
||||
|
||||
enum {
|
||||
/* bit mask for work_busy() return values */
|
||||
WORK_BUSY_PENDING = 1 << 0,
|
||||
WORK_BUSY_RUNNING = 1 << 1,
|
||||
};
|
||||
|
||||
extern unsigned int work_busy(struct work_struct *work);
|
||||
|
||||
#define schedule_work(work) compat_schedule_work(work)
|
||||
#define schedule_work_on(cpu, work) compat_schedule_work_on(cpu, work)
|
||||
#define schedule_delayed_work(dwork, delay) compat_schedule_delayed_work(dwork, delay)
|
||||
#define schedule_delayed_work_on(cpu, dwork, delay) compat_schedule_delayed_work_on(cpu, dwork, delay)
|
||||
#define flush_scheduled_work(a) compat_flush_scheduled_work(a)
|
||||
|
||||
#define br_port_exists(dev) (dev->br_port)
|
||||
|
||||
#else
|
||||
|
||||
static inline void compat_system_workqueue_create(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void compat_system_workqueue_destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This is not part of The 2.6.37 kernel yet but we
|
||||
* we use it to optimize the backport code we
|
||||
* need to implement. Instead of using ifdefs
|
||||
* to check what version of the check we use
|
||||
* we just replace all checks on current code
|
||||
* with this. I'll submit this upstream too, that
|
||||
* way all we'd have to do is to implement this
|
||||
* for older kernels, then we would not have to
|
||||
* edit the upstrema code for backport efforts.
|
||||
*/
|
||||
#define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
|
||||
|
||||
#endif /* LINUX_26_36_COMPAT_H */
|
||||
@@ -1,140 +0,0 @@
|
||||
#ifndef LINUX_26_37_COMPAT_H
|
||||
#define LINUX_26_37_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/leds.h>
|
||||
|
||||
#define SDIO_CLASS_BT_AMP 0x09 /* Type-A Bluetooth AMP interface */
|
||||
|
||||
extern struct kobj_ns_type_operations net_ns_type_operations;
|
||||
|
||||
/* mask skb_checksum_none_assert as RHEL6 backports this */
|
||||
#define skb_checksum_none_assert(a) compat_skb_checksum_none_assert(a)
|
||||
|
||||
/**
|
||||
* skb_checksum_none_assert - make sure skb ip_summed is CHECKSUM_NONE
|
||||
* @skb: skb to check
|
||||
*
|
||||
* fresh skbs have their ip_summed set to CHECKSUM_NONE.
|
||||
* Instead of forcing ip_summed to CHECKSUM_NONE, we can
|
||||
* use this helper, to document places where we make this assertion.
|
||||
*/
|
||||
static inline void skb_checksum_none_assert(struct sk_buff *skb)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
BUG_ON(skb->ip_summed != CHECKSUM_NONE);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define pcmcia_enable_device(link) pcmcia_request_configuration(link, &link->conf)
|
||||
|
||||
#include <net/genetlink.h>
|
||||
|
||||
struct compat_genl_info {
|
||||
struct genl_info *info;
|
||||
|
||||
u32 snd_seq;
|
||||
u32 snd_pid;
|
||||
struct genlmsghdr *genlhdr;
|
||||
struct nlattr **attrs;
|
||||
void *user_ptr[2];
|
||||
};
|
||||
#define genl_info compat_genl_info
|
||||
|
||||
struct compat_genl_ops {
|
||||
struct genl_ops ops;
|
||||
|
||||
u8 cmd;
|
||||
u8 internal_flags;
|
||||
unsigned int flags;
|
||||
const struct nla_policy *policy;
|
||||
|
||||
int (*doit)(struct sk_buff *skb, struct genl_info *info);
|
||||
int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb);
|
||||
int (*done)(struct netlink_callback *cb);
|
||||
};
|
||||
#define genl_ops compat_genl_ops
|
||||
|
||||
struct compat_genl_family {
|
||||
struct genl_family family;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
unsigned int id, hdrsize, version, maxattr;
|
||||
const char *name;
|
||||
bool netnsok;
|
||||
|
||||
struct nlattr **attrbuf;
|
||||
|
||||
int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb,
|
||||
struct genl_info *info);
|
||||
|
||||
void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb,
|
||||
struct genl_info *info);
|
||||
};
|
||||
|
||||
#define genl_family compat_genl_family
|
||||
|
||||
#define genl_register_family_with_ops compat_genl_register_family_with_ops
|
||||
|
||||
int genl_register_family_with_ops(struct genl_family *family,
|
||||
struct genl_ops *ops, size_t n_ops);
|
||||
|
||||
#define genl_unregister_family compat_genl_unregister_family
|
||||
|
||||
int genl_unregister_family(struct genl_family *family);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
|
||||
#define genl_info_net(_info) genl_info_net((_info)->info)
|
||||
#endif
|
||||
|
||||
#define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
|
||||
#define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
|
||||
#define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
|
||||
#define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
|
||||
|
||||
|
||||
extern void led_blink_set(struct led_classdev *led_cdev,
|
||||
unsigned long *delay_on,
|
||||
unsigned long *delay_off);
|
||||
|
||||
#define led_classdev_unregister compat_led_classdev_unregister
|
||||
extern void compat_led_classdev_unregister(struct led_classdev *led_cdev);
|
||||
|
||||
#define led_brightness_set compat_led_brightness_set
|
||||
extern void compat_led_brightness_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness);
|
||||
|
||||
#define alloc_ordered_workqueue(name, flags) create_singlethread_workqueue(name)
|
||||
|
||||
#define netdev_refcnt_read(a) atomic_read(&a->refcnt)
|
||||
|
||||
/* mask vzalloc as RHEL6 backports this */
|
||||
#define vzalloc(a) compat_vzalloc(a)
|
||||
|
||||
extern void *vzalloc(unsigned long size);
|
||||
|
||||
#define rtnl_dereference(p) \
|
||||
rcu_dereference_protected(p, lockdep_rtnl_is_held())
|
||||
|
||||
/**
|
||||
* RCU_INIT_POINTER() - initialize an RCU protected pointer
|
||||
*
|
||||
* Initialize an RCU-protected pointer in such a way to avoid RCU-lockdep
|
||||
* splats.
|
||||
*/
|
||||
#define RCU_INIT_POINTER(p, v) \
|
||||
p = (typeof(*v) __force __rcu *)(v)
|
||||
|
||||
static inline bool skb_has_frag_list(const struct sk_buff *skb)
|
||||
{
|
||||
return skb_shinfo(skb)->frag_list != NULL;
|
||||
}
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
|
||||
|
||||
#endif /* LINUX_26_37_COMPAT_H */
|
||||
@@ -1,95 +0,0 @@
|
||||
#ifndef LINUX_26_38_COMPAT_H
|
||||
#define LINUX_26_38_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/etherdevice.h>
|
||||
|
||||
/* rename member in struct mmc_host in include/linux/mmc/host.h */
|
||||
#define max_segs max_hw_segs
|
||||
|
||||
|
||||
/* Exponentially weighted moving average (EWMA) */
|
||||
|
||||
/* For more documentation see lib/average.c */
|
||||
|
||||
struct ewma {
|
||||
unsigned long internal;
|
||||
unsigned long factor;
|
||||
unsigned long weight;
|
||||
};
|
||||
|
||||
extern void ewma_init(struct ewma *avg, unsigned long factor,
|
||||
unsigned long weight);
|
||||
|
||||
extern struct ewma *ewma_add(struct ewma *avg, unsigned long val);
|
||||
|
||||
/**
|
||||
* ewma_read() - Get average value
|
||||
* @avg: Average structure
|
||||
*
|
||||
* Returns the average value held in @avg.
|
||||
*/
|
||||
static inline unsigned long ewma_read(const struct ewma *avg)
|
||||
{
|
||||
return DIV_ROUND_CLOSEST(avg->internal, avg->factor);
|
||||
}
|
||||
|
||||
#define pr_warn pr_warning
|
||||
#define create_freezable_workqueue create_freezeable_workqueue
|
||||
|
||||
static inline int skb_checksum_start_offset(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->csum_start - skb_headroom(skb);
|
||||
}
|
||||
|
||||
/* from include/linux/printk.h */
|
||||
#define pr_emerg_once(fmt, ...) \
|
||||
printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_alert_once(fmt, ...) \
|
||||
printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_crit_once(fmt, ...) \
|
||||
printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_err_once(fmt, ...) \
|
||||
printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_warn_once(fmt, ...) \
|
||||
printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_notice_once(fmt, ...) \
|
||||
printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_info_once(fmt, ...) \
|
||||
printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_cont_once(fmt, ...) \
|
||||
printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#if defined(DEBUG)
|
||||
#define pr_debug_once(fmt, ...) \
|
||||
printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#else
|
||||
#define pr_debug_once(fmt, ...) \
|
||||
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/* include/linux/netdevice.h */
|
||||
#define alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs) \
|
||||
alloc_netdev_mq(sizeof_priv, name, setup, \
|
||||
max_t(unsigned int, txqs, rxqs))
|
||||
|
||||
#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */
|
||||
|
||||
/**
|
||||
* is_unicast_ether_addr - Determine if the Ethernet address is unicast
|
||||
* @addr: Pointer to a six-byte array containing the Ethernet address
|
||||
*
|
||||
* Return true if the address is a unicast address.
|
||||
*/
|
||||
static inline int is_unicast_ether_addr(const u8 *addr)
|
||||
{
|
||||
return !is_multicast_ether_addr(addr);
|
||||
}
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) */
|
||||
|
||||
#endif /* LINUX_26_38_COMPAT_H */
|
||||
@@ -1,169 +0,0 @@
|
||||
#ifndef LINUX_26_39_COMPAT_H
|
||||
#define LINUX_26_39_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
|
||||
|
||||
#include <linux/tty.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#define tiocmget(tty) tiocmget(tty, NULL)
|
||||
#define tiocmset(tty, set, clear) tiocmset(tty, NULL, set, clear)
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) */
|
||||
|
||||
static inline int irq_set_irq_wake(unsigned int irq, unsigned int on)
|
||||
{
|
||||
return set_irq_wake(irq, on);
|
||||
}
|
||||
static inline int irq_set_chip(unsigned int irq, struct irq_chip *chip)
|
||||
{
|
||||
return set_irq_chip(irq, chip);
|
||||
}
|
||||
static inline int irq_set_handler_data(unsigned int irq, void *data)
|
||||
{
|
||||
return set_irq_data(irq, data);
|
||||
}
|
||||
static inline int irq_set_chip_data(unsigned int irq, void *data)
|
||||
{
|
||||
return set_irq_chip_data(irq, data);
|
||||
}
|
||||
static inline int irq_set_irq_type(unsigned int irq, unsigned int type)
|
||||
{
|
||||
return set_irq_type(irq, type);
|
||||
}
|
||||
static inline int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
|
||||
{
|
||||
return set_irq_msi(irq, entry);
|
||||
}
|
||||
static inline struct irq_chip *irq_get_chip(unsigned int irq)
|
||||
{
|
||||
return get_irq_chip(irq);
|
||||
}
|
||||
static inline void *irq_get_chip_data(unsigned int irq)
|
||||
{
|
||||
return get_irq_chip_data(irq);
|
||||
}
|
||||
static inline void *irq_get_handler_data(unsigned int irq)
|
||||
{
|
||||
return get_irq_data(irq);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
||||
static inline void *irq_data_get_irq_handler_data(struct irq_data *d)
|
||||
{
|
||||
return irq_data_get_irq_data(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline struct msi_desc *irq_get_msi_desc(unsigned int irq)
|
||||
{
|
||||
return get_irq_msi(irq);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
|
||||
static inline void irq_set_noprobe(unsigned int irq)
|
||||
{
|
||||
set_irq_noprobe(irq);
|
||||
}
|
||||
static inline void irq_set_probe(unsigned int irq)
|
||||
{
|
||||
set_irq_probe(irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
|
||||
static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc)
|
||||
{
|
||||
return get_irq_desc_chip(desc);
|
||||
}
|
||||
static inline void *irq_desc_get_handler_data(struct irq_desc *desc)
|
||||
{
|
||||
return get_irq_desc_data(desc);
|
||||
}
|
||||
|
||||
static inline void *irq_desc_get_chip_data(struct irq_desc *desc)
|
||||
{
|
||||
return get_irq_desc_chip_data(desc);
|
||||
}
|
||||
|
||||
static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc)
|
||||
{
|
||||
return get_irq_desc_msi(desc);
|
||||
}
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) */
|
||||
|
||||
/*
|
||||
* kstrto* was included in kernel 2.6.38.4 and causes conflicts with the
|
||||
* version included in compat-wireless. We use strict_strtol to check if
|
||||
* kstrto* is already available.
|
||||
*/
|
||||
#ifndef strict_strtol
|
||||
/* Internal, do not use. */
|
||||
int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
|
||||
int __must_check _kstrtol(const char *s, unsigned int base, long *res);
|
||||
|
||||
int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
|
||||
int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
|
||||
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
|
||||
{
|
||||
/*
|
||||
* We want to shortcut function call, but
|
||||
* __builtin_types_compatible_p(unsigned long, unsigned long long) = 0.
|
||||
*/
|
||||
if (sizeof(unsigned long) == sizeof(unsigned long long) &&
|
||||
__alignof__(unsigned long) == __alignof__(unsigned long long))
|
||||
return kstrtoull(s, base, (unsigned long long *)res);
|
||||
else
|
||||
return _kstrtoul(s, base, res);
|
||||
}
|
||||
|
||||
static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
|
||||
{
|
||||
/*
|
||||
* We want to shortcut function call, but
|
||||
* __builtin_types_compatible_p(long, long long) = 0.
|
||||
*/
|
||||
if (sizeof(long) == sizeof(long long) &&
|
||||
__alignof__(long) == __alignof__(long long))
|
||||
return kstrtoll(s, base, (long long *)res);
|
||||
else
|
||||
return _kstrtol(s, base, res);
|
||||
}
|
||||
|
||||
int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res);
|
||||
int __must_check kstrtoint(const char *s, unsigned int base, int *res);
|
||||
|
||||
static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res)
|
||||
{
|
||||
return kstrtoull(s, base, res);
|
||||
}
|
||||
|
||||
static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res)
|
||||
{
|
||||
return kstrtoll(s, base, res);
|
||||
}
|
||||
|
||||
static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res)
|
||||
{
|
||||
return kstrtouint(s, base, res);
|
||||
}
|
||||
|
||||
static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res)
|
||||
{
|
||||
return kstrtoint(s, base, res);
|
||||
}
|
||||
|
||||
int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
|
||||
int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
|
||||
int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
|
||||
int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
|
||||
#endif /* ifndef strict_strtol */
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
|
||||
|
||||
#endif /* LINUX_26_39_COMPAT_H */
|
||||
@@ -1,67 +0,0 @@
|
||||
#ifndef LINUX_26_COMPAT_H
|
||||
#define LINUX_26_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
|
||||
#include <linux/kconfig.h>
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
|
||||
#include <generated/autoconf.h>
|
||||
#else
|
||||
#include <linux/autoconf.h>
|
||||
#endif
|
||||
#include <linux/compat_autoconf.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
/*
|
||||
* The define overwriting module_init is based on the original module_init
|
||||
* which looks like this:
|
||||
* #define module_init(initfn) \
|
||||
* static inline initcall_t __inittest(void) \
|
||||
* { return initfn; } \
|
||||
* int init_module(void) __attribute__((alias(#initfn)));
|
||||
*
|
||||
* To the call to the initfn we added the symbol dependency on compat
|
||||
* to make sure that compat.ko gets loaded for any compat modules.
|
||||
*/
|
||||
void compat_dependency_symbol(void);
|
||||
|
||||
#undef module_init
|
||||
#define module_init(initfn) \
|
||||
static int __init __init_compat(void) \
|
||||
{ \
|
||||
compat_dependency_symbol(); \
|
||||
return initfn(); \
|
||||
} \
|
||||
int init_module(void) __attribute__((alias("__init_compat")));
|
||||
|
||||
/*
|
||||
* Each compat file represents compatibility code for new kernel
|
||||
* code introduced for *that* kernel revision.
|
||||
*/
|
||||
|
||||
#include <linux/compat-2.6.22.h>
|
||||
#include <linux/compat-2.6.23.h>
|
||||
#include <linux/compat-2.6.24.h>
|
||||
#include <linux/compat-2.6.25.h>
|
||||
#include <linux/compat-2.6.26.h>
|
||||
#include <linux/compat-2.6.27.h>
|
||||
#include <linux/compat-2.6.28.h>
|
||||
#include <linux/compat-2.6.29.h>
|
||||
#include <linux/compat-2.6.30.h>
|
||||
#include <linux/compat-2.6.31.h>
|
||||
#include <linux/compat-2.6.32.h>
|
||||
#include <linux/compat-2.6.33.h>
|
||||
#include <linux/compat-2.6.34.h>
|
||||
#include <linux/compat-2.6.35.h>
|
||||
#include <linux/compat-2.6.36.h>
|
||||
#include <linux/compat-2.6.37.h>
|
||||
#include <linux/compat-2.6.38.h>
|
||||
#include <linux/compat-2.6.39.h>
|
||||
#include <linux/compat-3.0.h>
|
||||
#include <linux/compat-3.1.h>
|
||||
#include <linux/compat-3.2.h>
|
||||
#include <linux/compat-3.3.h>
|
||||
#include <linux/compat-3.4.h>
|
||||
#include <linux/compat-3.5.h>
|
||||
|
||||
#endif /* LINUX_26_COMPAT_H */
|
||||
@@ -1,130 +0,0 @@
|
||||
#ifndef LINUX_3_0_COMPAT_H
|
||||
#define LINUX_3_0_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
|
||||
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
/*
|
||||
* since commit 1c5cae815d19ffe02bdfda1260949ef2b1806171
|
||||
* "net: call dev_alloc_name from register_netdevice" dev_alloc_name is
|
||||
* called automatically. This is not implemented in older kernel
|
||||
* versions so it will result in device wrong names.
|
||||
*/
|
||||
static inline int register_netdevice_name(struct net_device *dev)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (strchr(dev->name, '%')) {
|
||||
err = dev_alloc_name(dev, dev->name);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
return register_netdevice(dev);
|
||||
}
|
||||
|
||||
#define register_netdevice(dev) register_netdevice_name(dev)
|
||||
|
||||
/* BCMA core, see drivers/bcma/ */
|
||||
#ifndef BCMA_CORE
|
||||
/* Broadcom's specific AMBA core, see drivers/bcma/ */
|
||||
struct bcma_device_id {
|
||||
__u16 manuf;
|
||||
__u16 id;
|
||||
__u8 rev;
|
||||
__u8 class;
|
||||
};
|
||||
#define BCMA_CORE(_manuf, _id, _rev, _class) \
|
||||
{ .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
|
||||
#define BCMA_CORETABLE_END \
|
||||
{ 0, },
|
||||
|
||||
#define BCMA_ANY_MANUF 0xFFFF
|
||||
#define BCMA_ANY_ID 0xFFFF
|
||||
#define BCMA_ANY_REV 0xFF
|
||||
#define BCMA_ANY_CLASS 0xFF
|
||||
#endif /* BCMA_CORE */
|
||||
|
||||
int mac_pton(const char *s, u8 *mac);
|
||||
|
||||
int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res);
|
||||
int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res);
|
||||
int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res);
|
||||
int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res);
|
||||
int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res);
|
||||
int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res);
|
||||
int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res);
|
||||
int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res);
|
||||
int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res);
|
||||
int __must_check kstrtos8_from_user(const char __user *s, size_t count, unsigned int base, s8 *res);
|
||||
|
||||
static inline int __must_check kstrtou64_from_user(const char __user *s, size_t count, unsigned int base, u64 *res)
|
||||
{
|
||||
return kstrtoull_from_user(s, count, base, res);
|
||||
}
|
||||
|
||||
static inline int __must_check kstrtos64_from_user(const char __user *s, size_t count, unsigned int base, s64 *res)
|
||||
{
|
||||
return kstrtoll_from_user(s, count, base, res);
|
||||
}
|
||||
|
||||
static inline int __must_check kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, u32 *res)
|
||||
{
|
||||
return kstrtouint_from_user(s, count, base, res);
|
||||
}
|
||||
|
||||
static inline int __must_check kstrtos32_from_user(const char __user *s, size_t count, unsigned int base, s32 *res)
|
||||
{
|
||||
return kstrtoint_from_user(s, count, base, res);
|
||||
}
|
||||
|
||||
/*
|
||||
* This adds a nested function everywhere kfree_rcu() was called. This
|
||||
* function frees the memory and is given as a function to call_rcu().
|
||||
* The rcu callback could happen every time also after the module was
|
||||
* unloaded and this will cause problems.
|
||||
*/
|
||||
#define kfree_rcu(data, rcuhead) do { \
|
||||
void __kfree_rcu_fn(struct rcu_head *rcu_head) \
|
||||
{ \
|
||||
void *___ptr; \
|
||||
___ptr = container_of(rcu_head, typeof(*(data)), rcuhead);\
|
||||
kfree(___ptr); \
|
||||
} \
|
||||
call_rcu(&(data)->rcuhead, __kfree_rcu_fn); \
|
||||
} while (0)
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
/*
|
||||
* The define overwriting module_exit is based on the original module_exit
|
||||
* which looks like this:
|
||||
* #define module_exit(exitfn) \
|
||||
* static inline exitcall_t __exittest(void) \
|
||||
* { return exitfn; } \
|
||||
* void cleanup_module(void) __attribute__((alias(#exitfn)));
|
||||
*
|
||||
* We replaced the call to the actual function exitfn() with a call to our
|
||||
* function which calls the original exitfn() and then rcu_barrier()
|
||||
*
|
||||
* As a module will not be unloaded that ofter it should not have a big
|
||||
* performance impact when rcu_barrier() is called on every module exit,
|
||||
* also when no kfree_rcu() backport is used in that module.
|
||||
*/
|
||||
#undef module_exit
|
||||
#define module_exit(exitfn) \
|
||||
static void __exit __exit_compat(void) \
|
||||
{ \
|
||||
exitfn(); \
|
||||
rcu_barrier(); \
|
||||
} \
|
||||
void cleanup_module(void) __attribute__((alias("__exit_compat")));
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) */
|
||||
|
||||
#endif /* LINUX_3_0_COMPAT_H */
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef LINUX_3_1_COMPAT_H
|
||||
#define LINUX_3_1_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
|
||||
|
||||
#include <linux/security.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
|
||||
unsigned int length, gfp_t gfp)
|
||||
{
|
||||
struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
|
||||
|
||||
if (NET_IP_ALIGN && skb)
|
||||
skb_reserve(skb, NET_IP_ALIGN);
|
||||
return skb;
|
||||
}
|
||||
|
||||
#define IS_ENABLED(option) defined(option)
|
||||
|
||||
#define genl_dump_check_consistent(cb, user_hdr, family)
|
||||
|
||||
#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
|
||||
* skbs on transmit */
|
||||
|
||||
#define PCMCIA_DEVICE_MANF_CARD_PROD_ID3(manf, card, v3, vh3) { \
|
||||
.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
|
||||
PCMCIA_DEV_ID_MATCH_CARD_ID| \
|
||||
PCMCIA_DEV_ID_MATCH_PROD_ID3, \
|
||||
.manf_id = (manf), \
|
||||
.card_id = (card), \
|
||||
.prod_id = { NULL, NULL, (v3), NULL }, \
|
||||
.prod_id_hash = { 0, 0, (vh3), 0 }, }
|
||||
|
||||
/*
|
||||
* This has been defined in include/linux/security.h for some time, but was
|
||||
* only given an EXPORT_SYMBOL for 3.1. Add a compat_* definition to avoid
|
||||
* breaking the compile.
|
||||
*/
|
||||
#define security_sk_clone(a, b) compat_security_sk_clone(a, b)
|
||||
|
||||
static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* In many versions, several architectures do not seem to include an
|
||||
* atomic64_t implementation, and do not include the software emulation from
|
||||
* asm-generic/atomic64_t.
|
||||
* Detect and handle this here.
|
||||
*/
|
||||
#include <asm/atomic.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && !defined(ATOMIC64_INIT) && !defined(CONFIG_X86) && !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) && defined(CONFIG_ARM) && !defined(CONFIG_GENERIC_ATOMIC64))
|
||||
#include <asm-generic/atomic64.h>
|
||||
#endif
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) */
|
||||
|
||||
#endif /* LINUX_3_1_COMPAT_H */
|
||||
@@ -1,81 +0,0 @@
|
||||
#ifndef LINUX_3_2_COMPAT_H
|
||||
#define LINUX_3_2_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
|
||||
|
||||
/**
|
||||
* skb_frag_page - retrieve the page refered to by a paged fragment
|
||||
* @frag: the paged fragment
|
||||
*
|
||||
* Returns the &struct page associated with @frag.
|
||||
*/
|
||||
static inline struct page *skb_frag_page(const skb_frag_t *frag)
|
||||
{
|
||||
return frag->page;
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_frag_dma_map - maps a paged fragment via the DMA API
|
||||
* @device: the device to map the fragment to
|
||||
* @frag: the paged fragment to map
|
||||
* @offset: the offset within the fragment (starting at the
|
||||
* fragment's own offset)
|
||||
* @size: the number of bytes to map
|
||||
* @direction: the direction of the mapping (%PCI_DMA_*)
|
||||
*
|
||||
* Maps the page associated with @frag to @device.
|
||||
*/
|
||||
static inline dma_addr_t skb_frag_dma_map(struct device *dev,
|
||||
const skb_frag_t *frag,
|
||||
size_t offset, size_t size,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
return dma_map_page(dev, skb_frag_page(frag),
|
||||
frag->page_offset + offset, size, dir);
|
||||
}
|
||||
|
||||
#define ETH_P_TDLS 0x890D /* TDLS */
|
||||
|
||||
static inline unsigned int skb_frag_size(const skb_frag_t *frag)
|
||||
{
|
||||
return frag->size;
|
||||
}
|
||||
|
||||
static inline char *hex_byte_pack(char *buf, u8 byte)
|
||||
{
|
||||
*buf++ = hex_asc_hi(byte);
|
||||
*buf++ = hex_asc_lo(byte);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* module_platform_driver() - Helper macro for drivers that don't do
|
||||
* anything special in module init/exit. This eliminates a lot of
|
||||
* boilerplate. Each module may only use this macro once, and
|
||||
* calling it replaces module_init() and module_exit()
|
||||
*/
|
||||
#define module_platform_driver(__platform_driver) \
|
||||
module_driver(__platform_driver, platform_driver_register, \
|
||||
platform_driver_unregister)
|
||||
|
||||
static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t flag)
|
||||
{
|
||||
void *ret = dma_alloc_coherent(dev, size, dma_handle, flag);
|
||||
if (ret)
|
||||
memset(ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern int __netdev_printk(const char *level, const struct net_device *dev,
|
||||
struct va_format *vaf);
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */
|
||||
|
||||
#endif /* LINUX_3_2_COMPAT_H */
|
||||
@@ -1,60 +0,0 @@
|
||||
#ifndef LINUX_3_3_COMPAT_H
|
||||
#define LINUX_3_3_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
|
||||
|
||||
/* include to override NL80211_FEATURE_SK_TX_STATUS */
|
||||
#include <linux/nl80211.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
extern struct sk_buff *__pskb_copy(struct sk_buff *skb,
|
||||
int headroom, gfp_t gfp_mask);
|
||||
|
||||
static inline void skb_complete_wifi_ack(struct sk_buff *skb, bool acked)
|
||||
{
|
||||
WARN_ON(1);
|
||||
}
|
||||
#define NL80211_FEATURE_SK_TX_STATUS 0
|
||||
|
||||
typedef u32 netdev_features_t;
|
||||
|
||||
/* source include/linux/device.h */
|
||||
/**
|
||||
* module_driver() - Helper macro for drivers that don't do anything
|
||||
* special in module init/exit. This eliminates a lot of boilerplate.
|
||||
* Each module may only use this macro once, and calling it replaces
|
||||
* module_init() and module_exit().
|
||||
*
|
||||
* Use this macro to construct bus specific macros for registering
|
||||
* drivers, and do not use it on its own.
|
||||
*/
|
||||
#define module_driver(__driver, __register, __unregister) \
|
||||
static int __init __driver##_init(void) \
|
||||
{ \
|
||||
return __register(&(__driver)); \
|
||||
} \
|
||||
module_init(__driver##_init); \
|
||||
static void __exit __driver##_exit(void) \
|
||||
{ \
|
||||
__unregister(&(__driver)); \
|
||||
} \
|
||||
module_exit(__driver##_exit);
|
||||
|
||||
/* source include/linux/usb.h */
|
||||
/**
|
||||
* module_usb_driver() - Helper macro for registering a USB driver
|
||||
* @__usb_driver: usb_driver struct
|
||||
*
|
||||
* Helper macro for USB drivers which do not do anything special in module
|
||||
* init/exit. This eliminates a lot of boilerplate. Each module may only
|
||||
* use this macro once, and calling it replaces module_init() and module_exit()
|
||||
*/
|
||||
#define module_usb_driver(__usb_driver) \
|
||||
module_driver(__usb_driver, usb_register, \
|
||||
usb_deregister)
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
|
||||
|
||||
#endif /* LINUX_3_3_COMPAT_H */
|
||||
@@ -1,67 +0,0 @@
|
||||
#ifndef LINUX_3_4_COMPAT_H
|
||||
#define LINUX_3_4_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
|
||||
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
|
||||
#define skb_add_rx_frag(skb, i, page, off, size, truesize) \
|
||||
v2_6_28_skb_add_rx_frag(skb, i, page, off, size)
|
||||
#else
|
||||
#define skb_add_rx_frag(skb, i, page, off, size, truesize) \
|
||||
skb_add_rx_frag(skb, i, page, off, size)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_X32_ABI
|
||||
#define COMPAT_USE_64BIT_TIME \
|
||||
(!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
|
||||
#else
|
||||
#define COMPAT_USE_64BIT_TIME 0
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12))
|
||||
static inline void eth_hw_addr_random(struct net_device *dev)
|
||||
{
|
||||
#error eth_hw_addr_random() needs to be implemented for < 2.6.12
|
||||
}
|
||||
#else /* kernels >= 2.6.12 */
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
|
||||
static inline void eth_hw_addr_random(struct net_device *dev)
|
||||
{
|
||||
get_random_bytes(dev->dev_addr, ETH_ALEN);
|
||||
dev->dev_addr[0] &= 0xfe; /* clear multicast bit */
|
||||
dev->dev_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */
|
||||
}
|
||||
#else /* kernels >= 2.6.31 */
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
|
||||
/* So this is 2.6.31..2.6.35 */
|
||||
|
||||
/* Just have the flags present, they won't really mean anything though */
|
||||
#define NET_ADDR_PERM 0 /* address is permanent (default) */
|
||||
#define NET_ADDR_RANDOM 1 /* address is generated randomly */
|
||||
#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
|
||||
|
||||
static inline void eth_hw_addr_random(struct net_device *dev)
|
||||
{
|
||||
random_ether_addr(dev->dev_addr);
|
||||
}
|
||||
|
||||
#else /* 2.6.36 and on */
|
||||
static inline void eth_hw_addr_random(struct net_device *dev)
|
||||
{
|
||||
dev_hw_addr_random(dev, dev->dev_addr);
|
||||
}
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)) */
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) */
|
||||
|
||||
#endif /* LINUX_5_4_COMPAT_H */
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef LINUX_3_5_COMPAT_H
|
||||
#define LINUX_3_5_COMPAT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
|
||||
|
||||
extern int simple_open(struct inode *inode, struct file *file);
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
|
||||
|
||||
#endif /* LINUX_3_5_COMPAT_H */
|
||||
@@ -1,767 +0,0 @@
|
||||
#ifndef COMPAT_AUTOCONF_INCLUDED
|
||||
#define COMPAT_AUTOCONF_INCLUDED
|
||||
/*
|
||||
* Automatically generated C config: don't edit
|
||||
* Wed Jan 8 15:57:07 CET 2014
|
||||
* compat-wireless-2.6: compat-wireless-v3.4-rc3-1
|
||||
* linux-2.6: v3.4-rc3
|
||||
*/
|
||||
#define COMPAT_RELEASE "compat-wireless-v3.4-rc3-1"
|
||||
#define COMPAT_KERNEL_RELEASE "v3.4-rc3"
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
|
||||
#error Compat-wireless requirement: Linux >= 2,6,24
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) */
|
||||
#ifndef CONFIG_COMPAT_KERNEL_3_3
|
||||
#define CONFIG_COMPAT_KERNEL_3_3 1
|
||||
#endif /* CONFIG_COMPAT_KERNEL_3_3 */
|
||||
#ifndef CONFIG_COMPAT_KERNEL_3_4
|
||||
#define CONFIG_COMPAT_KERNEL_3_4 1
|
||||
#endif /* CONFIG_COMPAT_KERNEL_3_4 */
|
||||
#ifndef CONFIG_COMPAT_KERNEL_3_5
|
||||
#define CONFIG_COMPAT_KERNEL_3_5 1
|
||||
#endif /* CONFIG_COMPAT_KERNEL_3_5 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_24 */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
|
||||
#if (!defined(RHEL_MAJOR) || RHEL_MAJOR != 6 || RHEL_MINOR < 1)
|
||||
#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
|
||||
#ifndef CONFIG_COMPAT_FIRMWARE_CLASS
|
||||
#define CONFIG_COMPAT_FIRMWARE_CLASS 1
|
||||
#endif /* CONFIG_COMPAT_FIRMWARE_CLASS */
|
||||
#endif /* CONFIG_FW_LOADER */
|
||||
#endif /* CONFIG_COMPAT_RHEL_6_1 */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_33 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
|
||||
#if (!defined(RHEL_MAJOR) || RHEL_MAJOR != 6 || RHEL_MINOR < 1)
|
||||
#endif /* CONFIG_COMPAT_RHEL_6_1 */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_36 */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
|
||||
#ifndef CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN
|
||||
#define CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN 1
|
||||
#endif /* CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_33 */
|
||||
#if (defined(RHEL_MAJOR) && RHEL_MAJOR == 6 && RHEL_MINOR >= 0)
|
||||
#ifndef CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN
|
||||
#define CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN 1
|
||||
#endif /* CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN */
|
||||
#endif /* CONFIG_COMPAT_RHEL_6_0 */
|
||||
#if (defined(RHEL_MAJOR) && RHEL_MAJOR == 6 && RHEL_MINOR >= 0)
|
||||
#ifndef CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP
|
||||
#define CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP 1
|
||||
#endif /* CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP */
|
||||
#endif /* CONFIG_COMPAT_RHEL_6_0 */
|
||||
#ifndef CONFIG_MAC80211
|
||||
#define CONFIG_MAC80211 1
|
||||
#endif /* CONFIG_MAC80211 */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
|
||||
#ifndef CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER
|
||||
#define CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER 1
|
||||
#endif /* CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_33 */
|
||||
#ifndef CONFIG_MAC80211_RC_DEFAULT
|
||||
#define CONFIG_MAC80211_RC_DEFAULT "minstrel_ht"
|
||||
#endif /* CONFIG_MAC80211_RC_DEFAULT */
|
||||
#ifndef CONFIG_MAC80211_RC_DEFAULT_MINSTREL
|
||||
#define CONFIG_MAC80211_RC_DEFAULT_MINSTREL 1
|
||||
#endif /* CONFIG_MAC80211_RC_DEFAULT_MINSTREL */
|
||||
#ifndef CONFIG_COMPAT_MAC80211_RC_DEFAULT
|
||||
#define CONFIG_COMPAT_MAC80211_RC_DEFAULT "minstrel_ht"
|
||||
#endif /* CONFIG_COMPAT_MAC80211_RC_DEFAULT */
|
||||
#ifndef CONFIG_MAC80211_RC_PID
|
||||
#define CONFIG_MAC80211_RC_PID 1
|
||||
#endif /* CONFIG_MAC80211_RC_PID */
|
||||
#ifndef CONFIG_MAC80211_RC_MINSTREL
|
||||
#define CONFIG_MAC80211_RC_MINSTREL 1
|
||||
#endif /* CONFIG_MAC80211_RC_MINSTREL */
|
||||
#ifndef CONFIG_MAC80211_RC_MINSTREL_HT
|
||||
#define CONFIG_MAC80211_RC_MINSTREL_HT 1
|
||||
#endif /* CONFIG_MAC80211_RC_MINSTREL_HT */
|
||||
#if defined(CONFIG_LEDS_TRIGGERS) || defined(CONFIG_LEDS_TRIGGERS_MODULE)
|
||||
#ifndef CONFIG_MAC80211_LEDS
|
||||
#define CONFIG_MAC80211_LEDS 1
|
||||
#endif /* CONFIG_MAC80211_LEDS */
|
||||
#endif /* CONFIG_LEDS_TRIGGERS */
|
||||
#ifndef CONFIG_MAC80211_MESH
|
||||
#define CONFIG_MAC80211_MESH 1
|
||||
#endif /* CONFIG_MAC80211_MESH */
|
||||
#ifndef CONFIG_CFG80211
|
||||
#define CONFIG_CFG80211 1
|
||||
#endif /* CONFIG_CFG80211 */
|
||||
#ifndef CONFIG_CFG80211_DEFAULT_PS
|
||||
#define CONFIG_CFG80211_DEFAULT_PS 1
|
||||
#endif /* CONFIG_CFG80211_DEFAULT_PS */
|
||||
#ifndef CONFIG_LIB80211
|
||||
#define CONFIG_LIB80211 1
|
||||
#endif /* CONFIG_LIB80211 */
|
||||
#ifndef CONFIG_LIB80211_CRYPT_WEP
|
||||
#define CONFIG_LIB80211_CRYPT_WEP 1
|
||||
#endif /* CONFIG_LIB80211_CRYPT_WEP */
|
||||
#ifndef CONFIG_LIB80211_CRYPT_CCMP
|
||||
#define CONFIG_LIB80211_CRYPT_CCMP 1
|
||||
#endif /* CONFIG_LIB80211_CRYPT_CCMP */
|
||||
#ifndef CONFIG_LIB80211_CRYPT_TKIP
|
||||
#define CONFIG_LIB80211_CRYPT_TKIP 1
|
||||
#endif /* CONFIG_LIB80211_CRYPT_TKIP */
|
||||
#ifndef CONFIG_BT
|
||||
#define CONFIG_BT 1
|
||||
#endif /* CONFIG_BT */
|
||||
#ifndef CONFIG_BT_RFCOMM
|
||||
#define CONFIG_BT_RFCOMM 1
|
||||
#endif /* CONFIG_BT_RFCOMM */
|
||||
#ifndef CONFIG_BT_RFCOMM_TTY
|
||||
#define CONFIG_BT_RFCOMM_TTY 1
|
||||
#endif /* CONFIG_BT_RFCOMM_TTY */
|
||||
#ifndef CONFIG_BT_BNEP
|
||||
#define CONFIG_BT_BNEP 1
|
||||
#endif /* CONFIG_BT_BNEP */
|
||||
#ifndef CONFIG_BT_BNEP_MC_FILTER
|
||||
#define CONFIG_BT_BNEP_MC_FILTER 1
|
||||
#endif /* CONFIG_BT_BNEP_MC_FILTER */
|
||||
#ifndef CONFIG_BT_BNEP_PROTO_FILTER
|
||||
#define CONFIG_BT_BNEP_PROTO_FILTER 1
|
||||
#endif /* CONFIG_BT_BNEP_PROTO_FILTER */
|
||||
#if defined(CONFIG_ISDN_CAPI) || defined(CONFIG_ISDN_CAPI_MODULE)
|
||||
#ifndef CONFIG_BT_CMTP
|
||||
#define CONFIG_BT_CMTP 1
|
||||
#endif /* CONFIG_BT_CMTP */
|
||||
#endif /* CONFIG_ISDN_CAPI */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
|
||||
#ifndef CONFIG_COMPAT_BT_HIDP
|
||||
#define CONFIG_COMPAT_BT_HIDP 1
|
||||
#endif /* CONFIG_COMPAT_BT_HIDP */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_28 */
|
||||
#ifndef CONFIG_BT_HCIUART
|
||||
#define CONFIG_BT_HCIUART "M"
|
||||
#endif /* CONFIG_BT_HCIUART */
|
||||
#ifndef CONFIG_BT_HCIUART_H4
|
||||
#define CONFIG_BT_HCIUART_H4 1
|
||||
#endif /* CONFIG_BT_HCIUART_H4 */
|
||||
#ifndef CONFIG_BT_HCIUART_BCSP
|
||||
#define CONFIG_BT_HCIUART_BCSP 1
|
||||
#endif /* CONFIG_BT_HCIUART_BCSP */
|
||||
#ifndef CONFIG_BT_HCIUART_ATH3K
|
||||
#define CONFIG_BT_HCIUART_ATH3K 1
|
||||
#endif /* CONFIG_BT_HCIUART_ATH3K */
|
||||
#ifndef CONFIG_BT_HCIUART_LL
|
||||
#define CONFIG_BT_HCIUART_LL 1
|
||||
#endif /* CONFIG_BT_HCIUART_LL */
|
||||
#ifndef CONFIG_BT_HCIVHCI
|
||||
#define CONFIG_BT_HCIVHCI 1
|
||||
#endif /* CONFIG_BT_HCIVHCI */
|
||||
#ifndef CONFIG_BT_MRVL
|
||||
#define CONFIG_BT_MRVL 1
|
||||
#endif /* CONFIG_BT_MRVL */
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
#ifndef CONFIG_BT_HCIDTL1
|
||||
#define CONFIG_BT_HCIDTL1 1
|
||||
#endif /* CONFIG_BT_HCIDTL1 */
|
||||
#ifndef CONFIG_BT_HCIBT3C
|
||||
#define CONFIG_BT_HCIBT3C 1
|
||||
#endif /* CONFIG_BT_HCIBT3C */
|
||||
#ifndef CONFIG_BT_HCIBLUECARD
|
||||
#define CONFIG_BT_HCIBLUECARD 1
|
||||
#endif /* CONFIG_BT_HCIBLUECARD */
|
||||
#ifndef CONFIG_BT_HCIBTUART
|
||||
#define CONFIG_BT_HCIBTUART 1
|
||||
#endif /* CONFIG_BT_HCIBTUART */
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
#if defined(CONFIG_WIRELESS_EXT) || defined(CONFIG_WIRELESS_EXT_MODULE)
|
||||
#ifndef CONFIG_CFG80211_WEXT
|
||||
#define CONFIG_CFG80211_WEXT 1
|
||||
#endif /* CONFIG_CFG80211_WEXT */
|
||||
#else /* CONFIG_CFG80211_WEXT */
|
||||
#endif /* CONFIG_WIRELESS_EXT */
|
||||
#if defined(CONFIG_STAGING) || defined(CONFIG_STAGING_MODULE)
|
||||
#ifndef CONFIG_COMPAT_STAGING
|
||||
#define CONFIG_COMPAT_STAGING 1
|
||||
#endif /* CONFIG_COMPAT_STAGING */
|
||||
#endif /* CONFIG_STAGING */
|
||||
#ifndef CONFIG_MAC80211_HWSIM
|
||||
#define CONFIG_MAC80211_HWSIM 1
|
||||
#endif /* CONFIG_MAC80211_HWSIM */
|
||||
#ifndef CONFIG_ATH5K
|
||||
#define CONFIG_ATH5K 1
|
||||
#endif /* CONFIG_ATH5K */
|
||||
#ifndef CONFIG_ATH9K
|
||||
#define CONFIG_ATH9K 1
|
||||
#endif /* CONFIG_ATH9K */
|
||||
#ifndef CONFIG_ATH9K_HW
|
||||
#define CONFIG_ATH9K_HW 1
|
||||
#endif /* CONFIG_ATH9K_HW */
|
||||
#ifndef CONFIG_ATH9K_COMMON
|
||||
#define CONFIG_ATH9K_COMMON 1
|
||||
#endif /* CONFIG_ATH9K_COMMON */
|
||||
#ifndef CONFIG_COMPAT_ATH9K_RATE_CONTROL
|
||||
#define CONFIG_COMPAT_ATH9K_RATE_CONTROL 1
|
||||
#endif /* CONFIG_COMPAT_ATH9K_RATE_CONTROL */
|
||||
#ifndef CONFIG_ATH9K_BTCOEX_SUPPORT
|
||||
#define CONFIG_ATH9K_BTCOEX_SUPPORT 1
|
||||
#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */
|
||||
#if defined(CONFIG_PCI) || defined(CONFIG_PCI_MODULE)
|
||||
#ifndef CONFIG_ATH5K_PCI
|
||||
#define CONFIG_ATH5K_PCI 1
|
||||
#endif /* CONFIG_ATH5K_PCI */
|
||||
#ifndef CONFIG_ATH9K_PCI
|
||||
#define CONFIG_ATH9K_PCI 1
|
||||
#endif /* CONFIG_ATH9K_PCI */
|
||||
#ifndef CONFIG_IWLWIFI
|
||||
#define CONFIG_IWLWIFI 1
|
||||
#endif /* CONFIG_IWLWIFI */
|
||||
#ifndef CONFIG_IWLWIFI_P2P
|
||||
#define CONFIG_IWLWIFI_P2P 1
|
||||
#endif /* CONFIG_IWLWIFI_P2P */
|
||||
#ifndef CONFIG_IWLEGACY
|
||||
#define CONFIG_IWLEGACY 1
|
||||
#endif /* CONFIG_IWLEGACY */
|
||||
#ifndef CONFIG_COMPAT_IWL4965
|
||||
#define CONFIG_COMPAT_IWL4965 1
|
||||
#endif /* CONFIG_COMPAT_IWL4965 */
|
||||
#ifndef CONFIG_IWL3945
|
||||
#define CONFIG_IWL3945 1
|
||||
#endif /* CONFIG_IWL3945 */
|
||||
#ifndef CONFIG_B43
|
||||
#define CONFIG_B43 1
|
||||
#endif /* CONFIG_B43 */
|
||||
#ifndef CONFIG_B43_HWRNG
|
||||
#define CONFIG_B43_HWRNG 1
|
||||
#endif /* CONFIG_B43_HWRNG */
|
||||
#ifndef CONFIG_B43_PCI_AUTOSELECT
|
||||
#define CONFIG_B43_PCI_AUTOSELECT 1
|
||||
#endif /* CONFIG_B43_PCI_AUTOSELECT */
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
#ifndef CONFIG_B43_PCMCIA
|
||||
#define CONFIG_B43_PCMCIA 1
|
||||
#endif /* CONFIG_B43_PCMCIA */
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE)
|
||||
#ifndef CONFIG_B43_LEDS
|
||||
#define CONFIG_B43_LEDS 1
|
||||
#endif /* CONFIG_B43_LEDS */
|
||||
#endif /* CONFIG_MAC80211_LEDS */
|
||||
#ifndef CONFIG_B43_PHY_LP
|
||||
#define CONFIG_B43_PHY_LP 1
|
||||
#endif /* CONFIG_B43_PHY_LP */
|
||||
#ifndef CONFIG_B43_PHY_N
|
||||
#define CONFIG_B43_PHY_N 1
|
||||
#endif /* CONFIG_B43_PHY_N */
|
||||
#ifndef CONFIG_B43_PHY_HT
|
||||
#define CONFIG_B43_PHY_HT 1
|
||||
#endif /* CONFIG_B43_PHY_HT */
|
||||
#ifndef CONFIG_B43LEGACY
|
||||
#define CONFIG_B43LEGACY 1
|
||||
#endif /* CONFIG_B43LEGACY */
|
||||
#ifndef CONFIG_B43LEGACY_HWRNG
|
||||
#define CONFIG_B43LEGACY_HWRNG 1
|
||||
#endif /* CONFIG_B43LEGACY_HWRNG */
|
||||
#ifndef CONFIG_B43LEGACY_PCI_AUTOSELECT
|
||||
#define CONFIG_B43LEGACY_PCI_AUTOSELECT 1
|
||||
#endif /* CONFIG_B43LEGACY_PCI_AUTOSELECT */
|
||||
#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE)
|
||||
#ifndef CONFIG_B43LEGACY_LEDS
|
||||
#define CONFIG_B43LEGACY_LEDS 1
|
||||
#endif /* CONFIG_B43LEGACY_LEDS */
|
||||
#endif /* CONFIG_MAC80211_LEDS */
|
||||
#ifndef CONFIG_B43LEGACY_DMA
|
||||
#define CONFIG_B43LEGACY_DMA 1
|
||||
#endif /* CONFIG_B43LEGACY_DMA */
|
||||
#ifndef CONFIG_B43LEGACY_PIO
|
||||
#define CONFIG_B43LEGACY_PIO 1
|
||||
#endif /* CONFIG_B43LEGACY_PIO */
|
||||
#if defined(CONFIG_WIRELESS_EXT) || defined(CONFIG_WIRELESS_EXT_MODULE)
|
||||
#ifndef CONFIG_LIBIPW
|
||||
#define CONFIG_LIBIPW 1
|
||||
#endif /* CONFIG_LIBIPW */
|
||||
#ifndef CONFIG_IPW2100
|
||||
#define CONFIG_IPW2100 1
|
||||
#endif /* CONFIG_IPW2100 */
|
||||
#ifndef CONFIG_IPW2100_MONITOR
|
||||
#define CONFIG_IPW2100_MONITOR 1
|
||||
#endif /* CONFIG_IPW2100_MONITOR */
|
||||
#ifndef CONFIG_IPW2200
|
||||
#define CONFIG_IPW2200 1
|
||||
#endif /* CONFIG_IPW2200 */
|
||||
#ifndef CONFIG_IPW2200_MONITOR
|
||||
#define CONFIG_IPW2200_MONITOR 1
|
||||
#endif /* CONFIG_IPW2200_MONITOR */
|
||||
#ifndef CONFIG_IPW2200_RADIOTAP
|
||||
#define CONFIG_IPW2200_RADIOTAP 1
|
||||
#endif /* CONFIG_IPW2200_RADIOTAP */
|
||||
#ifndef CONFIG_IPW2200_PROMISCUOUS
|
||||
#define CONFIG_IPW2200_PROMISCUOUS 1
|
||||
#endif /* CONFIG_IPW2200_PROMISCUOUS */
|
||||
#ifndef CONFIG_IPW2200_QOS
|
||||
#define CONFIG_IPW2200_QOS 1
|
||||
#endif /* CONFIG_IPW2200_QOS */
|
||||
#endif /* CONFIG_WIRELESS_EXT */
|
||||
#if defined(CONFIG_SSB) || defined(CONFIG_SSB_MODULE)
|
||||
#ifndef CONFIG_SSB_SPROM
|
||||
#define CONFIG_SSB_SPROM 1
|
||||
#endif /* CONFIG_SSB_SPROM */
|
||||
#ifndef CONFIG_SSB_BLOCKIO
|
||||
#define CONFIG_SSB_BLOCKIO 1
|
||||
#endif /* CONFIG_SSB_BLOCKIO */
|
||||
#ifndef CONFIG_SSB_PCIHOST
|
||||
#define CONFIG_SSB_PCIHOST 1
|
||||
#endif /* CONFIG_SSB_PCIHOST */
|
||||
#ifndef CONFIG_SSB_B43_PCI_BRIDGE
|
||||
#define CONFIG_SSB_B43_PCI_BRIDGE 1
|
||||
#endif /* CONFIG_SSB_B43_PCI_BRIDGE */
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
#ifndef CONFIG_SSB_PCMCIAHOST
|
||||
#define CONFIG_SSB_PCMCIAHOST 1
|
||||
#endif /* CONFIG_SSB_PCMCIAHOST */
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
#ifndef CONFIG_SSB_DRIVER_PCICORE
|
||||
#define CONFIG_SSB_DRIVER_PCICORE 1
|
||||
#endif /* CONFIG_SSB_DRIVER_PCICORE */
|
||||
#ifndef CONFIG_B43_SSB
|
||||
#define CONFIG_B43_SSB 1
|
||||
#endif /* CONFIG_B43_SSB */
|
||||
#endif /* CONFIG_SSB */
|
||||
#ifndef CONFIG_BCMA
|
||||
#define CONFIG_BCMA 1
|
||||
#endif /* CONFIG_BCMA */
|
||||
#ifndef CONFIG_BCMA_BLOCKIO
|
||||
#define CONFIG_BCMA_BLOCKIO 1
|
||||
#endif /* CONFIG_BCMA_BLOCKIO */
|
||||
#ifndef CONFIG_BCMA_HOST_PCI
|
||||
#define CONFIG_BCMA_HOST_PCI 1
|
||||
#endif /* CONFIG_BCMA_HOST_PCI */
|
||||
#ifndef CONFIG_B43_BCMA
|
||||
#define CONFIG_B43_BCMA 1
|
||||
#endif /* CONFIG_B43_BCMA */
|
||||
#ifndef CONFIG_B43_BCMA_EXTRA
|
||||
#define CONFIG_B43_BCMA_EXTRA 1
|
||||
#endif /* CONFIG_B43_BCMA_EXTRA */
|
||||
#ifndef CONFIG_P54_PCI
|
||||
#define CONFIG_P54_PCI 1
|
||||
#endif /* CONFIG_P54_PCI */
|
||||
#ifndef CONFIG_B44
|
||||
#define CONFIG_B44 1
|
||||
#endif /* CONFIG_B44 */
|
||||
#ifndef CONFIG_B44_PCI
|
||||
#define CONFIG_B44_PCI 1
|
||||
#endif /* CONFIG_B44_PCI */
|
||||
#ifndef CONFIG_RTL8180
|
||||
#define CONFIG_RTL8180 1
|
||||
#endif /* CONFIG_RTL8180 */
|
||||
#ifndef CONFIG_ADM8211
|
||||
#define CONFIG_ADM8211 1
|
||||
#endif /* CONFIG_ADM8211 */
|
||||
#ifndef CONFIG_RT2X00_LIB_PCI
|
||||
#define CONFIG_RT2X00_LIB_PCI 1
|
||||
#endif /* CONFIG_RT2X00_LIB_PCI */
|
||||
#ifndef CONFIG_RT2400PCI
|
||||
#define CONFIG_RT2400PCI 1
|
||||
#endif /* CONFIG_RT2400PCI */
|
||||
#ifndef CONFIG_RT2500PCI
|
||||
#define CONFIG_RT2500PCI 1
|
||||
#endif /* CONFIG_RT2500PCI */
|
||||
#if defined(CONFIG_CRC_CCITT) || defined(CONFIG_CRC_CCITT_MODULE)
|
||||
#ifndef CONFIG_RT2800PCI
|
||||
#define CONFIG_RT2800PCI 1
|
||||
#endif /* CONFIG_RT2800PCI */
|
||||
#ifndef CONFIG_RT2800PCI_RT33XX
|
||||
#define CONFIG_RT2800PCI_RT33XX 1
|
||||
#endif /* CONFIG_RT2800PCI_RT33XX */
|
||||
#ifndef CONFIG_RT2800PCI_RT35XX
|
||||
#define CONFIG_RT2800PCI_RT35XX 1
|
||||
#endif /* CONFIG_RT2800PCI_RT35XX */
|
||||
#ifndef CONFIG_RT2800PCI_RT53XX
|
||||
#define CONFIG_RT2800PCI_RT53XX 1
|
||||
#endif /* CONFIG_RT2800PCI_RT53XX */
|
||||
#endif /* CONFIG_CRC_CCITT */
|
||||
#if defined(CONFIG_CRC_ITU_T) || defined(CONFIG_CRC_ITU_T_MODULE)
|
||||
#ifndef CONFIG_RT61PCI
|
||||
#define CONFIG_RT61PCI 1
|
||||
#endif /* CONFIG_RT61PCI */
|
||||
#endif /* CONFIG_CRC_ITU_T */
|
||||
#ifndef CONFIG_MWL8K
|
||||
#define CONFIG_MWL8K 1
|
||||
#endif /* CONFIG_MWL8K */
|
||||
#ifndef CONFIG_ATL1
|
||||
#define CONFIG_ATL1 1
|
||||
#endif /* CONFIG_ATL1 */
|
||||
#ifndef CONFIG_ATL2
|
||||
#define CONFIG_ATL2 1
|
||||
#endif /* CONFIG_ATL2 */
|
||||
#ifndef CONFIG_ATL1E
|
||||
#define CONFIG_ATL1E 1
|
||||
#endif /* CONFIG_ATL1E */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
|
||||
#undef CONFIG_ATL1C
|
||||
#ifndef CONFIG_ALX
|
||||
#define CONFIG_ALX 1
|
||||
#endif /* CONFIG_ALX */
|
||||
#else /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#undef CONFIG_ATL1C
|
||||
#ifndef CONFIG_ALX
|
||||
#define CONFIG_ALX 1
|
||||
#endif /* CONFIG_ALX */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#if defined(CONFIG_WIRELESS_EXT) || defined(CONFIG_WIRELESS_EXT_MODULE)
|
||||
#ifndef CONFIG_HERMES
|
||||
#define CONFIG_HERMES 1
|
||||
#endif /* CONFIG_HERMES */
|
||||
#ifndef CONFIG_HERMES_CACHE_FW_ON_INIT
|
||||
#define CONFIG_HERMES_CACHE_FW_ON_INIT 1
|
||||
#endif /* CONFIG_HERMES_CACHE_FW_ON_INIT */
|
||||
#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_PMAC_MODULE)
|
||||
#ifndef CONFIG_APPLE_AIRPORT
|
||||
#define CONFIG_APPLE_AIRPORT 1
|
||||
#endif /* CONFIG_APPLE_AIRPORT */
|
||||
#endif /* CONFIG_PPC_PMAC */
|
||||
#ifndef CONFIG_PLX_HERMES
|
||||
#define CONFIG_PLX_HERMES 1
|
||||
#endif /* CONFIG_PLX_HERMES */
|
||||
#ifndef CONFIG_TMD_HERMES
|
||||
#define CONFIG_TMD_HERMES 1
|
||||
#endif /* CONFIG_TMD_HERMES */
|
||||
#ifndef CONFIG_NORTEL_HERMES
|
||||
#define CONFIG_NORTEL_HERMES 1
|
||||
#endif /* CONFIG_NORTEL_HERMES */
|
||||
#ifndef CONFIG_PCI_HERMES
|
||||
#define CONFIG_PCI_HERMES 1
|
||||
#endif /* CONFIG_PCI_HERMES */
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
#ifndef CONFIG_PCMCIA_HERMES
|
||||
#define CONFIG_PCMCIA_HERMES 1
|
||||
#endif /* CONFIG_PCMCIA_HERMES */
|
||||
#ifndef CONFIG_PCMCIA_SPECTRUM
|
||||
#define CONFIG_PCMCIA_SPECTRUM 1
|
||||
#endif /* CONFIG_PCMCIA_SPECTRUM */
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
#endif /* CONFIG_WIRELESS_EXT */
|
||||
#ifndef CONFIG_RTL8192CE
|
||||
#define CONFIG_RTL8192CE 1
|
||||
#endif /* CONFIG_RTL8192CE */
|
||||
#ifndef CONFIG_RTL8192SE
|
||||
#define CONFIG_RTL8192SE 1
|
||||
#endif /* CONFIG_RTL8192SE */
|
||||
#ifndef CONFIG_RTL8192DE
|
||||
#define CONFIG_RTL8192DE 1
|
||||
#endif /* CONFIG_RTL8192DE */
|
||||
#ifndef CONFIG_BRCMSMAC
|
||||
#define CONFIG_BRCMSMAC 1
|
||||
#endif /* CONFIG_BRCMSMAC */
|
||||
#ifndef CONFIG_MWIFIEX_PCIE
|
||||
#define CONFIG_MWIFIEX_PCIE 1
|
||||
#endif /* CONFIG_MWIFIEX_PCIE */
|
||||
#endif /* CONFIG_PCI */
|
||||
#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
|
||||
#undef CONFIG_LIBERTAS
|
||||
#undef CONFIG_LIBERTAS_CS
|
||||
#else /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#ifndef CONFIG_LIBERTAS_CS
|
||||
#define CONFIG_LIBERTAS_CS 1
|
||||
#endif /* CONFIG_LIBERTAS_CS */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#endif /* CONFIG_PCMCIA */
|
||||
#ifndef CONFIG_EEPROM_93CX6
|
||||
#define CONFIG_EEPROM_93CX6 1
|
||||
#endif /* CONFIG_EEPROM_93CX6 */
|
||||
#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
|
||||
#ifndef CONFIG_COMPAT_ZD1211RW
|
||||
#define CONFIG_COMPAT_ZD1211RW 1
|
||||
#endif /* CONFIG_COMPAT_ZD1211RW */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
|
||||
#undef CONFIG_USB_COMPAT_USBNET
|
||||
#undef CONFIG_USB_NET_COMPAT_RNDIS_HOST
|
||||
#undef CONFIG_USB_NET_COMPAT_RNDIS_WLAN
|
||||
#undef CONFIG_USB_NET_COMPAT_CDCETHER
|
||||
#else /* CONFIG_COMPAT_KERNEL_2_6_29 */
|
||||
#ifndef CONFIG_USB_COMPAT_USBNET
|
||||
#define CONFIG_USB_COMPAT_USBNET 1
|
||||
#endif /* CONFIG_USB_COMPAT_USBNET */
|
||||
#if defined(CONFIG_USB_NET_CDCETHER) || defined(CONFIG_USB_NET_CDCETHER_MODULE)
|
||||
#ifndef CONFIG_USB_NET_COMPAT_RNDIS_HOST
|
||||
#define CONFIG_USB_NET_COMPAT_RNDIS_HOST 1
|
||||
#endif /* CONFIG_USB_NET_COMPAT_RNDIS_HOST */
|
||||
#ifndef CONFIG_USB_NET_COMPAT_RNDIS_WLAN
|
||||
#define CONFIG_USB_NET_COMPAT_RNDIS_WLAN 1
|
||||
#endif /* CONFIG_USB_NET_COMPAT_RNDIS_WLAN */
|
||||
#endif /* CONFIG_USB_NET_CDCETHER */
|
||||
#if defined(CONFIG_USB_NET_CDCETHER_MODULE) || defined(CONFIG_USB_NET_CDCETHER_MODULE_MODULE)
|
||||
#ifndef CONFIG_USB_NET_COMPAT_RNDIS_HOST
|
||||
#define CONFIG_USB_NET_COMPAT_RNDIS_HOST 1
|
||||
#endif /* CONFIG_USB_NET_COMPAT_RNDIS_HOST */
|
||||
#ifndef CONFIG_USB_NET_COMPAT_RNDIS_WLAN
|
||||
#define CONFIG_USB_NET_COMPAT_RNDIS_WLAN 1
|
||||
#endif /* CONFIG_USB_NET_COMPAT_RNDIS_WLAN */
|
||||
#endif /* CONFIG_USB_NET_CDCETHER */
|
||||
#ifndef CONFIG_USB_NET_COMPAT_CDCETHER
|
||||
#define CONFIG_USB_NET_COMPAT_CDCETHER 1
|
||||
#endif /* CONFIG_USB_NET_COMPAT_CDCETHER */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */
|
||||
#ifndef CONFIG_P54_USB
|
||||
#define CONFIG_P54_USB 1
|
||||
#endif /* CONFIG_P54_USB */
|
||||
#ifndef CONFIG_RTL8187
|
||||
#define CONFIG_RTL8187 1
|
||||
#endif /* CONFIG_RTL8187 */
|
||||
#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE)
|
||||
#ifndef CONFIG_RTL8187_LEDS
|
||||
#define CONFIG_RTL8187_LEDS 1
|
||||
#endif /* CONFIG_RTL8187_LEDS */
|
||||
#endif /* CONFIG_MAC80211_LEDS */
|
||||
#ifndef CONFIG_AT76C50X_USB
|
||||
#define CONFIG_AT76C50X_USB 1
|
||||
#endif /* CONFIG_AT76C50X_USB */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
|
||||
#ifndef CONFIG_CARL9170
|
||||
#define CONFIG_CARL9170 1
|
||||
#endif /* CONFIG_CARL9170 */
|
||||
#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE)
|
||||
#ifndef CONFIG_CARL9170_LEDS
|
||||
#define CONFIG_CARL9170_LEDS 1
|
||||
#endif /* CONFIG_CARL9170_LEDS */
|
||||
#endif /* CONFIG_MAC80211_LEDS */
|
||||
#ifndef CONFIG_CARL9170_WPC
|
||||
#define CONFIG_CARL9170_WPC 1
|
||||
#endif /* CONFIG_CARL9170_WPC */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */
|
||||
#ifndef CONFIG_COMPAT_USB_URB_THREAD_FIX
|
||||
#define CONFIG_COMPAT_USB_URB_THREAD_FIX 1
|
||||
#endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */
|
||||
#ifndef CONFIG_ATH9K_HTC
|
||||
#define CONFIG_ATH9K_HTC 1
|
||||
#endif /* CONFIG_ATH9K_HTC */
|
||||
#ifndef CONFIG_RT2500USB
|
||||
#define CONFIG_RT2500USB 1
|
||||
#endif /* CONFIG_RT2500USB */
|
||||
#if defined(CONFIG_CRC_CCITT) || defined(CONFIG_CRC_CCITT_MODULE)
|
||||
#ifndef CONFIG_RT2800USB
|
||||
#define CONFIG_RT2800USB 1
|
||||
#endif /* CONFIG_RT2800USB */
|
||||
#ifndef CONFIG_RT2800USB_RT33XX
|
||||
#define CONFIG_RT2800USB_RT33XX 1
|
||||
#endif /* CONFIG_RT2800USB_RT33XX */
|
||||
#ifndef CONFIG_RT2800USB_RT35XX
|
||||
#define CONFIG_RT2800USB_RT35XX 1
|
||||
#endif /* CONFIG_RT2800USB_RT35XX */
|
||||
#ifndef CONFIG_RT2800USB_RT53XX
|
||||
#define CONFIG_RT2800USB_RT53XX 1
|
||||
#endif /* CONFIG_RT2800USB_RT53XX */
|
||||
#ifndef CONFIG_RT2800USB_UNKNOWN
|
||||
#define CONFIG_RT2800USB_UNKNOWN 1
|
||||
#endif /* CONFIG_RT2800USB_UNKNOWN */
|
||||
#endif /* CONFIG_CRC_CCITT */
|
||||
#ifndef CONFIG_RT2X00_LIB_USB
|
||||
#define CONFIG_RT2X00_LIB_USB 1
|
||||
#endif /* CONFIG_RT2X00_LIB_USB */
|
||||
#if defined(CONFIG_CRC_ITU_T) || defined(CONFIG_CRC_ITU_T_MODULE)
|
||||
#ifndef CONFIG_RT73USB
|
||||
#define CONFIG_RT73USB 1
|
||||
#endif /* CONFIG_RT73USB */
|
||||
#endif /* CONFIG_CRC_ITU_T */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
|
||||
#undef CONFIG_LIBERTAS_THINFIRM_USB
|
||||
#undef CONFIG_LIBERTAS_USB
|
||||
#else /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#ifndef CONFIG_LIBERTAS_THINFIRM_USB
|
||||
#define CONFIG_LIBERTAS_THINFIRM_USB 1
|
||||
#endif /* CONFIG_LIBERTAS_THINFIRM_USB */
|
||||
#ifndef CONFIG_LIBERTAS_USB
|
||||
#define CONFIG_LIBERTAS_USB 1
|
||||
#endif /* CONFIG_LIBERTAS_USB */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#ifndef CONFIG_ORINOCO_USB
|
||||
#define CONFIG_ORINOCO_USB 1
|
||||
#endif /* CONFIG_ORINOCO_USB */
|
||||
#ifndef CONFIG_BT_HCIBTUSB
|
||||
#define CONFIG_BT_HCIBTUSB 1
|
||||
#endif /* CONFIG_BT_HCIBTUSB */
|
||||
#ifndef CONFIG_BT_HCIBCM203X
|
||||
#define CONFIG_BT_HCIBCM203X 1
|
||||
#endif /* CONFIG_BT_HCIBCM203X */
|
||||
#ifndef CONFIG_BT_HCIBPA10X
|
||||
#define CONFIG_BT_HCIBPA10X 1
|
||||
#endif /* CONFIG_BT_HCIBPA10X */
|
||||
#ifndef CONFIG_BT_HCIBFUSB
|
||||
#define CONFIG_BT_HCIBFUSB 1
|
||||
#endif /* CONFIG_BT_HCIBFUSB */
|
||||
#ifndef CONFIG_BT_ATH3K
|
||||
#define CONFIG_BT_ATH3K 1
|
||||
#endif /* CONFIG_BT_ATH3K */
|
||||
#ifndef CONFIG_RTL8192CU
|
||||
#define CONFIG_RTL8192CU 1
|
||||
#endif /* CONFIG_RTL8192CU */
|
||||
#endif /* CONFIG_USB */
|
||||
#if defined(CONFIG_SPI_MASTER) || defined(CONFIG_SPI_MASTER_MODULE)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
|
||||
#if defined(CONFIG_CRC7) || defined(CONFIG_CRC7_MODULE)
|
||||
#ifndef CONFIG_WL1251_SPI
|
||||
#define CONFIG_WL1251_SPI 1
|
||||
#endif /* CONFIG_WL1251_SPI */
|
||||
#ifndef CONFIG_WL12XX_SPI
|
||||
#define CONFIG_WL12XX_SPI 1
|
||||
#endif /* CONFIG_WL12XX_SPI */
|
||||
#endif /* CONFIG_CRC7 */
|
||||
#ifndef CONFIG_P54_SPI
|
||||
#define CONFIG_P54_SPI 1
|
||||
#endif /* CONFIG_P54_SPI */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
|
||||
#undef CONFIG_LIBERTAS_SPI
|
||||
#else /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#ifndef CONFIG_LIBERTAS_SPI
|
||||
#define CONFIG_LIBERTAS_SPI 1
|
||||
#endif /* CONFIG_LIBERTAS_SPI */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_25 */
|
||||
#endif /* CONFIG_SPI_MASTER */
|
||||
#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
|
||||
#ifndef CONFIG_SSB_SDIOHOST
|
||||
#define CONFIG_SSB_SDIOHOST 1
|
||||
#endif /* CONFIG_SSB_SDIOHOST */
|
||||
#ifndef CONFIG_B43_SDIO
|
||||
#define CONFIG_B43_SDIO 1
|
||||
#endif /* CONFIG_B43_SDIO */
|
||||
#if defined(CONFIG_CRC7) || defined(CONFIG_CRC7_MODULE)
|
||||
#if defined(CONFIG_WL12XX_PLATFORM_DATA) || defined(CONFIG_WL12XX_PLATFORM_DATA_MODULE)
|
||||
#ifndef CONFIG_COMPAT_WL1251_SDIO
|
||||
#define CONFIG_COMPAT_WL1251_SDIO 1
|
||||
#endif /* CONFIG_COMPAT_WL1251_SDIO */
|
||||
#endif /* CONFIG_WL12XX_PLATFORM_DATA */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
|
||||
#if defined(CONFIG_WL12XX_PLATFORM_DATA) || defined(CONFIG_WL12XX_PLATFORM_DATA_MODULE)
|
||||
#ifndef CONFIG_COMPAT_WL12XX_SDIO
|
||||
#define CONFIG_COMPAT_WL12XX_SDIO 1
|
||||
#endif /* CONFIG_COMPAT_WL12XX_SDIO */
|
||||
#endif /* CONFIG_WL12XX_PLATFORM_DATA */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_32 */
|
||||
#endif /* CONFIG_CRC7 */
|
||||
#ifndef CONFIG_MWIFIEX_SDIO
|
||||
#define CONFIG_MWIFIEX_SDIO 1
|
||||
#endif /* CONFIG_MWIFIEX_SDIO */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
|
||||
#ifndef CONFIG_COMPAT_LIBERTAS_SDIO
|
||||
#define CONFIG_COMPAT_LIBERTAS_SDIO 1
|
||||
#endif /* CONFIG_COMPAT_LIBERTAS_SDIO */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_32 */
|
||||
#ifndef CONFIG_IWM
|
||||
#define CONFIG_IWM 1
|
||||
#endif /* CONFIG_IWM */
|
||||
#ifndef CONFIG_BT_HCIBTSDIO
|
||||
#define CONFIG_BT_HCIBTSDIO 1
|
||||
#endif /* CONFIG_BT_HCIBTSDIO */
|
||||
#ifndef CONFIG_BT_MRVL_SDIO
|
||||
#define CONFIG_BT_MRVL_SDIO 1
|
||||
#endif /* CONFIG_BT_MRVL_SDIO */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
#ifndef CONFIG_ATH6KL
|
||||
#define CONFIG_ATH6KL 1
|
||||
#endif /* CONFIG_ATH6KL */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
|
||||
#ifndef CONFIG_BRCMFMAC
|
||||
#define CONFIG_BRCMFMAC 1
|
||||
#endif /* CONFIG_BRCMFMAC */
|
||||
#ifndef CONFIG_BRCMFMAC_SDIO
|
||||
#define CONFIG_BRCMFMAC_SDIO 1
|
||||
#endif /* CONFIG_BRCMFMAC_SDIO */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */
|
||||
#endif /* CONFIG_MMC */
|
||||
#ifndef CONFIG_RTLWIFI
|
||||
#define CONFIG_RTLWIFI 1
|
||||
#endif /* CONFIG_RTLWIFI */
|
||||
#ifndef CONFIG_RTL8192C_COMMON
|
||||
#define CONFIG_RTL8192C_COMMON 1
|
||||
#endif /* CONFIG_RTL8192C_COMMON */
|
||||
#ifndef CONFIG_RT2X00
|
||||
#define CONFIG_RT2X00 1
|
||||
#endif /* CONFIG_RT2X00 */
|
||||
#ifndef CONFIG_RT2X00_LIB
|
||||
#define CONFIG_RT2X00_LIB 1
|
||||
#endif /* CONFIG_RT2X00_LIB */
|
||||
#ifndef CONFIG_RT2800_LIB
|
||||
#define CONFIG_RT2800_LIB 1
|
||||
#endif /* CONFIG_RT2800_LIB */
|
||||
#ifndef CONFIG_RT2X00_LIB_FIRMWARE
|
||||
#define CONFIG_RT2X00_LIB_FIRMWARE 1
|
||||
#endif /* CONFIG_RT2X00_LIB_FIRMWARE */
|
||||
#ifndef CONFIG_RT2X00_LIB_CRYPTO
|
||||
#define CONFIG_RT2X00_LIB_CRYPTO 1
|
||||
#endif /* CONFIG_RT2X00_LIB_CRYPTO */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
|
||||
#undef CONFIG_RT2X00_LIB_LEDS
|
||||
#else /* CONFIG_COMPAT_KERNEL_2_6_25 */
|
||||
#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
|
||||
#ifndef CONFIG_RT2X00_LIB_LEDS
|
||||
#define CONFIG_RT2X00_LIB_LEDS 1
|
||||
#endif /* CONFIG_RT2X00_LIB_LEDS */
|
||||
#endif /* CONFIG_LEDS_CLASS */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_25 */
|
||||
#ifndef CONFIG_P54_COMMON
|
||||
#define CONFIG_P54_COMMON 1
|
||||
#endif /* CONFIG_P54_COMMON */
|
||||
#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE)
|
||||
#ifndef CONFIG_P54_LEDS
|
||||
#define CONFIG_P54_LEDS 1
|
||||
#endif /* CONFIG_P54_LEDS */
|
||||
#endif /* CONFIG_MAC80211_LEDS */
|
||||
#ifndef CONFIG_ATH_COMMON
|
||||
#define CONFIG_ATH_COMMON 1
|
||||
#endif /* CONFIG_ATH_COMMON */
|
||||
#ifndef CONFIG_BRCMUTIL
|
||||
#define CONFIG_BRCMUTIL 1
|
||||
#endif /* CONFIG_BRCMUTIL */
|
||||
#if defined(CONFIG_CRC7) || defined(CONFIG_CRC7_MODULE)
|
||||
#ifndef CONFIG_WL1251
|
||||
#define CONFIG_WL1251 1
|
||||
#endif /* CONFIG_WL1251 */
|
||||
#ifndef CONFIG_WL12XX
|
||||
#define CONFIG_WL12XX 1
|
||||
#endif /* CONFIG_WL12XX */
|
||||
#endif /* CONFIG_CRC7 */
|
||||
#ifndef CONFIG_MWIFIEX
|
||||
#define CONFIG_MWIFIEX 1
|
||||
#endif /* CONFIG_MWIFIEX */
|
||||
#if !defined(CONFIG_CORDIC) && !defined(CONFIG_CORDIC_MODULE)
|
||||
#ifndef CONFIG_COMPAT_CORDIC
|
||||
#define CONFIG_COMPAT_CORDIC 1
|
||||
#endif /* CONFIG_COMPAT_CORDIC */
|
||||
#endif /* CONFIG_CORDIC */
|
||||
#if !defined(CONFIG_CRC8) && !defined(CONFIG_CRC8_MODULE)
|
||||
#ifndef CONFIG_COMPAT_CRC8
|
||||
#define CONFIG_COMPAT_CRC8 1
|
||||
#endif /* CONFIG_COMPAT_CRC8 */
|
||||
#endif /* CONFIG_CRC8 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
|
||||
#undef CONFIG_LIBERTAS
|
||||
#else /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#ifndef CONFIG_LIBERTAS_THINFIRM
|
||||
#define CONFIG_LIBERTAS_THINFIRM 1
|
||||
#endif /* CONFIG_LIBERTAS_THINFIRM */
|
||||
#ifndef CONFIG_LIBERTAS
|
||||
#define CONFIG_LIBERTAS 1
|
||||
#endif /* CONFIG_LIBERTAS */
|
||||
#ifndef CONFIG_LIBERTAS_MESH
|
||||
#define CONFIG_LIBERTAS_MESH 1
|
||||
#endif /* CONFIG_LIBERTAS_MESH */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
|
||||
#ifndef CONFIG_RFKILL_BACKPORT
|
||||
#define CONFIG_RFKILL_BACKPORT 1
|
||||
#endif /* CONFIG_RFKILL_BACKPORT */
|
||||
#if defined(CONFIG_LEDS_TRIGGERS) || defined(CONFIG_LEDS_TRIGGERS_MODULE)
|
||||
#ifndef CONFIG_RFKILL_BACKPORT_LEDS
|
||||
#define CONFIG_RFKILL_BACKPORT_LEDS 1
|
||||
#endif /* CONFIG_RFKILL_BACKPORT_LEDS */
|
||||
#endif /* CONFIG_LEDS_TRIGGERS */
|
||||
#ifndef CONFIG_RFKILL_BACKPORT_INPUT
|
||||
#define CONFIG_RFKILL_BACKPORT_INPUT 1
|
||||
#endif /* CONFIG_RFKILL_BACKPORT_INPUT */
|
||||
#endif /* CONFIG_COMPAT_KERNEL_2_6_31 */
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
#ifdef CONFIG_NETDEVICES_MULTIQUEUE
|
||||
#ifndef CONFIG_MAC80211_QOS
|
||||
#define CONFIG_MAC80211_QOS 1
|
||||
#endif /* CONFIG_MAC80211_QOS */
|
||||
#endif
|
||||
#endif
|
||||
#endif /* COMPAT_AUTOCONF_INCLUDED */
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Broadcom Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __CORDIC_H_
|
||||
#define __CORDIC_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/**
|
||||
* struct cordic_iq - i/q coordinate.
|
||||
*
|
||||
* @i: real part of coordinate (in phase).
|
||||
* @q: imaginary part of coordinate (quadrature).
|
||||
*/
|
||||
struct cordic_iq {
|
||||
s32 i;
|
||||
s32 q;
|
||||
};
|
||||
|
||||
/**
|
||||
* cordic_calc_iq() - calculates the i/q coordinate for given angle.
|
||||
*
|
||||
* @theta: angle in degrees for which i/q coordinate is to be calculated.
|
||||
* @coord: function output parameter holding the i/q coordinate.
|
||||
*
|
||||
* The function calculates the i/q coordinate for a given angle using
|
||||
* cordic algorithm. The coordinate consists of a real (i) and an
|
||||
* imaginary (q) part. The real part is essentially the cosine of the
|
||||
* angle and the imaginary part is the sine of the angle. The returned
|
||||
* values are scaled by 2^16 for precision. The range for theta is
|
||||
* for -180 degrees to +180 degrees. Passed values outside this range are
|
||||
* converted before doing the actual calculation.
|
||||
*/
|
||||
struct cordic_iq cordic_calc_iq(s32 theta);
|
||||
|
||||
#endif /* __CORDIC_H_ */
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Broadcom Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __CRC8_H_
|
||||
#define __CRC8_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* see usage of this value in crc8() description */
|
||||
#define CRC8_INIT_VALUE 0xFF
|
||||
|
||||
/*
|
||||
* Return value of crc8() indicating valid message+crc. This is true
|
||||
* if a CRC is inverted before transmission. The CRC computed over the
|
||||
* whole received bitstream is _table[x], where x is the bit pattern
|
||||
* of the modification (almost always 0xff).
|
||||
*/
|
||||
#define CRC8_GOOD_VALUE(_table) (_table[0xFF])
|
||||
|
||||
/* required table size for crc8 algorithm */
|
||||
#define CRC8_TABLE_SIZE 256
|
||||
|
||||
/* helper macro assuring right table size is used */
|
||||
#define DECLARE_CRC8_TABLE(_table) \
|
||||
static u8 _table[CRC8_TABLE_SIZE]
|
||||
|
||||
/**
|
||||
* crc8_populate_lsb - fill crc table for given polynomial in regular bit order.
|
||||
*
|
||||
* @table: table to be filled.
|
||||
* @polynomial: polynomial for which table is to be filled.
|
||||
*
|
||||
* This function fills the provided table according the polynomial provided for
|
||||
* regular bit order (lsb first). Polynomials in CRC algorithms are typically
|
||||
* represented as shown below.
|
||||
*
|
||||
* poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1
|
||||
*
|
||||
* For lsb first direction x^7 maps to the lsb. So the polynomial is as below.
|
||||
*
|
||||
* - lsb first: poly = 10101011(1) = 0xAB
|
||||
*/
|
||||
void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial);
|
||||
|
||||
/**
|
||||
* crc8_populate_msb - fill crc table for given polynomial in reverse bit order.
|
||||
*
|
||||
* @table: table to be filled.
|
||||
* @polynomial: polynomial for which table is to be filled.
|
||||
*
|
||||
* This function fills the provided table according the polynomial provided for
|
||||
* reverse bit order (msb first). Polynomials in CRC algorithms are typically
|
||||
* represented as shown below.
|
||||
*
|
||||
* poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1
|
||||
*
|
||||
* For msb first direction x^7 maps to the msb. So the polynomial is as below.
|
||||
*
|
||||
* - msb first: poly = (1)11010101 = 0xD5
|
||||
*/
|
||||
void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial);
|
||||
|
||||
/**
|
||||
* crc8() - calculate a crc8 over the given input data.
|
||||
*
|
||||
* @table: crc table used for calculation.
|
||||
* @pdata: pointer to data buffer.
|
||||
* @nbytes: number of bytes in data buffer.
|
||||
* @crc: previous returned crc8 value.
|
||||
*
|
||||
* The CRC8 is calculated using the polynomial given in crc8_populate_msb()
|
||||
* or crc8_populate_lsb().
|
||||
*
|
||||
* The caller provides the initial value (either %CRC8_INIT_VALUE
|
||||
* or the previous returned value) to allow for processing of
|
||||
* discontiguous blocks of data. When generating the CRC the
|
||||
* caller is responsible for complementing the final return value
|
||||
* and inserting it into the byte stream. When validating a byte
|
||||
* stream (including CRC8), a final return value of %CRC8_GOOD_VALUE
|
||||
* indicates the byte stream data can be considered valid.
|
||||
*
|
||||
* Reference:
|
||||
* "A Painless Guide to CRC Error Detection Algorithms", ver 3, Aug 1993
|
||||
* Williams, Ross N., ross<at>ross.net
|
||||
* (see URL http://www.ross.net/crc/download/crc_v3.txt).
|
||||
*/
|
||||
u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc);
|
||||
|
||||
#endif /* __CRC8_H_ */
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2004 - 2006 rt2x00 SourceForge Project
|
||||
<http://rt2x00.serialmonkey.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the
|
||||
Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
Module: eeprom_93cx6
|
||||
Abstract: EEPROM reader datastructures for 93cx6 chipsets.
|
||||
Supported chipsets: 93c46, 93c56 and 93c66.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EEPROM operation defines.
|
||||
*/
|
||||
#define PCI_EEPROM_WIDTH_93C46 6
|
||||
#define PCI_EEPROM_WIDTH_93C56 8
|
||||
#define PCI_EEPROM_WIDTH_93C66 8
|
||||
#define PCI_EEPROM_WIDTH_93C86 8
|
||||
#define PCI_EEPROM_WIDTH_OPCODE 3
|
||||
#define PCI_EEPROM_WRITE_OPCODE 0x05
|
||||
#define PCI_EEPROM_ERASE_OPCODE 0x07
|
||||
#define PCI_EEPROM_READ_OPCODE 0x06
|
||||
#define PCI_EEPROM_EWDS_OPCODE 0x10
|
||||
#define PCI_EEPROM_EWEN_OPCODE 0x13
|
||||
|
||||
/**
|
||||
* struct eeprom_93cx6 - control structure for setting the commands
|
||||
* for reading the eeprom data.
|
||||
* @data: private pointer for the driver.
|
||||
* @register_read(struct eeprom_93cx6 *eeprom): handler to
|
||||
* read the eeprom register, this function should set all reg_* fields.
|
||||
* @register_write(struct eeprom_93cx6 *eeprom): handler to
|
||||
* write to the eeprom register by using all reg_* fields.
|
||||
* @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
|
||||
* @drive_data: Set if we're driving the data line.
|
||||
* @reg_data_in: register field to indicate data input
|
||||
* @reg_data_out: register field to indicate data output
|
||||
* @reg_data_clock: register field to set the data clock
|
||||
* @reg_chip_select: register field to set the chip select
|
||||
*
|
||||
* This structure is used for the communication between the driver
|
||||
* and the eeprom_93cx6 handlers for reading the eeprom.
|
||||
*/
|
||||
struct eeprom_93cx6 {
|
||||
void *data;
|
||||
|
||||
void (*register_read)(struct eeprom_93cx6 *eeprom);
|
||||
void (*register_write)(struct eeprom_93cx6 *eeprom);
|
||||
|
||||
int width;
|
||||
|
||||
char drive_data;
|
||||
char reg_data_in;
|
||||
char reg_data_out;
|
||||
char reg_data_clock;
|
||||
char reg_chip_select;
|
||||
};
|
||||
|
||||
extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
|
||||
const u8 word, u16 *data);
|
||||
extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
|
||||
const u8 word, __le16 *data, const u16 words);
|
||||
|
||||
extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
|
||||
|
||||
extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom,
|
||||
u8 addr, u16 data);
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef _COMPAT_LINUX_EXPORT_H
|
||||
#define _COMPAT_LINUX_EXPORT_H 1
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
|
||||
#include_next <linux/export.h>
|
||||
#else
|
||||
#include <linux/module.h>
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
|
||||
|
||||
#endif /* _COMPAT_LINUX_EXPORT_H */
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user