Changeset View
Changeset View
Standalone View
Standalone View
stand/kshim/bsd_kernel.h
| Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
| #define PI_SWI(...) (0) | #define PI_SWI(...) (0) | ||||
| #define UNIQ_NAME(x) x | #define UNIQ_NAME(x) x | ||||
| #define UNIQ_NAME_STR(x) #x | #define UNIQ_NAME_STR(x) #x | ||||
| #define DEVCLASS_MAXUNIT 32 | #define DEVCLASS_MAXUNIT 32 | ||||
| #define MOD_LOAD 1 | #define MOD_LOAD 1 | ||||
| #define MOD_UNLOAD 2 | #define MOD_UNLOAD 2 | ||||
| #define DEVMETHOD(what,func) { #what, (void *)&func } | #define DEVMETHOD(what,func) { #what, (void *)&func } | ||||
| #define DEVMETHOD_END {0,0} | #define DEVMETHOD_END {0,0} | ||||
| #define EARLY_DRIVER_MODULE(a, b, c, d, e, f, g) DRIVER_MODULE(a, b, c, d, e, f) | #define EARLY_DRIVER_MODULE(a, b, c, d, e, f) DRIVER_MODULE(a, b, c, d, e) | ||||
| #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg) \ | #define DRIVER_MODULE(name, busname, driver, evh, arg) \ | ||||
| static struct module_data bsd_##name##_##busname##_driver_mod = { \ | static struct module_data bsd_##name##_##busname##_driver_mod = { \ | ||||
| evh, arg, #busname, #name, #busname "/" #name, \ | evh, arg, #busname, #name, #busname "/" #name, \ | ||||
| &driver, &devclass, { 0, 0 } }; \ | &driver, { 0, 0 } }; \ | ||||
| SYSINIT(bsd_##name##_##busname##_driver_mod, SI_SUB_DRIVERS, \ | SYSINIT(bsd_##name##_##busname##_driver_mod, SI_SUB_DRIVERS, \ | ||||
| SI_ORDER_MIDDLE, module_register, \ | SI_ORDER_MIDDLE, module_register, \ | ||||
| &bsd_##name##_##busname##_driver_mod) | &bsd_##name##_##busname##_driver_mod) | ||||
| #define SYSINIT(uniq, subs, order, _func, _data) \ | #define SYSINIT(uniq, subs, order, _func, _data) \ | ||||
| const struct sysinit UNIQ_NAME(sysinit_##uniq) = { \ | const struct sysinit UNIQ_NAME(sysinit_##uniq) = { \ | ||||
| .func = (_func), \ | .func = (_func), \ | ||||
| .data = __DECONST(void *, _data) \ | .data = __DECONST(void *, _data) \ | ||||
| }; \ | }; \ | ||||
| Show All 27 Lines | |||||
| #define MTX_SPIN 0 | #define MTX_SPIN 0 | ||||
| #define MTX_RECURSE 0 | #define MTX_RECURSE 0 | ||||
| #define SX_DUPOK 0 | #define SX_DUPOK 0 | ||||
| #define SX_NOWITNESS 0 | #define SX_NOWITNESS 0 | ||||
| #define WITNESS_WARN(...) | #define WITNESS_WARN(...) | ||||
| #define cold 0 | #define cold 0 | ||||
| #define BUS_PROBE_GENERIC 0 | #define BUS_PROBE_GENERIC 0 | ||||
| #define BUS_PROBE_DEFAULT (-20) | #define BUS_PROBE_DEFAULT (-20) | ||||
| #define DEVICE_UNIT_ANY -1 | |||||
| #define CALLOUT_RETURNUNLOCKED 0x1 | #define CALLOUT_RETURNUNLOCKED 0x1 | ||||
| #undef ffs | #undef ffs | ||||
| #define ffs(x) __builtin_ffs(x) | #define ffs(x) __builtin_ffs(x) | ||||
| #undef va_list | #undef va_list | ||||
| #define va_list __builtin_va_list | #define va_list __builtin_va_list | ||||
| #undef va_size | #undef va_size | ||||
| #define va_size(type) __builtin_va_size(type) | #define va_size(type) __builtin_va_size(type) | ||||
| #undef va_start | #undef va_start | ||||
| ▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| typedef struct device_method device_method_t; | typedef struct device_method device_method_t; | ||||
| struct device { | struct device { | ||||
| TAILQ_HEAD(device_list, device) dev_children; | TAILQ_HEAD(device_list, device) dev_children; | ||||
| TAILQ_ENTRY(device) dev_link; | TAILQ_ENTRY(device) dev_link; | ||||
| devclass_t dev_class; | |||||
| struct device *dev_parent; | struct device *dev_parent; | ||||
| const struct module_data *dev_module; | const struct module_data *dev_module; | ||||
| void *dev_sc; | void *dev_sc; | ||||
| void *dev_aux; | void *dev_aux; | ||||
| driver_filter_t *dev_irq_filter; | driver_filter_t *dev_irq_filter; | ||||
| driver_intr_t *dev_irq_fn; | driver_intr_t *dev_irq_fn; | ||||
| void *dev_irq_arg; | void *dev_irq_arg; | ||||
| uint16_t dev_unit; | uint16_t dev_unit; | ||||
| char dev_nameunit[64]; | char dev_nameunit[64]; | ||||
| char dev_desc[64]; | char dev_desc[64]; | ||||
| uint8_t dev_res_alloc:1; | uint8_t dev_res_alloc:1; | ||||
| uint8_t dev_quiet:1; | uint8_t dev_quiet:1; | ||||
| uint8_t dev_softc_set:1; | uint8_t dev_softc_set:1; | ||||
| uint8_t dev_softc_alloc:1; | uint8_t dev_softc_alloc:1; | ||||
| uint8_t dev_attached:1; | uint8_t dev_attached:1; | ||||
| uint8_t dev_fixed_class:1; | uint8_t dev_fixed_class:1; | ||||
| uint8_t dev_unit_manual:1; | uint8_t dev_unit_manual:1; | ||||
| }; | }; | ||||
| struct devclass { | struct devclass { | ||||
| TAILQ_ENTRY(devclass) link; | |||||
| const char *name; | |||||
| device_t dev_list[DEVCLASS_MAXUNIT]; | device_t dev_list[DEVCLASS_MAXUNIT]; | ||||
| }; | }; | ||||
| struct driver { | struct driver { | ||||
| const char *name; | const char *name; | ||||
| const struct device_method *methods; | const struct device_method *methods; | ||||
| uint32_t size; | uint32_t size; | ||||
| }; | }; | ||||
| struct module_data { | struct module_data { | ||||
| int (*callback) (struct module *, int, void *arg); | int (*callback) (struct module *, int, void *arg); | ||||
| void *arg; | void *arg; | ||||
| const char *bus_name; | const char *bus_name; | ||||
| const char *mod_name; | const char *mod_name; | ||||
| const char *long_name; | const char *long_name; | ||||
| const struct driver *driver; | const struct driver *driver; | ||||
| struct devclass **devclass_pp; | |||||
| TAILQ_ENTRY(module_data) entry; | TAILQ_ENTRY(module_data) entry; | ||||
| }; | }; | ||||
| device_t device_get_parent(device_t dev); | device_t device_get_parent(device_t dev); | ||||
| void *device_get_method(device_t dev, const char *what); | void *device_get_method(device_t dev, const char *what); | ||||
| const char *device_get_name(device_t dev); | const char *device_get_name(device_t dev); | ||||
| const char *device_get_nameunit(device_t dev); | const char *device_get_nameunit(device_t dev); | ||||
| ▲ Show 20 Lines • Show All 261 Lines • Show Last 20 Lines | |||||