4 #include "member_offs.h"
11 /** Get the locical ID of this CPU */
16 * Set this CPU to online state.
17 * NOTE: This does not activate an inactive CPU, Just set the given state.
19 void set_online(bool o);
21 /** Get the physical ID of the CPU, for inter processor communication */
22 unsigned phys_id() const;
24 /** Convienience for Cpu::cpus.cpu(cpu).online() */
25 static bool online(unsigned cpu);
28 * Get logical CPU id from physical ID
29 * NOTE: This call is SLOW, use only for debugging/bootup
31 static unsigned p2l(unsigned phys_id);
33 static Cpu_mask const &online_mask();
37 /** Is this CPU online ? */
40 static Cpu_mask _online_mask;
44 //--------------------------------------------------------------------------
51 void set_id(unsigned id) { _id = id; }
55 //--------------------------------------------------------------------------
61 void set_id(unsigned) {}
65 // --------------------------------------------------------------------------
68 Cpu_mask Cpu::_online_mask(Cpu_mask::Init::Bss);
73 { return _online_mask; }
75 // --------------------------------------------------------------------------
88 { return _online_mask.get(_id); }
92 Cpu::set_online(bool o)
95 _online_mask.set(_id);
97 _online_mask.clear(_id);
102 Cpu::p2l(unsigned phys_id)
104 for (unsigned i = 0; i < Config::Max_num_cpus; ++i)
105 if (Per_cpu_data::valid(i) && Cpu::cpus.cpu(i).phys_id() == phys_id)
111 IMPLEMENT static inline NEEDS["kdb_ke.h"]
113 Cpu::online(unsigned _cpu)
114 { return _online_mask.get(_cpu); }
117 // --------------------------------------------------------------------------
118 IMPLEMENTATION [!mp]:
132 Cpu::set_online(bool)
140 IMPLEMENT static inline
142 Cpu::online(unsigned _cpu)
143 { return _cpu == 0; }