[SeaBIOS] [PATCH 2/2] accept MADT over fw_cfg

Kevin O'Connor kevin at koconnor.net
Wed Apr 24 02:54:17 CEST 2013


On Tue, Apr 23, 2013 at 06:22:12PM +0300, Michael S. Tsirkin wrote:
> So here's the version with shift, that should do it
> correctly. Add mere 8 lines of code.
> I'll look into alignment and fseg now.
[...]
> --- /dev/null
> +++ b/src/linker.h
> @@ -0,0 +1,29 @@
> +#include "types.h" // u8
> +#include "util.h" // romfile_s
> +
> +/* ROM file linker interface. Linker uses little endian format */
> +struct linker_entry_s {
> +    u8 size; /* size in bytes including the header */
> +    u8 bytes; /* How many bytes to change. Can be 1,2,4 or 8. */
> +    u8 shift; /* Shift source address right by this many bits. 0-63. */
> +    u8 type;
> +    u8 format;
> +    u8 reserved1;
> +    u16 reserved2;
> +    u64 dst_offset; /* Offset in destination. Little endian format. */
> +    /* Followed by source and destination, optionally padded by
> +     * 0, up to the total of entry_len - 4 bytes.
> +     * Strings are 0-terminated. */
> +    char src_dst[];
> +} PACKED;

As in my previous email, I think the main emphasis should be on
getting the content into QEMU, so I don't want to nitpick on the
details of the seabios side.  However, if I understand your proposal,
an RSDT with 10 table entries would require 50 "linker" entries (10 to
add the pointers and 40 to update the checksum) - that seems
excessive.  If the goal is to do a checksum - might as well just
define a checksum action.  Also, the variable length filenames aren't
needed - the QemuCfgFile interface already limits the filename to a
max of 56 bytes.

If you really feel QEMU should direct the pointer and checksum
updates, you might want to consider something like:

struct tabledeploy_s {
    u32 command;
    union {
        // COMMAND_ALLOC - allocate a table from the given "file"
        struct {
            char alloc_file[FILESZ];
            u32 alloc_align;
            u8 alloc_zone;
        };

        // COMMAND_PATCH - patch the table (originating from
        // "dest_file") to a pointer to the table originating from
        // "src_file".
        struct {
            char patch_dest_file[FILESZ];
            char patch_src_file[FILESZ];
            u32 patch_offset;
            u8 patch_size;
        };

        // COMMAND_CHECKSUM - Update a checksum in a table
        struct {
            char cksum_file[FILESZ];
            u32 cksum_offset;
            u32 cksum_start;
            u32 cksum_length;
        };

        // PAD
        char pad[124];
    };
} PACKED;

-Kevin



More information about the SeaBIOS mailing list