From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NjJV9-0007SD-JB for qemu-devel@nongnu.org; Sun, 21 Feb 2010 16:38:07 -0500 Received: from [199.232.76.173] (port=48124 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NjJV9-0007Rz-8S for qemu-devel@nongnu.org; Sun, 21 Feb 2010 16:38:07 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NjJV7-000347-Iz for qemu-devel@nongnu.org; Sun, 21 Feb 2010 16:38:07 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:51554) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NjJV7-00033u-1U for qemu-devel@nongnu.org; Sun, 21 Feb 2010 16:38:05 -0500 Message-ID: <4B81A7BA.8070106@mail.berlios.de> Date: Sun, 21 Feb 2010 22:38:02 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1266164189-21062-2-git-send-email-weil@mail.berlios.de> <1266164189-21062-3-git-send-email-weil@mail.berlios.de> <1266164189-21062-4-git-send-email-weil@mail.berlios.de> <1266164189-21062-5-git-send-email-weil@mail.berlios.de> <1266164189-21062-6-git-send-email-weil@mail.berlios.de> <1266164189-21062-7-git-send-email-weil@mail.berlios.de> <1266164189-21062-8-git-send-email-weil@mail.berlios.de> <1266164189-21062-9-git-send-email-weil@mail.berlios.de> <1266164189-21062-10-git-send-email-weil@mail.berlios.de> <1266164189-21062-11-git-send-email-weil@mail.berlios.de> <20100221170519.GB5185@redhat.com> In-Reply-To: <20100221170519.GB5185@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 11/20] eepro100: Use symbolic names for bits in EEPROM id List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: QEMU Developers Michael S. Tsirkin schrieb: > On Sun, Feb 14, 2010 at 05:16:20PM +0100, Stefan Weil wrote: >> Signed-off-by: Stefan Weil >> --- >> hw/eepro100.c | 17 ++++++++++++++++- >> 1 files changed, 16 insertions(+), 1 deletions(-) >> >> diff --git a/hw/eepro100.c b/hw/eepro100.c >> index c647322..01bcd6d 100644 >> --- a/hw/eepro100.c >> +++ b/hw/eepro100.c >> @@ -272,6 +272,21 @@ typedef enum { >> eeprom_smbus_addr = 0x90, >> } EEPROMOffset; >> >> +/* Bit values for EEPROM ID word. */ >> +typedef enum { >> + eeprom_id_mdm = BIT(0), /* Modem */ >> + eeprom_id_stb = BIT(1), /* Standby Enable */ >> + eeprom_id_wmr = BIT(2), /* ??? */ >> + eeprom_id_wol = BIT(5), /* Wake on LAN */ >> + eeprom_id_dpd = BIT(6), /* Deep Power Down */ >> + eeprom_id_alt = BIT(7), /* */ >> + /* BITS(10, 8) device revision */ >> + eeprom_id_bd = BIT(11), /* boot disable */ >> + eeprom_id_id = BIT(13), /* id bit */ >> + /* BITS(15, 14) signature */ >> + eeprom_id_valid = BIT(14), /* signature for valid eeprom */ >> +} eeprom_id_bit; > > The type name is unused - don't add it? Maybe it will be used some day? Adding a type name now makes the code more uniform and avoids two deltas when it is used. There are a lot of symbolic names which are unused today, for example most of above enum values. This is common practice. > Can constants be upper case? Of course they can. Is this a QEMU coding convention? I did not see a hint in CODING_STYLE. If it is the coding style: UPPER_CASE or CamelCase? Will it be required for all future modifications of QEMU code? > > >> + >> /* Default values for MDI (PHY) registers */ >> static const uint16_t eepro100_mdi_default[] = { >> /* MDI Registers 0 - 6, 7 */ >> @@ -643,7 +658,7 @@ static void nic_selective_reset(EEPRO100State * s) >> uint16_t *eeprom_contents = eeprom93xx_data(s->eeprom); >> //~ eeprom93xx_reset(s->eeprom); >> memcpy(eeprom_contents, s->conf.macaddr.a, 6); >> - eeprom_contents[eeprom_id] = 0x4000; >> + eeprom_contents[eeprom_id] = eeprom_id_valid; >> if (s->device == i82557B || s->device == i82557C) >> eeprom_contents[5] = 0x0100; >> eeprom_contents[eeprom_phy_id] = 1; >> -- >> 1.6.6.1 >> >>