1/* 2 * Copyright 2009, Colin Günther, coling@gmx.de. All Rights Reserved. 3 * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved. 4 * Copyright 2007, Hugo Santos. All Rights Reserved. 5 * Copyright 2004, Marcus Overhagen. All Rights Reserved. 6 * Distributed under the terms of the MIT License. 7 */ 8#ifndef DEVICE_H 9#define DEVICE_H 10 11 12#include <stdint.h> 13#include <stdio.h> 14 15#include <KernelExport.h> 16#include <drivers/PCI.h> 17 18#include <util/list.h> 19 20#include <net_stack.h> 21 22#include <compat/sys/kernel.h> 23#include <compat/net/if.h> 24 25#include "shared.h" 26 27#ifdef __cplusplus 28extern "C" { 29#endif 30 31struct root_device_softc { 32 struct pci_info pci_info; 33}; 34 35enum { 36 DEVICE_OPEN = 1 << 0, 37 DEVICE_CLOSED = 1 << 1, 38 DEVICE_NON_BLOCK = 1 << 2, 39 DEVICE_DESC_ALLOCED = 1 << 3, 40 DEVICE_ATTACHED = 1 << 4 41}; 42 43 44extern struct net_stack_module_info *gStack; 45extern pci_module_info *gPci; 46extern struct pci_x86_module_info *gPCIx86; 47 48 49static inline void 50__unimplemented(const char *method) 51{ 52 char msg[128]; 53 snprintf(msg, sizeof(msg), "fbsd compat, unimplemented: %s", method); 54 panic(msg); 55} 56 57#define UNIMPLEMENTED() __unimplemented(__FUNCTION__) 58 59status_t init_mbufs(void); 60void uninit_mbufs(void); 61 62status_t init_mutexes(void); 63void uninit_mutexes(void); 64 65status_t init_taskqueues(void); 66void uninit_taskqueues(void); 67 68status_t init_hard_clock(void); 69void uninit_hard_clock(void); 70 71status_t init_callout(void); 72void uninit_callout(void); 73 74device_t find_root_device(int); 75 76/* busdma_machdep.c */ 77void init_bounce_pages(void); 78void uninit_bounce_pages(void); 79 80void driver_printf(const char *format, ...) 81 __attribute__ ((format (__printf__, 1, 2))); 82void driver_vprintf(const char *format, va_list vl); 83 84void device_sprintf_name(device_t dev, const char *format, ...) 85 __attribute__ ((format (__printf__, 2, 3))); 86 87void ifq_init(struct ifqueue *, const char *); 88void ifq_uninit(struct ifqueue *); 89 90#ifdef __cplusplus 91} 92#endif 93 94#endif /* DEVICE_H */ 95