Coding style fixes
This commit is contained in:
parent
c56525f264
commit
b06cc3250a
|
@ -23,10 +23,13 @@
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
/* Enable debugging output */
|
/* enable debugging output */
|
||||||
static const bool verbose = false;
|
static const bool verbose = false;
|
||||||
|
|
||||||
/* Generic Apic structure */
|
|
||||||
|
/**
|
||||||
|
* Generic Apic structure
|
||||||
|
*/
|
||||||
struct Apic_struct
|
struct Apic_struct
|
||||||
{
|
{
|
||||||
enum Types { SRC_OVERRIDE = 2 };
|
enum Types { SRC_OVERRIDE = 2 };
|
||||||
|
@ -39,6 +42,7 @@ struct Apic_struct
|
||||||
Apic_struct *next() { return reinterpret_cast<Apic_struct *>((uint8_t *)this + length); }
|
Apic_struct *next() { return reinterpret_cast<Apic_struct *>((uint8_t *)this + length); }
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
|
||||||
struct Mcfg_struct
|
struct Mcfg_struct
|
||||||
{
|
{
|
||||||
uint64_t base;
|
uint64_t base;
|
||||||
|
@ -51,6 +55,7 @@ struct Mcfg_struct
|
||||||
return reinterpret_cast<Mcfg_struct *>((uint8_t *)this + sizeof(*this)); }
|
return reinterpret_cast<Mcfg_struct *>((uint8_t *)this + sizeof(*this)); }
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
|
||||||
/* ACPI spec 5.2.12.5 */
|
/* ACPI spec 5.2.12.5 */
|
||||||
struct Apic_override : Apic_struct
|
struct Apic_override : Apic_struct
|
||||||
{
|
{
|
||||||
|
@ -135,9 +140,9 @@ class Pci_config_space : public List<Pci_config_space>::Element
|
||||||
static List<Pci_config_space> _list;
|
static List<Pci_config_space> _list;
|
||||||
return &_list;
|
return &_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ACPI table wrapper that for mapping tables to this address space
|
* ACPI table wrapper that for mapping tables to this address space
|
||||||
*/
|
*/
|
||||||
|
@ -249,7 +254,8 @@ class Table_wrapper
|
||||||
|
|
||||||
PINF("MADT IRQ %u -> GSI %u flags: %x", o->irq, o->gsi, o->flags);
|
PINF("MADT IRQ %u -> GSI %u flags: %x", o->irq, o->gsi, o->flags);
|
||||||
|
|
||||||
Irq_override::list()->insert(new (env()->heap()) Irq_override(o->irq, o->gsi, o->flags));
|
Irq_override::list()->insert(new (env()->heap())
|
||||||
|
Irq_override(o->irq, o->gsi, o->flags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,8 +276,7 @@ class Table_wrapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Table_wrapper(addr_t base)
|
Table_wrapper(addr_t base) : _base(base), _io_mem(0), _table(0)
|
||||||
: _base(base), _io_mem(0), _table(0)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Try to map one page only, if table is on page boundary, map two pages
|
* Try to map one page only, if table is on page boundary, map two pages
|
||||||
|
@ -548,7 +553,6 @@ class Element : public List<Element>::Element
|
||||||
|
|
||||||
other = other->next();
|
other = other->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,6 +681,7 @@ class Element : public List<Element>::Element
|
||||||
|
|
||||||
/* special handle for four value packet */
|
/* special handle for four value packet */
|
||||||
if (package_op4) {
|
if (package_op4) {
|
||||||
|
|
||||||
/* scan for data package with four entries */
|
/* scan for data package with four entries */
|
||||||
if (data[0] != PACKAGE_OP)
|
if (data[0] != PACKAGE_OP)
|
||||||
return;
|
return;
|
||||||
|
@ -691,6 +696,7 @@ class Element : public List<Element>::Element
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (data[0]) {
|
switch (data[0]) {
|
||||||
|
|
||||||
case DEVICE:
|
case DEVICE:
|
||||||
|
|
||||||
data++; _data++;
|
data++; _data++;
|
||||||
|
@ -707,6 +713,7 @@ class Element : public List<Element>::Element
|
||||||
_read_size();
|
_read_size();
|
||||||
|
|
||||||
if (_size) {
|
if (_size) {
|
||||||
|
|
||||||
/* check if element is larger than parent */
|
/* check if element is larger than parent */
|
||||||
Element *p = _parent();
|
Element *p = _parent();
|
||||||
for (; p; p = p->_parent())
|
for (; p; p = p->_parent())
|
||||||
|
@ -774,7 +781,8 @@ class Element : public List<Element>::Element
|
||||||
char n[_name_len + 1];
|
char n[_name_len + 1];
|
||||||
memcpy(n, _name, _name_len);
|
memcpy(n, _name, _name_len);
|
||||||
n[_name_len] = 0;
|
n[_name_len] = 0;
|
||||||
PDBG("Found package %x size %u name_len %u name: %s", _data[0], _size, _name_len, n);
|
PDBG("Found package %x size %u name_len %u name: %s",
|
||||||
|
_data[0], _size, _name_len, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -821,7 +829,8 @@ class Element : public List<Element>::Element
|
||||||
*/
|
*/
|
||||||
static void parse(Generic *table)
|
static void parse(Generic *table)
|
||||||
{
|
{
|
||||||
for (uint8_t const *data = table->data(); data < table->data() + table->size; data++) {
|
uint8_t const *data = table->data();
|
||||||
|
for (; data < table->data() + table->size; data++) {
|
||||||
Element e(data);
|
Element e(data);
|
||||||
|
|
||||||
if (!e.valid() || !e._name_len)
|
if (!e.valid() || !e._name_len)
|
||||||
|
@ -892,7 +901,8 @@ class Element : public List<Element>::Element
|
||||||
Pci_routing *r = e->pci_list()->first();
|
Pci_routing *r = e->pci_list()->first();
|
||||||
for (; r; r = r->next()) {
|
for (; r; r = r->next()) {
|
||||||
if (r->match_bdf(device_bdf) && r->pin() == pin) {
|
if (r->match_bdf(device_bdf) && r->pin() == pin) {
|
||||||
if (verbose) PDBG("Found GSI: %u device : %x pin %u", r->gsi(), device_bdf, pin);
|
if (verbose) PDBG("Found GSI: %u device : %x pin %u",
|
||||||
|
r->gsi(), device_bdf, pin);
|
||||||
return r->gsi();
|
return r->gsi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1257,19 +1267,23 @@ static void dump_bdf(uint32_t a, uint32_t b, uint32_t pin)
|
||||||
(b >> 8), (b >> 3) & 0x1f, (b & 0x7), b, pin);
|
(b >> 8), (b >> 3) & 0x1f, (b & 0x7), b, pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dump_rewrite(uint32_t bdf, uint8_t line, uint8_t gsi)
|
static void dump_rewrite(uint32_t bdf, uint8_t line, uint8_t gsi)
|
||||||
{
|
{
|
||||||
PINF("Rewriting %02x:%02x.%u IRQ: %02u -> GSI: %02u",
|
PINF("Rewriting %02x:%02x.%u IRQ: %02u -> GSI: %02u",
|
||||||
(bdf >> 8), (bdf >> 3) & 0x1f, (bdf & 0x7), line, gsi);
|
(bdf >> 8), (bdf >> 3) & 0x1f, (bdf & 0x7), line, gsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse acpi table
|
* Parse acpi table
|
||||||
*/
|
*/
|
||||||
static void init_acpi_table() {
|
static void init_acpi_table()
|
||||||
|
{
|
||||||
static Acpi_table table;
|
static Acpi_table table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create config file for pci_drv
|
* Create config file for pci_drv
|
||||||
*/
|
*/
|
||||||
|
@ -1280,6 +1294,7 @@ void Acpi::create_pci_config_file(char * config_space,
|
||||||
Element::create_config_file(config_space, config_space_max);
|
Element::create_config_file(config_space, config_space_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rewrite GSIs of PCI config space
|
* Rewrite GSIs of PCI config space
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,10 +17,8 @@
|
||||||
#include <base/thread.h>
|
#include <base/thread.h>
|
||||||
#include <pci_session/capability.h>
|
#include <pci_session/capability.h>
|
||||||
|
|
||||||
class Acpi
|
struct Acpi
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +40,6 @@ class Acpi
|
||||||
* Return override GSI for IRQ
|
* Return override GSI for IRQ
|
||||||
*/
|
*/
|
||||||
static unsigned override(unsigned irq, unsigned *mode);
|
static unsigned override(unsigned irq, unsigned *mode);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _ACPI_H_ */
|
#endif /* _ACPI_H_ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user