Applied patch by Alexander von Gluck (kallisti5) - ticket #6350.
Small changes done: append ACPI node name to device name. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37757 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -32,7 +32,8 @@ const char* kCategoryString[] = {
|
|||||||
"Satellite communications controller", // 0x0f
|
"Satellite communications controller", // 0x0f
|
||||||
"Encryption controller", // 0x10
|
"Encryption controller", // 0x10
|
||||||
"Signal processing controller", // 0x11
|
"Signal processing controller", // 0x11
|
||||||
"Computer" // 0x12 (added later)
|
"Computer", // 0x12 (added later)
|
||||||
|
"ACPI controller" // 0x13 (added later)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ typedef enum {
|
|||||||
BUS_ISA = 1,
|
BUS_ISA = 1,
|
||||||
BUS_PCI,
|
BUS_PCI,
|
||||||
BUS_SCSI,
|
BUS_SCSI,
|
||||||
|
BUS_ACPI,
|
||||||
BUS_NONE
|
BUS_NONE
|
||||||
} BusType;
|
} BusType;
|
||||||
|
|
||||||
@@ -45,7 +46,8 @@ typedef std::vector<Attribute> Attributes;
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
CAT_NONE = 0,
|
CAT_NONE = 0,
|
||||||
CAT_BUS = 6,
|
CAT_BUS = 6,
|
||||||
CAT_COMPUTER = 0x12
|
CAT_COMPUTER = 0x12,
|
||||||
|
CAT_ACPI = 0x13
|
||||||
} Category;
|
} Category;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008-2010 Haiku Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck (kallisti5)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "DeviceACPI.h"
|
||||||
|
|
||||||
|
|
||||||
|
DeviceACPI::DeviceACPI(Device* parent)
|
||||||
|
:
|
||||||
|
Device(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeviceACPI::~DeviceACPI()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeviceACPI::InitFromAttributes()
|
||||||
|
{
|
||||||
|
BString outlineName;
|
||||||
|
BString nodeACPIPath;
|
||||||
|
BString rootACPIPath;
|
||||||
|
|
||||||
|
rootACPIPath = nodeACPIPath = GetAttribute("acpi/path").fValue;
|
||||||
|
|
||||||
|
// Grab just the root node info
|
||||||
|
// We grab 6 characters to not identify sub nodes of root node
|
||||||
|
rootACPIPath.Truncate(6);
|
||||||
|
// Grab node leaf name
|
||||||
|
nodeACPIPath.Remove(0, nodeACPIPath.FindLast(".") + 1);
|
||||||
|
|
||||||
|
fCategory = (Category)CAT_ACPI;
|
||||||
|
|
||||||
|
// Identify Predefined root namespaces (ACPI Spec 4.0a, p162)
|
||||||
|
if (rootACPIPath == "\\_SB_") {
|
||||||
|
outlineName = "ACPI System Bus";
|
||||||
|
} else if (rootACPIPath == "\\_TZ_") {
|
||||||
|
outlineName = "ACPI Thermal Zone";
|
||||||
|
} else if (rootACPIPath == "\\_PR_.") {
|
||||||
|
// each CPU node is considered a root node
|
||||||
|
outlineName << "ACPI Processor Namespace '" << nodeACPIPath << "'";
|
||||||
|
} else if (rootACPIPath == "\\_SI_") {
|
||||||
|
outlineName = "ACPI System Indicator";
|
||||||
|
} else {
|
||||||
|
outlineName << "ACPI node '" << nodeACPIPath << "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAttribute("Device name", outlineName.String());
|
||||||
|
SetAttribute("Manufacturer", "Not implimented");
|
||||||
|
|
||||||
|
SetText(outlineName.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
DeviceACPI::GetBusAttributes()
|
||||||
|
{
|
||||||
|
// Push back things that matter for ACPI
|
||||||
|
Attributes attributes;
|
||||||
|
attributes.push_back(GetAttribute("device/bus"));
|
||||||
|
attributes.push_back(GetAttribute("acpi/path"));
|
||||||
|
attributes.push_back(GetAttribute("acpi/type"));
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
DeviceACPI::GetBusStrings()
|
||||||
|
{
|
||||||
|
BString str;
|
||||||
|
str << "Class Info:\t\t\t\t: " << fAttributeMap["Class Info"];
|
||||||
|
return str;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008-2010 Haiku Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck (kallisti5)
|
||||||
|
*/
|
||||||
|
#ifndef DEVICEACPI_H
|
||||||
|
#define DEVICEACPI_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "Device.h"
|
||||||
|
|
||||||
|
|
||||||
|
class DeviceACPI : public Device {
|
||||||
|
public:
|
||||||
|
DeviceACPI(Device* parent);
|
||||||
|
virtual ~DeviceACPI();
|
||||||
|
virtual Attributes GetBusAttributes();
|
||||||
|
virtual BString GetBusStrings();
|
||||||
|
virtual void InitFromAttributes();
|
||||||
|
|
||||||
|
virtual BString GetBusTabName()
|
||||||
|
{ return "ACPI Information"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* DEVICEACPI_H */
|
||||||
@@ -277,21 +277,28 @@ DevicesView::AddDeviceAndChildren(device_node_cookie *node, Device* parent)
|
|||||||
// Determine what type of device it is and create it
|
// Determine what type of device it is and create it
|
||||||
for (unsigned int i = 0; i < attributes.size(); i++) {
|
for (unsigned int i = 0; i < attributes.size(); i++) {
|
||||||
// Devices Root
|
// Devices Root
|
||||||
if (attributes[i].fName == "device/pretty name"
|
if (attributes[i].fName == B_DEVICE_PRETTY_NAME
|
||||||
&& attributes[i].fValue == "Devices Root") {
|
&& attributes[i].fValue == "Devices Root") {
|
||||||
newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, "Computer");
|
newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, "Computer");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ACPI Controller
|
||||||
|
if (attributes[i].fName == B_DEVICE_PRETTY_NAME
|
||||||
|
&& attributes[i].fValue == "ACPI") {
|
||||||
|
newDevice = new Device(parent, BUS_ACPI, CAT_BUS, "ACPI bus");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// PCI bus
|
// PCI bus
|
||||||
if (attributes[i].fName == "device/pretty name"
|
if (attributes[i].fName == B_DEVICE_PRETTY_NAME
|
||||||
&& attributes[i].fValue == "PCI") {
|
&& attributes[i].fValue == "PCI") {
|
||||||
newDevice = new Device(parent, BUS_PCI, CAT_BUS, "PCI bus");
|
newDevice = new Device(parent, BUS_PCI, CAT_BUS, "PCI bus");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISA bus
|
// ISA bus
|
||||||
if (attributes[i].fName == "device/bus"
|
if (attributes[i].fName == B_DEVICE_BUS
|
||||||
&& attributes[i].fValue == "isa") {
|
&& attributes[i].fValue == "isa") {
|
||||||
newDevice = new Device(parent, BUS_ISA, CAT_BUS, "ISA bus");
|
newDevice = new Device(parent, BUS_ISA, CAT_BUS, "ISA bus");
|
||||||
break;
|
break;
|
||||||
@@ -303,6 +310,13 @@ DevicesView::AddDeviceAndChildren(device_node_cookie *node, Device* parent)
|
|||||||
newDevice = new DevicePCI(parent);
|
newDevice = new DevicePCI(parent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ACPI device
|
||||||
|
if (attributes[i].fName == B_DEVICE_BUS
|
||||||
|
&& attributes[i].fValue == "acpi") {
|
||||||
|
newDevice = new DeviceACPI(parent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newDevice == NULL) {
|
if (newDevice == NULL) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "Device.h"
|
#include "Device.h"
|
||||||
#include "DevicePCI.h"
|
#include "DevicePCI.h"
|
||||||
|
#include "DeviceACPI.h"
|
||||||
#include "PropertyList.h"
|
#include "PropertyList.h"
|
||||||
#include "PropertyListPlain.h"
|
#include "PropertyListPlain.h"
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ Application Devices :
|
|||||||
DevicesView.cpp
|
DevicesView.cpp
|
||||||
dm_wrapper.c
|
dm_wrapper.c
|
||||||
DevicePCI.cpp
|
DevicePCI.cpp
|
||||||
|
DeviceACPI.cpp
|
||||||
Device.cpp
|
Device.cpp
|
||||||
PropertyList.cpp
|
PropertyList.cpp
|
||||||
PropertyListPlain.cpp
|
PropertyListPlain.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user