4 #include "member_offs.h"
14 By_phys_id(Unsigned32 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 };
24 /** Get the logical ID of this CPU */
29 * Set this CPU to online state.
30 * NOTE: This does not activate an inactive CPU, Just set the given state.
32 void set_online(bool o);
34 /** Convienience for Cpu::cpus.cpu(cpu).online() */
35 static bool online(unsigned cpu);
37 static Online_cpu_mask const &online_mask();
40 /** Is this CPU online ? */
43 static Online_cpu_mask _online_mask;
47 //--------------------------------------------------------------------------
54 void set_id(unsigned id) { _id = id; }
58 //--------------------------------------------------------------------------
64 void set_id(unsigned) {}
68 // --------------------------------------------------------------------------
71 Cpu::Online_cpu_mask Cpu::_online_mask(Online_cpu_mask::Init::Bss);
74 Cpu::Online_cpu_mask const &
76 { return _online_mask; }
78 // --------------------------------------------------------------------------
91 { return _online_mask.get(_id); }
95 Cpu::set_online(bool o)
98 _online_mask.set(_id);
100 _online_mask.clear(_id);
104 IMPLEMENT static inline NEEDS["kdb_ke.h"]
106 Cpu::online(unsigned _cpu)
107 { return _online_mask.get(_cpu); }
110 // --------------------------------------------------------------------------
111 IMPLEMENTATION [!mp]:
125 Cpu::set_online(bool)
128 IMPLEMENT static inline
130 Cpu::online(unsigned _cpu)
131 { return _cpu == 0; }