Lines Matching refs:cdev
95 static void cosm_update_mic_status(struct cosm_device *cdev) in cosm_update_mic_status() argument
97 if (cdev->shutdown_status_int != MIC_NOP) { in cosm_update_mic_status()
98 cosm_set_shutdown_status(cdev, cdev->shutdown_status_int); in cosm_update_mic_status()
99 cdev->shutdown_status_int = MIC_NOP; in cosm_update_mic_status()
104 static void cosm_shutdown_status_int(struct cosm_device *cdev, in cosm_shutdown_status_int() argument
114 dev_err(&cdev->dev, "%s %d Unexpected shutdown_status %d\n", in cosm_shutdown_status_int()
118 cdev->shutdown_status_int = shutdown_status; in cosm_shutdown_status_int()
119 cdev->heartbeat_watchdog_enable = false; in cosm_shutdown_status_int()
121 if (cdev->state != MIC_SHUTTING_DOWN) in cosm_shutdown_status_int()
122 cosm_set_state(cdev, MIC_SHUTTING_DOWN); in cosm_shutdown_status_int()
126 static void cosm_scif_recv(struct cosm_device *cdev) in cosm_scif_recv() argument
132 rc = scif_recv(cdev->epd, &msg, sizeof(msg), 0); in cosm_scif_recv()
136 dev_dbg(&cdev->dev, "%s: %d rc %d\n", in cosm_scif_recv()
140 dev_dbg(&cdev->dev, "%s: %d rc %d id 0x%llx\n", in cosm_scif_recv()
145 cosm_shutdown_status_int(cdev, msg.shutdown_status); in cosm_scif_recv()
151 dev_err(&cdev->dev, "%s: %d unknown msg.id %lld\n", in cosm_scif_recv()
159 static void cosm_set_crashed(struct cosm_device *cdev) in cosm_set_crashed() argument
161 dev_err(&cdev->dev, "node alive timeout\n"); in cosm_set_crashed()
162 cosm_shutdown_status_int(cdev, MIC_CRASHED); in cosm_set_crashed()
163 cosm_update_mic_status(cdev); in cosm_set_crashed()
167 static void cosm_send_time(struct cosm_device *cdev) in cosm_send_time() argument
177 rc = scif_send(cdev->epd, &msg, sizeof(msg), SCIF_SEND_BLOCK); in cosm_send_time()
179 dev_err(&cdev->dev, "%s %d scif_send failed rc %d\n", in cosm_send_time()
188 static void cosm_scif_close(struct cosm_device *cdev) in cosm_scif_close() argument
195 cosm_update_mic_status(cdev); in cosm_scif_close()
196 scif_close(cdev->epd); in cosm_scif_close()
197 cdev->epd = NULL; in cosm_scif_close()
198 dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__); in cosm_scif_close()
206 static int cosm_set_online(struct cosm_device *cdev) in cosm_set_online() argument
210 if (MIC_BOOTING == cdev->state || MIC_ONLINE == cdev->state) { in cosm_set_online()
211 cdev->heartbeat_watchdog_enable = cdev->sysfs_heartbeat_enable; in cosm_set_online()
212 cdev->epd = cdev->newepd; in cosm_set_online()
213 if (cdev->state == MIC_BOOTING) in cosm_set_online()
214 cosm_set_state(cdev, MIC_ONLINE); in cosm_set_online()
215 cosm_send_time(cdev); in cosm_set_online()
216 dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__); in cosm_set_online()
218 dev_warn(&cdev->dev, "%s %d not going online in state: %s\n", in cosm_set_online()
219 __func__, __LINE__, cosm_state_string[cdev->state]); in cosm_set_online()
223 put_device(&cdev->dev); in cosm_set_online()
236 struct cosm_device *cdev = container_of(work, struct cosm_device, in cosm_scif_work() local
241 mutex_lock(&cdev->cosm_mutex); in cosm_scif_work()
242 if (cosm_set_online(cdev)) in cosm_scif_work()
246 pollepd.epd = cdev->epd; in cosm_scif_work()
250 mutex_unlock(&cdev->cosm_mutex); in cosm_scif_work()
253 mutex_lock(&cdev->cosm_mutex); in cosm_scif_work()
255 dev_err(&cdev->dev, "%s %d scif_poll rc %d\n", in cosm_scif_work()
262 cosm_scif_recv(cdev); in cosm_scif_work()
266 cosm_scif_close(cdev); in cosm_scif_work()
271 if (!rc && cdev->heartbeat_watchdog_enable) in cosm_scif_work()
272 cosm_set_crashed(cdev); in cosm_scif_work()
275 dev_dbg(&cdev->dev, "%s %d exiting\n", __func__, __LINE__); in cosm_scif_work()
276 mutex_unlock(&cdev->cosm_mutex); in cosm_scif_work()
286 struct cosm_device *cdev; in cosm_scif_server() local
306 cdev = cosm_find_cdev_by_id(port_id.node - 1); in cosm_scif_server()
307 if (!cdev) in cosm_scif_server()
309 cdev->newepd = newepd; in cosm_scif_server()
310 schedule_work(&cdev->scif_work); in cosm_scif_server()