Loading...
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Define 'struct task_struct' and provide the main scheduler
 * APIs (schedule(), wakeup variants, etc.)
 *
 * Stub definitions for Linux kernel scheduler.
 * U-Boot is single-threaded.
 */
#ifndef _LINUX_SCHED_H
#define _LINUX_SCHED_H

#include <linux/types.h>

/* io_context for I/O scheduling */
struct io_context {
	unsigned int ioprio;
};

/* Process flags */
#define PF_MEMALLOC		0x00000800	/* Allocating memory */
#define PF_MEMALLOC_NOFS	0x00040000	/* GFP_NOFS allocations */

struct task_struct {
	int pid;
	char comm[16];
	void *journal_info;	/* For jbd2 */
	unsigned int flags;	/* PF_* flags */
	struct io_context *io_context;	/* For I/O scheduling */
};

extern struct task_struct *current;

#define TASK_RUNNING		0
#define TASK_INTERRUPTIBLE	1
#define TASK_UNINTERRUPTIBLE	2

#define cond_resched()		do { } while (0)
#define cond_resched_lock(lock)	do { (void)(lock); } while (0)
#define yield()			do { } while (0)
/* Note: schedule() is implemented in common/cyclic.c */

#define in_interrupt()		0
#define in_atomic()		0
#define in_task()		1

#define signal_pending(task)	0
#define fatal_signal_pending(task)	0

/* Scheduler timeout stubs - return immediately in U-Boot */
#define schedule_timeout_interruptible(timeout)		({ (void)(timeout); 0; })
#define schedule_timeout_uninterruptible(timeout)	do { (void)(timeout); } while (0)

/* Check if rescheduling is needed - always false in single-threaded U-Boot */
#define need_resched()		(0)

#endif /* _LINUX_SCHED_H */