comparison src/g23m-gprs/gmm/gmm_kernp.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GPRS (8441)
4 | Modul : gmm_kernp.c
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This modul is part of the entity GMM and implements all
18 | functions to handles the incoming primitives as described in
19 | the SDL-documentation (KERN-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23
24
25 #ifndef GMM_KERNP_C
26 #define GMM_KERNP_C
27 #endif
28
29 #define ENTITY_GMM
30
31 /*==== INCLUDES =============================================================*/
32
33 #include "typedefs.h" /* to get Condat data types */
34 #include "vsi.h" /* to get a lot of macros */
35 #include "macdef.h"
36 #include "gprs.h"
37 #include "gsm.h" /* to get a lot of macros */
38 #include "ccdapi.h" /* to get CCD API */
39 #include "cnf_gmm.h" /* to get cnf-definitions */
40 #include "mon_gmm.h" /* to get mon-definitions */
41 #include "prim.h" /* to get the definitions of used SAP and directions */
42 #include "gmm.h" /* to get the global entity definitions */
43
44 #include "gmm_f.h" /* to ger the gobal functions */
45 #include "gmm_kernl.h" /* to ger the local functions */
46 #include "gmm_kernf.h" /* to ger the local functions */
47 #include "gmm_rdys.h" /* to get some signals */
48 #include <string.h> /* to get memcpy */
49 #include "gmm_txs.h" /* to get some signals */
50 #include "gmm_syncs.h"
51 #include "gmm_em.h" /* To get Engineering Mode functions */
52
53 /*==== CONST ================================================================*/
54
55 /*==== LOCAL VARS ===========================================================*/
56
57 /*==== PRIVATE FUNCTIONS ====================================================*/
58
59 /*==== PUBLIC FUNCTIONS =====================================================*/
60
61 /*
62 +------------------------------------------------------------------------------
63 | Function : kern_t3302
64 +------------------------------------------------------------------------------
65 | Description : Handles expiry of timer T3302. This function is called from
66 | pei_primitive().
67 | Timeout for Attach or RAU failure
68 | Parameters : none
69 |
70 +------------------------------------------------------------------------------
71 */
72 GLOBAL void kern_t3302(void)
73 {
74 GMM_TRACE_FUNCTION( "kern_t3302" );
75 TRACE_0_INFO("TIMEOUT T3302");
76 sig_kern_rdy_stop_t3302_req();
77 /*
78 * reset attach attempt counter
79 * <R.GMM.ATTACH.M.010>
80 */
81 /*
82 * reset rau attempt counter
83 * <R.GMM.ATTACH.M.010>
84 */
85
86
87 switch( GET_STATE( KERN ) )
88 {
89 case KERN_GMM_DEREG_RESUMING:
90 case KERN_GMM_DEREG_SUSPENDING:
91 case KERN_GMM_DEREG_SUSPENDED:
92 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=FALSE;
93 break;
94 case KERN_GMM_REG_SUSPENDING:
95 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=FALSE;
96 SET_STATE(GU,GU_UPDATE_NEEDED);
97 break;
98 case KERN_GMM_REG_RESUMING:
99 case KERN_GMM_REG_SUSPENDED:
100 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=FALSE;
101 SET_STATE(GU,GU_UPDATE_NEEDED);
102 break;
103 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
104 kern_attach_reset();
105 kern_attach ();
106 break;
107 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
108 kern_attach_reset();
109
110 if (PERIODIC_RAU == gmm_data->kern.attach_cap.update_proc_type)
111 {
112 /* 44.2.3.3.2 */
113 kern_periodic_rau();
114 }
115 else
116 {
117 kern_rau_limited();
118 }
119
120 break;
121 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
122 /*
123 * GPRS is still attached (normal service)
124 * so we need to resume LLC again
125 */
126 kern_attach_reset();
127 kern_rau();
128 break;
129 default:
130 TRACE_ERROR( "kern_t3302 unexpected" );
131 break;
132 }
133 GMM_RETURN;
134
135 } /* kern_t3302 */
136
137 /*
138 +------------------------------------------------------------------------------
139 | Function : kern_t3310
140 +------------------------------------------------------------------------------
141 | Description : Handles expiry of timer T3310. This function is called from
142 | pei_primitive().
143 | Timeout for ATTACH
144 | Parameters : none
145 |
146 +------------------------------------------------------------------------------
147 */
148 GLOBAL void kern_t3310 (void)
149 {
150 GMM_TRACE_FUNCTION( "kern_t3310" );
151 TRACE_0_INFO("TIMEOUT T3310");
152
153 gmm_data->kern.attach_cap.t3310_value=0;
154
155 switch( GET_STATE( KERN ) )
156 {
157 case KERN_GMM_REG_INITIATED:
158 /************************************************************************
159 * MSC: 3.8 Attach
160 *
161 * MSC: 3.8.1 Normal Attach
162 * MSC: 3.8.1.4 Abnormal cases
163 * MSC: 3.8.1.4.3 c) T3310 time-out
164 ************************************************************************/
165 if ( gmm_data->kern.ct3310 < MAX_CT3310 )
166 {
167 /*
168 * ATTACH
169 * <R.GMM.AGABNORM.M.007>
170 */
171 kern_gmmreg_detach ( GMMREG_DT_GPRS,
172 GMMCS_NET_FAIL, /* TCS 2.1 */
173 GMMREG_SEARCH_RUNNING,
174 GMMCS_NET_FAIL);
175
176 kern_attach();
177 }
178 else
179 {
180 /*
181 * AAC
182 *<R.GMM.AGABNORM.M.008>
183 */
184 kern_aac(GMMCS_NO_SERVICE); /* TCS 2.1 */
185 }
186
187 break;
188 case KERN_GMM_RAU_INITIATED:
189 /************************************************************************
190 * MSC: 3.10 RAU
191 *
192 * MSC: 3.10.1 Normal and periodic RAU initiation
193 * MSC: 3.10.1.4 Abnormal cases
194 * MSC: 3.10.1.4.3 c) T3310 time-out
195 *
196 ************************************************************************/
197 /*
198 * I reused the timer T3310 instead of T3330
199 */
200 if ( gmm_data->kern.ct3310 < MAX_CT3310 )
201 {
202 if (PERIODIC_RAU == gmm_data->kern.attach_cap.update_proc_type)
203 {
204 /* 44.2.3.3.2 */
205 kern_periodic_rau();
206 }
207 else
208 {
209 kern_rau_limited();
210 }
211 }
212 else
213 {
214 /*
215 * AAC
216 */
217 kern_aac(GMMCS_NO_SERVICE); /* TCS 2.1 */
218 }
219 break;
220 /* START PATCH UBUOB ISSUE 8274 */
221 case KERN_GMM_REG_RESUMING:
222 case KERN_GMM_REG_SUSPENDING:
223 case KERN_GMM_REG_SUSPENDED:
224 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = FALSE;
225 SET_STATE(GU,GU_UPDATE_NEEDED);
226 break;
227 /* END PATCH UBUOB ISSUE 8274 */
228 case KERN_GMM_REG_LIMITED_SERVICE:
229 TRACE_EVENT("T3310 ignored in limited mode");
230 break;
231 default:
232 TRACE_ERROR( "kern_t3310 unexpected" );
233 break;
234 }
235 GMM_RETURN;
236 } /* kern_t3310 */
237 /*
238 +------------------------------------------------------------------------------
239 | Function : kern_t3311
240 +------------------------------------------------------------------------------
241 | Description : Handles expiry of timer T3310. This function is called from
242 | pei_primitive().
243 | Timeout for ATTACH or RAU Reject
244 | Parameters : none
245 |
246 +------------------------------------------------------------------------------
247 */
248 GLOBAL void kern_t3311 (void)
249 {
250 GMM_TRACE_FUNCTION( "kern_t3311" );
251 TRACE_0_INFO("TIMEOUT T3311");
252 switch( GET_STATE( KERN ) )
253 {
254 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
255 kern_attach ();
256 break;
257 case KERN_GMM_REG_NORMAL_SERVICE:
258 /*
259 * <R.GMM.RNABNORM.M.022>
260 */
261 kern_periodic_rau();
262 break;
263 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
264 kern_llgmm_suspend(LLGMM_RAU);
265 /*FALLTHROUGH*/
266 //lint -fallthrough
267 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
268 kern_rau_limited ();
269 break;
270 /* START PATCH UBUOB ISSUE 8893 */
271 case KERN_GMM_DEREG_SUSPENDING:
272 case KERN_GMM_DEREG_SUSPENDED:
273 case KERN_GMM_DEREG_RESUMING:
274 /* END PATCH UBUOB ISSUE 8893 */
275 case KERN_GMM_REG_RESUMING:
276 /* START PATCH UBUOB ISSUE 8273 */
277 case KERN_GMM_REG_SUSPENDING:
278 case KERN_GMM_REG_SUSPENDED:
279 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = FALSE;
280 SET_STATE(GU,GU_UPDATE_NEEDED);
281 break;
282 /* END PATCH UBUOB ISSUE 8273 */
283 default:
284 TRACE_ERROR( "kern_t3311 unexpected" );
285 break;
286 }
287
288 GMM_RETURN;
289 } /* kern_t3311 */
290 /*
291 +------------------------------------------------------------------------------
292 | Function : kern_t3312
293 +------------------------------------------------------------------------------
294 | Description : Handles expiry of timer T3312. This function is called from
295 | pei_primitive().
296
297 | Periodic RAU timer
298 | Parameters : none
299 |
300 +------------------------------------------------------------------------------
301 */
302 GLOBAL void kern_t3312 (void)
303 {
304 GMM_TRACE_FUNCTION( "kern_t3312" );
305 TRACE_0_INFO("TIMEOUT T3312");
306 switch( GET_STATE( KERN ) )
307 {
308
309 case KERN_GMM_REG_NORMAL_SERVICE:
310 if (GMM_GRR_STATE_CR==gmm_data->kern.attach_cap.grr_state)
311 {
312 gmm_data->kern.timeout_t3312 = TRUE;
313 SET_STATE(GU,GU_UPDATE_NEEDED);
314 }
315 else
316 {
317 kern_periodic_rau();
318 }
319 break;
320 case KERN_GMM_REG_NO_CELL_AVAILABLE:
321 /*
322 * 24.008 ch 4.7.2.2. at the end:
323 *
324 * If the MS is both IMSI attached for GPRS and non-GPRS services in a network that
325 * operates in network operation mode I, and if the MS has camped on a cell that does
326 * not support GPRS, and timer T3312 expires, then the MS shall start an MM location
327 * updating procedure. In addition, the MS shall perform a combined routing area update
328 * procedure indicating "combined RA/LA updating with IMSI attach" when the MS enters
329 * a cell that supports GPRS and indicates that the network is in operation mode I.
330 */
331 gmm_data->kern.timeout_t3312 = TRUE;
332 SET_STATE(GU,GU_UPDATE_NEEDED);
333
334 if (GMM_MM_DEREG != GET_STATE(MM)
335 && GMMRR_LA_INVALID!=gmm_data->kern.sig_cell_info.env.rai.lac)
336 {
337 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING);
338 #ifdef FF_EM_MODE
339 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING);
340 #endif
341 kern_llgmm_suspend(LLGMM_CALL); /* in no cell availble LLC is alread susended */
342 kern_gmmrr_suspend(GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
343 }
344 break;
345
346
347 case KERN_GMM_REG_LIMITED_SERVICE:
348 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
349 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
350 case KERN_GMM_REG_RESUMING:
351 case KERN_GMM_REG_SUSPENDING:
352 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
353 case KERN_GMM_REG_SUSPENDED:
354 /* no break; */
355 /*
356 * <R.GMM.RAUTIMER.M.009>
357 */
358 gmm_data->kern.timeout_t3312 = TRUE;
359 SET_STATE(GU,GU_UPDATE_NEEDED);
360 break;
361 default:
362 break;
363 }
364
365 GMM_RETURN;
366 } /* kern_t3312 */
367 /*
368 +------------------------------------------------------------------------------
369 | Function : kern_t3321
370 +------------------------------------------------------------------------------
371 | Description : Handles expiry of timer T3321. This function is called from
372 | pei_primitive().
373 | Timeout for DETACH
374 |
375 | MSC: 3.9 GPRS detach procedure
376 |
377 | MCS: 3.9.3 Abnormal cases
378 | MSC: 3.9.3.1 a) Timeout of timer T3321
379 |
380 | Parameters : none
381 |
382 +------------------------------------------------------------------------------
383 */
384 GLOBAL void kern_t3321 (void)
385 {
386
387 #ifdef REL99
388 T_gmobile_identity gmobile_identity; /* TCS 4.0 */
389 #endif
390
391 GMM_TRACE_FUNCTION( "kern_t3321" );
392 TRACE_0_INFO("TIMEOUT T3321");
393 /*
394 * MSC: 3.9 GPRS detach procedure
395 *
396 * MCS: 3.9.3 Abnormal cases
397 * MSC: 3.9.3.1 a) Timeout of timer T3321
398 */
399 if ( ++gmm_data->kern.ct3321 < 5 )
400 {
401 MCAST (u_detach_request, U_DETACH_REQUEST);
402
403 TRACE_EVENT (" START T3321" );
404 sig_kern_rdy_start_timer_req ( kern_T3321, gmm_data->kern.t3321_val );
405
406 u_detach_request->u_detach_type.u_type_of_detach
407 = gmm_data->kern.detach_cap.detach_type,
408 u_detach_request->u_detach_type.power_off = PO_NORMAL_DETACH;
409
410
411 #ifdef REL99
412 /* Detach request sent to a Release 99 network has two addional
413 * parameters. PTMSI and PTMSI signature
414 */
415 switch (gmm_data->kern.sig_cell_info.sgsnr_flag)/*!gmm_data->release99 =>old code*/ /* TCS 4.0 */
416 {
417 default:
418 case PS_SGSN_UNKNOWN:
419 case PS_SGSN_98_OLDER:
420 u_detach_request->v_gmobile_identity = FALSE; /* TCS 4.0 */
421 u_detach_request->v_p_tmsi_signature_2 = FALSE; /* TCS 4.0 */
422 break;
423 case PS_SGSN_99_ONWARDS:
424 /*
425 * PTMSI
426 */
427 kern_ulong2mobile_identity( gmm_data->ptmsi.current, &gmobile_identity ); /* TCS 4.0 */
428 u_detach_request->v_gmobile_identity = TRUE; /* TCS 4.0 */
429 u_detach_request->gmobile_identity = gmobile_identity; /* TCS 4.0 */
430
431 /*
432 * PTMSI Signature
433 */
434 if(gmm_data->ptmsi_signature.available) /* TCS 4.0 */
435 { /* TCS 4.0 */
436 u_detach_request->v_p_tmsi_signature_2 =TRUE; /* TCS 4.0 */
437 u_detach_request->p_tmsi_signature_2.p_tmsi_signature_value /* TCS 4.0 */
438 = gmm_data->ptmsi_signature.value; /* TCS 4.0 */
439 } /* TCS 4.0 */
440 else /* TCS 4.0 */
441 { /* TCS 4.0 */
442 u_detach_request->v_p_tmsi_signature_2=FALSE; /* TCS 4.0 */
443 } /* TCS 4.0 */
444 break;
445 }
446 #endif
447
448
449 switch ( gmm_data->kern.detach_cap.detach_type )
450 {
451 case GMMREG_DT_GPRS:
452 u_detach_request->u_detach_type.u_type_of_detach
453 = DT_GPRS;
454 break;
455 case GMMREG_DT_IMSI:
456 u_detach_request->u_detach_type.u_type_of_detach
457 = DT_IMSI;
458 break;
459 case GMMREG_DT_COMB:
460 u_detach_request->u_detach_type.u_type_of_detach
461 = DT_COMB;
462 break;
463 case GMMREG_DT_SIM_REMOVED:
464 if ( GMM_MM_DEREG != GET_STATE(MM) )
465 {
466 u_detach_request->u_detach_type.u_type_of_detach
467 = DT_COMB;
468 }
469 else
470 {
471 u_detach_request->u_detach_type.u_type_of_detach
472 = DT_GPRS;
473 }
474 break;
475 default:
476 TRACE_ERROR ("unexpexted GMMREG_DT_TYPE");
477 break;
478 }
479 kern_mm_detach_started ();
480 sig_kern_tx_data_req ( CURRENT_TLLI, U_DETACH_REQUEST);
481 }
482 else
483 {
484 switch( GET_STATE( KERN ) )
485 {
486 case KERN_GMM_DEREG_INITIATED:
487 kern_local_detach( GMMCS_INT_NOT_PRESENT, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_DEREG); /* TCS 2.1 */
488 break;
489 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
490 /*
491 * <R.GMM.DMABNORM.M.020>
492 */
493 kern_local_detach( GMMCS_INT_NOT_PRESENT, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_REG_NORMAL); /* TCS 2.1 */
494 break;
495 default:
496 TRACE_ERROR( "kern_t3321 unexpected" );
497 break;
498 }
499 }
500 GMM_RETURN;
501 } /* kern_t3321 */
502 /*
503 +------------------------------------------------------------------------------
504 | Function : kern_tpower_off
505 +------------------------------------------------------------------------------
506 | Description : Handles expiry of timer Tpower_off. This function is called from
507 | pei_primitive().
508 | Timeout for power_off after sending DETACH message
509 | Parameters : none
510 |
511 +------------------------------------------------------------------------------
512 */
513 GLOBAL void kern_tpower_off (void)
514 {
515 GMM_TRACE_FUNCTION( "kern_tpower_off" );
516 TRACE_0_INFO("TIMEOUT TPOWER_OFF");
517 kern_local_detach( GMMCS_POWER_OFF, FALSE, /* TCS 2.1 */
518 GMMREG_DT_SOFT_OFF==gmm_data->kern.detach_cap.detach_type?
519 GMM_LOCAL_DETACH_PROC_SOFT_OFF:
520 GMM_LOCAL_DETACH_PROC_POWER_OFF);
521
522 GMM_RETURN;
523
524 } /* kern_tpower_off */
525
526 /*
527 +------------------------------------------------------------------------------
528 | Function : kern_tlocal_detach
529 +------------------------------------------------------------------------------
530 | Description : Handles expiry of timer Tlocal_detach. This function is called from
531 | pei_primitive().
532 | function local_detach is called to locally detach the MS.
533 | GRR and LLC can not unassigned immediately. So GMM waits untill
534 | the tlocal_detach timer has been expired or either CGRLC_TRIGGER_IND
535 | has been received or GMMRR_SUSPEND_CNF has been received.
536 | Parameters : none
537 |
538 +------------------------------------------------------------------------------
539 */
540 GLOBAL void kern_tlocal_detach (void)
541 {
542 GMM_TRACE_FUNCTION( "kern_tlocal_detach" );
543
544
545 switch( GET_STATE( KERN ) )
546 {
547 default:
548 TRACE_ERROR("tlocal_detach not in state DEREG_SUSPENDING");
549 /* NO break; */
550 case KERN_GMM_DEREG_SUSPENDING:
551 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE,
552 GMM_SUSP_UNKNOWN);
553
554 break;
555 }
556
557 GMM_RETURN ;
558 } /* kern_tlocal_detach */
559
560
561
562
563 /*
564 +------------------------------------------------------------------------------
565 | Function : kern_gmmreg_net_req
566 +------------------------------------------------------------------------------
567 | Description : Handles the primitive GMMREG_NET_REQ
568 |
569 | MSC: 3.20 MM Interface
570 | MSC: 3.20.2 Network selection
571 |
572 | Parameters : *gmmreg_net_req - Ptr to primitive payload
573 |
574 +------------------------------------------------------------------------------
575 */
576 GLOBAL void kern_gmmreg_net_req ( T_GMMREG_NET_REQ *gmmreg_net_req )
577 {
578 GMM_TRACE_FUNCTION( "kern_gmmreg_net_req" );
579
580 PFREE (gmmreg_net_req);
581 kern_mm_net_req();
582 GMM_RETURN;
583 } /* kern_gmmreg_net_req() */
584
585 /*
586 +------------------------------------------------------------------------------
587 | Function : kern_gmmreg_plmn_res
588 +------------------------------------------------------------------------------
589 | Description : Handles the primitive GMMREG_PLMN_RES
590 |
591 | MSC: 3.20 MM Interface
592 | MSC: 3.20.2 Network selection
593 |
594 | Parameters : *gmmreg_plmn_res - Ptr to primitive payload
595 |
596 +------------------------------------------------------------------------------
597 */
598 GLOBAL void kern_gmmreg_plmn_res ( T_GMMREG_PLMN_RES *gmmreg_plmn_res )
599 {
600 GMM_TRACE_FUNCTION( "kern_gmmreg_plmn_res" );
601
602 gmm_data->kern.attach_cap.network_selection_mode=MODE_MAN;
603 kern_remove_plmn_from_forbidden_list(gmmreg_plmn_res->plmn);
604
605 /* START PATCH UBUOB ISSUE 8276 */
606 /* T3302 should not be stopped here, because this is dangerous if the */
607 /* user selection does not lead to a different PLMN */
608 /*vsi_t_stop ( GMM_handle, kern_T3302);*/
609 /*sig_kern_rdy_start_t3302_req();*/
610 /* END PATCH UBUOB ISSUE 8276 */
611
612 /* When we receive manual mode network selection stop TSYNC timer */
613 vsi_t_stop ( GMM_handle, sync_TSYNC);
614
615 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = FALSE;
616 /*
617 * attach_cap.gmmreg sets the caller of the attach procedure to MMI
618 */
619 gmm_data->kern.attach_cap.gmmreg = TRUE;
620 /*
621 * if the moble has been rejected with cause #11,#12, or #13 it has to igored
622 * when user wanted the moile explicitly to try to attach
623 * TC 44.2.1.1.4.3.2
624 */
625 gmm_data->kern.detach_cap.error_cause=GMMCS_INT_NOT_PRESENT; /* TCS 2.1 */
626
627 /* Setting mm_status to FULL Service immediately on receiving PLMN Response creates a false display
628 * on MMI if selecting forbidden PLMN second time in a row. However, it is necessary in case of Normal PLMN selection
629 * for an early indication to ACI. Hence setting mm_status to Full Service only if the selected PLMN was not rejected by
630 * the N/W in the same power cycle.
631 */
632 if((memcmp(gmm_data->kern.attach_cap.list_of_forbidden_plmns_for_gprs_service[0].mcc,gmmreg_plmn_res->plmn.mcc, SIZE_MCC) NEQ 0) AND
633 (memcmp(gmm_data->kern.attach_cap.list_of_forbidden_plmns_for_gprs_service[0].mnc,gmmreg_plmn_res->plmn.mnc, SIZE_MNC)NEQ 0))
634 {
635 gmm_data->kern.sig_cell_info.mm_status = MMGMM_FULL_SERVICE;
636 sig_kern_sync_set_mm_state(MMGMM_FULL_SERVICE);
637 }
638
639 #ifndef NTRACE
640 /*
641 * My assumption is, that I have to know the class if plmn_res comes as power
642 * on primitive with AT+COPS=1,2,"001001". There are no possabilities to
643 * change the classes. a class change is handeled with attach_req
644 */
645 if(gmm_data->kern.attach_cap.mobile_class!=gmmreg_plmn_res->mobile_class)
646 {
647 TRACE_ERROR("class change not expected: NO DETACH_REQ will be send!");
648 }
649 #endif
650 gmm_data->kern.attach_cap.plmn_requested = gmmreg_plmn_res->plmn;
651 gmm_data->kern.attach_cap.mobile_class = gmmreg_plmn_res->mobile_class;
652 gmm_data->kern.attach_cap.attach_type = gmmreg_plmn_res->attach_type;
653 #ifndef NTRACE
654 switch ( gmm_data->kern.attach_cap.mobile_class )
655 {
656 case GMMREG_CLASS_CC:
657 TRACE_0_PARA ("MS class CC");
658 break;
659 case GMMREG_CLASS_CG:
660 TRACE_0_PARA ("MS class CG");
661 break;
662 case GMMREG_CLASS_B:
663 TRACE_0_PARA ("MS class B");
664 break;
665 case GMMREG_CLASS_BG:
666 TRACE_0_PARA ("MS class BG");
667 break;
668 case GMMREG_CLASS_BC:
669 TRACE_0_PARA ("MS class BC");
670 break;
671 case GMMREG_CLASS_A:
672 TRACE_0_PARA ("MS class A");
673 break;
674 default:
675 TRACE_ERROR ("unknown mobile class");
676 break;
677 }
678 switch (gmm_data->kern.attach_cap.attach_type)
679 {
680 case GMMREG_AT_IMSI:
681 TRACE_EVENT ("----- GSM only attach -----");
682 break;
683 case GMMREG_AT_GPRS:
684 TRACE_EVENT ("----- GPRS attach -----");
685 break;
686 case GMMREG_AT_COMB:
687 TRACE_EVENT ("----- GSM and GPRS attach -----");
688 break;
689 default:
690 TRACE_ERROR ("unknown attach type");
691 break;
692 }
693
694 #endif
695 {
696 PALLOC ( mmgmm_plmn_res, MMGMM_PLMN_RES);
697 mmgmm_plmn_res->plmn = gmmreg_plmn_res->plmn;
698 mmgmm_plmn_res->reg_type = REG_CELL_SEARCH_ONLY;
699 PFREE (gmmreg_plmn_res);
700
701 switch( GET_STATE( KERN ) )
702 {
703 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
704 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
705 mmgmm_plmn_res->reg_type = REG_GPRS_INACTIVE;
706 break;
707 case KERN_GMM_NULL_NO_IMSI:
708 if (GMMREG_CLASS_CC==gmm_data->kern.attach_cap.mobile_class
709 || GMMREG_AT_IMSI== gmm_data->kern.attach_cap.attach_type)
710 {
711 /* NO state change */
712 }
713 else
714 {
715 SET_STATE ( KERN, KERN_GMM_DEREG_NO_IMSI);
716 #ifdef FF_EM_MODE
717 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI);
718 #endif
719 }
720 mmgmm_plmn_res->reg_type = REG_GPRS_INACTIVE;
721
722 break;
723
724 case KERN_GMM_DEREG_RESUMING:
725 case KERN_GMM_REG_RESUMING:
726 case KERN_GMM_DEREG_NO_IMSI:
727 break;
728 /*
729 * GMM-DEREGISTERED
730 */
731 case KERN_GMM_DEREG_SUSPENDING:
732 /*
733 * not reachable beause of save in pei
734 */
735 case KERN_GMM_DEREG_SUSPENDED:
736 kern_resume_grr_der();
737 /* NO break;*/
738 case KERN_GMM_DEREG_PLMN_SEARCH:
739 case KERN_GMM_DEREG_LIMITED_SERVICE:
740 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
741 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
742 if (GMMREG_CLASS_CC==gmm_data->kern.attach_cap.mobile_class
743 || GMMREG_AT_IMSI== gmm_data->kern.attach_cap.attach_type)
744 {
745 SET_STATE ( KERN, KERN_GMM_NULL_PLMN_SEARCH);
746 #ifdef FF_EM_MODE
747 EM_GMM_SET_STATE(KERN_GMM_NULL_PLMN_SEARCH);
748 #endif
749 mmgmm_plmn_res->reg_type = REG_GPRS_INACTIVE;
750 }
751 else
752 {
753 SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH);
754 #ifdef FF_EM_MODE
755 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH);
756 #endif
757 }
758
759 break;
760
761 case KERN_GMM_NULL_PLMN_SEARCH:
762 case KERN_GMM_NULL_IMSI:
763
764 if (GMMREG_CLASS_CC==gmm_data->kern.attach_cap.mobile_class
765 || GMMREG_AT_IMSI== gmm_data->kern.attach_cap.attach_type)
766 {
767 SET_STATE ( KERN, KERN_GMM_NULL_PLMN_SEARCH);
768 #ifdef FF_EM_MODE
769 EM_GMM_SET_STATE(KERN_GMM_NULL_PLMN_SEARCH);
770 #endif
771 mmgmm_plmn_res->reg_type = REG_GPRS_INACTIVE;
772 }
773 else
774 {
775 SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH);
776 #ifdef FF_EM_MODE
777 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH);
778 #endif
779 kern_gmmrr_enable();
780 }
781
782 break;
783
784 case KERN_GMM_REG_NORMAL_SERVICE:
785
786 case KERN_GMM_REG_NO_CELL_AVAILABLE:
787 case KERN_GMM_REG_LIMITED_SERVICE:
788 case KERN_GMM_RAU_INITIATED:
789 case KERN_GMM_REG_INITIATED:
790 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
791 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
792 break;
793 case KERN_GMM_REG_SUSPENDING:
794 /*
795 * not reachablebeause of save in pei
796 */
797 case KERN_GMM_REG_SUSPENDED:
798 /*
799 * Attach requests in suspended mode will be handled after resumption
800 * by triggering form GRR with GMMRR_CELL_IND
801 */
802
803 /*
804 * The user is not allowed to change the mobile class or establish a
805 * voice call the same time manuall network search is started. it would
806 * not be nice
807 */
808 kern_resume_grr_reg();
809
810 TRACE_ERROR("I hoped, that this never is happened, ...");
811 break;
812 default:
813 TRACE_ERROR( "GMMREG_PLMN_RES unexpected" );
814 break;
815
816 }
817 mmgmm_plmn_res->mobile_class=gmm_data->kern.attach_cap.mobile_class;
818 PSEND ( hCommMM, mmgmm_plmn_res );
819 }
820 GMM_RETURN;
821 } /* kern_gmmreg_plmn_res() */
822
823 /*
824 +------------------------------------------------------------------------------
825 | Function : kern_gmmreg_plmn_mode_req
826 +------------------------------------------------------------------------------
827 | Description : Handles the primitive GMMREG_PLMN_MODE_REQ
828 |
829 | MSC: 3.20 MM Interface
830 | MSC: 3.20.1 Change of PLMN Mode
831 |
832 | Parameters : *gmmreg_plmn_mode_req - Ptr to primitive payload
833 |
834 +------------------------------------------------------------------------------
835 */
836 GLOBAL void kern_gmmreg_plmn_mode_req ( T_GMMREG_PLMN_MODE_REQ *gmmreg_plmn_mode_req )
837 {
838 GMM_TRACE_FUNCTION( "kern_gmmreg_plmn_mode_req" );
839 {
840 PPASS ( gmmreg_plmn_mode_req, mmgmm_plmn_mode_req, MMGMM_PLMN_MODE_REQ );
841 /*
842 * PATCH UBUOB 11.3.02: if we change from MANUAL to AUTOMATC or vice versa,
843 * then we need to clear the limited_service flag
844 * Problem was: Bouyg SIM, manual registration on SFR upon return to
845 * auto mode, first GPRS ATTACH
846
847 if (gmm_data->kern.attach_cap.network_selection_mode
848 != gmmreg_plmn_mode_req->net_selection_mode)
849 {
850 gmm_data->kern.sig_cell_info.mm_status = MMGMM_FULL_SERVICE;
851 sig_kern_sync_set_mm_state(MMGMM_FULL_SERVICE);
852 }
853 */
854 /*
855 * PLMN mode set to manual mode with PLMN_RES only
856 gmm_data->kern.attach_cap.network_selection_mode =
857 gmmreg_plmn_mode_req->net_selection_mode;
858 */
859 if (GMMREG_NET_SEL_MODE_AUTO == gmmreg_plmn_mode_req->net_selection_mode)
860 {
861 gmm_data->kern.attach_cap.network_selection_mode =
862 gmmreg_plmn_mode_req->net_selection_mode;
863 }
864 else
865 {
866 TRACE_0_INFO ("manual mode ignored. will be set with PLMN_RES");
867 }
868
869 PSEND ( hCommMM, mmgmm_plmn_mode_req );
870 }
871 GMM_RETURN;
872 } /* kern_gmmreg_plmn_mode_req () */
873
874 /*
875 +------------------------------------------------------------------------------
876 | Function : kern_gmmreg_config_req
877 +------------------------------------------------------------------------------
878 | Description : Handles the primitive GMMREG_CONFIG_REQ
879 |
880 | Parameters : *gmmreg_config_req - Ptr to primitive payload
881 |
882 +------------------------------------------------------------------------------
883 */
884 GLOBAL void kern_gmmreg_config_req ( T_GMMREG_CONFIG_REQ *gmmreg_config_req )
885 {
886 GMM_TRACE_FUNCTION( "kern_gmmreg_config_req" );
887 gmm_data->config.cipher_on
888 = gmmreg_config_req->cipher_on;
889 PFREE (gmmreg_config_req);
890 GMM_RETURN;
891 } /* kern_gmmreg_plmn_mode_req () */
892 /*
893 +------------------------------------------------------------------------------
894 | Function : kern_gmmreg_detach_req
895 +------------------------------------------------------------------------------
896 | Description : Handles the primitive GMMREG_DETACH_REQ
897 |
898 | Parameters : *gmmreg_detach_req - Ptr to primitive payload
899 |
900 +------------------------------------------------------------------------------
901 */
902 GLOBAL void kern_gmmreg_detach_req ( T_GMMREG_DETACH_REQ *gmmreg_detach_req )
903 {
904 GMM_TRACE_FUNCTION( "kern_gmmreg_detach_req" );
905
906 /*
907 * RAU may interrupt detach procedure, so we have to store the detach type
908 */
909 gmm_data->kern.detach_cap.detach_type=gmmreg_detach_req->detach_type;
910 gmm_data->kern.detach_cap.gmmreg=TRUE;
911
912 switch (gmmreg_detach_req->detach_type)
913 {
914 case GMMREG_DT_GPRS:
915 switch(gmm_data->kern.attach_cap.attach_type)
916 {
917 case GMMREG_AT_GPRS:
918 case GMMREG_AT_NOT_KNOWN:
919 gmm_data->kern.attach_cap.attach_type=GMMREG_AT_NOT_KNOWN;
920 break;
921 default:
922 case GMMREG_AT_IMSI:
923 case GMMREG_AT_COMB:
924 gmm_data->kern.attach_cap.attach_type=GMMREG_AT_IMSI;
925 break;
926 }
927 TRACE_EVENT ("Para: GPRS detach");
928 break;
929 case GMMREG_DT_IMSI:
930 gmm_data->kern.attach_cap.attach_type=
931 (GMMREG_CLASS_CC == gmm_data->kern.attach_cap.mobile_class?
932 GMMREG_AT_NOT_KNOWN:
933 GMMREG_AT_GPRS);
934 TRACE_EVENT ("Para: IMSI detach");
935 break;
936 case GMMREG_DT_POWER_OFF:
937 /*
938 * TMSI reset to remove TMSI in GRR when gmmrr_assign_req will
939 * be sent
940 */
941 gmm_data->tmsi = GMMRR_TMSI_INVALID;
942 gmm_data->kern.attach_cap.attach_type=GMMREG_AT_NOT_KNOWN;
943 gmm_data->kern.attach_cap.network_selection_mode=MODE_AUTO;
944 TRACE_EVENT ("Para: Power OFF");
945 break;
946 case GMMREG_DT_SOFT_OFF:
947 /*
948 * TMSI reset to remove TMSI in GRR when gmmrr_assign_req will
949 * be sent
950 */
951 gmm_data->tmsi = GMMRR_TMSI_INVALID;
952 gmm_data->kern.attach_cap.attach_type=GMMREG_AT_NOT_KNOWN;
953 TRACE_EVENT ("Para: Soft OFF");
954 break;
955 case GMMREG_DT_COMB:
956 gmm_data->kern.attach_cap.service_mode=SERVICE_MODE_LIMITED;
957 gmm_data->kern.attach_cap.attach_type=GMMREG_AT_NOT_KNOWN;
958 TRACE_EVENT ("Para: GMMREG_DT_COMB");
959 break;
960 case GMMREG_DT_SIM_REMOVED:
961 gmm_data->kern.attach_cap.attach_type=GMMREG_AT_NOT_KNOWN;
962 TRACE_EVENT ("Para: GMMREG_DT_SIM_REMOVED");
963 break;
964 case GMMREG_DT_DISABLE_GPRS:
965 TRACE_EVENT ("Para: GMMREG_DT_DISABLE_GPRS");
966 break;
967 case GMMREG_DT_LIMITED_SERVICE:
968 gmm_data->kern.attach_cap.service_mode=SERVICE_MODE_LIMITED;
969 TRACE_EVENT ("Para: GMMREG_DT_LIMITED_SERVICE");
970 break;
971 default:
972 gmm_data->kern.attach_cap.attach_type=
973 (GMMREG_CLASS_CG == gmm_data->kern.attach_cap.mobile_class?
974 GMMREG_AT_NOT_KNOWN:
975 GMMREG_AT_IMSI);
976 vsi_o_ttrace(VSI_CALLER TC_ERROR,"Error: Unknown detach_type = %x", gmmreg_detach_req->detach_type);
977 break;
978
979
980 }
981
982 gmm_data->kern.detach_cap.detach_type = gmmreg_detach_req->detach_type;
983
984 gmm_data->kern.detach_cap.gmmreg = TRUE;
985 gmm_data->kern.attach_cap.gmmreg = FALSE;
986 #ifndef GMM_TCS4
987 gmm_data->kern.attach_cap.gmmsm = FALSE;
988 #endif
989
990 PFREE ( gmmreg_detach_req );
991
992 switch( GET_STATE( KERN ) )
993 {
994 case KERN_GMM_REG_LIMITED_SERVICE:
995 case KERN_GMM_REG_NO_CELL_AVAILABLE:
996 case KERN_GMM_REG_TEST_MODE:
997 case KERN_GMM_REG_TEST_MODE_NO_IMSI:
998 switch ( gmm_data->kern.detach_cap.detach_type )
999 {
1000 case GMMREG_DT_IMSI:
1001 case GMMREG_DT_COMB:
1002 case GMMREG_DT_SIM_REMOVED:
1003 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDED);
1004 #ifdef FF_EM_MODE
1005 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDED);
1006 #endif
1007 kern_mm_imsi_detach();
1008 break;
1009 case GMMREG_DT_DISABLE_GPRS:
1010 kern_local_detach( GMMCS_INT_NOT_PRESENT, FALSE,
1011 GMM_LOCAL_DETACH_PROC_ENTER_NULL_IMSI); /* TCS 2.1 */
1012 break;
1013 case GMMREG_DT_GPRS:
1014 kern_local_detach( GMMCS_INT_NOT_PRESENT, FALSE,
1015 GMM_LOCAL_DETACH_PROC_ENTER_NULL_IMSI); /* TCS 2.1 */
1016 break;
1017 case GMMREG_DT_POWER_OFF:
1018 kern_local_detach( GMMCS_POWER_OFF, FALSE, /* TCS 2.1 */
1019 GMM_LOCAL_DETACH_PROC_POWER_OFF);
1020 break;
1021 case GMMREG_DT_SOFT_OFF:
1022 kern_local_detach( GMMCS_POWER_OFF, FALSE, /* TCS 2.1 */
1023 GMM_LOCAL_DETACH_PROC_SOFT_OFF);
1024
1025 break;
1026 default:
1027 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
1028 break;
1029 }
1030 break;
1031 case KERN_GMM_REG_INITIATED:
1032 /*
1033 * This cause is abnormal, because the normal and not the local detach
1034 * procedure is started on power off
1035 *
1036 * MSC: 3.8.1.4.7 g) Power off
1037 * <R.GMM.AGABNORM.M.015>,
1038 * <R.GMM.AGABNORM.M.031>
1039 */
1040 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
1041 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
1042 kern_gmmrr_attach_finished();
1043 /* NO break;*/
1044
1045 case KERN_GMM_REG_NORMAL_SERVICE:
1046 switch ( gmm_data->kern.detach_cap.detach_type )
1047 {
1048 case GMMREG_DT_IMSI:
1049 case GMMREG_DT_COMB:
1050 case GMMREG_DT_SIM_REMOVED:
1051 switch (gmm_data->kern.sig_cell_info.net_mode)
1052 {
1053 case GMMRR_NET_MODE_I:
1054 kern_detach( );
1055 break;
1056 case GMMRR_NET_MODE_II:
1057 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING);
1058 #ifdef FF_EM_MODE
1059 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING);
1060 #endif
1061 kern_llgmm_suspend(LLGMM_CALL);
1062 kern_gmmrr_suspend(GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_IMSI_DETACH);
1063 break;
1064 case GMMRR_NET_MODE_III:
1065 kern_detach( );
1066 break;
1067 default:
1068 TRACE_ERROR ("unknown net mode");
1069 break;
1070 }
1071 break;
1072 case GMMREG_DT_DISABLE_GPRS:
1073 case GMMREG_DT_GPRS:
1074 case GMMREG_DT_POWER_OFF:
1075 case GMMREG_DT_SOFT_OFF:
1076 kern_detach( );
1077 break;
1078
1079 default:
1080 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
1081 break;
1082 }
1083 break;
1084
1085 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
1086 switch ( gmm_data->kern.detach_cap.detach_type )
1087 {
1088 case GMMREG_DT_DISABLE_GPRS:
1089 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1090 /* NO break */
1091 default:
1092 kern_detach( );
1093 break;
1094 }
1095 break;
1096
1097 case KERN_GMM_REG_SUSPENDED:
1098 switch ( gmm_data->kern.detach_cap.detach_type )
1099 {
1100 case GMMREG_DT_IMSI:
1101 case GMMREG_DT_COMB:
1102 case GMMREG_DT_SIM_REMOVED:
1103 kern_mm_imsi_detach();
1104 break;
1105 case GMMREG_DT_DISABLE_GPRS:
1106 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1107 /* NO break; */
1108 case GMMREG_DT_GPRS:
1109 /*
1110 * Wait untill GSM is finished
1111 */
1112 break;
1113 case GMMREG_DT_POWER_OFF:
1114 kern_local_detach( GMMCS_POWER_OFF, FALSE, /* TCS 2.1 */
1115 GMM_LOCAL_DETACH_PROC_POWER_OFF);
1116 break;
1117 case GMMREG_DT_SOFT_OFF:
1118 kern_local_detach( GMMCS_POWER_OFF, FALSE, /* TCS 2.1 */
1119 GMM_LOCAL_DETACH_PROC_SOFT_OFF);
1120 break;
1121 default:
1122 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
1123 break;
1124 }
1125 break;
1126 case KERN_GMM_DEREG_RESUMING:
1127 case KERN_GMM_REG_RESUMING:
1128 TRACE_ERROR ("prim should be saved by pei");
1129 /* NO break */
1130 case KERN_GMM_REG_SUSPENDING:
1131 switch ( gmm_data->kern.detach_cap.detach_type )
1132 {
1133 case GMMREG_DT_IMSI:
1134 case GMMREG_DT_COMB:
1135 case GMMREG_DT_SIM_REMOVED:
1136 gmm_data->kern.suspension_type |= GMM_SUSP_IMSI_DETACH;
1137 break;
1138 case GMMREG_DT_DISABLE_GPRS:
1139 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1140 /* NO break; */
1141 case GMMREG_DT_GPRS:
1142 /*
1143 * Wait untill GSM is finished
1144 */
1145 break;
1146 case GMMREG_DT_POWER_OFF:
1147 case GMMREG_DT_SOFT_OFF:
1148 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDED);
1149 #ifdef FF_EM_MODE
1150 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDED);
1151 #endif
1152 kern_resume_grr_reg();
1153 break;
1154 default:
1155 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
1156 break;
1157 }
1158 break;
1159
1160 case KERN_GMM_NULL_NO_IMSI:
1161 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
1162 switch ( gmm_data->kern.detach_cap.detach_type )
1163 {
1164 case GMMREG_DT_IMSI:
1165 case GMMREG_DT_COMB:
1166 if ( GMM_MM_DEREG != GET_STATE(MM) )
1167 {
1168 kern_mm_imsi_detach();
1169 break;
1170 }
1171 /* else NO break;*/
1172 case GMMREG_DT_SIM_REMOVED:
1173 case GMMREG_DT_GPRS:
1174 {
1175 PALLOC (gmmreg_detach_cnf, GMMREG_DETACH_CNF);
1176 gmmreg_detach_cnf->detach_type = gmm_data->kern.detach_cap.detach_type;
1177 PSEND ( hCommMMI, gmmreg_detach_cnf );
1178 break;
1179 }
1180 case GMMREG_DT_POWER_OFF:
1181 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI );
1182 #ifdef FF_EM_MODE
1183 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI );
1184 #endif
1185 /* NO break*/
1186 case GMMREG_DT_SOFT_OFF:
1187 kern_mm_imsi_detach_ind (GMMCS_INT_NOT_PRESENT, /* TCS 2.1 */
1188 GET_STATE(MM)==GMM_MM_DEREG?
1189 MMGMM_DETACH_DONE:
1190 MMGMM_PERFORM_DETACH,
1191 gmm_data->kern.detach_cap.detach_type);
1192
1193 break;
1194 case GMMREG_DT_DISABLE_GPRS:
1195 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1196 {
1197 PALLOC (gmmreg_detach_cnf, GMMREG_DETACH_CNF);
1198 gmmreg_detach_cnf->detach_type = gmm_data->kern.detach_cap.detach_type;
1199 PSEND ( hCommMMI, gmmreg_detach_cnf );
1200 }
1201 break;
1202
1203 default:
1204 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
1205 break;
1206 }
1207 break;
1208
1209
1210 case KERN_GMM_NULL_IMSI:
1211 case KERN_GMM_NULL_PLMN_SEARCH:
1212 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
1213 switch ( gmm_data->kern.detach_cap.detach_type )
1214 {
1215 case GMMREG_DT_IMSI:
1216 case GMMREG_DT_COMB:
1217 if ( GMM_MM_DEREG != GET_STATE(MM) )
1218 {
1219 kern_mm_imsi_detach_ind (GMMCS_INT_NOT_PRESENT, MMGMM_PERFORM_DETACH,
1220 GMMREG_DT_SIM_REMOVED);
1221
1222 break;
1223 }
1224 /* else NO break;*/
1225 case GMMREG_DT_GPRS:
1226 {
1227 PALLOC (gmmreg_detach_cnf, GMMREG_DETACH_CNF);
1228 gmmreg_detach_cnf->detach_type = gmm_data->kern.detach_cap.detach_type;
1229 PSEND ( hCommMMI, gmmreg_detach_cnf );
1230 break;
1231 }
1232 case GMMREG_DT_SOFT_OFF:
1233 SET_STATE ( KERN, KERN_GMM_NULL_IMSI );
1234 #ifdef FF_EM_MODE
1235 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI );
1236 #endif
1237 kern_mm_imsi_detach_ind (GMMCS_INT_NOT_PRESENT, /* TCS 2.1 */
1238 GET_STATE(MM)==GMM_MM_DEREG?
1239 MMGMM_DETACH_DONE:
1240 MMGMM_PERFORM_DETACH,gmm_data->kern.detach_cap.detach_type);
1241
1242 break;
1243 case GMMREG_DT_SIM_REMOVED:
1244 case GMMREG_DT_POWER_OFF:
1245 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI );
1246 #ifdef FF_EM_MODE
1247 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI );
1248 #endif
1249 kern_mm_imsi_detach_ind (GMMCS_INT_NOT_PRESENT, /* TCS 2.1 */
1250 GET_STATE(MM)==GMM_MM_DEREG?
1251 MMGMM_DETACH_DONE:
1252 MMGMM_PERFORM_DETACH,
1253 gmm_data->kern.detach_cap.detach_type);
1254
1255 break;
1256 case GMMREG_DT_DISABLE_GPRS:
1257 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1258 {
1259 PALLOC (gmmreg_detach_cnf, GMMREG_DETACH_CNF);
1260 gmmreg_detach_cnf->detach_type = gmm_data->kern.detach_cap.detach_type;
1261 PSEND ( hCommMMI, gmmreg_detach_cnf );
1262 }
1263 break;
1264 default:
1265 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
1266 break;
1267 }
1268 break;
1269
1270 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
1271 kern_gmmrr_attach_finished();
1272
1273 /* NO break; */
1274
1275 case KERN_GMM_DEREG_NO_IMSI:
1276 case KERN_GMM_DEREG_PLMN_SEARCH:
1277 case KERN_GMM_DEREG_LIMITED_SERVICE:
1278 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
1279 case KERN_GMM_DEREG_INITIATED:
1280
1281 case KERN_GMM_DEREG_SUSPENDED:
1282 case KERN_GMM_DEREG_SUSPENDING:
1283
1284 switch ( gmm_data->kern.detach_cap.detach_type )
1285 {
1286 case GMMREG_DT_IMSI:
1287 case GMMREG_DT_COMB:
1288 if ( GMM_MM_DEREG != GET_STATE(MM) )
1289 {
1290 switch ( GET_STATE( KERN ) )
1291 {
1292 case KERN_GMM_DEREG_SUSPENDING:
1293 gmm_data->kern.suspension_type |= GMM_SUSP_IMSI_DETACH;
1294 break;
1295 default:
1296 kern_imsi_detach_der_susp ();
1297 break;
1298 }
1299 }
1300 /* NO break;*/
1301 case GMMREG_DT_GPRS:
1302 {
1303 PALLOC (gmmreg_detach_cnf, GMMREG_DETACH_CNF);
1304 gmmreg_detach_cnf->detach_type = gmm_data->kern.detach_cap.detach_type;
1305 PSEND ( hCommMMI, gmmreg_detach_cnf );
1306 break;
1307 }
1308 case GMMREG_DT_SOFT_OFF:
1309 kern_local_detach( GMMCS_POWER_OFF, FALSE, GMM_LOCAL_DETACH_PROC_SOFT_OFF); /* TCS 2.1 */
1310 break;
1311 case GMMREG_DT_POWER_OFF:
1312 kern_local_detach( GMMCS_POWER_OFF, FALSE, GMM_LOCAL_DETACH_PROC_POWER_OFF); /* TCS 2.1 */
1313 break;
1314 case GMMREG_DT_DISABLE_GPRS:
1315 case GMMREG_DT_SIM_REMOVED:
1316 kern_local_detach( GMMCS_INT_PROTOCOL_ERROR, FALSE, /* TCS 2.1 */
1317 GMM_LOCAL_DETACH_PROC_ENTER_DEREG );
1318 break;
1319 default:
1320 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
1321 break;
1322 }
1323 break;
1324
1325 case KERN_GMM_RAU_INITIATED:
1326 case KERN_GMM_RAU_WAIT_FOR_NPDU_LIST:
1327 /*
1328 * DETACH whilst RAU
1329 */
1330 break;
1331
1332 default:
1333 TRACE_ERROR( "GMMREG_DETACH_REQ unexpected" );
1334 break;
1335 }
1336 GMM_RETURN;
1337 } /* kern_gmmreg_detach_req() */
1338
1339
1340 /*
1341 +------------------------------------------------------------------------------
1342 | Function : kern_gmmsms_reg_state_req
1343 +------------------------------------------------------------------------------
1344 | Description : Handles the primitive GMMSMS_REG_STATE_REQ
1345 |
1346 | MSC: 3.21 Interaction with SMS
1347 |
1348 | Parameters : *gmmsms_reg_state_req - Ptr to primitive payload
1349 |
1350 +------------------------------------------------------------------------------
1351 */
1352 GLOBAL void kern_gmmsms_reg_state_req ( T_GMMSMS_REG_STATE_REQ *gmmsms_reg_state_req )
1353 {
1354 GMM_TRACE_FUNCTION( "kern_gmmsms_reg_state_req" );
1355
1356 PFREE (gmmsms_reg_state_req);
1357 {
1358 PALLOC ( gmmsms_reg_state_cnf, GMMSMS_REG_STATE_CNF );
1359 gmmsms_reg_state_cnf->radio_priority_level =
1360 gmm_data->kern.attach_cap.sms_radio_priority_level;
1361 switch( GET_STATE( KERN ) )
1362 {
1363 case KERN_GMM_NULL_NO_IMSI:
1364 case KERN_GMM_NULL_IMSI:
1365 case KERN_GMM_DEREG_NO_IMSI:
1366 case KERN_GMM_REG_SUSPENDED:
1367 case KERN_GMM_REG_RESUMING:
1368 case KERN_GMM_DEREG_SUSPENDED:
1369 case KERN_GMM_DEREG_RESUMING:
1370 case KERN_GMM_DEREG_PLMN_SEARCH:
1371 case KERN_GMM_DEREG_LIMITED_SERVICE:
1372 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
1373 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
1374 case KERN_GMM_DEREG_INITIATED:
1375 case KERN_GMM_REG_INITIATED:
1376 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
1377 case KERN_GMM_REG_NO_CELL_AVAILABLE:
1378 case KERN_GMM_REG_LIMITED_SERVICE:
1379 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
1380 case KERN_GMM_RAU_INITIATED:
1381
1382 gmmsms_reg_state_cnf->reg_state = SMS_RS_DEREGISTERED;
1383 break;
1384
1385 case KERN_GMM_REG_NORMAL_SERVICE:
1386
1387 gmmsms_reg_state_cnf->reg_state = SMS_RS_REGISTERED;
1388 break;
1389 default:
1390 TRACE_ERROR( "GMMSMS_REG_STATE_REQ unexpected" );
1391 break;
1392 }
1393 PSEND(hCommSMS,gmmsms_reg_state_cnf);
1394 }/* PALLOC*/
1395 GMM_RETURN;
1396 } /* kern_gmmsms_reg_state_req() */
1397
1398
1399
1400 /*
1401 +------------------------------------------------------------------------------
1402 | Function : kern_gmmrr_page_ind
1403 +------------------------------------------------------------------------------
1404 | Description : Handles the primitive GMMRR_PAGE_IND
1405 |
1406 | Parameters : *gmmrr_page_ind - Ptr to primitive payload
1407 |
1408 +------------------------------------------------------------------------------
1409 */
1410 GLOBAL void kern_gmmrr_page_ind ( T_GMMRR_PAGE_IND *gmmrr_page_ind )
1411 {
1412 GMM_TRACE_FUNCTION( "kern_gmmrr_page_ind" );
1413
1414
1415 switch( GET_STATE( KERN ) )
1416 {
1417 /*
1418 * case GMM-DEREG
1419 * If the MS is not GPRS attached when it receives a paging for
1420 * GPRS services, the MS shall ignore the paging.
1421 * <R.GMM.PAGNGPRS.M.17>
1422 */
1423 case KERN_GMM_REG_NORMAL_SERVICE:
1424 switch ( gmmrr_page_ind->page_id )
1425 {
1426 case GMMRR_IMSI:
1427 TRACE_EVENT("paged with IMSI");
1428 PFREE ( gmmrr_page_ind );
1429 gmm_data->gu = GU2_NOT_UPDATED;
1430 kern_sim_del_locigprs ();
1431 kern_sim_gmm_update ();
1432 /*
1433 * <R.GMM.PGPIMSI.M.004>, <R.GMM.PGPIMSI.M.005>,
1434 * <R.GMM.PGPIMSI.M.008>
1435 */
1436 gmm_data->kern.detach_cap.detach_type = GMM_DT_RE_ATTACH;
1437 kern_local_detach( GMMCS_INT_PROTOCOL_ERROR, /* TCS 2.1 */
1438 FALSE, GMM_LOCAL_DETACH_PROC_RE_ATTACH);
1439 /*
1440 * goto LABEL ATTACH
1441 *
1442 * <R.GMM.PGPIMSI.M.009>
1443 * GMM-DEREG.NORMAL-SERVICE
1444 *
1445 kern_attach_reset();
1446 kern_attach();
1447 */
1448 break;
1449 case GMMRR_PTMSI:
1450 TRACE_EVENT("paged with P-TMSI");
1451 PFREE ( gmmrr_page_ind );
1452 {
1453 /*
1454 * <R.GMM.PGPPTMS.M.007>
1455 */
1456 PALLOC (llgmm_trigger_req, LLGMM_TRIGGER_REQ);
1457 llgmm_trigger_req->trigger_cause = LLGMM_TRICS_PAGE_RESPONSE;
1458 PSEND ( hCommLLC, llgmm_trigger_req );
1459 break;
1460 }
1461 default:
1462 PFREE ( gmmrr_page_ind );
1463 TRACE_ERROR( "IMSI or PTMSI page ID expected" );
1464 break;
1465 }
1466 break;
1467 default:
1468 PFREE ( gmmrr_page_ind );
1469 TRACE_ERROR( "GMMRR_PAGE_IND unexpected" );
1470 break;
1471 }
1472 GMM_RETURN;
1473 } /* kern_gmmrr_page_ind() */
1474
1475 /*
1476 +------------------------------------------------------------------------------
1477 | Function : kern_gmmrr_cs_page_ind
1478 +------------------------------------------------------------------------------
1479 | Description : Handles the primitive GMMRR_CS_PAGE_IND
1480 |
1481 | Parameters : *gmmrr_cs_page_ind - Ptr to primitive payload
1482 |
1483 +------------------------------------------------------------------------------
1484 */
1485 GLOBAL void kern_gmmrr_cs_page_ind ( T_GMMRR_CS_PAGE_IND *gmmrr_cs_page_ind )
1486 {
1487 GMM_TRACE_FUNCTION( "kern_gmmrr_cs_page_ind" );
1488
1489 PFREE ( gmmrr_cs_page_ind );
1490
1491
1492 {
1493 PALLOC ( gmmrr_cs_page_res, GMMRR_CS_PAGE_RES );
1494
1495 switch (gmm_data->kern.attach_cap.mobile_class)
1496 {
1497 case GMMRR_CLASS_CG:
1498 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1499 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS;
1500 break;
1501
1502 /* PATCH JPS 26.10.02: with class BX, we can have BC in NMOIII */
1503 case GMMREG_CLASS_BG:
1504 if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode)
1505 {
1506 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1507 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS;
1508 break;
1509 }
1510 /* NO break; */
1511 case GMMREG_CLASS_BC:
1512 case GMMREG_CLASS_B:
1513 /* PATCH JPS 26.10.02 END */
1514 switch( GET_STATE( KERN ) )
1515 {
1516 case KERN_GMM_DEREG_RESUMING:
1517 case KERN_GMM_REG_RESUMING:
1518 TRACE_ERROR ("prim should be saved by pei");
1519 break;
1520 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
1521 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = TRUE;
1522 /* NO break;*/
1523 case KERN_GMM_DEREG_NO_IMSI:
1524 case KERN_GMM_DEREG_SUSPENDED:
1525 case KERN_GMM_DEREG_LIMITED_SERVICE:
1526
1527 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
1528 case KERN_GMM_DEREG_PLMN_SEARCH:
1529 case KERN_GMM_DEREG_INITIATED:
1530 case KERN_GMM_REG_INITIATED:
1531 if (GMM_MM_DEREG != GET_STATE(MM)
1532 && MMGMM_LIMITED_SERVICE!=gmm_data->kern.sig_cell_info.mm_status
1533 )
1534 {
1535 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1536 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDED );
1537 #ifdef FF_EM_MODE
1538 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDED );
1539 #endif
1540 }
1541 else
1542 {
1543 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1544 }
1545 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS;
1546 break;
1547 case KERN_GMM_REG_SUSPENDED:
1548 case KERN_GMM_REG_LIMITED_SERVICE:
1549 case KERN_GMM_REG_NO_CELL_AVAILABLE:
1550 if (GMM_MM_DEREG != GET_STATE(MM)
1551 && MMGMM_LIMITED_SERVICE!=gmm_data->kern.sig_cell_info.mm_status)
1552 {
1553 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1554 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDED );
1555 #ifdef FF_EM_MODE
1556 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDED );
1557 #endif
1558 kern_llgmm_suspend(LLGMM_CALL);
1559 }
1560 else
1561 {
1562 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1563 }
1564 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS;
1565
1566 break;
1567 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
1568 if (GMM_MM_DEREG != GET_STATE(MM)
1569 && MMGMM_LIMITED_SERVICE!=gmm_data->kern.sig_cell_info.mm_status)
1570 {
1571 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1572 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = TRUE;
1573 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDED );
1574 #ifdef FF_EM_MODE
1575 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDED );
1576 #endif
1577 kern_llgmm_suspend(LLGMM_CALL);
1578 }
1579 else
1580 {
1581 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1582 }
1583 gmmrr_cs_page_res->susp_gprs = GMMRR_SUSP_GPRS;
1584 /*
1585 * kern_llgmm_unassign();
1586 */
1587 break;
1588 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
1589 /* IOT: Combined RA/LA is accepted with network cause 16
1590 * MSC temporarily unavailable. MM state is reset to GMM_MM_DEREG
1591 * From the IOT, it was observed that after GMM moves to NMOII, MM
1592 * was able to perform LAU successfully, but not combined RAU. Hence
1593 * in this state we should be able to make and receive CS calls
1594 * Also network is able to reach us through paging */
1595 if (/*GMM_MM_DEREG != GET_STATE(MM)
1596 && */ MMGMM_LIMITED_SERVICE!=gmm_data->kern.sig_cell_info.mm_status)
1597 {
1598 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1599 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = TRUE;
1600 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDED );
1601 kern_llgmm_suspend(LLGMM_CALL);
1602 }
1603 else
1604 {
1605 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1606 }
1607 gmmrr_cs_page_res->susp_gprs = GMMRR_SUSP_GPRS;
1608 /*
1609 * kern_llgmm_unassign();
1610 */
1611 break;
1612 case KERN_GMM_RAU_INITIATED:
1613 case KERN_GMM_REG_NORMAL_SERVICE:
1614 if (GMM_MM_DEREG != GET_STATE(MM)
1615 && MMGMM_LIMITED_SERVICE!=gmm_data->kern.sig_cell_info.mm_status)
1616 {
1617 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1618 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDED );
1619 #ifdef FF_EM_MODE
1620 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDED );
1621 #endif
1622 kern_llgmm_suspend(LLGMM_CALL);
1623 }
1624 else
1625 {
1626 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1627 }
1628 gmmrr_cs_page_res->susp_gprs = GMMRR_SUSP_GPRS;
1629 /*
1630 * kern_llgmm_unassign();
1631 */
1632 break;
1633 case KERN_GMM_NULL_IMSI:
1634 /*
1635 * in state KERN_GMM_NULL_IMSI MS is doing a GPRS detach
1636 * and GMM has informed MM to act as GSM only mobile but
1637 * before MM processes the message, GMM receives CS_PAGE_IND
1638 * GMM must reject the CS_PAGE as MM will take care of the
1639 * next CS_PAGE_IND after processing MMGMM_REG_REQ to act as
1640 * GSM only mobile. if GMM accepts the CS_PAGE, GRR will be
1641 * suspended and after coming out of dedicated mode MM will
1642 * not inform GMM about CS connection release and GRR will
1643 * not be resumed. This is to prevent such a race condition.
1644 */
1645
1646 TRACE_EVENT("CS Call Received To GMM In GMM_NULL_IMSI state");
1647 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1648 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS;
1649 break;
1650 case KERN_GMM_NULL_PLMN_SEARCH:
1651 if (GMM_MM_DEREG != GET_STATE(MM)
1652 && MMGMM_LIMITED_SERVICE!=gmm_data->kern.sig_cell_info.mm_status)
1653 {
1654 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1655 }
1656 else
1657 {
1658 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1659 }
1660 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS;
1661 break;
1662 default:
1663 if (GMM_MM_DEREG != GET_STATE(MM)
1664 && MMGMM_LIMITED_SERVICE!=gmm_data->kern.sig_cell_info.mm_status)
1665 {
1666 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1667 }
1668 else
1669 {
1670 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_REJ;
1671 }
1672 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS;
1673 TRACE_ERROR( "GMMRR_CS_PAGE_IND unexpected" );
1674 break;
1675 }
1676 break;
1677 case GMMRR_CLASS_A:
1678 case GMMRR_CLASS_CC:
1679 gmmrr_cs_page_res->response = GMMRR_CS_PAGE_CNF;
1680 gmmrr_cs_page_res->susp_gprs = GMMRR_NOT_SUSP_GPRS; /* GMM1903A */
1681 break;
1682 default:
1683 TRACE_ERROR( "unknown MS class");
1684 break;
1685 }
1686 /* START PATCH UBUOB ISSUE 8379 */
1687 if (gmmrr_cs_page_res->response == GMMRR_CS_PAGE_CNF)
1688 {
1689 gmm_data->kern.gmmrr_resume_sent = FALSE;
1690 }
1691 /* END PATCH UBUOB ISSUES 8379 */
1692 PSEND ( hCommGRR, gmmrr_cs_page_res );
1693 }
1694 GMM_RETURN;
1695 } /* kern_gmmrr_cs_page_ind() */
1696
1697 /*
1698 +------------------------------------------------------------------------------
1699 | Function : kern_gmmrr_cr_ind
1700 +------------------------------------------------------------------------------
1701 | Description : Handles the primitive GMMRR_CR_IND
1702 |
1703 | Parameters : *gmmrr_cr_ind - Ptr to primitive payload
1704 |
1705 +------------------------------------------------------------------------------
1706 */
1707 GLOBAL void kern_gmmrr_cr_ind ( T_GMMRR_CR_IND *gmmrr_cr_ind )
1708 {
1709 GMM_TRACE_FUNCTION( "kern_gmmrr_cr_ind" );
1710
1711 PFREE ( gmmrr_cr_ind );
1712 if ( GMM_GRR_STATE_ON == gmm_data->kern.attach_cap.grr_state)
1713 /*
1714 * If GRR is suspended state should be kept.
1715 */
1716 {
1717 gmm_data->kern.attach_cap.grr_state = GMM_GRR_STATE_CR;
1718 }
1719
1720 switch( GET_STATE( KERN ) )
1721 {
1722 case KERN_GMM_REG_INITIATED:
1723 case KERN_GMM_RAU_INITIATED:
1724 /*
1725 * store timer value to be able to restart timer after cell reselection
1726 */
1727 gmm_data->kern.attach_cap.t3310_value=0;
1728 if (VSI_OK == vsi_t_status ( GMM_handle , kern_T3310, &(gmm_data->kern.attach_cap.t3310_value))
1729 && gmm_data->kern.attach_cap.t3310_value>0)
1730 {
1731 vsi_t_stop ( GMM_handle , kern_T3310);
1732 }
1733
1734 TRACE_1_INFO ("TIMER t3310 = %dmsec stopped - waiting for CELL_IND",gmm_data->kern.attach_cap.t3310_value);
1735 break;
1736 default:
1737 break;
1738 }
1739 GMM_RETURN;
1740 }/* kern_gmmrr_cr_ind */
1741
1742
1743 /*
1744 +------------------------------------------------------------------------------
1745 | Function : kern_cgrlc_status_ind (TCS 2.1)
1746 +------------------------------------------------------------------------------
1747 | Description : Handles the primitive CGRLC_STATUS_IND (TCS 2.1)
1748 |
1749 | Parameters : *cgrlc_status_ind - Ptr to primitive payload (TCS 2.1)
1750 |
1751 +------------------------------------------------------------------------------
1752 */
1753 GLOBAL void kern_cgrlc_status_ind ( T_CGRLC_STATUS_IND *cgrlc_status_ind ) /* TCS 2.1 */
1754 {
1755 GMM_TRACE_FUNCTION( "kern_cgrlc_status_ind" ); /* TCS 2.1 */
1756
1757 switch (cgrlc_status_ind->failure) /* TCS 2.1 */
1758 {
1759 case CGRLC_ACCESS_2_NETWORK_NOT_ALLOWED: /* TCS 2.1 */
1760 TRACE_EVENT ("Access to the network is not allowed");
1761 break;
1762 case CGRLC_PACKET_ACCESS_FAILURE: /* TCS 2.1 */
1763 TRACE_EVENT("Failure during packet access procedure, e.g. T3162 expired");
1764 break;
1765 case CGRLC_RLC_MAC_ERROR: /* TCS 2.1 */
1766 TRACE_EVENT("T3168 expires during contention resolution");
1767 break;
1768 case CGRLC_TLLI_MISMATCH: /* TCS 2.1 */
1769 TRACE_EVENT ("TLLI mismatch has occurred");
1770 break;
1771 case CGRLC_TBF_ESTABLISHMENT_FAILURE: /* TCS 2.1 */
1772 TRACE_EVENT ("T3164 expires or failure occurs due to any other reason");
1773 break;
1774 case CGRLC_RESUMPTION_FAILURE: /* TCS 2.1 */
1775 TRACE_EVENT ("resumption failure after dedicated mode was left");
1776 break;
1777 case CGRLC_CONTENTION_RESOLUTION_FAILED: /* TCS 2.1 */
1778 TRACE_EVENT ("Contantion Resolution has failed"); /* TCS 2.1 */
1779 break; /* TCS 2.1 */
1780 default:
1781 TRACE_ERROR ("unknown failure");
1782 break;
1783 }
1784
1785 PFREE (cgrlc_status_ind); /* TCS 2.1 */
1786
1787 switch( GET_STATE( KERN ) )
1788 {
1789 case KERN_GMM_REG_INITIATED:
1790 case KERN_GMM_RAU_INITIATED:
1791 /************************************************************************
1792 * MSC: 3.8 Attach
1793 *
1794 * MSC: 3.8.1 Normal Attach
1795 * MSC: 3.8.1.4 Abnormal cases
1796 * MSC: 3.8.1.4.2 b) Lower layer failure before the ATTACH ACCEPT or
1797 * ATTACH REJECT
1798 * message is received
1799 ************************************************************************
1800 *
1801 *<R.GMM.AGABNORM.M.004>, <R.GMM.LOWERFAIL.M.001>
1802 */
1803 kern_aac( /*llgmm_status_ind->error_cause*/ 0);
1804 break;
1805 case KERN_GMM_DEREG_INITIATED:
1806 /************************************************************************
1807 * MSC: 3.9 GPRS detach procedure
1808 *
1809 * MCS: 3.9.3 Abnormal cases
1810 * MSC: 3.9.3.2 b) Lower layer failure
1811 ************************************************************************/
1812 kern_local_detach ( GMMCS_INT_PROTOCOL_ERROR, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_DEREG); /* TCS 2.1 */
1813 break;
1814 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
1815 /*
1816 * <R.GMM.DMABNORM.M.021>
1817 */
1818 /************************************************************************
1819 * MSC: 3.9 GPRS detach procedure
1820 *
1821 * MCS: 3.9.3 Abnormal cases
1822 * MSC: 3.9.3.2 b) Lower layer failure
1823 ************************************************************************/
1824 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_IMSI;
1825 kern_local_detach( GMMCS_INT_PROTOCOL_ERROR, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_REG_NORMAL); /* TCS 2.1 */
1826 break;
1827 case KERN_GMM_DEREG_RESUMING:
1828 case KERN_GMM_DEREG_SUSPENDED:
1829 case KERN_GMM_REG_RESUMING:
1830 case KERN_GMM_REG_SUSPENDED:
1831 TRACE_ERROR( "CGRLC_STATUS_IND unexpected" ); /* TCS 2.1 */
1832 break;
1833 default:
1834 break;
1835 }
1836 GMM_RETURN;
1837 } /* kern_cgrlc_status_ind() */ /* TCS 2.1 */
1838 /*
1839 +------------------------------------------------------------------------------
1840 | Function : kern_llgmm_status_ind
1841 +------------------------------------------------------------------------------
1842 | Description : Handles the primitive LLGMM_STATUS_IND
1843 |
1844 | Parameters : *llgmm_status_ind - Ptr to primitive payload
1845 |
1846 +------------------------------------------------------------------------------
1847 */
1848 GLOBAL void kern_llgmm_status_ind ( T_LLGMM_STATUS_IND *llgmm_status_ind )
1849 {
1850 GMM_TRACE_FUNCTION( "kern_llgmm_status_ind" );
1851
1852 PFREE (llgmm_status_ind);
1853
1854 switch( GET_STATE( KERN ) )
1855 {
1856 case KERN_GMM_REG_INITIATED:
1857 case KERN_GMM_RAU_INITIATED:
1858 /************************************************************************
1859 * MSC: 3.8 Attach
1860 *
1861 * MSC: 3.8.1 Normal Attach
1862 * MSC: 3.8.1.4 Abnormal cases
1863 * MSC: 3.8.1.4.2 b) Lower layer failure before the ATTACH ACCEPT or
1864 * ATTACH REJECT
1865 * message is received
1866 ************************************************************************
1867 *
1868 *<R.GMM.AGABNORM.M.004>, <R.GMM.LOWERFAIL.M.001>
1869 */
1870 kern_aac( /*llgmm_status_ind->error_cause*/ GMMCS_NO_SERVICE); /* TCS 2.1 */
1871 break;
1872 case KERN_GMM_DEREG_INITIATED:
1873 /************************************************************************
1874 * MSC: 3.9 GPRS detach procedure
1875 *
1876 * MCS: 3.9.3 Abnormal cases
1877 * MSC: 3.9.3.2 b) Lower layer failure
1878 ************************************************************************/
1879 kern_local_detach( GMMCS_INT_PROTOCOL_ERROR, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_DEREG); /* TCS 2.1 */
1880 break;
1881 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
1882 /*
1883 * <R.GMM.DMABNORM.M.021>
1884 */
1885 /************************************************************************
1886 * MSC: 3.9 GPRS detach procedure
1887 *
1888 * MCS: 3.9.3 Abnormal cases
1889 * MSC: 3.9.3.2 b) Lower layer failure
1890 ************************************************************************/
1891 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_IMSI;
1892 kern_local_detach( GMMCS_INT_PROTOCOL_ERROR, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_REG_NORMAL); /* TCS 2.1 */
1893
1894 break;
1895 default:
1896 TRACE_ERROR( "LLGMM_STATUS_IND unexpected" );
1897 break;
1898 }
1899 GMM_RETURN;
1900 } /* kern_llgmm_status_ind() */
1901
1902 /*
1903 +------------------------------------------------------------------------------
1904 | Function : kern_llgmm_tlli_ind
1905 +------------------------------------------------------------------------------
1906 | Description : Handles the primitive LLGMM_TLLI_IND
1907 |
1908 | Parameters : *llgmm_status_ind - Ptr to primitive payload
1909 |
1910 +------------------------------------------------------------------------------
1911 */
1912 GLOBAL void kern_llgmm_tlli_ind ( T_LLGMM_TLLI_IND *llgmm_tlli_ind )
1913 {
1914 GMM_TRACE_FUNCTION( "kern_llgmm_tlli_ind" );
1915 TRACE_1_PARA ("TLLI: 0x%x", llgmm_tlli_ind->new_tlli);
1916
1917 GMM_TRACE_GMM_DATA(GMM_DEBUG_PRINT_MASK_TLLI);
1918
1919 switch( GET_STATE( KERN ) )
1920 {
1921 default:
1922 case KERN_GMM_NULL_NO_IMSI:
1923 case KERN_GMM_NULL_IMSI:
1924 case KERN_GMM_NULL_PLMN_SEARCH:
1925 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
1926 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
1927 TRACE_ERROR("LLGMM_TLLI_IND unexpected");
1928 break;
1929
1930 case KERN_GMM_DEREG_INITIATED:
1931 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
1932 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
1933 case KERN_GMM_DEREG_LIMITED_SERVICE:
1934 case KERN_GMM_DEREG_NO_IMSI:
1935 case KERN_GMM_DEREG_PLMN_SEARCH:
1936 case KERN_GMM_DEREG_SUSPENDED:
1937 case KERN_GMM_REG_INITIATED:
1938 case KERN_GMM_REG_NO_CELL_AVAILABLE:
1939 case KERN_GMM_REG_LIMITED_SERVICE:
1940 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
1941 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
1942 case KERN_GMM_REG_SUSPENDED:
1943 case KERN_GMM_REG_NORMAL_SERVICE:
1944 case KERN_GMM_RAU_INITIATED:
1945 case KERN_GMM_RAU_WAIT_FOR_NPDU_LIST:
1946 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
1947 case KERN_GMM_REG_RESUMING:
1948 case KERN_GMM_DEREG_SUSPENDING:
1949 case KERN_GMM_DEREG_RESUMING:
1950 case KERN_GMM_REG_SUSPENDING:
1951 case KERN_GMM_REG_TEST_MODE:
1952 case KERN_GMM_REG_TEST_MODE_NO_IMSI:
1953
1954 if ( llgmm_tlli_ind->new_tlli != gmm_data->tlli.current)
1955 {
1956 TRACE_ERROR("TLLI value not expected");
1957 }
1958
1959 TRACE_0_OUT_PARA("Unassign Old PTMSI");
1960
1961 gmm_data->tlli.old = GMMRR_TLLI_INVALID;
1962 gmm_data->ptmsi.old = GMMRR_TMSI_INVALID;
1963
1964 GMM_TRACE_GMM_DATA(GMM_DEBUG_PRINT_MASK_TLLI | GMM_DEBUG_PRINT_MASK_PTMSI);
1965 /*
1966 * LLC should know about unassigning itself
1967 */
1968 kern_gmmrr_assign();
1969 break;
1970 }
1971
1972 PFREE (llgmm_tlli_ind);
1973
1974 GMM_RETURN;
1975 } /* kern_llgmm_tlli_ind() */
1976
1977 /*
1978 +------------------------------------------------------------------------------
1979 | Function : kern_sim_gmm_insert_ind
1980 +------------------------------------------------------------------------------
1981 | Description : Handles the primitive SIM_GMM_INSERT_IND
1982 |
1983 | MSC: 3.2 SIM
1984 |
1985 | Parameters : *sim_gmm_insert_ind - Ptr to primitive payload
1986 |
1987 +------------------------------------------------------------------------------
1988 */
1989 GLOBAL void kern_sim_gmm_insert_ind ( T_SIM_GMM_INSERT_IND *sim_gmm_insert_ind )
1990 {
1991 GMM_TRACE_FUNCTION( "kern_sim_gmm_insert_ind" );
1992 /*
1993 * Set IMSI
1994 */
1995
1996 kern_read_imsi ( sim_gmm_insert_ind ) ;
1997
1998 GMM_TRACE_GMM_DATA(GMM_DEBUG_PRINT_MASK_IMSI);
1999
2000 kern_read_loc_info (sim_gmm_insert_ind);
2001
2002 GMM_TRACE_GMM_DATA(GMM_DEBUG_PRINT_MASK_CID);
2003 GMM_TRACE_GMM_DATA(GMM_DEBUG_PRINT_MASK_KERN_ATTACH);
2004
2005 gmm_data->acc_contr_class = sim_gmm_insert_ind->acc_ctrl.acc[0] * 256 +
2006 sim_gmm_insert_ind->acc_ctrl.acc[1];
2007 gmm_data->kern.sim_op_mode = sim_gmm_insert_ind->op_mode;
2008 kern_read_kc_cksn (sim_gmm_insert_ind);
2009
2010 PFREE ( sim_gmm_insert_ind );
2011
2012 switch( GET_STATE( KERN ) )
2013 {
2014 case KERN_GMM_NULL_NO_IMSI:
2015 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
2016 case KERN_GMM_DEREG_NO_IMSI:
2017 /*
2018 * MSC: 3.2 SIM
2019 *
2020 * MSC: 3.2.1 SIM is inserted and valid
2021 */
2022 /*
2023 * SIM is considered as invalid until SIM removed or switching off
2024 */
2025 gmm_data->sim_gprs_invalid = FALSE;
2026 /*
2027 * reset the attach attampt counter and the rau attempt counter
2028 * <R.GMM.ATTACH.M.007>
2029 */
2030 gmm_data->kern.aac = 0;
2031
2032 switch( GET_STATE( KERN ) )
2033 {
2034 case KERN_GMM_NULL_NO_IMSI:
2035 /*
2036 * <R.GMM.DOTHCASE.M.001>
2037 * SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH );
2038 *
2039 * state GMM-DEREGISTERED.IMSI discribes the state GMM-NULL.IMSI-VALID
2040 */
2041
2042 SET_STATE ( KERN, KERN_GMM_NULL_IMSI );
2043 #ifdef FF_EM_MODE
2044 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI );
2045 #endif
2046 break;
2047 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
2048 SET_STATE (KERN, KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
2049 #ifdef FF_EM_MODE
2050 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
2051 #endif
2052 break;
2053 case KERN_GMM_DEREG_NO_IMSI:
2054 /*
2055 * GMM enters state NULL_IMSI beause GMM is waiting for a new attach
2056 * prim from GACI (COPS=0)
2057 */
2058 SET_STATE ( KERN, KERN_GMM_NULL_IMSI );
2059 #ifdef FF_EM_MODE
2060 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI );
2061 #endif
2062 break;
2063 default:
2064 TRACE_ERROR( "State unexpected" );
2065 break;
2066 }
2067 break;
2068 default:
2069 TRACE_ERROR( "SIM_GMM_INSERT_IND unexpected" );
2070 break;
2071 }
2072 GMM_RETURN;
2073 } /* kern_sim_gmm_insert_ind() */
2074
2075
2076
2077 /*
2078 +------------------------------------------------------------------------------
2079 | Function : kern_sim_remove_ind
2080 +------------------------------------------------------------------------------
2081 | Description : Handles the primitive SIM_REMOVE_IND
2082 |
2083 | Parameters : *sim_remove_ind - Ptr to primitive payload
2084 |
2085 +------------------------------------------------------------------------------
2086 */
2087 GLOBAL void kern_sim_remove_ind ( T_SIM_REMOVE_IND *sim_remove_ind )
2088 {
2089 GMM_TRACE_FUNCTION( "kern_sim_remove_ind" );
2090
2091 PFREE ( sim_remove_ind );
2092
2093 gmm_data->sim_gprs_invalid = TRUE;
2094 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_SIM_REMOVED;
2095 /*
2096 * multiple outstanding SIM_AUTHENTICATION_REQ messages reset the
2097 * counter whenever SIM is removed
2098 */
2099 gmm_data->kern.auth_cap.last_auth_req_id = NOT_PRESENT_8BIT;
2100
2101 switch( GET_STATE( KERN ) )
2102 {
2103 /*
2104 * MSC: 3.2 SIM
2105 *
2106 * MSC: 3.2.2. No SIM present or SIM not valid
2107 * MSC: 3.2.2.2 State GMM-REG
2108 */
2109
2110 /*
2111 * MSC: 3.2.2.2.1 Network not reachable
2112 * state GMM_REG
2113 */
2114 case KERN_GMM_DEREG_RESUMING:
2115 case KERN_GMM_DEREG_SUSPENDED:
2116 case KERN_GMM_REG_RESUMING:
2117 case KERN_GMM_REG_SUSPENDED:
2118 if (GMM_GRR_STATE_SUSPENDED==gmm_data->kern.attach_cap.grr_state)
2119 /*
2120 * wait for MMGMM_CM_RELEASE_IND
2121 */
2122 {
2123 break;
2124 }
2125 /* NO break;*/
2126 case KERN_GMM_REG_LIMITED_SERVICE:
2127 case KERN_GMM_REG_NO_CELL_AVAILABLE:
2128 {
2129 kern_local_detach (GMMCS_SIM_REMOVED, FALSE,GMM_LOCAL_DETACH_PROC_SIM_REMOVED); /* TCS 2.1 */
2130 break;
2131 }
2132 case KERN_GMM_REG_TEST_MODE:
2133 {
2134 PALLOC (cgrlc_test_end_req, CGRLC_TEST_END_REQ); /* TCS 2.1 */
2135 SET_STATE (KERN, KERN_GMM_REG_TEST_MODE_NO_IMSI);
2136 #ifdef FF_EM_MODE
2137 EM_GMM_SET_STATE(KERN_GMM_REG_TEST_MODE_NO_IMSI);
2138 #endif
2139 PSEND (hCommGRLC, cgrlc_test_end_req); /* TCS 2.1 */
2140 }
2141 break;
2142 /*
2143 * MSC: 3.2.2.2.2 Network reachable
2144 * state GMM_REG.NORMAL_SERVICE
2145 */
2146 case KERN_GMM_RAU_INITIATED:
2147 case KERN_GMM_RAU_WAIT_FOR_NPDU_LIST:
2148 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
2149 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
2150 case KERN_GMM_REG_NORMAL_SERVICE:
2151 /*
2152 * <R.GMM.DSUBFANO.M.003>
2153 */
2154
2155 kern_detach ();
2156 break;
2157 /*
2158 * MSC: 3.2 SIM
2159 *
2160 * MSC: 3.2.2. No SIM present or SIM not valid
2161 * MSC: 3.2.2.1 State GMM-DEREG
2162 */
2163
2164 /*
2165 * state GMM_DEREG
2166 */
2167 case KERN_GMM_DEREG_PLMN_SEARCH:
2168 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
2169 case KERN_GMM_DEREG_LIMITED_SERVICE:
2170 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
2171 case KERN_GMM_REG_INITIATED:
2172 case KERN_GMM_DEREG_INITIATED:
2173
2174 kern_mm_imsi_detach_ind ( GMMCS_SIM_REMOVED, MMGMM_PERFORM_DETACH,
2175 gmm_data->kern.detach_cap.detach_type); /* TCS 2.1 */
2176 /*
2177 * <R.GMM.ODNOIMSI.M.001>
2178 */
2179 SET_STATE ( KERN, KERN_GMM_DEREG_NO_IMSI );
2180 #ifdef FF_EM_MODE
2181 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI );
2182 #endif
2183 break;
2184
2185 case KERN_GMM_NULL_IMSI:
2186
2187 kern_mm_imsi_detach_ind ( GMMCS_SIM_REMOVED, MMGMM_PERFORM_DETACH,
2188 gmm_data->kern.detach_cap.detach_type ); /* TCS 2.1 */
2189 /*
2190 * <R.GMM.ODNOIMSI.M.001>
2191 */
2192 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI );
2193 #ifdef FF_EM_MODE
2194 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI );
2195 #endif
2196 break;
2197
2198 default:
2199 kern_mm_imsi_detach_ind ( GMMCS_SIM_REMOVED, MMGMM_PERFORM_DETACH,
2200 gmm_data->kern.detach_cap.detach_type); /* TCS 2.1 */
2201 TRACE_ERROR( "SIM_REMOVE_IND unexpected" );
2202 break;
2203 }
2204 GMM_RETURN;
2205 } /* kern_sim_remove_ind() */
2206
2207
2208 /*
2209 +------------------------------------------------------------------------------
2210 | Function : kern_gmmrr_suspend_cnf
2211 +------------------------------------------------------------------------------
2212 | Description : Handles the primitive GMMRR_SUSPEND_CNF
2213 |
2214 | GRR confirms that GRR is successful suspended and RR is
2215 | activated.
2216 |
2217 | Parameters : *gmmrr_suspend_cnf - Ptr to primitive payload
2218 |
2219 +------------------------------------------------------------------------------
2220 */
2221 GLOBAL void kern_gmmrr_suspend_cnf ( T_GMMRR_SUSPEND_CNF *gmmrr_suspend_cnf )
2222 {
2223 GMM_TRACE_FUNCTION( "kern_gmmrr_suspend_cnf" );
2224 PFREE(gmmrr_suspend_cnf);
2225 gmm_data->kern.attach_cap.grr_state = GMM_GRR_STATE_SUSPENDED;
2226
2227 TRACE_1_PARA ("susp_type: %x", gmm_data->kern.suspension_type);
2228 switch( GET_STATE( KERN ) )
2229 {
2230 case KERN_GMM_DEREG_SUSPENDING:
2231 SET_STATE (KERN, KERN_GMM_DEREG_SUSPENDED);
2232 #ifdef FF_EM_MODE
2233 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDED);
2234 #endif
2235 if(gmm_data->kern.detach_cap.detach_type EQ GMMREG_DT_GPRS)
2236 {
2237 if ( GET_STATE(MM) != GMM_MM_REG_NORMAL_SERVICE)
2238 /*
2239 * The state of MM is forwarded to MMI
2240 */
2241 {
2242 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB;
2243 }
2244 if ( kern_lau_needed())
2245 {
2246 /*
2247 * see also kern_enter_der ()
2248 */
2249 kern_gmmreg_detach (gmm_data->kern.detach_cap.detach_type, GMMCS_INT_NOT_PRESENT,
2250 GMMREG_SEARCH_RUNNING, GMMCS_INT_NOT_PRESENT);
2251 }
2252 else
2253 {
2254 kern_gmmreg_detach (gmm_data->kern.detach_cap.detach_type, GMMCS_INT_NOT_PRESENT,
2255 GMMREG_SEARCH_NOT_RUNNING,GMMCS_INT_NOT_PRESENT);
2256 }
2257 }
2258
2259 kern_call_undone_mm_proc_der();
2260 break;
2261
2262 case KERN_GMM_REG_SUSPENDING:
2263 SET_STATE (KERN, KERN_GMM_REG_SUSPENDED);
2264 #ifdef FF_EM_MODE
2265 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDED);
2266 #endif
2267 kern_call_undone_mm_proc_reg();
2268 break;
2269
2270 case KERN_GMM_NULL_NO_IMSI:
2271 kern_local_detach ( GMMCS_POWER_OFF, /* TCS 2.1 */
2272 FALSE, GMM_LOCAL_DETACH_PROC_NOTHING);
2273 break;
2274 default:
2275 TRACE_ERROR( "GMMRR_SUSPNED_CNF unexpected" );
2276 break;
2277 }
2278 GMM_RETURN;
2279 } /* kern_gmmrr_suspend_cnf() */
2280 /*
2281 +------------------------------------------------------------------------------
2282 | Function : kern_cgrlc_test_mode_cnf (TCS 2.1)
2283 +------------------------------------------------------------------------------
2284 | Description : Handles the primitive GMMRR_SUSPEND_CNF
2285 |
2286 | GRR confirms that the test mode is finished
2287 |
2288 | Parameters : *cgrlc_test_mode_cnf - Ptr to primitive payload (TCS 2.1)
2289 |
2290 +------------------------------------------------------------------------------
2291 */
2292 GLOBAL void kern_cgrlc_test_mode_cnf ( T_CGRLC_TEST_MODE_CNF *cgrlc_test_mode_cnf ) /* TCS 2.1 */
2293 {
2294 GMM_TRACE_FUNCTION( "kern_cgrlc_test_mode_cnf" ); /* TCS 2.1 */
2295 PFREE (cgrlc_test_mode_cnf); /* TCS 2.1 */
2296
2297 switch( GET_STATE( KERN ) )
2298 {
2299 case KERN_GMM_REG_TEST_MODE:
2300 kern_enter_reg_normal();
2301 break;
2302 case KERN_GMM_REG_TEST_MODE_NO_IMSI:
2303 /*
2304 * <R.GMM.DSUBFANO.M.003>
2305 */
2306
2307 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_SIM_REMOVED;
2308 kern_detach ();
2309 break;
2310 default:
2311 TRACE_ERROR( "CGRLC_TEST_MODE_CNF unexpected" ); /* TCS 2.1 */
2312 break;
2313 }
2314 GMM_RETURN;
2315 } /* kern_cgrlc_test_mode_cnf() */ /* TCS 2.1 */
2316
2317 /*
2318 +------------------------------------------------------------------------------
2319 | Function : kern_mmgmm_lup_needed_ind
2320 +------------------------------------------------------------------------------
2321 | Description : Handles the primitive MMGMM_LUP_NEEDED_IND
2322 |
2323 | MSC: 3.20.8 MMGMM LUP NEEDED IND
2324 |
2325 | Parameters : *mmgmm_lup_needed_ind - Ptr to primitive payload
2326 |
2327 +------------------------------------------------------------------------------
2328 */
2329 GLOBAL void kern_mmgmm_lup_needed_ind ( T_MMGMM_LUP_NEEDED_IND *mmgmm_lup_needed_ind )
2330 {
2331 GMM_TRACE_FUNCTION( "kern_mmgmm_lup_needed_ind" );
2332 #ifndef NTRACE
2333 switch (mmgmm_lup_needed_ind->reason) /* TCS 2.1 */
2334 {
2335 case MMGMM_T3212:
2336 TRACE_EVENT("T3212 has expired");
2337 break;
2338 case MMGMM_T_ACCEPT:
2339 TRACE_EVENT("T_ACCEPT has expired");
2340 break;
2341 case MMGMM_IMSI_IN_VLR:
2342 TRACE_EVENT("IMSI unknown in VLR received");
2343 break;
2344 case MMGMM_RXLEV_JUMP:
2345 TRACE_EVENT("RR indicated an increased RX level");
2346 break;
2347 case MMGMM_REG_TIMER:
2348 TRACE_EVENT("Registration timer in MM expired");
2349 break;
2350 default:
2351 TRACE_ERROR("GPRS indicator is out of range");
2352 break;
2353 }
2354 #endif
2355 switch (GET_STATE( KERN ))
2356 {
2357 case KERN_GMM_DEREG_RESUMING:
2358 case KERN_GMM_DEREG_SUSPENDED:
2359 case KERN_GMM_NULL_NO_IMSI:
2360 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
2361 case KERN_GMM_NULL_IMSI:
2362 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
2363 case KERN_GMM_DEREG_INITIATED:
2364 case KERN_GMM_DEREG_NO_IMSI:
2365 case KERN_GMM_DEREG_PLMN_SEARCH:
2366 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
2367 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
2368 case KERN_GMM_DEREG_LIMITED_SERVICE:
2369 case KERN_GMM_DEREG_SUSPENDING:
2370 case KERN_GMM_REG_NO_CELL_AVAILABLE:
2371 break;
2372 default:
2373 if( GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode
2374 && MMGMM_T3212==mmgmm_lup_needed_ind->reason) /* TCS 2.1 */
2375 /*
2376 * <R.GMM.MMGMMONE.M.002>, <R.GMM.MMGMMONE.M.003>
2377 */
2378 {
2379 PFREE (mmgmm_lup_needed_ind);
2380 GMM_RETURN;
2381 }
2382 break;
2383 }
2384
2385
2386 switch( GET_STATE( KERN ) )
2387 {
2388 case KERN_GMM_NULL_NO_IMSI:
2389 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
2390 case KERN_GMM_NULL_IMSI:
2391 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
2392 /*
2393 * After deregistration MM will receive mmgmm_reg_req
2394 * automatically
2395 */
2396 break;
2397 case KERN_GMM_DEREG_NO_IMSI:
2398 /* PLU also if #7 */
2399 /*NO break;*/
2400 case KERN_GMM_DEREG_PLMN_SEARCH:
2401
2402 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
2403 case KERN_GMM_DEREG_LIMITED_SERVICE:
2404 case KERN_GMM_REG_INITIATED:
2405 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
2406 #ifdef FF_EM_MODE
2407 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
2408 #endif
2409 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2410 break;
2411
2412 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
2413 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = TRUE;
2414 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
2415 #ifdef FF_EM_MODE
2416 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
2417 #endif
2418 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2419 break;
2420 case KERN_GMM_DEREG_INITIATED:
2421 case KERN_GMM_DEREG_RESUMING:
2422 case KERN_GMM_DEREG_SUSPENDED:
2423 case KERN_GMM_REG_SUSPENDED:
2424 case KERN_GMM_REG_RESUMING:
2425 case KERN_GMM_RAU_INITIATED:
2426 case KERN_GMM_RAU_WAIT_FOR_NPDU_LIST:
2427 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
2428 SET_STATE(MM, GMM_MM_REG_UPDATE_NEEDED);
2429 break;
2430
2431 case KERN_GMM_REG_SUSPENDING:
2432 case KERN_GMM_DEREG_SUSPENDING:
2433 gmm_data->kern.suspension_type |= GMM_SUSP_LAU;
2434 break;
2435
2436 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
2437 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=TRUE;
2438 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
2439 #ifdef FF_EM_MODE
2440 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
2441 #endif
2442 kern_llgmm_suspend(LLGMM_CALL);
2443 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2444 break;
2445 case KERN_GMM_REG_LIMITED_SERVICE:
2446 case KERN_GMM_REG_NO_CELL_AVAILABLE:
2447 if(gmm_data->kern.gmmrr_resume_sent)
2448 /*
2449 * GMM is waiting for GMMRR_CELL_IND. So I rememmber to attach MM with
2450 * seting mm_imsi_attached to update_needed
2451 */
2452 {
2453 SET_STATE(MM,GMM_MM_REG_UPDATE_NEEDED);
2454 }
2455 else
2456 {
2457 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
2458 #ifdef FF_EM_MODE
2459 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
2460 #endif
2461 kern_llgmm_suspend(LLGMM_CALL);
2462 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2463 }
2464 break;
2465 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
2466 case KERN_GMM_REG_NORMAL_SERVICE:
2467 if( GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode)
2468 {
2469 kern_rau();
2470 }
2471 else
2472 {
2473 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
2474 #ifdef FF_EM_MODE
2475 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
2476 #endif
2477 kern_llgmm_suspend(LLGMM_CALL);
2478 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2479 }
2480 break;
2481 case KERN_GMM_REG_TEST_MODE_NO_IMSI:
2482 case KERN_GMM_REG_TEST_MODE:
2483 break;
2484 default:
2485 TRACE_ERROR ("Unexpexcted state");
2486 break;
2487 }
2488
2489 PFREE (mmgmm_lup_needed_ind);
2490 GMM_RETURN;
2491 } /* kern_mmgmm_lup_needed_ind() */
2492
2493
2494 /*
2495 +------------------------------------------------------------------------------
2496 | Function : kern_mmgmm_lup_accept_ind
2497 +------------------------------------------------------------------------------
2498 | Description : Handles the primitive MMGMM_LUP_ACCEPT_IND
2499 |
2500 | MSC: 3.20.3 IMSI attach/detach
2501 |
2502 | Parameters : *mmgmm_lup_accept_ind - Ptr to primitive payload
2503 |
2504 +------------------------------------------------------------------------------
2505 */
2506 GLOBAL void kern_mmgmm_lup_accept_ind ( T_MMGMM_LUP_ACCEPT_IND *mmgmm_lup_accept_ind )
2507 {
2508 GMM_TRACE_FUNCTION( "kern_mmgmm_lup_accept_ind" );
2509
2510 switch( GET_STATE( KERN ) )
2511 {
2512 case KERN_GMM_NULL_PLMN_SEARCH:
2513 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
2514 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
2515 case KERN_GMM_NULL_NO_IMSI:
2516
2517 case KERN_GMM_NULL_IMSI:
2518 case KERN_GMM_DEREG_NO_IMSI:
2519 case KERN_GMM_DEREG_LIMITED_SERVICE:
2520 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
2521 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
2522 case KERN_GMM_DEREG_PLMN_SEARCH:
2523 case KERN_GMM_REG_INITIATED:
2524
2525 case KERN_GMM_DEREG_RESUMING:
2526 case KERN_GMM_DEREG_SUSPENDED:
2527 case KERN_GMM_DEREG_SUSPENDING:
2528 if ( GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode
2529 && GMMREG_CLASS_BC== gmm_data->kern.attach_cap.mobile_class )
2530 {
2531 kern_mmgmmreg_attach_cnf (GMMREG_AT_IMSI, SEARCH_NOT_RUNNING, (T_MMGMM_REG_CNF*)mmgmm_lup_accept_ind);
2532 }
2533 else
2534 {
2535 kern_mmgmmreg_attach_cnf (GMMREG_AT_IMSI, SEARCH_RUNNING, (T_MMGMM_REG_CNF*)mmgmm_lup_accept_ind);
2536 }
2537 break;
2538 case KERN_GMM_REG_NORMAL_SERVICE:
2539 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
2540 case KERN_GMM_REG_NO_CELL_AVAILABLE:
2541 case KERN_GMM_REG_LIMITED_SERVICE:
2542 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
2543 case KERN_GMM_DEREG_INITIATED:
2544 case KERN_GMM_RAU_INITIATED:
2545
2546 case KERN_GMM_REG_RESUMING:
2547 case KERN_GMM_REG_SUSPENDED:
2548 kern_mmgmmreg_attach_cnf (GMMREG_AT_COMB, SEARCH_RUNNING, (T_MMGMM_REG_CNF*)mmgmm_lup_accept_ind);
2549 break;
2550 default:
2551 TRACE_ERROR ("Unexpexcted state");
2552 break;
2553 }
2554 PFREE ( mmgmm_lup_accept_ind );
2555 GMM_RETURN;
2556 } /* kern_mmgmm_lup_accept_ind() */
2557 /*
2558 +------------------------------------------------------------------------------
2559 | Function : kern_mmgmm_lup_accept_ind
2560 +------------------------------------------------------------------------------
2561 | Description : Handles the primitive MMGMM_INFO_IND
2562 |
2563 | MSC: 3.20.6 MM Information
2564 |
2565 | Parameters : *mmgmm_info_ind - Ptr to primitive payload
2566 |
2567 +------------------------------------------------------------------------------
2568 */
2569 GLOBAL void kern_mmgmm_info_ind ( T_MMGMM_INFO_IND *mmgmm_info_ind )
2570 {
2571 GMM_TRACE_FUNCTION( "kern_mmgmm_info_ind" );
2572 {
2573 PPASS (mmgmm_info_ind, gmmreg_info_ind, GMMREG_INFO_IND);
2574 PSEND ( hCommMMI, gmmreg_info_ind );
2575 }
2576 GMM_RETURN;
2577 } /* kern_mmgmm_info_ind() */
2578
2579 /*
2580 +------------------------------------------------------------------------------
2581 | Function : kern_sim_authentication_cnf
2582 +------------------------------------------------------------------------------
2583 | Description : The function kern_sim_authentication_cnf
2584 |
2585 | Parameters : *sim_authentication_cnf - Ptr to primitive payload
2586 |
2587 +------------------------------------------------------------------------------
2588 */
2589 GLOBAL void kern_sim_authentication_cnf ( T_SIM_AUTHENTICATION_CNF *
2590 sim_authentication_cnf )
2591 {
2592 GMM_TRACE_FUNCTION( "kern_sim_authentication_cnf" );
2593
2594 switch( GET_STATE( KERN ) )
2595 {
2596 case KERN_GMM_REG_NORMAL_SERVICE:
2597 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
2598 case KERN_GMM_REG_NO_CELL_AVAILABLE:
2599 case KERN_GMM_REG_LIMITED_SERVICE:
2600 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
2601 case KERN_GMM_REG_INITIATED:
2602 case KERN_GMM_DEREG_INITIATED:
2603 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
2604 case KERN_GMM_RAU_INITIATED:
2605 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
2606 /*
2607 * PATCH ubuob 19.7.02: multiple outstanding AUTHENTICATION REQ messages
2608 * reduce the count of outstanding requests
2609 */
2610
2611 /*
2612 * only use this SIM answer if there are no other outstanding SIM_AUTHENTICATION_REQ messages!
2613 */
2614
2615 if (gmm_data->kern.auth_cap.last_auth_req_id == sim_authentication_cnf->req_id)
2616
2617
2618 if (gmm_data->kern.auth_cap.last_auth_req_id == sim_authentication_cnf->req_id)
2619 {
2620 MCAST (authentication_and_ciphering_response,
2621 AUTHENTICATION_AND_CIPHERING_RESPONSE);
2622 authentication_and_ciphering_response->a_c_reference_number
2623 .a_c_reference_number_value
2624 = gmm_data->kern.auth_cap.a_c_reference_number;
2625
2626 authentication_and_ciphering_response
2627 ->v_authentication_parameter_sres = TRUE;
2628 authentication_and_ciphering_response
2629 ->authentication_parameter_sres.sres_value.l_sres_value = MAX_SRES*8;
2630 authentication_and_ciphering_response
2631 ->authentication_parameter_sres.sres_value.o_sres_value = 0;
2632 memcpy (authentication_and_ciphering_response->
2633 authentication_parameter_sres.sres_value.b_sres_value,
2634 sim_authentication_cnf->sres, MAX_SRES);
2635
2636 memcpy ( gmm_data->kern.auth_cap.kc, sim_authentication_cnf->kc,
2637 MAX_KC ) ;
2638
2639 #ifdef GMM_TCS4
2640 gmm_data->kern.auth_cap.last_auth_req_id = NOT_PRESENT_8BIT;
2641 #endif
2642
2643 PFREE (sim_authentication_cnf);
2644 /*
2645 * <R.GMM.AUTH_RES.M.006>
2646 */
2647 {
2648 PALLOC ( llgmm_assign_req, LLGMM_ASSIGN_REQ );
2649 llgmm_assign_req->old_tlli = LLGMM_TLLI_INVALID;
2650 llgmm_assign_req->new_tlli = gmm_data->tlli.current;
2651 if (NO_KEY== gmm_data->kern.auth_cap.cksn)
2652 {
2653 memset (llgmm_assign_req->llgmm_kc.key, 0x0, MAX_KC);
2654 }
2655 else
2656 {
2657 memcpy ( llgmm_assign_req->llgmm_kc.key, gmm_data->kern.auth_cap.kc, MAX_KC );
2658 }
2659 llgmm_assign_req->ciphering_algorithm
2660 = gmm_data->kern.auth_cap.ciphering_algorithm;
2661
2662 PSEND ( hCommLLC, llgmm_assign_req );
2663 }
2664
2665
2666 if (IMEISV_REQUESTED == gmm_data->kern.auth_cap.imeisv_requested)
2667 {
2668 authentication_and_ciphering_response->v_gmobile_identity = TRUE;
2669 kern_get_imeisv (
2670 &authentication_and_ciphering_response->gmobile_identity);
2671 }
2672 else
2673 {
2674 authentication_and_ciphering_response->v_gmobile_identity = FALSE;
2675 }
2676 sig_kern_tx_data_req (CURRENT_TLLI,AUTHENTICATION_AND_CIPHERING_RESPONSE);
2677 }
2678 else
2679 {
2680 PFREE (sim_authentication_cnf);
2681 /*
2682 * mutliple authentication request problem occurred!!!!
2683 * ignore this SIM answer because another request has already been sent to
2684 * the SIM again and this overwrote the A&C reference number
2685 */
2686 TRACE_0_INFO ("error: Authentication received twice, SIM ignored");
2687 }
2688 /* end patch ubuob */
2689 break;
2690
2691 default:
2692
2693 PFREE (sim_authentication_cnf);
2694 TRACE_1_INFO ("state: %x", GET_STATE( KERN ));
2695 TRACE_ERROR("A&C RES unexpected");
2696 break;
2697 }
2698 GMM_RETURN;
2699 } /* kern_sim_authentication_cnf() */
2700
2701
2702 /*
2703 +------------------------------------------------------------------------------
2704 | Function : kern_mmgmm_nreg_cnf
2705 +------------------------------------------------------------------------------
2706 | Description : Handles the primitive MMGMM_NREG_CNF
2707 |
2708 | MSC: 3.20.3 IMSI attach/detach
2709 |
2710 | Parameters : *mmgmm_nreg_cnf - Ptr to primitive payload
2711 |
2712 +------------------------------------------------------------------------------
2713 */
2714 GLOBAL void kern_mmgmm_nreg_cnf ( T_MMGMM_NREG_CNF *mmgmm_nreg_cnf )
2715 {
2716 UBYTE detach_type;
2717 GMM_TRACE_FUNCTION( "kern_mmgmm_nreg_cnf" );
2718
2719 if (gmm_data->kern.attach_cap.mobile_class_changed
2720 && GMM_GRR_STATE_ON == gmm_data->kern.attach_cap.grr_state)
2721 {
2722 gmm_data->kern.attach_cap.mobile_class_changed=FALSE;
2723 kern_gmmrr_enable();
2724 }
2725
2726 switch (mmgmm_nreg_cnf->detach_cause) /* TCS 2.1 */
2727 {
2728 case CS_SIM_REM:
2729 detach_type = GMMREG_DT_SIM_REMOVED;
2730 TRACE_EVENT ("SIM is removed");
2731 break;
2732 case CS_POW_OFF:
2733 detach_type = GMMREG_DT_POWER_OFF;
2734 TRACE_EVENT ("Power is switched off");
2735 break;
2736 case CS_SOFT_OFF:
2737 detach_type = GMMREG_DT_SOFT_OFF;
2738 TRACE_EVENT ("Power is soft switched off");
2739 break;
2740 case CS_DISABLE:
2741 detach_type = GMMREG_DT_IMSI;
2742 TRACE_EVENT ("GSM switched off");
2743 break;
2744 default:
2745 detach_type = GMMREG_DT_POWER_OFF;
2746 TRACE_EVENT ("unknown detach type in MMGMM_NREG_CNF");
2747 break;
2748 }
2749 SET_STATE( MM, GMM_MM_DEREG );
2750 sig_kern_sync_set_mm_state(MMGMM_CELL_SELECTED);
2751
2752 if (gmm_data->sim_gprs_invalid && gmm_data->kern.cell_id.lac == GMMREG_LA_INVALID && mmgmm_nreg_cnf->detach_cause == CS_SIM_REM)
2753 {
2754 switch ( GET_STATE (KERN) )
2755 {
2756 case KERN_GMM_DEREG_PLMN_SEARCH:
2757 case KERN_GMM_DEREG_SUSPENDED:
2758 SET_STATE(KERN,KERN_GMM_DEREG_NO_IMSI);
2759 #ifdef FF_EM_MODE
2760 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI);
2761 #endif
2762 break;
2763 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
2764 kern_enter_reg_normal();
2765 break;
2766 case KERN_GMM_DEREG_NO_IMSI:
2767 SET_STATE(KERN,KERN_GMM_NULL_NO_IMSI);
2768 #ifdef FF_EM_MODE
2769 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
2770 #endif
2771 break;
2772 default:
2773 break;
2774 }
2775 PFREE ( mmgmm_nreg_cnf );
2776 GMM_RETURN;
2777 }
2778 switch ( GET_STATE (KERN) )
2779 {
2780 case KERN_GMM_DEREG_PLMN_SEARCH:
2781 switch(mmgmm_nreg_cnf->detach_cause) /* TCS 2.1 */
2782 {
2783 case CS_SOFT_OFF:
2784 case CS_POW_OFF:
2785 kern_gmmreg_detach (GMMREG_DT_POWER_OFF,
2786 GMMCS_POWER_OFF, /* TCS 2.1 */
2787 SEARCH_NOT_RUNNING,
2788 GMMCS_POWER_OFF);
2789 break;
2790 case CS_SIM_REM:
2791 SET_STATE(KERN,KERN_GMM_DEREG_NO_IMSI);
2792 #ifdef FF_EM_MODE
2793 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI);
2794 #endif
2795 kern_gmmreg_detach (GMMREG_DT_SIM_REMOVED,
2796 GMMCS_SIM_REMOVED, /* TCS 2.1 */
2797 SEARCH_NOT_RUNNING,
2798 GMMCS_SIM_REMOVED);
2799 break;
2800 default:
2801 kern_gmmreg_detach (GMMREG_DT_COMB,
2802 /* START UBUOB PATCH ISSUE 8381 */
2803 GMMCS_NET_CAUSE_NOT_PRESENT, /* TCS 2.1 */
2804 /* END UBUOB PATCH ISSUE 8381 */
2805 SEARCH_RUNNING,
2806 GMMCS_NET_CAUSE_NOT_PRESENT);
2807 kern_mm_activate_rr();
2808 break;
2809 }
2810
2811 break;
2812
2813 case KERN_GMM_NULL_NO_IMSI:
2814 case KERN_GMM_NULL_IMSI:
2815 /*
2816 * POWER OFF
2817 */
2818 if( CS_DISABLE==mmgmm_nreg_cnf->detach_cause) /* TCS 2.1 */
2819 {
2820 detach_type=GMMREG_DT_IMSI;
2821 }
2822 kern_gmmreg_detach (detach_type,
2823 gmm_data->kern.detach_cap.error_cause, /* TCS 2.1 */
2824 SEARCH_NOT_RUNNING,
2825 gmm_data->kern.detach_cap.error_cause);
2826
2827 break;
2828 case KERN_GMM_DEREG_SUSPENDED:
2829 switch(mmgmm_nreg_cnf->detach_cause) /* TCS 2.1 */
2830 {
2831 case CS_SOFT_OFF:
2832 kern_gmmreg_detach (GMMREG_DT_SOFT_OFF,
2833 GMMCS_POWER_OFF, /* TCS 2.1 */
2834 SEARCH_NOT_RUNNING,
2835 GMMCS_POWER_OFF);
2836 break;
2837 case CS_POW_OFF:
2838 kern_gmmreg_detach (GMMREG_DT_POWER_OFF,
2839 GMMCS_POWER_OFF, /* TCS 2.1 */
2840 SEARCH_NOT_RUNNING,
2841 GMMCS_POWER_OFF);
2842 break;
2843 case CS_SIM_REM:
2844 SET_STATE(KERN,KERN_GMM_DEREG_NO_IMSI);
2845 #ifdef FF_EM_MODE
2846 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI);
2847 #endif
2848 kern_gmmreg_detach (GMMREG_DT_SIM_REMOVED,
2849 GMMCS_SIM_REMOVED, /* TCS 2.1 */
2850 SEARCH_NOT_RUNNING,
2851 GMMCS_SIM_REMOVED);
2852 break;
2853 default:
2854 /* ACI can not handle SEARCH RUNNING to show GSM detached */
2855 if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode
2856 && GMMREG_CLASS_BG== gmm_data->kern.attach_cap.mobile_class )
2857 {
2858 kern_gmmreg_detach (GMMREG_DT_COMB,
2859 GMMCS_NET_CAUSE_NOT_PRESENT, /* TCS 2.1 */
2860 SEARCH_RUNNING,
2861 GMMCS_NET_CAUSE_NOT_PRESENT);
2862 }
2863 else
2864 {
2865 kern_gmmreg_detach (GMMREG_DT_COMB,
2866 GMMCS_NET_CAUSE_NOT_PRESENT, /* TCS 2.1 */
2867 SEARCH_NOT_RUNNING,
2868 GMMCS_NET_CAUSE_NOT_PRESENT);
2869 }
2870 break;
2871 }
2872 kern_call_undone_mm_proc_der();
2873 break;
2874 case KERN_GMM_REG_SUSPENDED:
2875 switch(mmgmm_nreg_cnf->detach_cause) /* TCS 2.1 */
2876 {
2877 case CS_SOFT_OFF:
2878 kern_gmmreg_detach (GMMREG_DT_SOFT_OFF,
2879 GMMCS_POWER_OFF, /* TCS 2.1 */
2880 SEARCH_NOT_RUNNING,
2881 GMMCS_POWER_OFF);
2882 break;
2883 case CS_POW_OFF:
2884 kern_gmmreg_detach (GMMREG_DT_POWER_OFF,
2885 GMMCS_POWER_OFF, /* TCS 2.1 */
2886 SEARCH_NOT_RUNNING,
2887 GMMCS_POWER_OFF);
2888 break;
2889 case CS_DISABLE:
2890 if (GMMREG_DT_IMSI == gmm_data->kern.detach_cap.detach_type)
2891 {
2892 kern_gmmreg_detach (GMMREG_DT_IMSI,
2893 GMMCS_NET_CAUSE_NOT_PRESENT, /* TCS 2.1 */
2894 SEARCH_NOT_RUNNING,
2895 GMMCS_NET_CAUSE_NOT_PRESENT);
2896 break;
2897 }
2898 /*
2899 * else: wait for gprs detach to be finished
2900 * FALLTHROUGH
2901 */
2902 case CS_SIM_REM:
2903 if (GMMRR_NET_MODE_III!=gmm_data->kern.sig_cell_info.net_mode)
2904 {
2905
2906 /*
2907 * Wait until GPRS is deregistered
2908 */
2909 break;
2910 }
2911 /*
2912 * else NO break;
2913 * we are ms class BG and have switched off GSM
2914 */
2915 default:
2916 kern_gmmreg_detach (GMMREG_DT_IMSI,
2917 GMMCS_NET_CAUSE_NOT_PRESENT, /* TCS 2.1 */
2918 SEARCH_NOT_RUNNING,
2919 GMMCS_NET_CAUSE_NOT_PRESENT);
2920 break;
2921 }
2922 kern_call_undone_mm_proc_reg();
2923 break;
2924 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
2925 kern_enter_reg_normal();
2926 if(GMMRR_NET_MODE_I!=gmm_data->kern.sig_cell_info.net_mode)
2927 /*
2928 * In NMO I gmmreg_detach_cnf was sent before requesting
2929 * mmgmm_net_req
2930 */
2931 {
2932 kern_gmmreg_detach (detach_type,
2933 GMMCS_NET_CAUSE_NOT_PRESENT, /* TCS 2.1 */
2934 GMMREG_SEARCH_NOT_RUNNING,
2935 GMMCS_NET_CAUSE_NOT_PRESENT);
2936 }
2937 break;
2938 case KERN_GMM_REG_NORMAL_SERVICE:
2939 break;
2940 case KERN_GMM_DEREG_NO_IMSI:
2941 SET_STATE(KERN,KERN_GMM_NULL_NO_IMSI);
2942 #ifdef FF_EM_MODE
2943 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
2944 #endif
2945 kern_gmmreg_detach (detach_type,
2946 GMMCS_INT_NOT_PRESENT, /* TCS 2.1 */
2947 GMMREG_SEARCH_NOT_RUNNING,
2948 GMMCS_INT_NOT_PRESENT);
2949 break;
2950 default:
2951 TRACE_ERROR( "MMGMM_NREG_CNF unexpected" );
2952 break;
2953 }
2954 PFREE ( mmgmm_nreg_cnf );
2955
2956 #ifdef TRACE_FUNC
2957 #ifdef IDENTATION
2958 if (gmm_data->deep<=0) {
2959 /*
2960 * after power off deep is set to 0 in kern_init so we need here normal
2961 * return
2962 */
2963 return;
2964 }
2965 else
2966 {
2967 GMM_RETURN;
2968 }
2969 #endif
2970 #endif
2971 } /* kern_mmgmm_nreg_cnf() */
2972
2973 /*
2974 +------------------------------------------------------------------------------
2975 | Function : kern_mmgmm_auth_rej_ind
2976 +------------------------------------------------------------------------------
2977 | Description : Handles the primitive MMGMM_AUTH_REJ_IND
2978 |
2979 | Parameters : *mmgmm_auth_rej_ind - Ptr to primitive payload
2980 |
2981 +------------------------------------------------------------------------------
2982 */
2983 GLOBAL void kern_mmgmm_auth_rej_ind ( T_MMGMM_AUTH_REJ_IND *mmgmm_auth_rej_ind )
2984 {
2985 GMM_TRACE_FUNCTION( "kern_mmgmm_auth_rej_ind" );
2986 PFREE (mmgmm_auth_rej_ind);
2987
2988 gmm_data->sim_gprs_invalid = TRUE;
2989 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_SIM_REMOVED;
2990 kern_sim_del_locigprs ();
2991 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED;
2992 kern_sim_gmm_update ();
2993
2994 GMM_RETURN;
2995 } /* kern_mmgmm_auth_rej_ind() */
2996
2997 /*
2998 +------------------------------------------------------------------------------
2999 | Function : kern_mmgmm_t3212_val_ind
3000 |
3001 | Description : Handles the primitive MMGMM_T3212_VAL _IND
3002 |
3003 | Parameters : *mmgmm_t3212_val_ind - Ptr to primitive payload
3004 |
3005 +------------------------------------------------------------------------------
3006 */
3007 GLOBAL void kern_mmgmm_t3212_val_ind ( T_MMGMM_T3212_VAL_IND *mmgmm_t3212_val_ind )
3008 {
3009 GMM_TRACE_FUNCTION( "kern_mmgmm_t3212_val_ind" );
3010
3011 #ifdef REL99
3012 switch (gmm_data->kern.sig_cell_info.sgsnr_flag)/*!gmm_data->release99 =>old code*/ /* TCS 4.0 */
3013 {
3014 default:
3015 case PS_SGSN_UNKNOWN:
3016 case PS_SGSN_98_OLDER:
3017 #endif
3018
3019 /*
3020 * see GSM04.08 ch. 11.2.2 NOTE 4
3021 */
3022 gmm_data->kern.t3302_val = mmgmm_t3212_val_ind->t3212_val;
3023 /*
3024 * Boeser Hack wegen Faulheit, signal should be taken
3025 */
3026 gmm_data->sync.mm_cell_info.t3212_val = gmm_data->kern.t3302_val;
3027
3028 #ifdef REL99
3029 break;
3030 case PS_SGSN_99_ONWARDS:
3031 break;
3032 }
3033 #endif
3034
3035 PFREE ( mmgmm_t3212_val_ind );
3036 GMM_RETURN;
3037 } /* kern_mmgmm_t3212_val_ind() */
3038
3039 /*
3040 +------------------------------------------------------------------------------
3041 | Function : kern_mmgmm_cm_establish_ind
3042 +------------------------------------------------------------------------------
3043 | Description : Handles the primitive MMGMM_CM_ESTABLISH_IND
3044 |
3045 | Parameters : *mmgmm_cm_establish_ind - Ptr to primitive payload
3046 |
3047 +------------------------------------------------------------------------------
3048 */
3049 GLOBAL void kern_mmgmm_cm_establish_ind ( T_MMGMM_CM_ESTABLISH_IND *mmgmm_cm_establish_ind )
3050 {
3051 GMM_TRACE_FUNCTION( "kern_mmgmm_cm_establish_ind" );
3052
3053 PFREE ( mmgmm_cm_establish_ind );
3054
3055 if (gmm_data->kern.gmmrr_resume_sent)
3056 {
3057 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3058 GMM_RETURN;
3059 }
3060
3061 switch( GET_STATE( KERN ) )
3062 {
3063 case KERN_GMM_DEREG_RESUMING:
3064 case KERN_GMM_REG_RESUMING:
3065 TRACE_ERROR ("prim should be saved");
3066 break;
3067 case KERN_GMM_DEREG_SUSPENDING:
3068 case KERN_GMM_REG_SUSPENDING:
3069 gmm_data->kern.suspension_type |= GMM_SUSP_CALL;
3070 break;
3071
3072 case KERN_GMM_DEREG_SUSPENDED:
3073 case KERN_GMM_NULL_IMSI:
3074 kern_mm_cm_establish_res (MMGMM_ESTABLISH_OK);
3075 break;
3076 case KERN_GMM_DEREG_LIMITED_SERVICE:
3077 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
3078 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
3079 case KERN_GMM_DEREG_PLMN_SEARCH:
3080 case KERN_GMM_DEREG_INITIATED:
3081 case KERN_GMM_REG_INITIATED:
3082 switch (gmm_data->kern.attach_cap.mobile_class)
3083 {
3084 case GMMREG_CLASS_A:
3085 if (GMMRR_NET_MODE_III == gmm_data->kern.sig_cell_info.net_mode)
3086 {
3087 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3088 }
3089 else
3090 {
3091 kern_mm_cm_establish_res (MMGMM_ESTABLISH_OK);
3092 }
3093 break;
3094 case GMMREG_CLASS_CG:
3095 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3096 break;
3097 case GMMREG_CLASS_BG:
3098 if (GMMRR_NET_MODE_III == gmm_data->kern.sig_cell_info.net_mode)
3099 {
3100 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3101 break;
3102 }
3103 /* NO break */
3104 case GMMREG_CLASS_B:
3105 case GMMREG_CLASS_BC:
3106 /* START PATCH UBUOB ISSUE 8278 */
3107 switch (GET_STATE (KERN))
3108 {
3109 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
3110 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = TRUE;
3111 break;
3112 default:
3113 break;
3114 }
3115 /* END PATCH UBUOB ISSUE 8278 */
3116
3117 if (GMM_MM_DEREG != GET_STATE(MM))
3118 {
3119 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
3120 #ifdef FF_EM_MODE
3121 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
3122 #endif
3123 /* START PATCH UBUOB ISSUE 8781 */
3124 /* kern_gmmreg_suspend (GMMREG_CS_CALL); */
3125 /* END PATCH UBUOB ISSUE 8781 */
3126 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_ABNORMAL_RELEASE, GMM_SUSP_CALL);
3127 vsi_t_stop(GMM_handle, kern_T3321);
3128 }
3129 else
3130 {
3131 SET_STATE( KERN, KERN_GMM_DEREG_SUSPENDING);
3132 #ifdef FF_EM_MODE
3133 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING);
3134 #endif
3135 /*
3136 * kern_llgmm_unassign();
3137 */
3138 kern_llgmm_suspend(LLGMM_CALL);
3139 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_ABNORMAL_RELEASE, GMM_SUSP_CALL);
3140 }
3141 break;
3142 default:
3143 TRACE_ERROR( "unknown MS class");
3144 break;
3145 }
3146 break;
3147 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
3148 case KERN_GMM_REG_NO_CELL_AVAILABLE:
3149 case KERN_GMM_REG_LIMITED_SERVICE:
3150 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
3151 case KERN_GMM_RAU_INITIATED:
3152 switch (gmm_data->kern.attach_cap.mobile_class)
3153 {
3154 case GMMREG_CLASS_A:
3155 kern_mm_cm_establish_res (MMGMM_ESTABLISH_OK);
3156 break;
3157 case GMMREG_CLASS_CG:
3158 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3159 break;
3160 case GMMREG_CLASS_BG:
3161 if (GMMRR_NET_MODE_III == gmm_data->kern.sig_cell_info.net_mode)
3162 {
3163 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3164 break;
3165 }
3166 /* NO break; */
3167 case GMMREG_CLASS_B:
3168 case GMMREG_CLASS_BC:
3169 /* START PATCH UBUOB ISSUE 8278 */
3170 switch (GET_STATE (KERN))
3171 {
3172 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
3173 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = TRUE;
3174 break;
3175 default:
3176 break;
3177 }
3178 /* END PATCH UBUOB ISSUE 8278 */
3179 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
3180 #ifdef FF_EM_MODE
3181 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
3182 #endif
3183 kern_llgmm_suspend(LLGMM_CALL);
3184 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_ABNORMAL_RELEASE, GMM_SUSP_CALL);
3185 break;
3186 default:
3187 TRACE_ERROR( "unknown MS class");
3188 break;
3189 }
3190 break;
3191
3192 case KERN_GMM_REG_NORMAL_SERVICE:
3193 switch (gmm_data->kern.attach_cap.mobile_class)
3194 {
3195 case GMMREG_CLASS_A:
3196 kern_mm_cm_establish_res (MMGMM_ESTABLISH_OK);
3197 break;
3198 case GMMREG_CLASS_CG:
3199 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3200 break;
3201 case GMMREG_CLASS_BG:
3202 if (GMMRR_NET_MODE_III == gmm_data->kern.sig_cell_info.net_mode)
3203 {
3204 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3205 break;
3206 }
3207 /* NO break; */
3208 case GMMREG_CLASS_B:
3209 case GMMREG_CLASS_BC:
3210 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
3211 #ifdef FF_EM_MODE
3212 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
3213 #endif
3214 kern_llgmm_suspend(LLGMM_CALL);
3215 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_ABNORMAL_RELEASE, GMM_SUSP_CALL);
3216 break;
3217 default:
3218 TRACE_ERROR( "unknown MS class");
3219 break;
3220 }
3221 break;
3222 case KERN_GMM_REG_SUSPENDED:
3223 switch (gmm_data->kern.attach_cap.mobile_class)
3224 {
3225 case GMMREG_CLASS_A:
3226 kern_mm_cm_establish_res (MMGMM_ESTABLISH_OK);
3227 break;
3228 case GMMREG_CLASS_CG:
3229 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3230 break;
3231 case GMMREG_CLASS_BG:
3232 if (GMMRR_NET_MODE_III == gmm_data->kern.sig_cell_info.net_mode)
3233 {
3234 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3235 break;
3236 }
3237 /* NO break; */
3238 case GMMREG_CLASS_B:
3239 case GMMREG_CLASS_BC:
3240 /*
3241 * call is rejected because MM may establish the call by itself.
3242 * When state REG_RESUMING will be defined than GMM will return OK.
3243 * In case of waiting for GMMRR_CELL_IND after GMMRR_RESUME_REQ
3244 * the mobile will run into a dead lock situation otherwise.
3245 */
3246 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3247 break;
3248 default:
3249 TRACE_ERROR( "unknown MS class");
3250 break;
3251 }
3252 break;
3253 case KERN_GMM_DEREG_NO_IMSI:
3254 case KERN_GMM_NULL_NO_IMSI:
3255 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3256 break;
3257 default:
3258 kern_mm_cm_establish_res (MMGMM_ESTABLISH_REJECT);
3259 TRACE_1_INFO ("state: %x", GET_STATE( KERN ));
3260 TRACE_ERROR( "MMGMM_CM_ESTABLISH_IND unexpected" );
3261 break;
3262 }
3263 GMM_RETURN;
3264 } /* kern_mm_cm_establish_ind() */
3265 /*
3266 +------------------------------------------------------------------------------
3267 | Function : kern_mmgmm_cm_emergency_ind
3268 +------------------------------------------------------------------------------
3269 | Description : Handles the primitive MMGMM_CM_EMERGENCY_IND
3270 |
3271 | Parameters : *mmgmm_cm_emergency_ind - Ptr to primitive payload
3272 |
3273 +------------------------------------------------------------------------------
3274 */
3275 GLOBAL void kern_mmgmm_cm_emergency_ind ( T_MMGMM_CM_EMERGENCY_IND *mmgmm_cm_emergency_ind )
3276 {
3277 GMM_TRACE_FUNCTION( "kern_mmgmm_cm_emeregncy_ind" );
3278
3279 PFREE ( mmgmm_cm_emergency_ind );
3280
3281 if (GMMREG_CLASS_A == gmm_data->kern.attach_cap.mobile_class
3282 && GMMRR_NET_MODE_III != gmm_data->kern.sig_cell_info.net_mode)
3283 {
3284 kern_mm_cm_emergency_res (MMGMM_ESTABLISH_OK);
3285 GMM_RETURN;
3286 }
3287
3288 switch( GET_STATE( KERN ) )
3289 {
3290 case KERN_GMM_DEREG_RESUMING:
3291 case KERN_GMM_REG_RESUMING:
3292 TRACE_ERROR ("prim should be saved");
3293 break;
3294
3295 case KERN_GMM_DEREG_SUSPENDING:
3296 case KERN_GMM_REG_SUSPENDING:
3297 gmm_data->kern.suspension_type |= GMM_SUSP_EM_CALL;
3298 break;
3299 case KERN_GMM_DEREG_SUSPENDED:
3300 case KERN_GMM_REG_SUSPENDED:
3301 case KERN_GMM_NULL_IMSI:
3302 case KERN_GMM_NULL_NO_IMSI:
3303 case KERN_GMM_NULL_PLMN_SEARCH:
3304 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
3305 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
3306 kern_mm_cm_emergency_res (MMGMM_ESTABLISH_OK);
3307 break;
3308 case KERN_GMM_DEREG_NO_IMSI:
3309 if (gmm_data->kern.detach_cap.gmmreg)
3310 /*
3311 * The mobile is switching off this moment. Thera are no power anymore
3312 */
3313 {
3314 kern_mm_cm_emergency_res (MMGMM_ESTABLISH_REJECT);
3315 }
3316 break;
3317
3318 case KERN_GMM_DEREG_PLMN_SEARCH:
3319 case KERN_GMM_DEREG_LIMITED_SERVICE:
3320 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
3321 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
3322 case KERN_GMM_DEREG_INITIATED:
3323 case KERN_GMM_REG_INITIATED:
3324 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
3325 #ifdef FF_EM_MODE
3326 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
3327 #endif
3328 kern_llgmm_suspend(LLGMM_CALL);
3329 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_ABNORMAL_RELEASE, GMM_SUSP_EM_CALL);
3330 break;
3331 case KERN_GMM_RAU_WAIT_FOR_NPDU_LIST:
3332 case KERN_GMM_REG_IMSI_DETACH_INITIATED:
3333 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
3334 case KERN_GMM_REG_NO_CELL_AVAILABLE:
3335 case KERN_GMM_REG_LIMITED_SERVICE:
3336 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
3337 case KERN_GMM_RAU_INITIATED:
3338 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING);
3339 #ifdef FF_EM_MODE
3340 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING);
3341 #endif
3342 kern_llgmm_suspend(LLGMM_CALL);
3343 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_ABNORMAL_RELEASE, GMM_SUSP_EM_CALL);
3344 break;
3345 case KERN_GMM_REG_NORMAL_SERVICE:
3346 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
3347 #ifdef FF_EM_MODE
3348 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
3349 #endif
3350 /*
3351 * kern_llgmm_unassign();
3352 */
3353 kern_llgmm_suspend(LLGMM_CALL);
3354 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_ABNORMAL_RELEASE, GMM_SUSP_EM_CALL);
3355 break;
3356 default:
3357 TRACE_ERROR( "MMGMM_CM_EMERGENCY_IND unexpected" );
3358 break;
3359 }
3360 GMM_RETURN;
3361 } /* kern_mm_cm_emergency_ind() */
3362 /*
3363 +------------------------------------------------------------------------------
3364 | Function : kern_mmgmm_cm_release_ind
3365 +------------------------------------------------------------------------------
3366 | Description : Handles the primitive MMGMM_CM_RELEASE_IND
3367 |
3368 | Parameters : *mmgmm_cm_release_ind - Ptr to primitive payload
3369 |
3370 +------------------------------------------------------------------------------
3371 */
3372 GLOBAL void kern_mmgmm_cm_release_ind ( T_MMGMM_CM_RELEASE_IND *mmgmm_cm_release_ind )
3373 {
3374 GMM_TRACE_FUNCTION( "kern_mmgmm_cm_release_ind" );
3375
3376 switch( GET_STATE( KERN ) )
3377 {
3378 case KERN_GMM_REG_SUSPENDED:
3379 /*
3380 * resume with cell_ind
3381 */
3382 if (MMGMM_RESUMPTION_OK!=mmgmm_cm_release_ind->resumption)
3383 {
3384 TRACE_EVENT("Para: resumption failure: RAU needed");
3385 SET_STATE(GU,GU_UPDATE_NEEDED);
3386 }
3387 else
3388 {
3389 TRACE_EVENT("OPar: resumption OK.");
3390 }
3391 PFREE ( mmgmm_cm_release_ind );
3392 kern_call_undone_mm_proc_reg();
3393 break;
3394 case KERN_GMM_DEREG_SUSPENDED:
3395 PFREE ( mmgmm_cm_release_ind );
3396 kern_call_undone_mm_proc_der();
3397 break;
3398 case KERN_GMM_DEREG_SUSPENDING:
3399 case KERN_GMM_REG_SUSPENDING:
3400 gmm_data->kern.suspension_type &= ~ (GMM_SUSP_CALL|GMM_SUSP_EM_CALL);
3401
3402 PFREE ( mmgmm_cm_release_ind );
3403 break;
3404
3405 default:
3406
3407 if (GMMREG_CLASS_A!=gmm_data->kern.attach_cap.mobile_class)
3408 {
3409 TRACE_ERROR( "MMGMM_CM_RELEASE_IND unexpected" );
3410 }
3411 PFREE ( mmgmm_cm_release_ind );
3412 break;
3413 }
3414 GMM_RETURN;
3415 } /* kern_mm_cm_release_ind() */
3416
3417 /*
3418 +------------------------------------------------------------------------------
3419 | Function : kern_mmgmm_plmn_ind
3420 +------------------------------------------------------------------------------
3421 | Description : Handles the primitive MMGMM_PLMN_IND
3422 |
3423 | MSC: 3.20 MM Interface
3424 | MSC: 3.20.2 Network selection
3425 |
3426 | Parameters : *mmgmm_plmn_ind - Ptr to primitive payload
3427 |
3428 +------------------------------------------------------------------------------
3429 */
3430 GLOBAL void kern_mmgmm_plmn_ind ( T_MMGMM_PLMN_IND *mmgmm_plmn_ind )
3431 {
3432 GMM_TRACE_FUNCTION( "kern_mmgmm_plmn_ind" );
3433 {
3434 PPASS (mmgmm_plmn_ind, gmmreg_plmn_ind, GMMREG_PLMN_IND);
3435 PSEND ( hCommMMI, gmmreg_plmn_ind );
3436 }
3437 GMM_RETURN;
3438 } /* kern_mm_plmn_ind() */
3439
3440
3441 /*
3442 +------------------------------------------------------------------------------
3443 | Function : kern_gmmreg_attach_req
3444 +------------------------------------------------------------------------------
3445 | Description : Handles the the primitive GMMREG_ATTACH_REQ
3446 |
3447 | This signal passed the attach_type from MMI to
3448 | the service KERN
3449 |
3450 | MSC : 3.4 MMI-initiated normal/combined GPRS attach
3451 |
3452 | Parameters : *gmmreq_attach_req - Ptr to primitive payload
3453 |
3454 +------------------------------------------------------------------------------
3455 */
3456 GLOBAL void kern_gmmreg_attach_req ( T_GMMREG_ATTACH_REQ *gmmreg_attach_req )
3457 {
3458 U8 attach_type_changed = FALSE;
3459 GMM_TRACE_FUNCTION( "kern_gmmreg_attach_req" );
3460 TRACE_EVENT ("hp_gmm_24473#1#24473"); /* TCS 2.1 */
3461
3462 /* Changes for Boot Time Speedup. GMM will get dummy GMMREG_ATTACH_REQ indicating QUICK_REG.
3463 * GMM will send MMGMM_REG_REQ indicating QUICK_REG. No need to process this request as it is
3464 * dummy request and GMM will get other GMMREG_ATTACH_REQ indicating NORMAL_REG
3465 */
3466 if (gmmreg_attach_req->bootup_act EQ QUICK_REG)
3467 {
3468 kern_mm_reg_req (REG_GPRS_INACTIVE, QUICK_REG);
3469 return ;
3470 }
3471 vsi_t_stop ( GMM_handle, kern_T3302);
3472 sig_kern_rdy_stop_t3302_req();
3473 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau = FALSE;
3474 /*
3475 * attach_cap.gmmreg sets the caller of the attach procedure to MMI
3476 */
3477 gmm_data->kern.attach_cap.gmmreg = TRUE;
3478 gmm_data->kern.detach_cap.gmmreg = FALSE;
3479
3480 gmm_data->kern.attach_cap.service_mode = gmmreg_attach_req->service_mode;
3481
3482
3483 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
3484 {
3485 /*
3486 * I expect that limited service means emergency call over GSM only
3487 * CLASS_CC can be set, because service mode is changed via
3488 * GMMREG_ATTACH_REQ only, so that the wanted mobile class is giveb again
3489 */
3490 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
3491 gmm_data->kern.attach_cap.attach_type = GMMREG_AT_IMSI;
3492
3493 }
3494 else
3495 {
3496 /*
3497 *PATCH TB 26/10/02 <
3498 * Inform GRR of the new MS class
3499 */
3500 attach_type_changed =
3501 ( gmm_data->kern.attach_cap.mobile_class != gmmreg_attach_req->mobile_class
3502 || gmm_data->kern.attach_cap.attach_type!= gmmreg_attach_req->attach_type);
3503
3504 if (GMM_GRR_STATE_OFF != gmm_data->kern.attach_cap.grr_state
3505 && (gmm_data->kern.attach_cap.mobile_class != gmmreg_attach_req->mobile_class))
3506 {
3507 if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode)
3508 {
3509 gmm_data->kern.attach_cap.mobile_class_changed = TRUE;
3510 gmm_data->kern.attach_cap.mobile_class = gmmreg_attach_req->mobile_class;
3511 /*
3512 * inform GRR after switch (mmgmm_nreg_cnf xor kern _enter_der)
3513 * kern_gmmrr_enable();
3514 */
3515 }
3516 else
3517 {
3518 gmm_data->kern.attach_cap.mobile_class = gmmreg_attach_req->mobile_class;
3519 kern_gmmrr_enable();
3520 }
3521 }
3522 /* PATCH TB 26/10/02 > */
3523
3524
3525 gmm_data->kern.attach_cap.mobile_class = gmmreg_attach_req->mobile_class;
3526 /*
3527 * if MMI wants to detach, then detach is expected or class change
3528 */
3529 gmm_data->kern.attach_cap.attach_type =
3530 (GMMREG_CLASS_CG == gmmreg_attach_req->mobile_class?
3531 GMMREG_AT_GPRS:
3532 gmm_data->kern.attach_cap.attach_type|gmmreg_attach_req->attach_type);
3533
3534 }
3535
3536
3537
3538 #ifndef NTRACE
3539 switch (gmmreg_attach_req->service_mode)
3540 {
3541 case SERVICE_MODE_LIMITED:
3542 TRACE_EVENT ("Limited Service");
3543 break;
3544 case SERVICE_MODE_FULL:
3545 TRACE_EVENT ("Full Service");
3546 break;
3547 default:
3548 TRACE_ERROR ("wrong Service requested");
3549 }
3550 switch ( gmm_data->kern.attach_cap.mobile_class )
3551 {
3552 case GMMREG_CLASS_CC:
3553 TRACE_0_PARA("MS class CC");
3554 break;
3555 case GMMREG_CLASS_CG:
3556 TRACE_0_PARA("MS class CG");
3557 break;
3558 case GMMREG_CLASS_B:
3559 TRACE_0_PARA("MS class B");
3560 break;
3561 case GMMREG_CLASS_BG:
3562 TRACE_0_PARA("MS class BG");
3563 break;
3564 case GMMREG_CLASS_BC:
3565 TRACE_0_PARA("MS class BC");
3566 break;
3567 case GMMREG_CLASS_A:
3568 TRACE_0_PARA("MS class A");
3569 break;
3570 default:
3571 TRACE_ERROR ("unknown mobile class");
3572 break;
3573 }
3574 switch (gmm_data->kern.attach_cap.attach_type)
3575 {
3576 case GMMREG_AT_IMSI:
3577 TRACE_0_PARA("GSM only attach");
3578 break;
3579 case GMMREG_AT_GPRS:
3580 TRACE_0_PARA("GPRS attach");
3581 break;
3582 case GMMREG_AT_COMB:
3583 TRACE_0_PARA("GSM and GPRS attach");
3584 break;
3585 default:
3586 TRACE_ERROR ("unknown attach type");
3587 TRACE_1_PARA("%d",gmm_data->kern.attach_cap.attach_type);
3588 break;
3589 }
3590 #endif
3591
3592 if (gmm_data->sim_gprs_invalid
3593 && GMMREG_CLASS_CG == gmm_data->kern.attach_cap.mobile_class)
3594 /*
3595 * i.e. error cause 7: gprs not allowed
3596 */
3597 {
3598 PREUSE(gmmreg_attach_req,gmmreg_attach_rej,GMMREG_ATTACH_REJ );
3599 gmmreg_attach_rej->detach_type =
3600 (GMM_MM_REG_NORMAL_SERVICE == GET_STATE(MM)?GMMREG_DT_GPRS:GMMREG_DT_COMB),
3601 gmmreg_attach_rej->search_running = GMMREG_SEARCH_NOT_RUNNING,
3602 gmmreg_attach_rej->cause = GMMCS_GPRS_NOT_ALLOWED; /* TCS 2.1 */
3603 gmmreg_attach_rej->service = GMMCS_GPRS_NOT_ALLOWED;
3604 gmm_data->kern.attach_cap.gmmreg = FALSE;
3605
3606 PSEND ( hCommMMI, gmmreg_attach_rej );
3607 GMM_RETURN;
3608 }
3609
3610
3611 PFREE ( gmmreg_attach_req );
3612
3613 switch( GET_STATE( KERN ) )
3614 {
3615 /*
3616 * GMM-DEREGISTERED
3617 */
3618 case KERN_GMM_DEREG_RESUMING:
3619 case KERN_GMM_REG_RESUMING:
3620 TRACE_ERROR ("prim should be saved");
3621 break;
3622
3623 case KERN_GMM_DEREG_PLMN_SEARCH:
3624 case KERN_GMM_DEREG_LIMITED_SERVICE:
3625 case KERN_GMM_DEREG_NO_CELL_AVAILABLE:
3626 case KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH:
3627
3628 case KERN_GMM_DEREG_SUSPENDING:
3629 case KERN_GMM_DEREG_SUSPENDED:
3630 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
3631 {
3632 SET_STATE ( KERN, KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
3633 #ifdef FF_EM_MODE
3634 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
3635 #endif
3636 kern_gmmrr_disable();
3637 kern_mm_activate_mm();
3638 break;
3639 }
3640
3641 if (GMMREG_CLASS_CC==gmm_data->kern.attach_cap.mobile_class
3642 || GMMREG_AT_IMSI== gmm_data->kern.attach_cap.attach_type)
3643 {
3644 SET_STATE ( KERN, KERN_GMM_NULL_IMSI );
3645 #ifdef FF_EM_MODE
3646 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI );
3647 #endif
3648 kern_gmmrr_disable();
3649 kern_mm_activate_mm();
3650 if ( GMM_MM_REG_NORMAL_SERVICE == GET_STATE(MM) )
3651 {
3652 kern_gmmreg_attach_cnf( GMMREG_AT_IMSI);
3653 }
3654 break;
3655 }
3656
3657 switch ( gmm_data->kern.attach_cap.mobile_class )
3658 {
3659 case GMMREG_CLASS_CG:
3660 if ( GMM_MM_DEREG != GET_STATE(MM) )
3661 {
3662 switch( GET_STATE( KERN ) )
3663 {
3664 case KERN_GMM_DEREG_SUSPENDED:
3665 /*
3666 * Case GMMREG_CLASS_CG.
3667 * The detach procedure for cs is only possible after receiving
3668 * GMMRR_CELL_IND
3669 */
3670 break;
3671 case KERN_GMM_DEREG_SUSPENDING:
3672 gmm_data->kern.suspension_type |=GMM_SUSP_IMSI_DETACH;
3673 break;
3674 default:
3675 if (kern_lai_changed() )
3676 {
3677 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
3678 #ifdef FF_EM_MODE
3679 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
3680 #endif
3681 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
3682 }
3683 else
3684 {
3685 kern_imsi_detach_der_susp();
3686 }
3687 GMM_RETURN;
3688 }
3689 }
3690 break;
3691 default:
3692 break;
3693 }
3694
3695 switch( GET_STATE( KERN ) )
3696 {
3697 case KERN_GMM_DEREG_SUSPENDED:
3698 gmm_data->kern.attach_cap.mm_lau_attempted=TRUE;
3699 gmm_data->kern.suspension_type &= ~GMM_SUSP_LAU;
3700 break;
3701 case KERN_GMM_DEREG_SUSPENDING:
3702 gmm_data->kern.suspension_type |=GMM_SUSP_LAU;
3703 break;
3704 default:
3705 {
3706 kern_mm_reg_req (REG_CELL_SEARCH_ONLY, NORMAL_REG);
3707 }
3708 break;
3709
3710 }
3711 break;
3712 case KERN_GMM_NULL_PLMN_SEARCH:
3713 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
3714 {
3715 SET_STATE (KERN,KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
3716 #ifdef FF_EM_MODE
3717 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
3718 #endif
3719 kern_mm_activate_mm ();
3720 break;
3721 }
3722
3723 if (GMMREG_CLASS_CC==gmm_data->kern.attach_cap.mobile_class
3724 || GMMREG_AT_IMSI== gmm_data->kern.attach_cap.attach_type)
3725 {
3726 kern_mm_activate_mm ();
3727 break;
3728 }
3729
3730
3731 switch ( gmm_data->kern.attach_cap.mobile_class )
3732 {
3733 case GMMREG_CLASS_CG:
3734 if ( GMM_MM_DEREG != GET_STATE(MM) )
3735 {
3736 SET_STATE(KERN, KERN_GMM_DEREG_PLMN_SEARCH);
3737 #ifdef FF_EM_MODE
3738 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH);
3739 #endif
3740 /*
3741 * MM enters autmaticly gprs cell search mode so that GMM
3742 * need not to send mmgmm_reg_req (cell_search_only)
3743 */
3744 kern_mm_imsi_detach();
3745 }
3746 else
3747 {
3748 SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH );
3749 #ifdef FF_EM_MODE
3750 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH );
3751 #endif
3752 kern_mm_activate_rr();
3753 }
3754 break;
3755 default:
3756 /*
3757 * class A and B
3758 */
3759 SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH );
3760 #ifdef FF_EM_MODE
3761 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH );
3762 #endif
3763 kern_mm_activate_rr();
3764 break;
3765 }
3766 break;
3767 /*
3768 * GPRS will be enabled
3769 */
3770 case KERN_GMM_NULL_IMSI:
3771 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
3772 {
3773 SET_STATE (KERN,KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
3774 #ifdef FF_EM_MODE
3775 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ);
3776 #endif
3777 kern_mm_activate_mm ();
3778 break;
3779 }
3780 if (GMM_MM_DEREG != GET_STATE(MM)
3781 && GMMREG_CLASS_CC == gmm_data->kern.attach_cap.mobile_class)
3782 {
3783 TRACE_EVENT ("GMMREG_ATTACH_REQ has been come twice and is ignored!");
3784 /*
3785 * the funcion is not alled because mm_plmn is used.
3786 */
3787
3788 kern_gmmreg_attach_cnf(GMMREG_AT_IMSI);
3789 gmm_data->kern.attach_cap.gmmreg = FALSE;
3790
3791 break;
3792 }
3793 /* NO break */
3794 case KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ:
3795 if (SERVICE_MODE_LIMITED != gmm_data->kern.attach_cap.service_mode)
3796 {
3797 gmm_data->kern.sig_cell_info.gmm_status = GMMRR_SERVICE_UNKNOWN ; /* Initalize gmm status value */
3798 switch ( gmm_data->kern.attach_cap.mobile_class )
3799 {
3800 case GMMREG_CLASS_CC:
3801 if (KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ==GET_STATE(KERN)
3802 || GMM_MM_DEREG == GET_STATE(MM))
3803 {
3804 SET_STATE ( KERN, KERN_GMM_NULL_PLMN_SEARCH );
3805 #ifdef FF_EM_MODE
3806 EM_GMM_SET_STATE(KERN_GMM_NULL_PLMN_SEARCH );
3807 #endif
3808 kern_mm_activate_mm();
3809 }
3810 else
3811 {
3812 SET_STATE(KERN,KERN_GMM_NULL_IMSI);
3813 #ifdef FF_EM_MODE
3814 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI);
3815 #endif
3816 kern_gmmreg_attach_cnf( GMMREG_AT_IMSI);
3817 }
3818 break;
3819 case GMMREG_CLASS_CG:
3820 if ( GMM_MM_DEREG != GET_STATE(MM) )
3821 {
3822 switch(GET_STATE(KERN))
3823 {
3824 case KERN_GMM_NULL_IMSI:
3825 SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH);
3826 #ifdef FF_EM_MODE
3827 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH);
3828 #endif
3829 /*
3830 * MM enters autmaticly gprs cell search mode so that GMM
3831 * need not to send mmgmm_reg_req (cell_search_only)
3832 */
3833 kern_mm_imsi_detach();
3834 break;
3835 default:
3836 break;
3837 }
3838 }
3839 else
3840 {
3841 SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH );
3842 #ifdef FF_EM_MODE
3843 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH );
3844 #endif
3845 kern_mm_activate_rr();
3846 }
3847 break;
3848 default:
3849 /*
3850 * class A and B
3851 */
3852 if (GMMREG_AT_IMSI== gmm_data->kern.attach_cap.attach_type)
3853 {
3854 SET_STATE ( KERN, KERN_GMM_NULL_PLMN_SEARCH );
3855 #ifdef FF_EM_MODE
3856 EM_GMM_SET_STATE(KERN_GMM_NULL_PLMN_SEARCH );
3857 #endif
3858 kern_mm_activate_mm();
3859 }
3860 else
3861 {
3862 SET_STATE ( KERN, KERN_GMM_DEREG_PLMN_SEARCH );
3863 #ifdef FF_EM_MODE
3864 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH );
3865 #endif
3866
3867 kern_mm_activate_rr();
3868 }
3869 break;
3870 }
3871 }
3872 break;
3873 /* end case KERN_GMM_NULL_IMSI */
3874
3875 case KERN_GMM_DEREG_NO_IMSI:
3876 /*
3877 * this state is not necessary, it is the same as NULL_NO_IMSI
3878 * and will be romoved soon
3879 */
3880
3881 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
3882 {
3883 SET_STATE (KERN,KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ);
3884 #ifdef FF_EM_MODE
3885 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ);
3886 #endif
3887 }
3888 else
3889 {
3890 SET_STATE (KERN,KERN_GMM_NULL_NO_IMSI);
3891 #ifdef FF_EM_MODE
3892 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
3893 #endif
3894 }
3895 kern_gmmrr_disable();
3896 kern_mm_activate_mm();
3897 break;
3898
3899 case KERN_GMM_NULL_NO_IMSI:
3900 /*
3901 * Attach Rejected for the first time to enable POWER_OFF
3902 */
3903 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
3904 {
3905 SET_STATE (KERN,KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ);
3906 #ifdef FF_EM_MODE
3907 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ);
3908 #endif
3909 }
3910 kern_mm_activate_mm();
3911 break;
3912 case KERN_GMM_NULL_NO_IMSI_LIMITED_SERVICE_REQ:
3913 if ( SERVICE_MODE_LIMITED != gmm_data->kern.attach_cap.service_mode)
3914 {
3915 SET_STATE (KERN,KERN_GMM_NULL_NO_IMSI);
3916 #ifdef FF_EM_MODE
3917 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
3918 #endif
3919 }
3920 kern_mm_activate_mm();
3921 break;
3922 case KERN_GMM_REG_NORMAL_SERVICE:
3923 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
3924 {
3925 kern_l_sim_rem_reg();
3926 }
3927 else
3928 {
3929 switch ( gmm_data->kern.attach_cap.mobile_class )
3930 {
3931 case GMMREG_CLASS_CC:
3932 if ( GMM_MM_REG_NORMAL_SERVICE == GET_STATE(MM) )
3933 {
3934 kern_gmmreg_attach_cnf ( GMMREG_AT_IMSI );
3935 }
3936 kern_disable();
3937 break;
3938 case GMMREG_CLASS_CG:
3939 if (GMM_MM_DEREG != GET_STATE(MM))
3940 {
3941 if (kern_lai_changed() )
3942 {
3943 switch (gmm_data->kern.sig_cell_info.net_mode)
3944 {
3945 case GMMRR_NET_MODE_I:
3946 kern_rau();
3947 break;
3948 default:
3949 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
3950 #ifdef FF_EM_MODE
3951 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
3952 #endif
3953 kern_llgmm_suspend(LLGMM_CALL);
3954 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
3955 break;
3956 }
3957 }
3958 else
3959 {
3960 switch (gmm_data->kern.sig_cell_info.net_mode)
3961 {
3962 case GMMRR_NET_MODE_I:
3963 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_IMSI;
3964 kern_detach();
3965 break;
3966 default:
3967 kern_imsi_detach_reg_susp();
3968 break;
3969 }
3970 }
3971 GMM_RETURN;
3972 }
3973 /*
3974 * <R.GMM.AGACCEPT.M.027>,
3975 * <R.GMM.PATTCNF.M.001>
3976 */
3977 else
3978 {
3979 kern_gmmreg_attach_cnf ( GMMREG_AT_GPRS );
3980 }
3981 break;
3982 default:
3983 if (attach_type_changed)
3984 {
3985 /*
3986 * class A and B
3987 */
3988 if ( GMM_MM_REG_NORMAL_SERVICE == GET_STATE(MM) )
3989 {
3990 kern_gmmreg_attach_cnf ( GMMREG_AT_COMB );
3991 }
3992 else
3993 {
3994 /*
3995 * Combined RAU procedure is established
3996 * if GPRS is attached and IMSI should attached
3997 */
3998
3999 kern_rau();
4000 }
4001 }
4002 else
4003 {
4004 kern_mm_reg_req (REG_CELL_SEARCH_ONLY, NORMAL_REG);
4005 }
4006 break;
4007 }
4008 }
4009 break;
4010 case KERN_GMM_REG_SUSPENDED:
4011 case KERN_GMM_REG_SUSPENDING:
4012 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
4013 {
4014 kern_l_sim_rem_reg_lim ();
4015 break;
4016 }
4017 /*
4018 * Attach requests in suspended mode will be handled after resumption
4019 * by triggering form GRR with GMMRR_CELL_IND
4020 */
4021 break;
4022
4023 case KERN_GMM_REG_NO_CELL_AVAILABLE:
4024 case KERN_GMM_REG_LIMITED_SERVICE:
4025 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
4026 {
4027 kern_l_sim_rem_reg_lim ();
4028 break;
4029 }
4030 /* NO break */
4031 case KERN_GMM_RAU_INITIATED:
4032 case KERN_GMM_REG_INITIATED:
4033 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
4034 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
4035
4036 if (SERVICE_MODE_LIMITED == gmm_data->kern.attach_cap.service_mode)
4037 {
4038 kern_l_sim_rem_reg ();
4039 }
4040 else
4041 {
4042 switch ( gmm_data->kern.attach_cap.mobile_class )
4043 {
4044 case GMMREG_CLASS_CC:
4045
4046 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_DISABLE_GPRS;
4047
4048 kern_local_detach( GMMCS_INT_PROTOCOL_ERROR, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_NULL_IMSI); /* TCS 2.1 */
4049 if ( GMM_MM_REG_NORMAL_SERVICE == GET_STATE(MM) )
4050 {
4051 kern_gmmreg_attach_cnf ( GMMREG_AT_IMSI );
4052 }
4053 kern_enter_der();
4054 break;
4055 case GMMREG_CLASS_CG:
4056 if (GMM_MM_DEREG != GET_STATE(MM))
4057 {
4058 if (kern_lai_changed() )
4059 {
4060 switch(GET_STATE(KERN))
4061 {
4062 case KERN_GMM_REG_NO_CELL_AVAILABLE:
4063 case KERN_GMM_RAU_INITIATED:
4064 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM:
4065 case KERN_GMM_REG_ATTEMPTING_TO_UPDATE:
4066 kern_llgmm_suspend(LLGMM_CALL);
4067 break;
4068 default:
4069 break;
4070 }
4071
4072 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
4073 #ifdef FF_EM_MODE
4074 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
4075 #endif
4076
4077
4078 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
4079 }
4080 else
4081 {
4082 kern_imsi_detach_reg_susp();
4083 }
4084 GMM_RETURN;
4085 }
4086 else
4087 /*
4088 * <R.GMM.AGACCEPT.M.027>,
4089 * <R.GMM.PATTCNF.M.001>
4090 */
4091 {
4092 if (KERN_GMM_REG_INITIATED!=GET_STATE(KERN))
4093 {
4094 kern_gmmreg_attach_cnf ( GMMREG_AT_GPRS );
4095 }
4096 }
4097 break;
4098 default:
4099
4100 {
4101 kern_mm_reg_req (REG_CELL_SEARCH_ONLY, NORMAL_REG);
4102 }
4103 break;
4104 }
4105 }
4106 break;
4107 default:
4108 TRACE_ERROR( "GMMREG_ATTACH_REQ unexpected" );
4109 break;
4110
4111 }
4112 GMM_RETURN;
4113 } /* kern_gmmreg_attach_req() */
4114
4115
4116 /*
4117 +------------------------------------------------------------------------------
4118 | Function : kern_gmmsm_sequence_res
4119 +------------------------------------------------------------------------------
4120 | Description : Handles the primitive GMMSM_SEQENCE_RES
4121 |
4122 | Parameters : *gmmsm_sequence_res - Ptr to primitive payload
4123 |
4124 +------------------------------------------------------------------------------
4125 */
4126 #ifdef GMM_TCS4
4127 GLOBAL void kern_gmmsm_sequence_res ( T_MMPM_SEQUENCE_RES *gmmsm_sequence_res )
4128 #else
4129 GLOBAL void kern_gmmsm_sequence_res ( T_GMMSM_SEQUENCE_RES *gmmsm_sequence_res )
4130 #endif
4131 {
4132 GMM_TRACE_FUNCTION( "kern_gmmsm_sequence_res" );
4133
4134
4135 switch( GET_STATE( KERN ) )
4136 {
4137 case KERN_GMM_RAU_WAIT_FOR_NPDU_LIST:
4138 {
4139 int i=0;
4140 MCAST (routing_area_update_complete, ROUTING_AREA_UPDATE_COMPLETE);
4141 routing_area_update_complete->v_receive_n_pdu_number_list = TRUE;
4142 routing_area_update_complete->receive_n_pdu_number_list.
4143 c_receive_n_pdu_number_list_val = gmmsm_sequence_res->c_npdu_list;
4144
4145 for (i=0;i<routing_area_update_complete->receive_n_pdu_number_list.c_receive_n_pdu_number_list_val;i++)
4146 {
4147 routing_area_update_complete
4148 ->receive_n_pdu_number_list.receive_n_pdu_number_list_val[i]
4149 .nsapi
4150 = gmmsm_sequence_res->npdu_list[i].nsapi;
4151
4152 routing_area_update_complete
4153 ->receive_n_pdu_number_list.receive_n_pdu_number_list_val[i]
4154 .receive_n_pdu_number_val
4155
4156 = gmmsm_sequence_res->npdu_list[i].receive_n_pdu_number_val;
4157
4158 }
4159
4160 PFREE (gmmsm_sequence_res);
4161 kern_rau_complete (gmm_data->kern.attach_cap.result_type);
4162
4163 break;
4164 }
4165 default:
4166 PFREE (gmmsm_sequence_res);
4167 TRACE_ERROR( "GMMSM_SEQUENCE_RES received in an unusual state." );
4168 break;
4169 }
4170 GMM_RETURN;
4171 } /* kern_gmmsm_sequence_res() */
4172
4173 /*TI DK primitive*/
4174 #ifdef REL99
4175 /*+------------------------------------------------------------------------------
4176 | Function : kern_gmmsm_pdp_status_req
4177 +------------------------------------------------------------------------------
4178 | Description : Handles the primitive GMMSM_PDP_STATUS_REQ
4179 |
4180 | Parameters : *gmmsm_pdp_status_req - Ptr to primitive payload
4181 |
4182 +------------------------------------------------------------------------------
4183 */
4184 GLOBAL void kern_gmmsm_pdp_status_req ( T_MMPM_PDP_CONTEXT_STATUS_REQ *gmmsm_pdp_status_req )
4185
4186 {
4187 GMM_TRACE_FUNCTION( "kern_gmmsm_pdp_status_req" );
4188
4189 /* Store the data in context */
4190 gmm_data->kern.attach_cap.pdp_context_status =
4191 gmmsm_pdp_status_req->nsapi_set;
4192
4193 GMM_RETURN;
4194 } /* kern_gmmsm_pdp_status_req() */
4195 #endif
4196
4197 /*
4198 +------------------------------------------------------------------------------
4199 | Function : kern_mmgmm_ciphering_ind
4200 +------------------------------------------------------------------------------
4201 | Description : forwards the ciphering indicator of GSM to MMI
4202 |
4203 | Parameters : *mmgmm_ciphering_ind - Ptr to primitive payload
4204 |
4205 +------------------------------------------------------------------------------
4206 */
4207 GLOBAL void kern_mmgmm_ciphering_ind ( T_MMGMM_CIPHERING_IND *mmgmm_ciphering_ind )
4208 {
4209 GMM_TRACE_FUNCTION( "kern_mmgmm_ciphering_ind" );
4210 {
4211 PALLOC (gmmreg_ciphering_ind, GMMREG_CIPHERING_IND);
4212 gmmreg_ciphering_ind->gsm_ciph = mmgmm_ciphering_ind->ciph;
4213 /*
4214 * do not include the ciphering status of gprs purposely to have the
4215 * behaviour for GSM and for GPRS (do not remember the status of the other!)
4216 */
4217 gmmreg_ciphering_ind->gprs_ciph = CIPH_NA;
4218 PFREE ( mmgmm_ciphering_ind );
4219 PSEND ( hCommMMI, gmmreg_ciphering_ind );
4220 }
4221 GMM_RETURN;
4222 } /* kern_mmgmm_ciphering_ind() */
4223 /*
4224 +------------------------------------------------------------------------------
4225 | Function : kern_mmgmm_tmsi_ind
4226 +------------------------------------------------------------------------------
4227 | Description : forwards the TMSI received in MM to GMM
4228 |
4229 | Parameters : *mmgmm_tmsi_ind - Ptr to primitive payload
4230 |
4231 +------------------------------------------------------------------------------
4232 */
4233 GLOBAL void kern_mmgmm_tmsi_ind ( T_MMGMM_TMSI_IND *mmgmm_tmsi_ind )
4234 {
4235 GMM_TRACE_FUNCTION( "kern_mmgmm_tmsi_ind" );
4236 gmm_data->tmsi = mmgmm_tmsi_ind->tmsi;
4237 TRACE_1_PARA("TMSI %x", gmm_data->tmsi );
4238 PFREE ( mmgmm_tmsi_ind );
4239 GMM_RETURN;
4240 } /* kern_mmgmm_ciphering_ind() */
4241
4242 /*
4243 +------------------------------------------------------------------------------
4244 | Function : kern_mmgmm_ahplmn_ind
4245 +------------------------------------------------------------------------------
4246 | Description : forwards the ahplmn indicator to MMI
4247 |
4248 | Parameters : *mmgmm_ahplmn_ind - Ptr to primitive payload
4249 |
4250 +------------------------------------------------------------------------------
4251 */
4252 GLOBAL void kern_mmgmm_ahplmn_ind ( T_MMGMM_AHPLMN_IND *mmgmm_ahplmn_ind )
4253 {
4254 GMM_TRACE_FUNCTION( "kern_mmgmm_ahplmn_ind" );
4255 {
4256 PPASS (mmgmm_ahplmn_ind, gmmreg_ahplmn_ind, GMMREG_AHPLMN_IND);
4257 PSEND ( hCommMMI, gmmreg_ahplmn_ind );
4258 }
4259 GMM_RETURN;
4260 } /* kern_mmgmm_ahplmn_ind() */