aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsaccess.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace/nsaccess.c')
-rw-r--r--drivers/acpi/namespace/nsaccess.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index 1149bc18fb35..48fadade52e2 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void)
70 union acpi_operand_object *obj_desc; 70 union acpi_operand_object *obj_desc;
71 acpi_string val = NULL; 71 acpi_string val = NULL;
72 72
73 ACPI_FUNCTION_TRACE("ns_root_initialize"); 73 ACPI_FUNCTION_TRACE(ns_root_initialize);
74 74
75 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 75 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
76 if (ACPI_FAILURE(status)) { 76 if (ACPI_FAILURE(status)) {
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void)
98 "Entering predefined entries into namespace\n")); 98 "Entering predefined entries into namespace\n"));
99 99
100 for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { 100 for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
101
101 /* _OSI is optional for now, will be permanent later */ 102 /* _OSI is optional for now, will be permanent later */
102 103
103 if (!ACPI_STRCMP(init_val->name, "_OSI") 104 if (!ACPI_STRCMP(init_val->name, "_OSI")
@@ -156,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void)
156 157
157#if defined (ACPI_ASL_COMPILER) 158#if defined (ACPI_ASL_COMPILER)
158 159
159 /* save the parameter count for the i_aSL compiler */ 160 /* Save the parameter count for the i_aSL compiler */
160 161
161 new_node->value = obj_desc->method.param_count; 162 new_node->value = obj_desc->method.param_count;
162#else 163#else
@@ -258,10 +259,8 @@ acpi_status acpi_ns_root_initialize(void)
258 /* Save a handle to "_GPE", it is always present */ 259 /* Save a handle to "_GPE", it is always present */
259 260
260 if (ACPI_SUCCESS(status)) { 261 if (ACPI_SUCCESS(status)) {
261 status = 262 status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH,
262 acpi_ns_get_node_by_path("\\_GPE", NULL, 263 &acpi_gbl_fadt_gpe_device);
263 ACPI_NS_NO_UPSEARCH,
264 &acpi_gbl_fadt_gpe_device);
265 } 264 }
266 265
267 return_ACPI_STATUS(status); 266 return_ACPI_STATUS(status);
@@ -310,17 +309,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
310 acpi_object_type type_to_check_for; 309 acpi_object_type type_to_check_for;
311 acpi_object_type this_search_type; 310 acpi_object_type this_search_type;
312 u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; 311 u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
313 u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | 312 u32 local_flags;
314 ACPI_NS_SEARCH_PARENT);
315 313
316 ACPI_FUNCTION_TRACE("ns_lookup"); 314 ACPI_FUNCTION_TRACE(ns_lookup);
317 315
318 if (!return_node) { 316 if (!return_node) {
319 return_ACPI_STATUS(AE_BAD_PARAMETER); 317 return_ACPI_STATUS(AE_BAD_PARAMETER);
320 } 318 }
321 319
322 acpi_gbl_ns_lookup_count++; 320 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
323 *return_node = ACPI_ENTRY_NOT_FOUND; 321 *return_node = ACPI_ENTRY_NOT_FOUND;
322 acpi_gbl_ns_lookup_count++;
324 323
325 if (!acpi_gbl_root_node) { 324 if (!acpi_gbl_root_node) {
326 return_ACPI_STATUS(AE_NO_NAMESPACE); 325 return_ACPI_STATUS(AE_NO_NAMESPACE);
@@ -346,14 +345,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
346 return_ACPI_STATUS(AE_AML_INTERNAL); 345 return_ACPI_STATUS(AE_AML_INTERNAL);
347 } 346 }
348 347
349 /* 348 if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) {
350 * This node might not be a actual "scope" node (such as a 349 /*
351 * Device/Method, etc.) It could be a Package or other object node. 350 * This node might not be a actual "scope" node (such as a
352 * Backup up the tree to find the containing scope node. 351 * Device/Method, etc.) It could be a Package or other object node.
353 */ 352 * Backup up the tree to find the containing scope node.
354 while (!acpi_ns_opens_scope(prefix_node->type) && 353 */
355 prefix_node->type != ACPI_TYPE_ANY) { 354 while (!acpi_ns_opens_scope(prefix_node->type) &&
356 prefix_node = acpi_ns_get_parent_node(prefix_node); 355 prefix_node->type != ACPI_TYPE_ANY) {
356 prefix_node =
357 acpi_ns_get_parent_node(prefix_node);
358 }
357 } 359 }
358 } 360 }
359 361
@@ -365,6 +367,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
365 * Begin examination of the actual pathname 367 * Begin examination of the actual pathname
366 */ 368 */
367 if (!pathname) { 369 if (!pathname) {
370
368 /* A Null name_path is allowed and refers to the root */ 371 /* A Null name_path is allowed and refers to the root */
369 372
370 num_segments = 0; 373 num_segments = 0;
@@ -389,6 +392,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
389 * to the current scope). 392 * to the current scope).
390 */ 393 */
391 if (*path == (u8) AML_ROOT_PREFIX) { 394 if (*path == (u8) AML_ROOT_PREFIX) {
395
392 /* Pathname is fully qualified, start from the root */ 396 /* Pathname is fully qualified, start from the root */
393 397
394 this_node = acpi_gbl_root_node; 398 this_node = acpi_gbl_root_node;
@@ -416,6 +420,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
416 this_node = prefix_node; 420 this_node = prefix_node;
417 num_carats = 0; 421 num_carats = 0;
418 while (*path == (u8) AML_PARENT_PREFIX) { 422 while (*path == (u8) AML_PARENT_PREFIX) {
423
419 /* Name is fully qualified, no search rules apply */ 424 /* Name is fully qualified, no search rules apply */
420 425
421 search_parent_flag = ACPI_NS_NO_UPSEARCH; 426 search_parent_flag = ACPI_NS_NO_UPSEARCH;
@@ -430,6 +435,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
430 num_carats++; 435 num_carats++;
431 this_node = acpi_ns_get_parent_node(this_node); 436 this_node = acpi_ns_get_parent_node(this_node);
432 if (!this_node) { 437 if (!this_node) {
438
433 /* Current scope has no parent scope */ 439 /* Current scope has no parent scope */
434 440
435 ACPI_ERROR((AE_INFO, 441 ACPI_ERROR((AE_INFO,
@@ -569,6 +575,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
569 &this_node); 575 &this_node);
570 if (ACPI_FAILURE(status)) { 576 if (ACPI_FAILURE(status)) {
571 if (status == AE_NOT_FOUND) { 577 if (status == AE_NOT_FOUND) {
578
572 /* Name not found in ACPI namespace */ 579 /* Name not found in ACPI namespace */
573 580
574 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 581 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
@@ -602,10 +609,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
602 (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && 609 (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
603 (this_node->type != ACPI_TYPE_ANY) && 610 (this_node->type != ACPI_TYPE_ANY) &&
604 (this_node->type != type_to_check_for)) { 611 (this_node->type != type_to_check_for)) {
612
605 /* Complain about a type mismatch */ 613 /* Complain about a type mismatch */
606 614
607 ACPI_WARNING((AE_INFO, 615 ACPI_WARNING((AE_INFO,
608 "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", 616 "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
609 ACPI_CAST_PTR(char, &simple_name), 617 ACPI_CAST_PTR(char, &simple_name),
610 acpi_ut_get_type_name(this_node->type), 618 acpi_ut_get_type_name(this_node->type),
611 acpi_ut_get_type_name 619 acpi_ut_get_type_name
f='#n419'>419 420 421 422 423 424 425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776



                           
                          

                            













































































                                                     






                                         






                                       


                                         

                                                    

  

                                                

                                                 






























































































                                                                                              
                                               





































                                                                          
                               
  



















                                
                                         
                  























































































                                                                                             

                                 












                                          

                     
















                                      


































                                                                       

                                    



                                       
                                    

















                                          

































                                                                                        























                                                                             

                                                                        







                                    
                                    









                                       



















                                                   

                                                 









                                                     
                     

                                                    

                                                   
                     

                                                   

                                                 

                                                  


                                           
















                                                                                        
                        








                                                                                       

                                                                         



                                                                      



                                                                
                                                                             
                                                      


                                                               
                                                                    


                                                                         







                                                                                         
                                        

                                                           


                                                        
                                                    
                                                                           
                                                
 







                                                      
















                                                           


                                        
                             
                                                                          



                                      
                                                                              

                      











                                                                                  
                                     

                                                                         

              









                                                     











                                                     

                                   

                                                                               









                                                             
                                                                   









                                                                            
                                                                             
                            
                              

                              
                                 
                                

                            

                                         












                                                                               






                                                              



                                 
#ifndef __LINUX_RTNETLINK_H
#define __LINUX_RTNETLINK_H

#include <linux/netlink.h>
#include <linux/if_link.h>
#include <linux/if_addr.h>
#include <linux/neighbour.h>

/****
 *		Routing/neighbour discovery messages.
 ****/

/* Types of messages */

enum {
	RTM_BASE	= 16,
#define RTM_BASE	RTM_BASE

	RTM_NEWLINK	= 16,
#define RTM_NEWLINK	RTM_NEWLINK
	RTM_DELLINK,
#define RTM_DELLINK	RTM_DELLINK
	RTM_GETLINK,
#define RTM_GETLINK	RTM_GETLINK
	RTM_SETLINK,
#define RTM_SETLINK	RTM_SETLINK

	RTM_NEWADDR	= 20,
#define RTM_NEWADDR	RTM_NEWADDR
	RTM_DELADDR,
#define RTM_DELADDR	RTM_DELADDR
	RTM_GETADDR,
#define RTM_GETADDR	RTM_GETADDR

	RTM_NEWROUTE	= 24,
#define RTM_NEWROUTE	RTM_NEWROUTE
	RTM_DELROUTE,
#define RTM_DELROUTE	RTM_DELROUTE
	RTM_GETROUTE,
#define RTM_GETROUTE	RTM_GETROUTE

	RTM_NEWNEIGH	= 28,
#define RTM_NEWNEIGH	RTM_NEWNEIGH
	RTM_DELNEIGH,
#define RTM_DELNEIGH	RTM_DELNEIGH
	RTM_GETNEIGH,
#define RTM_GETNEIGH	RTM_GETNEIGH

	RTM_NEWRULE	= 32,
#define RTM_NEWRULE	RTM_NEWRULE
	RTM_DELRULE,
#define RTM_DELRULE	RTM_DELRULE
	RTM_GETRULE,
#define RTM_GETRULE	RTM_GETRULE

	RTM_NEWQDISC	= 36,
#define RTM_NEWQDISC	RTM_NEWQDISC
	RTM_DELQDISC,
#define RTM_DELQDISC	RTM_DELQDISC
	RTM_GETQDISC,
#define RTM_GETQDISC	RTM_GETQDISC

	RTM_NEWTCLASS	= 40,
#define RTM_NEWTCLASS	RTM_NEWTCLASS
	RTM_DELTCLASS,
#define RTM_DELTCLASS	RTM_DELTCLASS
	RTM_GETTCLASS,
#define RTM_GETTCLASS	RTM_GETTCLASS

	RTM_NEWTFILTER	= 44,
#define RTM_NEWTFILTER	RTM_NEWTFILTER
	RTM_DELTFILTER,
#define RTM_DELTFILTER	RTM_DELTFILTER
	RTM_GETTFILTER,
#define RTM_GETTFILTER	RTM_GETTFILTER

	RTM_NEWACTION	= 48,
#define RTM_NEWACTION   RTM_NEWACTION
	RTM_DELACTION,
#define RTM_DELACTION   RTM_DELACTION
	RTM_GETACTION,
#define RTM_GETACTION   RTM_GETACTION

	RTM_NEWPREFIX	= 52,
#define RTM_NEWPREFIX	RTM_NEWPREFIX

	RTM_GETMULTICAST = 58,
#define RTM_GETMULTICAST RTM_GETMULTICAST

	RTM_GETANYCAST	= 62,
#define RTM_GETANYCAST	RTM_GETANYCAST

	RTM_NEWNEIGHTBL	= 64,
#define RTM_NEWNEIGHTBL	RTM_NEWNEIGHTBL
	RTM_GETNEIGHTBL	= 66,
#define RTM_GETNEIGHTBL	RTM_GETNEIGHTBL
	RTM_SETNEIGHTBL,
#define RTM_SETNEIGHTBL	RTM_SETNEIGHTBL

	RTM_NEWNDUSEROPT = 68,
#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT

	__RTM_MAX,
#define RTM_MAX		(((__RTM_MAX + 3) & ~3) - 1)
};

#define RTM_NR_MSGTYPES	(RTM_MAX + 1 - RTM_BASE)
#define RTM_NR_FAMILIES	(RTM_NR_MSGTYPES >> 2)
#define RTM_FAM(cmd)	(((cmd) - RTM_BASE) >> 2)

/* 
   Generic structure for encapsulation of optional route information.
   It is reminiscent of sockaddr, but with sa_family replaced
   with attribute type.
 */

struct rtattr
{
	unsigned short	rta_len;
	unsigned short	rta_type;
};

/* Macros to handle rtattributes */

#define RTA_ALIGNTO	4
#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
			 (rta)->rta_len >= sizeof(struct rtattr) && \
			 (rta)->rta_len <= (len))
#define RTA_NEXT(rta,attrlen)	((attrlen) -= RTA_ALIGN((rta)->rta_len), \
				 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
#define RTA_LENGTH(len)	(RTA_ALIGN(sizeof(struct rtattr)) + (len))
#define RTA_SPACE(len)	RTA_ALIGN(RTA_LENGTH(len))
#define RTA_DATA(rta)   ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
#define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))




/******************************************************************************
 *		Definitions used in routing table administration.
 ****/

struct rtmsg
{
	unsigned char		rtm_family;
	unsigned char		rtm_dst_len;
	unsigned char		rtm_src_len;
	unsigned char		rtm_tos;

	unsigned char		rtm_table;	/* Routing table id */
	unsigned char		rtm_protocol;	/* Routing protocol; see below	*/