-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathNEWS.txt
3134 lines (2255 loc) · 123 KB
/
NEWS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
bits-2079
=========
- On unknown CPUs, don't run the MSR consistency test in the full testsuite
On unknown CPUs without a CPU-specific MSR blacklist, this test produces
too many false positives. Leave it available to run specifically, but
don't run it as part of the full "run all tests" testsuite.
- python: Disable new GCC warning shift-negative-value
This broke the build with GCC 6.
- os.putenv: Avoid propagating old errors from previous function calls
grub_env_set propagated the previous (potentially unrelated) grub_errno
value, which led to spurious error messages from harmless failures. For
instance, Python searches for modules by attempting to open each
possible location, and handles errors by continuing the search; however,
a subsequent call to putenv would noisily show that error. This
resulted in a spurious error message about /boot/python/bits/efi.pyc,
even though the import call that produced that message went on to open
the correct file.
Clear grub_errno at the start of putenv to prevent this.
- mkpresent: Update to work with current PIL
- bits.present: Fix hotkey for the new input layer
bits-2073
=========
- efi: Support EFI_IP4_CONFIG2_PROTOCOL and associated data structures
- _socket: Use EFI_IP4_CONFIG2_PROTOCOL if available, falling back to
EFI_IP4_CONFIG_PROTOCOL
BIOSes based on current versions of EDK2, including current OVMF, only
support EFI_IP4_CONFIG2_PROTOCOL, and drop support for
EFI_IP4_CONFIG_PROTOCOL. Support configuring IPv4 via the newer
protocol, falling back to the older protocol for compatibility with
existing BIOSes.
In either case, reuse the existing IPv4 configuration if present, and
only kick off DHCP if not already configured. This also allows systems
that require manual IPv4 configuration to perform such configuration
(via the EFI shell, the BITS Python interpreter, or any other means) and
subsequently use that configuration with BITS.
bits-2070
=========
Highlights of the new release:
- BITS on EFI now supports TCP networking, including HTTP clients via
urllib2, and HTTP servers via BaseHTTPServer. See below for details
and caveats.
- BITS now has significantly improved Python and ACPI performance,
thanks to Python's optimized memory allocator. This speeds up common
Python and ACPI operations significantly, including BITS boot time.
BITS can now boot in less than a second on virtual hardware.
- BITS line-editing keys now work on EFI, and several more common
keybindings from readline now work in BITS. Refer to
`Documentation/line-editing.txt` in the BITS distribution for full
input documentation.
- Fix a hard-to-debug issue that led to crashes or malfunctions in FFI
calls between C and Python, caused by EFI interrupts during assembly
code corrupting stack data in the x86-64 POSIX ABI "red zone".
- BITS now has a mailing list, [email protected]; see
https://lists.01.org/mailman/listinfo/bits to subscribe.
Networking
----------
BITS on EFI now supports TCP networking, using the Python socket module
and various modules built atop it. On EFI systems that provide
`EFI_IP4_CONFIG_PROTOCOL` and `EFI_TCP4_SERVICE_BINDING_PROTOCOL`, we
implement a `_socket` module in Python with support for TCP sockets over
IPv4. We then include Python's higher-level socket module that runs on
top of `_socket`.
When constructing a socket for the first time, `_socket` will initialize
the EFI network stack, which will typically use DHCP to obtain an
address.
Given a socket created with `s = socket.socket()`, you can establish
an outbound connection with `s.connect(("ip.ad.dr.ess"), port)`, or
create a server using `s.bind(("0.0.0.0", port))`, `s.listen(1)`, and
`client_s, addr = s.accept()`. Afterwards, use `recv` and `sendall`
to communicate, or create a file-like object with `makefile`. See the
socket module documentation at
https://docs.python.org/2.7/library/socket.html for more details.
The efi module now includes the EFI protocols for IPv4 configuration,
TCP over IPv4, and IPv4 DNS. The current Python socket implementation
only supports TCP over IPv4. Also, as OVMF and other EFI systems do not
include `EFI_DNS4_SERVICE_BINDING_PROTOCOL`, the socket implementation
does not support hostname resolution (other than "localhost").
Both blocking and non-blocking sockets work. BITS now includes a safe
Python interface to handle EFI events via callbacks, and uses this to
implement sockets and the Python select module (`select.select` only).
For the receive side, EFI has no way to ask for available data without
retrieving that data, so BITS will always kick off an EFI Receive call
in the background when checking for socket readiness with no data
available, and buffer the received data to supply to the caller. A
blocking recv will wait for the data to come back; a non-blocking recv
will raise a timeout after the configured socket timeout (possibly
immediately), and a subsequent recv will return the data. Only one
outstanding Receive call will run at a time, and only if BITS does not
already have a buffer of received data.
For the transmit side, a connected socket will always show up as
writable. BITS does not buffer transmits itself, but instead always
blocks until the EFI Transmit call signals its completion event.
Non-blocking connect works as well; `select.select` on a connecting
socket for write will block until the connect completes, and a
subsequent call to `getsockopt(SOL_SOCKET, SO_ERROR)` will return (and
clear) the connection status.
For simplicity, do not attempt to reuse a caller's buffers for zero-copy
networking; this is several-copy networking, optimized for simplicity
and memory usage rather than performance.
Building on this networking support, BITS now supports the Python
urllib2 module and its dependencies, to function as a simple HTTP
client. This also includes the Python modules urllib, urlparse,
httplib, mimetools, and rfc822.
Since BITS does not include DNS support, using `urllib2.urlopen` on an
URL with a hostname will fail. An URL with an IP address works, as long
as the server on the other end can handle a Host header with that IP
address (which may fail with servers serving multiple domains using
name-based virtual hosting). As a simple test, connecting to a server
run via python's SimpleHTTPServer module works, which makes it simple to
transfer data from a separate host system into the BITS environment
without rebooting.
Since BITS does not include an SSL library, `urllib2.urlopen` does not
support https URLs.
urllib2's support for digest authentication uses the random module,
which we don't yet support; add a stub random module with no functions,
so that importing urllib2 will work, but attempting to use digest
authentication will raise an exception when attempting to call
non-existent functions in random.
Likewise, mimetools imports tempfile, but only calls it from
`mimetools.pipethrough` (which also calls the unsupported `os.popen`);
add a stub tempfile module with no functions. httplib uses
`mimetools.Message`, which works.
On the server side, BITS now supports the Python BaseHTTPServer module
and its dependencies, to build simple HTTP servers. This includes the
Python modules base64, hashlib, cgi, mimetypes, shutil,
`dummy_threading` (without actual threading support), and SocketServer.
To build a simple HTTP server, define a class deriving from
`BaseHTTPServer.BaseHTTPRequestHandler` that implements handler methods
for GET (and POST if desired), and pass that class to
`BaseHTTPServer.test`. See the Python BaseHTTPServer documentation at
https://docs.python.org/2/library/basehttpserver.html for details.
Note that since the sockets support does not yet support `SO_REUSEADDR`
(the flag exists for compatibility, but does not yet map to any
underlying EFI functionality), attempting to stop and immediately
restart a server on the same port will likely fail with an EFI
exception, indicating that the port remains in use.
Performance
-----------
BITS now enables Python's pymalloc allocator; this speeds up object
allocations by an order of magnitude, which also affects common
operations such as string concatenation. This reduces BITS boot time by
an order of magnitude (now boots in about a second on virtual hardware),
and provides similar speedups in every part of BITS and Python.
BITS also uses Python's small-object allocator to allocate small ACPI
objects, which speeds up many ACPI operations.
Several of the longest-running tests in BITS, which measured CPU
frequencies for many seconds to ensure a stable reading, will now
optimistically attempt to use less wall-clock time if they get a stable
reading more quickly, speeding up the BITS testsuite in the common case.
Line-editing keys
-----------------
BITS now supports a much more extensive set of line-editing keys at the
Python interactive prompt, on both EFI and BIOS systems; all of these
keys match the behaviors expected by readline-trained fingers. Refer to
`Documentation/line-editing.txt` in the BITS distribution for full input
documentation. Highlights include Ctrl-Left and Ctrl-Right to move the
cursor by words, Ctrl-O to run and retrieve successive lines from
history, Ctrl-W/Ctrl-K/Ctrl-U/Ctrl-Y/Alt-Y to kill (delete) and yank
(paste) text, and Ctrl-C to interrupt Python code in progress (only on
EFI).
(Some of these keys previously worked on BIOS systems, but not on EFI due
to input protocol limitations; BITS on EFI now supports and uses
`EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL` to obtain keyboard input directly
from the firmware.)
Ctrl-C support uses `EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL` to register a
key notify handler for Ctrl-C, which raises KeyboardInterrupt the next
time the Python interpreter has control. This allows aborting a
long-running operation, which would otherwise require rebooting. Note
that this cannot interrupt a long-running operation in C code or in
firmware, and that not all code in BITS cleans up perfectly after a
KeyboardInterrupt exception.
This introduces a new bits.input module to abstract keyboard input. On
EFI platforms, this uses the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL; on
non-EFI BIOS, this continues to use GRUB for input.
Other enhancements
------------------
- testacpi: Speed up the ACPI `_PSS` test
Before spending a full second measuring the frequency of a CPU at a
given pstate, measure it for 100ms, and pass if we get the expected
result; only fall back to 1s if that fails. This significantly speeds
up the pstate test, which we run as part of the default test suite.
- pstate: Speed up the hardware pstate test
Before spending a full second measuring the frequency of a CPU at a
given pstate, measure it for 100ms, and pass if we get the expected
result; only fall back to 1s if that fails. This significantly speeds
up the hardware pstate test, which we run as part of the default test
suite on supported CPUs.
- Allow ACPI evaluation to read and write IO ports by default
Some systems, such as the third-generation Lenovo X1 Carbon, loop
forever performing IO-triggered SMIs during ACPI initialization; the
default behavior of blocking IO ports causes such systems to hang when
initializing ACPI. Since we already allow memory accesses by default,
allow IO as well.
For compatibility and debugging, acpi.evaluate still supports the
`unsafe_io` keyword argument; `unsafe_io=False` will explicitly
disable IO port access, and `unsafe_io=True` acts as a no-op for
compatibility with existing code.
- acpi: Implement OS port access functions in Python
Replace the C implementations of `AcpiOsReadPort` and
`AcpiOsWritePort` with calls to callback functions implemented in
Python.
- acpi: In ACPICA initialization, don't switch the system into ACPI mode
With IO port accesses enabled by default, ACPICA now successfully
switches the system into ACPI mode during initialization; previously,
the IO write to make this transition got ignored. On some systems,
switching into ACPI mode disables BIOS keyboard support, which BITS
relies on. Explicitly disable this transition in ACPICA
initialization, to return to the previous BITS behavior and keep the
BIOS keyboard working.
- ttypager: Show progress while collecting output
The pager collects output from writes to stdout, but doesn't display
anything until done. Add a spinning progress indicator to help the
user tell the difference between long-running output generation and a
hang.
- Turn on `Py_InspectFlag` so that `SystemExit` doesn't call C `exit()`
Without this flag, if code running in the interactive interpreter
raises `SystemExit`, the interpreter will call the C `exit()`
function, which will abort GRUB entirely. With `Py_InspectFlag` set,
`SystemExit` will propagate like any other exception. This then
allows calling modules intended as standalone programs and continuing
afterward. Such calls may still want to catch `SystemExit` and
provide a more user-friendly result than a traceback.
- init: Time the import and initialization of modules
In the process, always put timing start and end messages on separate
lines, so that a message printed between them will not break the
formatting.
- efi: Add a safe event callback mechanism using `Py_AddPendingCall`
Since event callbacks can occur asynchronously, use a C callback that
invokes `Py_AddPendingCall`, rather than a Python ctypes callback.
- efi: Support `EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL`
- efi: Add GUIDs for EFI networking protocols
- efi: Make `efi.show_available_protocols()` show output with the pager
- testacpi: Test that all CPUs return the same `_PSS`
- acpi: `AcpiGetTable` functions don't need full ACPI init
Just call the early tables-only initialization before running them.
- python: Support compiling with `Py_DEBUG`; BITS does not enable
`Py_DEBUG` by default, but this allows developers to enable it at
build time for low-level Python debugging.
- Provide file and line number for calls to `abort()`, to aid debugging
- efi: Return `ConfigurationTableDict` as an `OrderedDict`
The order of configuration tables can potentially matter, so preserve
it.
- Merge the acpica, smp, and bitsutil modules into the python module
This will allow calls from the other modules into the python module,
without creating a dependency cycle.
- efi: Make `efi.exit()` invoke any Python atexit handlers before
exiting. This provides an opportunity to clean up before exiting.
Note that not all EFI resource allocations perform such cleanup yet.
- efi: Add constants for key scancodes
- efi: Add a general keyboard callback mechanism
Call `RegisterKeyNotify` with a C callback that calls into Python;
once in Python, dispatch to a specific Python handler based on the
key.
- efi: Add more known UUIDs from the UEFI specification
- python: Implement `time.sleep`
Implemented as a busyloop in Python, rather than calling into C. We
want to allow for background processing (such as events or keyboard
notify handlers), and we don't currently have any means of actually
sleeping while doing so.
- python: Add `time.gmtime` for compatibility
Timezones intentionally ignored; always assumes localtime matches UTC.
- python: Set `sys.argv=[]` by default for compatibility
Stock python sets `sys.argv` even when running the interactive
interpreter. Some Python test functions check for arguments but don't
handle the case of `sys.argv` not existing at all. Set `sys.argv` to
an empty list for compatibility.
Bugfixes:
- Fix a bug on x86-64 EFI that would occasionally cause a libffi call or
callback to malfunction (bad return value, `abort()`, or stack
corruption and crash), due to an EFI interrupt corrupting data left in
the red zone. Assembly functions in libffi's support for the x86-64
POSIX ABI (as used between BITS C and Python code, such as calls to
ACPI) used the "red zone" defined by the ABI as scratch space;
however, EFI firmware does not follow the same ABI, and an EFI
interrupt can overwrite any data stored below the stack pointer.
Thus, an interrupt that occurred during the small regions of assembly
code relying on data in the red zone would cause rare, hard-to-debug
issues.
Fix these two libffi assembly routines (`ffi_call_unix64` and
`ffi_closure_unix64`) to not rely on the red zone remaining untouched
while they run; adjust the stack pointer to contain all scratch space,
and only access data above the stack pointer.
- Disable GCC 5.2's new `-Wdiscarded-array-qualifiers` warning for GRUB
GRUB uses `-Werror`, and the GRUB 2.00 snapshot we use doesn't satisfy
this warning. Pass `-Wno-discarded-array-qualifiers` to configure to
disable the warning.
- testacpi: Fix typo in `_MAT` test
- smbios: Fix field name typo
This caused an exception when decoding a `SystemEnclosure` with
contained elements.
- testacpi: When testing ACPI `_PSS`, preserve the current pstate
Introduce a new `bits.preserve_msr()` context manager to preserve an
MSR on all CPUs around a block of code.
- pstate: Preserve the current pstate around the hardware pstate test
- Update URLs in documentation to https where available
- efi: Save configuration tables to file decoded as GUID and pointer
- Fix typos in PCIe error injection
- Makefile: Fix a race condition between parallel grub install targets
Occasionally, the grub install targets for two platforms would both
try to install the same platform-independent script (e.g.
`grub-mkrescue`) at the same time to the same location, generating a
spurious failure saying the file already exists. Fix by installing
the grub binaries for each platform to a separate temporary directory.
- python: Fix line history navigation with Ctrl-O
Ctrl-O on a line in history submits the line and causes the next call
to readline to start with the following line from history. That
initial state caused readline to not have a recorded state for the
line "after" all existing history (what would be a fresh new blank
line if Ctrl-O had not left the "vertical cursor" back in history).
Subsequently navigating down to the end of history would then raise an
exception.
Fix that downward navigation to materialize a fresh new blank line
when navigating down from the last line in history.
bits-2005
=========
- Makefile: Fix version calculation when not building from git
bits-2003
=========
Track all BITS dependencies (GRUB2, Python, ACPICA, libffi, and fdlibm)
as git submodules, rather than as separate tarballs to unpack. Split
all BITS-specific changes to these dependencies as commits in those git
repositories, making them easier to track, update, and upstream.
Submodules also ensure that each commit to BITS has a matching version
of all dependencies that it builds with, and that changes to BITS and
corresponding changes to dependencies are committed atomically.
BITS releases now provide a single source tarball containing both the
BITS source and the dependencies under the deps directory. This avoids
the need to unpack multiple source tarballs to specific locations before
building.
New features:
- Add support to decode and execute ACPI error injection (APEI, EINJ)
- Add explore option to decode and display variable MTRRs
- smilatency: Add a new function to time explicitly invoked SMIs
The new smilatency.time_io_smi function explicitly invokes SMIs by
writing to an IO port (by default, port 0xb2), and times the duration
of those SMIs. The port, the byte written, and the number of SMIs to
average can all be changed via optional parameters.
- Update Python to a post-2.7.10 snapshot that supports --with-computed-gotos.
This improves the performance of the Python interpreter.
- python: Support the glob, optparse, pickle, profile, pstats, and
unicodedata modules
- Provide a bits.rdtsc() function to directly invoke the rdtsc
instruction. Previously, Python code used rdmsr on MSR 0x10.
- Update to ACPICA 20150717
- acpi: Add summary before SRAT table decode
- efi: Add SMBIOS3_TABLE_GUID
Bugfixes and cleanups:
- Makefile: Fix build on systems that change configure's default libdir
The invocation of configure for grub did not specify --libdir, and
assumed that it would end up as the default $(prefix)/lib. However,
some distributions set a different systemwide default libdir (such as
/lib64) in a way that affects the default for configured software. On
such systems, the build would fail because it could not find files in
GRUB's libdir. To avoid that, explicitly specify --libdir.
- Makefile: When computing build version information, only use our own git
repository
If we don't have a .git directory, avoid searching upwards for a git
repository. Otherwise, builds from beneath some other unrelated git
repository would pick up a version number from there.
- Don't hardcode a specific mwait hint value in pstate tests or
cpu_frequency
bits.cpu_frequency hardcoded an mwait hint of 0x20, and set that
unconditionally, without restoring the original hint afterward.
pstate.test_hardware_pstates and testacpi.test_pstates also hardcoded
0x20, and each had identical code to save and restore the original
hints.
Stop setting a hint in cpu_frequency; it now measures based on the
current state only. Factor out the duplicate save/restore code into a
new context manager bits.mwait.use_hint, and add a mechanism for CPUs
to quirk the default hint to something other than 0x20.
- bits.cpu_frequency: Stop assuming that APERF and MPERF use TSC
frequency
APERF and MPERF are only guaranteed to be proportional; MPERF need not
actually match TSC. Read and use the TSC delta separately to scale
the APERF/MPERF ratio.
- Avoid calling bits.cpu_frequency twice when checking for availability.
This speeds up the CPU frequency test.
- bitfields.setbits: Fix bug referencing a name from the same module
- topology.display: Let ttypager.page() catch and display exceptions.
- smilatency: Factor out the computation of TSCs per second as a helper.
The new bits.tsc_per_sec() function computes the number of TSC counts
per second; after the first call, it just returns the cached value.
The new bits.format_tsc() function formats a number of TSC counts as a
time string with units.
- cstate_residency: Use the new bits.mwait.use_hint helper.
This factors out common code, and ensures that the hint is restored
after the test.
- python: Fix time.localtime to accept float arguments
- python: Make our file-like objects, used for stdout/stderr streams,
support .flush()
- Move some bits-specific modules into the bits.* module namespace
This avoids possible conflicts between bits modules and standard
Python modules.
- Work around ACPICA bug: skip over initial NULLs from
AcpiGetTableByIndex below index 3
ACPICA started reserving index slots for 32-bit and 64-bit FACS, and
returning NULL for those that don't exist, with other tables starting
at index 3. This breaks the previous API that allowed enumerating
tables until the first NULL is returned. Work around that by always
grabbing the first 3 (filtering NULL), and then starting the
enumeration-until-NULL from 3 rather than 0.
- acpi: Rename duplicate field in SRATMemoryAffinity
- acpi: get_cpupaths: Fix handling of x2apic CPUs (with _UID)
- acpi: Fix FACS parsing to return the parsed structure
- cpudetect: Replace hardcoded list of CPU names with detection of
available CPU modules
- Move errno compatibility changes from pyconfig.h to errno.h. This
allows them to support fdlibm as well, which eliminates one of our
changes to fdlibm.
bits-1219
=========
BITS now builds via a Makefile rather than a shell script. This allows
the build to run in parallel, significantly speeding up builds.
Note that unlike the build script, which autodetected the number of CPUs
to build on, the Makefile uses the usual -j option to make. So, if
you're used to ./build autodetecting your CPUs, you'll want to use make
-j$(nproc) (or just directly specify your desired amount of parallelism,
as you do with other makefiles).
Use make V=1 to let make echo commands before it runs them.
Use make LOCAL=1 to include local-files in the build (formerly ./build
local).
BITS now builds within a "build" subdirectory of the source rather than
a temporary directory under /tmp. The build system no longer removes
this directory as part of the build, only via an explicit "make clean",
to make it easier to investigate the build results.
Note that despite building via Make, BITS does *not* attempt to support
incremental builds. We continue to recommend ccache to speed up rebuilds.
Notable new features:
- Add a menu entry to exit back to EFI.
- Show on the main menu how BITS was booted: 32-bit BIOS, 32-bit EFI, or
64-bit EFI.
- Support reading and writing control registers.
bits.read_cr(apicid, n) reads CRn.
bits.write_cr(apicid, n, value) writes value to CRn.
Both functions return None on GPF.
Various improvements to the pager:
- When showing output from Python code via the pager, capture tracebacks
and display those via the pager as well, so that they wait for input.
Previously, if an exception occurred, it would flash on the screen
briefly before returning directly to the menu, requiring a trip to the
log to view the traceback.
Also display the output produced before the exception.
- Don't suggest going up when at the top of the output.
- Mention Up as well as PgUp.
- Clean up and simplify logic for EFI file handling and for displaying
available options.
Migrate quite a bit of code from C to Python:
- efi: Remove efi.call and the underlying _efi methods supporting it
Now that we can call EFI functions via ctypes, we don't need efi.call
anymore.
- Remove bits.malloc and bits.memmove, now unused with the move to ctypes
- acpi: Use ctypes to call most ACPICA functions from Python, rather
than wrapping them via the Python C API.
This allows replacing several C functions with simpler Python
equivalents.
Because the 32-bit BIOS port uses a calling convention unsupported by
libffi, introduce various trivial C wrappers that re-export ACPICA
functions with the standard C calling convention. For
AcpiWalkNamespace, introduce a more detailed wrapper that handles
callbacks back into Python-provided functions.
Export acpica_init to Python as well, and call it before calling the
ACPICA functions.
- acpi: Move unsafe_io handling from C to Python.
Directly export the address of the variable and manipulate it using
ctypes.
- acpi: Add acpi.install_interface, wrapping AcpiInstallInterface, for
use in the ACPI OS features menu.
- acpi: Add an exception mechanism with error code names, and a function
to transform an ACPI_STATUS value into an exception. This uses
AcpiFormatException to decode error codes.
- acpi: Add docstrings to ACPICA functions
Migrate quite a bit of code from GRUB scripting (and supporting C and
Python scaffolding) to Python:
- Convert MWAIT latency test to Python, with a minimal C helper for the
timing-sensitive portion.
Delete the now-unused "timer" and "cpu_ping" commands.
- Port mwait menu to Python
- Drop code to force specific configuration profiles on Nehalem and
Sandy Bridge.
This code remains available in older releases, but drop it from the
current version rather than porting it from GRUB configuration
language to Python.
- configure.cfg: Drop support for CPU-specific GRUB configure menu
files, since no more such files remain.
- Factor out a bits.brandstring() function to return the brandstring.
- Generate the CPU name on the main menu using Python, and improve title
to use CPU brandstring rather than maintaining a table of CPU
marketing names in BITS.
- Delete CPU family names and marketing names.
- Drop GRUB-based CPU detection entirely.
None of the GRUB config files depend on the variables this sets
anymore; all CPU-specific code lives in Python now.
- Remove the testsuite module and C expression evaluator.
The GRUB CPU detection code was the last user of this.
- Remove options to GRUB commands to run on particular CPUs.
The GRUB CPU detection code was the last programmatic user of this, and
command-line users can use Python for this.
- Remove all GRUB commands and options not used manually.
Nothing uses these commands programmatically anymore, so drop mechanisms
to write to environment variables, operate quietly, run tests, format
environment variables for display, sleep, or set mwait.
A future version of BITS may remove the remaining commands entirely,
in favor of Python functions, as the Python functions become
increasingly high-level and convenient. If you still rely on the GRUB
commands, please contact us.
Migrating all this code from C and GRUB to Python allowed deleting over 9000
lines of code in BITS relative to the previous release.
Other changes in this release:
- Remove the runppm command to load and run power-management reference
code; this is no longer used with current CPUs.
- README.Developers.txt: Update for the switch to build with make.
- README.Developers.txt: Update reference to GRUB version information.
- README.Developers.txt: BITS doesn't need the todos command anymore.
- acpi: Fix reinitialization after termination. Clear all of the
initialization flags, so that reinitialization actually loads tables
rather than failing. This fixes the menu items to change what OS
features BITS advertises to ACPI.
- acpi: Don't retrieve full table data just to check if a table exists.
get_table and get_table_addr both return None for a nonexistent table,
but the former returns a string containing the full table data, while
the latter just returns the address.
- acpi: Drop support for AcpiGbl_EnableAmlDebugObject. Our current
setting for AcpiDbgLevel leaves the debug object always enabled
regardless of this value, so drop it.
- acpi: Add assert that the number of ACPI_OBJECT_TYPE values hasn't
changed
- acpi: Use "bool" to return errors from ACPICA initialization
Stop using GRUB error codes, since the error code never gets passed
through GRUB.
Also use the proper type to hold ACPICA error codes.
- efi: Add network-related protocol GUIDs
- efi: Add EFI_PCI_IO_PROTOCOL and a simple test function
- Convert many modules to use "from __future__ import print_function".
- testmsr: Remove redundant output in MSR result descriptions
- Eliminate redundant acpica2.h header; move contents to acpica.h
- Delete unused header file misc.h
bits-1154
=========
- efi: Fix typo in type signatures of OutputString and TestString
- NEWS.txt: Fix typos in release notes for bits-1151
bits-1151
=========
The "I FFI, UEFI, we all FFI for EFI" release.
BITS now supports making EFI calls via the Python ctypes module, rather than
manually using efi.call. This provides simplified call syntax, type safety,
better (reference-counted) memory lifetime handling, bounds checking, and the
ability to have EFI call Python callbacks.
All EFI protocols, functions, and types have been converted to use ctypes.
This also provides automatic conversions to and from Python types as
appropriate. For instance, functions declared to accept a c_wchar_p (a Unicode
string) accept Python string and unicode objects:
out = efi.system_table.ConOut.contents
out.OutputString(out, "Hello world!\r\n")
- Add support for the 64-bit EFI calling convention in ctypes
Ship a separate copy of libffi with 64-bit EFI support added, and change
Python's _ctypes module to support that calling convention.
Add the uintptr_t and intptr_t types to our stdint.h, since libffi needs
uintptr_t.
- Convert all EFI functions, structure, and protocols to ctypes
Now that ctypes can call EFI functions, convert all functions to use it,
along with the corresponding types and protocols. This significantly
improves type safety, memory lifetime handling, bounds checking, and
similar.
In particular, code should now almost never use from_address or
addressof, since those produce raw addresses that may outlive the
objects they point to; code using from_address should now use
from_buffer or similar, and code using addressof should use byref or
similar.
Define a new type EFIFUNCTYPE, analogous to ctypes.CFUNCTYPE, for calls
using the EFI calling convention. For convenience, provide a wrapper
efi.FUNC that assumes a return type of EFI_STATUS (overridable with a
keyword parameter "ret").
To simplify the process of translating EFI functions and structures from
specifications, define appropriate EFI type aliases for ctypes types.
For instance, EFI extensively uses the type UINTN for "an integer the
size of a pointer", so the efi module defines that type as c_ulong.
Using ctypes function types also enables many convenient conversions.
For example, a function taking a parameter of type c_wchar_p can accept
a Python string or unicode object. See the ctypes documentation for
more details.
When defining function parameter and return types, note that the ctypes
types c_char_p and c_wchar_p have additional magic behavior above and
beyond a normal pointer, to transparently accept and return strings.
This behavior can be convenient, but it means that an EFI function
specified to accept or return a pointer to CHAR16 may want to use either
POINTER(CHAR16) or EFI_STRING (AKA c_wchar_p) as its type, depending on
the desired semantic behavior. Use POINTER(CHAR16) (and
create_unicode_buffer) for a pointer that EFI will fill in (since
passing a temporary object converted from a Python unicode object would
not produce useful results), or for a returned pointer that the caller
must free via the EFI FreePool or similar (since the automatic
conversion of return types from c_wchar_p to a Python unicode object
would discard the pointer that needs freeing).
EFIException now decodes known EFI error codes as symbolic names, in
addition to showing the hex value of all error codes.
Since efi now makes much more extensive use of ctypes types, switch from
"import ctypes" to "from ctypes import *". Similarly, bits.present does
"from efi import *" to get the EFI types. In general, modules that just
call efi functions should "import efi", but modules defining new EFI
protocols or structures should "from efi import *".
efi.call, and the associated split64() magic for 64-bit parameters on
32-bit EFI, are no more. They will not be mourned.
- Backport a grub change to fix a build failure on systems with new flex
With current versions of flex, grub failed to build with this error:
grub_script.yy.c:2367:13: error: 'yy_fatal_error' defined but not used [-Werror=unused-function]
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
Fix that by backporting the change from git commit
9cc836a27be4a95f6f7bfd5b6bc099801645c0ea to disable additional warnings
for the flex-generated lexer.
- Disable -Wunused-value for Python
Current Python on current GCC generates a -Wunused-value warning on uses
of the PyObject_INIT macro, because it expands to a comma expression
where the rightmost value goes unused if nothing looks at the return
value. This warning turns into an error because of -Werror.
bits-1146
=========
The "EFI, FFI, fo, fum" release.
BITS now uses the Python ctypes module to access many types of data
structures and tables in memory, not just EFI. The ctypes module now
works for non-EFI builds, so modules such as acpi and pirtable can
safely use it. This required modifications to Python's libffi and
ctypes modules, to handle the various required calling conventions. See
the new bits.cdata module for ctypes wrappers that provide improved
printing, formatting, bitfield handling, and types such as GUIDs.
Much of acpi, pirtable, mptable, and smbios now use ctypes instead of
custom unpacking routines based on the struct module. Several new
internal C routines provide access to data structures as addresses
rather than Python strings, for direct access via ctypes. Further
conversion to ctypes will allow significant reduction in C code in favor
of Python.
Thanks to many new optimizations, BITS 1146 starts up several times
faster than previous releases:
- The filesystem API layer for Python code now has a faster
implementation of stat(), reducing the cases where it needs to
enumerate the parent directory to find the appropriate directory
entry.
- The Python pydoc module (with its various dependencies) now loads
on-demand when first invoked via help() or the pydoc command.
- Python now supports the zipimport module, and loads the Python
standard library from a zipfile.
Other changes in this release:
- Update Python to 2.7.9. Drop changes merged upstream, and add new
stubs and compatibility APIs for functions now called by 2.7.9.
- Update to ACPICA version 20141107
- Support the Python shlex module
- The pager now supports saving the currently displayed data to a file
on disk. Since this requires file write support, it only works when
booted via EFI.
- Print a message when starting BITS and when loading and initializing
early Python modules, to help debug BITS startup and provide an
indication of progress.
- smbios: Decode many additional structure types, and add a preliminary
Annex A conformance test. Includes contributions by Cathy Ji.
- efi: Add constants, structures, and helper functions for HII
configuration protocols.
- efi: The efi_file class now provides context manager support, to work
with the "with" statement.
- efi: Add menu entries to save and print EFI tables, in both raw and
decoded form. Includes the System Table, Configuration Table, Runtime
Services. and Boot Services. Decoded versions include names for known
GUIDs in Configuration table entries.
- acpi: Optionally allow I/O port access from ACPI method evaluation. By
default, ACPI method evaluation still ignores attempts to read or
write I/O ports. However, acpi.evaluate now accepts a keyword argument
unsafe_io=True to explicitly allow I/O. Also add a new debug printf to
show attempts to access I/O ports; add "acpica_io" to the debug
environment variable to see those attempts.
- acpi: When running under EFI, support saving ACPI tables to disk as
separate files, both raw and optionally decoded.
- acpi: Generate the table-dumping menu items from Python.
- acpi: Support dumping decoded ACPI tables to the BITS log.
- acpi: Add a new load_table method to load an SSDT table binary into
the ACPI namespace. Usage: acpi.load_table(table_data), where
table_data is a string buffer of the SSDT's AML. The contents of the
SSDT can be used to either patch existing or add new ACPI methods or
data for debug purposes. Given a binary AML file stored on the BITS
boot media as /ssdt.aml: acpi.load_table(open("/ssdt.aml").read())
- acpi: get_objpaths, display_objects, and dump now support limiting
maximum object depth, with a new optional depth parameter.
- acpica: Provide more logging and debugging functions, to help debug
internal ACPICA failures.
- _acpi: Add internal functions to get and set AcpiGbl_EnableAmlDebugObject
- init.cfg: Add a commented example to enable verbose logging from
Python; useful to debug Python module loading.
Bugfixes:
- acpi: Fix double-free in _eval error path when processing packages
- acpi: Handle package arguments correctly in acpi.evaluate.
acpi.evaluate attempted to convert tuples to ACPI packages, but did
not recursively convert the objects in the tuple to ACPI objects, so
any attempt to pass a non-empty tuple as an argument failed. Fix by
recursively calling _acpi_object_from_python on each component of the
tuple.
- acpi: Handle CPU paths and Device paths separately. Evaluate the
former to get a ProcID, and call ._UID on the latter to get a UID;
don't do both on both. Make display handle processors with UIDs
correctly, and format them correctly.
- acpimodule.c: Fix unused parameter warnings
Previously hidden by lax warning flags that ACPICA requires; this will
allow re-enabling that warning via GCC pragmas.
- efi: import efi from generated menu entries; avoid assuming that some
other global Python code has already imported efi.
- efi: Make EFI table saving more robust (and verbose). Add error
handling for unusual boot scenarios in which the EFI boot filesystem
does not match the GRUB root directory.
- Avoid printing spurious pre-import messages for efi modules when not
on efi. Using try/except to catch ImportError didn't stop the initial
message from printing. Check sys.platform instead.
- ttypager: When trying to import efi, only catch ImportError
- When viewing the log, don't write the log to the log