struct slot_config get_slot_config (int fd, unsigned int slot) { const unsigned int NUM_SLOTS = 16; assert (slot < NUM_SLOTS); uint32_t data = 0; uint8_t *p = (uint8_t *)&data; const uint32_t OFFSET_TO_SLOT_CONFIGS = 5; uint8_t addr = slot; if (slot % 2 != 0) addr -= 1; addr += OFFSET_TO_SLOT_CONFIGS; assert (read4 (fd, CONFIG_ZONE, addr, &data)); printf ("Raw data %x\n", data); if (slot % 2 != 0) { data &= 0xFFFF; } else data = data >> 16; return parse_slot_config (p); }
int eisa_enumerator(unsigned long eeprom_addr, struct resource *io_parent, struct resource *mem_parent) { int i; struct eeprom_header *eh; static char eeprom_buf[HPEE_MAX_LENGTH]; for (i=0; i < HPEE_MAX_LENGTH; i++) { eeprom_buf[i] = gsc_readb(eeprom_addr+i); } printk(KERN_INFO "Enumerating EISA bus\n"); eh = (struct eeprom_header*)(eeprom_buf); for (i=0;i<eh->num_slots;i++) { struct eeprom_eisa_slot_info *es; es = (struct eeprom_eisa_slot_info*) (&eeprom_buf[HPEE_SLOT_INFO(i)]); if (-1==init_slot(i+1, es)) { return -1; } if (es->config_data_offset < HPEE_MAX_LENGTH) { if (parse_slot_config(i+1, &eeprom_buf[es->config_data_offset], es, io_parent, mem_parent)) { return -1; } } else { printk (KERN_WARNING "EISA EEPROM offset 0x%x out of range\n",es->config_data_offset); return -1; } } return 0; }