Hi Aarya,

Yes, that is the plan. There is an open patch[1] in Gerrit to add
deserialization functions for endian specific encoding. 
Parsing data to a struct can then look like this:
        
        struct data {
                uint16_t a;
                uint32_t b;
        };

        void* buffer;
        struct data my_data;

        my_data.a = read_le16(bufer);
        my_data.b = read_le32(buffer + 2);

The endian independent layout parsing is the main component for this
project. But we are glad of every closed issue.
For the fmap parsing I've stated an attempt last year but got deviated
by other tasks. The code is far from working, but you may want to have
a look. The first version on Gerrit [2] and a copy of my private
working tree [3].

Most data flashrom reads are just passed to the user. The user should
know how to handle it. This is not the job of flashrom. Only when
flashrom itself needs to interpret some data, like layout information
of the chip, we need to care about it.

[1] https://review.coreboot.org/c/flashrom/+/31016/12
[2] https://review.coreboot.org/c/flashrom/+/57265/4
[3] https://gist.github.com/heijligen/8828cec759f552549b201bdf35976f39

-- Thomas

On Sat, 2022-03-19 at 19:08 +0530, Aarya Chaumal wrote:
> Hi Thomas,
> 
> Thank you for your quick reply on the "fixing endianness issues"
> project. I saw that in the code that functions
> flashrom_layout_read_from_* only work for little-endian machines and
> return an error code otherwise. Also, the function
> flashrom_layout_parse_fmap is defined for little-endian machines. So
> maybe we can have a function to convert the data into the endianness
> of the machine before parsing/reading it. Macros are defined for up
> to 64bit endianness conversion in hwaccess.h but they are not used
> anywhere. Doing this much should make the code run on both types of
> machines. This logic might also work in other parts of the code which
> are endian specific (currently not sure which parts are these)
> 
> Furthermore, I think we should give the user the specify in which
> endian he wants to write/read the data.
> 
> Aarya.
> 
> On Fri, Mar 18, 2022 at 2:54 AM Thomas Heijligen <s...@posteo.de>
> wrote:
> > Hi Aarya,
> > 
> > Thank you for contributing to flashrom. The merge of a patch
> > sometimes
> > needs just time, even if it has +2.
> > 
> > The topic "fixing endianness issues" consists of tasks to rewrite
> > code
> > that assumes a specific endianness. For example, the flashrom fmap
> > parser just maps packed c structs onto the memory. This works only
> > when
> > flashrom runs on a CPU with the same endian as fmap defines. We
> > have
> > two macros, __FLASHROM_LITTLE_ENDIAN__ and __FLASHROM_BIG_ENDIAN__
> > which handle code that works only on one endian. In the GSoC
> > project,
> > we want to make this code run on little and big endian systems.
> > Besides
> > that, we may find additional parts in the code which are endian
> > specific.
> > 
> > -- Thomas
> > 
> > On Sun, 2022-03-13 at 08:13 +0530, Aarya Chaumal wrote:
> > > As suggested, I have been doing some of the easy projects till
> > > now
> > > and
> > > I have enjoyed it. I have submitted a few patches till now and
> > > some
> > > of
> > > them have gotten +2 code-reviews but still, they were not merged.
> > > Is
> > > there anything that is required to get the changes to be merged?
> > > Also, I have fixed most of the issues I got by running scan-
> > > build,
> > > only 2 classes of issues were remaining which I feel are false
> > > positives (showing underflow error but those cases won't occur or
> > > are
> > > handled seprately) created by the tool and can be ignored.
> > > As was going through your proposed projects for GSoC, I found
> > > "optimizing erase-function" and "fixing endianness issues"
> > > interesting and would like to do that in the summer. Can you
> > > suggest
> > > some tasks so that I can know more about these projects and get
> > > an
> > > idea of how to write my proposal for GSoC for doing this project?
> > > Thanks :)
> > > 
> > > On Thu, Mar 10, 2022 at 10:45 AM Anastasia Klimchuk
> > > <a...@chromium.org> wrote:
> > > > 
> > > > Hello Aarya,
> > > > 
> > > > Nice to meet you! I think I saw your question on the IRC
> > > > channel,
> > > > and someone replied, was that your question?
> > > > Do you still need more info? Let us know if yes.
> > > > 
> > > > Thanks!
> > > > 
> > > > On Wed, Mar 9, 2022 at 2:42 PM Aarya Chaumal
> > > > <aarya.chau...@gmail.com> wrote:
> > > > > 
> > > > > Hello there,
> > > > > 
> > > > > I hope you are well today when you receive this email. I am
> > > > > Aarya
> > > > > Chaumal, a Computer Engineering student at the College of
> > > > > Engineering Pune, India. While going through organizations
> > > > > for
> > > > > this year's Google's Summer of Code I came across your
> > > > > organization, Flashrom.
> > > > > 
> > > > > I am a  part of onboard computers subsystem at my college's
> > > > > satellite initiative. Through this, I have closely worked on
> > > > > Atmel SAM E70 XPLAINED board. Also, I have strong knowledge
> > > > > about
> > > > > C/C++ and assembly language. From your list of GSoC project
> > > > > ideas, I liked the idea of “Remove global state from
> > > > > flashrom”
> > > > > and "Optimize Erase-Function Selection", although I am not
> > > > > quite
> > > > > sure which one is more suitable for me. Can you guide me
> > > > > through
> > > > > this?
> > > > > 
> > > > > As mentioned in your Contributor commitments and
> > > > > requirements, I
> > > > > started to do one of the easy projects - Add new flash chip
> > > > > definitions. For this, I read the relevant datasheets, one
> > > > > from
> > > > > the unlisted chips and another of a listed one (for
> > > > > reference)
> > > > > but still, I am not getting the information about some fields
> > > > > for
> > > > > the structure in the datasheet, namely the feature_bits,
> > > > > probe_timing. Also, do I have to write the probe, read, write
> > > > > and
> > > > > erase functions for the chip separately? Also, how do I test
> > > > > if
> > > > > my code is working as I don't have relevant hardware with me?
> > > > > Can
> > > > > you help me with this? Also what resources should I use to
> > > > > learn
> > > > > more about it?
> > > > > 
> > > > > Thank you for looking into this for me.
> > > > > Sincerely,
> > > > > Aarya Chaumal
> > > > > _______________________________________________
> > > > > flashrom mailing list -- flashrom@flashrom.org
> > > > > To unsubscribe send an email to flashrom-le...@flashrom.org
> > > > 
> > > > 
> > > > 
> > > > --
> > > > Anastasia.
> > > _______________________________________________
> > > flashrom mailing list -- flashrom@flashrom.org
> > > To unsubscribe send an email to flashrom-le...@flashrom.org
> > 

_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org

Reply via email to