david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[efi] Allow calls to efi_snp_claim() and efi_snp_release() to be nested

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2015-09-01 16:19:08 +01:00
parent 8430642642
commit 9869ee5125
2 changed files with 8 additions and 7 deletions

View File

@ -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 */

View File

@ -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 )