gitlab.com/apertussolutions/u-root@v7.0.0+incompatible/cmds/core/rsdp/rsdp.go (about)

     1  // Copyright 2012-2018 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // rsdp allows to determine the ACPI RSDP structure address which could
     6  // be passed to the boot command later on
     7  // It must be executed at the system init as it relies on scanning
     8  // the kernel messages which could be quickly filled up in some cases
     9  //
    10  // Synopsis:
    11  //	rsdp [-f file]
    12  //
    13  // Description:
    14  //	Look for rsdp value in a file, default /dev/kmsg
    15  //
    16  // Example:
    17  //	rsdp
    18  //	rsdp -f /path/to/file
    19  package main
    20  
    21  import (
    22  	"fmt"
    23  	"log"
    24  
    25  	flag "github.com/spf13/pflag"
    26  	"github.com/u-root/u-root/pkg/boot/acpi"
    27  )
    28  
    29  var (
    30  	cmdUsage = "Usage: rsdp"
    31  )
    32  
    33  func usage() {
    34  	log.Fatalf(cmdUsage)
    35  }
    36  
    37  func main() {
    38  	flag.Parse()
    39  	if flag.NArg() != 0 {
    40  		usage()
    41  	}
    42  	rsdp, err := acpi.GetRSDP()
    43  	if err != nil {
    44  		log.Fatal(err)
    45  	}
    46  	fmt.Printf(" acpi_rsdp=%#x \n", rsdp.RSDPAddr())
    47  }