PxeBcDriver.c 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848
  1. /** @file
  2. Driver Binding functions implementation for UefiPxeBc Driver.
  3. (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
  4. Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include "PxeBcImpl.h"
  8. EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp4DriverBinding = {
  9. PxeBcIp4DriverBindingSupported,
  10. PxeBcIp4DriverBindingStart,
  11. PxeBcIp4DriverBindingStop,
  12. 0xa,
  13. NULL,
  14. NULL
  15. };
  16. EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp6DriverBinding = {
  17. PxeBcIp6DriverBindingSupported,
  18. PxeBcIp6DriverBindingStart,
  19. PxeBcIp6DriverBindingStop,
  20. 0xa,
  21. NULL,
  22. NULL
  23. };
  24. /**
  25. Get the Nic handle using any child handle in the IPv4 stack.
  26. @param[in] ControllerHandle Pointer to child handle over IPv4.
  27. @return NicHandle The pointer to the Nic handle.
  28. **/
  29. EFI_HANDLE
  30. PxeBcGetNicByIp4Children (
  31. IN EFI_HANDLE ControllerHandle
  32. )
  33. {
  34. EFI_HANDLE NicHandle;
  35. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiArpProtocolGuid);
  36. if (NicHandle == NULL) {
  37. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp4ProtocolGuid);
  38. if (NicHandle == NULL) {
  39. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiUdp4ProtocolGuid);
  40. if (NicHandle == NULL) {
  41. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp4ProtocolGuid);
  42. if (NicHandle == NULL) {
  43. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp4ProtocolGuid);
  44. if (NicHandle == NULL) {
  45. return NULL;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. return NicHandle;
  52. }
  53. /**
  54. Get the Nic handle using any child handle in the IPv6 stack.
  55. @param[in] ControllerHandle Pointer to child handle over IPv6.
  56. @return NicHandle The pointer to the Nic handle.
  57. **/
  58. EFI_HANDLE
  59. PxeBcGetNicByIp6Children (
  60. IN EFI_HANDLE ControllerHandle
  61. )
  62. {
  63. EFI_HANDLE NicHandle;
  64. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp6ProtocolGuid);
  65. if (NicHandle == NULL) {
  66. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiUdp6ProtocolGuid);
  67. if (NicHandle == NULL) {
  68. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid);
  69. if (NicHandle == NULL) {
  70. NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp6ProtocolGuid);
  71. if (NicHandle == NULL) {
  72. return NULL;
  73. }
  74. }
  75. }
  76. }
  77. return NicHandle;
  78. }
  79. /**
  80. Destroy the opened instances based on IPv4.
  81. @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
  82. @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
  83. **/
  84. VOID
  85. PxeBcDestroyIp4Children (
  86. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  87. IN PXEBC_PRIVATE_DATA *Private
  88. )
  89. {
  90. ASSERT (Private != NULL);
  91. if (Private->ArpChild != NULL) {
  92. //
  93. // Close Arp for PxeBc->Arp and destroy the instance.
  94. //
  95. gBS->CloseProtocol (
  96. Private->ArpChild,
  97. &gEfiArpProtocolGuid,
  98. This->DriverBindingHandle,
  99. Private->Controller
  100. );
  101. NetLibDestroyServiceChild (
  102. Private->Controller,
  103. This->DriverBindingHandle,
  104. &gEfiArpServiceBindingProtocolGuid,
  105. Private->ArpChild
  106. );
  107. }
  108. if (Private->Ip4Child != NULL) {
  109. //
  110. // Close Ip4 for background ICMP error message and destroy the instance.
  111. //
  112. gBS->CloseProtocol (
  113. Private->Ip4Child,
  114. &gEfiIp4ProtocolGuid,
  115. This->DriverBindingHandle,
  116. Private->Controller
  117. );
  118. NetLibDestroyServiceChild (
  119. Private->Controller,
  120. This->DriverBindingHandle,
  121. &gEfiIp4ServiceBindingProtocolGuid,
  122. Private->Ip4Child
  123. );
  124. }
  125. if (Private->Udp4WriteChild != NULL) {
  126. //
  127. // Close Udp4 for PxeBc->UdpWrite and destroy the instance.
  128. //
  129. gBS->CloseProtocol (
  130. Private->Udp4WriteChild,
  131. &gEfiUdp4ProtocolGuid,
  132. This->DriverBindingHandle,
  133. Private->Controller
  134. );
  135. NetLibDestroyServiceChild (
  136. Private->Controller,
  137. This->DriverBindingHandle,
  138. &gEfiUdp4ServiceBindingProtocolGuid,
  139. Private->Udp4WriteChild
  140. );
  141. }
  142. if (Private->Udp4ReadChild != NULL) {
  143. //
  144. // Close Udp4 for PxeBc->UdpRead and destroy the instance.
  145. //
  146. gBS->CloseProtocol (
  147. Private->Udp4ReadChild,
  148. &gEfiUdp4ProtocolGuid,
  149. This->DriverBindingHandle,
  150. Private->Controller
  151. );
  152. NetLibDestroyServiceChild (
  153. Private->Controller,
  154. This->DriverBindingHandle,
  155. &gEfiUdp4ServiceBindingProtocolGuid,
  156. Private->Udp4ReadChild
  157. );
  158. }
  159. if (Private->Mtftp4Child != NULL) {
  160. //
  161. // Close Mtftp4 for PxeBc->Mtftp4 and destroy the instance.
  162. //
  163. gBS->CloseProtocol (
  164. Private->Mtftp4Child,
  165. &gEfiMtftp4ProtocolGuid,
  166. This->DriverBindingHandle,
  167. Private->Controller
  168. );
  169. NetLibDestroyServiceChild (
  170. Private->Controller,
  171. This->DriverBindingHandle,
  172. &gEfiMtftp4ServiceBindingProtocolGuid,
  173. Private->Mtftp4Child
  174. );
  175. }
  176. if (Private->Dhcp4Child != NULL) {
  177. //
  178. // Close Dhcp4 for PxeBc->Dhcp4 and destroy the instance.
  179. //
  180. gBS->CloseProtocol (
  181. Private->Dhcp4Child,
  182. &gEfiDhcp4ProtocolGuid,
  183. This->DriverBindingHandle,
  184. Private->Controller
  185. );
  186. NetLibDestroyServiceChild (
  187. Private->Controller,
  188. This->DriverBindingHandle,
  189. &gEfiDhcp4ServiceBindingProtocolGuid,
  190. Private->Dhcp4Child
  191. );
  192. }
  193. if (Private->Ip4Nic != NULL) {
  194. //
  195. // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
  196. //
  197. gBS->CloseProtocol (
  198. Private->Controller,
  199. &gEfiCallerIdGuid,
  200. This->DriverBindingHandle,
  201. Private->Ip4Nic->Controller
  202. );
  203. gBS->UninstallMultipleProtocolInterfaces (
  204. Private->Ip4Nic->Controller,
  205. &gEfiDevicePathProtocolGuid,
  206. Private->Ip4Nic->DevicePath,
  207. &gEfiLoadFileProtocolGuid,
  208. &Private->Ip4Nic->LoadFile,
  209. &gEfiPxeBaseCodeProtocolGuid,
  210. &Private->PxeBc,
  211. NULL
  212. );
  213. FreePool (Private->Ip4Nic->DevicePath);
  214. if (Private->Snp != NULL) {
  215. //
  216. // Close SNP from the child virtual handle
  217. //
  218. gBS->CloseProtocol (
  219. Private->Ip4Nic->Controller,
  220. &gEfiSimpleNetworkProtocolGuid,
  221. This->DriverBindingHandle,
  222. Private->Ip4Nic->Controller
  223. );
  224. gBS->UninstallProtocolInterface (
  225. Private->Ip4Nic->Controller,
  226. &gEfiSimpleNetworkProtocolGuid,
  227. Private->Snp
  228. );
  229. }
  230. FreePool (Private->Ip4Nic);
  231. }
  232. Private->ArpChild = NULL;
  233. Private->Ip4Child = NULL;
  234. Private->Udp4WriteChild = NULL;
  235. Private->Udp4ReadChild = NULL;
  236. Private->Mtftp4Child = NULL;
  237. Private->Dhcp4Child = NULL;
  238. Private->Ip4Nic = NULL;
  239. }
  240. /**
  241. Destroy the opened instances based on IPv6.
  242. @param[in] This Pointer to the EFI_DRIVER_BINDING_PROTOCOL.
  243. @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
  244. **/
  245. VOID
  246. PxeBcDestroyIp6Children (
  247. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  248. IN PXEBC_PRIVATE_DATA *Private
  249. )
  250. {
  251. ASSERT (Private != NULL);
  252. if (Private->Ip6Child != NULL) {
  253. //
  254. // Close Ip6 for Ip6->Ip6Config and destroy the instance.
  255. //
  256. gBS->CloseProtocol (
  257. Private->Ip6Child,
  258. &gEfiIp6ProtocolGuid,
  259. This->DriverBindingHandle,
  260. Private->Controller
  261. );
  262. NetLibDestroyServiceChild (
  263. Private->Controller,
  264. This->DriverBindingHandle,
  265. &gEfiIp6ServiceBindingProtocolGuid,
  266. Private->Ip6Child
  267. );
  268. }
  269. if (Private->Udp6WriteChild != NULL) {
  270. //
  271. // Close Udp6 for PxeBc->UdpWrite and destroy the instance.
  272. //
  273. gBS->CloseProtocol (
  274. Private->Udp6WriteChild,
  275. &gEfiUdp6ProtocolGuid,
  276. This->DriverBindingHandle,
  277. Private->Controller
  278. );
  279. NetLibDestroyServiceChild (
  280. Private->Controller,
  281. This->DriverBindingHandle,
  282. &gEfiUdp6ServiceBindingProtocolGuid,
  283. Private->Udp6WriteChild
  284. );
  285. }
  286. if (Private->Udp6ReadChild != NULL) {
  287. //
  288. // Close Udp6 for PxeBc->UdpRead and destroy the instance.
  289. //
  290. gBS->CloseProtocol (
  291. Private->Udp6ReadChild,
  292. &gEfiUdp6ProtocolGuid,
  293. This->DriverBindingHandle,
  294. Private->Controller
  295. );
  296. NetLibDestroyServiceChild (
  297. Private->Controller,
  298. This->DriverBindingHandle,
  299. &gEfiUdp6ServiceBindingProtocolGuid,
  300. Private->Udp6ReadChild
  301. );
  302. }
  303. if (Private->Mtftp6Child != NULL) {
  304. //
  305. // Close Mtftp6 for PxeBc->Mtftp and destroy the instance.
  306. //
  307. gBS->CloseProtocol (
  308. Private->Mtftp6Child,
  309. &gEfiMtftp6ProtocolGuid,
  310. This->DriverBindingHandle,
  311. Private->Controller
  312. );
  313. NetLibDestroyServiceChild (
  314. Private->Controller,
  315. This->DriverBindingHandle,
  316. &gEfiMtftp6ServiceBindingProtocolGuid,
  317. Private->Mtftp6Child
  318. );
  319. }
  320. if (Private->Dhcp6Child != NULL) {
  321. //
  322. // Close Dhcp6 for PxeBc->Dhcp and destroy the instance.
  323. //
  324. gBS->CloseProtocol (
  325. Private->Dhcp6Child,
  326. &gEfiDhcp6ProtocolGuid,
  327. This->DriverBindingHandle,
  328. Private->Controller
  329. );
  330. NetLibDestroyServiceChild (
  331. Private->Controller,
  332. This->DriverBindingHandle,
  333. &gEfiDhcp6ServiceBindingProtocolGuid,
  334. Private->Dhcp6Child
  335. );
  336. }
  337. if (Private->Ip6Nic != NULL) {
  338. //
  339. // Close PxeBcPrivate from the parent Nic handle and destroy the virtual handle.
  340. //
  341. gBS->CloseProtocol (
  342. Private->Controller,
  343. &gEfiCallerIdGuid,
  344. This->DriverBindingHandle,
  345. Private->Ip6Nic->Controller
  346. );
  347. gBS->UninstallMultipleProtocolInterfaces (
  348. Private->Ip6Nic->Controller,
  349. &gEfiDevicePathProtocolGuid,
  350. Private->Ip6Nic->DevicePath,
  351. &gEfiLoadFileProtocolGuid,
  352. &Private->Ip6Nic->LoadFile,
  353. &gEfiPxeBaseCodeProtocolGuid,
  354. &Private->PxeBc,
  355. NULL
  356. );
  357. FreePool (Private->Ip6Nic->DevicePath);
  358. if (Private->Snp != NULL) {
  359. //
  360. // Close SNP from the child virtual handle
  361. //
  362. gBS->CloseProtocol (
  363. Private->Ip6Nic->Controller,
  364. &gEfiSimpleNetworkProtocolGuid,
  365. This->DriverBindingHandle,
  366. Private->Ip6Nic->Controller
  367. );
  368. gBS->UninstallProtocolInterface (
  369. Private->Ip6Nic->Controller,
  370. &gEfiSimpleNetworkProtocolGuid,
  371. Private->Snp
  372. );
  373. }
  374. FreePool (Private->Ip6Nic);
  375. }
  376. Private->Ip6Child = NULL;
  377. Private->Udp6WriteChild = NULL;
  378. Private->Udp6ReadChild = NULL;
  379. Private->Mtftp6Child = NULL;
  380. Private->Dhcp6Child = NULL;
  381. Private->Ip6Nic = NULL;
  382. Private->Mode.Ipv6Available = FALSE;
  383. }
  384. /**
  385. Check whether UNDI protocol supports IPv6.
  386. @param[in] ControllerHandle Controller handle.
  387. @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
  388. @param[out] Ipv6Support TRUE if UNDI supports IPv6.
  389. @retval EFI_SUCCESS Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully.
  390. @retval EFI_NOT_FOUND Don't know whether UNDI supports IPv6 since NII or AIP is not available.
  391. **/
  392. EFI_STATUS
  393. PxeBcCheckIpv6Support (
  394. IN EFI_HANDLE ControllerHandle,
  395. IN PXEBC_PRIVATE_DATA *Private,
  396. OUT BOOLEAN *Ipv6Support
  397. )
  398. {
  399. EFI_HANDLE Handle;
  400. EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
  401. EFI_STATUS Status;
  402. EFI_GUID *InfoTypesBuffer;
  403. UINTN InfoTypeBufferCount;
  404. UINTN TypeIndex;
  405. BOOLEAN Supported;
  406. VOID *InfoBlock;
  407. UINTN InfoBlockSize;
  408. ASSERT (Private != NULL && Ipv6Support != NULL);
  409. //
  410. // Check whether the UNDI supports IPv6 by NII protocol.
  411. //
  412. if (Private->Nii != NULL) {
  413. *Ipv6Support = Private->Nii->Ipv6Supported;
  414. return EFI_SUCCESS;
  415. }
  416. //
  417. // Check whether the UNDI supports IPv6 by AIP protocol.
  418. //
  419. //
  420. // Get the NIC handle by SNP protocol.
  421. //
  422. Handle = NetLibGetSnpHandle (ControllerHandle, NULL);
  423. if (Handle == NULL) {
  424. return EFI_NOT_FOUND;
  425. }
  426. Aip = NULL;
  427. Status = gBS->HandleProtocol (
  428. Handle,
  429. &gEfiAdapterInformationProtocolGuid,
  430. (VOID *)&Aip
  431. );
  432. if (EFI_ERROR (Status) || (Aip == NULL)) {
  433. return EFI_NOT_FOUND;
  434. }
  435. InfoTypesBuffer = NULL;
  436. InfoTypeBufferCount = 0;
  437. Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
  438. if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL)) {
  439. FreePool (InfoTypesBuffer);
  440. return EFI_NOT_FOUND;
  441. }
  442. Supported = FALSE;
  443. for (TypeIndex = 0; TypeIndex < InfoTypeBufferCount; TypeIndex++) {
  444. if (CompareGuid (&InfoTypesBuffer[TypeIndex], &gEfiAdapterInfoUndiIpv6SupportGuid)) {
  445. Supported = TRUE;
  446. break;
  447. }
  448. }
  449. FreePool (InfoTypesBuffer);
  450. if (!Supported) {
  451. return EFI_NOT_FOUND;
  452. }
  453. //
  454. // We now have adapter information block.
  455. //
  456. InfoBlock = NULL;
  457. InfoBlockSize = 0;
  458. Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);
  459. if (EFI_ERROR (Status) || (InfoBlock == NULL)) {
  460. FreePool (InfoBlock);
  461. return EFI_NOT_FOUND;
  462. }
  463. *Ipv6Support = ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *)InfoBlock)->Ipv6Support;
  464. FreePool (InfoBlock);
  465. return EFI_SUCCESS;
  466. }
  467. /**
  468. Create the opened instances based on IPv4.
  469. @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
  470. @param[in] ControllerHandle Handle of the child to destroy.
  471. @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
  472. @retval EFI_SUCCESS The instances based on IPv4 were all created successfully.
  473. @retval Others An unexpected error occurred.
  474. **/
  475. EFI_STATUS
  476. PxeBcCreateIp4Children (
  477. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  478. IN EFI_HANDLE ControllerHandle,
  479. IN PXEBC_PRIVATE_DATA *Private
  480. )
  481. {
  482. EFI_STATUS Status;
  483. IPv4_DEVICE_PATH Ip4Node;
  484. EFI_PXE_BASE_CODE_MODE *Mode;
  485. EFI_UDP4_CONFIG_DATA *Udp4CfgData;
  486. EFI_IP4_CONFIG_DATA *Ip4CfgData;
  487. EFI_IP4_MODE_DATA Ip4ModeData;
  488. PXEBC_PRIVATE_PROTOCOL *Id;
  489. EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
  490. if (Private->Ip4Nic != NULL) {
  491. //
  492. // Already created before.
  493. //
  494. return EFI_SUCCESS;
  495. }
  496. //
  497. // Create Dhcp4 child and open Dhcp4 protocol for PxeBc->Dhcp.
  498. //
  499. Status = NetLibCreateServiceChild (
  500. ControllerHandle,
  501. This->DriverBindingHandle,
  502. &gEfiDhcp4ServiceBindingProtocolGuid,
  503. &Private->Dhcp4Child
  504. );
  505. if (EFI_ERROR (Status)) {
  506. goto ON_ERROR;
  507. }
  508. Status = gBS->OpenProtocol (
  509. Private->Dhcp4Child,
  510. &gEfiDhcp4ProtocolGuid,
  511. (VOID **)&Private->Dhcp4,
  512. This->DriverBindingHandle,
  513. ControllerHandle,
  514. EFI_OPEN_PROTOCOL_BY_DRIVER
  515. );
  516. if (EFI_ERROR (Status)) {
  517. goto ON_ERROR;
  518. }
  519. //
  520. // Create Mtftp4 child and open Mtftp4 protocol for PxeBc->Mtftp.
  521. //
  522. Status = NetLibCreateServiceChild (
  523. ControllerHandle,
  524. This->DriverBindingHandle,
  525. &gEfiMtftp4ServiceBindingProtocolGuid,
  526. &Private->Mtftp4Child
  527. );
  528. if (EFI_ERROR (Status)) {
  529. goto ON_ERROR;
  530. }
  531. Status = gBS->OpenProtocol (
  532. Private->Mtftp4Child,
  533. &gEfiMtftp4ProtocolGuid,
  534. (VOID **)&Private->Mtftp4,
  535. This->DriverBindingHandle,
  536. ControllerHandle,
  537. EFI_OPEN_PROTOCOL_BY_DRIVER
  538. );
  539. if (EFI_ERROR (Status)) {
  540. goto ON_ERROR;
  541. }
  542. //
  543. // Create Udp4 child and open Udp4 protocol for PxeBc->UdpRead.
  544. //
  545. Status = NetLibCreateServiceChild (
  546. ControllerHandle,
  547. This->DriverBindingHandle,
  548. &gEfiUdp4ServiceBindingProtocolGuid,
  549. &Private->Udp4ReadChild
  550. );
  551. if (EFI_ERROR (Status)) {
  552. goto ON_ERROR;
  553. }
  554. Status = gBS->OpenProtocol (
  555. Private->Udp4ReadChild,
  556. &gEfiUdp4ProtocolGuid,
  557. (VOID **)&Private->Udp4Read,
  558. This->DriverBindingHandle,
  559. ControllerHandle,
  560. EFI_OPEN_PROTOCOL_BY_DRIVER
  561. );
  562. if (EFI_ERROR (Status)) {
  563. goto ON_ERROR;
  564. }
  565. //
  566. // Create Udp4 child and open Udp4 protocol for PxeBc->UdpWrite.
  567. //
  568. Status = NetLibCreateServiceChild (
  569. ControllerHandle,
  570. This->DriverBindingHandle,
  571. &gEfiUdp4ServiceBindingProtocolGuid,
  572. &Private->Udp4WriteChild
  573. );
  574. if (EFI_ERROR (Status)) {
  575. goto ON_ERROR;
  576. }
  577. Status = gBS->OpenProtocol (
  578. Private->Udp4WriteChild,
  579. &gEfiUdp4ProtocolGuid,
  580. (VOID **)&Private->Udp4Write,
  581. This->DriverBindingHandle,
  582. ControllerHandle,
  583. EFI_OPEN_PROTOCOL_BY_DRIVER
  584. );
  585. if (EFI_ERROR (Status)) {
  586. goto ON_ERROR;
  587. }
  588. //
  589. // Create Arp child and open Arp protocol for PxeBc->Arp.
  590. //
  591. Status = NetLibCreateServiceChild (
  592. ControllerHandle,
  593. This->DriverBindingHandle,
  594. &gEfiArpServiceBindingProtocolGuid,
  595. &Private->ArpChild
  596. );
  597. if (EFI_ERROR (Status)) {
  598. goto ON_ERROR;
  599. }
  600. Status = gBS->OpenProtocol (
  601. Private->ArpChild,
  602. &gEfiArpProtocolGuid,
  603. (VOID **)&Private->Arp,
  604. This->DriverBindingHandle,
  605. ControllerHandle,
  606. EFI_OPEN_PROTOCOL_BY_DRIVER
  607. );
  608. if (EFI_ERROR (Status)) {
  609. goto ON_ERROR;
  610. }
  611. //
  612. // Create Ip4 child and open Ip4 protocol for background ICMP packets.
  613. //
  614. Status = NetLibCreateServiceChild (
  615. ControllerHandle,
  616. This->DriverBindingHandle,
  617. &gEfiIp4ServiceBindingProtocolGuid,
  618. &Private->Ip4Child
  619. );
  620. if (EFI_ERROR (Status)) {
  621. goto ON_ERROR;
  622. }
  623. Status = gBS->OpenProtocol (
  624. Private->Ip4Child,
  625. &gEfiIp4ProtocolGuid,
  626. (VOID **)&Private->Ip4,
  627. This->DriverBindingHandle,
  628. ControllerHandle,
  629. EFI_OPEN_PROTOCOL_BY_DRIVER
  630. );
  631. if (EFI_ERROR (Status)) {
  632. goto ON_ERROR;
  633. }
  634. //
  635. // Get max packet size from Ip4 to calculate block size for Tftp later.
  636. //
  637. Status = Private->Ip4->GetModeData (Private->Ip4, &Ip4ModeData, NULL, NULL);
  638. if (EFI_ERROR (Status)) {
  639. goto ON_ERROR;
  640. }
  641. Private->Ip4MaxPacketSize = Ip4ModeData.MaxPacketSize;
  642. Private->Ip4Nic = AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC));
  643. if (Private->Ip4Nic == NULL) {
  644. return EFI_OUT_OF_RESOURCES;
  645. }
  646. Private->Ip4Nic->Private = Private;
  647. Private->Ip4Nic->Signature = PXEBC_VIRTUAL_NIC_SIGNATURE;
  648. //
  649. // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.
  650. //
  651. Status = gBS->HandleProtocol (
  652. ControllerHandle,
  653. &gEfiIp4Config2ProtocolGuid,
  654. (VOID **)&Private->Ip4Config2
  655. );
  656. if (EFI_ERROR (Status)) {
  657. goto ON_ERROR;
  658. }
  659. //
  660. // Create a device path node for Ipv4 virtual nic, and append it.
  661. //
  662. ZeroMem (&Ip4Node, sizeof (IPv4_DEVICE_PATH));
  663. Ip4Node.Header.Type = MESSAGING_DEVICE_PATH;
  664. Ip4Node.Header.SubType = MSG_IPv4_DP;
  665. Ip4Node.StaticIpAddress = FALSE;
  666. SetDevicePathNodeLength (&Ip4Node.Header, sizeof (Ip4Node));
  667. Private->Ip4Nic->DevicePath = AppendDevicePathNode (Private->DevicePath, &Ip4Node.Header);
  668. if (Private->Ip4Nic->DevicePath == NULL) {
  669. Status = EFI_OUT_OF_RESOURCES;
  670. goto ON_ERROR;
  671. }
  672. CopyMem (
  673. &Private->Ip4Nic->LoadFile,
  674. &gLoadFileProtocolTemplate,
  675. sizeof (EFI_LOAD_FILE_PROTOCOL)
  676. );
  677. //
  678. // Create a new handle for IPv4 virtual nic,
  679. // and install PxeBaseCode, LoadFile and DevicePath protocols.
  680. //
  681. Status = gBS->InstallMultipleProtocolInterfaces (
  682. &Private->Ip4Nic->Controller,
  683. &gEfiDevicePathProtocolGuid,
  684. Private->Ip4Nic->DevicePath,
  685. &gEfiLoadFileProtocolGuid,
  686. &Private->Ip4Nic->LoadFile,
  687. &gEfiPxeBaseCodeProtocolGuid,
  688. &Private->PxeBc,
  689. NULL
  690. );
  691. if (EFI_ERROR (Status)) {
  692. goto ON_ERROR;
  693. }
  694. if (Private->Snp != NULL) {
  695. //
  696. // Install SNP protocol on purpose is for some OS loader backward
  697. // compatibility consideration.
  698. //
  699. Status = gBS->InstallProtocolInterface (
  700. &Private->Ip4Nic->Controller,
  701. &gEfiSimpleNetworkProtocolGuid,
  702. EFI_NATIVE_INTERFACE,
  703. Private->Snp
  704. );
  705. if (EFI_ERROR (Status)) {
  706. goto ON_ERROR;
  707. }
  708. //
  709. // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
  710. // layering to perform the experiment.
  711. //
  712. Status = gBS->OpenProtocol (
  713. Private->Ip4Nic->Controller,
  714. &gEfiSimpleNetworkProtocolGuid,
  715. (VOID **)&Snp,
  716. This->DriverBindingHandle,
  717. Private->Ip4Nic->Controller,
  718. EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE
  719. );
  720. if (EFI_ERROR (Status)) {
  721. goto ON_ERROR;
  722. }
  723. }
  724. //
  725. // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
  726. // real NIC handle and the virtual IPv4 NIC handle.
  727. //
  728. Status = gBS->OpenProtocol (
  729. ControllerHandle,
  730. &gEfiCallerIdGuid,
  731. (VOID **)&Id,
  732. This->DriverBindingHandle,
  733. Private->Ip4Nic->Controller,
  734. EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
  735. );
  736. if (EFI_ERROR (Status)) {
  737. goto ON_ERROR;
  738. }
  739. //
  740. // Set default configure data for Udp4Read and Ip4 instance.
  741. //
  742. Mode = Private->PxeBc.Mode;
  743. Udp4CfgData = &Private->Udp4CfgData;
  744. Ip4CfgData = &Private->Ip4CfgData;
  745. Udp4CfgData->AcceptBroadcast = FALSE;
  746. Udp4CfgData->AcceptAnyPort = TRUE;
  747. Udp4CfgData->AllowDuplicatePort = TRUE;
  748. Udp4CfgData->TypeOfService = Mode->ToS;
  749. Udp4CfgData->TimeToLive = Mode->TTL;
  750. Udp4CfgData->ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
  751. Udp4CfgData->TransmitTimeout = PXEBC_DEFAULT_LIFETIME;
  752. Ip4CfgData->AcceptIcmpErrors = TRUE;
  753. Ip4CfgData->DefaultProtocol = EFI_IP_PROTO_ICMP;
  754. Ip4CfgData->TypeOfService = Mode->ToS;
  755. Ip4CfgData->TimeToLive = Mode->TTL;
  756. Ip4CfgData->ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
  757. Ip4CfgData->TransmitTimeout = PXEBC_DEFAULT_LIFETIME;
  758. return EFI_SUCCESS;
  759. ON_ERROR:
  760. PxeBcDestroyIp4Children (This, Private);
  761. return Status;
  762. }
  763. /**
  764. Create the opened instances based on IPv6.
  765. @param[in] This Pointer to EFI_DRIVER_BINDING_PROTOCOL.
  766. @param[in] ControllerHandle Handle of the child to destroy.
  767. @param[in] Private Handle Pointer to PXEBC_PRIVATE_DATA.
  768. @retval EFI_SUCCESS The instances based on IPv6 were all created successfully.
  769. @retval Others An unexpected error occurred.
  770. **/
  771. EFI_STATUS
  772. PxeBcCreateIp6Children (
  773. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  774. IN EFI_HANDLE ControllerHandle,
  775. IN PXEBC_PRIVATE_DATA *Private
  776. )
  777. {
  778. EFI_STATUS Status;
  779. IPv6_DEVICE_PATH Ip6Node;
  780. EFI_UDP6_CONFIG_DATA *Udp6CfgData;
  781. EFI_IP6_CONFIG_DATA *Ip6CfgData;
  782. EFI_IP6_MODE_DATA Ip6ModeData;
  783. PXEBC_PRIVATE_PROTOCOL *Id;
  784. EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
  785. UINTN Index;
  786. if (Private->Ip6Nic != NULL) {
  787. //
  788. // Already created before.
  789. //
  790. return EFI_SUCCESS;
  791. }
  792. Private->Ip6Nic = AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC));
  793. if (Private->Ip6Nic == NULL) {
  794. return EFI_OUT_OF_RESOURCES;
  795. }
  796. Private->Ip6Nic->Private = Private;
  797. Private->Ip6Nic->Signature = PXEBC_VIRTUAL_NIC_SIGNATURE;
  798. //
  799. // Create Dhcp6 child and open Dhcp6 protocol for PxeBc->Dhcp.
  800. //
  801. Status = NetLibCreateServiceChild (
  802. ControllerHandle,
  803. This->DriverBindingHandle,
  804. &gEfiDhcp6ServiceBindingProtocolGuid,
  805. &Private->Dhcp6Child
  806. );
  807. if (EFI_ERROR (Status)) {
  808. goto ON_ERROR;
  809. }
  810. Status = gBS->OpenProtocol (
  811. Private->Dhcp6Child,
  812. &gEfiDhcp6ProtocolGuid,
  813. (VOID **)&Private->Dhcp6,
  814. This->DriverBindingHandle,
  815. ControllerHandle,
  816. EFI_OPEN_PROTOCOL_BY_DRIVER
  817. );
  818. if (EFI_ERROR (Status)) {
  819. goto ON_ERROR;
  820. }
  821. //
  822. // Generate a random IAID for the Dhcp6 assigned address.
  823. //
  824. Private->IaId = NET_RANDOM (NetRandomInitSeed ());
  825. if (Private->Snp != NULL) {
  826. for (Index = 0; Index < Private->Snp->Mode->HwAddressSize; Index++) {
  827. Private->IaId |= (Private->Snp->Mode->CurrentAddress.Addr[Index] << ((Index << 3) & 31));
  828. }
  829. }
  830. //
  831. // Create Mtftp6 child and open Mtftp6 protocol for PxeBc->Mtftp.
  832. //
  833. Status = NetLibCreateServiceChild (
  834. ControllerHandle,
  835. This->DriverBindingHandle,
  836. &gEfiMtftp6ServiceBindingProtocolGuid,
  837. &Private->Mtftp6Child
  838. );
  839. if (EFI_ERROR (Status)) {
  840. goto ON_ERROR;
  841. }
  842. Status = gBS->OpenProtocol (
  843. Private->Mtftp6Child,
  844. &gEfiMtftp6ProtocolGuid,
  845. (VOID **)&Private->Mtftp6,
  846. This->DriverBindingHandle,
  847. ControllerHandle,
  848. EFI_OPEN_PROTOCOL_BY_DRIVER
  849. );
  850. if (EFI_ERROR (Status)) {
  851. goto ON_ERROR;
  852. }
  853. //
  854. // Create Udp6 child and open Udp6 protocol for PxeBc->UdpRead.
  855. //
  856. Status = NetLibCreateServiceChild (
  857. ControllerHandle,
  858. This->DriverBindingHandle,
  859. &gEfiUdp6ServiceBindingProtocolGuid,
  860. &Private->Udp6ReadChild
  861. );
  862. if (EFI_ERROR (Status)) {
  863. goto ON_ERROR;
  864. }
  865. Status = gBS->OpenProtocol (
  866. Private->Udp6ReadChild,
  867. &gEfiUdp6ProtocolGuid,
  868. (VOID **)&Private->Udp6Read,
  869. This->DriverBindingHandle,
  870. ControllerHandle,
  871. EFI_OPEN_PROTOCOL_BY_DRIVER
  872. );
  873. if (EFI_ERROR (Status)) {
  874. goto ON_ERROR;
  875. }
  876. //
  877. // Create Udp6 child and open Udp6 protocol for PxeBc->UdpWrite.
  878. //
  879. Status = NetLibCreateServiceChild (
  880. ControllerHandle,
  881. This->DriverBindingHandle,
  882. &gEfiUdp6ServiceBindingProtocolGuid,
  883. &Private->Udp6WriteChild
  884. );
  885. if (EFI_ERROR (Status)) {
  886. goto ON_ERROR;
  887. }
  888. Status = gBS->OpenProtocol (
  889. Private->Udp6WriteChild,
  890. &gEfiUdp6ProtocolGuid,
  891. (VOID **)&Private->Udp6Write,
  892. This->DriverBindingHandle,
  893. ControllerHandle,
  894. EFI_OPEN_PROTOCOL_BY_DRIVER
  895. );
  896. if (EFI_ERROR (Status)) {
  897. goto ON_ERROR;
  898. }
  899. //
  900. // Create Ip6 child and open Ip6 protocol for background ICMP6 packets.
  901. //
  902. Status = NetLibCreateServiceChild (
  903. ControllerHandle,
  904. This->DriverBindingHandle,
  905. &gEfiIp6ServiceBindingProtocolGuid,
  906. &Private->Ip6Child
  907. );
  908. if (EFI_ERROR (Status)) {
  909. goto ON_ERROR;
  910. }
  911. Status = gBS->OpenProtocol (
  912. Private->Ip6Child,
  913. &gEfiIp6ProtocolGuid,
  914. (VOID **)&Private->Ip6,
  915. This->DriverBindingHandle,
  916. ControllerHandle,
  917. EFI_OPEN_PROTOCOL_BY_DRIVER
  918. );
  919. if (EFI_ERROR (Status)) {
  920. goto ON_ERROR;
  921. }
  922. //
  923. // Get max packet size from Ip6 to calculate block size for Tftp later.
  924. //
  925. Status = Private->Ip6->GetModeData (Private->Ip6, &Ip6ModeData, NULL, NULL);
  926. if (EFI_ERROR (Status)) {
  927. goto ON_ERROR;
  928. }
  929. Private->Ip6MaxPacketSize = Ip6ModeData.MaxPacketSize;
  930. if (Ip6ModeData.AddressList != NULL) {
  931. FreePool (Ip6ModeData.AddressList);
  932. }
  933. if (Ip6ModeData.GroupTable != NULL) {
  934. FreePool (Ip6ModeData.GroupTable);
  935. }
  936. if (Ip6ModeData.RouteTable != NULL) {
  937. FreePool (Ip6ModeData.RouteTable);
  938. }
  939. if (Ip6ModeData.NeighborCache != NULL) {
  940. FreePool (Ip6ModeData.NeighborCache);
  941. }
  942. if (Ip6ModeData.PrefixTable != NULL) {
  943. FreePool (Ip6ModeData.PrefixTable);
  944. }
  945. if (Ip6ModeData.IcmpTypeList != NULL) {
  946. FreePool (Ip6ModeData.IcmpTypeList);
  947. }
  948. //
  949. // Locate Ip6->Ip6Config and store it for set IPv6 address.
  950. //
  951. Status = gBS->HandleProtocol (
  952. ControllerHandle,
  953. &gEfiIp6ConfigProtocolGuid,
  954. (VOID **)&Private->Ip6Cfg
  955. );
  956. if (EFI_ERROR (Status)) {
  957. goto ON_ERROR;
  958. }
  959. //
  960. // Create a device path node for Ipv6 virtual nic, and append it.
  961. //
  962. ZeroMem (&Ip6Node, sizeof (IPv6_DEVICE_PATH));
  963. Ip6Node.Header.Type = MESSAGING_DEVICE_PATH;
  964. Ip6Node.Header.SubType = MSG_IPv6_DP;
  965. Ip6Node.PrefixLength = IP6_PREFIX_LENGTH;
  966. SetDevicePathNodeLength (&Ip6Node.Header, sizeof (Ip6Node));
  967. Private->Ip6Nic->DevicePath = AppendDevicePathNode (Private->DevicePath, &Ip6Node.Header);
  968. if (Private->Ip6Nic->DevicePath == NULL) {
  969. Status = EFI_OUT_OF_RESOURCES;
  970. goto ON_ERROR;
  971. }
  972. CopyMem (
  973. &Private->Ip6Nic->LoadFile,
  974. &gLoadFileProtocolTemplate,
  975. sizeof (EFI_LOAD_FILE_PROTOCOL)
  976. );
  977. //
  978. // Create a new handle for IPv6 virtual nic,
  979. // and install PxeBaseCode, LoadFile and DevicePath protocols.
  980. //
  981. Status = gBS->InstallMultipleProtocolInterfaces (
  982. &Private->Ip6Nic->Controller,
  983. &gEfiDevicePathProtocolGuid,
  984. Private->Ip6Nic->DevicePath,
  985. &gEfiLoadFileProtocolGuid,
  986. &Private->Ip6Nic->LoadFile,
  987. &gEfiPxeBaseCodeProtocolGuid,
  988. &Private->PxeBc,
  989. NULL
  990. );
  991. if (EFI_ERROR (Status)) {
  992. goto ON_ERROR;
  993. }
  994. if (Private->Snp != NULL) {
  995. //
  996. // Install SNP protocol on purpose is for some OS loader backward
  997. // compatibility consideration.
  998. //
  999. Status = gBS->InstallProtocolInterface (
  1000. &Private->Ip6Nic->Controller,
  1001. &gEfiSimpleNetworkProtocolGuid,
  1002. EFI_NATIVE_INTERFACE,
  1003. Private->Snp
  1004. );
  1005. if (EFI_ERROR (Status)) {
  1006. goto ON_ERROR;
  1007. }
  1008. //
  1009. // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
  1010. // layering to perform the experiment.
  1011. //
  1012. Status = gBS->OpenProtocol (
  1013. Private->Ip6Nic->Controller,
  1014. &gEfiSimpleNetworkProtocolGuid,
  1015. (VOID **)&Snp,
  1016. This->DriverBindingHandle,
  1017. Private->Ip6Nic->Controller,
  1018. EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE
  1019. );
  1020. if (EFI_ERROR (Status)) {
  1021. goto ON_ERROR;
  1022. }
  1023. }
  1024. //
  1025. // Open PxeBaseCodePrivate protocol by child to setup a parent-child relationship between
  1026. // real NIC handle and the virtual IPv6 NIC handle.
  1027. //
  1028. Status = gBS->OpenProtocol (
  1029. ControllerHandle,
  1030. &gEfiCallerIdGuid,
  1031. (VOID **)&Id,
  1032. This->DriverBindingHandle,
  1033. Private->Ip6Nic->Controller,
  1034. EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
  1035. );
  1036. if (EFI_ERROR (Status)) {
  1037. goto ON_ERROR;
  1038. }
  1039. //
  1040. // Set IPv6 available flag and set default configure data for
  1041. // Udp6Read and Ip6 instance.
  1042. //
  1043. Status = PxeBcCheckIpv6Support (ControllerHandle, Private, &Private->Mode.Ipv6Available);
  1044. if (EFI_ERROR (Status)) {
  1045. //
  1046. // Fail to get the data whether UNDI supports IPv6. Set default value.
  1047. //
  1048. Private->Mode.Ipv6Available = TRUE;
  1049. }
  1050. if (!Private->Mode.Ipv6Available) {
  1051. goto ON_ERROR;
  1052. }
  1053. Udp6CfgData = &Private->Udp6CfgData;
  1054. Ip6CfgData = &Private->Ip6CfgData;
  1055. Udp6CfgData->AcceptAnyPort = TRUE;
  1056. Udp6CfgData->AllowDuplicatePort = TRUE;
  1057. Udp6CfgData->HopLimit = PXEBC_DEFAULT_HOPLIMIT;
  1058. Udp6CfgData->ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
  1059. Udp6CfgData->TransmitTimeout = PXEBC_DEFAULT_LIFETIME;
  1060. Ip6CfgData->AcceptIcmpErrors = TRUE;
  1061. Ip6CfgData->DefaultProtocol = IP6_ICMP;
  1062. Ip6CfgData->HopLimit = PXEBC_DEFAULT_HOPLIMIT;
  1063. Ip6CfgData->ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
  1064. Ip6CfgData->TransmitTimeout = PXEBC_DEFAULT_LIFETIME;
  1065. return EFI_SUCCESS;
  1066. ON_ERROR:
  1067. PxeBcDestroyIp6Children (This, Private);
  1068. return Status;
  1069. }
  1070. /**
  1071. The entry point for UefiPxeBc driver that installs the driver
  1072. binding and component name protocol on its image.
  1073. @param[in] ImageHandle The Image handle of the driver.
  1074. @param[in] SystemTable The system table.
  1075. @return EFI_SUCCESS
  1076. @return Others
  1077. **/
  1078. EFI_STATUS
  1079. EFIAPI
  1080. PxeBcDriverEntryPoint (
  1081. IN EFI_HANDLE ImageHandle,
  1082. IN EFI_SYSTEM_TABLE *SystemTable
  1083. )
  1084. {
  1085. EFI_STATUS Status;
  1086. if ((PcdGet8 (PcdIPv4PXESupport) == PXE_DISABLED) && (PcdGet8 (PcdIPv6PXESupport) == PXE_DISABLED)) {
  1087. return EFI_UNSUPPORTED;
  1088. }
  1089. Status = EfiLibInstallDriverBindingComponentName2 (
  1090. ImageHandle,
  1091. SystemTable,
  1092. &gPxeBcIp4DriverBinding,
  1093. ImageHandle,
  1094. &gPxeBcComponentName,
  1095. &gPxeBcComponentName2
  1096. );
  1097. if (EFI_ERROR (Status)) {
  1098. return Status;
  1099. }
  1100. Status = EfiLibInstallDriverBindingComponentName2 (
  1101. ImageHandle,
  1102. SystemTable,
  1103. &gPxeBcIp6DriverBinding,
  1104. NULL,
  1105. &gPxeBcComponentName,
  1106. &gPxeBcComponentName2
  1107. );
  1108. if (EFI_ERROR (Status)) {
  1109. EfiLibUninstallDriverBindingComponentName2 (
  1110. &gPxeBcIp4DriverBinding,
  1111. &gPxeBcComponentName,
  1112. &gPxeBcComponentName2
  1113. );
  1114. }
  1115. return Status;
  1116. }
  1117. /**
  1118. Test to see if this driver supports ControllerHandle. This is the worker function for
  1119. PxeBcIp4(6)DriverBindingSupported.
  1120. @param[in] This The pointer to the driver binding protocol.
  1121. @param[in] ControllerHandle The handle of device to be tested.
  1122. @param[in] RemainingDevicePath Optional parameter used to pick a specific child
  1123. device to be started.
  1124. @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
  1125. @retval EFI_SUCCESS This driver supports this device.
  1126. @retval EFI_UNSUPPORTED This driver does not support this device.
  1127. **/
  1128. EFI_STATUS
  1129. EFIAPI
  1130. PxeBcSupported (
  1131. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1132. IN EFI_HANDLE ControllerHandle,
  1133. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
  1134. IN UINT8 IpVersion
  1135. )
  1136. {
  1137. EFI_STATUS Status;
  1138. EFI_GUID *DhcpServiceBindingGuid;
  1139. EFI_GUID *MtftpServiceBindingGuid;
  1140. if (IpVersion == IP_VERSION_4) {
  1141. if (PcdGet8 (PcdIPv4PXESupport) == PXE_DISABLED) {
  1142. return EFI_UNSUPPORTED;
  1143. }
  1144. DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
  1145. MtftpServiceBindingGuid = &gEfiMtftp4ServiceBindingProtocolGuid;
  1146. } else {
  1147. if (PcdGet8 (PcdIPv6PXESupport) == PXE_DISABLED) {
  1148. return EFI_UNSUPPORTED;
  1149. }
  1150. DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid;
  1151. MtftpServiceBindingGuid = &gEfiMtftp6ServiceBindingProtocolGuid;
  1152. }
  1153. //
  1154. // Try to open the Mtftp and Dhcp protocol to test whether IP stack is ready.
  1155. //
  1156. Status = gBS->OpenProtocol (
  1157. ControllerHandle,
  1158. DhcpServiceBindingGuid,
  1159. NULL,
  1160. This->DriverBindingHandle,
  1161. ControllerHandle,
  1162. EFI_OPEN_PROTOCOL_TEST_PROTOCOL
  1163. );
  1164. if (!EFI_ERROR (Status)) {
  1165. Status = gBS->OpenProtocol (
  1166. ControllerHandle,
  1167. MtftpServiceBindingGuid,
  1168. NULL,
  1169. This->DriverBindingHandle,
  1170. ControllerHandle,
  1171. EFI_OPEN_PROTOCOL_TEST_PROTOCOL
  1172. );
  1173. }
  1174. //
  1175. // It's unsupported case if IP stack are not ready.
  1176. //
  1177. if (EFI_ERROR (Status)) {
  1178. return EFI_UNSUPPORTED;
  1179. }
  1180. return EFI_SUCCESS;
  1181. }
  1182. /**
  1183. Start this driver on ControllerHandle. This is the worker function for
  1184. PxeBcIp4(6)DriverBindingStart.
  1185. @param[in] This The pointer to the driver binding protocol.
  1186. @param[in] ControllerHandle The handle of device to be started.
  1187. @param[in] RemainingDevicePath Optional parameter used to pick a specific child
  1188. device to be started.
  1189. @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
  1190. @retval EFI_SUCCESS This driver is installed to ControllerHandle.
  1191. @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
  1192. @retval other This driver does not support this device.
  1193. **/
  1194. EFI_STATUS
  1195. EFIAPI
  1196. PxeBcStart (
  1197. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1198. IN EFI_HANDLE ControllerHandle,
  1199. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
  1200. IN UINT8 IpVersion
  1201. )
  1202. {
  1203. PXEBC_PRIVATE_DATA *Private;
  1204. EFI_STATUS Status;
  1205. PXEBC_PRIVATE_PROTOCOL *Id;
  1206. BOOLEAN FirstStart;
  1207. FirstStart = FALSE;
  1208. Status = gBS->OpenProtocol (
  1209. ControllerHandle,
  1210. &gEfiCallerIdGuid,
  1211. (VOID **)&Id,
  1212. This->DriverBindingHandle,
  1213. ControllerHandle,
  1214. EFI_OPEN_PROTOCOL_GET_PROTOCOL
  1215. );
  1216. if (!EFI_ERROR (Status)) {
  1217. //
  1218. // Skip the initialization if the driver has been started already.
  1219. //
  1220. Private = PXEBC_PRIVATE_DATA_FROM_ID (Id);
  1221. } else {
  1222. FirstStart = TRUE;
  1223. //
  1224. // If the driver has not been started yet, it should do initialization.
  1225. //
  1226. Private = AllocateZeroPool (sizeof (PXEBC_PRIVATE_DATA));
  1227. if (Private == NULL) {
  1228. return EFI_OUT_OF_RESOURCES;
  1229. }
  1230. CopyMem (
  1231. &Private->PxeBc,
  1232. &gPxeBcProtocolTemplate,
  1233. sizeof (EFI_PXE_BASE_CODE_PROTOCOL)
  1234. );
  1235. Private->Signature = PXEBC_PRIVATE_DATA_SIGNATURE;
  1236. Private->Controller = ControllerHandle;
  1237. Private->Image = This->ImageHandle;
  1238. Private->PxeBc.Mode = &Private->Mode;
  1239. Private->Mode.Ipv6Supported = TRUE;
  1240. Private->Mode.AutoArp = TRUE;
  1241. Private->Mode.TTL = DEFAULT_TTL;
  1242. Private->Mode.ToS = DEFAULT_ToS;
  1243. //
  1244. // Open device path to prepare for appending virtual NIC node.
  1245. //
  1246. Status = gBS->OpenProtocol (
  1247. ControllerHandle,
  1248. &gEfiDevicePathProtocolGuid,
  1249. (VOID **)&Private->DevicePath,
  1250. This->DriverBindingHandle,
  1251. ControllerHandle,
  1252. EFI_OPEN_PROTOCOL_GET_PROTOCOL
  1253. );
  1254. if (EFI_ERROR (Status)) {
  1255. goto ON_ERROR;
  1256. }
  1257. //
  1258. // Get the NII interface if it exists, it's not required.
  1259. //
  1260. Status = gBS->OpenProtocol (
  1261. ControllerHandle,
  1262. &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
  1263. (VOID **)&Private->Nii,
  1264. This->DriverBindingHandle,
  1265. ControllerHandle,
  1266. EFI_OPEN_PROTOCOL_GET_PROTOCOL
  1267. );
  1268. if (EFI_ERROR (Status)) {
  1269. Private->Nii = NULL;
  1270. }
  1271. //
  1272. // Install PxeBaseCodePrivate protocol onto the real NIC handler.
  1273. // PxeBaseCodePrivate protocol is only used to keep the relationship between
  1274. // NIC handle and virtual child handles.
  1275. // gEfiCallerIdGuid will be used as its protocol guid.
  1276. //
  1277. Status = gBS->InstallProtocolInterface (
  1278. &ControllerHandle,
  1279. &gEfiCallerIdGuid,
  1280. EFI_NATIVE_INTERFACE,
  1281. &Private->Id
  1282. );
  1283. if (EFI_ERROR (Status)) {
  1284. goto ON_ERROR;
  1285. }
  1286. //
  1287. // Try to locate SNP protocol.
  1288. //
  1289. NetLibGetSnpHandle (ControllerHandle, &Private->Snp);
  1290. }
  1291. if (IpVersion == IP_VERSION_4) {
  1292. //
  1293. // Try to create virtual NIC handle for IPv4.
  1294. //
  1295. Status = PxeBcCreateIp4Children (This, ControllerHandle, Private);
  1296. } else {
  1297. //
  1298. // Try to create virtual NIC handle for IPv6.
  1299. //
  1300. Status = PxeBcCreateIp6Children (This, ControllerHandle, Private);
  1301. }
  1302. if (EFI_ERROR (Status)) {
  1303. //
  1304. // Failed to start PXE driver if IPv4 and IPv6 stack are both not available.
  1305. //
  1306. Status = EFI_DEVICE_ERROR;
  1307. goto ON_ERROR;
  1308. }
  1309. return EFI_SUCCESS;
  1310. ON_ERROR:
  1311. if (FirstStart) {
  1312. gBS->UninstallProtocolInterface (
  1313. ControllerHandle,
  1314. &gEfiCallerIdGuid,
  1315. &Private->Id
  1316. );
  1317. }
  1318. if (IpVersion == IP_VERSION_4) {
  1319. PxeBcDestroyIp4Children (This, Private);
  1320. } else {
  1321. PxeBcDestroyIp6Children (This, Private);
  1322. }
  1323. if (FirstStart && (Private != NULL)) {
  1324. FreePool (Private);
  1325. }
  1326. return Status;
  1327. }
  1328. /**
  1329. Stop this driver on ControllerHandle. This is the worker function for
  1330. PxeBcIp4(6)DriverBindingStop.
  1331. @param[in] This Protocol instance pointer.
  1332. @param[in] ControllerHandle Handle of device to stop driver on.
  1333. @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
  1334. children is zero stop the entire bus driver.
  1335. @param[in] ChildHandleBuffer List of Child Handles to Stop.
  1336. @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
  1337. @retval EFI_SUCCESS This driver was removed ControllerHandle.
  1338. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  1339. @retval Others This driver was not removed from this device
  1340. **/
  1341. EFI_STATUS
  1342. EFIAPI
  1343. PxeBcStop (
  1344. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1345. IN EFI_HANDLE ControllerHandle,
  1346. IN UINTN NumberOfChildren,
  1347. IN EFI_HANDLE *ChildHandleBuffer,
  1348. IN UINT8 IpVersion
  1349. )
  1350. {
  1351. PXEBC_PRIVATE_DATA *Private;
  1352. PXEBC_VIRTUAL_NIC *VirtualNic;
  1353. EFI_LOAD_FILE_PROTOCOL *LoadFile;
  1354. EFI_STATUS Status;
  1355. EFI_HANDLE NicHandle;
  1356. PXEBC_PRIVATE_PROTOCOL *Id;
  1357. Private = NULL;
  1358. NicHandle = NULL;
  1359. VirtualNic = NULL;
  1360. LoadFile = NULL;
  1361. Id = NULL;
  1362. Status = gBS->OpenProtocol (
  1363. ControllerHandle,
  1364. &gEfiLoadFileProtocolGuid,
  1365. (VOID **)&LoadFile,
  1366. This->DriverBindingHandle,
  1367. ControllerHandle,
  1368. EFI_OPEN_PROTOCOL_GET_PROTOCOL
  1369. );
  1370. if (EFI_ERROR (Status)) {
  1371. //
  1372. // Get the Nic handle by any pass-over service child handle.
  1373. //
  1374. if (IpVersion == IP_VERSION_4) {
  1375. NicHandle = PxeBcGetNicByIp4Children (ControllerHandle);
  1376. } else {
  1377. NicHandle = PxeBcGetNicByIp6Children (ControllerHandle);
  1378. }
  1379. if (NicHandle == NULL) {
  1380. return EFI_SUCCESS;
  1381. }
  1382. //
  1383. // Try to retrieve the private data by PxeBcPrivate protocol.
  1384. //
  1385. Status = gBS->OpenProtocol (
  1386. NicHandle,
  1387. &gEfiCallerIdGuid,
  1388. (VOID **)&Id,
  1389. This->DriverBindingHandle,
  1390. ControllerHandle,
  1391. EFI_OPEN_PROTOCOL_GET_PROTOCOL
  1392. );
  1393. if (EFI_ERROR (Status)) {
  1394. return Status;
  1395. }
  1396. Private = PXEBC_PRIVATE_DATA_FROM_ID (Id);
  1397. } else {
  1398. //
  1399. // It's a virtual handle with LoadFileProtocol.
  1400. //
  1401. Status = gBS->OpenProtocol (
  1402. ControllerHandle,
  1403. &gEfiLoadFileProtocolGuid,
  1404. (VOID **)&LoadFile,
  1405. This->DriverBindingHandle,
  1406. ControllerHandle,
  1407. EFI_OPEN_PROTOCOL_GET_PROTOCOL
  1408. );
  1409. if (EFI_ERROR (Status)) {
  1410. return Status;
  1411. }
  1412. VirtualNic = PXEBC_VIRTUAL_NIC_FROM_LOADFILE (LoadFile);
  1413. Private = VirtualNic->Private;
  1414. NicHandle = Private->Controller;
  1415. }
  1416. //
  1417. // Stop functionality of PXE Base Code protocol
  1418. //
  1419. Status = Private->PxeBc.Stop (&Private->PxeBc);
  1420. if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_STARTED)) {
  1421. return Status;
  1422. }
  1423. if ((Private->Ip4Nic != NULL) && (IpVersion == IP_VERSION_4)) {
  1424. PxeBcDestroyIp4Children (This, Private);
  1425. }
  1426. if ((Private->Ip6Nic != NULL) && (IpVersion == IP_VERSION_6)) {
  1427. PxeBcDestroyIp6Children (This, Private);
  1428. }
  1429. if ((Private->Ip4Nic == NULL) && (Private->Ip6Nic == NULL)) {
  1430. gBS->UninstallProtocolInterface (
  1431. NicHandle,
  1432. &gEfiCallerIdGuid,
  1433. &Private->Id
  1434. );
  1435. FreePool (Private);
  1436. }
  1437. return EFI_SUCCESS;
  1438. }
  1439. /**
  1440. Test to see if this driver supports ControllerHandle. This service
  1441. is called by the EFI boot service ConnectController(). In
  1442. order to make drivers as small as possible, there are a few calling
  1443. restrictions for this service. ConnectController() must
  1444. follow these calling restrictions. If any other agent wishes to call
  1445. Supported() it must also follow these calling restrictions.
  1446. @param[in] This The pointer to the driver binding protocol.
  1447. @param[in] ControllerHandle The handle of device to be tested.
  1448. @param[in] RemainingDevicePath Optional parameter used to pick a specific child
  1449. device to be started.
  1450. @retval EFI_SUCCESS This driver supports this device.
  1451. @retval EFI_UNSUPPORTED This driver does not support this device.
  1452. **/
  1453. EFI_STATUS
  1454. EFIAPI
  1455. PxeBcIp4DriverBindingSupported (
  1456. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1457. IN EFI_HANDLE ControllerHandle,
  1458. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  1459. )
  1460. {
  1461. return PxeBcSupported (
  1462. This,
  1463. ControllerHandle,
  1464. RemainingDevicePath,
  1465. IP_VERSION_4
  1466. );
  1467. }
  1468. /**
  1469. Start this driver on ControllerHandle. This service is called by the
  1470. EFI boot service ConnectController(). In order to make
  1471. drivers as small as possible, there are a few calling restrictions for
  1472. this service. ConnectController() must follow these
  1473. calling restrictions. If any other agent wishes to call Start() it
  1474. must also follow these calling restrictions.
  1475. @param[in] This The pointer to the driver binding protocol.
  1476. @param[in] ControllerHandle The handle of device to be started.
  1477. @param[in] RemainingDevicePath Optional parameter used to pick a specific child
  1478. device to be started.
  1479. @retval EFI_SUCCESS This driver is installed to ControllerHandle.
  1480. @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
  1481. @retval other This driver does not support this device.
  1482. **/
  1483. EFI_STATUS
  1484. EFIAPI
  1485. PxeBcIp4DriverBindingStart (
  1486. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1487. IN EFI_HANDLE ControllerHandle,
  1488. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  1489. )
  1490. {
  1491. return PxeBcStart (
  1492. This,
  1493. ControllerHandle,
  1494. RemainingDevicePath,
  1495. IP_VERSION_4
  1496. );
  1497. }
  1498. /**
  1499. Stop this driver on ControllerHandle. This service is called by the
  1500. EFI boot service DisconnectController(). In order to
  1501. make drivers as small as possible, there are a few calling
  1502. restrictions for this service. DisconnectController()
  1503. must follow these calling restrictions. If any other agent wishes
  1504. to call Stop() it must also follow these calling restrictions.
  1505. @param[in] This Protocol instance pointer.
  1506. @param[in] ControllerHandle Handle of device to stop driver on
  1507. @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
  1508. children is zero stop the entire bus driver.
  1509. @param[in] ChildHandleBuffer List of Child Handles to Stop.
  1510. @retval EFI_SUCCESS This driver is removed ControllerHandle
  1511. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  1512. @retval Others This driver was not removed from this device.
  1513. **/
  1514. EFI_STATUS
  1515. EFIAPI
  1516. PxeBcIp4DriverBindingStop (
  1517. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1518. IN EFI_HANDLE ControllerHandle,
  1519. IN UINTN NumberOfChildren,
  1520. IN EFI_HANDLE *ChildHandleBuffer
  1521. )
  1522. {
  1523. return PxeBcStop (
  1524. This,
  1525. ControllerHandle,
  1526. NumberOfChildren,
  1527. ChildHandleBuffer,
  1528. IP_VERSION_4
  1529. );
  1530. }
  1531. /**
  1532. Test to see if this driver supports ControllerHandle. This service
  1533. is called by the EFI boot service ConnectController(). In
  1534. order to make drivers as small as possible, there are a few calling
  1535. restrictions for this service. ConnectController() must
  1536. follow these calling restrictions. If any other agent wishes to call
  1537. Supported() it must also follow these calling restrictions.
  1538. @param[in] This The pointer to the driver binding protocol.
  1539. @param[in] ControllerHandle The handle of device to be tested.
  1540. @param[in] RemainingDevicePath Optional parameter use to pick a specific child
  1541. device to be started.
  1542. @retval EFI_SUCCESS This driver supports this device.
  1543. @retval EFI_UNSUPPORTED This driver does not support this device.
  1544. **/
  1545. EFI_STATUS
  1546. EFIAPI
  1547. PxeBcIp6DriverBindingSupported (
  1548. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1549. IN EFI_HANDLE ControllerHandle,
  1550. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  1551. )
  1552. {
  1553. return PxeBcSupported (
  1554. This,
  1555. ControllerHandle,
  1556. RemainingDevicePath,
  1557. IP_VERSION_6
  1558. );
  1559. }
  1560. /**
  1561. Start this driver on ControllerHandle. This service is called by the
  1562. EFI boot service ConnectController(). In order to make
  1563. drivers as small as possible, there are a few calling restrictions for
  1564. this service. ConnectController() must follow these
  1565. calling restrictions. If any other agent wishes to call Start() it
  1566. must also follow these calling restrictions.
  1567. @param[in] This The pointer to the driver binding protocol.
  1568. @param[in] ControllerHandle The handle of device to be started.
  1569. @param[in] RemainingDevicePath Optional parameter used to pick a specific child
  1570. device to be started.
  1571. @retval EFI_SUCCESS This driver is installed to ControllerHandle.
  1572. @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
  1573. @retval other This driver does not support this device.
  1574. **/
  1575. EFI_STATUS
  1576. EFIAPI
  1577. PxeBcIp6DriverBindingStart (
  1578. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1579. IN EFI_HANDLE ControllerHandle,
  1580. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  1581. )
  1582. {
  1583. return PxeBcStart (
  1584. This,
  1585. ControllerHandle,
  1586. RemainingDevicePath,
  1587. IP_VERSION_6
  1588. );
  1589. }
  1590. /**
  1591. Stop this driver on ControllerHandle. This service is called by the
  1592. EFI boot service DisconnectController(). In order to
  1593. make drivers as small as possible, there are a few calling
  1594. restrictions for this service. DisconnectController()
  1595. must follow these calling restrictions. If any other agent wishes
  1596. to call Stop() it must also follow these calling restrictions.
  1597. @param[in] This Protocol instance pointer.
  1598. @param[in] ControllerHandle Handle of device to stop driver on
  1599. @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
  1600. children is zero stop the entire bus driver.
  1601. @param[in] ChildHandleBuffer List of Child Handles to Stop.
  1602. @retval EFI_SUCCESS This driver is removed ControllerHandle
  1603. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  1604. @retval Others This driver was not removed from this device.
  1605. **/
  1606. EFI_STATUS
  1607. EFIAPI
  1608. PxeBcIp6DriverBindingStop (
  1609. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  1610. IN EFI_HANDLE ControllerHandle,
  1611. IN UINTN NumberOfChildren,
  1612. IN EFI_HANDLE *ChildHandleBuffer
  1613. )
  1614. {
  1615. return PxeBcStop (
  1616. This,
  1617. ControllerHandle,
  1618. NumberOfChildren,
  1619. ChildHandleBuffer,
  1620. IP_VERSION_6
  1621. );
  1622. }