-static inline unsigned long addr(struct map_info *map, unsigned long ofs)
-{
- unsigned long offset;
- offset = ((8*1024*1024) - map->size) + ofs;
- if (offset >= (4*1024*1024)) {
- offset += 0x400000;
- }
- return map->map_priv_1 + 0x400000 + offset;
-}
-
-static inline unsigned long dbg_addr(struct map_info *map, unsigned long addr)
-{
- return addr - map->map_priv_1 + ICHX_FWH_REGION_START;
-}
-
-static map_word ichxrom_read(struct map_info *map, unsigned long ofs)
-{
- map_word val;
- int i;
- switch(map->bankwidth) {
- case 1: val.x[0] = __raw_readb(addr(map, ofs)); break;
- case 2: val.x[0] = __raw_readw(addr(map, ofs)); break;
- case 4: val.x[0] = __raw_readl(addr(map, ofs)); break;
-#if BITS_PER_LONG >= 64
- case 8: val.x[0] = __raw_readq(addr(map, ofs)); break;
-#endif
- default: val.x[0] = 0; break;
- }
- for(i = 1; i < map_words(map); i++) {
- val.x[i] = 0;
- }
- return val;
-}
-
-static void ichxrom_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, addr(map, from), len);
-}
-
-static void ichxrom_write(struct map_info *map, map_word d, unsigned long ofs)
-{
- switch(map->bankwidth) {
- case 1: __raw_writeb(d.x[0], addr(map,ofs)); break;
- case 2: __raw_writew(d.x[0], addr(map,ofs)); break;
- case 4: __raw_writel(d.x[0], addr(map,ofs)); break;
-#if BITS_PER_LONG >= 64
- case 8: __raw_writeq(d.x[0], addr(map,ofs)); break;
-#endif
- }
- mb();
-}
-
-static void ichxrom_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(addr(map, to), from, len);
-}
-
-static struct ichxrom_map_info ichxrom_map = {
- .map = {
- .name = MOD_NAME,
- .phys = NO_XIP,
- .size = 0,
- .bankwidth = 1,
- .read = ichxrom_read,
- .copy_from = ichxrom_copy_from,
- .write = ichxrom_write,
- .copy_to = ichxrom_copy_to,
- /* Firmware hubs only use vpp when being programmed
- * in a factory setting. So in-place programming
- * needs to use a different method.
- */
- },
- /* remaining fields of structure are initialized to 0 */