History log of /freebsd-current/sys/isa/isa_common.c
Revision Date Author Comments
# 9dbf5b0e 13-Mar-2024 John Baldwin <jhb@FreeBSD.org>

new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCE

The public bus_release_resource() API still accepts both forms, but
the internal kobj method no longer passes the arguments.
Implementations which need the rid or type now use rman_get_rid() or
rman_get_type() to fetch the value from the allocated resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44131


# 98a670cd 28-Oct-2023 Zhenlei Huang <zlei@FreeBSD.org>

isa: Postpone removal of the non-PNP driver until 15

Reviewed by: imp
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D42387


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# c2cbd7ff 31-Jul-2023 Doug Moore <dougm@FreeBSD.org>

isa_common: find next bit faster

Since ffs is no longer implemented with a linear search, find_next_bit
can work in constant time, with masking.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41251


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 09fd3b43 19-Apr-2022 John Baldwin <jhb@FreeBSD.org>

Remove isa_devclass from ISA bus drivers.


# 43ac2b6d 19-Apr-2022 John Baldwin <jhb@FreeBSD.org>

Remove isab_devclass from ISA bridge drivers.


# ddfc9c4c 22-Jun-2021 Warner Losh <imp@FreeBSD.org>

newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf

Now that the upper layers all go through a layer to tie into these
information functions that translates an sbuf into char * and len. The
current interface suffers issues of what to do in cases of truncation,
etc. Instead, migrate all these functions to using struct sbuf and these
issues go away. The caller is also in charge of any memory allocation
and/or expansion that's needed during this process.

Create a bus_generic_child_{pnpinfo,location} and make it default. It
just returns success. This is for those busses that have no information
for these items. Migrate the now-empty routines to using this as
appropriate.

Document these new interfaces with man pages, and oversight from before.

Reviewed by: jhb, bcr
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29937


# 6ffdaa5f 08-Mar-2021 Warner Losh <imp@FreeBSD.org>

Move back the isa non-PNP driver deadline to FreeBSD 14.


# 9e1472ca 30-Dec-2017 Warner Losh <imp@FreeBSD.org>

On further testing on actual machines with this hardware, we should
only warn for devices that are attached. Add missing \n.


# 7dcb3b12 23-Dec-2017 Warner Losh <imp@FreeBSD.org>

Warn when nonPNP ISA devices are attached in GENERIC that they are
being removed from GENERIC in 12. Always print PNP info for ISA when
it exists: it doesn't depend on ISAPNP. Add PNP ID to orm and vga to
prevent us from warning about them since those devices aren't being
removed from GENERIC. PNP devices will be removed from GENERIC too,
but they will be automatically loaded, so need no warning. We don't
warn for non-GENERIC kernels because people running them are presumed
to know what they are doing.

MFC After: 2 weeks


# fe267a55 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# f8fd3fb5 22-Mar-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Fix the resource_list_print_type() calls to use uintmax_t.

Missed a bunch from r297000.


# 534ccd7b 02-Mar-2016 Justin Hibbits <jhibbits@FreeBSD.org>

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


# 43cd6160 18-Feb-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Replace several bus_alloc_resource() calls using default arguments with bus_alloc_resource_any()

Since these calls only use default arguments, bus_alloc_resource_any() is the
right call.

Differential Revision: https://reviews.freebsd.org/D5306


# 2dd1bdf1 26-Jan-2016 Justin Hibbits <jhibbits@FreeBSD.org>

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


# f9a94737 06-May-2011 John Baldwin <jhb@FreeBSD.org>

Retire isa_setup_intr() and isa_teardown_intr() and use the generic bus
versions instead. They were never needed as bus_generic_intr() and
bus_teardown_intr() had been changed to pass the original child device up
in 42734, but the ISA bus was not converted to new-bus until 45720.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 3d844edd 10-Sep-2010 Andriy Gapon <avg@FreeBSD.org>

bus_add_child: change type of order parameter to u_int

