iPXE
mp.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  *
19  * You can also choose to distribute this program under the terms of
20  * the Unmodified Binary Distribution Licence (as given in the file
21  * COPYING.UBDL), provided that you have satisfied its requirements.
22  */
23 
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25 
26 /** @file
27  *
28  * Multiprocessor functions
29  *
30  */
31 
32 #include <ipxe/timer.h>
33 #include <ipxe/mp.h>
34 
35 /** Time to wait for application processors */
36 #define MP_MAX_CPUID_WAIT_MS 10
37 
38 /**
39  * Get boot CPU identifier
40  *
41  * @ret id Boot CPU identifier
42  */
43 unsigned int mp_boot_cpuid ( void ) {
44  unsigned int max = 0;
45 
46  /* Update maximum to accommodate boot processor */
48  DBGC ( &mp_call, "MP boot processor ID is %#x\n", max );
49 
50  return max;
51 }
52 
53 /**
54  * Get maximum CPU identifier
55  *
56  * @ret max Maximum CPU identifier
57  */
58 unsigned int mp_max_cpuid ( void ) {
59  unsigned int max = mp_boot_cpuid();
60 
61  /* Update maximum to accommodate application processors */
64  DBGC ( &mp_call, "MP observed maximum CPU ID is %#x\n", max );
65 
66  return max;
67 }
#define MP_MAX_CPUID_WAIT_MS
Time to wait for application processors.
Definition: mp.c:36
#define max(x, y)
Definition: ath.h:39
#define DBGC(...)
Definition: compiler.h:505
iPXE timers
void mp_start_all(mp_func_t func, void *opaque)
Start a multiprocessor function on all application processors.
void __asmcall mp_call(mp_addr_t func, mp_addr_t opaque)
Call a multiprocessor function from C code on the current CPU.
mp_func_t mp_update_max_cpuid
Update maximum observed CPU identifier.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int mp_max_cpuid(void)
Get maximum CPU identifier.
Definition: mp.c:58
unsigned int mp_boot_cpuid(void)
Get boot CPU identifier.
Definition: mp.c:43
Multiprocessor functions.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:78
void mp_exec_boot(mp_func_t func, void *opaque)
Execute a multiprocessor function on the boot processor.