Lines Matching refs:cdev
105 static void cosm_update_mic_status(struct cosm_device *cdev) in cosm_update_mic_status() argument
107 if (cdev->shutdown_status_int != MIC_NOP) { in cosm_update_mic_status()
108 cosm_set_shutdown_status(cdev, cdev->shutdown_status_int); in cosm_update_mic_status()
109 cdev->shutdown_status_int = MIC_NOP; in cosm_update_mic_status()
114 static void cosm_shutdown_status_int(struct cosm_device *cdev, in cosm_shutdown_status_int() argument
124 dev_err(&cdev->dev, "%s %d Unexpected shutdown_status %d\n", in cosm_shutdown_status_int()
128 cdev->shutdown_status_int = shutdown_status; in cosm_shutdown_status_int()
129 cdev->heartbeat_watchdog_enable = false; in cosm_shutdown_status_int()
131 if (cdev->state != MIC_SHUTTING_DOWN) in cosm_shutdown_status_int()
132 cosm_set_state(cdev, MIC_SHUTTING_DOWN); in cosm_shutdown_status_int()
136 static void cosm_scif_recv(struct cosm_device *cdev) in cosm_scif_recv() argument
142 rc = scif_recv(cdev->epd, &msg, sizeof(msg), 0); in cosm_scif_recv()
146 dev_dbg(&cdev->dev, "%s: %d rc %d\n", in cosm_scif_recv()
150 dev_dbg(&cdev->dev, "%s: %d rc %d id 0x%llx\n", in cosm_scif_recv()
155 cosm_shutdown_status_int(cdev, msg.shutdown_status); in cosm_scif_recv()
161 dev_err(&cdev->dev, "%s: %d unknown msg.id %lld\n", in cosm_scif_recv()
169 static void cosm_set_crashed(struct cosm_device *cdev) in cosm_set_crashed() argument
171 dev_err(&cdev->dev, "node alive timeout\n"); in cosm_set_crashed()
172 cosm_shutdown_status_int(cdev, MIC_CRASHED); in cosm_set_crashed()
173 cosm_update_mic_status(cdev); in cosm_set_crashed()
177 static void cosm_send_time(struct cosm_device *cdev) in cosm_send_time() argument
183 rc = scif_send(cdev->epd, &msg, sizeof(msg), SCIF_SEND_BLOCK); in cosm_send_time()
185 dev_err(&cdev->dev, "%s %d scif_send failed rc %d\n", in cosm_send_time()
194 static void cosm_scif_close(struct cosm_device *cdev) in cosm_scif_close() argument
201 cosm_update_mic_status(cdev); in cosm_scif_close()
202 scif_close(cdev->epd); in cosm_scif_close()
203 cdev->epd = NULL; in cosm_scif_close()
204 dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__); in cosm_scif_close()
212 static int cosm_set_online(struct cosm_device *cdev) in cosm_set_online() argument
216 if (MIC_BOOTING == cdev->state || MIC_ONLINE == cdev->state) { in cosm_set_online()
217 cdev->heartbeat_watchdog_enable = cdev->sysfs_heartbeat_enable; in cosm_set_online()
218 cdev->epd = cdev->newepd; in cosm_set_online()
219 if (cdev->state == MIC_BOOTING) in cosm_set_online()
220 cosm_set_state(cdev, MIC_ONLINE); in cosm_set_online()
221 cosm_send_time(cdev); in cosm_set_online()
222 dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__); in cosm_set_online()
224 dev_warn(&cdev->dev, "%s %d not going online in state: %s\n", in cosm_set_online()
225 __func__, __LINE__, cosm_state_string[cdev->state]); in cosm_set_online()
229 put_device(&cdev->dev); in cosm_set_online()
242 struct cosm_device *cdev = container_of(work, struct cosm_device, in cosm_scif_work() local
247 mutex_lock(&cdev->cosm_mutex); in cosm_scif_work()
248 if (cosm_set_online(cdev)) in cosm_scif_work()
252 pollepd.epd = cdev->epd; in cosm_scif_work()
256 mutex_unlock(&cdev->cosm_mutex); in cosm_scif_work()
259 mutex_lock(&cdev->cosm_mutex); in cosm_scif_work()
261 dev_err(&cdev->dev, "%s %d scif_poll rc %d\n", in cosm_scif_work()
268 cosm_scif_recv(cdev); in cosm_scif_work()
272 cosm_scif_close(cdev); in cosm_scif_work()
277 if (!rc && cdev->heartbeat_watchdog_enable) in cosm_scif_work()
278 cosm_set_crashed(cdev); in cosm_scif_work()
281 dev_dbg(&cdev->dev, "%s %d exiting\n", __func__, __LINE__); in cosm_scif_work()
282 mutex_unlock(&cdev->cosm_mutex); in cosm_scif_work()
292 struct cosm_device *cdev; in cosm_scif_server() local
312 cdev = cosm_find_cdev_by_id(port_id.node - 1); in cosm_scif_server()
313 if (!cdev) in cosm_scif_server()
315 cdev->newepd = newepd; in cosm_scif_server()
316 schedule_work(&cdev->scif_work); in cosm_scif_server()