166416Speter/*-
266416Speter * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
366416Speter * All rights reserved.
466416Speter *
566416Speter * Redistribution and use in source and binary forms, with or without
666416Speter * modification, are permitted provided that the following conditions
766416Speter * are met:
866416Speter * 1. Redistributions of source code must retain the above copyright
966416Speter *    notice, this list of conditions and the following disclaimer.
1066416Speter * 2. Redistributions in binary form must reproduce the above copyright
1166416Speter *    notice, this list of conditions and the following disclaimer in the
1266416Speter *    documentation and/or other materials provided with the distribution.
1366416Speter *
1466416Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1566416Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1666416Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1766416Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1866416Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1966416Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2066416Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2166416Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2266416Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2366416Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2466416Speter * SUCH DAMAGE.
2566416Speter *
2666416Speter * $FreeBSD$
2766416Speter */
2866416Speter
29103862Sjhb#ifndef _MACHINE_LEGACYVAR_H_
30103862Sjhb#define	_MACHINE_LEGACYVAR_H_
3166416Speter
32103862Sjhbenum legacy_device_ivars {
33172394Smarius	LEGACY_IVAR_PCIDOMAIN,
34234150Sjhb	LEGACY_IVAR_PCIBUS,
35234150Sjhb	LEGACY_IVAR_PCISLOT,
36234150Sjhb	LEGACY_IVAR_PCIFUNC
3766416Speter};
3866416Speter
39103862Sjhb#define LEGACY_ACCESSOR(var, ivar, type)				\
40103862Sjhb    __BUS_ACCESSOR(legacy, var, LEGACY, ivar, type)
4166416Speter
42172394SmariusLEGACY_ACCESSOR(pcidomain,		PCIDOMAIN,	uint32_t)
43145121SpeterLEGACY_ACCESSOR(pcibus,			PCIBUS,		uint32_t)
44234150SjhbLEGACY_ACCESSOR(pcislot,		PCISLOT,	int)
45234150SjhbLEGACY_ACCESSOR(pcifunc,		PCIFUNC,	int)
4666416Speter
47103862Sjhb#undef LEGACY_ACCESSOR
4866416Speter
49120362Speterint	legacy_pcib_maxslots(device_t dev);
50188302Simpuint32_t legacy_pcib_read_config(device_t dev, u_int bus, u_int slot,
51188302Simp    u_int func, u_int reg, int bytes);
52120362Speterint	legacy_pcib_read_ivar(device_t dev, device_t child, int which,
53120362Speter    uintptr_t *result);
54188302Simpvoid	legacy_pcib_write_config(device_t dev, u_int bus, u_int slot,
55188302Simp    u_int func, u_int reg, uint32_t data, int bytes);
56120362Speterint	legacy_pcib_write_ivar(device_t dev, device_t child, int which,
57120362Speter    uintptr_t value);
58150266Simpstruct resource *legacy_pcib_alloc_resource(device_t dev, device_t child,
59150266Simp    int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
60234150Sjhbint	legacy_pcib_map_msi(device_t pcib, device_t dev, int irq,
61234150Sjhb    uint64_t *addr, uint32_t *data);
62120362Speter
63103862Sjhb#endif /* !_MACHINE_LEGACYVAR_H_ */
64