jcs's openbsd hax
openbsd
1/* $OpenBSD: iosfvar.h,v 1.2 2024/05/11 14:49:56 jsg Exp $ */
2
3/*
4 * Copyright (c) 2023 David Gwynne <dlg@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _DEV_IC_IOSFVAR_H_
20#define _DEV_IC_IOSFVAR_H_
21
22/*
23 * iosf provider api
24 */
25
26struct iosf_mbi {
27 struct device *mbi_dev;
28 int mbi_prio;
29 int mbi_semaddr;
30
31 uint32_t (*mbi_mdr_rd)(struct iosf_mbi *sc, uint32_t, uint32_t);
32 void (*mbi_mdr_wr)(struct iosf_mbi *sc, uint32_t, uint32_t,
33 uint32_t);
34};
35
36void iosf_mbi_attach(struct iosf_mbi *);
37
38/*
39 * iosf consumer apis
40 */
41
42int iosf_mbi_available(void);
43
44/* for i2c */
45int iosf_i2c_acquire(int);
46void iosf_i2c_release(int);
47
48/* for drm to coordinate with the rest of the kernel */
49void iosf_mbi_punit_acquire(void);
50void iosf_mbi_punit_release(void);
51void iosf_mbi_assert_punit_acquired(void);
52
53#ifdef nyetyet
54int iosf_mbi_read(uint8_t, uint8_t, uint32_t, uint32_t *);
55int iosf_mbi_write(uint8_t, uint8_t, uint32_t, uint32_t);
56int iosf_mbi_modify(uint8_t, uint8_t, uint32_t, uint32_t, uint32_t);
57#endif
58
59#endif /* _DEV_IC_IOSFVAR_H_ */