13229Spst/*-
23229Spst * Copyright (c) 2006 Marcel Moolenaar
350476Speter * All rights reserved.
43229Spst *
5129303Sru * Redistribution and use in source and binary forms, with or without
633035Scharnier * modification, are permitted provided that the following conditions
769913Sru * are met:
833035Scharnier *
933035Scharnier * 1. Redistributions of source code must retain the above copyright
1033035Scharnier *    notice, this list of conditions and the following disclaimer.
1133035Scharnier * 2. Redistributions in binary form must reproduce the above copyright
1268949Sru *    notice, this list of conditions and the following disclaimer in the
13129303Sru *    documentation and/or other materials provided with the distribution.
14125654Sroam *
15125654Sroam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16125654Sroam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1733035Scharnier * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1833035Scharnier * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1933035Scharnier * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2033035Scharnier * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2133035Scharnier * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2233035Scharnier * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23129303Sru * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24125654Sroam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25125654Sroam *
2633035Scharnier * $FreeBSD$
2733035Scharnier */
2833035Scharnier
2999500Scharnier#ifndef _DEV_PUC_BFE_H_
3099500Scharnier#define	_DEV_PUC_BFE_H_
3199500Scharnier
323229Spst#define	PUC_PCI_BARS	6
333229Spst
3499500Scharnierstruct puc_cfg;
3599500Scharnierstruct puc_port;
3699500Scharnier
373229Spstextern const struct puc_cfg puc_pci_devices[];
3871895Sru
3968949Sruextern devclass_t puc_devclass;
40131487Sruextern const char puc_driver_name[];
41131487Sru
4233035Scharnierstruct puc_bar {
433229Spst	struct resource *b_res;
4433035Scharnier	int		b_rid;
453229Spst	int		b_type;
4633035Scharnier};
473229Spst
4833035Scharnierstruct puc_softc {
493229Spst	device_t	sc_dev;
5033035Scharnier
513229Spst	const struct puc_cfg *sc_cfg;
5233035Scharnier	intptr_t	sc_cfg_data;
533229Spst
5433035Scharnier	struct puc_bar	sc_bar[PUC_PCI_BARS];
553229Spst	struct rman	sc_ioport;
5633035Scharnier	struct rman	sc_iomem;
5733035Scharnier	struct rman	sc_irq;
5833035Scharnier
5933035Scharnier	struct resource *sc_ires;
6033035Scharnier	void		*sc_icookie;
613229Spst	int		sc_irid;
6233035Scharnier
633229Spst	int		sc_nports;
6433035Scharnier	struct puc_port *sc_port;
65131487Sru
66131487Sru	int		sc_fastintr:1;
673229Spst	int		sc_leaving:1;
68131487Sru	int		sc_polled:1;
69131487Sru
7033035Scharnier	int		sc_ilr;
713229Spst
7233035Scharnier	/*
733229Spst	 * Bitmask of ports that use the serdev I/F. This allows for
7433035Scharnier	 * 32 ports on ILP32 machines and 64 ports on LP64 machines.
753229Spst	 */
7633035Scharnier	u_long		sc_serdevs;
773229Spst};
7833035Scharnier
793229Spststruct puc_bar *puc_get_bar(struct puc_softc *sc, int rid);
803229Spst
8133035Scharnierint puc_bfe_attach(device_t);
823229Spstint puc_bfe_detach(device_t);
833229Spstint puc_bfe_probe(device_t, const struct puc_cfg *);
843229Spst
8533035Scharnierint puc_bus_child_location_str(device_t, device_t, char *, size_t);
863229Spstint puc_bus_child_pnpinfo_str(device_t, device_t, char *, size_t);
8733035Scharnierstruct resource *puc_bus_alloc_resource(device_t, device_t, int, int *, u_long,
883229Spst    u_long, u_long, u_int);
893229Spstint puc_bus_get_resource(device_t, device_t, int, int, u_long *, u_long *);
9033035Scharnierint puc_bus_print_child(device_t, device_t);
913229Spstint puc_bus_read_ivar(device_t, device_t, int, uintptr_t *);
923229Spstint puc_bus_release_resource(device_t, device_t, int, int, struct resource *);
933229Spstint puc_bus_setup_intr(device_t, device_t, struct resource *, int,
9433035Scharnier    driver_filter_t *, driver_intr_t *, void *, void **);
953229Spstint puc_bus_teardown_intr(device_t, device_t, struct resource *, void *);
963229Spst
9779754Sdd#endif /* _DEV_PUC_BFE_H_ */
9833035Scharnier