xref: /freebsd/share/man/man9/bhnd_erom.9 (revision 81727a3dd38287d437d1e7e416dd89107a706e55)
105ed3f90SLandon J. Fuller.\" Copyright (c) 2015-2016 Landon Fuller <landonf@FreeBSD.org>
205ed3f90SLandon J. Fuller.\" Copyright (c) 2017 The FreeBSD Foundation
305ed3f90SLandon J. Fuller.\" All rights reserved.
405ed3f90SLandon J. Fuller.\"
505ed3f90SLandon J. Fuller.\" Portions of this documentation were written by Landon Fuller
605ed3f90SLandon J. Fuller.\" under sponsorship from the FreeBSD Foundation.
705ed3f90SLandon J. Fuller.\"
805ed3f90SLandon J. Fuller.\" Redistribution and use in source and binary forms, with or without
905ed3f90SLandon J. Fuller.\" modification, are permitted provided that the following conditions
1005ed3f90SLandon J. Fuller.\" are met:
1105ed3f90SLandon J. Fuller.\" 1. Redistributions of source code must retain the above copyright
1205ed3f90SLandon J. Fuller.\"    notice, this list of conditions and the following disclaimer.
1305ed3f90SLandon J. Fuller.\" 2. Redistributions in binary form must reproduce the above copyright
1405ed3f90SLandon J. Fuller.\"    notice, this list of conditions and the following disclaimer in the
1505ed3f90SLandon J. Fuller.\"    documentation and/or other materials provided with the distribution.
1605ed3f90SLandon J. Fuller.\"
1705ed3f90SLandon J. Fuller.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1805ed3f90SLandon J. Fuller.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1905ed3f90SLandon J. Fuller.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2005ed3f90SLandon J. Fuller.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2105ed3f90SLandon J. Fuller.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2205ed3f90SLandon J. Fuller.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2305ed3f90SLandon J. Fuller.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2405ed3f90SLandon J. Fuller.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2505ed3f90SLandon J. Fuller.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2605ed3f90SLandon J. Fuller.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2705ed3f90SLandon J. Fuller.\" SUCH DAMAGE.
2805ed3f90SLandon J. Fuller.\"
2905ed3f90SLandon J. Fuller.Dd November 9, 2017
3005ed3f90SLandon J. Fuller.Dt BHND_EROM 9
3105ed3f90SLandon J. Fuller.Os
3205ed3f90SLandon J. Fuller.Sh NAME
3305ed3f90SLandon J. Fuller.Nm bhnd_erom ,
3405ed3f90SLandon J. Fuller.Nm bhnd_erom_alloc ,
3505ed3f90SLandon J. Fuller.Nm bhnd_erom_dump ,
3605ed3f90SLandon J. Fuller.Nm bhnd_erom_fini_static ,
3705ed3f90SLandon J. Fuller.Nm bhnd_erom_free ,
3805ed3f90SLandon J. Fuller.Nm bhnd_erom_free_core_table ,
3905ed3f90SLandon J. Fuller.Nm bhnd_erom_get_core_table ,
4005ed3f90SLandon J. Fuller.Nm bhnd_erom_init_static ,
4105ed3f90SLandon J. Fuller.Nm bhnd_erom_io ,
4205ed3f90SLandon J. Fuller.Nm bhnd_erom_io_fini ,
4305ed3f90SLandon J. Fuller.Nm bhnd_erom_io_map ,
4405ed3f90SLandon J. Fuller.Nm bhnd_erom_io_read ,
4505ed3f90SLandon J. Fuller.Nm bhnd_erom_iobus_init ,
4605ed3f90SLandon J. Fuller.Nm bhnd_erom_iores_new ,
4705ed3f90SLandon J. Fuller.Nm bhnd_erom_lookup_core ,
4805ed3f90SLandon J. Fuller.Nm bhnd_erom_lookup_core_addr ,
4905ed3f90SLandon J. Fuller.Nm bhnd_erom_probe ,
5005ed3f90SLandon J. Fuller.Nm bhnd_erom_probe_driver_classes
5105ed3f90SLandon J. Fuller.Nd BHND device enumeration table parsing
5205ed3f90SLandon J. Fuller.Sh SYNOPSIS
5305ed3f90SLandon J. Fuller.In dev/bhnd/bhnd.h
5405ed3f90SLandon J. Fuller.In dev/bhnd/bhnd_erom.h
5505ed3f90SLandon J. Fuller.\"
5605ed3f90SLandon J. Fuller.Vt typedef struct bhnd_erom bhnd_erom_t ;
5705ed3f90SLandon J. Fuller.Vt typedef struct kobj_class bhnd_erom_class_t ;
5805ed3f90SLandon J. Fuller.Vt typedef struct bhnd_erom_static bhnd_erom_static_t ;
5905ed3f90SLandon J. Fuller.Ft int
6005ed3f90SLandon J. Fuller.Fo bhnd_erom_probe
6105ed3f90SLandon J. Fuller.Fa "bhnd_erom_class_t *cls"
6205ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
6305ed3f90SLandon J. Fuller.Fa "const struct bhnd_chipid *hint"
6405ed3f90SLandon J. Fuller.Fa "struct bhnd_chipid *cid"
6505ed3f90SLandon J. Fuller.Fc
6605ed3f90SLandon J. Fuller.Ft bhnd_erom_class_t *
6705ed3f90SLandon J. Fuller.Fo bhnd_erom_probe_driver_classes
6805ed3f90SLandon J. Fuller.Fa "devclass_t bus_devclass"
6905ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
7005ed3f90SLandon J. Fuller.Fa "const struct bhnd_chipid *hint"
7105ed3f90SLandon J. Fuller.Fa "struct bhnd_chipid *cid"
7205ed3f90SLandon J. Fuller.Fc
7305ed3f90SLandon J. Fuller.Ft bhnd_erom_t *
7405ed3f90SLandon J. Fuller.Fo bhnd_erom_alloc
7505ed3f90SLandon J. Fuller.Fa "bhnd_erom_class_t *cls"
7605ed3f90SLandon J. Fuller.Fa "const struct bhnd_chipid *cid"
7705ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
7805ed3f90SLandon J. Fuller.Fc
7905ed3f90SLandon J. Fuller.Ft void
8005ed3f90SLandon J. Fuller.Fo bhnd_erom_free
8105ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
8205ed3f90SLandon J. Fuller.Fc
8305ed3f90SLandon J. Fuller.Ft int
8405ed3f90SLandon J. Fuller.Fo bhnd_erom_init_static
8505ed3f90SLandon J. Fuller.Fa "bhnd_erom_class_t *cls"
8605ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
8705ed3f90SLandon J. Fuller.Fa "size_t esize"
8805ed3f90SLandon J. Fuller.Fa "const struct bhnd_chipid *cid"
8905ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
9005ed3f90SLandon J. Fuller.Fc
9105ed3f90SLandon J. Fuller.Ft void
9205ed3f90SLandon J. Fuller.Fo bhnd_erom_fini_static
9305ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
9405ed3f90SLandon J. Fuller.Fc
9505ed3f90SLandon J. Fuller.Ft int
9605ed3f90SLandon J. Fuller.Fo bhnd_erom_dump
9705ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
9805ed3f90SLandon J. Fuller.Fc
9905ed3f90SLandon J. Fuller.Ft int
10005ed3f90SLandon J. Fuller.Fo bhnd_erom_get_core_table
10105ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
10205ed3f90SLandon J. Fuller.Fa "struct bhnd_core_info **cores"
10305ed3f90SLandon J. Fuller.Fa "u_int *num_cores"
10405ed3f90SLandon J. Fuller.Fc
10505ed3f90SLandon J. Fuller.Ft void
10605ed3f90SLandon J. Fuller.Fo bhnd_erom_free_core_table
10705ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
10805ed3f90SLandon J. Fuller.Fa "struct bhnd_core_info *cores"
10905ed3f90SLandon J. Fuller.Fc
11005ed3f90SLandon J. Fuller.Ft int
11105ed3f90SLandon J. Fuller.Fo bhnd_erom_lookup_core
11205ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
11305ed3f90SLandon J. Fuller.Fa "const struct bhnd_core_match *desc"
11405ed3f90SLandon J. Fuller.Fa "struct bhnd_core_info *core"
11505ed3f90SLandon J. Fuller.Fc
11605ed3f90SLandon J. Fuller.Ft int
11705ed3f90SLandon J. Fuller.Fo bhnd_erom_lookup_core_addr
11805ed3f90SLandon J. Fuller.Fa "bhnd_erom_t *erom"
11905ed3f90SLandon J. Fuller.Fa "const struct bhnd_core_match *desc"
12005ed3f90SLandon J. Fuller.Fa "bhnd_port_type type"
12105ed3f90SLandon J. Fuller.Fa "u_int port"
12205ed3f90SLandon J. Fuller.Fa "u_int region"
12305ed3f90SLandon J. Fuller.Fa "struct bhnd_core_info *core"
12405ed3f90SLandon J. Fuller.Fa "bhnd_addr_t *addr"
12505ed3f90SLandon J. Fuller.Fa "bhnd_size_t *size"
12605ed3f90SLandon J. Fuller.Fc
12705ed3f90SLandon J. Fuller.\"
12805ed3f90SLandon J. Fuller.Ss Bus Space I/O
12905ed3f90SLandon J. Fuller.Ft struct bhnd_erom_io *
13005ed3f90SLandon J. Fuller.Fo bhnd_erom_iores_new
13105ed3f90SLandon J. Fuller.Fa "device_t dev"
13205ed3f90SLandon J. Fuller.Fa "int rid"
13305ed3f90SLandon J. Fuller.Fc
13405ed3f90SLandon J. Fuller.Ft int
13505ed3f90SLandon J. Fuller.Fo bhnd_erom_iobus_init
13605ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_iobus *iobus"
13705ed3f90SLandon J. Fuller.Fa "bhnd_addr_t addr"
13805ed3f90SLandon J. Fuller.Fa "bhnd_size_t size"
13905ed3f90SLandon J. Fuller.Fa "bus_space_tag_t bst"
14005ed3f90SLandon J. Fuller.Fa "bus_space_handle_t bsh"
14105ed3f90SLandon J. Fuller.Fc
14205ed3f90SLandon J. Fuller.Ft void
14305ed3f90SLandon J. Fuller.Fo bhnd_erom_io_fini
14405ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
14505ed3f90SLandon J. Fuller.Fc
14605ed3f90SLandon J. Fuller.Ft int
14705ed3f90SLandon J. Fuller.Fo bhnd_erom_io_map
14805ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
14905ed3f90SLandon J. Fuller.Fa "bhnd_addr_t addr"
15005ed3f90SLandon J. Fuller.Fa "bhnd_size_t size"
15105ed3f90SLandon J. Fuller.Fc
15205ed3f90SLandon J. Fuller.Ft uint32_t
15305ed3f90SLandon J. Fuller.Fo bhnd_erom_io_read
15405ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
15505ed3f90SLandon J. Fuller.Fa "bhnd_size_t offset"
15605ed3f90SLandon J. Fuller.Fa "u_int width"
15705ed3f90SLandon J. Fuller.Fc
15805ed3f90SLandon J. Fuller.In dev/bhnd/bhnd_eromvar.h
15905ed3f90SLandon J. Fuller.Bd -literal
16005ed3f90SLandon J. Fullerstruct bhnd_erom_io {
16105ed3f90SLandon J. Fuller	bhnd_erom_io_map_t	*map;
16205ed3f90SLandon J. Fuller	bhnd_erom_io_read_t	*read;
16305ed3f90SLandon J. Fuller	bhnd_erom_io_fini_t	*fini;
16405ed3f90SLandon J. Fuller};
16505ed3f90SLandon J. Fuller.Ed
16605ed3f90SLandon J. Fuller.Ft typedef int
16705ed3f90SLandon J. Fuller.Fo \*(lpbhnd_erom_io_map_t\*(rp
16805ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
16905ed3f90SLandon J. Fuller.Fa "bhnd_addr_t addr"
17005ed3f90SLandon J. Fuller.Fa "bhnd_size_t size"
17105ed3f90SLandon J. Fuller.Fc
17205ed3f90SLandon J. Fuller.Ft typedef uint32_t
17305ed3f90SLandon J. Fuller.Fo \*(lpbhnd_erom_io_read_t\*(rp
17405ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
17505ed3f90SLandon J. Fuller.Fa "bhnd_size_t offset"
17605ed3f90SLandon J. Fuller.Fa "u_int width"
17705ed3f90SLandon J. Fuller.Fc
17805ed3f90SLandon J. Fuller.Ft typedef void
17905ed3f90SLandon J. Fuller.Fo "\*(lpbhnd_erom_io_fini_t\*(rp
18005ed3f90SLandon J. Fuller.Fa "struct bhnd_erom_io *eio"
18105ed3f90SLandon J. Fuller.Fc
18205ed3f90SLandon J. Fuller.\"
18305ed3f90SLandon J. Fuller.Sh DESCRIPTION
18405ed3f90SLandon J. FullerThe
18505ed3f90SLandon J. Fuller.Nm
18605ed3f90SLandon J. Fullerframework provides a common parser interface to the BHND device enumeration
18705ed3f90SLandon J. Fullertable formats supported by
18805ed3f90SLandon J. Fuller.Xr bhnd 4
18905ed3f90SLandon J. Fullerbus drivers.
19005ed3f90SLandon J. Fuller.Pp
19105ed3f90SLandon J. FullerThe
19205ed3f90SLandon J. Fuller.Fn bhnd_erom_probe
19305ed3f90SLandon J. Fullerfunction is used to identify a
19405ed3f90SLandon J. Fuller.Xr bhnd 4
19505ed3f90SLandon J. Fullerbus device and determine whether the erom class
19605ed3f90SLandon J. Fuller.Fa cls
19705ed3f90SLandon J. Fulleris capable of parsing its device enumeration table.
19805ed3f90SLandon J. FullerIf successful, the probed chip identification is written to the location
19905ed3f90SLandon J. Fullerpointed to by
20005ed3f90SLandon J. Fuller.Fa cid .
20105ed3f90SLandon J. Fuller.Pp
20205ed3f90SLandon J. FullerA pointer to a bus I/O instance mapping the device registers of the first
20305ed3f90SLandon J. Fullerhardware core must be provided using the
20405ed3f90SLandon J. Fuller.Fa eio
20505ed3f90SLandon J. Fullerargument.
20605ed3f90SLandon J. FullerThe registers can be mapped using
207*81727a3dSChristopher Davidson.Fn bhnd_erom_io_map .
20805ed3f90SLandon J. Fuller.Pp
20905ed3f90SLandon J. FullerOn devices that do not provide standard
21005ed3f90SLandon J. Fuller.Xr bhnd_chipc 4
21105ed3f90SLandon J. Fullerchip identification registers via the first hardware core, a pointer to chip
21205ed3f90SLandon J. Fullerinformation for the device must be specified using the
21305ed3f90SLandon J. Fuller.Fa hint
21405ed3f90SLandon J. Fullerargument.
21505ed3f90SLandon J. FullerOtherwise, the
21605ed3f90SLandon J. Fuller.Fa hint
21705ed3f90SLandon J. Fullerargument should be
21805ed3f90SLandon J. Fuller.Dv NULL .
21905ed3f90SLandon J. Fuller.Pp
22005ed3f90SLandon J. FullerThe
22105ed3f90SLandon J. Fuller.Fn bhnd_erom_probe_driver_classes
22205ed3f90SLandon J. Fullerfunction is a convenience wrapper for
22305ed3f90SLandon J. Fuller.Fn bhnd_erom_probe .
22405ed3f90SLandon J. FullerThis function will iterate over all drivers instances in the device class
22505ed3f90SLandon J. Fuller.Fa bus_devclass ,
22605ed3f90SLandon J. Fullerusing
22705ed3f90SLandon J. Fuller.Xr bhnd_driver_get_erom_class 9
22805ed3f90SLandon J. Fullerto fetch each driver's erom class and probe the hardware core mapped by
22905ed3f90SLandon J. Fuller.Fa eio .
23005ed3f90SLandon J. FullerA pointer to the erom class with the highest probe priority is returned on
23105ed3f90SLandon J. Fullersuccess.
23205ed3f90SLandon J. FullerIf there are no successful probe results from the erom classes,
23305ed3f90SLandon J. Fuller.Dv NULL
23405ed3f90SLandon J. Fulleris returned.
23505ed3f90SLandon J. Fuller.Pp
23605ed3f90SLandon J. FullerThe
23705ed3f90SLandon J. Fuller.Fn bhnd_erom_alloc
23805ed3f90SLandon J. Fullerfunction allocates and returns a new parser instance of the device enumeration
23905ed3f90SLandon J. Fullerclass
24005ed3f90SLandon J. Fuller.Fa cls
24105ed3f90SLandon J. Fullerfor the chip identified by
24205ed3f90SLandon J. Fuller.Fa cid ,
24305ed3f90SLandon J. Fullerusing the bus I/O instance
24405ed3f90SLandon J. Fuller.Fa eio
24505ed3f90SLandon J. Fullerto map and read the device table.
24605ed3f90SLandon J. FullerOn success, the returned
24705ed3f90SLandon J. Fuller.Vt bhnd_erom_t
24805ed3f90SLandon J. Fullerassumes ownership of
24905ed3f90SLandon J. Fuller.Fa eio .
25005ed3f90SLandon J. Fuller.Pp
25105ed3f90SLandon J. FullerThe
25205ed3f90SLandon J. Fuller.Fn bhnd_erom_free
25305ed3f90SLandon J. Fullerfunction releases all resources held by an erom parser successfully allocated
25405ed3f90SLandon J. Fullerusing
25505ed3f90SLandon J. Fuller.Fn bhnd_erom_alloc .
25605ed3f90SLandon J. Fuller.Pp
25705ed3f90SLandon J. FullerClients can manage the allocation of memory themselves with
25805ed3f90SLandon J. Fuller.Fn bhnd_erom_init_static .
25905ed3f90SLandon J. FullerThis is useful in cases like performing device enumeration before
26005ed3f90SLandon J. Fuller.Xr malloc 9
26105ed3f90SLandon J. Fullerinitialization.
26205ed3f90SLandon J. Fuller.Fn bhnd_erom_init_static
26305ed3f90SLandon J. Fulleris called with
26405ed3f90SLandon J. Fuller.Fa erom
26505ed3f90SLandon J. Fullerset to a pointer to the memory for the instance, and the total available bytes
26605ed3f90SLandon J. Fullerin
26705ed3f90SLandon J. Fuller.Fa esize .
26805ed3f90SLandon J. Fuller.Pp
26905ed3f90SLandon J. FullerThe
27005ed3f90SLandon J. Fuller.Vt bhnd_erom_static
27105ed3f90SLandon J. Fullerstructure is large enough to statically allocate any supported parser class
27205ed3f90SLandon J. Fullerinstance state.
27305ed3f90SLandon J. FullerPointers to a
27405ed3f90SLandon J. Fuller.Vt bhnd_erom_static
27505ed3f90SLandon J. Fullerstructure can be cast to
27605ed3f90SLandon J. Fuller.Vt bhnd_erom_t .
27705ed3f90SLandon J. Fuller.Pp
27805ed3f90SLandon J. FullerThe
27905ed3f90SLandon J. Fuller.Fn bhnd_erom_fini_static
28005ed3f90SLandon J. Fullerfunction releases all resources held by an erom parser successfully
28105ed3f90SLandon J. Fullerinitialized using
28205ed3f90SLandon J. Fuller.Fn bhnd_erom_init_static .
28305ed3f90SLandon J. Fuller.Pp
28405ed3f90SLandon J. FullerThe
28505ed3f90SLandon J. Fuller.Fn bhnd_erom_dump
28605ed3f90SLandon J. Fullerfunction enumerates and prints all device table entries in
28705ed3f90SLandon J. Fuller.Fa erom .
28805ed3f90SLandon J. Fuller.Pp
28905ed3f90SLandon J. FullerThe
29005ed3f90SLandon J. Fuller.Fn bhnd_erom_get_core_table
29105ed3f90SLandon J. Fullerfunction enumerates all device table entries in
29205ed3f90SLandon J. Fuller.Fa erom ,
29305ed3f90SLandon J. Fullerreturning a table of core information structures in
29405ed3f90SLandon J. Fuller.Fa cores
29505ed3f90SLandon J. Fullerand the count in
29605ed3f90SLandon J. Fuller.Fa num_cores .
29705ed3f90SLandon J. FullerThe memory allocated for the table must be freed using
29805ed3f90SLandon J. Fuller.Fn bhnd_erom_free_core_table .
29905ed3f90SLandon J. Fuller.Pp
30005ed3f90SLandon J. FullerThe
30105ed3f90SLandon J. Fuller.Fn bhnd_erom_free_core_table
30205ed3f90SLandon J. Fullerfunction frees any memory allocated in a previous call to
30305ed3f90SLandon J. Fuller.Fn bhnd_erom_get_core_table .
30405ed3f90SLandon J. Fuller.Pp
30505ed3f90SLandon J. FullerThe
30605ed3f90SLandon J. Fuller.Fn bhnd_erom_lookup_core
30705ed3f90SLandon J. Fullerfunction locates the first device table entry in
30805ed3f90SLandon J. Fuller.Fa erom
30905ed3f90SLandon J. Fullerthat matches core match descriptor
31005ed3f90SLandon J. Fuller.Fa desc ,
31105ed3f90SLandon J. Fullerwriting the core information of the matching entry to
31205ed3f90SLandon J. Fuller.Fa core .
31305ed3f90SLandon J. Fuller.Pp
31405ed3f90SLandon J. FullerThe
31505ed3f90SLandon J. Fuller.Fn bhnd_erom_lookup_core_addr
31605ed3f90SLandon J. Fullerfunction locates the first device table entry in
31705ed3f90SLandon J. Fuller.Fa erom
31805ed3f90SLandon J. Fullerthat matches core match descriptor
31905ed3f90SLandon J. Fuller.Fa desc ,
32005ed3f90SLandon J. Fullerfetching the base address and size of the memory region
32105ed3f90SLandon J. Fuller.Fa region
32205ed3f90SLandon J. Fullermapped to the port
32305ed3f90SLandon J. Fuller.Fa port
32405ed3f90SLandon J. Fullerof type
32505ed3f90SLandon J. Fuller.Fa type .
32605ed3f90SLandon J. FullerOn success, the core information of the matching entry is written to
32705ed3f90SLandon J. Fuller.Fa core ,
32805ed3f90SLandon J. Fullerthe base address of the port region is written to
32905ed3f90SLandon J. Fuller.Fa addr ,
33005ed3f90SLandon J. Fullerand the total size of the port region is written to
33105ed3f90SLandon J. Fuller.Fa size .
33205ed3f90SLandon J. FullerIf the core information is not desired, set
33305ed3f90SLandon J. Fuller.Fa core
33405ed3f90SLandon J. Fullerto
33505ed3f90SLandon J. Fuller.Dv NULL .
33605ed3f90SLandon J. Fuller.Ss Bus Space I/O
33705ed3f90SLandon J. FullerThe
33805ed3f90SLandon J. Fuller.Vt bhnd_erom_io
33905ed3f90SLandon J. Fullerstructure provides a set of I/O callbacks used by
34005ed3f90SLandon J. Fuller.Nm
34105ed3f90SLandon J. Fullerto map and read the device enumeration table.
34205ed3f90SLandon J. FullerClients may either use the existing
34305ed3f90SLandon J. Fuller.Fn bhnd_erom_iores_new
34405ed3f90SLandon J. Fulleror
34505ed3f90SLandon J. Fuller.Fn bhnd_erom_iobus_init
34605ed3f90SLandon J. Fullerfunctions to allocate a bus I/O instance, or implement the
34705ed3f90SLandon J. Fuller.Vt bhnd_erom_io
34805ed3f90SLandon J. Fullercallbacks directly.
34905ed3f90SLandon J. Fuller.Pp
35005ed3f90SLandon J. FullerThe
35105ed3f90SLandon J. Fuller.Vt bhnd_erom_io
35205ed3f90SLandon J. Fullerstructure contains these required fields:
35305ed3f90SLandon J. Fuller.Bl -tag -width "read" -offset indent
35405ed3f90SLandon J. Fuller.It Fa map
35505ed3f90SLandon J. FullerA function implementing
35605ed3f90SLandon J. Fuller.Fn bhnd_erom_io_map .
35705ed3f90SLandon J. Fuller.It Fa read
35805ed3f90SLandon J. FullerA function implementing
35905ed3f90SLandon J. Fuller.Fn bhnd_erom_io_read .
36005ed3f90SLandon J. Fuller.It Fa fini
36105ed3f90SLandon J. FullerA function implementing
36205ed3f90SLandon J. Fuller.Fn bhnd_erom_io_fini .
36305ed3f90SLandon J. Fuller.El
36405ed3f90SLandon J. Fuller.Pp
36505ed3f90SLandon J. FullerThe
36605ed3f90SLandon J. Fuller.Fn bhnd_erom_iores_new
36705ed3f90SLandon J. Fullerfunction allocates and returns a new bus I/O instance that will perform mapping
36805ed3f90SLandon J. Fullerby using
36905ed3f90SLandon J. Fuller.Xr bhnd_alloc_resource 9
37005ed3f90SLandon J. Fullerto allocate
37105ed3f90SLandon J. Fuller.Dv SYS_RES_MEMORY
37205ed3f90SLandon J. Fullerbus resources on demand from the device
37305ed3f90SLandon J. Fuller.Fa dev
37405ed3f90SLandon J. Fullerusing a resource ID of
37505ed3f90SLandon J. Fuller.Fa rid .
37605ed3f90SLandon J. Fuller.Pp
37705ed3f90SLandon J. FullerThe
37805ed3f90SLandon J. Fuller.Fn bhnd_erom_iobus_init
37905ed3f90SLandon J. Fullerfunction initializes a caller-allocated bus I/O instance
38005ed3f90SLandon J. Fuller.Fa iobus
38105ed3f90SLandon J. Fullerthat will perform bus I/O using the bus space tag
38205ed3f90SLandon J. Fuller.Fa bst
38305ed3f90SLandon J. Fullerand handle
38405ed3f90SLandon J. Fuller.Fa bsh .
38505ed3f90SLandon J. FullerThe base address and total size mapped by
38605ed3f90SLandon J. Fuller.Fa bsh
38705ed3f90SLandon J. Fullershould be specified using the
38805ed3f90SLandon J. Fuller.Fa addr
38905ed3f90SLandon J. Fullerand
39005ed3f90SLandon J. Fuller.Fa size
39105ed3f90SLandon J. Fullerarguments.
39205ed3f90SLandon J. Fuller.Pp
39305ed3f90SLandon J. FullerThe
39405ed3f90SLandon J. Fuller.Fn bhnd_erom_io_fini
39505ed3f90SLandon J. Fullerfunction frees all resources held by the bus I/O instance
39605ed3f90SLandon J. Fuller.Fa eio .
39705ed3f90SLandon J. Fuller.Pp
39805ed3f90SLandon J. FullerThe
39905ed3f90SLandon J. Fuller.Fn bhnd_erom_io_map
40005ed3f90SLandon J. Fullerfunction is used to request that the bus I/O instance
40105ed3f90SLandon J. Fuller.Fa eio
40205ed3f90SLandon J. Fullermap
40305ed3f90SLandon J. Fuller.Xr bhnd 4
40405ed3f90SLandon J. Fullerbus space at bus address
40505ed3f90SLandon J. Fuller.Fa addr
40605ed3f90SLandon J. Fullerwith a mapping of size
40705ed3f90SLandon J. Fuller.Fa size .
40805ed3f90SLandon J. Fuller.Pp
40905ed3f90SLandon J. FullerThe
41005ed3f90SLandon J. Fuller.Fn bhnd_erom_io_read
41105ed3f90SLandon J. Fullerfunction is used to read a data item of
41205ed3f90SLandon J. Fuller.Fa width
41305ed3f90SLandon J. Fullerbytes from the bus I/O instance
41405ed3f90SLandon J. Fuller.Fa eio
41505ed3f90SLandon J. Fullerat
41605ed3f90SLandon J. Fuller.Fa offset ,
41705ed3f90SLandon J. Fullerrelative to the bus address previously mapped using
41805ed3f90SLandon J. Fuller.Fn bhnd_erom_io_map .
41905ed3f90SLandon J. Fuller.Pp
42005ed3f90SLandon J. FullerThe
42105ed3f90SLandon J. Fuller.Fa width
42205ed3f90SLandon J. Fullermust be one of 1, 2, or 4 bytes.
42305ed3f90SLandon J. Fuller.Sh RETURN VALUES
42405ed3f90SLandon J. FullerThe
42505ed3f90SLandon J. Fuller.Fn bhnd_erom_probe
42605ed3f90SLandon J. Fullerfunction returns a standard
42705ed3f90SLandon J. Fuller.Xr DEVICE_PROBE 9
42805ed3f90SLandon J. Fullerresult.
42905ed3f90SLandon J. Fuller.Pp
43005ed3f90SLandon J. FullerA return value equal to or less than zero indicates success.
43105ed3f90SLandon J. FullerValues greater than zero indicates an error, and will be an appropriate error
43205ed3f90SLandon J. Fullercode.
43305ed3f90SLandon J. FullerFor values less than or equal to zero, the erom class returning the highest
43405ed3f90SLandon J. Fullervalue should be used to parse the erom table.
43505ed3f90SLandon J. Fuller.Er ENXIO
43605ed3f90SLandon J. Fulleris returned if the device is not supported by the parser.
43705ed3f90SLandon J. Fuller.Pp
43805ed3f90SLandon J. FullerThe
43905ed3f90SLandon J. Fuller.Fn bhnd_erom_probe_driver_classes
44005ed3f90SLandon J. Fullerfunction returns a pointer to the probed
44105ed3f90SLandon J. Fuller.Vt bhnd_erom_class_t
44205ed3f90SLandon J. Fullerinstance on success, a null pointer otherwise.
44305ed3f90SLandon J. Fuller.Pp
44405ed3f90SLandon J. FullerThe
44505ed3f90SLandon J. Fuller.Fn bhnd_erom_alloc
44605ed3f90SLandon J. Fullerfunction returns a pointer to
44705ed3f90SLandon J. Fuller.Vt bhnd_erom_t
44805ed3f90SLandon J. Fulleron success, or
44905ed3f90SLandon J. Fuller.Dv NULL
45005ed3f90SLandon J. Fullerif an error occurred allocating or initializing the EROM parser.
45105ed3f90SLandon J. Fuller.Pp
45205ed3f90SLandon J. FullerThe
45305ed3f90SLandon J. Fuller.Fn bhnd_erom_init_static
45405ed3f90SLandon J. Fullerfunction returns 0 on success,
45505ed3f90SLandon J. Fuller.Er ENOMEM
45605ed3f90SLandon J. Fullerif the allocation size is smaller than required by the erom class, or
45705ed3f90SLandon J. Fulleran appropriate error code if initialization otherwise fails.
45805ed3f90SLandon J. Fuller.Pp
45905ed3f90SLandon J. FullerThe
46005ed3f90SLandon J. Fuller.Fn bhnd_erom_lookup_core
46105ed3f90SLandon J. Fullerfunction returns 0 on success,
46205ed3f90SLandon J. Fuller.Er ENOENT
46305ed3f90SLandon J. Fullerif no matching core is found, or an appropriate error code if parsing the device
46405ed3f90SLandon J. Fullertable otherwise fails.
46505ed3f90SLandon J. Fuller.Pp
46605ed3f90SLandon J. FullerThe
46705ed3f90SLandon J. Fuller.Fn bhnd_erom_dump ,
46805ed3f90SLandon J. Fuller.Fn bhnd_erom_get_core_table ,
46905ed3f90SLandon J. Fuller.Fn bhnd_erom_iobus_init ,
47005ed3f90SLandon J. Fuller.Fn bhnd_erom_io_map ,
47105ed3f90SLandon J. Fullerfunctions return 0 on success, otherwise an appropriate error code is returned.
47205ed3f90SLandon J. Fuller.Sh SEE ALSO
47305ed3f90SLandon J. Fuller.Xr bhnd 4 ,
47405ed3f90SLandon J. Fuller.Xr bhnd 9 ,
475a549eb67SGordon Bergling.Xr bhnd_alloc_resource 9 ,
476a549eb67SGordon Bergling.Xr bhnd_driver_get_erom_class 9 ,
47705ed3f90SLandon J. Fuller.Xr bus_space 9
47805ed3f90SLandon J. Fuller.Sh AUTHORS
47905ed3f90SLandon J. Fuller.An -nosplit
48005ed3f90SLandon J. FullerThe
48105ed3f90SLandon J. Fuller.Nm
48205ed3f90SLandon J. Fullerframework and this manual page were written by
48305ed3f90SLandon J. Fuller.An Landon Fuller Aq Mt landonf@FreeBSD.org .
484