return result;
}
-/**
- * Set bit atomically
- *
- * @v bits Bit field
- * @v bit Bit to set
- */
-static inline __attribute__ (( always_inline )) void
-hv_set_bit ( void *bits, unsigned int bit ) {
- struct {
- uint32_t dword[ ( bit / 32 ) + 1 ];
- } *dwords = bits;
-
- /* Set bit using "lock bts". Inform compiler that any memory
- * from the start of the bit field up to and including the
- * dword containing this bit may be modified. (This is
- * overkill but shouldn't matter in practice since we're
- * unlikely to subsequently read other bits from the same bit
- * field.)
- */
- __asm__ __volatile__ ( "lock bts %1, %0"
- : "+m" ( *dwords ) : "Ir" ( bit ) );
-}
-
#endif /* _BITS_HYPERV_H */
return result;
}
-/**
- * Set bit atomically
- *
- * @v bits Bit field
- * @v bit Bit to set
- */
-static inline __attribute__ (( always_inline )) void
-hv_set_bit ( void *bits, unsigned int bit ) {
- struct {
- uint64_t qword[ ( bit / 64 ) + 1 ];
- } *qwords = bits;
-
- /* Set bit using "lock bts". Inform compiler that any memory
- * from the start of the bit field up to and including the
- * qword containing this bit may be modified. (This is
- * overkill but shouldn't matter in practice since we're
- * unlikely to subsequently read other bits from the same bit
- * field.)
- */
- __asm__ __volatile__ ( "lock bts %1, %0"
- : "+m" ( *qwords ) : "Ir" ( bit ) );
-}
-
#endif /* _BITS_HYPERV_H */
#include <ipxe/nap.h>
#include <ipxe/malloc.h>
#include <ipxe/iobuf.h>
+#include <ipxe/bitops.h>
#include <ipxe/hyperv.h>
#include <ipxe/vmbus.h>
group = ( vmdev->monitor / ( 8 * sizeof ( trigger->pending ) ));
bit = ( vmdev->monitor % ( 8 * sizeof ( trigger->pending ) ) );
trigger = &vmbus->monitor_out->trigger[group];
- hv_set_bit ( trigger, bit );
+ set_bit ( bit, trigger );
}
/**
return 0;
/* Set channel bit in interrupt page */
- hv_set_bit ( vmbus->intr->out, vmdev->channel );
+ set_bit ( vmdev->channel, vmbus->intr->out );
/* Signal the host */
vmdev->signal ( vmdev );