summaryrefslogtreecommitdiffstats
path: root/sys/pci/pcibus.h
blob: 1c5671c4d0379886fe2110913418d85f96f22f0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**************************************************************************
**
**  $Id: pcibus.h,v 1.2 1994/11/02 23:47:14 se Exp $
**
**  Declarations for pci bus driver.
**
**  386bsd / FreeBSD
**
**-------------------------------------------------------------------------
**
** Copyright (c) 1994 Wolfgang Stanglmeier.  All rights reserved.
**
** 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.
** 3. The name of the author may not be used to endorse or promote products
**    derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
**
***************************************************************************
*/

#ifndef __PCI_BUS_H__
#define __PCI_BUS_H__

/*-----------------------------------------------------------------
**
**	The following functions are provided by the pci bios.
**	They are used only by the pci configuration.
**
**	pb_mode():
**		Probes for a pci system.
**		Returns 1 or 2 for pci configuration mechanism.
**		Returns 0 if no pci system.
**
**	pb_tag():
**		Gets a handle for accessing the pci configuration
**		space.
**		This handle is given to the mapping functions (see
**		above) or to the read/write functions.
**
**	pb_read():
**		Read a long word from the pci configuration space.
**		Requires a tag (from pcitag) and the register
**		number (should be a long word aligned one).
**
**	pb_write():
**		Writes a long word to the pci configuration space.
**		Requires a tag (from pcitag), the register number
**		(should be a long word aligned one), and a value.
**
**	pb_regint():
**		Register an interupt handler for a pci device.
**		Requires a tag (from pcitag), the handler function
**		and it's argument, and an interupt mask.
**
**-----------------------------------------------------------------
*/

struct pcibus {
	char     *pb_name;
	int	(*pb_mode  ) (void);
	pcici_t	(*pb_tag   ) (u_char bus, u_char device, u_char func);
	u_long	(*pb_read  ) (pcici_t tag, u_long reg);
	void	(*pb_write ) (pcici_t tag, u_long reg, u_long data);
	int	(*pb_regint) (pcici_t tag, int(*func)(), void*arg, unsigned*mp);
};

/*
**	The following structure should be generated by the driver
*/

extern struct linker_set pcibus_set;

#endif
OpenPOWER on IntegriCloud