1168962Spjd/*- 2168962Spjd * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3168962Spjd * All rights reserved. 4168962Spjd * 5168962Spjd * Redistribution and use in source and binary forms, with or without 6168962Spjd * modification, are permitted provided that the following conditions 7168962Spjd * are met: 8168962Spjd * 1. Redistributions of source code must retain the above copyright 9168962Spjd * notice, this list of conditions and the following disclaimer. 10168962Spjd * 2. Redistributions in binary form must reproduce the above copyright 11168962Spjd * notice, this list of conditions and the following disclaimer in the 12168962Spjd * documentation and/or other materials provided with the distribution. 13168962Spjd * 14168962Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 15168962Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16168962Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17168962Spjd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 18168962Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19168962Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20168962Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21168962Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22168962Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23168962Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24168962Spjd * SUCH DAMAGE. 25168962Spjd * 26168962Spjd * $FreeBSD: stable/11/sys/cddl/compat/opensolaris/sys/sunddi.h 325534 2017-11-08 08:53:44Z avg $ 27168962Spjd */ 28168962Spjd 29168962Spjd#ifndef _OPENSOLARIS_SYS_SUNDDI_H_ 30168962Spjd#define _OPENSOLARIS_SYS_SUNDDI_H_ 31168962Spjd 32219089Spjd#ifdef _KERNEL 33219089Spjd 34219089Spjd#include <sys/kmem.h> 35219089Spjd#include <sys/libkern.h> 36219089Spjd#include <sys/sysevent.h> 37219089Spjd 38185029Spjd#define ddi_driver_major(zfs_dip) (0) 39220447Smm#define ddi_copyin(from, to, size, flag) \ 40220447Smm (copyin((from), (to), (size)), 0) 41220447Smm#define ddi_copyout(from, to, size, flag) \ 42220447Smm (copyout((from), (to), (size)), 0) 43185029Spjdint ddi_strtol(const char *str, char **nptr, int base, long *result); 44168962Spjdint ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result); 45325534Savgint ddi_strtoll(const char *str, char **nptr, int base, long long *result); 46219089Spjdint ddi_strtoull(const char *str, char **nptr, int base, 47219089Spjd unsigned long long *result); 48168962Spjd 49219089Spjd#define DDI_SUCCESS (0) 50219089Spjd#define DDI_FAILURE (-1) 51219089Spjd#define DDI_SLEEP 0x666 52219089Spjd 53219089Spjdint ddi_soft_state_init(void **statep, size_t size, size_t nitems); 54219089Spjdvoid ddi_soft_state_fini(void **statep); 55219089Spjd 56219089Spjdvoid *ddi_get_soft_state(void *state, int item); 57219089Spjdint ddi_soft_state_zalloc(void *state, int item); 58219089Spjdvoid ddi_soft_state_free(void *state, int item); 59219089Spjd 60219089Spjdint _ddi_log_sysevent(char *vendor, char *class_name, char *subclass_name, 61219089Spjd nvlist_t *attr_list, sysevent_id_t *eidp, int flag); 62219089Spjd#define ddi_log_sysevent(dip, vendor, class_name, subclass_name, \ 63219089Spjd attr_list, eidp, flag) \ 64219089Spjd _ddi_log_sysevent((vendor), (class_name), (subclass_name), \ 65219089Spjd (attr_list), (eidp), (flag)) 66219089Spjd 67219089Spjd#endif /* _KERNEL */ 68219089Spjd 69168962Spjd#endif /* _OPENSOLARIS_SYS_SUNDDI_H_ */ 70