int tegra_pm_notifier(struct notifier_block *nb, unsigned long event, void *nouse) { printk(KERN_INFO "%s: start processing event=%lx\n", __func__, event); // Notify the event to nvrm_daemon. switch (event) { case PM_SUSPEND_PREPARE: #ifndef CONFIG_HAS_EARLYSUSPEND notify_daemon(STRING_PM_DISPLAY_OFF); #endif notify_daemon(STRING_PM_SUSPEND_PREPARE); break; case PM_POST_SUSPEND: notify_daemon(STRING_PM_POST_SUSPEND); #ifndef CONFIG_HAS_EARLYSUSPEND notify_daemon(STRING_PM_DISPLAY_ON); #endif break; default: printk(KERN_ERR "%s: unknown event %ld\n", __func__, event); return NOTIFY_DONE; } printk(KERN_INFO "%s: finished processing event=%ld\n", __func__, event); return NOTIFY_OK; }
int xencons_ring_recv(struct consfront_dev *dev, char *data, unsigned len) { struct xencons_interface *intf; XENCONS_RING_IDX cons, prod; unsigned filled = 0; if (!dev) intf = xencons_interface(); else intf = dev->ring; cons = intf->in_cons; prod = intf->in_prod; mb(); BUG_ON((prod - cons) > sizeof(intf->in)); while (filled < len && cons + filled != prod) { data[filled] = *(intf->in + MASK_XENCONS_IDX(cons + filled, intf->in)); filled++; } mb(); intf->in_cons = cons + filled; notify_daemon(dev); return filled; }
void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data) { struct consfront_dev *dev = (struct consfront_dev *) data; #ifdef HAVE_LIBC int fd = dev ? dev->fd : -1; if (fd != -1) files[fd].read = 1; wake_up(&console_queue); #else struct xencons_interface *intf = xencons_interface(); XENCONS_RING_IDX cons, prod; cons = intf->in_cons; prod = intf->in_prod; mb(); BUG_ON((prod - cons) > sizeof(intf->in)); while (cons != prod) { xencons_rx(intf->in+MASK_XENCONS_IDX(cons,intf->in), 1, regs); cons++; } mb(); intf->in_cons = cons; notify_daemon(dev); xencons_tx(); #endif }
struct consfront_dev *xencons_ring_init(void) { int err; struct consfront_dev *dev; if (!start_info.console.domU.evtchn) return 0; dev = malloc(sizeof(struct consfront_dev)); memset(dev, 0, sizeof(struct consfront_dev)); dev->nodename = "device/console"; dev->dom = 0; dev->backend = 0; dev->ring_ref = 0; #ifdef HAVE_LIBC dev->fd = -1; #endif dev->evtchn = start_info.console.domU.evtchn; dev->ring = (struct xencons_interface *) mfn_to_virt(start_info.console.domU.mfn); err = bind_evtchn(dev->evtchn, console_handle_input, dev); if (err <= 0) { printk("XEN console request chn bind failed %i\n", err); free(dev); return NULL; } unmask_evtchn(dev->evtchn); /* In case we have in-flight data after save/restore... */ notify_daemon(dev); return dev; }
int xencons_ring_init(void) { int irq; if (xencons_irq) unbind_from_irqhandler(xencons_irq, NULL); xencons_irq = 0; if (!is_running_on_xen() || is_initial_xendomain() || !xen_start_info->console.domU.evtchn) return -ENODEV; irq = bind_caller_port_to_irqhandler( xen_start_info->console.domU.evtchn, handle_input, 0, "xencons", NULL); if (irq < 0) { printk(KERN_ERR "XEN console request irq failed %i\n", irq); return irq; } xencons_irq = irq; /* In case we have in-flight data after save/restore... */ notify_daemon(); return 0; }
int xencons_ring_send(struct consfront_dev *dev, const char *data, unsigned len) { int sent; sent = xencons_ring_send_no_notify(dev, data, len); notify_daemon(dev); return sent; }
void xencons_resume(struct consfront_dev *dev) { if (!dev) { unmask_evtchn(start_info.console.domU.evtchn); } else { unmask_evtchn(dev->evtchn); } notify_daemon(dev); }
int xencons_ring_send(void *dev, const char *data, unsigned int len) { int sent=0; for (int i=0; i<len; i++) { if (data[i] == '\n') { sent += xencons_ring_send_no_notify(dev, "\r\n", 2); } else sent += xencons_ring_send_no_notify(dev, &data[i], 1); } notify_daemon(dev); return sent; }
int xencons_ring_send(struct consfront_dev *dev, const char *data, unsigned len) { int sent = 0; int part; for (sent = 0; sent < len; sent += part) { part = xencons_ring_send_no_notify(dev, data + sent, len - sent); notify_daemon(dev); } ASSERT(sent == len); return sent; }
static int domU_read_console(uint32_t vtermno, char *buf, int len) { struct xencons_interface *intf = xencons_interface(); XENCONS_RING_IDX cons, prod; int recv = 0; cons = intf->in_cons; prod = intf->in_prod; mb(); /* get pointers before reading ring */ BUG_ON((prod - cons) > sizeof(intf->in)); while (cons != prod && recv < len) buf[recv++] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)]; mb(); /* read ring before consuming */ intf->in_cons = cons; notify_daemon(); return recv; }
static int write_console(uint32_t vtermno, const char *data, int len) { struct xencons_interface *intf = xencons_interface(); XENCONS_RING_IDX cons, prod; int sent = 0; cons = intf->out_cons; prod = intf->out_prod; mb(); /* update queue values before going on */ BUG_ON((prod - cons) > sizeof(intf->out)); while ((sent < len) && ((prod - cons) < sizeof(intf->out))) intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = data[sent++]; wmb(); /* write ring before updating pointer */ intf->out_prod = prod; notify_daemon(); return sent; }
int xencons_ring_send(const char *data, unsigned len) { int sent = 0; struct xencons_interface *intf = xencons_interface(); XENCONS_RING_IDX cons, prod; cons = intf->out_cons; prod = intf->out_prod; mb(); BUG_ON((prod - cons) > sizeof(intf->out)); while ((sent < len) && ((prod - cons) < sizeof(intf->out))) intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = data[sent++]; wmb(); intf->out_prod = prod; notify_daemon(); return sent; }
void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data) { struct consfront_dev *dev = (struct consfront_dev *) data; struct xencons_interface *intf = xencons_interface(); XENCONS_RING_IDX cons, prod; cons = intf->in_cons; prod = intf->in_prod; mb(); BUG_ON((prod - cons) > sizeof(intf->in)); while (cons != prod) { xencons_rx(intf->in+MASK_XENCONS_IDX(cons,intf->in), 1, regs); cons++; } mb(); intf->in_cons = cons; notify_daemon(dev); xencons_tx(); }
static irqreturn_t handle_input(int irq, void *unused, struct pt_regs *regs) { struct xencons_interface *intf = xencons_interface(); XENCONS_RING_IDX cons, prod; cons = intf->in_cons; prod = intf->in_prod; mb(); BUG_ON((prod - cons) > sizeof(intf->in)); while (cons != prod) { xencons_rx(intf->in+MASK_XENCONS_IDX(cons,intf->in), 1, regs); cons++; } mb(); intf->in_cons = cons; notify_daemon(); xencons_tx(); return IRQ_HANDLED; }
void tegra_display_on(struct early_suspend *h) { notify_daemon(STRING_PM_DISPLAY_ON); }
void hs_notify_daemon(struct consfront_dev *dev) { notify_daemon(dev); }