mirror of https://github.com/ipxe/ipxe.git
[efi] Allow calls to efi_snp_claim() and efi_snp_release() to be nested
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/41/head
parent
8430642642
commit
9869ee5125
|
@ -73,14 +73,14 @@ extern int efi_snp_hii_install ( struct efi_snp_device *snpdev );
|
|||
extern void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev );
|
||||
extern struct efi_snp_device * find_snpdev ( EFI_HANDLE handle );
|
||||
extern struct efi_snp_device * last_opened_snpdev ( void );
|
||||
extern void efi_snp_set_claimed ( int claimed );
|
||||
extern void efi_snp_add_claim ( int delta );
|
||||
|
||||
/**
|
||||
* Claim network devices for use by iPXE
|
||||
*
|
||||
*/
|
||||
static inline void efi_snp_claim ( void ) {
|
||||
efi_snp_set_claimed ( 1 );
|
||||
efi_snp_add_claim ( +1 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ static inline void efi_snp_claim ( void ) {
|
|||
*
|
||||
*/
|
||||
static inline void efi_snp_release ( void ) {
|
||||
efi_snp_set_claimed ( 0 );
|
||||
efi_snp_add_claim ( -1 );
|
||||
}
|
||||
|
||||
#endif /* _IPXE_EFI_SNP_H */
|
||||
|
|
|
@ -1231,15 +1231,16 @@ struct efi_snp_device * last_opened_snpdev ( void ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set SNP claimed/released state
|
||||
* Add to SNP claimed/released count
|
||||
*
|
||||
* @v claimed Network devices are claimed for use by iPXE
|
||||
* @v delta Claim count change
|
||||
*/
|
||||
void efi_snp_set_claimed ( int claimed ) {
|
||||
void efi_snp_add_claim ( int delta ) {
|
||||
struct efi_snp_device *snpdev;
|
||||
|
||||
/* Claim SNP devices */
|
||||
efi_snp_claimed = claimed;
|
||||
efi_snp_claimed += delta;
|
||||
assert ( efi_snp_claimed >= 0 );
|
||||
|
||||
/* Update SNP mode state for each interface */
|
||||
list_for_each_entry ( snpdev, &efi_snp_devices, list )
|
||||
|
|
Loading…
Reference in New Issue