DF-5042 / fkdecl.h
/* * fkdecl.h — observation shims for the DF-5042 / DF-5043 verbatim replay of * adv_pci_attach() (sys/dev/disk/advansys/adv_pci.c). * * The four driver translation units (adv_pci.c included verbatim into * wrapper.c, plus advansys.c / advlib.c / advmcode.c compiled verbatim) are * compiled UNMODIFIED except that a handful of bus/PCI externals are renamed * on the compiler command line (-Dname=fk_name) to the observation shims * defined in wrapper.c. Every shim forwards to the real kernel function * after recording the call; only the functions listed below differ: * * fk_pci_read_config / fk_pci_write_config scripted PCI config space * fk_bus_alloc_resource / fk_bus_release_resource fake struct resource * (r_bustag/r_bushandle point at a real pmap_mapdev_uncacheable * window so rman_get_bustag/bushandle return the fake chip) * fk_bus_setup_intr scripted failure (mode 2) * fk_adv_alloc adv_alloc on OUR softc * fk_adv_init mode 1: REAL adv_init() * (fails at the halt check); * mode 2: scripted success * fk_bus_dma_tag_create / fk_bus_dma_tag_destroy * forward + count per-tag create/destroy */ #ifndef FKDECL_H #define FKDECL_H #include <sys/param.h> #include <sys/types.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/queue.h> #include <sys/lock.h> #include <sys/bus.h> /* device_t, driver_intr_t, lwkt_serialize_t */ #include <sys/bus_dma.h> /* bus_dma_tag_t */ #include <sys/rman.h> #include <machine/bus_dma.h> /* bus_space_tag_t/handle_t, X86_64_BUS_SPACE_MEM */ #include "advansys.h" /* struct adv_softc (needs the above first) */ u_int32_t fk_pci_read_config(device_t dev, int reg, int width); void fk_pci_write_config(device_t dev, int reg, uint32_t val, int width); struct resource *fk_bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); int fk_bus_release_resource(device_t dev, int type, int rid, struct resource *res); int fk_bus_setup_intr(device_t dev, struct resource *r, int flags, driver_intr_t handler, void *arg, void **cookiep, lwkt_serialize_t serializer); struct adv_softc *fk_adv_alloc(device_t dev, bus_space_tag_t tag, bus_space_handle_t bsh); int fk_adv_init(struct adv_softc *adv); int fk_find_signature(bus_space_tag_t tag, bus_space_handle_t bsh); int fk_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, bus_size_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_tag_t *dmat); int fk_bus_dma_tag_destroy(bus_dma_tag_t dmat); #endif /* FKDECL_H */ |