mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
device code cleanup. this is the uncritical part of my device cleanup
patch. Most of it are printk_ cleanup fixes required for the v2->v3 transition, thus trivial. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@327 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
bd53a46fbd
commit
6c4d4e2c95
11 changed files with 47 additions and 52 deletions
|
@ -172,7 +172,7 @@ void cardbus_enable_resources(struct device *dev)
|
|||
/* Error check. */
|
||||
ctrl |= (PCI_CB_BRIDGE_CTL_PARITY + PCI_CB_BRIDGE_CTL_SERR);
|
||||
|
||||
printk_debug("%s bridge ctrl <- %04x\n", dev_path(dev), ctrl);
|
||||
printk(BIOS_DEBUG, "%s bridge ctrl <- %04x\n", dev_path(dev), ctrl);
|
||||
pci_write_config16(dev, PCI_BRIDGE_CONTROL, ctrl);
|
||||
|
||||
pci_dev_enable_resources(dev);
|
||||
|
@ -192,7 +192,7 @@ unsigned int cardbus_scan_bridge(struct device *dev, unsigned int max)
|
|||
u32 buses;
|
||||
u16 cr;
|
||||
|
||||
printk_spew("%s for %s\n", __func__, dev_path(dev));
|
||||
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(dev));
|
||||
|
||||
bus = &dev->link[0];
|
||||
bus->dev = dev;
|
||||
|
@ -238,7 +238,7 @@ unsigned int cardbus_scan_bridge(struct device *dev, unsigned int max)
|
|||
pci_write_config32(dev, PCI_CB_PRIMARY_BUS, buses);
|
||||
pci_write_config16(dev, PCI_COMMAND, cr);
|
||||
|
||||
printk_spew("%s returns max %d\n", __func__, max);
|
||||
printk(BIOS_SPEW, "%s returns max %d\n", __func__, max);
|
||||
return max;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <device/device.h>
|
||||
#include <device/pci.h>
|
||||
#include <device/pci_ids.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -190,12 +190,11 @@ static int ht_setup_link(struct ht_link *prev, struct device *dev,
|
|||
unsigned int new_freq;
|
||||
pci_write_config8(cur->dev, cur->pos + cur->freq_off, freq);
|
||||
reset_needed = 1;
|
||||
printk_spew("HyperT FreqP old %x new %x\n", old_freq, freq);
|
||||
printk(BIOS_SPEW, "HyperT FreqP old %x new %x\n", old_freq, freq);
|
||||
new_freq = pci_read_config8(cur->dev, cur->pos + cur->freq_off);
|
||||
new_freq &= 0x0f;
|
||||
if (new_freq != freq) {
|
||||
printk_err
|
||||
("%s Hypertransport frequency would not set wanted: %x got: %x\n",
|
||||
printk(BIOS_ERR, "%s Hypertransport frequency would not set wanted: %x got: %x\n",
|
||||
dev_path(dev), freq, new_freq);
|
||||
}
|
||||
}
|
||||
|
@ -205,13 +204,12 @@ static int ht_setup_link(struct ht_link *prev, struct device *dev,
|
|||
pci_write_config8(cur->dev, cur->pos + cur->config_off + 1,
|
||||
present_width);
|
||||
reset_needed = 1;
|
||||
printk_spew("HyperT widthP old %x new %x\n", old_width,
|
||||
printk(BIOS_SPEW, "HyperT widthP old %x new %x\n", old_width,
|
||||
present_width);
|
||||
new_width =
|
||||
pci_read_config8(cur->dev, cur->pos + cur->config_off + 1);
|
||||
if (new_width != present_width) {
|
||||
printk_err
|
||||
("%s Hypertransport width would not set wanted: %x got: %x\n",
|
||||
printk(BIOS_ERR, "%s Hypertransport width would not set wanted: %x got: %x\n",
|
||||
dev_path(dev), present_width, new_width);
|
||||
}
|
||||
}
|
||||
|
@ -223,13 +221,12 @@ static int ht_setup_link(struct ht_link *prev, struct device *dev,
|
|||
unsigned int new_freq;
|
||||
pci_write_config8(prev->dev, prev->pos + prev->freq_off, freq);
|
||||
reset_needed = 1;
|
||||
printk_spew("HyperT freqU old %x new %x\n", old_freq, freq);
|
||||
printk(BIOS_SPEW, "HyperT freqU old %x new %x\n", old_freq, freq);
|
||||
new_freq =
|
||||
pci_read_config8(prev->dev, prev->pos + prev->freq_off);
|
||||
new_freq &= 0x0f;
|
||||
if (new_freq != freq) {
|
||||
printk_err
|
||||
("%s Hypertransport frequency would not set wanted: %x got: %x\n",
|
||||
printk(BIOS_ERR, "%s Hypertransport frequency would not set wanted: %x got: %x\n",
|
||||
dev_path(prev->dev), freq, new_freq);
|
||||
}
|
||||
}
|
||||
|
@ -240,14 +237,13 @@ static int ht_setup_link(struct ht_link *prev, struct device *dev,
|
|||
pci_write_config8(prev->dev, prev->pos + prev->config_off + 1,
|
||||
upstream_width);
|
||||
reset_needed = 1;
|
||||
printk_spew("HyperT widthU old %x new %x\n", old_width,
|
||||
printk(BIOS_SPEW, "HyperT widthU old %x new %x\n", old_width,
|
||||
upstream_width);
|
||||
new_width =
|
||||
pci_read_config8(prev->dev,
|
||||
prev->pos + prev->config_off + 1);
|
||||
if (new_width != upstream_width) {
|
||||
printk_err
|
||||
("%s Hypertransport width would not set wanted: %x got: %x\n",
|
||||
printk(BIOS_ERR, "%s Hypertransport width would not set wanted: %x got: %x\n",
|
||||
dev_path(prev->dev), upstream_width, new_width);
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +278,7 @@ static unsigned int ht_lookup_slave_capability(struct device *dev)
|
|||
if (pos) {
|
||||
unsigned int flags;
|
||||
flags = pci_read_config16(dev, pos + PCI_CAP_FLAGS);
|
||||
printk_spew("Flags: 0x%04x\n", flags);
|
||||
printk(BIOS_SPEW, "Flags: 0x%04x\n", flags);
|
||||
if ((flags >> 13) == 0) {
|
||||
/* Entry is a Slave secondary, success... */
|
||||
break;
|
||||
|
@ -325,8 +321,7 @@ static void ht_collapse_early_enumeration(struct bus *bus,
|
|||
ctrl = pci_read_config16(prev.dev,
|
||||
prev.pos + prev.ctrl_off);
|
||||
if (ctrl & ((1 << 4) | (1 << 8))) {
|
||||
printk_alert
|
||||
("Detected error on Hypertransport Link\n");
|
||||
printk(BIOS_ALERT, "Detected error on Hypertransport Link\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -384,7 +379,7 @@ static void ht_collapse_early_enumeration(struct bus *bus,
|
|||
flags = pci_read_config16(&dummy, pos + PCI_CAP_FLAGS);
|
||||
flags &= ~0x1f;
|
||||
pci_write_config16(&dummy, pos + PCI_CAP_FLAGS, flags);
|
||||
printk_spew("Collapsing %s [%04x/%04x]\n",
|
||||
printk(BIOS_SPEW, "Collapsing %s [%04x/%04x]\n",
|
||||
dev_path(&dummy), dummy.vendor, dummy.device);
|
||||
}
|
||||
}
|
||||
|
@ -461,8 +456,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn,
|
|||
ctrl = pci_read_config16(prev.dev,
|
||||
prev.pos + prev.ctrl_off);
|
||||
if (ctrl & ((1 << 4) | (1 << 8))) {
|
||||
printk_alert
|
||||
("Detected error on Hypertransport Link\n");
|
||||
printk(BIOS_ALERT, "Detected error on Hypertransport Link\n");
|
||||
goto end_of_chain;
|
||||
}
|
||||
}
|
||||
|
@ -480,8 +474,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn,
|
|||
/* Find the hypertransport link capability. */
|
||||
pos = ht_lookup_slave_capability(dev);
|
||||
if (pos == 0) {
|
||||
printk_err
|
||||
("%s Hypertransport link capability not found",
|
||||
printk(BIOS_ERR, "%s Hypertransport link capability not found",
|
||||
dev_path(dev));
|
||||
break;
|
||||
}
|
||||
|
@ -513,7 +506,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn,
|
|||
|
||||
/* Compute the number of unitids consumed. */
|
||||
count = (flags >> 5) & 0x1f; /* Get unit count. */
|
||||
printk_spew("%s count: %04x static_count: %04x\n",
|
||||
printk(BIOS_SPEW, "%s count: %04x static_count: %04x\n",
|
||||
dev_path(dev), count, static_count);
|
||||
if (count < static_count) {
|
||||
count = static_count;
|
||||
|
@ -534,7 +527,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn,
|
|||
/* Setup the hypertransport link. */
|
||||
bus->reset_needed |= ht_setup_link(&prev, dev, pos);
|
||||
|
||||
printk_debug("%s [%04x/%04x] %s next_unitid: %04x\n",
|
||||
printk(BIOS_DEBUG, "%s [%04x/%04x] %s next_unitid: %04x\n",
|
||||
dev_path(dev),
|
||||
dev->vendor, dev->device,
|
||||
(dev->enabled ? "enabled" : "disabled"),
|
||||
|
@ -545,9 +538,9 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn,
|
|||
end_of_chain:
|
||||
#if OPT_HT_LINK == 1
|
||||
if (bus->reset_needed) {
|
||||
printk_info("HyperT reset needed\n");
|
||||
printk(BIOS_INFO, "HyperT reset needed\n");
|
||||
} else {
|
||||
printk_debug("HyperT reset not needed\n");
|
||||
printk(BIOS_DEBUG, "HyperT reset not needed\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -588,9 +581,9 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn,
|
|||
if (old_devices) {
|
||||
struct device *left;
|
||||
for (left = old_devices; left; left = left->sibling) {
|
||||
printk_debug("%s\n", dev_path(left));
|
||||
printk(BIOS_DEBUG, "%s\n", dev_path(left));
|
||||
}
|
||||
printk_err("HT: Left over static devices.\n");
|
||||
printk(BIOS_ERR, "HT: Left over static devices.\n");
|
||||
/* Put back the left over static device, and let
|
||||
* pci_scan_bus() disable it.
|
||||
*/
|
||||
|
|
|
@ -605,7 +605,7 @@ void pci_dev_enable_resources(struct device *dev)
|
|||
command = pci_read_config16(dev, PCI_COMMAND);
|
||||
command |= dev->command;
|
||||
command |= (PCI_COMMAND_PARITY + PCI_COMMAND_SERR); // Error check.
|
||||
printk(BIOS_DEBUG, "%s: %s(%s) cmd <- %02x\n", __func__, dev->dtsname,
|
||||
printk(BIOS_DEBUG, "%s: %s (%s) cmd <- %02x\n", __func__, dev->dtsname,
|
||||
dev_path(dev), command);
|
||||
pci_write_config16(dev, PCI_COMMAND, command);
|
||||
}
|
||||
|
@ -1039,7 +1039,7 @@ unsigned int pci_scan_bus(struct bus *bus, unsigned int min_devfn,
|
|||
#endif
|
||||
|
||||
old_devices = bus->children;
|
||||
printk(BIOS_DEBUG, "%s: old_devices %p, dev for this bus %p(%s)\n",
|
||||
printk(BIOS_DEBUG, "%s: old_devices %p, dev for this bus %p (%s)\n",
|
||||
__func__, old_devices, bus->dev, bus->dev->dtsname);
|
||||
bus->children = 0;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ static void pciexp_tune_dev(struct device *dev)
|
|||
/* error... */
|
||||
return;
|
||||
}
|
||||
printk_debug("PCIEXP: tuning %s\n", dev_path(dev));
|
||||
printk(BIOS_DEBUG, "PCIEXP: tuning %s\n", dev_path(dev));
|
||||
#warning "IMPLEMENT PCI EXPRESS TUNING"
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static void pcix_tune_dev(struct device *dev)
|
|||
if (!cap) {
|
||||
return;
|
||||
}
|
||||
printk_debug("%s PCI-X tuning\n", dev_path(dev));
|
||||
printk(BIOS_DEBUG, "%s PCI-X tuning\n", dev_path(dev));
|
||||
status = pci_read_config32(dev, cap + PCI_X_STATUS);
|
||||
orig_cmd = cmd = pci_read_config16(dev, cap + PCI_X_CMD);
|
||||
|
||||
|
@ -129,7 +129,7 @@ unsigned int pcix_scan_bridge(struct device *dev, unsigned int max)
|
|||
}
|
||||
|
||||
/* Print the PCI-X bus speed. */
|
||||
printk_debug("PCI: %02x: %s\n", dev->link[0].secondary,
|
||||
printk(BIOS_DEBUG, "PCI: %02x: %s\n", dev->link[0].secondary,
|
||||
pcix_speed(sstatus));
|
||||
|
||||
return max;
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
|
||||
#include <types.h>
|
||||
#include <console.h>
|
||||
#include <stdlib.h>
|
||||
// #include <stdint.h>
|
||||
// #include <bitops.h>
|
||||
#include <string.h>
|
||||
#include <io.h>
|
||||
#include <device/device.h>
|
||||
|
|
|
@ -108,7 +108,7 @@ unsigned int scan_static_bus(struct device *busdevice, unsigned int max)
|
|||
struct device *child;
|
||||
unsigned int link;
|
||||
|
||||
printk(BIOS_INFO, "%s for %s(%s)\n", __func__, busdevice->dtsname,
|
||||
printk(BIOS_INFO, "%s for %s (%s)\n", __func__, busdevice->dtsname,
|
||||
dev_path(busdevice));
|
||||
|
||||
for (link = 0; link < busdevice->links; link++) {
|
||||
|
|
|
@ -33,7 +33,7 @@ struct bus *get_pbus_smbus(struct device *dev)
|
|||
}
|
||||
if (!pbus || !pbus->dev || !pbus->dev->ops
|
||||
|| !pbus->dev->ops->ops_smbus_bus) {
|
||||
printk_alert("%s Cannot find smbus bus operations",
|
||||
printk(BIOS_ALERT, "%s Cannot find smbus bus operations",
|
||||
dev_path(dev));
|
||||
die("");
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ int smbus_set_link(struct device *dev)
|
|||
pbus_a[pbus_num++] = pbus;
|
||||
pbus = pbus->dev->bus;
|
||||
}
|
||||
// printk_info("smbus_set_link: ");
|
||||
// printk(BIOS_INFO, "smbus_set_link: ");
|
||||
for (i = pbus_num - 1; i >= 0; i--) {
|
||||
// printk_info(" %s[%d] -> ", dev_path(pbus_a[i]->dev), pbus_a[i]->link);
|
||||
// printk(BIOS_INFO, " %s[%d] -> ", dev_path(pbus_a[i]->dev), pbus_a[i]->link);
|
||||
if (ops_smbus_bus(get_pbus_smbus(pbus_a[i]->dev))) {
|
||||
if (pbus_a[i]->dev->ops
|
||||
&& pbus_a[i]->dev->ops->set_link)
|
||||
|
@ -66,7 +66,7 @@ int smbus_set_link(struct device *dev)
|
|||
pbus_a[i]->link);
|
||||
}
|
||||
}
|
||||
// printk_info(" %s\n", dev_path(dev));
|
||||
// printk(BIOS_INFO, " %s\n", dev_path(dev));
|
||||
|
||||
return pbus_num;
|
||||
}
|
||||
|
|
|
@ -23,17 +23,17 @@ static unsigned long ulzma(unsigned char * src, unsigned char * dst)
|
|||
memcpy(properties, src, LZMA_PROPERTIES_SIZE);
|
||||
outSize = *(UInt32 *)(src + LZMA_PROPERTIES_SIZE);
|
||||
if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) {
|
||||
printk_warning("Incorrect stream properties\n");
|
||||
printk(BIOS_WARNING, "Incorrect stream properties\n");
|
||||
}
|
||||
mallocneeds = (LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
|
||||
if (mallocneeds > 15980) {
|
||||
printk_warning("Decoder scratchpad too small!\n");
|
||||
printk(BIOS_WARNING, "Decoder scratchpad too small!\n");
|
||||
}
|
||||
state.Probs = (CProb *)scratchpad;
|
||||
res = LzmaDecode(&state, src + LZMA_PROPERTIES_SIZE + 8, (SizeT)0xffffffff, &inProcessed,
|
||||
dst, outSize, &outProcessed);
|
||||
if (res != 0) {
|
||||
printk_warning("Decoding error = %d\n", res);
|
||||
printk(BIOS_WARNING, "Decoding error = %d\n", res);
|
||||
}
|
||||
return outSize;
|
||||
}
|
||||
|
|
18
lib/stage2.c
18
lib/stage2.c
|
@ -43,7 +43,19 @@ int stage2(void)
|
|||
{
|
||||
/* TODO: Add comment. */
|
||||
void show_all_devs(void);
|
||||
|
||||
static const char console_test[] =
|
||||
"\n\nLinuxBIOS-"
|
||||
LINUXBIOS_VERSION
|
||||
LINUXBIOS_EXTRA_VERSION
|
||||
" "
|
||||
LINUXBIOS_BUILD
|
||||
" booting...\n";
|
||||
|
||||
post_code(0x20);
|
||||
|
||||
printk(BIOS_NOTICE, console_test);
|
||||
|
||||
dev_init();
|
||||
|
||||
/* Console init, also ANYTHING that has to be done
|
||||
|
@ -53,12 +65,6 @@ int stage2(void)
|
|||
dev_phase1();
|
||||
show_all_devs();
|
||||
|
||||
// printk_notice("LinuxBIOS-%s%s %s booting...\n",
|
||||
// linuxbios_version, linuxbios_extra_version, linuxbios_build);
|
||||
|
||||
// printk_notice("LinuxBIOS-%s%s %s booting...\n",
|
||||
// linuxbios_version, linuxbios_extra_version, linuxbios_build);
|
||||
|
||||
/* Here is where weird stuff like init_timer handling should be
|
||||
* done. This is for ANYTHING that might have to happen before
|
||||
* device enumeration but that needs a printk.
|
||||
|
|
Loading…
Add table
Reference in a new issue