First roll of renames: pnp_node_hamdle is now device_node_handle, pnp_node_attr

is now device_attr, pnp_bus_info bus_module_info, pnp_driver_info driver_module_info, ...
Small cleanup (more would be needed, but this has time).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10670 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-01-11 23:19:41 +00:00
parent b1e0087b8c
commit b83a8af4e0
9 changed files with 177 additions and 240 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ typedef struct phys_vecs {
// interface to be provided by device driver
typedef struct blkdev_interface {
pnp_driver_info dinfo;
driver_module_info dinfo;
// iovecs are physical address here
// pos and num_blocks are in blocks; bytes_transferred in bytes
+3 -3
View File
@@ -319,7 +319,7 @@ typedef struct ide_channel_info *ide_channel_cookie;
// interface of controller driver
typedef struct {
pnp_driver_info dinfo;
driver_module_info info;
status_t (*write_command_block_regs)
(ide_channel_cookie channel, ide_task_file *tf, ide_reg_mask mask);
@@ -349,7 +349,7 @@ typedef struct ide_bus_info *ide_channel;
// interface of bus manager as seen from controller driver
// use this interface as the fixed consumer of your controller driver
typedef struct {
pnp_driver_info dinfo;
driver_module_info info;
// status - status read from controller (_not_ alt_status, as reading
// normal status acknowledges IRQ request of device)
@@ -360,4 +360,4 @@ typedef struct {
#define IDE_FOR_CONTROLLER_MODULE_NAME "bus_managers/ide/controller/v1"
#endif
#endif /* __IDE_H__ */
+2 -2
View File
@@ -35,8 +35,8 @@
#define B_MAX_ISA_DMA_COUNT 0x10000
typedef struct isa2_module_info {
pnp_bus_info binfo;
bus_module_info info;
uint8 (*read_io_8)( int mapped_io_addr );
void (*write_io_8)( int mapped_io_addr, uint8 value );
uint16 (*read_io_16)( int mapped_io_addr );
+1 -1
View File
@@ -87,7 +87,7 @@ typedef struct pci_device_info *pci_device;
// Actually, this is a _function_ of a device only, but
// pci_function_module_info would be a bit non-intuitive
typedef struct pci_device_module_info {
pnp_driver_info dinfo;
driver_module_info info;
uint8 (*read_io_8) (pci_device device, int mapped_io_addr);
void (*write_io_8) (pci_device device, int mapped_io_addr, uint8 value);
+35 -37
View File
@@ -1,7 +1,9 @@
/*
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef __SCSI_BUSMANAGER_H__
#define __SCSI_BUSMANAGER_H__
/*
Part of Open SCSI bus manager
@@ -90,10 +92,6 @@
may be enhanced/generalized in the future.
*/
// warning: Be defined a scsi.h (lower case) header file already,
// so we cannot use that for the ifdef
#ifndef __SCSI_BUSMANAGER_H__
#define __SCSI_BUSMANAGER_H__
#include <KernelExport.h>
#include <device_manager.h>
@@ -295,29 +293,29 @@ typedef struct
// bus manager device interface for peripheral driver
typedef struct scsi_device_interface {
pnp_driver_info dinfo;
driver_module_info info;
// get CCB
// warning: if pool of CCBs is exhausted, this call is delayed until a
// CCB is freed, so don't try to allocate more then one CCB at once!
scsi_ccb *(*alloc_ccb)( scsi_device device );
scsi_ccb *(*alloc_ccb)(scsi_device device);
// free CCB
void (*free_ccb)( scsi_ccb *ccb );
void (*free_ccb)(scsi_ccb *ccb);
// execute command asynchronously
// when it's finished, the semaphore of the ccb is released
// you must provide a S/G list if data_len != 0
void (*async_io)( scsi_ccb *ccb );
void (*async_io)(scsi_ccb *ccb);
// execute command synchronously
// you don't need to provide a S/G list nor have to lock data
void (*sync_io)( scsi_ccb *ccb );
void (*sync_io)(scsi_ccb *ccb);
// abort request
uchar (*abort)( scsi_ccb *ccb_to_abort );
uchar (*abort)(scsi_ccb *ccb_to_abort);
// reset device
uchar (*reset_device)( scsi_device device );
uchar (*reset_device)(scsi_device device);
// terminate request
uchar (*term_io)( scsi_ccb *ccb_to_terminate );
uchar (*term_io)(scsi_ccb *ccb_to_terminate);
} scsi_device_interface;
#define SCSI_DEVICE_MODULE_NAME "bus_managers/scsi/driver/v1"
@@ -336,12 +334,12 @@ typedef struct scsi_device_interface {
// This interface can be used by peripheral drivers to access the
// bus directly.
typedef struct scsi_bus_interface {
pnp_bus_info binfo;
bus_module_info info;
// get information about host controller
uchar (*path_inquiry)( scsi_bus bus, scsi_path_inquiry *inquiry_data );
uchar (*path_inquiry)(scsi_bus bus, scsi_path_inquiry *inquiry_data);
// reset SCSI bus
uchar (*reset_bus)( scsi_bus bus );
uchar (*reset_bus)(scsi_bus bus);
} scsi_bus_interface;
// name of SCSI bus node driver
@@ -357,8 +355,8 @@ typedef struct scsi_dpc_info *scsi_dpc_cookie;
// SCSI controller drivers get this interface passed via their init_device
// method. Further, they must specify this driver as their fixed consumer.
typedef struct scsi_for_sim_interface {
pnp_driver_info dinfo;
driver_module_info info;
// put request into wait queue because of overflow
// bus_overflow: true - too many bus requests
// false - too many device requests
@@ -366,41 +364,41 @@ typedef struct scsi_for_sim_interface {
// is called or a request is finished via finished();
// to avoid race conditions (reporting a full and a available bus at once)
// the SIM should synchronize calls to requeue, resubmit and finished
void (*requeue)( scsi_ccb *ccb, bool bus_overflow );
void (*requeue)(scsi_ccb *ccb, bool bus_overflow);
// resubmit request ASAP
// to be used if execution of request went wrong and must be retried
void (*resubmit)( scsi_ccb *ccb );
void (*resubmit)(scsi_ccb *ccb);
// mark request as being finished
// num_requests: number of requests that were handled by device
// when the request was sent (read: how full was the device
// queue); needed to find out how large the device queue is;
// e.g. if three were already running plus this request makes
// num_requests=4
void (*finished)( scsi_ccb *ccb, uint num_requests );
void (*finished)(scsi_ccb *ccb, uint num_requests);
// following functions return error on invalid arguments only
status_t (*alloc_dpc)( scsi_dpc_cookie *dpc );
status_t (*free_dpc)( scsi_dpc_cookie dpc );
status_t (*schedule_dpc)( scsi_bus cookie, scsi_dpc_cookie dpc, /*int flags,*/
void (*func)( void * ), void *arg );
status_t (*alloc_dpc)(scsi_dpc_cookie *dpc);
status_t (*free_dpc)(scsi_dpc_cookie dpc);
status_t (*schedule_dpc)(scsi_bus cookie, scsi_dpc_cookie dpc, /*int flags,*/
void (*func)( void * ), void *arg);
// block entire bus (can be nested)
// no more request will be submitted to this bus
void (*block_bus)( scsi_bus bus );
void (*block_bus)(scsi_bus bus);
// unblock entire bus
// requests will be submitted to bus ASAP
void (*unblock_bus)( scsi_bus bus );
void (*unblock_bus)(scsi_bus bus);
// block one device
// no more requests will be submitted to this device
void (*block_device)( scsi_device device );
void (*block_device)(scsi_device device);
// unblock device
// requests for this device will be submitted ASAP
void (*unblock_device)( scsi_device device );
void (*unblock_device)(scsi_device device);
// terminate bus overflow condition (see "requeue")
void (*cont_send_bus)( scsi_bus bus );
void (*cont_send_bus)(scsi_bus bus);
// terminate device overflow condition (see "requeue")
void (*cont_send_device)( scsi_device device );
void (*cont_send_device)(scsi_device device);
} scsi_for_sim_interface;
@@ -421,7 +419,7 @@ typedef struct scsi_sim_cookie *scsi_sim_cookie;
// SIM interface
// SCSI controller drivers must provide this interface
typedef struct scsi_sim_interface {
pnp_driver_info dinfo;
driver_module_info info;
// execute request
void (*scsi_io)( scsi_sim_cookie cookie, scsi_ccb *ccb );
@@ -456,4 +454,4 @@ typedef struct scsi_sim_interface {
} scsi_sim_interface;
#endif
#endif /* __SCSI_BUSMANAGER_H__ */
+58 -62
View File
@@ -1,7 +1,11 @@
/*
** Copyright 2002-04, Thomas Kurschel. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2002-04, Thomas Kurschel. All rights reserved.
*
* Distributed under the terms of the MIT License.
*/
#ifndef _IDE_PCI_H
#define _IDE_PCI_H
/*
IDE adapter library
@@ -12,8 +16,6 @@
free to access any controller or channel data of this library.
*/
#ifndef _IDE_PCI_H
#define _IDE_PCI_H
#include <bus/PCI.h>
#include <bus/IDE.h>
@@ -114,7 +116,7 @@ typedef struct ide_adapter_channel_info {
// be accessed anymore
ide_channel ide_channel;
pnp_node_handle node;
device_node_handle node;
int32 (*inthand)( void *arg );
@@ -135,90 +137,84 @@ typedef struct ide_adapter_controller_info {
uint32 lost; // != 0 if device got removed, i.e. if it must not
// be accessed anymore
pnp_node_handle node;
device_node_handle node;
} ide_adapter_controller_info;
// interface of IDE adapter library
typedef struct {
module_info minfo;
module_info info;
// function calls that can be forwarded from actual driver
status_t (*write_command_block_regs)
(ide_adapter_channel_info *channel, ide_task_file *tf, ide_reg_mask mask);
status_t (*read_command_block_regs)
(ide_adapter_channel_info *channel, ide_task_file *tf, ide_reg_mask mask);
status_t (*write_command_block_regs)(ide_adapter_channel_info *channel,
ide_task_file *tf, ide_reg_mask mask);
status_t (*read_command_block_regs)(ide_adapter_channel_info *channel,
ide_task_file *tf, ide_reg_mask mask);
uint8 (*get_altstatus) (ide_adapter_channel_info *channel);
status_t (*write_device_control) (ide_adapter_channel_info *channel, uint8 val);
status_t (*write_pio) (ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit );
status_t (*read_pio) (ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit );
status_t (*write_pio)(ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit);
status_t (*read_pio)(ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit);
status_t (*prepare_dma)(ide_adapter_channel_info *channel,
const physical_entry *sg_list, size_t sg_list_count,
bool to_device );
status_t (*prepare_dma)(ide_adapter_channel_info *channel, const physical_entry *sg_list,
size_t sg_list_count, bool to_device);
status_t (*start_dma)(ide_adapter_channel_info *channel);
status_t (*finish_dma)(ide_adapter_channel_info *channel);
// default functions that should be replaced by a more specific version
// (copy them from source code of this library and modify them at will)
int32 (*inthand)( void *arg );
int32 (*inthand)(void *arg);
// functions that must be called by init/uninit etc. of channel driver
status_t (*init_channel)( pnp_node_handle node, ide_channel ide_channel,
ide_adapter_channel_info **cookie, size_t total_data_size,
int32 (*inthand)( void *arg ) );
status_t (*uninit_channel)( ide_adapter_channel_info *channel );
void (*channel_removed)( pnp_node_handle node, ide_adapter_channel_info *channel );
status_t (*init_channel)(device_node_handle node, ide_channel ide_channel,
ide_adapter_channel_info **cookie, size_t total_data_size,
int32 (*inthand)(void *arg));
status_t (*uninit_channel)(ide_adapter_channel_info *channel);
void (*channel_removed)(device_node_handle node, ide_adapter_channel_info *channel);
// publish channel node
status_t (*publish_channel)( pnp_node_handle controller_node,
const char *channel_module_name,
uint16 command_block_base, uint16 control_block_base,
uint8 intnum, bool can_dma, bool is_primary, const char *name,
io_resource_handle *resources, pnp_node_handle *node );
status_t (*publish_channel)(device_node_handle controller_node,
const char *channel_module_name, uint16 command_block_base,
uint16 control_block_base, uint8 intnum, bool can_dma,
bool is_primary, const char *name,
io_resource_handle *resources, device_node_handle *node);
// verify channel configuration and publish node on success
status_t (*detect_channel)(
pci_device_module_info *pci, pci_device pci_device,
pnp_node_handle controller_node,
const char *channel_module_name, bool controller_can_dma,
uint16 command_block_base, uint16 control_block_base, uint16 bus_master_base,
uint8 intnum, bool is_primary, const char *name, pnp_node_handle *node,
bool supports_compatibility_mode );
status_t (*detect_channel)(pci_device_module_info *pci, pci_device pci_device,
device_node_handle controller_node, const char *channel_module_name,
bool controller_can_dma, uint16 command_block_base,
uint16 control_block_base, uint16 bus_master_base,
uint8 intnum, bool is_primary, const char *name,
device_node_handle *node, bool supports_compatibility_mode);
// functions that must be called by init/uninit etc. of controller driver
status_t (*init_controller)( pnp_node_handle node, void *user_cookie,
ide_adapter_controller_info **cookie, size_t total_data_size );
status_t (*uninit_controller)( ide_adapter_controller_info *controller );
void (*controller_removed)( pnp_node_handle node, ide_adapter_controller_info *controller );
status_t (*init_controller)(device_node_handle node, void *user_cookie,
ide_adapter_controller_info **cookie, size_t total_data_size);
status_t (*uninit_controller)(ide_adapter_controller_info *controller);
void (*controller_removed)(device_node_handle node, ide_adapter_controller_info *controller);
// publish controller node
status_t (*publish_controller)(
pnp_node_handle parent,
uint16 bus_master_base, io_resource_handle *resources,
const char *controller_driver, const char *controller_driver_type,
const char *controller_name,
bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary,
uint32 max_sg_block_size, pnp_node_handle *node );
status_t (*publish_controller)(device_node_handle parent, uint16 bus_master_base,
io_resource_handle *resources, const char *controller_driver,
const char *controller_driver_type, const char *controller_name,
bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary,
uint32 max_sg_block_size, device_node_handle *node);
// verify controller configuration and publish node on success
status_t (*detect_controller)(
pci_device_module_info *pci, pci_device pci_device,
pnp_node_handle parent, uint16 bus_master_base,
const char *controller_driver, const char *controller_driver_type,
const char *controller_name,
bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary,
uint32 max_sg_block_size, pnp_node_handle *node );
status_t (*detect_controller)(pci_device_module_info *pci, pci_device pci_device,
device_node_handle parent, uint16 bus_master_base,
const char *controller_driver, const char *controller_driver_type,
const char *controller_name, bool can_dma, bool can_cq,
uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
device_node_handle *node);
// standard master probe for controller that registers controller and channel nodes
status_t (*probe_controller)( pnp_node_handle parent,
const char *controller_driver, const char *controller_driver_type,
const char *controller_name, const char *channel_module_name,
bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary,
uint32 max_sg_block_size, bool supports_compatibility_mode );
status_t (*probe_controller)(device_node_handle parent, const char *controller_driver,
const char *controller_driver_type, const char *controller_name,
const char *channel_module_name, bool can_dma, bool can_cq,
uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
bool supports_compatibility_mode);
} ide_adapter_interface;
#define IDE_ADAPTER_MODULE_NAME "generic/ide_adapter/v1"
#endif
#endif /* _IDE_PCI_H */
+3 -4
View File
@@ -84,7 +84,7 @@ typedef struct scsi_periph_callbacks {
// functions provided by this module
typedef struct scsi_periph_interface {
module_info module;
module_info info;
// *** init/cleanup ***
status_t (*register_device)(
@@ -92,7 +92,7 @@ typedef struct scsi_periph_interface {
scsi_periph_callbacks *callbacks,
scsi_device scsi_device,
scsi_device_interface *scsi,
pnp_node_handle node,
device_node_handle node,
bool removable,
scsi_periph_device *driver );
status_t (*unregister_device)( scsi_periph_device driver );
@@ -150,8 +150,7 @@ typedef struct scsi_periph_interface {
// compose device name consisting of prefix and path/target/LUN
// (result must be freed by caller)
char *(*compose_device_name)( pnp_node_handle device_node,
const char *prefix );
char *(*compose_device_name)(device_node_handle device_node, const char *prefix);
// fill data with icon (for B_GET_ICON ioctl)
status_t (*get_icon)( icon_type type, device_icon *data );
+73 -129
View File
@@ -1,3 +1,8 @@
/*
* Copyright 2004-2005, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
*/
/*
Copyright (c) 2003-04, Thomas Kurschel
@@ -156,7 +161,7 @@ typedef struct {
// ISA DMA channel: must be 1
} io_resource;
// attribute of device node
// attribute of a device node
typedef struct {
const char *name;
type_code type; // for supported types, see value
@@ -171,49 +176,40 @@ typedef struct {
size_t len;
} raw;
} value;
} pnp_node_attr;
} device_attr;
// handle of PnP node
typedef struct pnp_node_info *pnp_node_handle;
// handle of device node
typedef struct device_node_info *device_node_handle;
// handle of acquired I/O resource
typedef struct io_resource_info *io_resource_handle;
// handle of node attribute
typedef struct pnp_node_attr_info *pnp_node_attr_handle;
typedef struct device_attr_info *device_attr_handle;
typedef struct pnp_driver_info pnp_driver_info;
typedef struct driver_module_info driver_module_info;
// interface of PnP manager
typedef struct device_manager_info {
module_info minfo;
module_info info;
// load driver
// node - node whos driver is to be loaded
// user_cookie - cookie to be passed to init_device of driver
// interface - interface of loaded driver
// cookie - device cookie issued by loaded driver
status_t (*load_driver) (
pnp_node_handle node,
void *user_cookie,
pnp_driver_info **interface,
void **cookie
);
status_t (*load_driver)(device_node_handle node, void *userCookie,
driver_module_info **interface, void **cookie);
// unload driver
status_t (*unload_driver) (
pnp_node_handle node
);
status_t (*unload_driver)(device_node_handle node);
// rescan node for new dynamic drivers
// node - node whose dynamic drivers are to be scanned
// depth - recursive depth (>= 1)
status_t (*rescan) (
pnp_node_handle node,
uint depth
);
status_t (*rescan)(device_node_handle node, uint32 depth);
// register device
// parent - parent node
// attributes - NULL-terminated array of node attributes
@@ -222,63 +218,46 @@ typedef struct device_manager_info {
// on return, io_resources are invalid: on success I/O resources belong
// to node, on fail they are released;
// if device is already registered, B_OK is returned but *node is NULL
status_t (*register_device) (
pnp_node_handle parent,
const pnp_node_attr *attrs,
status_t (*register_device)(device_node_handle parent,
const device_attr *attrs,
const io_resource_handle *io_resources,
pnp_node_handle *node
);
device_node_handle *node);
// unregister device
// all nodes having this node as their parent are unregistered too.
// if the node contains PNP_MANAGER_ID_GENERATOR/PNP_MANAGER_AUTO_ID
// pairs, the id specified this way is freed too
status_t (*unregister_device) (
pnp_node_handle node
);
status_t (*unregister_device)(device_node_handle node);
// acquire I/O resources
// resources - NULL-terminated array of resources to acquire
// handles - NULL-terminated array of handles (one per resource);
// array must be provided by caller
// return B_BUSY if a resource is used by a loaded driver
status_t (*acquire_io_resources) (
io_resource *resources,
io_resource_handle *handles
);
status_t (*acquire_io_resources)(io_resource *resources,
io_resource_handle *handles);
// release I/O resources
// handles - NULL-terminated array of handles
status_t (*release_io_resources) (
const io_resource_handle *handles
);
status_t (*release_io_resources)(const io_resource_handle *handles);
// find device by node content
// the given attributes must _uniquely_ identify a device node;
// parent - parent node (-1 for don't-care)
// attrs - list of attributes (can be NULL)
// return: NULL if no device or multiple(!) devices found
pnp_node_handle (*find_device) (
pnp_node_handle parent,
const pnp_node_attr *attrs
);
device_node_handle (*find_device)(device_node_handle parent,
const device_attr *attrs);
// create unique id
// generator - name of id set
// if result >= 0 - unique id
// result < 0 - error code
int32 (*create_id)(
const char *generator
);
int32 (*create_id)(const char *generator);
// free unique id
status_t (*free_id)(
const char *generator,
uint32 id
);
status_t (*free_id)(const char *generator, uint32 id);
// get parent device node
pnp_node_handle (*get_parent)(
pnp_node_handle node
);
device_node_handle (*get_parent)(device_node_handle node);
// helpers to extract attribute by name.
// if <recursive> is true, parent nodes are scanned if
// attribute isn't found in current node; unless you declared
@@ -286,43 +265,19 @@ typedef struct device_manager_info {
// intermittent nodes, e.g. defined by filter drivers, transparently.
// for raw and string attributes, you get a copy that must
// be freed by caller
status_t (*get_attr_uint8)(
pnp_node_handle node,
const char *name,
uint8 *value,
bool recursive
);
status_t (*get_attr_uint16)(
pnp_node_handle node,
const char *name,
uint16 *value,
bool recursive
);
status_t (*get_attr_uint32)(
pnp_node_handle node,
const char *name,
uint32 *value,
bool recursive
);
status_t (*get_attr_uint64)(
pnp_node_handle node,
const char *name,
uint64 *value,
bool recursive
);
status_t (*get_attr_string)(
pnp_node_handle node,
const char *name,
char **value,
bool recursive
);
status_t (*get_attr_raw)(
pnp_node_handle node,
const char *name,
void **data,
size_t *len,
bool recursive
);
status_t (*get_attr_uint8)(device_node_handle node,
const char *name, uint8 *value, bool recursive);
status_t (*get_attr_uint16)(device_node_handle node,
const char *name, uint16 *value, bool recursive);
status_t (*get_attr_uint32)(device_node_handle node,
const char *name, uint32 *value, bool recursive);
status_t (*get_attr_uint64)(device_node_handle node,
const char *name, uint64 *value, bool recursive);
status_t (*get_attr_string)(device_node_handle node,
const char *name, char **value, bool recursive);
status_t (*get_attr_raw)(device_node_handle node,
const char *name, void **data, size_t *_size,
bool recursive);
// get next attribute of node;
// on call, *<attr_handle> must contain handle of an attribute;
@@ -332,38 +287,27 @@ typedef struct device_manager_info {
// the returned handle must be released by either passing it to
// another get_next_attr() call or by using release_attr()
// directly
status_t (*get_next_attr)(
pnp_node_handle node,
pnp_node_attr_handle *attr_handle
);
status_t (*get_next_attr)(device_node_handle node,
device_attr_handle *attrHandle);
// release attribute handle <attr_handle> of <node>;
// see get_next_attr
status_t (*release_attr)(
pnp_node_handle node,
pnp_node_attr_handle attr_handle
);
status_t (*release_attr)(device_node_handle node,
device_attr_handle attr_handle);
// retrieve attribute data with handle given;
// <attr> is only valid as long as you don't release <attr_handle>
// implicitely or explicitely
status_t (*retrieve_attr)(
pnp_node_attr_handle attr_handle,
const pnp_node_attr **attr
);
status_t (*retrieve_attr)(device_attr_handle attr_handle,
const device_attr **attr);
// change/add attribute <attr> of/to node
status_t (*write_attr)(
pnp_node_handle node,
const pnp_node_attr *attr
);
status_t (*write_attr)(device_node_handle node,
const device_attr *attr);
// remove attribute of node by name
// <name> is name of attribute
status_t (*remove_attr)(
pnp_node_handle node,
const char *name
);
status_t (*remove_attr)(device_node_handle node, const char *name);
} device_manager_info;
@@ -461,32 +405,32 @@ typedef struct device_manager_info {
*/
// interface of PnP driver
struct pnp_driver_info {
module_info minfo;
// interface of device driver
struct driver_module_info {
module_info info;
status_t (*init_device)(pnp_node_handle node, void *user_cookie, void **cookie);
status_t (*init_device)(device_node_handle node, void *user_cookie, void **cookie);
// driver is loaded.
// node - node of device
// user_cookie - cookie passed by loading driver
// cookie - cookie issued by this driver
status_t (*uninit_device)(void *cookie);
status_t (*uninit_device)(void *cookie);
// driver gets unloaded.
status_t (*probe)(pnp_node_handle parent);
status_t (*probe)(device_node_handle parent);
// parent was added or is rescanned.
// check whether this parent is supported and register
// any consumer device. Dynamic consumers must return
// B_OK if they support this parent. All other return
// values are ignored.
void (*device_removed)(pnp_node_handle node, void *cookie);
void (*device_removed)(device_node_handle node, void *cookie);
// a device node, registered by this driver, got removed.
// if the driver wasn't loaded when this happenes, no (un)init_device
// is called and thus <cookie> is NULL;
void (*device_cleanup)(pnp_node_handle node);
void (*device_cleanup)(device_node_handle node);
// a device node, registered by this driver, got removed and
// the driver got unloaded
};
@@ -576,14 +520,14 @@ struct pnp_driver_info {
// interface of PnP bus
typedef struct pnp_bus_info {
pnp_driver_info dinfo;
typedef struct bus_module_info {
driver_module_info info;
// (re)scan bus and register all devices.
// driver is always loaded during this call, but other hooks may
// be called concurrently
status_t (*rescan) ( void *cookie );
} pnp_bus_info;
status_t (*rescan) (void *cookie);
} bus_module_info;
// standard attributes:
+1 -1
View File
@@ -30,7 +30,7 @@ typedef status_t (*pnp_device_open_hook)(void *device_cookie, uint32 flags,
// new interface to devfs
typedef struct pnp_devfs_driver_info {
pnp_driver_info dinfo;
driver_module_info info;
pnp_device_open_hook open; // called to open the device
device_close_hook close; // called to close the device