Lines Matching refs:context

35 int __init_lpc_dev(struct mbox_context *context, const char *path)  in __init_lpc_dev()  argument
56 context->fds[LPC_CTRL_FD].fd = fd; in __init_lpc_dev()
66 context->mem_size = map.size; in __init_lpc_dev()
68 context->lpc_base = 0x0FFFFFFF & -context->mem_size; in __init_lpc_dev()
71 MSG_DBG("Mapping in 0x%.8x bytes of %s\n", context->mem_size, path); in __init_lpc_dev()
72 context->mem = mmap(NULL, context->mem_size, PROT_READ | PROT_WRITE, in __init_lpc_dev()
74 if (context->mem == MAP_FAILED) { in __init_lpc_dev()
82 int init_lpc_dev(struct mbox_context *context) in init_lpc_dev() argument
84 return __init_lpc_dev(context, LPC_CTRL_PATH); in init_lpc_dev()
87 void free_lpc_dev(struct mbox_context *context) in free_lpc_dev() argument
89 if (context->mem) { in free_lpc_dev()
90 munmap(context->mem, context->mem_size); in free_lpc_dev()
92 close(context->fds[LPC_CTRL_FD].fd); in free_lpc_dev()
101 int point_to_flash(struct mbox_context *context) in point_to_flash() argument
111 .addr = 0x0FFFFFFF & -context->flash_size, in point_to_flash()
113 .size = context->flash_size in point_to_flash()
116 if (context->state & MAPS_FLASH) { in point_to_flash()
120 if (context->state & STATE_SUSPENDED) { in point_to_flash()
127 context->flash_size >> 20, map.addr); in point_to_flash()
129 if (ioctl(context->fds[LPC_CTRL_FD].fd, ASPEED_LPC_CTRL_IOCTL_MAP, &map) in point_to_flash()
136 context->state = ACTIVE_MAPS_FLASH; in point_to_flash()
141 return set_flash_bytemap(context, 0, context->flash_size, FLASH_DIRTY); in point_to_flash()
150 int point_to_memory(struct mbox_context *context) in point_to_memory() argument
156 .addr = context->lpc_base, in point_to_memory()
158 .size = context->mem_size in point_to_memory()
161 if (context->state & MAPS_MEM) { in point_to_memory()
166 context->mem, context->mem_size); in point_to_memory()
169 if (ioctl(context->fds[LPC_CTRL_FD].fd, ASPEED_LPC_CTRL_IOCTL_MAP, in point_to_memory()
177 context->state = MAPS_MEM | (context->state & STATE_SUSPENDED); in point_to_memory()