From 5a515132d9f25b1ff2c15e2013de9be33bf71067 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 14 Nov 2021 08:41:07 +0100 Subject: lmb: remove lmb_is_nomap() from include Defining static functions in includes should be avoided. Function lmb_is_nomap() is only used in the unit test. So move it to the unit test. Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas --- include/lmb.h | 7 ------- test/lib/lmb.c | 5 +++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/lmb.h b/include/lmb.h index 1984291..ee5b938 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -124,13 +124,6 @@ void board_lmb_reserve(struct lmb *lmb); void arch_lmb_reserve(struct lmb *lmb); void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align); -/* Low level functions */ - -static inline bool lmb_is_nomap(struct lmb_property *m) -{ - return m->flags & LMB_NOMAP; -} - #endif /* __KERNEL__ */ #endif /* _LINUX_LMB_H */ diff --git a/test/lib/lmb.c b/test/lib/lmb.c index b2c2b99..157c263 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -12,6 +12,11 @@ #include #include +static inline bool lmb_is_nomap(struct lmb_property *m) +{ + return m->flags & LMB_NOMAP; +} + static int check_lmb(struct unit_test_state *uts, struct lmb *lmb, phys_addr_t ram_base, phys_size_t ram_size, unsigned long num_reserved, -- cgit v1.1 From 4ad4c2daeb44a1761e944e819213ceb3c3bd1340 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 14 Nov 2021 08:43:07 +0100 Subject: doc: add include/lmb.h to the HTML documentation Correct Sphinx style comments in include/lmb.h Add the logical memory block API to the HTML documentation. Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas --- doc/api/index.rst | 1 + doc/api/lmb.rst | 7 +++++++ include/lmb.h | 23 ++++++++++++----------- 3 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 doc/api/lmb.rst diff --git a/doc/api/index.rst b/doc/api/index.rst index 281d1dc..806c738 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -10,6 +10,7 @@ U-Boot API documentation efi getopt linker_lists + lmb logging pinctrl rng diff --git a/doc/api/lmb.rst b/doc/api/lmb.rst new file mode 100644 index 0000000..2095bfa --- /dev/null +++ b/doc/api/lmb.rst @@ -0,0 +1,7 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Logical memory blocks +===================== + +.. kernel-doc:: include/lmb.h + :internal: diff --git a/include/lmb.h b/include/lmb.h index ee5b938..5efdf9d 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -25,8 +25,9 @@ enum lmb_flags { /** * struct lmb_property - Description of one region. * - * @base: Base address of the region. - * @size: Size of the region + * @base: Base address of the region. + * @size: Size of the region + * @flags: memory region attributes */ struct lmb_property { phys_addr_t base; @@ -83,11 +84,11 @@ extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size); /** * lmb_reserve_flags - Reserve one region with a specific flags bitfield. * - * @lmb the logical memory block struct - * @base base address of the memory region - * @size size of the memory region - * @flags flags for the memory region - * @return 0 if OK, > 0 for coalesced region or a negative error code. + * @lmb: the logical memory block struct + * @base: base address of the memory region + * @size: size of the memory region + * @flags: flags for the memory region + * Return: 0 if OK, > 0 for coalesced region or a negative error code. */ long lmb_reserve_flags(struct lmb *lmb, phys_addr_t base, phys_size_t size, enum lmb_flags flags); @@ -103,10 +104,10 @@ extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr); /** * lmb_is_reserved_flags - test if tha address is in reserved region with a bitfield flag * - * @lmb the logical memory block struct - * @addr address to be tested - * @flags flags bitfied to be tested - * @return 0 if not reserved or reserved without the requested flag else 1 + * @lmb: the logical memory block struct + * @addr: address to be tested + * @flags: flags bitfied to be tested + * Return: if not reserved or reserved without the requested flag else 1 */ int lmb_is_reserved_flags(struct lmb *lmb, phys_addr_t addr, int flags); extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size); -- cgit v1.1 From 951a8c487120b7f0a4badecb9402d7eaaad8dbfb Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 14 Nov 2021 08:52:48 +0100 Subject: lmb: remove extern keyword in lmb.h The extern keyword is not needed in include/lmb.h to declare functions. Remove it. Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas --- include/lmb.h | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/include/lmb.h b/include/lmb.h index 5efdf9d..6182054 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -74,13 +74,12 @@ struct lmb { #endif }; -extern void lmb_init(struct lmb *lmb); -extern void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, - void *fdt_blob); -extern void lmb_init_and_reserve_range(struct lmb *lmb, phys_addr_t base, - phys_size_t size, void *fdt_blob); -extern long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size); -extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size); +void lmb_init(struct lmb *lmb); +void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob); +void lmb_init_and_reserve_range(struct lmb *lmb, phys_addr_t base, + phys_size_t size, void *fdt_blob); +long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size); +long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size); /** * lmb_reserve_flags - Reserve one region with a specific flags bitfield. * @@ -92,15 +91,14 @@ extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size); */ long lmb_reserve_flags(struct lmb *lmb, phys_addr_t base, phys_size_t size, enum lmb_flags flags); -extern phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align); -extern phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, - phys_addr_t max_addr); -extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, - phys_addr_t max_addr); -extern phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base, - phys_size_t size); -extern phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr); -extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr); +phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align); +phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, + phys_addr_t max_addr); +phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, + phys_addr_t max_addr); +phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base, phys_size_t size); +phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr); +int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr); /** * lmb_is_reserved_flags - test if tha address is in reserved region with a bitfield flag * @@ -110,10 +108,10 @@ extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr); * Return: if not reserved or reserved without the requested flag else 1 */ int lmb_is_reserved_flags(struct lmb *lmb, phys_addr_t addr, int flags); -extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size); +long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size); -extern void lmb_dump_all(struct lmb *lmb); -extern void lmb_dump_all_force(struct lmb *lmb); +void lmb_dump_all(struct lmb *lmb); +void lmb_dump_all_force(struct lmb *lmb); static inline phys_size_t lmb_size_bytes(struct lmb_region *type, unsigned long region_nr) -- cgit v1.1 From 7db07aa24fa869bfa0e56709ffaa992051075942 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 14 Nov 2021 09:03:27 +0100 Subject: lmb: drop unused lmb_size_bytes() lmb_size_bytes() is unused. Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas --- include/lmb.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/lmb.h b/include/lmb.h index 6182054..ab277ca 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -113,12 +113,6 @@ long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size); void lmb_dump_all(struct lmb *lmb); void lmb_dump_all_force(struct lmb *lmb); -static inline phys_size_t -lmb_size_bytes(struct lmb_region *type, unsigned long region_nr) -{ - return type->region[region_nr].size; -} - void board_lmb_reserve(struct lmb *lmb); void arch_lmb_reserve(struct lmb *lmb); void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align); -- cgit v1.1 From ac7606af7d4a91d6bad0e5de51b72a513e6ae440 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 14 Nov 2021 09:38:53 +0100 Subject: lmb: fix typo 'commun' %s/commun/common/ Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas --- lib/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig b/lib/Kconfig index 70bf8e7..807a4c6 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -793,7 +793,7 @@ config LMB Support the library logical memory blocks. config LMB_USE_MAX_REGIONS - bool "Use a commun number of memory and reserved regions in lmb lib" + bool "Use a common number of memory and reserved regions in lmb lib" depends on LMB default y help -- cgit v1.1 From 0c9e8bf2bb617e08d9e07f219fe2bcf6d6de0ab4 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 15 Nov 2021 19:06:55 +0100 Subject: test: test truncation in snprintf() Test that the return value of snprintf() is correct in the case of truncation. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/print_ut.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/print_ut.c b/test/print_ut.c index 152a8c3..7b2e7bb 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -31,6 +31,7 @@ static int print_guid(struct unit_test_state *uts) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; char str[40]; + int ret; sprintf(str, "%pUb", guid); ut_assertok(strcmp("01020304-0506-0708-090a-0b0c0d0e0f10", str)); @@ -40,6 +41,9 @@ static int print_guid(struct unit_test_state *uts) ut_assertok(strcmp("04030201-0605-0807-090a-0b0c0d0e0f10", str)); sprintf(str, "%pUL", guid); ut_assertok(strcmp("04030201-0605-0807-090A-0B0C0D0E0F10", str)); + ret = snprintf(str, 4, "%pUL", guid); + ut_asserteq(0, str[3]); + ut_asserteq(36, ret); return 0; } @@ -349,6 +353,20 @@ static int print_itoa(struct unit_test_state *uts) } PRINT_TEST(print_itoa, 0); +static int snprint(struct unit_test_state *uts) +{ + char buf[10] = "xxxxxxxxx"; + int ret; + + ret = snprintf(buf, 4, "%s:%s", "abc", "def"); + ut_asserteq(0, buf[3]); + ut_asserteq(7, ret); + ret = snprintf(buf, 4, "%s:%d", "abc", 9999); + ut_asserteq(8, ret); + return 0; +} +PRINT_TEST(snprint, 0); + static int print_xtoa(struct unit_test_state *uts) { ut_asserteq_str("7f", simple_xtoa(127)); -- cgit v1.1 From dfec0e9d9c6e19fb24d16e79da612f68e9a91544 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 16 Nov 2021 18:56:43 +0100 Subject: scripts: update spelling.txt from upstream Linux This list is used by checkpatch.pl. The Linux v5.15 version has several words that where mispelled in U-Boot too. Signed-off-by: Heinrich Schuchardt --- scripts/spelling.txt | 365 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 360 insertions(+), 5 deletions(-) diff --git a/scripts/spelling.txt b/scripts/spelling.txt index 9a058cf..17fdc62 100644 --- a/scripts/spelling.txt +++ b/scripts/spelling.txt @@ -9,7 +9,12 @@ # abandonning||abandoning abigious||ambiguous +abitrary||arbitrary abitrate||arbitrate +abnornally||abnormally +abnrormal||abnormal +abord||abort +aboslute||absolute abov||above abreviated||abbreviated absense||absence @@ -17,6 +22,7 @@ absolut||absolute absoulte||absolute acccess||access acceess||access +accelaration||acceleration acceleratoin||acceleration accelleration||acceleration accesing||accessing @@ -25,6 +31,7 @@ accessable||accessible accesss||access accidentaly||accidentally accidentually||accidentally +acclerated||accelerated accoding||according accomodate||accommodate accomodates||accommodates @@ -34,8 +41,11 @@ accout||account accquire||acquire accquired||acquired accross||across +accumalate||accumulate +accumalator||accumulator acessable||accessible acess||access +acessing||accessing achitecture||architecture acient||ancient acitions||actions @@ -49,7 +59,9 @@ activete||activate actived||activated actualy||actually acumulating||accumulating +acumulative||accumulative acumulator||accumulator +acutally||actually adapater||adapter addional||additional additionaly||additionally @@ -58,18 +70,22 @@ addres||address adddress||address addreses||addresses addresss||address +addrress||address aditional||additional aditionally||additionally aditionaly||additionally adminstrative||administrative adress||address adresses||addresses +adrresses||addresses +advertisment||advertisement adviced||advised afecting||affecting againt||against agaist||against aggreataon||aggregation aggreation||aggregation +ajust||adjust albumns||albums alegorical||allegorical algined||aligned @@ -77,6 +93,7 @@ algorith||algorithm algorithmical||algorithmically algoritm||algorithm algoritms||algorithms +algorithmn||algorithm algorrithm||algorithm algorritm||algorithm aligment||alignment @@ -88,6 +105,7 @@ alloated||allocated allocatote||allocate allocatrd||allocated allocte||allocate +allocted||allocated allpication||application alocate||allocate alogirhtms||algorithms @@ -95,11 +113,16 @@ alogrithm||algorithm alot||a lot alow||allow alows||allows +alreay||already +alredy||already altough||although alue||value ambigious||ambiguous +ambigous||ambiguous amoung||among amout||amount +amplifer||amplifier +amplifyer||amplifier an union||a union an user||a user an userspace||a userspace @@ -130,6 +153,7 @@ arbitary||arbitrary architechture||architecture arguement||argument arguements||arguments +arithmatic||arithmetic aritmetic||arithmetic arne't||aren't arraival||arrival @@ -138,27 +162,42 @@ artillary||artillery asign||assign asser||assert assertation||assertion +assertting||asserting +assgined||assigned assiged||assigned assigment||assignment assigments||assignments assistent||assistant +assocaited||associated +assocating||associating assocation||association associcated||associated assotiated||associated +asssert||assert assum||assume assumtpion||assumption asuming||assuming asycronous||asynchronous asynchnous||asynchronous +asynchromous||asynchronous +asymetric||asymmetric +asymmeric||asymmetric +atleast||at least atomatically||automatically atomicly||atomically atempt||attempt +atrributes||attributes attachement||attachment +attatch||attach attched||attached +attemp||attempt attemps||attempts attemping||attempting +attepmpt||attempt +attnetion||attention attruibutes||attributes authentification||authentication +authenicated||authenticated automaticaly||automatically automaticly||automatically automatize||automate @@ -172,6 +211,7 @@ avaible||available availabe||available availabled||available availablity||availability +availaible||available availale||available availavility||availability availble||available @@ -205,28 +245,42 @@ boardcast||broadcast borad||board boundry||boundary brievely||briefly +brigde||bridge +broadcase||broadcast broadcat||broadcast +bufer||buffer +bufufer||buffer cacluated||calculated +caculate||calculate caculation||calculation +cadidate||candidate +cahces||caches calender||calendar calescing||coalescing calle||called callibration||calibration +callled||called +callser||caller calucate||calculate calulate||calculate cancelation||cancellation cancle||cancel +canot||cannot capabilites||capabilities +capabilties||capabilities capabilty||capability capabitilies||capabilities +capablity||capability capatibilities||capabilities capapbilities||capabilities +caputure||capture carefuly||carefully cariage||carriage catagory||category cehck||check challange||challenge challanges||challenges +chache||cache chanell||channel changable||changeable chanined||chained @@ -240,6 +294,7 @@ charaters||characters charcter||character chcek||check chck||check +checksumed||checksummed checksuming||checksumming childern||children childs||children @@ -255,7 +310,9 @@ claread||cleared clared||cleared closeing||closing clustred||clustered +cnfiguration||configuration coexistance||coexistence +colescing||coalescing collapsable||collapsible colorfull||colorful comand||command @@ -266,14 +323,17 @@ comminucation||communication commited||committed commiting||committing committ||commit +commnunication||communication commoditiy||commodity comsume||consume comsumer||consumer comsuming||consuming compability||compatibility compaibility||compatibility +comparsion||comparison compatability||compatibility compatable||compatible +compatibililty||compatibility compatibiliy||compatibility compatibilty||compatibility compatiblity||compatibility @@ -285,22 +345,32 @@ completly||completely complient||compliant componnents||components compoment||component +comppatible||compatible compres||compress compresion||compression comression||compression +comunicate||communicate comunication||communication conbination||combination conditionaly||conditionally +conditon||condition +condtion||condition conected||connected -connecetd||connected +conector||connector +configration||configuration +configred||configured configuartion||configuration +configuation||configuration +configued||configured configuratoin||configuration configuraton||configuration configuretion||configuration configutation||configuration conider||consider conjuction||conjunction +connecetd||connected connectinos||connections +connetor||connector connnection||connection connnections||connections consistancy||consistency @@ -310,11 +380,13 @@ containts||contains contaisn||contains contant||contact contence||contents +contiguos||contiguous continious||continuous continous||continuous continously||continuously continueing||continuing contraints||constraints +contruct||construct contol||control contoller||controller controled||controlled @@ -340,15 +412,23 @@ cunter||counter curently||currently cylic||cyclic dafault||default +deactive||deactivate deafult||default deamon||daemon +debouce||debounce +decendant||descendant +decendants||descendants decompres||decompress +decsribed||described decription||description dectected||detected defailt||default +deferal||deferral +deffered||deferred defferred||deferred definate||definite definately||definitely +definiation||definition defintion||definition defintions||definitions defualt||default @@ -362,29 +442,35 @@ delare||declare delares||declares delaring||declaring delemiter||delimiter +delievered||delivered demodualtor||demodulator demension||dimension dependancies||dependencies dependancy||dependency dependant||dependent +dependend||dependent depreacted||deprecated depreacte||deprecate desactivate||deactivate desciptor||descriptor desciptors||descriptors +descripto||descriptor descripton||description descrition||description descritptor||descriptor desctiptor||descriptor desriptor||descriptor desriptors||descriptors +desination||destination destionation||destination +destoried||destroyed destory||destroy destoryed||destroyed destorys||destroys destroied||destroyed detabase||database deteced||detected +detectt||detect develope||develop developement||development developped||developed @@ -394,44 +480,74 @@ developpment||development deveolpment||development devided||divided deviece||device +devision||division diable||disable +diabled||disabled +dicline||decline dictionnary||dictionary didnt||didn't diferent||different differrence||difference diffrent||different +differenciate||differentiate diffrentiate||differentiate difinition||definition +digial||digital +dimention||dimension dimesions||dimensions +diconnected||disconnected +disabed||disabled +disble||disable +disgest||digest +disired||desired +dispalying||displaying diplay||display +directon||direction +direcly||directly direectly||directly +diregard||disregard disassocation||disassociation disapear||disappear disapeared||disappeared disappared||disappeared +disbale||disable +disbaled||disabled disble||disable disbled||disabled disconnet||disconnect discontinous||discontinuous +disharge||discharge +disnabled||disabled dispertion||dispersion dissapears||disappears +dissconect||disconnect distiction||distinction +divisable||divisible +divsiors||divisors docuentation||documentation documantation||documentation documentaion||documentation documment||document doesnt||doesn't +donwload||download +donwloading||downloading dorp||drop dosen||doesn downlad||download downlads||downloads +droped||dropped +droput||dropout druing||during +dyanmic||dynamic dynmaic||dynamic +eanable||enable +eanble||enable easilly||easily ecspecially||especially edditable||editable editting||editing efective||effective +effectivness||effectiveness efficently||efficiently ehther||ether eigth||eight @@ -439,16 +555,23 @@ elementry||elementary eletronic||electronic embeded||embedded enabledi||enabled +enbale||enable +enble||enable enchanced||enhanced encorporating||incorporating encrupted||encrypted encrypiton||encryption encryptio||encryption endianess||endianness +enpoint||endpoint enhaced||enhanced enlightnment||enlightenment +enqueing||enqueuing +entires||entries +entites||entities entrys||entries enocded||encoded +enought||enough enterily||entirely enviroiment||environment enviroment||environment @@ -460,13 +583,23 @@ equivelant||equivalent equivilant||equivalent eror||error errorr||error +errror||error estbalishment||establishment etsablishment||establishment etsbalishment||establishment +evalute||evaluate +evalutes||evaluates +evalution||evaluation excecutable||executable exceded||exceeded +exceds||exceeds +exceeed||exceed excellant||excellent +execeeded||exceeded +execeeds||exceeds exeed||exceed +exeeds||exceeds +exeuction||execution existance||existence existant||existent exixt||exist @@ -474,6 +607,7 @@ exlcude||exclude exlcusive||exclusive exmaple||example expecially||especially +experies||expires explicite||explicit explicitely||explicitly explict||explicit @@ -482,11 +616,16 @@ explictly||explicitly expresion||expression exprimental||experimental extened||extended +exteneded||extended extensability||extensibility extention||extension +extenstion||extension extracter||extractor -falied||failed +faied||failed +faield||failed faild||failed +failded||failed +failer||failure faill||fail failied||failed faillure||failure @@ -504,8 +643,12 @@ feautures||features fetaure||feature fetaures||features fileystem||filesystem +fimrware||firmware fimware||firmware +firmare||firmware +firmaware||firmware firware||firmware +firwmare||firmware finanize||finalize findn||find finilizes||finalizes @@ -520,13 +663,18 @@ forseeable||foreseeable forse||force fortan||fortran forwardig||forwarding +frambuffer||framebuffer framming||framing framwork||framework +frequence||frequency frequncy||frequency +frequancy||frequency frome||from fucntion||function fuction||function fuctions||functions +fullill||fulfill +funcation||function funcion||function functionallity||functionality functionaly||functionally @@ -537,14 +685,19 @@ funtions||functions furthur||further futhermore||furthermore futrue||future +gatable||gateable +gateing||gating +gauage||gauge gaurenteed||guaranteed generiously||generously genereate||generate +genereted||generated genric||generic globel||global grabing||grabbing grahical||graphical grahpical||graphical +granularty||granularity grapic||graphic grranted||granted guage||gauge @@ -553,14 +706,22 @@ guarentee||guarantee halfs||halves hander||handler handfull||handful +hanlde||handle hanled||handled happend||happened +hardare||hardware harware||hardware +havind||having heirarchically||hierarchically +heirarchy||hierarchy helpfull||helpful +hearbeat||heartbeat +heterogenous||heterogeneous +hexdecimal||hexadecimal hybernate||hibernate hierachy||hierarchy hierarchie||hierarchy +homogenous||homogeneous howver||however hsould||should hypervior||hypervisor @@ -568,12 +729,16 @@ hypter||hyper identidier||identifier iligal||illegal illigal||illegal +illgal||illegal +iomaped||iomapped imblance||imbalance immeadiately||immediately immedaite||immediate +immedate||immediate immediatelly||immediately immediatly||immediately immidiate||immediate +immutible||immutable impelentation||implementation impementated||implemented implemantation||implementation @@ -591,10 +756,13 @@ incative||inactive incomming||incoming incompatabilities||incompatibilities incompatable||incompatible +incompatble||incompatible inconsistant||inconsistent increas||increase incremeted||incremented incrment||increment +incuding||including +inculde||include indendation||indentation indended||intended independant||independent @@ -603,6 +771,8 @@ independed||independent indiate||indicate indicat||indicate inexpect||inexpected +inferface||interface +infinit||infinite infomation||information informatiom||information informations||information @@ -617,14 +787,24 @@ initalize||initialize initation||initiation initators||initiators initialiazation||initialization +initializationg||initialization initializiation||initialization +initialze||initialize initialzed||initialized +initialzing||initializing initilization||initialization initilize||initialize +initliaze||initialize +initilized||initialized inofficial||unofficial +inrerface||interface insititute||institute +instace||instance instal||install +instanciate||instantiate instanciated||instantiated +instuments||instruments +insufficent||insufficient inteface||interface integreated||integrated integrety||integrity @@ -635,17 +815,20 @@ interanl||internal interchangable||interchangeable interferring||interfering interger||integer +intergrated||integrated intermittant||intermittent internel||internal interoprability||interoperability interuupt||interrupt +interupt||interrupt +interupts||interrupts interrface||interface interrrupt||interrupt interrup||interrupt interrups||interrupts interruptted||interrupted interupted||interrupted -interupt||interrupt +intiailized||initialized intial||initial intialisation||initialisation intialised||initialised @@ -654,10 +837,14 @@ intialization||initialization intialized||initialized intialize||initialize intregral||integral +intrerrupt||interrupt intrrupt||interrupt intterrupt||interrupt intuative||intuitive +inavlid||invalid invaid||invalid +invaild||invalid +invailid||invalid invald||invalid invalde||invalid invalide||invalid @@ -666,14 +853,18 @@ invalud||invalid invididual||individual invokation||invocation invokations||invocations +ireelevant||irrelevant irrelevent||irrelevant isnt||isn't isssue||issue +issus||issues +iteraions||iterations iternations||iterations itertation||iteration itslef||itself jave||java jeffies||jiffies +jumpimng||jumping juse||just jus||just kown||known @@ -683,6 +874,7 @@ langauge||language langugage||language lauch||launch layed||laid +legnth||length leightweight||lightweight lengh||length lenght||length @@ -693,29 +885,45 @@ libary||library librairies||libraries libraris||libraries licenceing||licencing +limted||limited +logaritmic||logarithmic loggging||logging loggin||login logile||logfile +loobpack||loopback loosing||losing losted||lost +maangement||management machinary||machinery +maibox||mailbox maintainance||maintenance maintainence||maintenance maintan||maintain makeing||making +mailformed||malformed malplaced||misplaced malplace||misplace managable||manageable +managament||management managment||management mangement||management +manger||manager manoeuvering||maneuvering +manufaucturing||manufacturing mappping||mapping +maping||mapping +matchs||matches mathimatical||mathematical mathimatic||mathematic mathimatics||mathematics +maximium||maximum maxium||maximum mechamism||mechanism meetign||meeting +memeory||memory +memmber||member +memoery||memory +memroy||memory ment||meant mergable||mergeable mesage||message @@ -723,11 +931,14 @@ messags||messages messgaes||messages messsage||message messsages||messages +metdata||metadata micropone||microphone microprocesspr||microprocessor +migrateable||migratable milliseonds||milliseconds minium||minimum minimam||minimum +miniumum||minimum minumum||minimum misalinged||misaligned miscelleneous||miscellaneous @@ -736,21 +947,28 @@ mispelled||misspelled mispelt||misspelt mising||missing mismactch||mismatch +missign||missing missmanaged||mismanaged missmatch||mismatch +misssing||missing miximum||maximum mmnemonic||mnemonic mnay||many +modfiy||modify +modifer||modifier modulues||modules momery||memory memomry||memory +monitring||monitoring monochorome||monochrome monochromo||monochrome monocrome||monochrome mopdule||module mroe||more +multipler||multiplier mulitplied||multiplied multidimensionnal||multidimensional +multipe||multiple multple||multiple mumber||number muticast||multicast @@ -772,21 +990,30 @@ nerver||never nescessary||necessary nessessary||necessary noticable||noticeable +notication||notification notications||notifications +notifcations||notifications notifed||notified +notity||notify +nubmer||number numebr||number numner||number obtaion||obtain +obusing||abusing occassionally||occasionally occationally||occasionally occurance||occurrence occurances||occurrences +occurd||occurred occured||occurred occurence||occurrence occure||occurred -occured||occurred occuring||occurring +offser||offset offet||offset +offlaod||offload +offloded||offloaded +offseting||offsetting omited||omitted omiting||omitting omitt||omit @@ -794,22 +1021,28 @@ ommiting||omitting ommitted||omitted onself||oneself ony||only +openning||opening operatione||operation opertaions||operations +opportunies||opportunities optionnal||optional optmizations||optimizations orientatied||orientated orientied||oriented orignal||original +originial||original otherise||otherwise ouput||output oustanding||outstanding overaall||overall overhread||overhead overlaping||overlapping +overflw||overflow +overlfow||overflow overide||override overrided||overridden overriden||overridden +overrrun||overrun overun||overrun overwritting||overwriting overwriten||overwritten @@ -820,6 +1053,7 @@ packege||package packge||package packtes||packets pakage||package +paket||packet pallette||palette paln||plan paramameters||parameters @@ -829,23 +1063,34 @@ parametes||parameters parametised||parametrised paramter||parameter paramters||parameters +parmaters||parameters particuarly||particularly particularily||particularly +partion||partition +partions||partitions partiton||partition pased||passed passin||passing pathes||paths +pattrns||patterns pecularities||peculiarities peformance||performance +peforming||performing peice||piece pendantic||pedantic peprocessor||preprocessor +perfomance||performance perfoming||performing +perfomring||performing +periperal||peripheral +peripherial||peripheral permissons||permissions peroid||period persistance||persistence persistant||persistent +phoneticly||phonetically plalform||platform +platfoem||platform platfrom||platform plattform||platform pleaes||please @@ -857,7 +1102,10 @@ poiter||pointer posible||possible positon||position possibilites||possibilities +potocol||protocol powerfull||powerful +pramater||parameter +preamle||preamble preample||preamble preapre||prepare preceeded||preceded @@ -868,9 +1116,16 @@ precission||precision preemptable||preemptible prefered||preferred prefferably||preferably +prefitler||prefilter +preform||perform premption||preemption prepaired||prepared +prepate||prepare +preperation||preparation +preprare||prepare pressre||pressure +presuambly||presumably +previosuly||previously primative||primitive princliple||principle priorty||priority @@ -878,6 +1133,7 @@ privilaged||privileged privilage||privilege priviledge||privilege priviledges||privileges +privleges||privileges probaly||probably procceed||proceed proccesors||processors @@ -891,12 +1147,16 @@ processsed||processed processsing||processing procteted||protected prodecure||procedure +progamming||programming progams||programs progess||progress +programable||programmable programers||programmers programm||program programms||programs progresss||progress +prohibitted||prohibited +prohibitting||prohibiting promiscous||promiscuous promps||prompts pronnounced||pronounced @@ -906,35 +1166,45 @@ pronunce||pronounce propery||property propigate||propagate propigation||propagation +propogation||propagation propogate||propagate prosess||process protable||portable protcol||protocol protecion||protection +protedcted||protected protocoll||protocol promixity||proximity psudo||pseudo psuedo||pseudo psychadelic||psychedelic +purgable||purgeable pwoer||power +queing||queuing quering||querying +queus||queues randomally||randomly raoming||roaming reasearcher||researcher reasearchers||researchers reasearch||research +receieve||receive recepient||recipient +recevied||received receving||receiving +recievd||received recieved||received recieve||receive reciever||receiver recieves||receives +recieving||receiving recogniced||recognised recognizeable||recognizable recommanded||recommended recyle||recycle redircet||redirect redirectrion||redirection +redundacy||redundancy reename||rename refcounf||refcount refence||reference @@ -944,7 +1214,9 @@ refering||referring refernces||references refernnce||reference refrence||reference +registed||registered registerd||registered +registeration||registration registeresd||registered registerred||registered registes||registers @@ -957,6 +1229,7 @@ regulamentations||regulations reigstration||registration releated||related relevent||relevant +reloade||reload remoote||remote remore||remote removeable||removable @@ -967,25 +1240,38 @@ replys||replies reponse||response representaion||representation reqeust||request +reqister||register +requed||requeued requestied||requested requiere||require requirment||requirement requred||required requried||required requst||request +requsted||requested +reregisteration||reregistration reseting||resetting +reseved||reserved +reseverd||reserved resizeable||resizable resouce||resource resouces||resources resoures||resources responce||response +resrouce||resource ressizes||resizes ressource||resource ressources||resources +restesting||retesting +resumbmitting||resubmitting retransmited||retransmitted retreived||retrieved retreive||retrieve +retreiving||retrieving retrive||retrieve +retrived||retrieved +retrun||return +retun||return retuned||returned reudce||reduce reuest||request @@ -1006,30 +1292,42 @@ sacrifying||sacrificing safly||safely safty||safety savable||saveable +scaleing||scaling scaned||scanned scaning||scanning scarch||search +schdule||schedule seach||search searchs||searches +secion||section secquence||sequence secund||second segement||segment +seleted||selected +semaphone||semaphore +senario||scenario senarios||scenarios sentivite||sensitive separatly||separately sepcify||specify -sepc||spec seperated||separated seperately||separately seperate||separate seperatly||separately seperator||separator sepperate||separate +seqeunce||sequence +seqeuncer||sequencer +seqeuencer||sequencer sequece||sequence +sequemce||sequence sequencial||sequential +serivce||service serveral||several +servive||service setts||sets settting||setting +shapshot||snapshot shotdown||shutdown shoud||should shouldnt||shouldn't @@ -1037,6 +1335,7 @@ shoule||should shrinked||shrunk siginificantly||significantly signabl||signal +significanly||significantly similary||similarly similiar||similar simlar||similar @@ -1046,15 +1345,22 @@ singaled||signaled singal||signal singed||signed sleeped||slept +sliped||slipped +softwade||software softwares||software +soley||solely +souce||source speach||speech specfic||specific +specfield||specified speciefied||specified specifc||specific specifed||specified specificatin||specification specificaton||specification +specificed||specified specifing||specifying +specifiy||specify specifiying||specifying speficied||specified speicify||specify @@ -1071,8 +1377,12 @@ staion||station standardss||standards standartization||standardization standart||standard +standy||standby +stardard||standard staticly||statically +statuss||status stoped||stopped +stoping||stopping stoppped||stopped straming||streaming struc||struct @@ -1084,13 +1394,17 @@ sturcture||structure subdirectoires||subdirectories suble||subtle substract||subtract +submited||submitted submition||submission +succeded||succeeded +suceed||succeed succesfully||successfully succesful||successful successed||succeeded successfull||successful successfuly||successfully sucessfully||successfully +sucessful||successful sucess||success superflous||superfluous superseeded||superseded @@ -1103,11 +1417,13 @@ supportin||supporting suppoted||supported suppported||supported suppport||support +supprot||support supress||suppress surpressed||suppressed surpresses||suppresses susbsystem||subsystem suspeneded||suspended +suspsend||suspend suspicously||suspiciously swaping||swapping switchs||switches @@ -1119,9 +1435,11 @@ swithcing||switching swithed||switched swithing||switching swtich||switch +syfs||sysfs symetric||symmetric synax||syntax synchonized||synchronized +synchronuously||synchronously syncronize||synchronize syncronized||synchronized syncronizing||synchronizing @@ -1130,28 +1448,43 @@ syste||system sytem||system sythesis||synthesis taht||that +tansmit||transmit targetted||targeted targetting||targeting +taskelt||tasklet teh||the temorary||temporary temproarily||temporarily +temperture||temperature +thead||thread therfore||therefore thier||their threds||threads +threee||three threshhold||threshold thresold||threshold throught||through +trackling||tracking troughput||throughput +trys||tries thses||these +tiggers||triggers tiggered||triggered tipically||typically +timeing||timing timout||timeout tmis||this +toogle||toggle torerable||tolerable +traget||target +traking||tracking tramsmitted||transmitted tramsmit||transmit tranasction||transaction +tranceiver||transceiver tranfer||transfer +tranmission||transmission +transcevier||transceiver transciever||transceiver transferd||transferred transfered||transferred @@ -1162,6 +1495,8 @@ transormed||transformed trasfer||transfer trasmission||transmission treshold||threshold +triggerd||triggered +trigerred||triggered trigerring||triggering trun||turn tunning||tuning @@ -1169,8 +1504,12 @@ ture||true tyep||type udpate||update uesd||used +uknown||unknown +usccess||success uncommited||uncommitted +uncompatible||incompatible unconditionaly||unconditionally +undeflow||underflow underun||underrun unecessary||unnecessary unexecpted||unexpected @@ -1181,11 +1520,16 @@ unexpeted||unexpected unexpexted||unexpected unfortunatelly||unfortunately unifiy||unify +uniterrupted||uninterrupted unintialized||uninitialized +unitialized||uninitialized unkmown||unknown unknonw||unknown +unknouwn||unknown unknow||unknown unkown||unknown +unamed||unnamed +uneeded||unneeded unneded||unneeded unneccecary||unnecessary unneccesary||unnecessary @@ -1194,6 +1538,7 @@ unnecesary||unnecessary unneedingly||unnecessarily unnsupported||unsupported unmached||unmatched +unprecise||imprecise unregester||unregister unresgister||unregister unrgesiter||unregister @@ -1203,13 +1548,17 @@ unsolicitied||unsolicited unsuccessfull||unsuccessful unsuported||unsupported untill||until +ununsed||unused unuseful||useless +unvalid||invalid upate||update +upsupported||unsupported usefule||useful usefull||useful usege||usage usera||users usualy||usually +usupported||unsupported utilites||utilities utillities||utilities utilties||utilities @@ -1224,6 +1573,8 @@ varible||variable varient||variant vaule||value verbse||verbose +veify||verify +veriosn||version verisons||versions verison||version verson||version @@ -1233,7 +1584,9 @@ virtaul||virtual virtiual||virtual visiters||visitors vitual||virtual +vunerable||vulnerable wakeus||wakeups +wathdog||watchdog wating||waiting wiat||wait wether||whether @@ -1247,8 +1600,10 @@ wiil||will wirte||write withing||within wnat||want +wont||won't workarould||workaround writeing||writing writting||writing +wtih||with zombe||zombie zomebie||zombie -- cgit v1.1 From 3f80064fd55fa0c4767e92bb359dd4a582849584 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 16 Nov 2021 18:38:47 +0100 Subject: doc: fix typos in trace.rst Fix obvious typos. Use US spelling consistently. Signed-off-by: Heinrich Schuchardt --- doc/develop/trace.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/develop/trace.rst b/doc/develop/trace.rst index 7776c48..09f5745 100644 --- a/doc/develop/trace.rst +++ b/doc/develop/trace.rst @@ -4,7 +4,7 @@ Tracing in U-Boot ================= -U-Boot supports a simple tracing feature which allows a record of excecution +U-Boot supports a simple tracing feature which allows a record of execution to be collected and sent to a host machine for analysis. At present the main use for this is to profile boot time. @@ -161,10 +161,10 @@ limit of the trace buffer size you have specified. Once that is exhausted no more data will be collected. Collecting trace data has an affect on execution time/performance. You -will notice this particularly with trvial functions - the overhead of +will notice this particularly with trivial functions - the overhead of recording their execution may even exceed their normal execution time. In practice this doesn't matter much so long as you are aware of the -effect. Once you have done your optimisations, turn off tracing before +effect. Once you have done your optimizations, turn off tracing before doing end-to-end timing. The best time to start tracing is right at the beginning of U-Boot. The @@ -184,7 +184,7 @@ the OS. In practical terms, U-Boot runs the 'fakegocmd' environment variable at this point. This variable should have a short script which collects the trace data and writes it somewhere. -Trace data collection relies on a microsecond timer, accesed through +Trace data collection relies on a microsecond timer, accessed through timer_get_us(). So the first think you should do is make sure that this produces sensible results for your board. Suitable sources for this timer include high resolution timers, PWMs or profile timers if @@ -285,7 +285,7 @@ Options Specify U-Boot map file -p - Specifiy profile/trace file + Specify profile/trace file Commands: @@ -315,11 +315,11 @@ time: 2. Build U-Boot with tracing and run it. Note the difference in boot time (it is common for tracing to add 10% to the time) -3. Collect the trace information as descibed above. Use this to find where +3. Collect the trace information as described above. Use this to find where all the time is being spent. -4. Take a look at that code and see if you can optimise it. Perhaps it is - possible to speed up the initialisation of a device, or remove an unused +4. Take a look at that code and see if you can optimize it. Perhaps it is + possible to speed up the initialization of a device, or remove an unused feature. 5. Rebuild, run and collect again. Compare your results. -- cgit v1.1 From 45c16fd0c2457d64fa94ddf3f96818542ebf72b6 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Fri, 12 Nov 2021 16:24:27 +0900 Subject: efi: add comment for efi_system_table and efi_configuration_table This commit adds the comment for efi_system_table and efi_configuration_table structure. Signed-off-by: Masahisa Kojima Reviewed-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- include/efi_api.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/efi_api.h b/include/efi_api.h index 0accad0..db35819 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -417,6 +417,15 @@ struct efi_runtime_services { EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, \ 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25) +/** + * struct efi_configuration_table - EFI Configuration Table + * + * This table contains a set of GUID/pointer pairs. + * The EFI Configuration Table may contain at most one instance of each table type. + * + * @guid: GUID that uniquely identifies the system configuration table + * @table: A pointer to the table associated with guid + */ struct efi_configuration_table { efi_guid_t guid; void *table; @@ -424,6 +433,29 @@ struct efi_configuration_table { #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) +/** + * struct efi_system_table - EFI System Table + * + * EFI System Table contains pointers to the runtime and boot services tables. + * + * @hdr: The table header for the EFI System Table + * @fw_vendor: A pointer to a null terminated string that identifies the vendor + * that produces the system firmware + * @fw_revision: The revision of the system firmware + * @con_in_handle: The handle for the active console input device + * @con_in: A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface + * that is associated with con_in_handle + * @con_out_handle: The handle for the active console output device + * @con_out: A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface + * that is associated with con_out_handle + * @stderr_handle: The handle for the active standard error console device + * @std_err: A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface + * that is associated with stderr_handle + * @runtime: A pointer to the EFI Runtime Services Table + * @boottime: A pointer to the EFI Boot Services Table + * @nr_tables: The number of system configuration tables + * @tables: A pointer to the system configuration tables + */ struct efi_system_table { struct efi_table_hdr hdr; u16 *fw_vendor; /* physical addr of wchar_t vendor string */ -- cgit v1.1 From e032cb2ac98d7085bec258dd19617409f0f70e90 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 20 Nov 2021 09:28:54 +0100 Subject: efi_loader: Sphinx comments in efi_api.h Fix incorrect Sphinx comments in efi_api.h: * add missing 'struct' * correct indentation Signed-off-by: Heinrich Schuchardt --- include/efi_api.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index db35819..41516cc 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -902,8 +902,8 @@ struct efi_hii_package_list_header { * @fields: 'fields' replaces the bit-fields defined in the EFI * specification to to avoid possible compiler incompatibilities:: * - * u32 length:24; - * u32 type:8; + * u32 length:24; + * u32 type:8; */ struct efi_hii_package_header { u32 fields; @@ -1841,7 +1841,7 @@ struct efi_system_resource_table { 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7) /** - * win_certificate_uefi_guid - A certificate that encapsulates + * struct win_certificate_uefi_guid - A certificate that encapsulates * a GUID-specific signature * * @hdr: Windows certificate header @@ -1855,7 +1855,7 @@ struct win_certificate_uefi_guid { } __attribute__((__packed__)); /** - * efi_variable_authentication_2 - A time-based authentication method + * struct efi_variable_authentication_2 - A time-based authentication method * descriptor * * This structure describes an authentication information for @@ -1872,7 +1872,7 @@ struct efi_variable_authentication_2 { } __attribute__((__packed__)); /** - * efi_firmware_image_authentication - Capsule authentication method + * struct efi_firmware_image_authentication - Capsule authentication method * descriptor * * This structure describes an authentication information for @@ -1890,7 +1890,7 @@ struct efi_firmware_image_authentication { /** - * efi_signature_data - A format of signature + * struct efi_signature_data - A format of signature * * This structure describes a single signature in signature database. * @@ -1903,7 +1903,7 @@ struct efi_signature_data { } __attribute__((__packed__)); /** - * efi_signature_list - A format of signature database + * struct efi_signature_list - A format of signature database * * This structure describes a list of signatures with the same type. * An authenticated variable's value is a concatenation of one or more -- cgit v1.1 From 3961bd9b552bfb3c08664fb09f18744c6f691456 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Tue, 9 Nov 2021 20:35:53 +0900 Subject: efi_loader: Reduce efi_tcg2 logging statement log_info() is used for the debug level logging statement which should use log_debug() instead. Convert it to reduce the log output. Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_tcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 189e4a5..2771fd6 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1472,7 +1472,7 @@ static efi_status_t tcg2_measure_boot_variable(struct udevice *dev) &var_data_size); if (!bootvar) { - log_info("%ls not found\n", boot_name); + log_debug("%ls not found\n", boot_name); continue; } -- cgit v1.1 From 5d49b32f0a34cc4c23da8060ac18345984c9b96c Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Fri, 12 Nov 2021 22:05:15 +0900 Subject: efi_loader: capsule: Record capsule result only if capsule is read Record capsule update result only if the capsule file is successfully read, because the capsule GUID is not sure when the file can not be read or the file is not a capsule. Without this fix, if user puts a dummy (non-capsule) file under (ESP)EFI/UpdateCapsule, U-Boot causes a synchronous abort. This also fixes use-after-free bug of the 'capsule' variable. Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support") Signed-off-by: Masami Hiramatsu Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_capsule.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 850937f..502bcfc 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -1108,13 +1108,13 @@ efi_status_t efi_launch_capsules(void) log_err("Applying capsule %ls failed\n", files[i]); + /* create CapsuleXXXX */ + set_capsule_result(index, capsule, ret); + free(capsule); } else { log_err("Reading capsule %ls failed\n", files[i]); } - /* create CapsuleXXXX */ - set_capsule_result(index, capsule, ret); - /* delete a capsule either in case of success or failure */ ret = efi_capsule_delete_file(files[i]); if (ret != EFI_SUCCESS) -- cgit v1.1 From 43eaf5b13f31395afbef3ff89d99a4f6c1a2ba63 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 16 Nov 2021 18:46:27 +0100 Subject: efi_loader: EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES Implement the EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES event group handling. Add the definition of EFI_EVENT_GROUP_AFTER_READY_TO_BOOT. Signed-off-by: Heinrich Schuchardt --- include/efi_api.h | 9 +++++++++ lib/efi_loader/efi_boottime.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/efi_api.h b/include/efi_api.h index 41516cc..1e95656 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -360,10 +360,15 @@ struct efi_runtime_services { }; /* EFI event group GUID definitions */ + #define EFI_EVENT_GROUP_EXIT_BOOT_SERVICES \ EFI_GUID(0x27abf055, 0xb1b8, 0x4c26, 0x80, 0x48, \ 0x74, 0x8f, 0x37, 0xba, 0xa2, 0xdf) +#define EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES \ + EFI_GUID(0x8be0e274, 0x3970, 0x4b44, 0x80, 0xc5, \ + 0x1a, 0xb9, 0x50, 0x2f, 0x3b, 0xfc) + #define EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE \ EFI_GUID(0x13fa7698, 0xc831, 0x49c7, 0x87, 0xea, \ 0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96) @@ -376,6 +381,10 @@ struct efi_runtime_services { EFI_GUID(0x7ce88fb3, 0x4bd7, 0x4679, 0x87, 0xa8, \ 0xa8, 0xd8, 0xde, 0xe5, 0x0d, 0x2b) +#define EFI_EVENT_GROUP_AFTER_READY_TO_BOOT \ + EFI_GUID(0x3a2a00ad, 0x98b9, 0x4cdf, 0xa4, 0x78, \ + 0x70, 0x27, 0x77, 0xf1, 0xc1, 0xb) + #define EFI_EVENT_GROUP_RESET_SYSTEM \ EFI_GUID(0x62da6a56, 0x13fb, 0x485a, 0xa8, 0xda, \ 0xa3, 0xdd, 0x79, 0x12, 0xcb, 0x6b) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 1823990..6fdd0ef 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -71,6 +71,9 @@ const efi_guid_t efi_guid_driver_binding_protocol = /* event group ExitBootServices() invoked */ const efi_guid_t efi_guid_event_group_exit_boot_services = EFI_EVENT_GROUP_EXIT_BOOT_SERVICES; +/* event group before ExitBootServices() invoked */ +const efi_guid_t efi_guid_event_group_before_exit_boot_services = + EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES; /* event group SetVirtualAddressMap() invoked */ const efi_guid_t efi_guid_event_group_virtual_address_change = EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE; @@ -2123,6 +2126,16 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, if (!systab.boottime) goto out; + /* Notify EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES event group. */ + list_for_each_entry(evt, &efi_events, link) { + if (evt->group && + !guidcmp(evt->group, + &efi_guid_event_group_before_exit_boot_services)) { + efi_signal_event(evt); + break; + } + } + /* Stop all timer related activities */ timers_enabled = false; -- cgit v1.1 From 22ad3f5f7b31e2ff3e3415047c584dfdff388aea Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 17 Nov 2021 18:52:35 +0100 Subject: efi_selftest: unit test for EFI_GROUP_BEFORE_EXIT_BOOT_SERVICE Add a test for the EFI_GROUP_BEFORE_EXIT_BOOT_SERVICE event group. Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/efi_selftest_exitbootservices.c | 67 ++++++++++++++++++++---- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_exitbootservices.c b/lib/efi_selftest/efi_selftest_exitbootservices.c index 4fecd1b..59ab154 100644 --- a/lib/efi_selftest/efi_selftest_exitbootservices.c +++ b/lib/efi_selftest/efi_selftest_exitbootservices.c @@ -10,9 +10,34 @@ #include +static efi_guid_t guid_before_exit_boot_services = + EFI_GUID(0x8be0e274, 0x3970, 0x4b44, 0x80, 0xc5, + 0x1a, 0xb9, 0x50, 0x2f, 0x3b, 0xfc); +#define CAPACITY 4 + +struct notification_record { + unsigned int count; + unsigned int type[CAPACITY]; +}; + +struct notification_context { + struct notification_record *record; + unsigned int type; +}; + static struct efi_boot_services *boottime; static struct efi_event *event_notify; -static unsigned int notification_count; +struct notification_record record; + +struct notification_context context_before = { + .record = &record, + .type = 1, +}; + +struct notification_context context = { + .record = &record, + .type = 2, +}; /* * Notification function, increments the notification count. @@ -20,11 +45,15 @@ static unsigned int notification_count; * @event notified event * @context pointer to the notification count */ -static void EFIAPI notify(struct efi_event *event, void *context) +static void EFIAPI ebs_notify(struct efi_event *event, void *context) { - unsigned int *count = context; + struct notification_context *ctx = context; + + if (ctx->record->count >= CAPACITY) + return; - ++*count; + ctx->record->type[ctx->record->count] = ctx->type; + ctx->record->count++; } /* @@ -43,15 +72,23 @@ static int setup(const efi_handle_t handle, boottime = systable->boottime; - notification_count = 0; ret = boottime->create_event(EVT_SIGNAL_EXIT_BOOT_SERVICES, - TPL_CALLBACK, notify, - (void *)¬ification_count, + TPL_CALLBACK, ebs_notify, + &context, &event_notify); if (ret != EFI_SUCCESS) { efi_st_error("could not create event\n"); return EFI_ST_FAILURE; } + ret = boottime->create_event_ex(0, TPL_CALLBACK, ebs_notify, + &context_before, + &guid_before_exit_boot_services, + &event_notify); + if (ret != EFI_SUCCESS) { + efi_st_error("could not create event\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; } @@ -68,13 +105,21 @@ static int setup(const efi_handle_t handle, */ static int execute(void) { - if (notification_count != 1) { - efi_st_error("ExitBootServices was not notified\n"); + if (record.count != 2) { + efi_st_error("Incorrect event count %u\n", record.count); + return EFI_ST_FAILURE; + } + if (record.type[0] != 1) { + efi_st_error("EFI_GROUP_BEFORE_EXIT_BOOT_SERVICE not notified\n"); + return EFI_ST_FAILURE; + } + if (record.type[1] != 2) { + efi_st_error("EVT_SIGNAL_EXIT_BOOT_SERVICES was not notified\n"); return EFI_ST_FAILURE; } efi_st_exit_boot_services(); - if (notification_count != 1) { - efi_st_error("ExitBootServices was notified twice\n"); + if (record.count != 2) { + efi_st_error("Incorrect event count %u\n", record.count); return EFI_ST_FAILURE; } return EFI_ST_SUCCESS; -- cgit v1.1 From dc52578d7b48342c04484184199831893a983cbf Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 17 Nov 2021 18:55:59 +0100 Subject: efi_loader: bump EFI_SPECIFICATION_VERSION to 2.9 We have implemented all what is new in UEFI specification 2.9 and relevant for U-Boot. Signed-off-by: Heinrich Schuchardt --- include/efi_api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 1e95656..80109f0 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -20,8 +20,8 @@ #include #include -/* UEFI spec version 2.8 */ -#define EFI_SPECIFICATION_VERSION (2 << 16 | 80) +/* UEFI spec version 2.9 */ +#define EFI_SPECIFICATION_VERSION (2 << 16 | 90) /* Types and defines for EFI CreateEvent */ enum efi_timer_delay { -- cgit v1.1 From 5ba0397049b4ad5e2e23e47a8ae412e2d9044c67 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 18 Nov 2021 09:03:39 +0200 Subject: efi_loader: fix FinalEvents table if an EFI app invoked GetEventLog As described in the TCG spec [1] in sections 7.1.1 and 7.1.2 the FinalEvent table should include events after GetEventLog has been called. This currently works for us as long as the kernel is the only EFI application calling that. Specifically we only implement what's described in 7.1.1. So refactor the code a bit and support EFI application(s) calling GetEventLog. Events will now be logged in both the EventLog and FinalEvent table as long as ExitBootServices haven't been invoked. [1] https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf Signed-off-by: Ilias Apalodimas --- lib/efi_loader/efi_tcg2.c | 99 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 29 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 2771fd6..6e32f52 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -27,6 +27,17 @@ #include #include +/** + * struct event_log_buffer - internal eventlog management structure + * + * @buffer: eventlog buffer + * @final_buffer: finalevent config table buffer + * @pos: current position of 'buffer' + * @final_pos: current position of 'final_buffer' + * @get_event_called: true if GetEventLog has been invoked at least once + * @ebs_called: true if ExitBootServices has been invoked + * @truncated: true if the 'buffer' is truncated + */ struct event_log_buffer { void *buffer; void *final_buffer; @@ -34,6 +45,7 @@ struct event_log_buffer { size_t final_pos; /* final events config table position */ size_t last_event_size; bool get_event_called; + bool ebs_called; bool truncated; }; @@ -186,39 +198,29 @@ static efi_status_t tcg2_pcr_extend(struct udevice *dev, u32 pcr_index, return EFI_SUCCESS; } -/* tcg2_agile_log_append - Append an agile event to out eventlog +/* put_event - Append an agile event to an eventlog * * @pcr_index: PCR index * @event_type: type of event added * @digest_list: list of digest algorithms to add * @size: size of event * @event: event to add + * @log: log buffer to append the event * - * @Return: status code */ -static efi_status_t tcg2_agile_log_append(u32 pcr_index, u32 event_type, - struct tpml_digest_values *digest_list, - u32 size, u8 event[]) +static void put_event(u32 pcr_index, u32 event_type, + struct tpml_digest_values *digest_list, u32 size, + u8 event[], void *log) { - void *log = (void *)((uintptr_t)event_log.buffer + event_log.pos); size_t pos; size_t i; u32 event_size; - if (event_log.get_event_called) - log = (void *)((uintptr_t)event_log.final_buffer + - event_log.final_pos); - /* * size refers to the length of event[] only, we need to check against * the final tcg_pcr_event2 size */ event_size = size + tcg_event_final_size(digest_list); - if (event_log.pos + event_size > TPM2_EVENT_LOG_SIZE || - event_log.final_pos + event_size > TPM2_EVENT_LOG_SIZE) { - event_log.truncated = true; - return EFI_VOLUME_FULL; - } put_unaligned_le32(pcr_index, log); pos = offsetof(struct tcg_pcr_event2, event_type); @@ -242,25 +244,62 @@ static efi_status_t tcg2_agile_log_append(u32 pcr_index, u32 event_type, memcpy((void *)((uintptr_t)log + pos), event, size); pos += size; - /* make sure the calculated buffer is what we checked against */ + /* + * make sure the calculated buffer is what we checked against + * This check should never fail. It checks the code above is + * calculating the right length for the event we are adding + */ if (pos != event_size) - return EFI_INVALID_PARAMETER; + log_err("Appending to the EventLog failed\n"); +} - /* if GetEventLog hasn't been called update the normal log */ - if (!event_log.get_event_called) { - event_log.pos += pos; - event_log.last_event_size = pos; - } else { - /* if GetEventLog has been called update config table log */ - struct efi_tcg2_final_events_table *final_event; +/* tcg2_agile_log_append - Append an agile event to an eventlog + * + * @pcr_index: PCR index + * @event_type: type of event added + * @digest_list: list of digest algorithms to add + * @size: size of event + * @event: event to add + * @log: log buffer to append the event + * + * @Return: status code + */ +static efi_status_t tcg2_agile_log_append(u32 pcr_index, u32 event_type, + struct tpml_digest_values *digest_list, + u32 size, u8 event[]) +{ + void *log = (void *)((uintptr_t)event_log.buffer + event_log.pos); + u32 event_size = size + tcg_event_final_size(digest_list); + struct efi_tcg2_final_events_table *final_event; + efi_status_t ret = EFI_SUCCESS; - final_event = - (struct efi_tcg2_final_events_table *)(event_log.final_buffer); - final_event->number_of_events++; - event_log.final_pos += pos; + /* if ExitBootServices hasn't been called update the normal log */ + if (!event_log.ebs_called) { + if (event_log.truncated || + event_log.pos + event_size > TPM2_EVENT_LOG_SIZE) { + event_log.truncated = true; + return EFI_VOLUME_FULL; + } + put_event(pcr_index, event_type, digest_list, size, event, log); + event_log.pos += event_size; + event_log.last_event_size = event_size; } - return EFI_SUCCESS; + if (!event_log.get_event_called) + return ret; + + /* if GetEventLog has been called update FinalEventLog as well */ + if (event_log.final_pos + event_size > TPM2_EVENT_LOG_SIZE) + return EFI_VOLUME_FULL; + + log = (void *)((uintptr_t)event_log.final_buffer + event_log.final_pos); + put_event(pcr_index, event_type, digest_list, size, event, log); + + final_event = event_log.final_buffer; + final_event->number_of_events++; + event_log.final_pos += event_size; + + return ret; } /** @@ -1303,6 +1342,7 @@ static efi_status_t efi_init_event_log(void) event_log.pos = 0; event_log.last_event_size = 0; event_log.get_event_called = false; + event_log.ebs_called = false; event_log.truncated = false; /* @@ -1792,6 +1832,7 @@ efi_tcg2_notify_exit_boot_services(struct efi_event *event, void *context) EFI_ENTRY("%p, %p", event, context); + event_log.ebs_called = true; ret = platform_get_tpm2_device(&dev); if (ret != EFI_SUCCESS) goto out; -- cgit v1.1 From d6b55a420cfce660343cc1f60e68fcad0157925a Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 18 Nov 2021 10:13:42 +0200 Subject: efi_loader: startup the tpm device when installing the protocol Due to U-Boot's lazy binding mentality the TPM is probed but not properly initialized. The user can startup the device from the command line e.g 'tpm2 startup TPM2_SU_CLEAR'. However we can initialize the TPM during the TCG protocol installation, which is easier to use overall. Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_tcg2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 6e32f52..8c1f22e 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1943,6 +1944,7 @@ efi_status_t efi_tcg2_register(void) efi_status_t ret = EFI_SUCCESS; struct udevice *dev; struct efi_event *event; + u32 err; ret = platform_get_tpm2_device(&dev); if (ret != EFI_SUCCESS) { @@ -1950,6 +1952,13 @@ efi_status_t efi_tcg2_register(void) return EFI_SUCCESS; } + /* initialize the TPM as early as possible. */ + err = tpm_startup(dev, TPM_ST_CLEAR); + if (err) { + log_err("TPM startup failed\n"); + goto fail; + } + ret = efi_init_event_log(); if (ret != EFI_SUCCESS) goto fail; -- cgit v1.1