1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SUNNDI_H
#define _SYS_SUNNDI_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Sun Specific NDI definitions
*/
#include <sys/esunddi.h>
#include <sys/sunddi.h>
#include <sys/obpdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#define NDI_SUCCESS DDI_SUCCESS /* successful return */
#define NDI_FAILURE DDI_FAILURE /* unsuccessful return */
#define NDI_NOMEM -2 /* failed to allocate resources */
#define NDI_BADHANDLE -3 /* bad handle passed to in function */
#define NDI_FAULT -4 /* fault during copyin/copyout */
#define NDI_BUSY -5 /* device busy - could not offline */
#define NDI_UNBOUND -6 /* device not bound to a driver */
/*
* Property functions: See also, ddipropdefs.h.
* In general, the underlying driver MUST be held
* to call it's property functions.
*/
/*
* Used to create boolean properties
*/
int
ndi_prop_create_boolean(dev_t match_dev, dev_info_t *dip, char *name);
/*
* Used to create, modify, and lookup integer properties
*/
int
ndi_prop_update_int(dev_t match_dev, dev_info_t *dip, char *name, int data);
int
ndi_prop_update_int_array(dev_t match_dev, dev_info_t *dip, char *name,
int *data, uint_t nelements);
int
ndi_prop_update_int64(dev_t match_dev, dev_info_t *dip, char *name,
int64_t data);
int
ndi_prop_update_int64_array(dev_t match_dev, dev_info_t *dip, char *name,
int64_t *data, uint_t nelements);
/*
* Used to create, modify, and lookup string properties
*/
int
ndi_prop_update_string(dev_t match_dev, dev_info_t *dip, char *name,
char *data);
int
ndi_prop_update_string_array(dev_t match_dev, dev_info_t *dip,
char *name, char **data, uint_t nelements);
/*
* Used to create, modify, and lookup byte properties
*/
int
ndi_prop_update_byte_array(dev_t match_dev, dev_info_t *dip,
char *name, uchar_t *data, uint_t nelements);
/*
* Used to remove properties
*/
int
ndi_prop_remove(dev_t dev, dev_info_t *dip, char *name);
void
ndi_prop_remove_all(dev_info_t *dip);
/*
* Nexus Driver Functions
*/
/*
* Allocate and initialize a new dev_info structure.
* This routine will often be called at interrupt time by a nexus in
* response to a hotplug event, therefore memory allocations are
* not allowed to sleep.
*/
int
ndi_devi_alloc(dev_info_t *parent, char *node_name, pnode_t nodeid,
dev_info_t **ret_dip);
void
ndi_devi_alloc_sleep(dev_info_t *parent, char *node_name, pnode_t nodeid,
dev_info_t **ret_dip);
/*
* Remove an initialized (but not yet attached) dev_info
* node from it's parent.
*/
int
ndi_devi_free(dev_info_t *dip);
/* devinfo locking: use DEVI_BUSY_OWNED in ASSERTs to verify */
void ndi_devi_enter(dev_info_t *dip, int *circ);
void ndi_devi_exit(dev_info_t *dip, int circ);
int ndi_devi_tryenter(dev_info_t *dip, int *circ);
/* devinfo ref counting */
void ndi_hold_devi(dev_info_t *dip);
void ndi_rele_devi(dev_info_t *dip);
/* driver ref counting */
struct dev_ops *ndi_hold_driver(dev_info_t *dip);
void ndi_rele_driver(dev_info_t *dip);
/*
* Change the node name
*/
int
ndi_devi_set_nodename(dev_info_t *dip, char *name, int flags);
/*
* Place the devinfo in the DS_BOUND state,
* binding a driver to the device
*
* Flags:
* all flags are ignored.
*/
int
ndi_devi_bind_driver(dev_info_t *dip, uint_t flags);
/*
* Asynchronous version of ndi_devi_bind_driver, callable from
* interrupt context. The dip must be a persistent node.
*/
int
ndi_devi_bind_driver_async(dev_info_t *dip, uint_t flags);
/*
* Return devctl state of the child addressed by "name@addr".
* For use by a driver's DEVCTL_DEVICE_GETSTATE handler.
*/
int
ndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp,
uint_t *state);
/*
* Transition the child addressed by "name@addr" to the online state.
* For use by a driver's DEVCTL_DEVICE_ONLINE handler.
*/
int
ndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp,
uint_t flags);
/*
* Transition the child addressed by "name@addr" to the offline state.
* For use by a driver's DEVCTL_DEVICE_OFFLINE handler.
*/
int
ndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp,
uint_t flags);
/*
* Remove the child addressed by name@addr.
* For use by a driver's DEVCTL_DEVICE_REMOVE handler.
*/
int
ndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp,
uint_t flags);
/*
* Bus get state
* For use by a driver's DEVCTL_BUS_GETSTATE handler.
*/
int
ndi_devctl_bus_getstate(dev_info_t *dip, struct devctl_iocdata *dcp,
uint_t *state);
/*
* Place the devinfo in the ONLINE state
*/
int
ndi_devi_online(dev_info_t *dip, uint_t flags);
/*
* Generic devctl ioctl handler
*/
int
ndi_devctl_ioctl(dev_info_t *dip, int cmd, intptr_t arg, int mode,
uint_t flags);
/*
* Asynchronous version of ndi_devi_online, callable from interrupt
* context. The dip must be a persistent node.
*/
int
ndi_devi_online_async(dev_info_t *dip, uint_t flags);
/*
* Configure children of a nexus node.
*
* Flags:
* NDI_ONLINE_ATTACH - Attach driver to devinfo node when placing
* the device Online.
* NDI_CONFIG - Recursively configure children if child is nexus node
*/
int
ndi_devi_config(dev_info_t *dip, int flags);
int
ndi_devi_config_driver(dev_info_t *dip, int flags, major_t major);
int
ndi_devi_config_one(dev_info_t *dip, char *devnm, dev_info_t **dipp, int flags);
/*
* Unconfigure children of a nexus node.
*
* Flags:
* NDI_DEVI_REMOVE - Remove child devinfo nodes
*
* NDI_UNCONFIG - Put child devinfo nodes to uninitialized state,
* release resources held by child nodes.
*/
int
ndi_devi_unconfig(dev_info_t *dip, int flags);
int
e_ddi_devi_unconfig(dev_info_t *dip, dev_info_t **dipp, int flags);
int
ndi_devi_unconfig_one(dev_info_t *dip, char *devnm, dev_info_t **dipp,
int flags);
int
ndi_devi_unconfig_driver(dev_info_t *dip, int flags, major_t major);
/*
* Take a device node "Offline".
*
* Offline means to detach the device instance from the bound
* driver and setting the devinfo state to prevent deferred attach
* from re-attaching the device instance.
*
* Flags:
* NDI_DEVI_REMOVE - Remove the node from the devinfo tree after
* first taking it Offline.
*/
#define NDI_DEVI_REMOVE 0x00000001 /* remove after unconfig */
#define NDI_ONLINE_ATTACH 0x00000002 /* online/attach after config */
#define NDI_MDI_FALLBACK 0x00000004 /* Leadville to fallback to phci */
#define NDI_CONFIG 0x00000008 /* recursively config descendants */
#define NDI_UNCONFIG 0x00000010 /* unconfig to uninitialized state */
#define NDI_DEVI_BIND 0x00000020 /* transition to DS_BOUND state */
#define NDI_DEVI_PERSIST 0x00000040 /* do not config offlined nodes */
#define NDI_PROMNAME 0x00000080 /* name comes from prom */
#define NDI_DEVFS_CLEAN 0x00001000 /* clean dv_nodes only, no detach */
#define NDI_AUTODETACH 0x00002000 /* moduninstall daemon */
#define NDI_NO_EVENT 0x00004000 /* don't devfs add/remove events */
#define NDI_DEVI_DEBUG 0x00008000 /* turn on observability */
#define NDI_CONFIG_REPROBE 0x00010000 /* force reprobe (deferred attach) */
#define NDI_DEVI_ONLINE 0x00020000 /* force offlined device to online */
#define NDI_DEVI_OFFLINE 0x00040000 /* set detached device to offline */
#define NDI_POST_EVENT 0x00080000 /* Post NDI events before remove */
#define NDI_BRANCH_EVENT_OP 0x01000000 /* branch op needs branch event */
#define NDI_NO_EVENT_STATE_CHNG 0x02000000 /* don't change the event state */
#define NDI_DRV_CONF_REPROBE 0x04000000 /* reprobe conf-enum'd nodes only */
#define NDI_DETACH_DRIVER 0x08000000 /* performing driver_detach */
#define NDI_MTC_OFF 0x10000000 /* disable multi-threading */
/* ndi interface flag values */
#define NDI_SLEEP 0x000000
#define NDI_NOSLEEP 0x100000
#define NDI_EVENT_NOPASS 0x200000 /* do not pass event req up the tree */
int
ndi_devi_offline(dev_info_t *dip, uint_t flags);
/*
* Find the child dev_info node of parent nexus 'p' whose name
* matches "cname"@"caddr". Use ndi_devi_findchild() instead.
*/
dev_info_t *
ndi_devi_find(dev_info_t *p, char *cname, char *caddr);
/*
* Find the child dev_info node of parent nexus 'p' whose name
* matches device name "name"@"addr".
*/
dev_info_t *
ndi_devi_findchild(dev_info_t *p, char *devname);
/*
* generate debug msg via NDI_DEVI_DEBUG flag
*/
#define NDI_DEBUG(flags, args) \
if (flags & NDI_DEVI_DEBUG) cmn_err args
/*
* Copy in the devctl IOCTL data structure and the strings referenced
* by the structure.
*
* Convenience functions for use by nexus drivers as part of the
* implementation of devctl IOCTL handling.
*/
int
ndi_dc_allochdl(void *iocarg, struct devctl_iocdata **rdcp);
void
ndi_dc_freehdl(struct devctl_iocdata *dcp);
char *
ndi_dc_getpath(struct devctl_iocdata *dcp);
char *
ndi_dc_getname(struct devctl_iocdata *dcp);
char *
ndi_dc_getaddr(struct devctl_iocdata *dcp);
nvlist_t *
ndi_dc_get_ap_data(struct devctl_iocdata *dcp);
char *
ndi_dc_getminorname(struct devctl_iocdata *dcp);
int
ndi_dc_return_dev_state(dev_info_t *dip, struct devctl_iocdata *dcp);
int
ndi_dc_return_ap_state(devctl_ap_state_t *ap, struct devctl_iocdata *dcp);
int
ndi_dc_return_bus_state(dev_info_t *dip, struct devctl_iocdata *dcp);
int
ndi_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, int flags,
dev_info_t **rdip);
int
ndi_get_bus_state(dev_info_t *dip, uint_t *rstate);
int
ndi_set_bus_state(dev_info_t *dip, uint_t state);
/*
* Post an event notification up the device tree hierarchy to the
* parent nexus, until claimed by a bus nexus driver or the top
* of the dev_info tree is reached.
*/
int
ndi_post_event(dev_info_t *dip, dev_info_t *rdip, ddi_eventcookie_t eventhdl,
void *impl_data);
/*
* Called by the NDI Event Framework to deliver a registration request to the
* appropriate bus nexus driver.
*/
int
ndi_busop_add_eventcall(dev_info_t *dip, dev_info_t *rdip,
ddi_eventcookie_t eventhdl, void (*callback)(), void *arg,
ddi_callback_id_t *cb_id);
/*
* Called by the NDI Event Framework to deliver an unregister request to the
* appropriate bus nexus driver.
*/
int
ndi_busop_remove_eventcall(dev_info_t *ddip, ddi_callback_id_t id);
/*
* Called by the NDI Event Framework and/or a bus nexus driver's
* implementation of the (*bus_get_eventcookie)() interface up the device tree
* hierarchy, until claimed by a bus nexus driver or the top of the dev_info
* tree is reached. The NDI Event Framework will skip nexus drivers which are
* not configured to handle NDI events.
*/
int
ndi_busop_get_eventcookie(dev_info_t *dip, dev_info_t *rdip, char *name,
ddi_eventcookie_t *event_cookiep);
/*
* ndi event callback support routines:
*
* these functions require an opaque ndi event handle
*/
typedef struct ndi_event_hdl *ndi_event_hdl_t;
/*
* structure for maintaining each registered callback
*/
typedef struct ndi_event_callbacks {
struct ndi_event_callbacks *ndi_evtcb_next;
struct ndi_event_callbacks *ndi_evtcb_prev;
dev_info_t *ndi_evtcb_dip;
char *devname; /* name of device defining this callback */
void (*ndi_evtcb_callback)();
void *ndi_evtcb_arg;
ddi_eventcookie_t ndi_evtcb_cookie;
} ndi_event_callbacks_t;
/*
* a nexus driver defines events that it can support using the
* following structure
*/
typedef struct ndi_event_definition {
int ndi_event_tag;
char *ndi_event_name;
ddi_plevel_t ndi_event_plevel;
uint_t ndi_event_attributes;
} ndi_event_definition_t;
typedef struct ndi_event_cookie {
ndi_event_definition_t *definition; /* Event Description */
dev_info_t *ddip; /* Devi defining this event */
ndi_event_callbacks_t *callback_list; /* Cb's reg'd to w/ this evt */
struct ndi_event_cookie *next_cookie; /* Next cookie def'd in hdl */
} ndi_event_cookie_t;
#define NDI_EVENT(cookie) ((struct ndi_event_cookie *)(void *)(cookie))
#define NDI_EVENT_NAME(cookie) (NDI_EVENT(cookie)->definition->ndi_event_name)
#define NDI_EVENT_TAG(cookie) (NDI_EVENT(cookie)->definition->ndi_event_tag)
#define NDI_EVENT_ATTRIBUTES(cookie) \
(NDI_EVENT(cookie)->definition->ndi_event_attributes)
#define NDI_EVENT_PLEVEL(cookie) \
(NDI_EVENT(cookie)->definition->ndi_event_plevel)
#define NDI_EVENT_DDIP(cookie) (NDI_EVENT(cookie)->ddip)
/* ndi_event_attributes */
#define NDI_EVENT_POST_TO_ALL 0x0 /* broadcast: post to all handlers */
#define NDI_EVENT_POST_TO_TGT 0x1 /* call only specific child's hdlr */
typedef struct ndi_event_set {
ushort_t ndi_events_version;
ushort_t ndi_n_events;
ndi_event_definition_t *ndi_event_defs;
} ndi_event_set_t;
#define NDI_EVENTS_REV0 0
#define NDI_EVENTS_REV1 1
/*
* allocate an ndi event handle
*/
int
ndi_event_alloc_hdl(dev_info_t *dip, ddi_iblock_cookie_t cookie,
ndi_event_hdl_t *ndi_event_hdl, uint_t flag);
/*
* free the ndi event handle
*/
int
ndi_event_free_hdl(ndi_event_hdl_t handle);
/*
* bind or unbind a set of events to/from the event handle
*/
int
ndi_event_bind_set(ndi_event_hdl_t handle,
ndi_event_set_t *ndi_event_set,
uint_t flag);
int
ndi_event_unbind_set(ndi_event_hdl_t handle,
ndi_event_set_t *ndi_event_set,
uint_t flag);
/*
* get an event cookie
*/
int
ndi_event_retrieve_cookie(ndi_event_hdl_t handle,
dev_info_t *child_dip,
char *eventname,
ddi_eventcookie_t *cookiep,
uint_t flag);
/*
* add an event callback info to the ndi event handle
*/
int
ndi_event_add_callback(ndi_event_hdl_t handle,
dev_info_t *child_dip,
ddi_eventcookie_t cookie,
void (*event_callback)
(dev_info_t *,
ddi_eventcookie_t,
void *arg,
void *impldata),
void *arg,
uint_t flag,
ddi_callback_id_t *cb_id);
/*
* remove an event callback registration from the ndi event handle
*/
int
ndi_event_remove_callback(ndi_event_hdl_t handle, ddi_callback_id_t id);
/*
* perform callbacks for a specified cookie
*/
int
ndi_event_run_callbacks(ndi_event_hdl_t handle, dev_info_t *child_dip,
ddi_eventcookie_t cookie, void *bus_impldata);
/*
* do callback for just one child_dip, regardless of attributes
*/
int ndi_event_do_callback(ndi_event_hdl_t handle, dev_info_t *child_dip,
ddi_eventcookie_t cookie, void *bus_impldata);
/*
* ndi_event_tag_to_cookie: utility function to find an event cookie
* given an event tag
*/
ddi_eventcookie_t
ndi_event_tag_to_cookie(ndi_event_hdl_t handle, int event_tag);
/*
* ndi_event_cookie_to_tag: utility function to find an event tag
* given an event_cookie
*/
int
ndi_event_cookie_to_tag(ndi_event_hdl_t handle,
ddi_eventcookie_t cookie);
/*
* ndi_event_cookie_to_name: utility function to find an event
* name given an event_cookie
*/
char *
ndi_event_cookie_to_name(ndi_event_hdl_t handle,
ddi_eventcookie_t cookie);
/*
* ndi_event_tag_to_name: utility function to find an event
* name given an event_tag
*/
char *
ndi_event_tag_to_name(ndi_event_hdl_t handle, int event_tag);
dev_info_t *
ndi_devi_config_vhci(char *, int);
#ifdef DEBUG
/*
* ndi_event_dump_hdl: debug functionality used to display event handle
*/
void
ndi_event_dump_hdl(struct ndi_event_hdl *hdl, char *location);
#endif
/*
* Default busop bus_config helper functions
*/
int
ndi_busop_bus_config(dev_info_t *pdip, uint_t flags, ddi_bus_config_op_t op,
void *arg, dev_info_t **child, clock_t reset_delay);
int
ndi_busop_bus_unconfig(dev_info_t *dip, uint_t flags, ddi_bus_config_op_t op,
void *arg);
/*
* Bus Resource allocation structures and function prototypes exported
* by busra module
*/
/* structure for specifying a request */
typedef struct ndi_ra_request {
uint_t ra_flags; /* General flags */
/* see bit definitions below */
uint64_t ra_len; /* Requested allocation length */
uint64_t ra_addr; /* Specific base address requested */
uint64_t ra_boundbase; /* Base address of the area for */
/* the allocated resource to be */
/* restricted to */
uint64_t ra_boundlen; /* Length of the area, starting */
/* from ra_boundbase, for the */
/* allocated resource to be */
/* restricted to. */
uint64_t ra_align_mask; /* Alignment mask used for */
/* allocated base address */
} ndi_ra_request_t;
/* ra_flags bit definitions */
#define NDI_RA_ALIGN_SIZE 0x0001 /* Set the alignment of the */
/* allocated resource address */
/* according to the ra_len */
/* value (alignment mask will */
/* be (ra_len - 1)). Value of */
/* ra_len has to be power of 2. */
/* If this flag is set, value of */
/* ra_align_mask will be ignored. */
#define NDI_RA_ALLOC_BOUNDED 0x0002 /* Indicates that the resource */
/* should be restricted to the */
/* area specified by ra_boundbase */
/* and ra_boundlen */
#define NDI_RA_ALLOC_SPECIFIED 0x0004 /* Indicates that a specific */
/* address (ra_addr value) is */
/* requested. */
#define NDI_RA_ALLOC_PARTIAL_OK 0x0008 /* Indicates if requested size */
/* (ra_len) chunk is not available */
/* then allocate as big chunk as */
/* possible which is less than or */
/* equal to ra_len size. */
/* return values specific to bus resource allocator */
#define NDI_RA_PARTIAL_REQ -7
/* Predefined types for generic type of resources */
#define NDI_RA_TYPE_MEM "memory"
#define NDI_RA_TYPE_IO "io"
#define NDI_RA_TYPE_PCI_BUSNUM "pci_bus_number"
#define NDI_RA_TYPE_PCI_PREFETCH_MEM "pci_prefetchable_memory"
#define NDI_RA_TYPE_INTR "interrupt"
/* flag bit definition */
#define NDI_RA_PASS 0x0001 /* pass request up the dev tree */
/*
* Prototype definitions for functions exported
*/
int
ndi_ra_map_setup(dev_info_t *dip, char *type);
int
ndi_ra_map_destroy(dev_info_t *dip, char *type);
int
ndi_ra_alloc(dev_info_t *dip, ndi_ra_request_t *req, uint64_t *basep,
uint64_t *lenp, char *type, uint_t flag);
int
ndi_ra_free(dev_info_t *dip, uint64_t base, uint64_t len, char *type,
uint_t flag);
/*
* ndi_dev_is_prom_node: Return non-zero if the node is a prom node
*/
int ndi_dev_is_prom_node(dev_info_t *);
/*
* ndi_dev_is_pseudo_node: Return non-zero if the node is a pseudo node.
* NB: all non-prom nodes are pseudo nodes.
* c.f. ndi_dev_is_persistent_node
*/
int ndi_dev_is_pseudo_node(dev_info_t *);
/*
* ndi_dev_is_persistent_node: Return non-zero if the node has the
* property of persistence.
*/
int ndi_dev_is_persistent_node(dev_info_t *);
/*
* Event posted when a fault is reported
*/
#define DDI_DEVI_FAULT_EVENT "DDI:DEVI_FAULT"
struct ddi_fault_event_data {
dev_info_t *f_dip;
ddi_fault_impact_t f_impact;
ddi_fault_location_t f_location;
const char *f_message;
ddi_devstate_t f_oldstate;
};
/*
* Access handle/DMA handle fault flag setting/clearing functions for nexi
*/
void ndi_set_acc_fault(ddi_acc_handle_t ah);
void ndi_clr_acc_fault(ddi_acc_handle_t ah);
void ndi_set_dma_fault(ddi_dma_handle_t dh);
void ndi_clr_dma_fault(ddi_dma_handle_t dh);
/* Driver.conf property merging */
int ndi_merge_node(dev_info_t *, int (*)(dev_info_t *, char *, int));
void ndi_merge_wildcard_node(dev_info_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SUNNDI_H */
|