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