Commit Graph

462 Commits

Author SHA1 Message Date
Pedro F. Giffuni
8dfea46460 Remove slightly used const values that can be replaced with nitems().
Suggested by:	jhb
2016-04-21 15:38:28 +00:00
Warner Losh
cb49b65481 Move pccard_safe_quote() up to subr_bus.c and rename to
devctl_safe_quote() so it can be used more generally.
2016-03-28 20:16:29 +00:00
Justin Hibbits
da1b038af9 Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.
On some architectures, u_long isn't large enough for resource definitions.
Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but
type `long' is only 32-bit.  This extends rman's resources to uintmax_t.  With
this change, any resource can feasibly be placed anywhere in physical memory
(within the constraints of the driver).

Why uintmax_t and not something machine dependent, or uint64_t?  Though it's
possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on
32-bit architectures.  64-bit architectures should have plenty of RAM to absorb
the increase on resource sizes if and when this occurs, and the number of
resources on memory-constrained systems should be sufficiently small as to not
pose a drastic overhead.  That being said, uintmax_t was chosen for source
clarity.  If it's specified as uint64_t, all printf()-like calls would either
need casts to uintmax_t, or be littered with PRI*64 macros.  Casts to uintmax_t
aren't horrible, but it would also bake into the API for
resource_list_print_type() either a hidden assumption that entries get cast to
uintmax_t for printing, or these calls would need the PRI*64 macros.  Since
source code is meant to be read more often than written, I chose the clearest
path of simply using uintmax_t.

Tested on a PowerPC p5020-based board, which places all device resources in
0xfxxxxxxxx, and has 8GB RAM.
Regression tested on qemu-system-i386
Regression tested on qemu-system-mips (malta profile)

Tested PAE and devinfo on virtualbox (live CD)

Special thanks to bz for his testing on ARM.

Reviewed By: bz, jhb (previous)
Relnotes:	Yes
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D4544
2016-03-18 01:28:41 +00:00
Justin Hibbits
534ccd7bbf Replace all resource occurrences of '0UL/~0UL' with '0/~0'.
Summary:
The idea behind this is '~0ul' is well-defined, and casting to uintmax_t, on a
32-bit platform, will leave the upper 32 bits as 0.  The maximum range of a
resource is 0xFFF.... (all bits of the full type set).  By dropping the 'ul'
suffix, C type promotion rules apply, and the sign extension of ~0 on 32 bit
platforms gets it to a type-independent 'unsigned max'.

Reviewed By: cem
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5255
2016-03-03 05:07:35 +00:00
Justin Hibbits
c47476d7e6 Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().
Most calls to bus_alloc_resource() use "anywhere" as the range, with a given
count.  Migrate these to use the new bus_alloc_resource_anywhere() API.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D5370
2016-02-27 03:38:01 +00:00
Justin Hibbits
7915adb560 Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.
This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.

This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.

Discussed with:	jhb
Suggested by:	marcel
2016-02-20 01:32:58 +00:00
Justin Hibbits
2dd1bdf183 Convert rman to use rman_res_t instead of u_long
Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources.  For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075
2016-01-27 02:23:54 +00:00
Warner Losh
f6cea53f9d Create a generic PCCARD_PNP_INFO from the MODULE_PNP_INFO building
block. Use it in all the PNP drivers to export either the current PNP
table. For uart, create a custom table and export it using
MODULE_PNP_INFO since it's the only one that matches on function
number.

Differential Review: https://reviews.freebsd.org/D3461
2015-12-11 05:27:56 +00:00
Warner Losh
86fd88736f Remove unused PCMCIA_CARD* macros.
Always include the card human readable name. We support ~270 cards and
at ~20 bytes each, this bloats things by only ~5k. Retain the
PCMCIA_CARD vs PCMCIA_CARD_D distinction, though, in case this is
intolerable.
2014-12-03 00:47:05 +00:00
Warner Losh
2f1c4b0c87 Retire old, transition code for managing the FreeBSD 5 -> 6 migration. 2014-11-22 18:40:14 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
Warner Losh
96eb909a84 Simplify resource activation a bit. 2012-06-28 07:26:44 +00:00
Ed Schouten
75da3c1a9b Replace inline static' by static inline'.
If I interpret the C standard correctly, the storage specifier should be
placed before the inline keyword. While at it, replace __inline by
inline in the files affected.
2011-12-13 14:06:01 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Warner Losh
54e397e566 Make a couple of debug printfs DEVPRINTF. 2011-06-06 16:27:38 +00:00
Rebecca Cran
b1ce21c6ef Fix typos.
PR:	bin/148894
Submitted by:	olgeni
2010-11-09 10:59:09 +00:00
Warner Losh
f29b8b7f41 cardbus -> CardBus 2010-01-03 23:31:58 +00:00
Warner Losh
a5a8a1c8fe Another PC Card that needs the CIS strings for the Surecom EP-427X,
which really is just a rebadged OEM card...  Plus a tiny whitespace
nit.
2009-04-24 17:27:45 +00:00
Warner Losh
9ca9ddabfd A couple of older Melco cards that missed the transition to newcard 2009-04-22 16:50:44 +00:00
Warner Losh
194842b5c3 Add Billionton LNT-10TB variant 2009-04-22 15:56:00 +00:00
Warner Losh
ffef988b76 Add AmbiCom AMB8002, AMB8010 (2 variants) and AMB8610. These were
inferred from data in the linux driver.
2009-04-22 15:11:27 +00:00
Warner Losh
f133918640 Another NE-2000 clone. The GVC NIC-2000P Ethernet adapter. Based on
the MN5017 chipset.  There's no vendor/product pair on this card, so
it needs to be matched by the CIS strings.
2009-04-14 03:13:05 +00:00
Warner Losh
990b9c1594 Another GlobalVillage card. 2009-04-07 05:57:56 +00:00
Warner Losh
5b4fb02615 Sort NECINFORTIA correctly. 2009-03-27 20:40:17 +00:00
Warner Losh
0324af86de Harvest a previously unknown Bromax design based on the AX88x90 from
the Linux axnet driver.
2009-03-27 19:08:15 +00:00
Warner Losh
a47bf9d7df RIOS Systems co was naughty and used a 'random' id. Use it with the
PCCARD3 name to describe the RIOS PC Card III Ethernet that I have.
2009-03-25 22:20:36 +00:00
Warner Losh
a8eaa9a1b4 Another akihabra find: Mitsubishi B8895. 2009-03-25 07:26:24 +00:00
Warner Losh
381bbcb826 Remove old compat method that's no longer needed (and hasn't been
since just before 6.0).
2009-03-11 08:15:17 +00:00
Warner Losh
3ef22bdd2f Allow zero length memroy space descriptor sections. It is apparently
legal in the spec.  Add newline to the verbose messages we print when
debugging when this happens.  The Hitachi HT-4840-11 is the only card
to hit these in years, and it works well enough if we're liberal about
what we accept.
2009-03-11 08:14:44 +00:00
Warner Losh
ccd1b0f54d Add entry for Hitachi HT-4840-11, which is a fe-based card. 2009-03-11 08:11:11 +00:00
Warner Losh
edee63f77b Add 3 new cards that I found today in akihabara...
Toshiba LANCT00A
TDK LAK-CD011
TJ PTJ-LAN/T PC-NIC ENCC 990010759-001A
2009-03-11 07:22:11 +00:00
Warner Losh
96a31ac3e8 Add in parsing of the disk FUNCE tuples. 2009-03-03 18:57:59 +00:00
Warner Losh
1b37372ada Store the entire funce for disk type functions (eg CF cards and the
like).
2009-02-06 07:49:03 +00:00
Wojciech A. Koszek
1e9e2b22b8 Bring consistent debugging output for all values that are supposed
to be printed in a hexadecimal format. Otherwise, '270' doesn't say
much.

Reviewed by:	imp
2009-02-05 23:51:11 +00:00
Warner Losh
102720b585 do_product_lookup should return a const struct pccard_product *. 2009-02-05 19:39:07 +00:00
Warner Losh
73e04c0b84 Fix parameter types for set_res_flags and read_ivars 2009-02-05 19:38:31 +00:00
Warner Losh
609729b7a6 Define bits for memory mapping house keeping by bridges. 2009-01-05 20:58:41 +00:00
Warner Losh
ff54eabd8a Remove opt_wi.h from module and fix typo in pccarddevs. 2008-08-27 05:43:46 +00:00
Warner Losh
dcf77c235d The APDL-325 is a Wireless LAN pcmcia adapter that sits inside some
Billion Access Points.  Fix wi(4) to recognise the adapter.

PR:		77913
Submitted by:	Daan Vreeken [PA4DAN]
MFC after:	3 days
2008-08-27 04:52:27 +00:00
Warner Losh
cfd23b465a Some PC Cards don't have the proper IRQ mask in them. The standard
says that in such cases we can pick any interrupt.  One of these cards
is the LG11 Wireless LAN card.  I don't have one of these, but I do
know that this doesn't hurt any cards I've tried it with.

PR:		92070
Submitted by:	Helge Oldach
MFC after:	3 days
2008-08-27 04:36:27 +00:00
Warner Losh
2e8082cc0c MFp4: necessary quirks to get 3c1 not working (still no interrupts) 2008-08-25 04:59:43 +00:00
Warner Losh
0e66b169d6 Fix a small problem in the comment about departure from NetBSD.
Also, r181392 fixed a small problem with multifunction cards that would
cause the card not to power down when the last driver detached from it.
2008-08-07 21:16:14 +00:00
Warner Losh
431b127e40 Add NEC PC-9802N-J02 (confirmed) and NEC PC-9202N-J02R (speculative)
to the list of devices.
2008-08-07 20:52:54 +00:00
Warner Losh
69e401fe28 Unify the initial card probe/attach procedure with the kldload
procedure.  There were some subtle differences before that could lead
to a variety of bugs, including resources being lost (in one case
forever).  pccard_probe_and_attach_card does this now, and includes
comments about what's going on and why, since it isn't obvious from
the code.  Please let me know if I've missed anything...

Provide a new function called pccard_select_cfe that allows drivers to
select which configuration entry to use.  This is needed for some
older pre-MFC standard cards with many functions that want to activate
all their functions by selecting alternative entries, or to work
around broken ones.  pccard_select_cfe will migrate into the
pccard_if.m interface as its interface stabilizes to keep all the
pccard drivers from referencing any symbols in the pccard.ko module
directly.

Fix a printf to refer to the right function name.
2008-08-06 07:34:35 +00:00
Warner Losh
96edbc847e Add an alternative ID for the Siemens SpeedStream SS1021: 0x3021. 2008-08-02 20:36:25 +00:00
Warner Losh
b98165b03f Merge from NetBSD's pcmciadev file (rev ~1.208 - 1.226) where
appropriate (versions not appropriate to merge omitted):
o 1.226 imp nop, save for NetBSD string (minor merging the other way)
o 1.225 jnemeth Coreage LAPCCTXD
o 1.224 martin (remove 3rd and 4th clauses)
o 1.223 kiyohara (TDK bluetooth PC Card)
o 1.222 kiyohara (Anycom BlueCard)
o 1.221 ichiro (NEC Infrontia AX420N)
o 1.219 jmcneill (EDIMAX EP-4101)
o 1.213 tsutsui (TEAC IDECARDII entry fix)

Also, while I'm here, fix some tab problems that have crept in.
2008-07-06 06:17:39 +00:00
Warner Losh
f791dd06c2 Slight simplification of the power parsing code, as well as using
autoincrement in some places where it makes sense.  This makes this .o
about 180 bytes smaller on x86 and amd64 with no apparent functional
changes.
2008-06-01 20:55:34 +00:00
Rink Springer
603d67ae36 Commit cmx(4), a driver for Omnikey CardMan 4040 PCMCIA smartcard readers.
PR:		kern/114582
Submitted by:	Daniel Roethlisberger <daniel@roe.ch>
Reviewed by:	imp, myself
Tested by:	johans, myself
MFC after:	2 weeks
2008-03-06 08:09:45 +00:00