4 static struct spinlock lock
;
6 uint64_t fwcfg_get_u(uint16_t index
, int bytes
)
13 asm volatile ("out %0, %1" : : "a"(index
), "d"((uint16_t)BIOS_CFG_IOPORT
));
14 for (i
= 0; i
< bytes
; ++i
) {
15 asm volatile ("in %1, %0" : "=a"(b
) : "d"((uint16_t)(BIOS_CFG_IOPORT
+ 1)));
16 r
|= (uint64_t)b
<< (i
* 8);
22 uint8_t fwcfg_get_u8(unsigned index
)
24 return fwcfg_get_u(index
, 1);
27 uint16_t fwcfg_get_u16(unsigned index
)
29 return fwcfg_get_u(index
, 2);
32 uint32_t fwcfg_get_u32(unsigned index
)
34 return fwcfg_get_u(index
, 4);
37 uint64_t fwcfg_get_u64(unsigned index
)
39 return fwcfg_get_u(index
, 8);
42 unsigned fwcfg_get_nb_cpus(void)
44 return fwcfg_get_u16(FW_CFG_NB_CPUS
);