2002-07-09 16:24:59 +04:00
|
|
|
/*
|
2005-10-25 20:59:12 +04:00
|
|
|
* Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
2003-05-03 20:03:26 +04:00
|
|
|
#ifndef KERNEL_SMP_H
|
|
|
|
#define KERNEL_SMP_H
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-10-26 20:13:36 +04:00
|
|
|
#include <KernelExport.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
struct kernel_args;
|
|
|
|
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
// intercpu messages
|
|
|
|
enum {
|
2005-12-14 20:07:37 +03:00
|
|
|
SMP_MSG_INVALIDATE_PAGE_RANGE = 0,
|
|
|
|
SMP_MSG_INVALIDATE_PAGE_LIST,
|
|
|
|
SMP_MSG_USER_INVALIDATE_PAGES,
|
|
|
|
SMP_MSG_GLOBAL_INVALIDATE_PAGES,
|
2002-07-09 16:24:59 +04:00
|
|
|
SMP_MSG_CPU_HALT,
|
2005-10-25 22:18:11 +04:00
|
|
|
SMP_MSG_CALL_FUNCTION,
|
2009-12-10 14:54:38 +03:00
|
|
|
SMP_MSG_RESCHEDULE,
|
|
|
|
SMP_MSG_RESCHEDULE_IF_IDLE
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2005-10-25 22:18:11 +04:00
|
|
|
SMP_MSG_FLAG_ASYNC = 0x0,
|
|
|
|
SMP_MSG_FLAG_SYNC = 0x1,
|
|
|
|
SMP_MSG_FLAG_FREE_ARG = 0x2,
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
2008-10-08 01:14:24 +04:00
|
|
|
typedef uint32 cpu_mask_t;
|
|
|
|
|
2005-10-25 22:18:11 +04:00
|
|
|
typedef void (*smp_call_func)(uint32 data1, int32 currentCPU, uint32 data2, uint32 data3);
|
|
|
|
|
|
|
|
|
2005-10-25 20:59:12 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-03-15 01:54:00 +03:00
|
|
|
status_t smp_init(struct kernel_args *args);
|
|
|
|
status_t smp_per_cpu_init(struct kernel_args *args, int32 cpu);
|
2008-06-02 06:04:12 +04:00
|
|
|
status_t smp_init_post_generic_syscalls(void);
|
2005-10-25 20:59:12 +04:00
|
|
|
bool smp_trap_non_boot_cpus(int32 cpu);
|
|
|
|
void smp_wake_up_non_boot_cpus(void);
|
2007-03-01 11:09:28 +03:00
|
|
|
void smp_cpu_rendezvous(volatile uint32 *var, int current_cpu);
|
2005-10-25 20:59:12 +04:00
|
|
|
void smp_send_ici(int32 targetCPU, int32 message, uint32 data, uint32 data2, uint32 data3,
|
|
|
|
void *data_ptr, uint32 flags);
|
2008-10-08 01:14:24 +04:00
|
|
|
void smp_send_multicast_ici(cpu_mask_t cpuMask, int32 message, uint32 data,
|
|
|
|
uint32 data2, uint32 data3, void *data_ptr, uint32 flags);
|
2005-10-25 20:59:12 +04:00
|
|
|
void smp_send_broadcast_ici(int32 message, uint32 data, uint32 data2, uint32 data3,
|
|
|
|
void *data_ptr, uint32 flags);
|
2009-08-01 05:53:54 +04:00
|
|
|
void smp_send_broadcast_ici_interrupts_disabled(int32 currentCPU, int32 message,
|
|
|
|
uint32 data, uint32 data2, uint32 data3, void *data_ptr, uint32 flags);
|
2005-10-25 20:59:12 +04:00
|
|
|
|
|
|
|
int32 smp_get_num_cpus(void);
|
|
|
|
void smp_set_num_cpus(int32 numCPUs);
|
|
|
|
int32 smp_get_current_cpu(void);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2009-08-01 05:53:54 +04:00
|
|
|
int smp_intercpu_int_handler(int32 cpu);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2005-10-25 20:59:12 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
#endif /* KERNEL_SMP_H */
|