Skip to contentSkip to conversation

EV-64260-BP & GT64260 bi_recs

DISCUSSION Michael Sokolov 9 participants 30 messages Mar 19, 2002 – Mar 27, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Mark A. Greer

I like what Michael has done but want to add more and change the BI_GT64260_ETH_CFG to a more generic BI_ETH_CFG.

I disagree. I don't see how a generic BI_ETH_CFG is possible. See how I've implemented BI_GT64260_ETH_CFG in arch/ppc/kernel/setup.c:parse_bootinfo: it injects the information from this record directly into the gt64260_eth driver, which is where this information is needed.

Next when someone wants to do the same for, say, 8260 Ethernet, they'll have to add BI_8260_ETH_CFG or whatever. I don't see any other way: what if I built a board with an 8260 CPU and a GT-64260 attached to the 60x bus coming out of the 8260 (such a board was in the works at SBS before I left) and both 8260 and GT Ethernets are used? What will parse_bootinfo() do with a BI_ETH_CFG then? Is it going to inject the MAC address into the 8260 Ethernet driver, into the GT Ethernet driver, or where? How do you make sure that each Ethernet interface gets the MAC address that belongs to it?

MS

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 9 lines · Michael Sokolov
Quoted 2 lines · Mark A. Greer

I like what Michael has done but want to add more and change the BI_GT64260_ETH_CFG to a more generic BI_ETH_CFG.

I disagree. I don't see how a generic BI_ETH_CFG is possible. See how I've implemented BI_GT64260_ETH_CFG in arch/ppc/kernel/setup.c:parse_bootinfo: it injects the information from this record directly into the gt64260_eth driver, which is where this information is needed.

My point is that "you way" would change to a more generic way for all enet driver.

The BI_ETH_CFG has already been shot down so we don't need to worry about it anyway.

Quoted 8 lines

Next when someone wants to do the same for, say, 8260 Ethernet, they'll have to add BI_8260_ETH_CFG or whatever. I don't see any other way: what if I built a board with an 8260 CPU and a GT-64260 attached to the 60x bus coming out of the 8260 (such a board was in the works at SBS before I left) and both 8260 and GT Ethernets are used? What will parse_bootinfo() do with a BI_ETH_CFG then? Is it going to inject the MAC address into the 8260 Ethernet driver, into the GT Ethernet driver, or where? How do you make sure that each Ethernet interface gets the MAC address that belongs to it?

This is a good point and this is an issue with any generic ethernet bi_rec scheme. At this point, I'm back to preferring what you've done since...well...its done and I don't see anyone else caring much about this for other drivers.

Mark

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 4 lines · In message <[email protected]> you wrote:

The BI_ETH_CFG has already been shot down so we don't need to worry about it anyway.

Has been shot down? When? Where? Why? Am I missing something?

So how are we going to solve this issue - in 2.4 and 2.5?

We need to deal with boards with more than one ethernet interface, which are already active in the firmware (net-booting from redundand interfaces, using separate MAC addresses).

Quoted 2 lines
Quoted 2 lines

Ethernet driver, or where? How do you make sure that each Ethernet interface gets the MAC address that belongs to it?

We added an index field to BI_ETH_CFG, didn't we? The driver would then "know" how to map this...

Quoted 3 lines

This is a good point and this is an issue with any generic ethernet bi_rec scheme. At this point, I'm back to preferring what you've done since...well...its done and I don't see anyone else caring much about this for other drivers.

We _do_ care, a little for 8xx, very much for 8260, also for 824x and 4xx.

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it.
- Perlis's Programming Proverb #58, SIGPLAN Notices, Sept. 1982

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
In reply to Michael Sokolov
Quoted 5 lines

I disagree. I don't see how a generic BI_ETH_CFG is possible. See how I've implemented BI_GT64260_ETH_CFG in arch/ppc/kernel/setup.c:parse_bootinfo: it injects the information from this record directly into the gt64260_eth

driver,

Quoted 1 line

which is where this information is needed.

This is the wrong approach. What we should do instead is have the gt eth driver
do some kind of find_bi_rec(BI_GT64260_ETH_CFG). setup.c doesn't have to be changed each time a new birec is added, and your approach seem wrong if that driver ever becomes a module.

What I have not yet decided regarding what to do of birec's in 2.5. That is either providing some structure to them so they represent devices with all the mapping & routing information needed (flexible enough to accomodate
most embedded needs), that is some kind of lightweight device-tree, or if we just
stay to what we have now (minus bd_t), that is everybody defines it's own set of
bi_recs.

I've started writing a draft of what the first option could be last year, I'll see if I can still find it and post it for you guys to fight over some material ;)

The _important_ point however is that the common arch code and the common CPU code mustn't have to care (or be modified) when a bi_rec is added and then later used by whatever driver you want to pass it to.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
Quoted 5 lines · [email protected] wrote:

This is the wrong approach. What we should do instead is have the gt eth driver
do some kind of find_bi_rec(BI_GT64260_ETH_CFG). setup.c doesn't have to be changed each time a new birec is added, and your approach seem wrong if that driver ever becomes a module.

Then push my patch defining the new bi_recs, and once it's in I'll make another one to implement what you just suggested. But if patches aren't being accepted there is no incentive for me to make or improve them.

MS

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
Quoted 9 lines · Michael Sokolov
Quoted 5 lines · [email protected] wrote:

This is the wrong approach. What we should do instead is have the gt eth driver
do some kind of find_bi_rec(BI_GT64260_ETH_CFG). setup.c doesn't have to be changed each time a new birec is added, and your approach seem wrong if that driver ever becomes a module.

Quoted 3 lines

Then push my patch defining the new bi_recs, and once it's in I'll make another one to implement what you just suggested. But if patches aren't being accepted there is no incentive for me to make or improve them.

Sure there is, for it to be accepted. And would you please make it versus the _galileo tree so that other users of GT-64260 can easily test your changes?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw

Ok, here is my older document, though now that I re-read it, I find it rather too bloated. Food for though...

Ben.

/* Here's a try at defining new birecs a bit more
*
* Of course, most of this is _optional_, OF based machines
* won't use but a few of these, embedded developers may use
* and customize these, we will try to make embedded specific
* driver rely solely on defined bi_recs....
*
* Note. The high 8 bits of the size field contains a type code
* for the bi_rec. The types are defined below. The composite
* type allow embedding of "properties", in that case the birec
* tag is considered as a "name". For records of type meminfo,
* bootinfo, and cpuinfo, the tag identify the information passed.
* All lowercase tags are reserved for future use by the kernel,
* All uppercase or mixed case tags can be freely used by board
* implementors for custom applications.
*/

