-int
-ddi_soft_state_zalloc(void *state, int item)
-{
-#pragma unused(state)
- if (item < NSOFT_STATES)
- return DDI_SUCCESS;
- else
- return DDI_FAILURE;
-}
-
-void *
-ddi_get_soft_state(void *state, int item)
-{
-#pragma unused(state)
- ASSERT(item < NSOFT_STATES);
- return soft[item];
-}
-
-int
-ddi_soft_state_free(void *state, int item)
-{
- ASSERT(item < NSOFT_STATES);
- bzero( soft[item], (size_t)state );
- return DDI_SUCCESS;
-}
-
-void
-ddi_soft_state_fini(void **state_p)
-{
-#pragma unused(state_p)
- int i;
-
- for (i = 0; i < NSOFT_STATES; ++i) _FREE( soft[i], M_TEMP );
-}
-
-static unsigned int gRegisteredProps = 0;
-static struct {
- char name[32]; /* enough for "dof-data-" + digits */
- int *data;
- uint_t nelements;
-} gPropTable[16];
-
-kern_return_t _dtrace_register_anon_DOF(char *, uchar_t *, uint_t);
-
-kern_return_t
-_dtrace_register_anon_DOF(char *name, uchar_t *data, uint_t nelements)
-{
- if (gRegisteredProps < sizeof(gPropTable)/sizeof(gPropTable[0])) {
- int *p = (int *)_MALLOC(nelements*sizeof(int), M_TEMP, M_WAITOK);
-
- if (NULL == p)
- return KERN_FAILURE;
-
- strlcpy(gPropTable[gRegisteredProps].name, name, sizeof(gPropTable[0].name));
- gPropTable[gRegisteredProps].nelements = nelements;
- gPropTable[gRegisteredProps].data = p;
-
- while (nelements-- > 0) {
- *p++ = (int)(*data++);
- }
-
- gRegisteredProps++;
- return KERN_SUCCESS;
- }
- else
- return KERN_FAILURE;
-}
-
-int
-ddi_prop_lookup_int_array(dev_t match_dev, dev_info_t *dip, uint_t flags,
- const char *name, int **data, uint_t *nelements)
-{
-#pragma unused(match_dev,dip,flags)
- unsigned int i;
- for (i = 0; i < gRegisteredProps; ++i)
- {
- if (0 == strncmp(name, gPropTable[i].name,
- sizeof(gPropTable[i].name))) {
- *data = gPropTable[i].data;
- *nelements = gPropTable[i].nelements;
- return DDI_SUCCESS;
- }
- }
- return DDI_FAILURE;
-}
-
-int
-ddi_prop_free(void *buf)
-{
- _FREE(buf, M_TEMP);
- return DDI_SUCCESS;
-}
-
-int
-ddi_driver_major(dev_info_t *devi) { return (int)major(CAST_DOWN_EXPLICIT(int,devi)); }
-