This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to: r212213
MFC after: 10 days


# 0d484d24 18-Nov-2008 John Baldwin <jhb@FreeBSD.org>

Allow device hints to wire the unit numbers of devices.
- An "at" hint now reserves a device name.
- A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When
determining the unit number of a device, this method is invoked to
let the bus driver specify the unit of a device given a specific
devclass. This is the only way a device can be given a name reserved
via an "at" hint.
- Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers.
Both of these busses implement this by comparing the resources for a
given hint device with the resources enumerated by ACPI/PnPBIOS and
wire a unit if the hint resources are a subset of the "real" resources.
- Use bus_hinted_children() for adding hinted devices on isa(4) busses
now instead of doing it by hand.
- Remove the unit kludging from sio(4) as it is no longer necessary.

Prodding from: peter, imp
OK'd by: marcel
MFC after: 1 month


# 132580b5 02-Nov-2008 Warner Losh <imp@FreeBSD.org>

MFp4:

Make the ISA bus keep track of more PNP details. Plus a minor style
fix while I'm here. More could be done here, but except for some SBCs
that don't have ACPI, there's limited value to anybody in doing so.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5b4ae400 24-Aug-2008 Warner Losh <imp@FreeBSD.org>

MFp4 (my newcard tree):

ISACFGATTR_MULTI is unused. Retire it, and a function that has no
side effects used to compute it.


# 90dea4f9 17-Apr-2007 John Baldwin <jhb@FreeBSD.org>

When trying to allocate a PnP BIOS memory resource, the code loops trying
to move up the start address until the allocation succeeds. If the
alignment of the resource was 0, then the code would keep trying the same
request in an infinite loop and hang. Force the request to always move
start up by at least 1 byte each time through the loop.


# acb8c149 12-Jun-2006 Marius Strobl <marius@FreeBSD.org>

Make the ISAPNP code optional and only enable it on i386 and pc98 (used
for CBUS-PNP cards there) by default, as there are no amd64 and sparc64
machines with ISA slots and which therefore could make use of this code
known to exist. For sparc64 this additionally allows to get rid of the
compat shims for in{b,w,l}()/out{b,w,l}() etc and the associated hacks.

OK'ed by: imp, peter


# 73dbd3da 11-May-2006 John Baldwin <jhb@FreeBSD.org>

Remove various bits of conditional Alpha code and fixup a few comments.


# a81804d9 01-Aug-2005 Warner Losh <imp@FreeBSD.org>

Add pnp and location info for the ISA bus. The pnp info is the
primary vendor id for this device. The location is empty because ISA
doesn't give one a way to generally locate a card. PNP BIOS entries
do provide a way to locate cards, as do isa pnp cards. These
locations will be added as soon as the code to remember them is
written.


# 36fed965 17-Mar-2005 Warner Losh <imp@FreeBSD.org>

Use STAILQ in preference to SLIST for the resources. Insert new resources
last in the list rather than first.

This makes the resouces print in the 4.x order rather than the 5.x order
(eg fdc0 at 0x3f0-0x3f5,0x3f7 is 4.x, but 0x3f7,0x3f0-0x3f5 is 5.x). This
also means that the pci code will once again print the resources in BAR
ascending order.


# 784d07b4 22-Jan-2005 Warner Losh <imp@FreeBSD.org>

Protect against wrapping. This appaers to fix some hangs that people
have seen in the isa pnp case where a resource buts up against
0xffffffff. This would only impact when the board was booted without
ACPI.

Submitted by: Ed Maste (freebsd-stable <20050103145720.GA90754@sandvine.com>)
MFC After: 5 days


# 9b01161e 27-Dec-2004 Warner Losh <imp@FreeBSD.org>

Formatting nits


# 812fb8f2 24-Dec-2004 Warner Losh <imp@FreeBSD.org>

Get rid of #ifdef for legacy system. Move that into the MD code.
Export minimal symbols to allow this to happen.


