Commit e5c21603fce2e6143f7312211eaed47c16510ea3
Committed by
Alexander Graf
1 parent
a0549ef607
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
efi_loader: implement WaitForPacket event
The WaitForPacket event informs that a network package has been received by the SimpleNetworkProtocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Move is_signaled = true line into efi_net_push()] Signed-off-by: Alexander Graf <agraf@suse.de>
Showing 1 changed file with 16 additions and 0 deletions Side-by-side Diff
lib/efi_loader/efi_net.c
... | ... | @@ -24,6 +24,10 @@ |
24 | 24 | * to check if a new network packet has been received. |
25 | 25 | */ |
26 | 26 | static struct efi_event *network_timer_event; |
27 | +/* | |
28 | + * This event is signaled when a packet has been received. | |
29 | + */ | |
30 | +static struct efi_event *wait_for_packet; | |
27 | 31 | |
28 | 32 | struct efi_net_obj { |
29 | 33 | /* Generic EFI object parent class data */ |
... | ... | @@ -171,6 +175,7 @@ |
171 | 175 | static void efi_net_push(void *pkt, int len) |
172 | 176 | { |
173 | 177 | new_rx_packet = true; |
178 | + wait_for_packet->is_signaled = true; | |
174 | 179 | } |
175 | 180 | |
176 | 181 | static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this, |
... | ... | @@ -280,6 +285,17 @@ |
280 | 285 | /* Hook net up to the device list */ |
281 | 286 | list_add_tail(&netobj->parent.link, &efi_obj_list); |
282 | 287 | |
288 | + /* | |
289 | + * Create WaitForPacket event. | |
290 | + */ | |
291 | + r = efi_create_event(EVT_NOTIFY_WAIT, TPL_CALLBACK, | |
292 | + efi_network_timer_notify, NULL, | |
293 | + &wait_for_packet); | |
294 | + if (r != EFI_SUCCESS) { | |
295 | + printf("ERROR: Failed to register network event\n"); | |
296 | + return r; | |
297 | + } | |
298 | + netobj->net.wait_for_packet = wait_for_packet; | |
283 | 299 | /* |
284 | 300 | * Create a timer event. |
285 | 301 | * |