Lines Matching +full:sync +full:- +full:flag
1 // SPDX-License-Identifier: GPL-2.0-only
28 (CIRC_CNT((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE))
30 (CIRC_CNT_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE))
32 (CIRC_SPACE((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE))
34 (CIRC_SPACE_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE))
72 static inline bool __acpi_aml_access_ok(unsigned long flag) in __acpi_aml_access_ok() argument
85 if ((flag & ACPI_AML_KERN) && in __acpi_aml_access_ok()
91 static inline bool __acpi_aml_readable(struct circ_buf *circ, unsigned long flag) in __acpi_aml_readable() argument
97 if (!(acpi_aml_io.flags & flag) && circ_count(circ)) in __acpi_aml_readable()
102 static inline bool __acpi_aml_writable(struct circ_buf *circ, unsigned long flag) in __acpi_aml_writable() argument
108 if (!(acpi_aml_io.flags & flag) && circ_space(circ)) in __acpi_aml_writable()
203 static int acpi_aml_lock_write(struct circ_buf *circ, unsigned long flag) in acpi_aml_lock_write() argument
208 if (!__acpi_aml_access_ok(flag)) { in acpi_aml_lock_write()
209 ret = -EFAULT; in acpi_aml_lock_write()
212 if (!__acpi_aml_writable(circ, flag)) { in acpi_aml_lock_write()
213 ret = -EAGAIN; in acpi_aml_lock_write()
216 acpi_aml_io.flags |= flag; in acpi_aml_lock_write()
222 static int acpi_aml_lock_read(struct circ_buf *circ, unsigned long flag) in acpi_aml_lock_read() argument
227 if (!__acpi_aml_access_ok(flag)) { in acpi_aml_lock_read()
228 ret = -EFAULT; in acpi_aml_lock_read()
231 if (!__acpi_aml_readable(circ, flag)) { in acpi_aml_lock_read()
232 ret = -EAGAIN; in acpi_aml_lock_read()
235 acpi_aml_io.flags |= flag; in acpi_aml_lock_read()
241 static void acpi_aml_unlock_fifo(unsigned long flag, bool wakeup) in acpi_aml_unlock_fifo() argument
244 acpi_aml_io.flags &= ~flag; in acpi_aml_unlock_fifo()
260 /* sync tail before inserting logs */ in acpi_aml_write_kern()
262 p = &crc->buf[crc->head]; in acpi_aml_write_kern()
265 /* sync head after inserting logs */ in acpi_aml_write_kern()
267 crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); in acpi_aml_write_kern()
281 /* sync head before removing cmds */ in acpi_aml_readb_kern()
283 p = &crc->buf[crc->tail]; in acpi_aml_readb_kern()
285 /* sync tail before inserting cmds */ in acpi_aml_readb_kern()
287 crc->tail = (crc->tail + 1) & (ACPI_AML_BUF_SIZE - 1); in acpi_aml_readb_kern()
293 * acpi_aml_write_log() - Capture debugger output
306 return -ENODEV; in acpi_aml_write_log()
312 if (ret == -EAGAIN) { in acpi_aml_write_log()
326 count -= ret; in acpi_aml_write_log()
332 * acpi_aml_read_cmd() - Capture debugger input
356 if (ret == -EAGAIN) { in acpi_aml_read_cmd()
370 count--; in acpi_aml_read_cmd()
376 *(msg + size - 1) = '\0'; in acpi_aml_read_cmd()
400 acpi_aml_io.usages--; in acpi_aml_thread()
411 * acpi_aml_create_thread() - Create AML debugger thread
453 return -EINVAL; in acpi_aml_wait_command_ready()
473 ret = -EBUSY; in acpi_aml_open()
476 if ((file->f_flags & O_ACCMODE) != O_WRONLY) { in acpi_aml_open()
482 ret = -EBUSY; in acpi_aml_open()
494 ret = -ENODEV; in acpi_aml_open()
506 ret = -EINVAL; in acpi_aml_open()
531 acpi_aml_io.users--; in acpi_aml_release()
582 /* sync head before removing logs */ in acpi_aml_read_user()
584 p = &crc->buf[crc->tail]; in acpi_aml_read_user()
587 ret = -EFAULT; in acpi_aml_read_user()
590 /* sync tail after removing logs */ in acpi_aml_read_user()
592 crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1); in acpi_aml_read_user()
608 return -EFAULT; in acpi_aml_read()
613 if (ret == -EAGAIN) { in acpi_aml_read()
614 if (file->f_flags & O_NONBLOCK) in acpi_aml_read()
634 count -= ret; in acpi_aml_read()
652 /* sync tail before inserting cmds */ in acpi_aml_write_user()
654 p = &crc->buf[crc->head]; in acpi_aml_write_user()
657 ret = -EFAULT; in acpi_aml_write_user()
660 /* sync head after inserting cmds */ in acpi_aml_write_user()
662 crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); in acpi_aml_write_user()
678 return -EFAULT; in acpi_aml_write()
683 if (ret == -EAGAIN) { in acpi_aml_write()
684 if (file->f_flags & O_NONBLOCK) in acpi_aml_write()
704 count -= ret; in acpi_aml_write()
746 return -ENODEV; in acpi_aml_init()