Lines Matching refs:cdev
107 static void cosm_update_mic_status(struct cosm_device *cdev) in cosm_update_mic_status() argument
109 if (cdev->shutdown_status_int != MIC_NOP) { in cosm_update_mic_status()
110 cosm_set_shutdown_status(cdev, cdev->shutdown_status_int); in cosm_update_mic_status()
111 cdev->shutdown_status_int = MIC_NOP; in cosm_update_mic_status()
116 static void cosm_shutdown_status_int(struct cosm_device *cdev, in cosm_shutdown_status_int() argument
126 dev_err(&cdev->dev, "%s %d Unexpected shutdown_status %d\n", in cosm_shutdown_status_int()
130 cdev->shutdown_status_int = shutdown_status; in cosm_shutdown_status_int()
131 cdev->heartbeat_watchdog_enable = false; in cosm_shutdown_status_int()
133 if (cdev->state != MIC_SHUTTING_DOWN) in cosm_shutdown_status_int()
134 cosm_set_state(cdev, MIC_SHUTTING_DOWN); in cosm_shutdown_status_int()
138 static void cosm_scif_recv(struct cosm_device *cdev) in cosm_scif_recv() argument
144 rc = scif_recv(cdev->epd, &msg, sizeof(msg), 0); in cosm_scif_recv()
148 dev_dbg(&cdev->dev, "%s: %d rc %d\n", in cosm_scif_recv()
152 dev_dbg(&cdev->dev, "%s: %d rc %d id 0x%llx\n", in cosm_scif_recv()
157 cosm_shutdown_status_int(cdev, msg.shutdown_status); in cosm_scif_recv()
163 dev_err(&cdev->dev, "%s: %d unknown msg.id %lld\n", in cosm_scif_recv()
171 static void cosm_set_crashed(struct cosm_device *cdev) in cosm_set_crashed() argument
173 dev_err(&cdev->dev, "node alive timeout\n"); in cosm_set_crashed()
174 cosm_shutdown_status_int(cdev, MIC_CRASHED); in cosm_set_crashed()
175 cosm_update_mic_status(cdev); in cosm_set_crashed()
179 static void cosm_send_time(struct cosm_device *cdev) in cosm_send_time() argument
189 rc = scif_send(cdev->epd, &msg, sizeof(msg), SCIF_SEND_BLOCK); in cosm_send_time()
191 dev_err(&cdev->dev, "%s %d scif_send failed rc %d\n", in cosm_send_time()
200 static void cosm_scif_close(struct cosm_device *cdev) in cosm_scif_close() argument
207 cosm_update_mic_status(cdev); in cosm_scif_close()
208 scif_close(cdev->epd); in cosm_scif_close()
209 cdev->epd = NULL; in cosm_scif_close()
210 dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__); in cosm_scif_close()
218 static int cosm_set_online(struct cosm_device *cdev) in cosm_set_online() argument
222 if (MIC_BOOTING == cdev->state || MIC_ONLINE == cdev->state) { in cosm_set_online()
223 cdev->heartbeat_watchdog_enable = cdev->sysfs_heartbeat_enable; in cosm_set_online()
224 cdev->epd = cdev->newepd; in cosm_set_online()
225 if (cdev->state == MIC_BOOTING) in cosm_set_online()
226 cosm_set_state(cdev, MIC_ONLINE); in cosm_set_online()
227 cosm_send_time(cdev); in cosm_set_online()
228 dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__); in cosm_set_online()
230 dev_warn(&cdev->dev, "%s %d not going online in state: %s\n", in cosm_set_online()
231 __func__, __LINE__, cosm_state_string[cdev->state]); in cosm_set_online()
235 put_device(&cdev->dev); in cosm_set_online()
248 struct cosm_device *cdev = container_of(work, struct cosm_device, in cosm_scif_work() local
253 mutex_lock(&cdev->cosm_mutex); in cosm_scif_work()
254 if (cosm_set_online(cdev)) in cosm_scif_work()
258 pollepd.epd = cdev->epd; in cosm_scif_work()
262 mutex_unlock(&cdev->cosm_mutex); in cosm_scif_work()
265 mutex_lock(&cdev->cosm_mutex); in cosm_scif_work()
267 dev_err(&cdev->dev, "%s %d scif_poll rc %d\n", in cosm_scif_work()
274 cosm_scif_recv(cdev); in cosm_scif_work()
278 cosm_scif_close(cdev); in cosm_scif_work()
283 if (!rc && cdev->heartbeat_watchdog_enable) in cosm_scif_work()
284 cosm_set_crashed(cdev); in cosm_scif_work()
287 dev_dbg(&cdev->dev, "%s %d exiting\n", __func__, __LINE__); in cosm_scif_work()
288 mutex_unlock(&cdev->cosm_mutex); in cosm_scif_work()
298 struct cosm_device *cdev; in cosm_scif_server() local
318 cdev = cosm_find_cdev_by_id(port_id.node - 1); in cosm_scif_server()
319 if (!cdev) in cosm_scif_server()
321 cdev->newepd = newepd; in cosm_scif_server()
322 schedule_work(&cdev->scif_work); in cosm_scif_server()