# 09aafea1 24-Dec-2004 Warner Losh <imp@FreeBSD.org>

A few style(9) changes before more extensive changes:
o u_intXX_t -> uintXX_t
o use 8 character tabs
o proper wrapping
o return (value);


# 5f96beb9 17-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# c37faf26 08-Jul-2003 John Baldwin <jhb@FreeBSD.org>

- Make the isab devclass global to allow for multiple ISA bridge drivers.
- Factor out code common to all ISA bridge drivers attach methods into a
isab_attach() function.
- Rename the PCI-ISA bridge driver's attach function to pci_isab_attach()
and have it call isab_attach().


# 8c9bbf48 10-Jun-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().


# 0eb8d2e8 30-Apr-2003 Peter Wemm <peter@FreeBSD.org>

Create a 'legacy' node for AMD64 as well as i386. While we'll never
have to use it since all AMD64 machines are supposed to have acpi etc,
I'm using it during development so I can avoid the acpi code for now.
Yes, this is cheating.


# f7130d09 14-Apr-2003 Matthew N. Dodd <mdodd@FreeBSD.org>

Add a module version number.


# 63e30378 14-Oct-2002 John Baldwin <jhb@FreeBSD.org>

- Use __BUS_ACCESSOR() to define the ISA ivar accessor functions instead of
homerolling our own version.
- Rename the enum for memsize from ISA_IVAR_MSIZE to ISA_IVAR_MEMSIZE
since using 'MSIZE' in the macro invocation of ISA_ACCESSOR() conflicts
with the 'MSIZE' kernel option. The accessor function is still
isa_get_msize().


# f46708e0 30-Sep-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Don't leak memory in case device_add_child_ordered() returns NULL.

Found by: FlexeLint


# c1e309b3 26-Sep-2002 John Baldwin <jhb@FreeBSD.org>

Argh, isa(4), eisa(4) and mca(4) now attach to legacy(4) instead of
nexus(4) in the case of machines w/o equivalent bridges on a PCI bus.

Reported by: winter
Pointy hat to: jhb


# 0077e822 24-Feb-2002 Alfred Perlstein <alfred@FreeBSD.org>

