EPIC Vs OpenPIC (RFC)
Somehow I feel that Patching or changing the openPIC code would make it shabby.
Why should we change open_pic code,
just because that EPIC is non-conforming ? The best is to rewrite open_pic code for EPIC. ( ofcourse, we can reuse code. )
I dont find anything wrong with open_pic
interface. If people dont follow standards, we dont make standards comply with them. We make them comply with standards.
Sarnath
Quoted 55 lines · On Sat, 03 Nov 2001 Dag Nygren wrote :
Quoted 5 lines
Mark A. Greer wrote:
This is along the lines that I was thinking except
add a struct member to specify
Quoted 1 line
whether edge or level sensitive--i.e., separate
members for hi/lo and edge/level
Actually this evolved after I posted it :-), after I started
to modifyopen_pic.cQuoted 1 line
What exactly is the "IrqEnable" for? Is this so you
can set up the IRQ but not
Quoted 1 line
enable it? Then the driver can enable it later and
its set up correctly (e.g.,
Quoted 1 line
I2C)??
Not really, it was more or less a mistake in the first draft. Would there be a
need
for that ?Quoted 1 line
Doesn't the new struct eliminate the need for
"RegOffset"?
Have to think about that when implementing the stuff.
Quoted 2 lines
And as you noted,
"programmer_switch_irq" probably isn't needed either.Right?
Yep, and I also came up with another scheme for the cascading as the
special handling for chrp is actually.....drum roll.... a cascade!
And it would remove the i8259 refs from the openpic stuff.Quoted 1 line
If you're up to it, how about implementing, testing,
then posting a patch for
Quoted 1 line
everyone to check out??
I'm trying, but I am a bit scared of destroying too much of the
open_pic
code...Here is the newest suggestion for that interface:
typedef enum irq_polarity_en { OP_IRQ_POS = 1, OP_IRQ_NEG = 0 } irq_polarity_type;
Quoted 6 lines
typedef enum
irq_sense_en{
OP_IRQ_LEVEL= 1,
OP_IRQ_EDGE= 0
}irq_sense_type;typedef struct op
PICIrq;
Quoted 18 lines
u_int Vector; u_char Priority; irq_sense_type IrqSense; irq_polarity_type IrqPolarity; irq_polarity_type IrqPolarity; int (*CascadeHandler)();}
openpic_irq_def;typedef struct openpic_def_str { struct OpenPIC *OpenPIC_Addr; int main_pic; u_char RegOffset; /* 0 for "standard", 16for MPC107 */
intprogrammer_switch_irq;
openpic_irq_def*IRQdef; /* The lovest vector
first in the table !!! */
}openpic_def;
Quoted 7 lines
Comments?
Dag
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 12 lines
Somehow I feel that Patching or changing the openPIC code would make it shabby.
Why should we changeopen_piccode,
just because that EPIC is non-conforming ? The best is to rewriteopen_piccode for EPIC. ( ofcourse, we can reuse code. )
I dont find anything wrong withopen_pic
interface. If people dont follow standards, we dont make standards comply with them. We make them comply with standards.
I dont agree,
we would end up duplicating 90% of the open_pic code, and this is also an excellent opportunity to move out the cascade-handling from the open_pic stuff.
Just stay tuned, I already did the rewriting of the open_pic.c, just need to get to work on Monday, testing the result.
I will then submit this as a suggestion.
It actually looks more clean that the original code, at last to my eyes ;-)
And it really makes for an even more simple xxx_setup.c for the different ports.
At the same time I would like to suggest an inclusion of the registration of the i8259 interrupts to i8259_init(). At the momenty everyone of the drivers are doing exactly the same thing:
for ( vec = 0 ; vec < NUM_8259_INTERRUPTS ; vec++ )
irq_desc[vec].handler = &i8259_pic;
Moving this to i8259_init() and giving the routine a parameter startvec (even if everyone is starting from 0 at the moment) would get rid of even more code from the machine-specific stuff.
BRGDS
Dag
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/