33use crate :: error:: { Error , Result } ;
44use crate :: time;
55use crate :: { declare_per_core, get_per_core, get_per_core_mut} ;
6+ use num_enum:: TryFromPrimitive ;
67use raw_cpuid:: CpuId ;
78use x86:: msr;
89
@@ -17,21 +18,21 @@ const IA32_APIC_BASE_EXD: u64 = 1 << 10;
1718/// BSP mask
1819const IA32_APIC_BASE_BSP : u64 = 1 << 8 ;
1920
20- #[ derive( Debug ) ]
21+ #[ derive( Debug , TryFromPrimitive ) ]
2122#[ repr( u8 ) ]
2223/// ICR destination shorthand values
2324pub enum DstShorthand {
2425 /// No shorthand used
2526 NoShorthand = 0x00 ,
26- // TODO(dlrobertson): Is there any reason to include self? AFAIK
27- // SELF_IPI negates the need for it.
27+ /// Send only to myself
28+ MySelf = 0x01 ,
2829 /// Broadcast including myself
2930 AllIncludingSelf = 0x02 ,
3031 /// Broadcast excluding myself
3132 AllExcludingSelf = 0x03 ,
3233}
3334
34- #[ derive( Debug ) ]
35+ #[ derive( Debug , TryFromPrimitive ) ]
3536#[ repr( u8 ) ]
3637/// INIT IPI Level
3738pub enum Level {
@@ -41,7 +42,7 @@ pub enum Level {
4142 Assert = 0x01 ,
4243}
4344
44- #[ derive( Debug ) ]
45+ #[ derive( Debug , TryFromPrimitive ) ]
4546#[ repr( u8 ) ]
4647/// ICR trigger modes
4748pub enum TriggerMode {
@@ -51,7 +52,7 @@ pub enum TriggerMode {
5152 Level = 0x01 ,
5253}
5354
54- #[ derive( Debug ) ]
55+ #[ derive( Debug , TryFromPrimitive ) ]
5556#[ repr( u8 ) ]
5657/// ICR mode of the Destination field
5758pub enum DstMode {
@@ -61,7 +62,7 @@ pub enum DstMode {
6162 Logical = 0x01 ,
6263}
6364
64- #[ derive( Debug ) ]
65+ #[ derive( Debug , TryFromPrimitive ) ]
6566#[ repr( u8 ) ]
6667/// ICR delivery mode
6768pub enum DeliveryMode {
0 commit comments