struct bi_record {
unsigned long tag; /* tag ID */
unsigned long size; /* size of record (in bytes) */
unsigned long data[0]; /* data */
};

#define BI_SIZEMASK 0x00ffffff
#define BI_TYPEMASK 0xff000000

#define BI_TYPE_FIRST 0x01000000
#define BI_TYPE_CPUINFO 0x02000000 /* single values, fixed type */
#define BI_TYPE_BOARDINFO 0x03000000 /* single values, fixed type */
#define BI_TYPE_MEMINFO 0x04000000 /* physical memory layout */
#define BI_TYPE_BOOTINFO 0x05000000 /* boot infos (cmdline, ...) */
#define BI_TYPE_COMPOSITE 0x42000000 /* more birecs after a bi_composite */
#define BI_TYPE_SINGLE_MASK 0x80000000 /* single value (no size, value in
size field */
#define BI_TYPE_END_COMPOSITE 0xfe000000
#define BI_TYPE_LAST 0xff000000

/*
* CPU Info
*/
#define BI_CPU_4xx_CORE_CLOCK 'cclk' /* Core clock of a 4xx (ulong, Hz) */
#define BI_CPU_4xx_PLB_CLOCK 'pclk' /* PLB clock of a 4xx (ulong, Hz) */
#define BI_CPU_4xx_OPB_CLOCK 'oclk' /* OPB clock of a 4xx (ulong, Hz) */
#define BI_CPU_4xx_PCI_CLOCK 'iclk' /* PCI clock of a 4xx (ulong, Hz) */

/*
* Board info
*/
#define BI_BOARD_NAME 'name' /* 0 term string */
#define BI_BOARD_MACHINE_TYPE 'mach' /* Machine type (common config) */
#define BI_BOARD_MACHINE_MODEL 'modl' /* Model within machine type */
#define BI_BOARD_MACHINE_FAMILY 'fami' /* Familly within machine type */

#define BI_BOARD_SERIALNUMBER 'sern' /* Why not ? 0 term string */

	/* To be defined, or specific to a given board */

/*
* Mem info
*/
#define BI_MEM_TOTALMEM 'totm' /* Total memory */
#define BI_MEM_PHYSMAP 'phym' /* Physmap, contiguous @ 0 if absent */
#define BI_MEM_DIMMMAP 'dimm' /* Why not ? ... */

/*
* Boot info
*/
#define BI_BOOT_CMDLINE 'cmdl' /* Command line (0 term string) */

#define BI_BOOT_INITRD		'rimg'		/* Initial ramdisk */
	struct bi_boot_initrd {
		unsigned long	addr;		/* Physical address */
		unsigned long	csize;		/* Compressed size */
		unsigned long	msize;		/* Memory size (max rd driver size) */
	};
	/* Note: we may want to define a format for scattered ramdisks */

#define BI_BOOT_ROOT_DEVICE 'root' /* Major & minor of root device in
2x32 bits ! */

/*
* Composite record format is a suite of bi_recs finishing
* with a BI_TYPE_END_COMPOSITE.
* They have a "name" which is the tag of the composite
* record, and they begin with a "type" long. Then, is
* a suite of bi_recs.
*/
struct bi_composite {
unsigned long type_tag; /* type tag */
unsigned long data[0]; /* more birecs */
};

/* Here are some defined type tags */

#define BI_COMP_DEVGROUP 'dgrp' /* A group of devices (more composite) */
#define BI_COMP_DEVICE 'devi' /* Generic device */
#define BI_COMP_PCI_HOST 'phst' /* PCI host (contains it's devices !) */
#define BI_COMP_PCI_DEVICE 'pdev' /* PCI device */
#define BI_COMP_CPU_DEVICE 'pdev' /* CPU embedded device */
#define BI_COMP_IRQ_NODE 'irqn' /* Interrupt node (controller or bridge) */

/*
* An interrupt node defines interrupt routing.
*/

/* To be written ;) */

/*
* A device has those generic properties defined.
*/

/* An IO resource is an abstract entity to designate a memory
* or IO region used by a device. The exact meaning of those
* fields depends on the atualy type of device (the bus where
* resides). A generic device is meant to be used for your own
* motherboard devices, you can use the values below the way
* you want, each driver defines it's own meaning there.
* It wouldn't be efficient to provide more abstraction imho. */
#define BI_PROP_IO_RESOURCE 'iors'

struct bi_prop_io_resource {
	unsigned long	base_addr;
	unsigned long	size;
	unsigned long	flags;
};

/* An interrupt is designated by a parent node ID and a
* number. The parent node structure will be then define
* routing informations. If the interrupt is wired to the
* CPU's internal interrupt controller directly, it's parent
* node ID is 0, and the number represents an interrupt number
* in the native CPU numbering.
* Additionally, flags are added to the interrupt definition.
* Only 2 bits are currently defined for those, the high 16
* bits are free to be used by the implementor of a given board. */
#define BI_PROP_INTERRUPT 'irq '
struct bi_prop_interrupt {
unsigned long parent; /* tagID of the parent node */
unsigned long number; /* Interrupt number */
unsigned long flags; /* see below */
};
#define BI_IRQ_LEVEL 0x00000000 /* bit 0 = 0 */
#define BI_IRQ_EDGE 0x00000001 /* bit 0 = 1 */
#define BI_IRQ_NEG 0x00000000 /* bit 1 = 0 */
#define BI_IRQ_POS 0x00000002 /* bit 1 = 1 */

/* The device type (or class), mostly for information purpose for now */
#define BI_PROP_DEVICE_CLASS 'clas' /* ulong */

#define  BI_DEV_CLASS_ETHERNET		'eth '
#define  BI_DEV_CLASS_UART		'uart'
#define  BI_DEV_CLASS_SCC		'scc '
	/* etc... */

/* The driver is used to define "standard" type of devices, like
* PC-like uart. Note that devices defined below rely on a specific
* format of the io resources and eventual additional properties */
#define BI_PROP_DEVICE_DRIVER 'drvr' /* ulong */

/* define required properties of legacy serial here */

/*
* Properties relative to PCI hosts
*/

/* define bus numbers, and bases here along with a type
* property indicating the host type, a generic type can
* be used for indirect
*/

/*
* Properties relative to PCI devices. This includes the
* above properties (all of them eventually). The IO resource
* property additionally defines some flags. The actual mapping
* of the host bridge (ISA, etc...) isn't defined here but is
* defined
*/
#define BI_PROP_PCI_DEVFN 'dvfn' /* ulong */
#define BI_PROP_PCI_VENDORID 'vid ' /* Do we need that here ? */
#define BI_PROP_PCI_DEVICEID 'did ' /* Do we need that here ? */

