#ifndef _BHND_BHNDBVAR_H_
#define _BHND_BHNDBVAR_H_
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/rman.h>
#include <dev/bhnd/bhndvar.h>
#include "bhndb.h"
#include "bhndb_if.h"
DECLARE_CLASS(bhndb_driver);
struct bhndb_intr_isrc;
struct bhndb_resources;
struct bhndb_host_resources;
int bhndb_attach(device_t dev,
struct bhnd_chipid *cid,
struct bhnd_core_info *cores, u_int ncores,
struct bhnd_core_info *bridge_core,
bhnd_erom_class_t *erom_class);
int bhndb_generic_probe(device_t dev);
int bhndb_generic_detach(device_t dev);
int bhndb_generic_suspend(device_t dev);
int bhndb_generic_resume(device_t dev);
int bhndb_generic_init_full_config(device_t dev,
device_t child,
const struct bhndb_hw_priority *hw_prio_table);
int bhnd_generic_br_suspend_child(device_t dev,
device_t child);
int bhnd_generic_br_resume_child(device_t dev,
device_t child);
int bhndb_find_hostb_core(
struct bhnd_core_info *cores, u_int ncores,
bhnd_devclass_t bridge_devclass,
struct bhnd_core_info *core);
struct bhndb_intr_isrc *bhndb_alloc_intr_isrc(device_t owner, int rid,
rman_res_t start, rman_res_t end,
rman_res_t count, u_int flags);
void bhndb_free_intr_isrc(
struct bhndb_intr_isrc *isrc);
int bhndb_alloc_host_resources(
struct bhndb_host_resources **resources,
device_t dev, device_t parent_dev,
const struct bhndb_hwcfg *hwcfg);
void bhndb_release_host_resources(
struct bhndb_host_resources *resources);
struct resource *bhndb_host_resource_for_range(
struct bhndb_host_resources *resources,
int type, rman_res_t start,
rman_res_t count);
struct resource *bhndb_host_resource_for_regwin(
struct bhndb_host_resources *resources,
const struct bhndb_regwin *win);
size_t bhndb_regwin_count(
const struct bhndb_regwin *table,
bhndb_regwin_type_t type);
const struct bhndb_regwin *bhndb_regwin_find_type(
const struct bhndb_regwin *table,
bhndb_regwin_type_t type,
bus_size_t min_size);
const struct bhndb_regwin *bhndb_regwin_find_core(
const struct bhndb_regwin *table,
bhnd_devclass_t class, int unit,
bhnd_port_type port_type, u_int port,
u_int region, bus_size_t offset,
bus_size_t min_size);
const struct bhndb_regwin *bhndb_regwin_find_best(
const struct bhndb_regwin *table,
bhnd_devclass_t class, int unit,
bhnd_port_type port_type, u_int port,
u_int region, bus_size_t offset,
bus_size_t min_size);
bool bhndb_regwin_match_core(
const struct bhndb_regwin *regw,
struct bhnd_core_info *core);
typedef enum {
BHNDB_ADDRSPACE_BRIDGED,
BHNDB_ADDRSPACE_NATIVE
} bhndb_addrspace;
struct bhndb_devinfo {
bhndb_addrspace addrspace;
struct resource_list resources;
};
struct bhndb_intr_isrc {
device_t is_owner;
struct resource *is_res;
int is_rid;
};
struct bhndb_host_resources {
device_t owner;
const struct bhndb_hwcfg *cfg;
struct resource_spec *resource_specs;
struct resource **resources;
bus_dma_tag_t *dma_tags;
size_t num_dma_tags;
};
struct bhndb_softc {
device_t dev;
struct bhnd_chipid chipid;
struct bhnd_core_info bridge_core;
device_t parent_dev;
device_t bus_dev;
struct bhnd_service_registry services;
struct mtx sc_mtx;
struct bhndb_resources *bus_res;
STAILQ_HEAD(,bhndb_intr_handler) bus_intrs;
};
#endif