netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Eliezer Tamir" <eliezert@broadcom.com>
To: "David Miller" <davem@davemloft.net>
Cc: "Michael Chan" <mchan@broadcom.com>,
	jeff@garzik.org, netdev@vger.kernel.org, masbock@us.ibm.com,
	"eilong" <eilong@broadcom.com>
Subject: Re: [RFC][BNX2X] .h files rewrite
Date: Wed, 31 Oct 2007 12:14:47 +0200	[thread overview]
Message-ID: <1193825688.4836.134.camel@eliezer> (raw)
In-Reply-To: <20071029.013931.203090879.davem@davemloft.net>

(Sorry It took so long to answer, I've had to go over a lot of stuff to
make sure I'm giving you accurate answers.)

On Mon, 2007-10-29 at 01:39 -0700, David Miller wrote:
> From: "Eliezer Tamir" <eliezert@broadcom.com>
> Date: Sun, 28 Oct 2007 22:21:14 +0200
> 
> Overall things look significantly better, thanks a lot!
> 
> However, there is still one set of magic constants in here
> which I hope you can clear up:
> 
> > +static const struct raw_op init_ops[] = {
> > +#define PRS_COMMON_START        0
> > +     {OP_WR, PRS_REG_INC_VALUE, 0xf},
> > +     {OP_WR, PRS_REG_EVENT_ID_1, 0x45},
> > +     {OP_WR, PRS_REG_EVENT_ID_2, 0x84},
> > +     {OP_WR, PRS_REG_EVENT_ID_3, 0x6},
> > +     {OP_WR, PRS_REG_NO_MATCH_EVENT_ID, 0x4},
> > +     {OP_WR, PRS_REG_CM_HDR_TYPE_0, 0x0},
> > +     {OP_WR, PRS_REG_CM_HDR_TYPE_1, 0x12170000},
> > +     {OP_WR, PRS_REG_CM_HDR_TYPE_2, 0x22170000},
> > +     {OP_WR, PRS_REG_CM_HDR_TYPE_3, 0x32170000},
> > +     {OP_ZR, PRS_REG_CM_HDR_TYPE_4, 0x5},
> > +     {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_1, 0x12150000},
> > +     {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_2, 0x22150000},
> > +     {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_3, 0x32150000},
> > +     {OP_ZR, PRS_REG_CM_HDR_LOOPBACK_TYPE_4, 0x4},
>  etc. etc.

These are the steps performed to initialize the chip and load the
microcode.

Each element in the array is an operation in the form:
{operation, chip address, value}

Where the operation is one of:
OP_WR - write a value to the chip.
OP_RD - read a register (this is a read with a side effect, usually a
clear on read register).
OP_SW - string write to the chip (parts of the microcode).
OP_SI - string write using indirect write registers.
OP_ZR - clear a range of memory.
OP_ZP - unzip and copy using DMAE.
OP_WB - string copy using DMAE.

(I will add these explanations to bnx2x_init.h)

As you can see there are quite a lot of them, that is because most of
them are setting up the microcode internal structures.
Maybe it would have been better if the microcode were to do these things
but because of size issues it currently is not an option.

We will add comments to all register definitions explaining as much as
possible about each register.

All of the registers that are related to the driver flow are accessed
explicitly inside the driver code in the main .c file.

Writes to memories are simply parts of the microcode.

However, almost all of the registers written to here, are numeric values
not bit constants. The values are derived from HW definitions (and that
was the source of the extra-ugly generated code that we replaced).

In a perfect world almost all of these would have been the reset values
of the registers. 
#include "bitching_about_HW_guys.h"

The added documentation for each register in the register file will
provide all the info that I have about the values.
I feel bad about adding several hundred lines of defines that are only
used once, and do not add any real information about the values.

Your insights would be appreciated.

Thanks,
Eliezer




  reply	other threads:[~2007-10-31 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-28 20:17 [RFC][BNX2X] .h files rewrite Eliezer Tamir
     [not found] ` <1193602875.4836.28.camel@eliezer>
2007-10-29  8:39   ` David Miller
2007-10-31 10:14     ` Eliezer Tamir [this message]
2007-10-31 10:53       ` David Miller
2007-11-02 23:35 ` Max Asbock
2007-11-04  7:47   ` Eliezer Tamir
2007-11-12 23:13     ` Ram Pai
2007-11-12 23:13       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1193825688.4836.134.camel@eliezer \
    --to=eliezert@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=jeff@garzik.org \
    --cc=masbock@us.ibm.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).