/* Note: I appologize for bit numbering ;) */

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw

Thanks for writing this up, Ben! My main objection is that I really don't see any reason to make bi_recs more complicated than:

record type
size
data

What added functionality does the whole "structure" concept give us? Here's the current bi_rec parsing code:

while (rec->tag != BI_LAST) {
/* fiddle with each individual record */ rec = (struct bi_record *)((ulong)rec + rec->size);
}

The simplicity of this system is valuable - I don't want to give it up unless we get lots and lots of added functionality in return. Dan Malek's comments suggest that bi_recs should only be used for only a small, simple class of information. In this context, I don't see what structures buy us.

I have to admit, bi_rec structures are a really cool idea, but I prefer simplicity over coolness. :)

-VAL

Quoted 187 lines · On Wed, Mar 20, 2002 at 05:58:25PM +0100, [email protected] wrote:

Ok, here is my older document, though now that I re-read it, I find it rather too bloated. Food for though...

Ben.

/* Here's a try at defining new birecs a bit more
*
* Of course, most of this is _optional_, OF based machines
* won't use but a few of these, embedded developers may use
* and customize these, we will try to make embedded specific
* driver rely solely on defined bi_recs....
*
* Note. The high 8 bits of the size field contains a type code
* for the bi_rec. The types are defined below. The composite
* type allow embedding of "properties", in that case the birec
* tag is considered as a "name". For records of type meminfo,
* bootinfo, and cpuinfo, the tag identify the information passed.
* All lowercase tags are reserved for future use by the kernel,
* All uppercase or mixed case tags can be freely used by board
* implementors for custom applications.
*/

struct bi_record {
unsigned long tag; /* tag ID */
unsigned long size; /* size of record (in bytes) */
unsigned long data[0]; /* data */
};

#define BI_SIZEMASK 0x00ffffff
#define BI_TYPEMASK 0xff000000

#define BI_TYPE_FIRST 0x01000000
#define BI_TYPE_CPUINFO 0x02000000 /* single values, fixed type */
#define BI_TYPE_BOARDINFO 0x03000000 /* single values, fixed type */
#define BI_TYPE_MEMINFO 0x04000000 /* physical memory layout */
#define BI_TYPE_BOOTINFO 0x05000000 /* boot infos (cmdline, ...) */
#define BI_TYPE_COMPOSITE 0x42000000 /* more birecs after a bi_composite */
#define BI_TYPE_SINGLE_MASK 0x80000000 /* single value (no size, value in
size field */
#define BI_TYPE_END_COMPOSITE 0xfe000000
#define BI_TYPE_LAST 0xff000000

/*
* CPU Info
*/
#define BI_CPU_4xx_CORE_CLOCK 'cclk' /* Core clock of a 4xx (ulong, Hz) */
#define BI_CPU_4xx_PLB_CLOCK 'pclk' /* PLB clock of a 4xx (ulong, Hz) */
#define BI_CPU_4xx_OPB_CLOCK 'oclk' /* OPB clock of a 4xx (ulong, Hz) */
#define BI_CPU_4xx_PCI_CLOCK 'iclk' /* PCI clock of a 4xx (ulong, Hz) */

/*
* Board info
*/
#define BI_BOARD_NAME 'name' /* 0 term string */
#define BI_BOARD_MACHINE_TYPE 'mach' /* Machine type (common config) */
#define BI_BOARD_MACHINE_MODEL 'modl' /* Model within machine type */
#define BI_BOARD_MACHINE_FAMILY 'fami' /* Familly within machine type */

#define BI_BOARD_SERIALNUMBER 'sern' /* Why not ? 0 term string */

	/* To be defined, or specific to a given board */

/*
* Mem info
*/
#define BI_MEM_TOTALMEM 'totm' /* Total memory */
#define BI_MEM_PHYSMAP 'phym' /* Physmap, contiguous @ 0 if absent */
#define BI_MEM_DIMMMAP 'dimm' /* Why not ? ... */

/*
* Boot info
*/
#define BI_BOOT_CMDLINE 'cmdl' /* Command line (0 term string) */

#define BI_BOOT_INITRD		'rimg'		/* Initial ramdisk */
	struct bi_boot_initrd {
		unsigned long	addr;		/* Physical address */
		unsigned long	csize;		/* Compressed size */
		unsigned long	msize;		/* Memory size (max rd driver size) */
	};
	/* Note: we may want to define a format for scattered ramdisks */

#define BI_BOOT_ROOT_DEVICE 'root' /* Major & minor of root device in
2x32 bits ! */

/*
* Composite record format is a suite of bi_recs finishing
* with a BI_TYPE_END_COMPOSITE.
* They have a "name" which is the tag of the composite
* record, and they begin with a "type" long. Then, is
* a suite of bi_recs.
*/
struct bi_composite {
unsigned long type_tag; /* type tag */
unsigned long data[0]; /* more birecs */
};

/* Here are some defined type tags */

#define BI_COMP_DEVGROUP 'dgrp' /* A group of devices (more composite) */
#define BI_COMP_DEVICE 'devi' /* Generic device */
#define BI_COMP_PCI_HOST 'phst' /* PCI host (contains it's devices !) */
#define BI_COMP_PCI_DEVICE 'pdev' /* PCI device */
#define BI_COMP_CPU_DEVICE 'pdev' /* CPU embedded device */
#define BI_COMP_IRQ_NODE 'irqn' /* Interrupt node (controller or bridge) */

/*
* An interrupt node defines interrupt routing.
*/

/* To be written ;) */

/*
* A device has those generic properties defined.
*/

/* An IO resource is an abstract entity to designate a memory
* or IO region used by a device. The exact meaning of those
* fields depends on the atualy type of device (the bus where
* resides). A generic device is meant to be used for your own
* motherboard devices, you can use the values below the way
* you want, each driver defines it's own meaning there.
* It wouldn't be efficient to provide more abstraction imho. */
#define BI_PROP_IO_RESOURCE 'iors'

struct bi_prop_io_resource {
	unsigned long	base_addr;
	unsigned long	size;
	unsigned long	flags;
};

