Lines Matching refs:context

35 int __lpc_dev_init(struct mbox_context *context, const char *path)  in __lpc_dev_init()  argument
56 context->fds[LPC_CTRL_FD].fd = fd; in __lpc_dev_init()
66 context->mem_size = map.size; in __lpc_dev_init()
68 context->lpc_base = 0x0FFFFFFF & -context->mem_size; in __lpc_dev_init()
71 MSG_DBG("Mapping in 0x%.8x bytes of %s\n", context->mem_size, path); in __lpc_dev_init()
72 context->mem = mmap(NULL, context->mem_size, PROT_READ | PROT_WRITE, in __lpc_dev_init()
74 if (context->mem == MAP_FAILED) { in __lpc_dev_init()
82 int lpc_dev_init(struct mbox_context *context) in lpc_dev_init() argument
84 return __lpc_dev_init(context, LPC_CTRL_PATH); in lpc_dev_init()
87 void lpc_dev_free(struct mbox_context *context) in lpc_dev_free() argument
89 if (context->mem) { in lpc_dev_free()
90 munmap(context->mem, context->mem_size); in lpc_dev_free()
92 close(context->fds[LPC_CTRL_FD].fd); in lpc_dev_free()
101 int lpc_map_flash(struct mbox_context *context) in lpc_map_flash() argument
111 .addr = 0x0FFFFFFF & -context->backend.flash_size, in lpc_map_flash()
113 .size = context->backend.flash_size in lpc_map_flash()
116 if (context->state & MAPS_FLASH) { in lpc_map_flash()
120 if (context->state & STATE_SUSPENDED) { in lpc_map_flash()
127 context->backend.flash_size >> 20, map.addr); in lpc_map_flash()
129 if (ioctl(context->fds[LPC_CTRL_FD].fd, ASPEED_LPC_CTRL_IOCTL_MAP, &map) in lpc_map_flash()
136 context->state = ACTIVE_MAPS_FLASH; in lpc_map_flash()
141 return backend_set_bytemap(&context->backend, 0, in lpc_map_flash()
142 context->backend.flash_size, FLASH_DIRTY); in lpc_map_flash()
151 int lpc_map_memory(struct mbox_context *context) in lpc_map_memory() argument
157 .addr = context->lpc_base, in lpc_map_memory()
159 .size = context->mem_size in lpc_map_memory()
162 if (context->state & MAPS_MEM) { in lpc_map_memory()
167 context->mem, context->mem_size); in lpc_map_memory()
170 if (ioctl(context->fds[LPC_CTRL_FD].fd, ASPEED_LPC_CTRL_IOCTL_MAP, in lpc_map_memory()
178 context->state = MAPS_MEM | (context->state & STATE_SUSPENDED); in lpc_map_memory()