4 #include "member_offs.h"
14 By_phys_id(Cpu_phys_id p) : _p(p) {}
15 template<typename CPU>
16 bool operator () (CPU const &c) const { return _p == c.phys_id(); }
18 // we actually use a mask that has one CPU more that we can physically,
19 // have, to avoid lots of special cases for an invalid CPU number
20 typedef Cpu_mask_t<Config::Max_num_cpus + 1> Online_cpu_mask;
22 enum { Invalid = Config::Max_num_cpus };
23 static Cpu_number invalid() { return Cpu_number(Invalid); }
25 /** Get the logical ID of this CPU */
26 Cpu_number id() const;
30 * Set this CPU to online state.
31 * NOTE: This does not activate an inactive CPU, Just set the given state.
33 void set_online(bool o);
35 /** Convienience for Cpu::cpus.cpu(cpu).online() */
36 static bool online(Cpu_number cpu);
38 static Online_cpu_mask const &online_mask();
41 /** Is this CPU online ? */
44 static Online_cpu_mask _online_mask;
48 //--------------------------------------------------------------------------
55 void set_id(Cpu_number id) { _id = id; }
59 //--------------------------------------------------------------------------
65 void set_id(Cpu_number) {}
69 // --------------------------------------------------------------------------
72 Cpu::Online_cpu_mask Cpu::_online_mask(Online_cpu_mask::Init::Bss);
75 Cpu::Online_cpu_mask const &
77 { return _online_mask; }
79 // --------------------------------------------------------------------------
92 { return _online_mask.get(_id); }
96 Cpu::set_online(bool o)
99 _online_mask.set(_id);
101 _online_mask.clear(_id);
105 IMPLEMENT static inline NEEDS["kdb_ke.h"]
107 Cpu::online(Cpu_number _cpu)
108 { return _online_mask.get(_cpu); }
111 // --------------------------------------------------------------------------
112 IMPLEMENTATION [!mp]:
117 { return Cpu_number::boot_cpu(); }
126 Cpu::set_online(bool)
129 IMPLEMENT static inline
131 Cpu::online(Cpu_number _cpu)
132 { return _cpu == Cpu_number::boot_cpu(); }