/* An interrupt is designated by a parent node ID and a
* number. The parent node structure will be then define
* routing informations. If the interrupt is wired to the
* CPU's internal interrupt controller directly, it's parent
* node ID is 0, and the number represents an interrupt number
* in the native CPU numbering.
* Additionally, flags are added to the interrupt definition.
* Only 2 bits are currently defined for those, the high 16
* bits are free to be used by the implementor of a given board. */
#define BI_PROP_INTERRUPT 'irq '
struct bi_prop_interrupt {
unsigned long parent; /* tagID of the parent node */
unsigned long number; /* Interrupt number */
unsigned long flags; /* see below */
};
#define BI_IRQ_LEVEL 0x00000000 /* bit 0 = 0 */
#define BI_IRQ_EDGE 0x00000001 /* bit 0 = 1 */
#define BI_IRQ_NEG 0x00000000 /* bit 1 = 0 */
#define BI_IRQ_POS 0x00000002 /* bit 1 = 1 */

/* The device type (or class), mostly for information purpose for now */
#define BI_PROP_DEVICE_CLASS 'clas' /* ulong */

#define  BI_DEV_CLASS_ETHERNET		'eth '
#define  BI_DEV_CLASS_UART		'uart'
#define  BI_DEV_CLASS_SCC		'scc '
	/* etc... */

/* The driver is used to define "standard" type of devices, like
* PC-like uart. Note that devices defined below rely on a specific
* format of the io resources and eventual additional properties */
#define BI_PROP_DEVICE_DRIVER 'drvr' /* ulong */

/* define required properties of legacy serial here */

/*
* Properties relative to PCI hosts
*/

/* define bus numbers, and bases here along with a type
* property indicating the host type, a generic type can
* be used for indirect
*/

/*
* Properties relative to PCI devices. This includes the
* above properties (all of them eventually). The IO resource
* property additionally defines some flags. The actual mapping
* of the host bridge (ISA, etc...) isn't defined here but is
* defined
*/
#define BI_PROP_PCI_DEVFN 'dvfn' /* ulong */
#define BI_PROP_PCI_VENDORID 'vid ' /* Do we need that here ? */
#define BI_PROP_PCI_DEVICEID 'did ' /* Do we need that here ? */

Quoted 3 lines

/* Note: I appologize for bit numbering ;) */

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw
Quoted 4 lines · Val Henson

while (rec->tag != BI_LAST) {
/* fiddle with each individual record */ rec = (struct bi_record *)((ulong)rec + rec->size);
}

Won't this code still work with benh's proposal? The "fiddle" part above may delve into the structure, but at the top level the record is still treated exactly like above.

Quoted 2 lines

The simplicity of this system is valuable - I don't want to give it up unless we get lots and lots of added functionality in return.

I agree with this. In fact, we shouldn't give up simplicity for any reason.

Quoted 4 lines

Dan
Malek's comments suggest that bi_recs should only be used for only a small, simple class of information. In this context, I don't see what structures buy us.

That's because he sees no value in having a lot of data passed in from the boot loader. On the other hand, I believe that if the kernel can learn something from the boot loader, it should - rather than duplicate the code that is already in the boot loader, or hard-wire configuration information - and if this ends up being a lot of data and/or with a complicated structure (this isn't automatically the case btw), then so be it. This can be achieved with "simple" bi_recs, if they are defined in the right way.

Quoted 2 lines

I have to admit, bi_rec structures are a really cool idea, but I prefer simplicity over coolness. :)

The beauty of the proposal is that it *is* simple. bi_recs within bi_recs. The top level treats the record as one (typeless) chunk of data. I have actually requested *more* types (e.g. arrays), and also the saving of certain (most?) bi_recs so that loadable modules can consult them later (rather than requiring code in the kernel startup to parse the records). Cheers!

								Murray...

--
Murray Jensen, CSIRO Manufacturing Sci & Tech, Phone: +61 3 9662 7763
Locked Bag No. 9, Preston, Vic, 3072, Australia. Fax: +61 3 9662 7853
Internet: [email protected]

Hymod project: http://www.msa.cmst.csiro.au/projects/Hymod/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#9 lore raw
Quoted 7 lines

The beauty of the proposal is that it *is* simple. bi_recs within bi_recs. The top level treats the record as one (typeless) chunk of data. I have actually requested *more* types (e.g. arrays), and also the saving of certain (most?) bi_recs so that loadable modules can consult them later (rather than requiring code in the kernel startup to parse the records). Cheers!

The kernel startup should stop parsing them. The interface between kernel & drivers to bi_recs should instead be of the type "find_birec(type)" or "find_dev_birec(class, id)" for BI_DEVICE ones.

There should be no reason to have to touch the kernel support files when adding new types of bi_rec nor to have them all parsed in a single location.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#10 lore raw
In reply to Val Henson
Quoted 9 lines

What added functionality does the whole "structure" concept give us? Here's the current bi_rec parsing code:

while (rec->tag != BI_LAST) {
/* fiddle with each individual record */ rec = (struct bi_record *)((ulong)rec + rec->size);
}

Quoted 8 lines

The simplicity of this system is valuable - I don't want to give it up unless we get lots and lots of added functionality in return. Dan Malek's comments suggest that bi_recs should only be used for only a small, simple class of information. In this context, I don't see what structures buy us.

I have to admit, bi_rec structures are a really cool idea, but I prefer simplicity over coolness. :)

Well, my "draft" proposal is indeed to complicated, I agree. Though I want to stay in the idea that a given bi_rec can contain itself some bi_recs.

What I now want to do is to keep the exising scheme for most informations (that is a flat list of bi_recs), with only one exception that doesn't affect the current parsing code, only a couple of helpers need to be added for drivers to use the additional information:

We define a special BI_DEVICE type of bi_rec that represents a HW device for which the firmware provides some informations. Since the firmware is free to provide whatever informations it want (that set is not fully defined), the content of the BI_DEVICE record is itself a list of bi_recs.

In there, only a couple are generically defined, BI_DEV_TYPE indicates the "type" of device (not the class or function, but rather the type of wiring), and an optional BI_DEV_ID, whose content depends only on BI_DEV_TYPE.

For example, a PCI device for which we want to provide some additional informations (like an HW ethernet address) would have BI_DEV_TYPE = BI_DEV_TYPE_PCI, and BI_DEV_ID containing a PCI bus/devfn.

On chip devices just need a specific BI_DEV_TYPE (for example BI_DEV_TYPE_4xx_OCP), in which case BI_DEV_ID indicates what on chip periph is designated (ex: BI_DEV_ID_4xx_ETH).
Eventually, we can also define a BI_DEV_CLASS indicating the calss (function) of the device (ex: BI_DEV_CLASS_ETH). If we go this way, then for things like on-chip devices, we identify them with BI_DEV_TYPE and BI_DEV_CLASS, keeping BI_DEV_ID solely as an index number for chips that support more than 1 instance of a given cell.

