hal: miscellaneous fixes

Fixes for the following issues reported by KW

21725, 21726, 21727, 21737, 21738, 21739, 21740, 21750,
21751, 21752, 25317, 30602, 32620, 36778, 41817, 41819,
50942, 54468, 54470, 54479, 55569, 54481, 55570, 55571,
58485, 85112, 85122, 85123

Change-Id: I9abef07db7ccdc19789a201eb268a97e1b360cad