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