The "standard" kernel only define a few BI_DEV_TYPE's (like PCI, 4xx OCP, 8xx OCP). Drivers define attributes they can read from the BI_DEVICE (4xx ethernet can read a HW eth adress for example). Board vendors are free to provide additional information in the BI_DEVICE, and add the ability to the driver (patches welcome) to make good use of that information ;) (Could be, for example, wiring of the PHY since it may not use MII, etc...).

What do you think ?
Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#11 lore raw
Quoted 6 lines · Benjamin Herrenschmidt

We define a special BI_DEVICE type of bi_rec that represents a HW device for which the firmware provides some informations. Since the firmware is free to provide whatever informations it want (that set is not fully defined), the content of the BI_DEVICE record is itself a list of bi_recs.

<snip>

Quoted 9 lines

The "standard" kernel only define a few BI_DEV_TYPE's (like PCI, 4xx OCP, 8xx OCP). Drivers define attributes they can read from the BI_DEVICE (4xx ethernet can read a HW eth adress for example). Board vendors are free to provide additional information in the BI_DEVICE, and add the ability to the driver (patches welcome) to make good use of that information ;) (Could be, for example, wiring of the PHY since it may not use MII, etc...).

What do you think ?

I had an amazing and brilliant insight (which I'm sure everyone else has already had). :) The kernel just ignores bi_recs it doesn't understand. Really, you don't need any BI_DEV_TYPE's for non-core kernel code - just a type that the kernel is guaranteed never to use for any other bi_rec type.

How about one BI_IGNORE type, and driver writers and firmware authors can put whatever they feel like inside that bi_rec? The BI_IGNORE bi_rec can contain whatever you want - more bi_recs, object code, random data - and it would be the driver and firmware writers' responsibility to make them match up. I personally think this is an awful idea, but it would give everyone the freedom they want while staying within the very nice bi_rec interface. The rest of the bi_recs, the ones that the core kernel code will interpret, can be simple, one-dimensional bi_recs. What do you think, Ben?

I really agree with Dan Malek on this - we shouldn't use bi_recs as a way to reimplement methods of passing information that already exist, for example, the __setup() functions. It should be a way of passing information that only a bootloader can know, such as the location of a ramdisk, or the command line that the user typed into the bootloader. People who don't agree with this philosophy can shove whatever they like into the BI_IGNORE record type, and suffer the consequences. :)

-VAL

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#12 lore raw
Quoted 7 lines

