1dba28784SAugustin Cavalier /* 2dba28784SAugustin Cavalier * Copyright 2009, Colin Günther, coling@gmx.de. All Rights Reserved. 3dba28784SAugustin Cavalier * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved. 4dba28784SAugustin Cavalier * Copyright 2007, Hugo Santos. All Rights Reserved. 5dba28784SAugustin Cavalier * Copyright 2004, Marcus Overhagen. All Rights Reserved. 6dba28784SAugustin Cavalier * Distributed under the terms of the MIT License. 7dba28784SAugustin Cavalier */ 8dba28784SAugustin Cavalier #ifndef SHARED_H_ 9dba28784SAugustin Cavalier #define SHARED_H_ 10dba28784SAugustin Cavalier 11dba28784SAugustin Cavalier 12dba28784SAugustin Cavalier #include <sys/bus.h> 13dba28784SAugustin Cavalier 14dba28784SAugustin Cavalier 15dba28784SAugustin Cavalier #define MAX_DEVICES 8 16dba28784SAugustin Cavalier 17dba28784SAugustin Cavalier 18dba28784SAugustin Cavalier struct ifnet; 19dba28784SAugustin Cavalier 20dba28784SAugustin Cavalier struct device { 21dba28784SAugustin Cavalier struct device *parent; 22dba28784SAugustin Cavalier struct device *root; 23dba28784SAugustin Cavalier 24dba28784SAugustin Cavalier driver_t *driver; 25dba28784SAugustin Cavalier struct list children; 26dba28784SAugustin Cavalier 27dba28784SAugustin Cavalier uint32 flags; 28dba28784SAugustin Cavalier 29dba28784SAugustin Cavalier char device_name[128]; 30dba28784SAugustin Cavalier int unit; 31dba28784SAugustin Cavalier char nameunit[64]; 32dba28784SAugustin Cavalier const char *description; 33dba28784SAugustin Cavalier void *softc; 34dba28784SAugustin Cavalier void *ivars; 35dba28784SAugustin Cavalier 36dba28784SAugustin Cavalier struct { 37*c25e20c5SAugustin Cavalier void* (*device_register)(device_t dev); 38dba28784SAugustin Cavalier int (*probe)(device_t dev); 39dba28784SAugustin Cavalier int (*attach)(device_t dev); 40dba28784SAugustin Cavalier int (*detach)(device_t dev); 41dba28784SAugustin Cavalier int (*suspend)(device_t dev); 42dba28784SAugustin Cavalier int (*resume)(device_t dev); 43dba28784SAugustin Cavalier void (*shutdown)(device_t dev); 44dba28784SAugustin Cavalier 45dba28784SAugustin Cavalier int (*miibus_readreg)(device_t, int, int); 46dba28784SAugustin Cavalier int (*miibus_writereg)(device_t, int, int, int); 47dba28784SAugustin Cavalier void (*miibus_statchg)(device_t); 48dba28784SAugustin Cavalier void (*miibus_linkchg)(device_t); 49dba28784SAugustin Cavalier void (*miibus_mediainit)(device_t); 50dba28784SAugustin Cavalier 51dba28784SAugustin Cavalier int (*bus_child_location_str)(device_t dev __unused, device_t child, 52dba28784SAugustin Cavalier char *buf, size_t buflen); 53dba28784SAugustin Cavalier int (*bus_child_pnpinfo_str)(device_t dev __unused, device_t child, 54dba28784SAugustin Cavalier char *buf, size_t buflen); 55dba28784SAugustin Cavalier void (*bus_hinted_child)(device_t dev, const char *name, int unit); 56dba28784SAugustin Cavalier int (*bus_print_child)(device_t dev, device_t child); 57dba28784SAugustin Cavalier int (*bus_read_ivar)(device_t dev, device_t child __unused, int which, 58dba28784SAugustin Cavalier uintptr_t *result); 59dba28784SAugustin Cavalier bus_dma_tag_t (*bus_get_dma_tag)(device_t dev); 60dba28784SAugustin Cavalier } methods; 61dba28784SAugustin Cavalier 62dba28784SAugustin Cavalier struct list_link link; 63dba28784SAugustin Cavalier }; 64dba28784SAugustin Cavalier 65dba28784SAugustin Cavalier 66dba28784SAugustin Cavalier extern const char *gDeviceNameList[]; 67dba28784SAugustin Cavalier extern struct ifnet *gDevices[]; 68dba28784SAugustin Cavalier extern int32 gDeviceCount; 69dba28784SAugustin Cavalier 70dba28784SAugustin Cavalier #endif /* SHARED_H_ */ 71