Section:hwinfo offset:0x000002b8 size:0x00000088 0) tag(021e92b8) base(021e92bc) next(021e92c4) name[Group] 0) size:3 tag:3 isize:3, iname:0, owner:65535, kids:2 12) tag(021e92c4) base(021e92c8) next(021e92d0) name[Bus] 12) size:3 tag:17 isize:3, iname:9, owner:0, kids:1 24) tag(021e92d0) base(021e92d4) next(021e92dc) name[Bus] 24) size:3 tag:17 isize:3, iname:49, owner:0, kids:1 36) tag(021e92dc) base(021e92e0) next(021e92e8) name[Group] 36) size:3 tag:3 isize:3, iname:53, owner:24, kids:2 48) tag(021e92e8) base(021e92ec) next(021e92f8) name[Device] 48) size:4 tag:62 isize:4, iname:57, owner:36, kids:0 00 00 00 00 64) tag(021e92f8) base(021e92fc) next(021e9308) name[Device] 64) size:4 tag:62 isize:4, iname:69, owner:36, kids:0 00 00 00 00 80) tag(021e9308) base(021e930c) next(021e9314) name[Group] 80) size:3 tag:3 isize:3, iname:74, owner:12, kids:1 92) tag(021e9314) base(021e9318) next(021e9324) name[Device] 92) size:4 tag:62 isize:4, iname:82, owner:80, kids:0 00 00 00 00 Section:typed_strings offset:0x00000228 size:0x00000020 off:0 type:5 string:'MV64460' off:12 type:2 string:'localhost' Section:strings offset:0x00000248 size:0x00000070 [0]'hw' [3]'Group' [9]'unknown' [17]'Bus' [21]'memory' [28]'device' [35]'rom' [39]'ram' [43]'7447A' [49]'pci' [53]'dma' [57]'pci0' [62]'Device' [69]'pci1' [74]'MV64460' [82]'mv64460' [90]'imagefs' [98]'sysram' init_hwinfo() find_item(bus) offset(00000000)[0] tag(021e9218) init_hwinfo() find_item(bus) bus(00000018) init_hwinfo() class=NULL tag(021e922c) class(00000024) init_hwinfo() base_tag(021e9258) tag(021e9240) init_hwinfo() [pci0] class(00000024) tag(021e9240) ... isize(4) iname(57) owner(36) kids(0) ... tag.prefix(021e9240) tag.prefix/size(4) ... find_tag(dev_name) [pci0] off(65535) tag(021f920f) ... find_tag(dev) [pci0] off(65535) tag(021f920f) ... find_tag(bus) [pci0] off(65535) tag(021f920f) ... find_item() [pci0] off(36) tag(021e9234) init_hwinfo() find_item(bus) bus(00000018) init_hwinfo() base_tag(021e9270) tag(021e9258) init_hwinfo() [pci1] class(00000024) tag(021e9258) ... isize(4) iname(69) owner(36) kids(0) ... tag.prefix(021e9258) tag.prefix/size(4) ... find_tag(dev_name) [pci1] off(65535) tag(021f9217) ... find_tag(dev) [pci1] off(65535) tag(021f9217) ... find_tag(bus) [pci1] off(65535) tag(021f9217) ... find_item() [pci1] off(36) tag(021e923c) init_hwinfo() find_item(bus) bus(0000000c) init_hwinfo() class=NULL tag(021e9270) class(00000050) init_hwinfo() base_tag(021e929c) tag(021e9284) init_hwinfo() [mv64460] class(00000050) tag(021e9284) ... isize(4) iname(82) owner(80) kids(0) ... tag.prefix(021e9284) tag.prefix/size(4) ... find_tag(dev_name) [mv64460] off(65535) tag(021f9227) ... find_tag(dev) [mv64460] off(65535) tag(021f9227) ... find_tag(bus) [mv64460] off(65535) tag(021f9227) ... find_item() [mv64460] off(80) tag(021e9278) =========================================================================== init_hwinfo.c: #include "startup.h" /* * Initialize hwinfo structure in the system page. * This code is hardware dependant and may have to be changed * changed by end users. */ typedef struct { char *bus; char *dev; char *dev_name; unsigned int base; } HW_INFO; static HW_INFO hw_info[] = { { HWI_ITEM_BUS_PCI, HWI_ITEM_DEVCLASS_DMA, "pci0", CSEMS_PCI0_BASE }, { HWI_ITEM_BUS_PCI, HWI_ITEM_DEVCLASS_DMA, "pci1", CSEMS_PCI1_BASE }, { HWI_ITEM_BUS_UNKNOWN, "MV64460", "mv64460", CSEMS_MV64460_BASE }, { NULL, NULL, NULL, 0 } }; //typedef unsigned char uint8_t ; //====================================================================== void init_hwinfo() { hwi_tag *tag; hwi_tag *base_tag; HW_INFO *hw; unsigned int off; unsigned int class; unsigned int bus; uint8_t *base; uint8_t *next; for( hw = hw_info; hw->bus; hw++ ) { //======================================================= // set most everything except the device base // hwi_add_device( hw->bus, hw->dev, hw->dev_name, 0 ); //======================================================= bus = hwi_find_item(HWI_NULL_OFF, hw->bus, NULL); if(bus == HWI_NULL_OFF) { off = hwi_find_item(HWI_NULL_OFF, HWI_ITEM_ROOT_HW, NULL); tag = hwi_alloc_item(HWI_TAG_INFO(bus), hw->bus, off); bus = hwi_tag2off(tag); kprintf( "init_hwinfo() find_item(bus) offset(%x)[%d] tag(%x)\n", off, off, (uint32_t)tag ); } kprintf( "init_hwinfo() find_item(bus) bus(%x)\n", bus ); //======================================================= // get a pointer to the tag so w can set the base // see hwi_add_device.c //======================================================= class = hwi_find_item(HWI_NULL_OFF, hw->bus, hw->dev, NULL); if(class == HWI_NULL_OFF) { tag = hwi_alloc_item(HWI_TAG_INFO(group), hw->dev, bus); class = hwi_tag2off(tag); kprintf( "init_hwinfo() class=NULL tag(%x) class(%x)\n", tag, class ); } tag = hwi_alloc_item(HWI_TAG_INFO(device), hw->dev_name, class); //======================================================= //======================================================= base_tag = tag + 1; // pointer math kprintf( "init_hwinfo() base_tag(%x) tag(%x)\n", base_tag, tag ); // #define HWI_TAG_NAME_nicphyaddr "nicphyaddr" // #define HWI_TAG_ALIGN_nicphyaddr (sizeof(_Uint32t)) // struct hwi_nicphyaddr { // struct hwi_prefix prefix; // _Uint32t addr; //======================================================= //======================================================= kprintf( "init_hwinfo() [%s] class(%x) tag(%x)\n", hw->dev_name, class, tag ); kprintf( "... isize(%d) iname(%d) owner(%d) kids(%d)\n", tag->item.itemsize, tag->item.itemname, tag->item.owner, tag->item.kids ); kprintf( "... tag.prefix(%x) tag.prefix/size(%d)\n", &(tag->prefix), tag->prefix.size ); //======================================================= //======================================================= off = hwi_find_tag( HWI_NULL_OFF, 0, hw->dev_name ); tag = hwi_off2tag( off ); kprintf( "... find_tag(dev_name) [%s] off(%d) tag(%x)\n", hw->dev_name, off, tag ); off = hwi_find_tag( HWI_NULL_OFF, 0, hw->dev ); tag = hwi_off2tag( off ); kprintf( "... find_tag(dev) [%s] off(%d) tag(%x)\n", hw->dev_name, off, tag ); off = hwi_find_tag( HWI_NULL_OFF, 0, hw->bus ); tag = hwi_off2tag( off ); kprintf( "... find_tag(bus) [%s] off(%d) tag(%x)\n", hw->dev_name, off, tag ); off = hwi_find_item(HWI_NULL_OFF, hw->bus, hw->dev, NULL); tag = hwi_off2tag( off ); kprintf( "... find_item() [%s] off(%d) tag(%x)\n", hw->dev_name, off, tag ); //======================================================= // need to put the offset in in little-indian order // see libstartup/debug.c/print_hwinfo() //======================================================= #if 0 next = (uint8_t *) ((uint32_t *)tag + tag->prefix.size); base = (uint8_t *) (&tag->prefix + 1); if( base != next ) { kprintf( "init_hwinfo() [%s] base(%x) next(%x)\n", hw->dev_name, base, next ); *base ++ = (uint8_t) ((hw->base >> 24) & 0xff); *base ++ = (uint8_t) ((hw->base >> 16) & 0xff); *base ++ = (uint8_t) ((hw->base >> 8) & 0xff); *base ++ = (uint8_t) ((hw->base ) & 0xff); } #endif } }