summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | binman: Make section padding consistent with other entriesSimon Glass2020-10-294-2/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present padding of sections is inconsistent with other entry types, in that different pad bytes are used. When a normal entry is padded by its parent, the parent's pad byte is used. But for sections, the section's pad byte is used. Adjust logic to always do this the same way. Note there is still a special case in entry_Section.GetPaddedData() where an image is padded with the pad byte of the top-level section. This is necessary since otherwise there would be no way to set the pad byte of the image, without adding a top-level section to every image. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Move section padding to the parentSimon Glass2020-10-292-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each section is padded up to its size, if the contents are not large enough. Move this logic from _BuildSectionData() to GetPaddedDataForEntry() so that all the padding is in one place. With this, the testDual test is working again, so enable it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Refactor _BuildSectionData()Simon Glass2020-10-292-10/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this function does the padding needed around an entry. It is easier to understand what is going on if we have a function that returns the contents of an entry, with padding included. Refactor the code accordingly, adding a new GetPaddedData() method. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Move section-building code into a functionSimon Glass2020-10-292-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a new _BuildSectionData() to hold the code that is now in GetData(), so that it is clearly separated from entry.GetData() base function. Separate out the 'pad-before' processing to make this easier to understand. Unfortunately this breaks the testDual test. Rather than squash several patches into an un-reviewable glob, disable the test for now. This also affects testSkipAtStartSectionPad(), although it still not quite what it should be. Update that temporarily for now. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Expand docs and test for alignmentSimon Glass2020-10-293-12/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alignment does form part of the entry once the image is written out, but within binman the entry contents does not include the padding. Add documentation to make this clear, as well as a test. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Expand docs and test for paddingSimon Glass2020-10-293-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Padding becomes part of the entry once the image is written out, but within binman the entry contents does not include the padding. Add documentation to make this clear, as well as a test. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Update testPackExtra with more checksSimon Glass2020-10-292-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check the contents of each section to make sure it is actually in the right place. Also fix a whitespace error in the .dts file. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Use 'files-compress' to set compression for filesSimon Glass2020-10-294-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present we use 'compress' as the property to set the compression of a 'files' entry. But this conflicts with the same property for entries, of which Entry_section is a subclass. Strictly speaking, since Entry_files is in fact a subclass of Entry_section, the files can be compressed individually but also the section (that contains all the files) can itself be compressed. With this change, it is possible to express that. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Move CompressData() into Entry base classSimon Glass2020-10-292-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this is only used by blobs. To allow it to be used by other entry types (such as sections), move it into the base class. Also read the compression type in the base class. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Expand the error message for breaching a sectionSimon Glass2020-10-292-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add in a few more details to this error message to make it easier to see what is going on. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Remove references to 'image' in entry_SectionSimon Glass2020-10-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While a section is the base class of Image, it is more correct to refer to sections in most places in this file. Fix these comments. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Fix return from u-boot-ucode if there is no DTSimon Glass2020-10-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should return empty contents, not leave it unset. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Give a sensible error if no command is givenSimon Glass2020-10-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present if 'binman' is typed on the command line, a strange error about a missing argument is displayed. Fix this. These does not seem to be standard way to add the 'required' argument in all recent Python versions, so set it manually. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Add tests for skip-at-start sectionsSimon Glass2020-10-294-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this feature is tested view the end-at-4gb feature. Add some tests of its own, including the operation of padding. The third test here shows binman's current, inconsistent approach to padding in the top-level section. Future patches in this series will address this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Drop unused return variable for _DoTestFile()Simon Glass2020-10-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function returns the exit code from binman, not any data. Fix up a few callers in the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | binman: Update the entry docsSimon Glass2020-10-291-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has got out of sync with the entries. Regenerate it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: doc: Update the of-platadata documentationSimon Glass2020-10-291-23/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update this to incorporate the parent feature as well as other recent developments. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: Don't allow U_BOOT_DEVICE() when of-platdata is usedSimon Glass2020-10-293-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With of-platdata, the devicetree is supposed to specify all the devices in the system. So far this hasn't really mattered since of-platdata still works correctly. However, new of-platdata features rely on numbering the devices in a particular order so that they can be referenced by a single integer. It is tricky to implement this efficiently when other devices are present in the build. To address this, disable use of U_BOOT_DEVICE() when of-platdata is enabled. This seems acceptable as it is not supposed to be used at all, except in SPL/TPL, where of-platdata is the recommended approach. This breaks one non-compliant boards at present: mx6cuboxi Signed-off-by: Simon Glass <sjg@chromium.org> (disable CONFIG_IMX_THERMAL for mx6cuboxi to avoid a build error)
| * | | | imx: mx6cuboxi: Disable thermal driver in SPLSimon Glass2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature is incompatble with of-platdata since it uses the U_BOOT_DEVICE() macro. With of-platdata the only devices permitted are those created by dtoc. The driver is not used in SPL anyway, so exclude it from that build. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Fabio Estevam <festevam@gmail.com>
| * | | | dm: Use driver_info index instead of pointerSimon Glass2020-10-2910-58/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present we use a 'node' pointer in the of-platadata phandle_n_arg structs. This is a pointer to the struct driver_info for a particular device, and we can use it to obtain the struct udevice pointer itself. Since we don't know the struct udevice pointer until it is allocated in memory, we have to fix up the phandle_n_arg.node at runtime. This is annoying since it requires that SPL's data is writable and adds a small amount of extra (generated) code in the dm_populate_phandle_data() function. Now that we can find a driver_info by its index, it is easier to put the index in the phandle_n_arg structures. Update dtoc to do this, add a new device_get_by_driver_info_idx() to look up a device by drive_info index and update the tests to match. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | x86: apl: Take advantage of the of-platdata parent supportSimon Glass2020-10-292-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that parent devices are supported with of-platadata, we don't need the messy code to fix up the parent pointers and allocations on Apollo Lake. Put the code behind a condition. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | x86: apl: Enable SPI flash in TPL with APL_SPI_FLASH_BOOTSimon Glass2020-10-292-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present, enabling CONFIG_APL_SPI_FLASH_BOOT does not build since SPI and SPI flash are not enabled for TPL. Add a condition to fix this and tidy up a build warning in the SPI-flash driver. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: core: Convert #ifdef to if() in root.cSimon Glass2020-10-291-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert a few conditions to use compile-time checks to reduce the number of build paths. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: Add a test for of-platdata parent informationSimon Glass2020-10-296-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a simple test that we can obtain the correct parent for an I2C device. This requires updating the driver names to match the compatible strings, adding them to the devicetree and enabling a few options. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: Support parent devices with of-platdataSimon Glass2020-10-295-3/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present of-platdata does not provide parent information. But this is useful for I2C devices, for example, since it allows them to determine which bus they are on. Add support for setting the parent correctly, by storing the parent driver_info index in dtoc and reading this in lists_bind_drivers(). This needs multiple passes since we must process children after their parents already have been bound. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | sandbox: Fix up building for of-platdataSimon Glass2020-10-293-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no devicetree with of-platdata. Update a few uclasses to allow them to be built for sandbox_spl. Also drop the i2c-gpio from SPL to avoid build errors, since it does not support of-platdata. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: Use an allocated array for run-time device infoSimon Glass2020-10-297-22/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present we update the driver_info struct with a pointer to the device that it created (i.e. caused to be bound). This works fine when U-Boot SPL is stored in read-write memory. But on some platforms, such as Intel Apollo Lake, it is not possible to update the data memory. In any case, it is bad form to put this information in a structure that is in the data region, since it expands the size of the binary. Create a new driver_rt structure which holds runtime information about drivers. Update the code to store the device pointer in this instead. Also update the test check that this works. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Add a test for of-platdata phandlesSimon Glass2020-10-295-4/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a test in dtoc for this feature, but not one in U-Boot itself. Add a simple test that checks that the information comes through correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Add a check that all devices have a dev valueSimon Glass2020-10-292-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With of-platdata, the driver_info struct is updated with the device pointer when it is bound. This makes it easy for a device to be found by its driver info with the device_get_by_driver_info() function. Add a test that all devices (except the root device) have such an entry. Fix a bug that the function does not set *devp to NULL on failure, which the documentation asserts. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: Add a C test for of-platdata propertiesSimon Glass2020-10-291-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present properties are tested in a roundabout way. The driver's probe() method writes out the values of the properties and the Python test checks the output from U-Boot SPL. Add a C test which checks these values more directly. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | Azure/GitLab/Travis: Add SPL unit testsSimon Glass2020-10-293-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Run SPL unit tests in all test environments. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Drop of-platdata pytestSimon Glass2020-10-295-104/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have a C version of this test, drop the Python implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | test: Run only the selected SPL testSimon Glass2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the new -k option to select the test to run. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | sandbox: Allow selection of SPL unit testsSimon Glass2020-10-293-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have more than one test, add a way to select the test to run. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | test: Run SPL unit testsSimon Glass2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the 'run' script to include SPL unit tests. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | pytest: Collect SPL unit testsSimon Glass2020-10-292-5/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new test_spl fixture to handle running SPL unit tests. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | Makefile: Generate a symbol file for u-boot-splSimon Glass2020-10-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a rule to generate u-boot-spl.sym so that pytest can discover the available unit tests. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Add a very simple of-platadata testSimon Glass2020-10-292-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present we have a pytest that covers of-platadata. Add a very simple unit test that just checks that a device can be found. This shows the ability to write these tests in C. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Add a way to run SPL testsSimon Glass2020-10-295-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a -u flag for U-Boot SPL which requests that unit tests be run. To make this work, export dm_test_main() and update it to skip test features that are not used with of-platdata. To run the tests: $ spl/u-boot-spl -u U-Boot SPL 2020.10-rc5 (Oct 01 2020 - 07:35:39 -0600) Running 0 driver model tests Failures: 0 At present there are no SPL unit tests. Note that there is one wrinkle with these tests. SPL has limited memory available for allocation. Also malloc_simple does not free memory (free() is a nop) and running tests repeatedly causes driver-model to reinit multiple times and allocate memory. Therefore it is not possible to run more than a few tests at a time. One solution is to increase the amount of malloc space in sandbox_spl. This is not a problem for pytest, since it runs each test individually, so for now this is left as is. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Update the test runner to support of-platdataSimon Glass2020-10-291-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present DM tests assume that a devicetree is available. This is not the case with of-platadata. Update the code to add this condition. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Build tests for SPLSimon Glass2020-10-293-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to run unit tests in SPL. Add a new Kconfig to control this and enable it for sandbox_spl Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: core: fix typo in device.hDario Binacchi2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace 'a the' with 'the' in include/dm/device.h. Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
| * | | | sandbox: make SDL window resizableHeinrich Schuchardt2020-10-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without resizing the SDL window showed by ./u-boot -D -l is not legible on a high resolution screen. Allow resizing the window Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
| * | | | dtoc: Fix widening of int to bytesSimon Glass2020-10-295-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present an integer is converted to bytes incorrectly. The whole 32-bit integer is inserted as the first element of the byte array, and the other three bytes are skipped. This was not noticed because the unit test did not check it, and the functional test was checking for wrong values. Update the code to handle this as a special case. Add one more test to cover all code paths. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: core: Allow dm_warn() to be used in SPLSimon Glass2020-10-294-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this option is disabled in SPL, meaning that warnings are not displayed. It is sometimes useful to see warnings in SPL for debugging purposes. Add a new Kconfig option to permit this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dtoc: Order the structures internally by nameSimon Glass2020-10-292-43/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present the structures are written in name order, but parents have to be written before their children, so the file does not end up being in order. The order of nodes in _valid_nodes matches the order of the devicetree. Update the code so that _valid_nodes is in sorted order, by C name of the structure. This allows us to assign a sequential ordering to each U_BOOT_DEVICE() declaration. U-Boot's linker lists are also ordered alphabetically, which means that the order in the driver_info list will match the order used by dtoc. This defines an index ('idx') for the U_BOOT_DEVICE declarations. They appear in alphabetical order, numbered from 0 in _valid_nodes and in the driver_info linker list. Add a comment against each declaration, showing the idx value. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dtoc: Document the return value of scan_structs()Simon Glass2020-10-291-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add documentation to this function as well as generate_structs(), where the return value is ultimately passed in. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | sandbox: Drop ad-hoc device declarations in SPLSimon Glass2020-10-293-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since sandbox's SPL is build with of-platadata, we should not use U_BOOT_DEVICE() declarations as well. Drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Disable some tests that should not run in SPLSimon Glass2020-10-292-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tests are easier to run in U-Boot proper. Running them in SPL does not add test coverage in most cases. Also some tests use features that are not available in SPL. Update the build rules to disable these tests in SPL. We still need test-main to be able to actually run SPL tests. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | | dm: test: Make use of CONFIG_UNIT_TESTSimon Glass2020-10-292-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present we always include test/dm from the main Makefile. We have a CONFIG_UNIT_TEST that should control whether the test/ directory is built, so rely on that instead. Signed-off-by: Simon Glass <sjg@chromium.org>