Fix style bugs:
Missing `const' qualifier.
Initialization in declaration.

Submitted by: mike


# b2e4739f 24-Feb-2002 Alfred Perlstein <alfred@FreeBSD.org>

Give a little more information as to why pnp configuration of a device
may have failed.

Submitted by: Terry Lambert <tlambert2@mindspring.com>


# 01f1aed2 21-Dec-2001 Thomas Moestl <tmm@FreeBSD.org>

Use the new resource_list_print_type() function.
Pass the bus device to isa_init() (this is needed for the sparc64
version).


# c3959391 04-Sep-2001 Kazutaka YOKOTA <yokota@FreeBSD.org>

Rework the ISA PnP driver pnp and the PnP resource parser to fix
the following bugs.

- When constructing a resource configuration, respect the order
in which resource descriptors are read, in order to establish
the correct mapping between the descriptors and configuration
registers.
"Plug and Play ISA Specification, Version 1.0a", Sec 4.6.1, May 5,
1994. "Clarifications to the Plug and Play ISA Specification,
Version 1.0a", Sec 6.2.1, Dec. 10, 1994.

- Do not ignore null (empty) descriptors; they are valid descriptors
acting as filler.
"Clarifications to the Plug and Play ISA Specification, Version 1.0a",
Sec 6.2.1.

- Correctly set up logical device configuration registers for null
resources.
"Clarifications to the Plug and Play ISA Specification, Version 1.0a"

- Handle null resources properly in the resource allocator for the
ISA bus.


# 7abb4662 03-Sep-2001 Kazutaka YOKOTA <yokota@FreeBSD.org>

Add a new field, id_config_attr to the struct isa_device.
It will be later used to store some flags to control PnP device
configurations.


# 2e5bbc3f 30-Aug-2001 Mike Smith <msmith@FreeBSD.org>

Safety-check against empty PnP ID lists.


# 3b82ede0 10-Aug-2001 Julian Elischer <julian@FreeBSD.org>

DO NOT ALLOCATE 2+K OBJECTS ON THE KERNEL STACK!!!!
found by: Getting my u-area overwritten


# 5aea03b0 12-Dec-2000 Mike Smith <msmith@FreeBSD.org>

It's possible for an ISA bus to be hung off an EISA bridge, so we need to
reflect that here.


# 7cc0979f 08-Dec-2000 David Malone <dwmalone@FreeBSD.org>

Convert more malloc+bzero to malloc+M_ZERO.

Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>


# 959b7375 08-Dec-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Staticize some malloc M_ instances.


# 1581afb3 28-Nov-2000 Matthew N. Dodd <mdodd@FreeBSD.org>

Reduce code duplication by using the GET_RESOURCE_LIST bus method and related
generic resource_list management functions.

I'll deal with the EISA bits later.

Not objected to by: new-bus


# 2b2b44c9 11-Jul-2000 John Baldwin <jhb@FreeBSD.org>

Don't assume that any ISA device that fails to probe is a PnP device,
instead, use the bus_print_child_* functions to display the error message.
Also, since this is more of a warning than an error, hide it behind
bootverbose.

Similarly, if isa_assign_resources() fails to allocate resources to a
device, use bus_print_child_header() instead of device_printf(), and
display the resources that could not be allocated if bootverbose is true.

Approved by: msmith
Help from: mdodd


# 328d36e9 25-Jun-2000 Doug Rabson <dfr@FreeBSD.org>

Replace the unknown driver with a nomatch method in the isa driver.
This allows ISA PnP drivers to be dynamically loaded after the kernel
has booted.


# 208cc52f 10-Feb-2000 Mike Smith <msmith@FreeBSD.org>

When allocating resources in the following cases:

- trying for a fit for a PnP configuration from a device
- soaking up resources from a configuration that were not allocated by
the driver

do not attempt to activate them. Only a device driver that is aware of
the nature of the resource and its suitability can be certain that
activating a resource, particularly a memory resource, is a safe thing
to do.

This was prompted by the discovery that many systems report all physical
memory through a PNP0c02 device; activating this resource maps all
physical memory into the kernel's virtual space, either blowing out the
kernel pagetable or in the worst case causing a panic in pmap_mapdev()
if the system has too much physical memory.

Authorised by: jkh
Reviewed by: dfr


# 01fef730 17-Jan-2000 Mike Smith <msmith@FreeBSD.org>

Don't mark unallocated resources as active; the goal is to reserve them,
and there may be a good reason for them being unallocated (eg. they're
nonsensical or not useful). The goal here is simply to reserve them
against accidental use by other code.


# fe0d4089 03-Dec-1999 Matthew N. Dodd <mdodd@FreeBSD.org>

Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered(). 'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t. Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything. I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by: peter, dfr


# 5ab05143 20-Nov-1999 Peter Wemm <peter@FreeBSD.org>

Allow NULL for startp and/or countp in bus_get_resource() so that you can
get one of the two without having to use a dummy variable.


# ec22663b 11-Nov-1999 Doug Rabson <dfr@FreeBSD.org>

Reorganise the code so that I can add custom identify drivers dynamically
during autoconfig to support strange hardware (such as the Yamaha DS-1)
which implements 'legacy' ISA devices as well as a PCI device. This will
allow the PCI driver for the YMF724 to add the legacy devices to the ISA
bus and will allow the PnP system to automatically allocate the resources
for those devices.


# 25afb89b 12-Oct-1999 Doug Rabson <dfr@FreeBSD.org>

* Add struct resource_list* argument to resource_list_alloc and
resource_list_release. This removes the dependancy on the
layout of ivars.

* Move set_resource, get_resource and delete_resource from
isa_if.m to bus_if.m.

* Simplify driver code by providing wrappers to those methods:

bus_set_resource(dev, type, rid, start, count);
bus_get_resource(dev, type, rid, startp, countp);
bus_get_resource_start(dev, type, rid);
bus_get_resource_count(dev, type, rid);
bus_delete_resource(dev, type, rid);

* Delete isa_get_rsrc and use bus_get_resource_start instead.

* Fix a stupid typo in isa_alloc_resource reported by Takahashi
Yoshihiro <nyan@FreeBSD.org>.

* Print a diagnostic message if we can't assign resources to a PnP
device.

* Change device_print_prettyname() so that it doesn't print
"(no driver assigned)-1" for anonymous devices.


# a2e6dbb3 02-Oct-1999 Doug Rabson <dfr@FreeBSD.org>

Disable pnp devices before running heuristic probes. This allows us to
'hide' those devices from those probes so that they don't get probed and
then re-probed later when the pnp probe is run.


# 062acdb7 07-Sep-1999 Doug Rabson <dfr@FreeBSD.org>

Change isa_get/set_flags() to device_get/set_flags().


# 2aadbbb6 04-Sep-1999 Doug Rabson <dfr@FreeBSD.org>

Only set the description if there is one in the matching isa_pnp_id.


# 4249382d 01-Sep-1999 Doug Rabson <dfr@FreeBSD.org>

This represents essentially a complete rewrite of the ISA PnP code. The
new system is integrated with the ISA bus code more cleanly and allows
the future addition of more enumerators such as PnPBIOS and ACPI.

This commit also enables the new pcm driver since it is somewhat tied to
the new PnP code.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# f4e3b1e7 28-Jul-1999 Matthew N. Dodd <mdodd@FreeBSD.org>

Fix a typo.
Back out a few lines that I haven't dealt with properly yet.

Snickered at by: Mike Smith


# 15317dd8 28-Jul-1999 Matthew N. Dodd <mdodd@FreeBSD.org>

Alter the behavior of sys/kern/subr_bus.c:device_print_child()

- device_print_child() either lets the BUS_PRINT_CHILD
method produce the entire device announcement message or
it prints "foo0: not found\n"

Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on
the previous behavior of device_print_child() (printing the
"foo0: <FooDevice 1.1>" bit of the announce message.)

Provide bus_print_child_header() and bus_print_child_footer()
to actually print the output for bus_generic_print_child().
These functions should be used whenever possible (unless you can
just use bus_generic_print_child())

The BUS_PRINT_CHILD method now returns int instead of void.

Modify everything else that defines or uses a BUS_PRINT_CHILD
method to comply with the above changes.

- Devices are 'on' a bus, not 'at' it.
- If a custom BUS_PRINT_CHILD method does the same thing
as bus_generic_print_child(), use bus_generic_print_child()
- Use device_get_nameunit() instead of both
device_get_name() and device_get_unit()
- All BUS_PRINT_CHILD methods return the number of
characters output.

Reviewed by: dfr, peter


# cfa84f46 30-May-1999 Doug Rabson <dfr@FreeBSD.org>

* Add ivars for ISA pnp.
* Move isa_dma* declarations to isavar.h.
* Add a method ISA_DELETE_RESOURCE() to the ISA interface.
* Tidy up include protection defines.


# bea6af4d 28-May-1999 Doug Rabson <dfr@FreeBSD.org>

* Change device_add_child_after() to device_add_child_ordered() which is
easier to use and more flexible.
* Change BUS_ADD_CHILD to take an order argument instead of a place.
* Define a partial ordering for isa devices so that sensitive devices are
probed before non-sensitive ones.


# a3be63b3 22-May-1999 Doug Rabson <dfr@FreeBSD.org>

* Factor out the common code between the isa bus drivers for i386 and alpha.
* Re-work the resource allocation code to use helper functions in subr_bus.c.
* Add simple isa interface for manipulating the resource ranges which can be
allocated and remove the code from isa_write_ivar() which was previously
used for this purpose.