xref: /openbmc/u-boot/scripts/coreboot.sed (revision cdaa633f)
1#
2# Copyright (c) 2016 Google, Inc
3#
4# SPDX-License-Identifier:	GPL-2.0+
5#
6# Script to convert coreboot code to something similar to what U-Boot uses
7# sed -f coreboot.sed <coreboot_file.c>
8# Remember to add attribution to coreboot for new files added to U-Boot.
9s/REG_RES_WRITE32(\(.*\), \(.*\), \(.*\)),/writel(\3, base + \2);/
10s/REG_RES_POLL32(\(.*\), \(.*\), \(.*\), \(.*\), \(.*\)),/ret = poll32(base + \2, \3, \4, \5);/
11s/REG_RES_OR32(\(.*\), \(.*\), \(.*\)),/setbits_le32(base + \2, \3);/
12s/REG_RES_RMW32(\(.*\), \(.*\), \(.*\), \(.*\)),/clrsetbits_le32(base + \2, ~\3, \4);/
13/REG_SCRIPT_END/d
14s/read32/readl/
15s/write32(\(.*\), \(.*\))/writel(\2, \1)/
16s/conf->/plat->/
17s/static const struct reg_script \(.*\)_script\[\] = {/static int \1(struct udevice *dev)/
18