forked from illumos/illumos-gate
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approvced by: Jerry Jelinek <jerry.jelinek@joyent.com>
- Loading branch information
Mike Gerdts
committed
Feb 13, 2018
1 parent
59e5084
commit ed0e03a
Showing
308 changed files
with
76,371 additions
and
4,576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,48 @@ | ||
The ACPI utilities are based on the Intel ACPI source code drops. No changes | ||
are made to Intel-provided source code. Most of the ACPI lives in the kernel | ||
under usr/src/uts/intel/io/acpica and usr/src/uts/intel/sys/acpi. | ||
This file and its contents are supplied under the terms of the | ||
Common Development and Distribution License ("CDDL"), version 1.0. | ||
You may only use this file in accordance with the terms of version | ||
1.0 of the CDDL. | ||
|
||
The assembler/disassembler (iasl) is currently not being built here, but it | ||
can be used on the dumped tables from within a non-native environment, such | ||
as within an lx-branded zone. | ||
A full copy of the text of the CDDL should have accompanied this | ||
source. A copy of the CDDL is also available via the Internet at | ||
http://www.illumos.org/license/CDDL. | ||
|
||
Copyright (c) 2018, Joyent, Inc. | ||
|
||
--- | ||
|
||
The ACPI utilities are based on the Intel ACPI source code drops. Aside from | ||
notes in Readme.resync files, no changes are made to Intel-provided source code. | ||
Most of the ACPI source code lives in | ||
the following directories: | ||
|
||
usr/src/uts/common/acpica Common to kernel and commands | ||
usr/src/uts/intel/io/acpica Kernel | ||
usr/src/uts/intel/sys/acpi Headers | ||
usr/src/cmd/acpi Commands | ||
|
||
The acpica-update script in this directory can serve as a guide for performing | ||
updates. It is expected that it will need to be tweaked as the upstream acpica | ||
software evolves. | ||
|
||
The expected workflow for updating is | ||
|
||
1. Clone the appropriate acpica workspace from github. Until such a time | ||
as Joyent's changes to acpica are in the Intel distribution, this probably | ||
means: | ||
|
||
git clone -b smartos git@github.com:joyent/acpica.git | ||
|
||
2. Do any required development work in the workspace checked out in step 1. | ||
This probably includes rebasing Joyent's changes on the latest release. | ||
Don't forget to push these to github and submit a pull request if | ||
appropriate. | ||
|
||
3. Build and test the modified acpica disto as described in the documentation | ||
in that workspace. | ||
|
||
4. Run acpica-update from within an illumos workspace. That is: | ||
|
||
./acpica-update ~/acpica | ||
|
||
5. Build, test, code review, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,251 @@ | ||
#!/bin/ksh -e | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# | ||
# Copyright (c) 2018, Joyent, Inc. | ||
# | ||
|
||
export PATH=/usr/bin:/usr/sbin:$PATH | ||
|
||
# Comment this when you are ready to run it for real. | ||
dry_run=--dry-run | ||
|
||
# This uses rsync. Trailing slashes are signficant. | ||
function sync { # srcdir dstdir [excludepatterns] | ||
set -e | ||
typeset src=$1 | ||
typeset dst=$2 | ||
typeset -a exclude | ||
typeset patch=acpica-resync.patch | ||
|
||
shift 2 | ||
for arg in "$@"; do | ||
exclude+=( --exclude "$arg" ) | ||
done | ||
|
||
echo "" | ||
echo "sync $src" | ||
echo " to: $dst" | ||
if (( $# > 0 )); then | ||
echo " excluding: $@" | ||
fi | ||
|
||
add_files "$dst" | ||
|
||
rsync $dry_run --out-format '%i %n' -r \ | ||
--checksum --delete --exclude "$patch" "${exclude[@]}" \ | ||
"$src" "$dst" | ||
|
||
if [[ -f $dst/$patch ]]; then | ||
typeset ws_patch | ||
ws_patch=$(ws_path "${dst%%/}/$patch") | ||
if grep '^@@ ' "$ws_patch" >/dev/null 2>&1; then | ||
if [[ -z $dry_run ]]; then | ||
echo "Applying patch in $ws_patch" | ||
if patch -f -p1 < "$ws_patch"; then | ||
patches["$ws_patch"]="Patch Applied" | ||
else | ||
patches["$ws_patch"]="Patch FAILED" | ||
fi | ||
else | ||
echo "Patch in $ws_patch" | ||
if [[ -n $diffstat ]]; then | ||
diffstat < $ws_patch | ||
fi | ||
patches["$ws_patch"]="Has Patch" | ||
fi | ||
else | ||
echo "Important resync info in $ws_patch:" | ||
cat "$ws_patch" | ||
patches["$ws_patch"]="MUST READ" | ||
fi | ||
fi | ||
} | ||
|
||
function copy { # srcfile dst{file|dir} | ||
typeset src=$1 | ||
typeset dst=$2 | ||
|
||
if [[ -d "$dst" ]]; then | ||
add_files "$dst" | ||
else | ||
add_files "$(dirname "$dst")" | ||
fi | ||
|
||
if diff "$src" "$dst" >/dev/null 2>&1; then | ||
echo "" | ||
echo "copy $src" | ||
echo " to: $dst" | ||
if [[ -z $dry_run ]]; then | ||
cp "$src" "$dst" || return $? | ||
fi | ||
fi | ||
return 0 | ||
} | ||
|
||
function add_files { # dir | ||
typeset dir=$(ws_path "$1") | ||
typeset file | ||
|
||
if [[ -n ${alldirs["$dir"]} ]]; then | ||
return | ||
fi | ||
alldirs["$dir"]=added | ||
|
||
find "$dir" -type f | while read file; do | ||
skip_file "$file" && continue | ||
[[ -n ${allfiles["$file"]} ]] && continue | ||
set -- $(md5sum "$file") | ||
allfiles["$file"]="md5:$1" | ||
done | ||
} | ||
|
||
function compare_files { | ||
typeset dir | ||
typeset file | ||
typeset ufile | ||
typeset header="\nThe following file changes happened:" | ||
|
||
for dir in ${!alldirs[@]}; do | ||
find "$dir" -type f | while read file; do | ||
skip_file "$file" && continue | ||
if [[ -z ${allfiles["$file"]} ]]; then | ||
allfiles["$file"]=new | ||
continue | ||
fi | ||
set -- $(md5sum "$file") | ||
if [[ ${allfiles["$file"]} == "md5:$1" ]]; then | ||
allfiles["$file"]=same | ||
continue | ||
fi | ||
allfiles["$file"]=modified | ||
done | ||
done | ||
for ufile in "${!allfiles[@]}"; do | ||
echo "$ufile" | ||
done | sort | while read file; do | ||
typeset val=${allfiles["$file"]} | ||
|
||
[[ $val == same ]] && continue | ||
[[ $val == md5:* ]] && val=removed | ||
|
||
if [[ -n $header ]]; then | ||
print "$header" | ||
header= | ||
fi | ||
printf " %-12s %s\n" "$val" "$file" | ||
done | ||
} | ||
|
||
function skip_file { # filename | ||
typeset file=$1 | ||
|
||
# Remember reserved meaning of return codes | ||
[[ $file == *.o ]] && return 0 | ||
[[ $file == *.rej ]] && return 0 | ||
[[ $file == *.orig ]] && return 0 | ||
[[ $(file "$file") == *ELF* ]] && return 0 | ||
|
||
return 1 | ||
} | ||
|
||
# Translate absolute path into one relative to $ws_top | ||
function ws_path { # path | ||
typeset path=$1 | ||
|
||
if [[ $path != /* ]]; then | ||
print -u2 "ws_path: bad absolute path: '%s'" | ||
exit 1 | ||
fi | ||
|
||
# Strip excessive leading and all trailing slashes | ||
path=${path%%/} | ||
path=/${path##/} | ||
|
||
echo "${path#$ws_top/}" | ||
} | ||
|
||
# | ||
# First argument is the acpica source directory | ||
# | ||
if [[ $1 != /* || ! -d $1 ]]; then | ||
print -u2 "Usage: $0 <acpica-git-directory>" | ||
exit 1 | ||
fi | ||
ac_top=$1 | ||
|
||
ac_source=$ac_top/source | ||
ac_include=$ac_source/include | ||
ac_components=$ac_source/components | ||
|
||
ws_top=${CODEMGR_WS:-$(git rev-parse --show-toplevel)} | ||
ws_common=$ws_top/usr/src/common/acpica | ||
ws_include=$ws_top/usr/src/uts/intel/sys/acpi | ||
ws_cmd=$ws_top/usr/src/cmd/acpi | ||
|
||
cd "$ws_top" | ||
|
||
typeset -A patches | ||
typeset -A alldirs | ||
typeset -A allfiles | ||
diffstat=$(type -p diffstat 2>/dev/null) | ||
|
||
# | ||
# Sync acpica/source/comonents/<comp> to illumos/usr/src/common/acpica/<comp> | ||
# | ||
for dir in disassembler dispatcher events executer hardware \ | ||
namespace parser resources tables utilities; do | ||
sync "$ac_components/$dir/" "$ws_common/$dir/" | ||
done | ||
|
||
# | ||
# Sync acpica/source/include to illumos/usr/src/uts/intel/sys/acpi | ||
# | ||
sync "$ac_include/" "$ws_include/" acsolaris.h acpi_pci.h acpi_enum.h | ||
|
||
# | ||
# Sync some acpica/source/tools/<tool> to usr/src/cmd/acpi/<tool> | ||
# acpidump requires some special treatment because of OS-specific files. | ||
# | ||
sync "$ac_source/tools/acpidump/" "$ws_cmd/acpidump/" \ | ||
Makefile osillumostbl.c osunixdir.c | ||
copy "$ac_source/os_specific/service_layers/osunixdir.c" "$ws_cmd/acpidump/" | ||
sync "$ac_source/tools/acpixtract/" "$ws_cmd/acpixtract/" \ | ||
Makefile | ||
|
||
# | ||
# Sync iasl from acpica/source/compiler to usr/src/cmd/acpi/iasl | ||
# | ||
sync "$ac_source/compiler/" "$ws_cmd/iasl/" \ | ||
Makefile | ||
|
||
# | ||
# Sync common user space code from acpica/source/common to | ||
# usr/src/cmd/acpi/comon | ||
# | ||
sync "$ac_source/common/" "$ws_cmd/common/" osl.c osunixxf.c | ||
copy "$ac_source/os_specific/service_layers/osunixxf.c" "$ws_cmd/common/" | ||
|
||
if [[ -n $dry_run ]]; then | ||
echo "" | ||
echo "NOTICE: That was a dry run: nothing was changed." | ||
fi | ||
|
||
if (( ${#patches[@]} != 0 )); then | ||
echo "" | ||
echo "NOTICE: You reviewed all the $patch files, right?" | ||
for file in "${!patches[@]}"; do | ||
printf " %-12s %s\n" "${patches["$file"]}" "$file" | ||
done | ||
fi | ||
|
||
compare_files | ||
|
||
exit 0 |
Oops, something went wrong.