I had an amazing and brilliant insight (which I'm sure everyone else has already had). :) The kernel just ignores bi_recs it doesn't understand. Really, you don't need any BI_DEV_TYPE's for non-core kernel code - just a type that the kernel is guaranteed never to use for any other bi_rec type.

Of course you want to add whatever additional bi_recs, and among the things I propose is the definition that the kernel will only use all-lowercase bi_rec types for it's own use leaving any other combo for other uses.

The point is to pass informations to drivers in a bit cleaner way than inventing a bi_rec type for each combination of driver and attribute (expecially if a given board can decline in several models with, for example, a different number of on-chip eth controllers, or things like that).

Quoted 9 lines

How about one BI_IGNORE type, and driver writers and firmware authors can put whatever they feel like inside that bi_rec? The BI_IGNORE bi_rec can contain whatever you want - more bi_recs, object code, random data - and it would be the driver and firmware writers' responsibility to make them match up. I personally think this is an awful idea, but it would give everyone the freedom they want while staying within the very nice bi_rec interface. The rest of the bi_recs, the ones that the core kernel code will interpret, can be simple, one-dimensional bi_recs. What do you think, Ben?

Which means that as soon as you want to add more infos, you will have to deal with all the pre-bi_rec problems when you own stuffs have to evolve. (versionning etc...).

Again, for anything not realted to device drivers infos (things like HW ethernet addresses, PHY IDs, eventually interrupt routing), a whole bunch of bi_rec types will be left free by the kernel for use by your proprietary stuff the way you want, so you can pretty much define whatever you want (or not, it's up to you).

But, I feel it's more convenient for drivers to use this signle-level BI_DEVICE bi_rec that contains itself bi_recs.

Quoted 5 lines

I really agree with Dan Malek on this - we shouldn't use bi_recs as a way to reimplement methods of passing information that already exist, for example, the __setup() functions. It should be a way of passing information that only a bootloader can know, such as the location of a ramdisk, or the command line that the user typed into the bootloader.

Which is exactly what I'm proposing. Passing generic informations like CPU core clocks, command line, ramdisk, etc... is done via bi_recs at the toplevel.

The BI_DEVICE bi_rec's allow to provide other informations that are also only known by the firmware (most of the time), like eth MAC address, PHY wiring, or other kind of wiring informations related to a given rev. of a board, etc... provided that those infos concern a given driver for a specific device. It's also a convenient way to provide interrupt routing informations.

Quoted 2 lines

People who don't agree with this philosophy can shove whatever they like into the BI_IGNORE record type, and suffer the consequences. :)

No. A BI_IGNORE makes no sense. A whole class of bi_rec types guaranteed not to be used by the kernel makes sense. I don't want to fix the kernel side of the problem just to put back the same problem on my vendor specific infos (I have various ones; depending on the product, they can have to evolve especially as I have to maintain different revisions of the produce, and if possible with the same kernel / firmware). It's always a win when you don't have to change a line of the kernel code because your HW engineer wired an interrupt differently. That means I only have to update the tables in the firmware and not touch the kernel version.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#13 lore raw
Quoted 23 lines · Benjamin Herrenschmidt

Which means that as soon as you want to add more infos, you will have to deal with all the pre-bi_rec problems when you own stuffs have to evolve. (versionning etc...).

Again, for anything not realted to device drivers infos (things like HW ethernet addresses, PHY IDs, eventually interrupt routing), a whole bunch of bi_rec types will be left free by the kernel for use by your proprietary stuff the way you want, so you can pretty much define whatever you want (or not, it's up to you).

But, I feel it's more convenient for drivers to use this signle-level BI_DEVICE bi_rec that contains itself bi_recs.

Quoted 5 lines

I really agree with Dan Malek on this - we shouldn't use bi_recs as a way to reimplement methods of passing information that already exist, for example, the __setup() functions. It should be a way of passing information that only a bootloader can know, such as the location of a ramdisk, or the command line that the user typed into the bootloader.

Which is exactly what I'm proposing. Passing generic informations like CPU core clocks, command line, ramdisk, etc... is done via bi_recs at the toplevel.

Quoted 6 lines

The BI_DEVICE bi_rec's allow to provide other informations that are also only known by the firmware (most of the time), like eth MAC address, PHY wiring, or other kind of wiring informations related to a given rev. of a board, etc... provided that those infos concern a given driver for a specific device. It's also a convenient way to provide interrupt routing informations.

Alternatively, why not create a whole device tree for this? There already exists a standard for device trees: IEEE 1275 Open Firmware. Then you need only one extra bi_rec tag: BI_OF_TREE.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#14 lore raw
Quoted 5 lines

Alternatively, why not create a whole device tree for this? There already exists a standard for device trees: IEEE 1275 Open Firmware. Then you need only
one extra bi_rec tag: BI_OF_TREE.

Well, BI_OF_TREE may exist if we ever decide to move the OF interface out of the kernel and to the wrapper. Though it's not well suited for embedded platforms where we really want something as small as possible.

The device-tree has the inconvenient of duplicating a lot of informations that we don't necessarily need. In most embedded cases, I will only need about 2 or 3 BI_DEVICE records, those containing only a couple of informations.

I'm still not completely sure about the BI_DEV_TYPE/BI_DEV_ID mecanism of retreiving a given BI_DEVICE yet. I have a case here where I want to use BI_DEVICE to carry informations about the chip select & IRQ on which a chip is wired on the processor external bus, along with a couple of flags related to some broken address select on some board revs, I want my driver to be able to lookup the chip itself, not a "location", so I'm still thinking about the best way to provide that info. Maybe an additional (and optional as always BI_DEV_NAME).

That would give us 2 utility routines to be used by drivers to locate BI_DEVICE bi_recs:

bi_find_device_type(ulong dev_type, void* dev_id, size_t dev_id_size) bi_find_device_name(const char* name)

The first one compares BI_DEV_TYPE with dev_type, and if dev_id is non NULL, matches it with the variable sized BI_DEV_ID. The second one compares BI_DEV_NAME as a C string.

The basic function for finding a bi_rec will be

  bi_find(struct bi_rec* where, ulong tag);

"where" will be NULL for a toplevel search, and will point to a bi_rec returned by one of the 2 bi_find_device routines for looking up an attribute within a BI_DEVICE.

Any comments ? Should I start putting this together in _2_4_devel or only 2_5 ?

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#15 lore raw
In reply to Benjamin Herrenschmidt
Quoted 4 lines · Benjamin Herrenschmidt

Of course you want to add whatever additional bi_recs, and among the things I propose is the definition that the kernel will only use all-lowercase bi_rec types for it's own use leaving any other combo for other uses.

Did you mean, the kernel will use all-uppercase bi_rec types? That's what it's currently using. If you meant to say that the kernel will use all-lowercase bi_rec types, I'm interested in knowing why it's worth breaking backwards compatibility.

Quoted 2 lines

No. A BI_IGNORE makes no sense. A whole class of bi_rec types guaranteed not to be used by the kernel makes sense.

Sure, that makes sense. Like the vendor specific major/minor numbers.

-VAL

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#16 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 4 lines

Of course you want to add whatever additional bi_recs, and among the things I propose is the definition that the kernel will only use all-lowercase bi_rec types for it's own use leaving any other combo for other uses.

Did you mean, the kernel will use all-uppercase bi_rec types? That's what it's currently using. If you meant to say that the kernel will use all-lowercase bi_rec types, I'm interested in knowing why it's worth breaking backwards compatibility.

Yes, sorry for the confusion.

Quoted 4 lines
Quoted 2 lines

No. A BI_IGNORE makes no sense. A whole class of bi_rec types guaranteed not to be used by the kernel makes sense.

Sure, that makes sense. Like the vendor specific major/minor numbers.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#17 lore raw
In reply to Val Henson
Quoted 15 lines · Val Henson
Quoted 5 lines · Benjamin Herrenschmidt

We define a special BI_DEVICE type of bi_rec that represents a HW device for which the firmware provides some informations. Since the firmware is free to provide whatever informations it want (that set is not fully defined), the content of the BI_DEVICE record is itself a list of bi_recs.

<snip>

Quoted 8 lines

The "standard" kernel only define a few BI_DEV_TYPE's (like PCI, 4xx OCP, 8xx OCP). Drivers define attributes they can read from the BI_DEVICE (4xx ethernet can read a HW eth adress for example). Board vendors are free to provide additional information in the BI_DEVICE, and add the ability to the driver (patches welcome) to make good use of that information ;) (Could be, for example, wiring of the PHY since it may not use MII, etc...).

Quoted 7 lines
Quoted 1 line

What do you think ?

I had an amazing and brilliant insight (which I'm sure everyone else has already had). :) The kernel just ignores bi_recs it doesn't understand. Really, you don't need any BI_DEV_TYPE's for non-core kernel code - just a type that the kernel is guaranteed never to use for any other bi_rec type.

Yes indeed.

BTW, I just thought of something different: some people want to keep data stored in bi_recs for later use, after the initialization of the kernel. What about a new tag to mark data that is to be copied and stored for later use?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#18 lore raw
Quoted 6 lines

Yes indeed.

BTW, I just thought of something different: some people want to keep data stored in bi_recs for later use, after the initialization of the kernel. What about a new tag to mark data that is to be copied and stored for later use?

Currently, I plan to keep everything. Though if we decide to put some flag bits in the high part of the size field, we could specify what to keep and what to strip.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#19 lore raw
Quoted 3 lines
Quoted 3 lines

BTW, I just thought of something different: some people want to keep data stored in bi_recs for later use, after the initialization of the

kernel. What

Quoted 5 lines
Quoted 1 line

about a new tag to mark data that is to be copied and stored for later use?

Currently, I plan to keep everything. Though if we decide to put some flag bits in the high part of the size field, we could specify what to keep and what to strip.

Ok, rather that hacking flag bits, which I want to avoid, what about
that: we define an optional BI_PERSISTENT tag. Any bi_rec _before_ that tag is lost after __init (typically cmdline, initrd, informations used in *_setup). Any bi_rec after this tag is kept around. Tyîcally, this means those bi_recs are copied to separate pages (this will typically be BI_DEVICE recs). If you want, you can put them before BI_PERSISTENT and build your drivers in. If you prefer using modules, you can put your BI_DEVICE entries after it.

An important point about bi_recs is that they shouldn't contain pointers to other things within bi_recs. They can (and will) be moved around, so unless explicitely defined (like initrd ptrs), no pointers in bi_recs.

Again, all of this is just a small superset of the existing mecanism with a few utiliy functions for kernel code and drivers to locate bi_rec's by tag, either globally or within another bi_rec (that is typically BI_DEVICE). The point is that once this is coded, I expect bd_t & other various facilities used by bootloaders to go away, or at worst be moved to the wrapper.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#20 lore raw
In reply to Val Henson
Quoted 2 lines · Val Henson

How about one BI_IGNORE type, and driver writers and firmware authors can put whatever they feel like inside that bi_rec?

The kernel should simply ignore any bi_rec it doesn't know about. You don't need a special record tag for this. Any bi_recs within bi_recs are all ignored in one fell swoop, since the outer record tag is unknown.

Quoted 3 lines

It should be a way of passing
information that only a bootloader can know, such as the location of a ramdisk, or the command line that the user typed into the bootloader.

Why only that? Why not use it to pass anything that the bootloader knows so that you don't have to duplicate effort in the Linux kernel?

And anticipating the obvious answer, if a boot loader does not support bi_recs and/or cannot provide some required information, then you need a piggy back loader in arch/ppc/boot. Cheers!

								Murray...

--
Murray Jensen, CSIRO Manufacturing Sci & Tech, Phone: +61 3 9662 7763
Locked Bag No. 9, Preston, Vic, 3072, Australia. Fax: +61 3 9662 7853
Internet: [email protected]

Hymod project: http://www.msa.cmst.csiro.au/projects/Hymod/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#21 lore raw
Quoted 8 lines · Murray Jensen
Quoted 2 lines · Val Henson

How about one BI_IGNORE type, and driver writers and firmware authors can put whatever they feel like inside that bi_rec?

The kernel should simply ignore any bi_rec it doesn't know about. You don't need a special record tag for this. Any bi_recs within bi_recs are all ignored in one fell swoop, since the outer record tag is unknown.

I know most of you understand this, but I just wanted to make it clear:

The kernel should simply ignore any bi_rec it doesn't know about - and does. The question is, how can we guarantee that the kernel doesn't know about that bi_rec? The answer is that we need to reserve at least one (or several, under Ben's plan) bi_rec types that are guaranteed not to be used by the kernel. That's all I was trying to say.

-VAL

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#22 lore raw
In reply to Benjamin Herrenschmidt
Quoted 4 lines · Benjamin Herrenschmidt

What I now want to do is to keep the exising scheme for most informations (that is a flat list of bi_recs), with only one exception that doesn't affect the current parsing code, only

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I like this part!

<A bunch of stuff about various ways to identify driver specific bi_recs>

Quoted 1 line

What do you think ?

I like the general idea - have a bunch of bi_recs that the kernel ignores, and then define a driver interface to easily get that information.

I would like a simpler, more generic interface between drivers and bi_recs. The model is this: Firmware creates a top-level bi_rec and puts something in it. When the driver wants to get the information, it calls:

  my_bi_rec = bi_find_id(NULL, BI_SOME_ID);

This gives it a pointer to the top-level bi_rec containing its info. If the firmware put more bi_recs inside that bi_rec, the driver calls:

  my_other_bi_rec = bi_find_id(&(my_bi_rec->data), BI_SOME_OTHER_ID);

Basically, don't create special cases, just treat the generic case of a driver and a bootloader and some information you want to pass between them. I don't like BI_DEVICE, I do like BI_NOT_FOR_THE_KERNEL or something shorter but equivalent. :)

I'm happy to hear reasons for why a more complicated interface is a good idea.

-VAL

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#23 lore raw
Quoted 2 lines · Val Henson

I'm happy to hear reasons for why a more complicated interface is a good idea.

benh wanted to "find" a particular BI_DEVICE bi_rec within multiple instances. I think what you are suggesting requires that there be only one instance of any given (top-level) tag. yes? If not, how do you determine which bi_rec to return? Always the first one you come across? or maintain a pointer and have subsequent calls return the next one, until there are no more, at which time you return NULL?

I think benh was suggesting that you have many "top-level" BI_DEVICE bi_recs, then have some interface to "find" one of them (either by "name", or by some variable length "device id") - each driver (that wants to) then looks for it's bi_rec when it is initialised. This would require that every BI_DEVICE bi_rec "contains" either a "name" bi_rec or a "device id" bi_rec - otherwise it would never be found (using the proposed interface functions). Cheers!

								Murray...

--
Murray Jensen, CSIRO Manufacturing Sci & Tech, Phone: +61 3 9662 7763
Locked Bag No. 9, Preston, Vic, 3072, Australia. Fax: +61 3 9662 7853
Internet: [email protected]

Hymod project: http://www.msa.cmst.csiro.au/projects/Hymod/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#24 lore raw
In reply to Val Henson
Quoted 8 lines

Basically, don't create special cases, just treat the generic case of a driver and a bootloader and some information you want to pass between them. I don't like BI_DEVICE, I do like BI_NOT_FOR_THE_KERNEL or something shorter but equivalent. :)

I'm happy to hear reasons for why a more complicated interface is a good idea.

Ok, so first, the generic case is there as you can always stuff things inside a toplevel bi_rec and use bi_find within that.

The point of BI_DEVICE is to standardize a bit the interface between known drivers and the bootloader. Your scheme would require each device on my board to have a different bi_rec, which will lead into proprietary stuff & more driver patching.

For example, let's say we fix some "common" ethernet drivers like pcnet32, tulip, etc... to be able to locate a bi_rec for a BI_DEV_TYPE_PCI based on the bus/devfn and use the HW address in there. Once that's done, no kernel/driver change is needed, even if you happen to have 3 instances of the ethernet chip on your PCI bus, just pass the appropriate infos from the bootloader. Of course, this is mostly useful for embedded cases where the PCI device is wired, not in a slot.

Also, a set BI_DEV_TYPE_PCI with just a BI_IRQ_NUMBER (no indication of the device class/name) can also be used to provide the PCI interrupt routing for PCI slots, though in this specific case, I'd prefer seeing the firmware fill the PCI_INTERRUPT_LINE register in the config space and the kernel retreive that.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#25 lore raw
Quoted 6 lines · On Tue, 26 Mar 2002 [email protected] wrote:

Also, a set BI_DEV_TYPE_PCI with just a BI_IRQ_NUMBER (no indication of the device class/name) can also be used to provide the PCI interrupt routing for PCI slots, though in this specific case, I'd prefer seeing the firmware fill the PCI_INTERRUPT_LINE register in the config space and the kernel retreive that.

Won't fly, this is a byte wide register and there are machines with more than 256 interrupt lines. And they are even more likely with PCI 2.2+ so called message passing interrupts, which is a simple way to admit that the way of doing interrupts was so dumb that even (one physical PCB trace per vector) the Cro-Magnon man would have done better

Basically, PCI is going to implement interrupts in the way similar to waht VME/m68k (and even Z80) hardware have done for over 25 years. The electrical details are different, but it is the device that puts the interrupt vector on the bus, not some PIC (where P stands for paleolithic) through a maze of PCB traces.

BTW, I don't even allow sharing VME interrupt vectors in my PCI<->VME bridge driver, because I have something like 1792 (7*256) separately identifiable interrupt sources.

Regards,
Gabriel.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#26 lore raw
Quoted 7 lines

Won't fly, this is a byte wide register and there are machines with more than 256 interrupt lines. And they are even more likely with PCI 2.2+ so called message passing interrupts, which is a simple way to admit that the way of doing interrupts was so dumb that even (one physical PCB trace per vector) the Cro-Magnon man would have done better

Well, I would expect such machines to have a device-tree :) Anyway, a bi_rec would indeed help if really needed here but again, it's optional and I would expect embedded not to require it for PCI routing.

Quoted 9 lines

Basically, PCI is going to implement interrupts in the way similar to waht VME/m68k (and even Z80) hardware have done for over 25 years. The electrical details are different, but it is the device that puts the interrupt vector on the bus, not some PIC (where P stands for paleolithic) through a maze of PCB traces.

BTW, I don't even allow sharing VME interrupt vectors in my PCI<->VME bridge driver, because I have something like 1792 (7*256) separately identifiable interrupt sources.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#27 lore raw
In reply to Benjamin Herrenschmidt

Ben, et. al.,

Sorry for dropping out the last few days, I've been very busy with other things.

I've skimmed the email but I'll admit I didn't read them all in depth. I've made an example of actual bi_rec's using the ev64260 to see if my skimming worked :) In the example, I used a BI_STRUCT to pass in the mac addr for the 3 embedded enet ctlrs on the gt64260. I used the DEV_TYPE + DEV_CLASS concept but made an "EMBEDDED" DEV_TYPE to go along with DEV_PCI so we don't have to add a new one for each embedded ctlr. The square brackets are only there to make it easier to follow. I'm assuming that every bi_rec is responsible for padding out to a 4-byte boundary. Is that what I'm supposed to do?

Please let me know if I'm on the right track. If so, we--the ev64260 people--can flesh out some more bi_rec's and implement them.

Mark
--
Example for ev64260:
--------------------

[0] tag: BI_CMD_LINE

    size: 36                            (4 + 4 + 26 chars + 2 pad)
    data: "console=ttyS0,115200 ip=on"
    pad: 2

[1] tag: BI_MEMSIZE

    size: 12
    data: 33554432                      (32 MB)

[2] tag: BI_GT64260_BASE

    size: 12
    data: fc000000

[3] tag: BI_STRUCT (embedded enet cltr 0)

    size: 76                            (12 + 3*12 + 25 + 3 == 76)
    data: BI_DEVICE

    [3.0] tag: BI_DEV_TYPE
          size: 12
          data: BI_DEV_EMBEDDED

    [3.1] tag: BI_DEV_CLASS
          size: 12
          data: BI_CLASS_ENET

    [3.2] tag: BI_DEV_ID
          size: 12
          data: 0                       (1st enet device)

    [3.3] tag: BI_MAC_ADDR
          size: 25
          data: aa:bb:cc:dd:ee:ff       (ascii)
    pad: 3

[4] tag: BI_STRUCT

    size: 76
    data: BI_DEVICE

    [4.0] tag: BI_DEV_TYPE
          size: 12
          data: BI_DEV_EMBEDDED

    [4.1] tag: BI_DEV_CLASS
          size: 12
          data: BI_CLASS_ENET

    [4.2] tag: BI_DEV_ID
          size: 12
          data: 1                       (2nd enet device)

    [4.3] tag: BI_MAC_ADDR
          size: 25
          data: gg:hh:ii:jj:kk:ll       (ascii)
    pad: 3

[5] tag: BI_STRUCT

    size: 76
    data: BI_DEVICE

    [5.0] tag: BI_DEV_TYPE
          size: 12
          data: BI_DEV_EMBEDDED

    [5.1] tag: BI_DEV_CLASS
          size: 12
          data: BI_CLASS_ENET

    [5.2] tag: BI_DEV_ID
          size: 12
          data: 2                       (3rd enet device)

    [5.3] tag: BI_MAC_ADDR
          size: 25
          data: mm:nn:oo:pp:qq:rr       (ascii)
    pad: 3

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#28 lore raw
Quoted 11 lines

Ben, et. al.,

Sorry for dropping out the last few days, I've been very busy with other things.

I've skimmed the email but I'll admit I didn't read them all in depth. I've made
an example of actual bi_rec's using the ev64260 to see if my skimming worked :)
In the example, I used a BI_STRUCT to pass in the mac addr for the 3

embedded

Quoted 3 lines

enet ctlrs on the gt64260. I used the DEV_TYPE + DEV_CLASS concept but made an
"EMBEDDED" DEV_TYPE to go along with DEV_PCI so we don't have to add a

new one

Quoted 8 lines

for each embedded ctlr. The square brackets are only there to make it easier to
follow. I'm assuming that every bi_rec is responsible for padding out to a 4-byte boundary. Is that what I'm supposed to do?

Please let me know if I'm on the right track. If so, we--the ev64260 people--can
flesh out some more bi_rec's and implement them.

Looks fine except for a couple of points:

- BI_STRUCT is gone, it's BI_DEVICE and the first "type" field is gone,
that is BI_DEVICE just contains tags without a header. There is no need to "know" if a given BI_REC is actually a struct or not, though if we still want to do that for debugging reasons, we can define this info is stored in the the high bit of the size field (and make sure bi_rec parsing routines ignore that bit when reading size)

- I'm not sure about the "EMBEDDED" dev type. I'd rather have a specific
type for EV64260_EMBEDDED, and another one for 405_EMBEDDED for example, though this is mostly a matter of taste, we have enough room for types to define as many as we want ;)

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#29 lore raw
Quoted 9 lines · [email protected] wrote:

Looks fine except for a couple of points:

- BI_STRUCT is gone, it's BI_DEVICE and the first "type" field is gone,
that is BI_DEVICE just contains tags without a header. There is no need to "know" if a given BI_REC is actually a struct or not, though if we still want to do that for debugging reasons, we can define this info is stored in the the high bit of the size field (and make sure bi_rec parsing routines ignore that bit when reading size)

Quoted 6 lines

- I'm not sure about the "EMBEDDED" dev type. I'd rather have a specific
type for EV64260_EMBEDDED, and another one for 405_EMBEDDED for example, though this is mostly a matter of taste, we have enough room for types to define as many as we want ;)

Ben.

Ahh, oops, didn't see this until after I send the second iteration the the bi_rec's.
I'll send a third in a few minutes.

Mark

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/