Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ow/ow.c
Show All 31 Lines | |||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/errno.h> | #include <sys/errno.h> | ||||
#include <sys/libkern.h> | #include <sys/libkern.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/sbuf.h> | |||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <dev/ow/ow.h> | #include <dev/ow/ow.h> | ||||
#include <dev/ow/owll.h> | #include <dev/ow/owll.h> | ||||
#include <dev/ow/own.h> | #include <dev/ow/own.h> | ||||
/* | /* | ||||
* lldev - link level device | * lldev - link level device | ||||
▲ Show 20 Lines • Show All 536 Lines • ▼ Show 20 Lines | for (i = 0; i < nkid; i++) { | ||||
device_delete_child(ndev, child); | device_delete_child(ndev, child); | ||||
} | } | ||||
free(children, M_TEMP); | free(children, M_TEMP); | ||||
OW_LOCK_DESTROY(sc); | OW_LOCK_DESTROY(sc); | ||||
return 0; | return 0; | ||||
} | } | ||||
/* | |||||
* Not sure this is really needed. I'm having trouble figuring out what | |||||
* location means in the context of the one wire bus. | |||||
*/ | |||||
static int | static int | ||||
ow_child_location_str(device_t dev, device_t child, char *buf, | ow_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb) | ||||
size_t buflen) | |||||
{ | { | ||||
*buf = '\0'; | |||||
return (0); | |||||
} | |||||
static int | |||||
ow_child_pnpinfo_str(device_t dev, device_t child, char *buf, | |||||
size_t buflen) | |||||
{ | |||||
struct ow_devinfo *di; | struct ow_devinfo *di; | ||||
di = device_get_ivars(child); | di = device_get_ivars(child); | ||||
snprintf(buf, buflen, "romid=%8D", &di->romid, ":"); | sbuf_printf(sb, "romid=%8D", &di->romid, ":"); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
ow_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) | ow_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) | ||||
{ | { | ||||
struct ow_devinfo *di; | struct ow_devinfo *di; | ||||
romid_t **ptr; | romid_t **ptr; | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||
static device_method_t ow_methods[] = { | static device_method_t ow_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, ow_probe), | DEVMETHOD(device_probe, ow_probe), | ||||
DEVMETHOD(device_attach, ow_attach), | DEVMETHOD(device_attach, ow_attach), | ||||
DEVMETHOD(device_detach, ow_detach), | DEVMETHOD(device_detach, ow_detach), | ||||
/* Bus interface */ | /* Bus interface */ | ||||
DEVMETHOD(bus_child_pnpinfo_str, ow_child_pnpinfo_str), | DEVMETHOD(bus_child_pnpinfo, ow_child_pnpinfo), | ||||
DEVMETHOD(bus_child_location_str, ow_child_location_str), | |||||
DEVMETHOD(bus_read_ivar, ow_read_ivar), | DEVMETHOD(bus_read_ivar, ow_read_ivar), | ||||
DEVMETHOD(bus_write_ivar, ow_write_ivar), | DEVMETHOD(bus_write_ivar, ow_write_ivar), | ||||
DEVMETHOD(bus_print_child, ow_print_child), | DEVMETHOD(bus_print_child, ow_print_child), | ||||
DEVMETHOD(bus_probe_nomatch, ow_probe_nomatch), | DEVMETHOD(bus_probe_nomatch, ow_probe_nomatch), | ||||
/* One Wire Network/Transport layer interface */ | /* One Wire Network/Transport layer interface */ | ||||
DEVMETHOD(own_send_command, ow_send_command), | DEVMETHOD(own_send_command, ow_send_command), | ||||
DEVMETHOD(own_acquire_bus, ow_acquire_bus), | DEVMETHOD(own_acquire_bus, ow_acquire_bus), | ||||
Show All 13 Lines |