u_int32_t pmc_eeprom_read (long addr, long mem_offset) { u_int32_t data; /* Data from chip */ if (!ByteReverseBuilt) BuildByteReverse (); mem_offset = ByteReverse[0x7F & mem_offset]; /* Reverse address */ /* * NOTE: The max offset address is 128 or half the reversal table. So the * LSB is always zero and counts as a built in shift of one bit. So even * though we need to shift 3 bits to make room for the command, we only * need to shift twice more because of the built in shift. */ mem_offset <<= 2; /* Shift for command */ mem_offset |= EPROM_READ; /* Add command */ eeprom_put_byte (addr, mem_offset, SIZE_ADDR_OP); /* Output chip address */ data = eeprom_get_byte (addr); /* Read chip data */ pci_write_32 ((u_int32_t *) addr, 0); /* Remove Chip Select from * EEPROM */ return (data & 0x000000FF); }
u_int32_t pmc_eeprom_read (long addr, long mem_offset) { u_int32_t data; /* */ if (!ByteReverseBuilt) BuildByteReverse (); mem_offset = ByteReverse[0x7F & mem_offset]; /* */ /* */ mem_offset <<= 2; /* */ mem_offset |= EPROM_READ; /* */ eeprom_put_byte (addr, mem_offset, SIZE_ADDR_OP); /* */ data = eeprom_get_byte (addr); /* */ pci_write_32 ((u_int32_t *) addr, 0); /* */ return (data & 0x000000FF); }