@@ -420,8 +420,7 @@ static struct nfit_test_resource *nfit_test_lookup(resource_size_t addr)
420420
421421static int nfit_test0_alloc (struct nfit_test * t )
422422{
423- size_t nfit_size = sizeof (struct acpi_table_nfit )
424- + sizeof (struct acpi_nfit_system_address ) * NUM_SPA
423+ size_t nfit_size = sizeof (struct acpi_nfit_system_address ) * NUM_SPA
425424 + sizeof (struct acpi_nfit_memory_map ) * NUM_MEM
426425 + sizeof (struct acpi_nfit_control_region ) * NUM_DCR
427426 + sizeof (struct acpi_nfit_data_region ) * NUM_BDW
@@ -471,8 +470,7 @@ static int nfit_test0_alloc(struct nfit_test *t)
471470
472471static int nfit_test1_alloc (struct nfit_test * t )
473472{
474- size_t nfit_size = sizeof (struct acpi_table_nfit )
475- + sizeof (struct acpi_nfit_system_address )
473+ size_t nfit_size = sizeof (struct acpi_nfit_system_address )
476474 + sizeof (struct acpi_nfit_memory_map )
477475 + sizeof (struct acpi_nfit_control_region );
478476
@@ -488,39 +486,24 @@ static int nfit_test1_alloc(struct nfit_test *t)
488486 return 0 ;
489487}
490488
491- static void nfit_test_init_header (struct acpi_table_nfit * nfit , size_t size )
492- {
493- memcpy (nfit -> header .signature , ACPI_SIG_NFIT , 4 );
494- nfit -> header .length = size ;
495- nfit -> header .revision = 1 ;
496- memcpy (nfit -> header .oem_id , "LIBND" , 6 );
497- memcpy (nfit -> header .oem_table_id , "TEST" , 5 );
498- nfit -> header .oem_revision = 1 ;
499- memcpy (nfit -> header .asl_compiler_id , "TST" , 4 );
500- nfit -> header .asl_compiler_revision = 1 ;
501- }
502-
503489static void nfit_test0_setup (struct nfit_test * t )
504490{
505491 struct nvdimm_bus_descriptor * nd_desc ;
506492 struct acpi_nfit_desc * acpi_desc ;
507493 struct acpi_nfit_memory_map * memdev ;
508494 void * nfit_buf = t -> nfit_buf ;
509- size_t size = t -> nfit_size ;
510495 struct acpi_nfit_system_address * spa ;
511496 struct acpi_nfit_control_region * dcr ;
512497 struct acpi_nfit_data_region * bdw ;
513498 struct acpi_nfit_flush_address * flush ;
514499 unsigned int offset ;
515500
516- nfit_test_init_header (nfit_buf , size );
517-
518501 /*
519502 * spa0 (interleave first half of dimm0 and dimm1, note storage
520503 * does not actually alias the related block-data-window
521504 * regions)
522505 */
523- spa = nfit_buf + sizeof ( struct acpi_table_nfit ) ;
506+ spa = nfit_buf ;
524507 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
525508 spa -> header .length = sizeof (* spa );
526509 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_PM ), 16 );
@@ -533,7 +516,7 @@ static void nfit_test0_setup(struct nfit_test *t)
533516 * does not actually alias the related block-data-window
534517 * regions)
535518 */
536- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa );
519+ spa = nfit_buf + sizeof (* spa );
537520 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
538521 spa -> header .length = sizeof (* spa );
539522 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_PM ), 16 );
@@ -542,7 +525,7 @@ static void nfit_test0_setup(struct nfit_test *t)
542525 spa -> length = SPA1_SIZE ;
543526
544527 /* spa2 (dcr0) dimm0 */
545- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 2 ;
528+ spa = nfit_buf + sizeof (* spa ) * 2 ;
546529 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
547530 spa -> header .length = sizeof (* spa );
548531 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_DCR ), 16 );
@@ -551,7 +534,7 @@ static void nfit_test0_setup(struct nfit_test *t)
551534 spa -> length = DCR_SIZE ;
552535
553536 /* spa3 (dcr1) dimm1 */
554- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 3 ;
537+ spa = nfit_buf + sizeof (* spa ) * 3 ;
555538 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
556539 spa -> header .length = sizeof (* spa );
557540 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_DCR ), 16 );
@@ -560,7 +543,7 @@ static void nfit_test0_setup(struct nfit_test *t)
560543 spa -> length = DCR_SIZE ;
561544
562545 /* spa4 (dcr2) dimm2 */
563- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 4 ;
546+ spa = nfit_buf + sizeof (* spa ) * 4 ;
564547 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
565548 spa -> header .length = sizeof (* spa );
566549 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_DCR ), 16 );
@@ -569,7 +552,7 @@ static void nfit_test0_setup(struct nfit_test *t)
569552 spa -> length = DCR_SIZE ;
570553
571554 /* spa5 (dcr3) dimm3 */
572- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 5 ;
555+ spa = nfit_buf + sizeof (* spa ) * 5 ;
573556 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
574557 spa -> header .length = sizeof (* spa );
575558 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_DCR ), 16 );
@@ -578,7 +561,7 @@ static void nfit_test0_setup(struct nfit_test *t)
578561 spa -> length = DCR_SIZE ;
579562
580563 /* spa6 (bdw for dcr0) dimm0 */
581- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 6 ;
564+ spa = nfit_buf + sizeof (* spa ) * 6 ;
582565 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
583566 spa -> header .length = sizeof (* spa );
584567 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_BDW ), 16 );
@@ -587,7 +570,7 @@ static void nfit_test0_setup(struct nfit_test *t)
587570 spa -> length = DIMM_SIZE ;
588571
589572 /* spa7 (bdw for dcr1) dimm1 */
590- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 7 ;
573+ spa = nfit_buf + sizeof (* spa ) * 7 ;
591574 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
592575 spa -> header .length = sizeof (* spa );
593576 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_BDW ), 16 );
@@ -596,7 +579,7 @@ static void nfit_test0_setup(struct nfit_test *t)
596579 spa -> length = DIMM_SIZE ;
597580
598581 /* spa8 (bdw for dcr2) dimm2 */
599- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 8 ;
582+ spa = nfit_buf + sizeof (* spa ) * 8 ;
600583 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
601584 spa -> header .length = sizeof (* spa );
602585 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_BDW ), 16 );
@@ -605,15 +588,15 @@ static void nfit_test0_setup(struct nfit_test *t)
605588 spa -> length = DIMM_SIZE ;
606589
607590 /* spa9 (bdw for dcr3) dimm3 */
608- spa = nfit_buf + sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 9 ;
591+ spa = nfit_buf + sizeof (* spa ) * 9 ;
609592 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
610593 spa -> header .length = sizeof (* spa );
611594 memcpy (spa -> range_guid , to_nfit_uuid (NFIT_SPA_BDW ), 16 );
612595 spa -> range_index = 9 + 1 ;
613596 spa -> address = t -> dimm_dma [3 ];
614597 spa -> length = DIMM_SIZE ;
615598
616- offset = sizeof (struct acpi_table_nfit ) + sizeof ( * spa ) * 10 ;
599+ offset = sizeof (* spa ) * 10 ;
617600 /* mem-region0 (spa0, dimm0) */
618601 memdev = nfit_buf + offset ;
619602 memdev -> header .type = ACPI_NFIT_TYPE_MEMORY_MAP ;
@@ -1100,15 +1083,13 @@ static void nfit_test0_setup(struct nfit_test *t)
11001083
11011084static void nfit_test1_setup (struct nfit_test * t )
11021085{
1103- size_t size = t -> nfit_size , offset ;
1086+ size_t offset ;
11041087 void * nfit_buf = t -> nfit_buf ;
11051088 struct acpi_nfit_memory_map * memdev ;
11061089 struct acpi_nfit_control_region * dcr ;
11071090 struct acpi_nfit_system_address * spa ;
11081091
1109- nfit_test_init_header (nfit_buf , size );
1110-
1111- offset = sizeof (struct acpi_table_nfit );
1092+ offset = 0 ;
11121093 /* spa0 (flat range with no bdw aliasing) */
11131094 spa = nfit_buf + offset ;
11141095 spa -> header .type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS ;
0 commit comments