e1000: Introduced an array to control the access to the MAC registers
commitbc0f0674f037a01f2ce0870ad6270a356a7a8347
authorLeonid Bloch <leonid.bloch@ravellosystems.com>
Wed, 11 Nov 2015 13:52:41 +0000 (11 15:52 +0200)
committerJason Wang <jasowang@redhat.com>
Thu, 12 Nov 2015 07:26:52 +0000 (12 15:26 +0800)
treeddb4bec1181cb5c018ff30963692d7065e2af0fe
parent9e11773417d98fd2ec961568ec2875063b95569b
e1000: Introduced an array to control the access to the MAC registers

The array of uint8_t's which is introduced here, contains access metadata
about the MAC registers: if a register is accessible, but partly implemented,
or if a register requires a certain compatibility flag in order to be
accessed. Currently, 6 hypothetical flags are supported (3 exist for e1000
so far) but in the future, if more than 6 flags will be needed, the datatype
of this array can simply be swapped for a larger one.

This patch is intended to solve the following current problems:

1) In a scenario of migration between different versions of QEMU, which
differ by the MAC registers implemented in them, some registers need not to
be active if a compatibility flag is set, in order to preserve the machine's
state perfectly for the older version. Checking this for each register
individually, would create a lot of clutter in the code.

2) Some registers are (or may be) only partly implemented (e.g.
placeholders that allow reading and writing, but lack other functions).
In such cases it is better to print a debug warning on read/write attempts.
As above, dealing with this functionality on a per-register level, would
require longer and more messy code.

Signed-off-by: Leonid Bloch <leonid.bloch@ravellosystems.com>
Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/e1000.c