[BACK]Return to isapnp.9 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man9

File: [cvs.NetBSD.org] / src / share / man / man9 / isapnp.9 (download)

Revision 1.12, Mon May 30 01:50:07 2011 UTC (12 years, 10 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, matt-nb8-mediatek-base, matt-nb8-mediatek, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, localcount-20160914, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, cherry-xenmp-base, cherry-xenmp, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, agc-symver-base, agc-symver, HEAD
Changes since 1.11: +2 -2 lines

MI drivers should #include <sys/bus.h> not <machine/bus.h>.

.\"     $NetBSD: isapnp.9,v 1.12 2011/05/30 01:50:07 dyoung Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Gregory McGarry.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 19, 2001
.Dt ISAPNP 9
.Os
.Sh NAME
.Nm ISAPNP ,
.Nm isapnp_devmatch ,
.Nm isapnp_config ,
.Nm isapnp_unconfig
.Nd Plug 'n' Play ISA bus
.Sh SYNOPSIS
.In sys/bus.h
.In dev/isa/isareg.h
.In dev/isa/isavar.h
.In dev/isapnp/isapnpreg.h
.In dev/isapnp/isapnpvar.h
.In dev/isapnp/isapnpdevs.h
.Ft int
.Fn isapnp_devmatch "const struct isapnp_attach_args *ipa" \
"const struct isapnp_devinfo *dinfo" "int *variant"
.Ft int
.Fn isapnp_config "bus_space_tag_t iot" "bus_space_tag_t memt" \
"struct isapnp_attach_args *ipa"
.Ft void
.Fn isapnp_unconfig "bus_space_tag_t iot" "bus_space_tag_t memt" \
"struct isapnp_attach_args *ipa"
.Sh DESCRIPTION
The machine-independent
.Nm
subsystem provides support for ISAPNP devices.
ISAPNP devices were developed to support "plug and play" connection
on the ISA bus.
In all other aspects, the ISAPNP bus is same as the ISA bus (see
.Xr isa 9 ) .
.Pp
Devices on the ISAPNP bus are uniquely identified by a 7-character
string.
Resources, such as I/O address space and interrupts, should
be allocated to the devices by the machine firmware.
On some machine the firmware seems doesn't work correctly and
.Nx
will attempt to allocate resources as necessary.
.Sh DATA TYPES
Drivers attached to the ISAPNP bus will make use of the following data
types:
.Bl -tag -width compact
.It Fa struct isapnp_matchinfo
.Nx
kernel contains a database of known ISAPNP devices.
Each entry in the database has a
.Em struct isapnp_matchinfo .
It contains the following members:
.Bd -literal
	const char *name;		/* device id string */
	int variant;			/* variant flag */
.Ed
.It Fa struct isapnp_devinfo
Defines the devices supported by a driver.
It contains pointer to an array of supported
.Em struct isapnp_matchinfo
structures and a pointer to another array of compatibility devices.
It contains the following members:
.Bd -literal
	struct isapnp_matchinfo *devlogic;
	int nlogic;
	struct isapnp_matchinfo *devcompat;
	int ncompat;
.Ed
.It Fa struct isapnp_region
Describes ISAPNP bus-space regions.
It contains the following members:
.Bd -literal
	bus_space_handle_t h;
	uint32_t base;
	uint32_t length;
.Ed
.It Fa struct isapnp_pin
Describes the wiring of interrupts and DMA pins from the ISAPNP bus
onto the host processor.
It contains the following members:
.Bd -literal
	uint8_t  num;
	uint8_t  flags:4;
	uint8_t  type:4;
	uint16_t bits;
.Ed
.It Fa struct isapnp_attach_args
A structure used to inform the driver of the device properties.
It contains the following members:
.Bd -literal
	bus_space_tag_t	ipa_iot;	/* isa i/o space tag */
	bus_space_tag_t	ipa_memt;	/* isa mem space tag */
	bus_dma_tag_t	ipa_dmat;	/* isa dma tag */
	isa_chipset_tag_t	ipa_ic;
	struct isapnp_region    ipa_io[ISAPNP_NUM_IO];
	struct isapnp_region    ipa_mem[ISAPNP_NUM_MEM];
	struct isapnp_region    ipa_mem32[ISAPNP_NUM_MEM32];
	struct isapnp_pin       ipa_irq[ISAPNP_NUM_IRQ];
	struct isapnp_pin       ipa_drq[ISAPNP_NUM_DRQ];
.Ed
.El
.Sh FUNCTIONS
.Bl -tag -width compact
.It Fn isapnp_devmatch "ipa" "dinfo" "variant"
Matches the device described by the attachment
.Fa ipa
with the device-match information in
.Fa dinfo .
If the device is matched,
.Fn isapnp_devmatch
returns a non-zero value and variant is the flag describing the device
variant.
.Fn isapnp_devmatch
returns zero if the device is not found.
.It Fn isapnp_config "iot" "memt" "ipa"
Allocate device resources specified by
.Fa ipa .
The device is mapped into the I/O and memory bus spaces specified by
bus-space tags
.Fa iot
and
.Fa memt
respectively.
The
.Fa ipa_io ,
.Fa ipa_mem ,
.Fa ipa_mem32 ,
.Fa ipa_irq ,
and
.Fa ipa_drq
members of
.Fa ipa
are updated to reflect the allocated and mapped resources.
.Fn isapnp_config
returns zero on success and non-zero on error.
.It Fn isapnp_unconfig "iot" "memt" "ipa"
Free the resources allocated by
.Fn isapnp_config .
.El
.Sh AUTOCONFIGURATION
During autoconfiguration, an ISAPNP driver will receive a pointer to
.Fa struct isapnp_attach_args
describing the device attached to the ISAPNP bus.
Drivers match the device using
.Fn ispnp_devmatch .
.Pp
During the driver attach step, driver should initially allocate and
map resources using
.Fn isapnp_config .
The I/O (memory) bus-space resources can be accessed using the
bus-space tag
.Fa ipa_iot
.Po
.Fa ipa_memt
.Pc
and the bus-space handle
.Fa ipa_io[0].h
.Po
.Fa ipa_mem[0].h
.Pc
members of
.Fa ipa .
.Pp
Interrupts should be established using
.Fn isa_intr_establish
.Po
see
.Xr isa 9
.Pc
with the IRQ specified by the
.Fa ipa_irq[0].num
member of
.Fa ipa .
Similarly, the standard
.Xr isa 9
DMA interface should be used with the
.Fa ipa_drq[0].num
member of
.Fa ipa .
.Sh DMA SUPPORT
Extensive DMA facilities are provided through the
.Xr isa 9
DMA facilities.
.Sh CODE REFERENCES
The
.Nm
subsystem itself is implemented within the file
.Pa sys/dev/isapnp/isapnp.c .
The database of the known devices exists within the file
.Pa sys/dev/isapnp/isapnpdevs.c
and is generated automatically from the file
.Pa sys/dev/isapnp/isapnpdevs .
New devices should be added to this file.
The database can be regenerated using the Makefile
.Pa sys/dev/isapnp/Makefile.isapnpdevs .
.Sh SEE ALSO
.Xr isa 4 ,
.Xr isapnp 4 ,
.Xr pnpbios 4 ,
.Xr autoconf 9 ,
.Xr bus_dma 9 ,
.Xr bus_space 9 ,
.Xr driver 9 ,
.Xr isa 9
.Rs
.%T "Plug and Play ISA Specification V1.0a"
.%D May 5 1994
.Re
.Sh HISTORY
The machine-independent ISAPNP subsystem appear in
.Nx 1.3 .