./service/virtio_blk minix-base
./service/virtio_net minix-base
./service/vt6105 minix-base
+./usr/lib/libacpi.a minix-base
+./usr/lib/libacpi_pic.a minix-base
./usr/lib/libhgfs.a minix-base
./usr/lib/libhgfs_pic.a minix-base
./usr/lib/libm387.a minix-base
./usr/include/zlib.h minix-comp
./usr/lib minix-comp
./usr/lib/bc minix-comp
+./usr/lib/bc/libacpi.a minix-comp bitcode
./usr/lib/bc/libarchive.a minix-comp bitcode
./usr/lib/bc/libasyn.a minix-comp bitcode
./usr/lib/bc/libaudiodriver.a minix-comp bitcode
.endif
.if (${MACHINE_ARCH} == "i386")
-SUBDIR+= ../minix/lib/libhgfs \
+SUBDIR+= ../minix/lib/libacpi \
+ ../minix/lib/libhgfs \
../minix/lib/libvassert \
../minix/lib/libvboxfs \
../minix/lib/libvirtio
DPADD+= ${LIBCHARDRIVER}
LDADD+= -lchardriver
+DPADD+= ${LIBACPI}
+LDADD+= -lacpi
+
WARNS= 3
.include <minix.service.mk>
#include <minix/acpi.h>
#include <minix/chardriver.h>
#include <minix/driver.h>
-#include <minix/ds.h>
#include <minix/param.h>
#include <minix/rs.h>
static int nr_pcidev= 0;
static struct machine machine;
-static endpoint_t acpi_ep;
/*===========================================================================*
* helper functions for I/O *
return 0;
}
-/*===========================================================================*
- * IRQ handling *
- *===========================================================================*/
-static int
-acpi_get_irq(unsigned bus, unsigned dev, unsigned pin)
-{
- int err;
- message m;
-
- ((struct acpi_get_irq_req *)&m)->hdr.request = ACPI_REQ_GET_IRQ;
- ((struct acpi_get_irq_req *)&m)->bus = bus;
- ((struct acpi_get_irq_req *)&m)->dev = dev;
- ((struct acpi_get_irq_req *)&m)->pin = pin;
-
- if ((err = ipc_sendrec(acpi_ep, &m)) != OK)
- panic("PCI: error %d while receiveing from ACPI\n", err);
-
- return ((struct acpi_get_irq_resp *)&m)->irq;
-}
-
static int
derive_irq(struct pcidev * dev, int pin)
{
}
}
-/*
- * tells acpi which two busses are connected by this bridge. The primary bus
- * (pbnr) must be already known to acpi and it must map dev as the connection to
- * the secondary (sbnr) bus
- */
-static void
-acpi_map_bridge(unsigned int pbnr, unsigned int dev, unsigned int sbnr)
-{
- int err;
- message m;
-
- ((struct acpi_map_bridge_req *)&m)->hdr.request = ACPI_REQ_MAP_BRIDGE;
- ((struct acpi_map_bridge_req *)&m)->primary_bus = pbnr;
- ((struct acpi_map_bridge_req *)&m)->secondary_bus = sbnr;
- ((struct acpi_map_bridge_req *)&m)->device = dev;
-
- if ((err = ipc_sendrec(acpi_ep, &m)) != OK)
- panic("PCI: error %d while receiveing from ACPI\n", err);
-
- if (((struct acpi_map_bridge_resp *)&m)->err != OK)
- printf("PCI: acpi failed to map pci (%d) to pci (%d) bridge\n",
- pbnr, sbnr);
-}
-
static void
do_pcibridge(int busind)
{
return ENODEV;
}
if (machine.apic_enabled &&
- ds_retrieve_label_endpt("acpi", &acpi_ep) != OK) {
+ acpi_init() != OK) {
panic("PCI: Cannot use APIC mode without ACPI!\n");
}
#include <sys/types.h>
#include <minix/ipc.h>
-#define ACPI_REQ_GET_IRQ 1
-#define ACPI_REQ_MAP_BRIDGE 2
+#define ACPI_REQ_GET_IRQ 1
+#define ACPI_REQ_MAP_BRIDGE 2
struct acpi_request_hdr {
endpoint_t m_source; /* message header */
u32_t request;
};
-/*
+/*
* Message to request dev/pin translation to IRQ by acpi using the acpi routing
* tables
*/
int err;
u32_t __padding[7];
};
+
+int acpi_init(void);
+int acpi_get_irq(unsigned bus, unsigned dev, unsigned pin);
+void acpi_map_bridge(unsigned int pbnr, unsigned int dev, unsigned int sbnr);
.endif
.if (${MACHINE_ARCH} == "i386")
+SUBDIR+= libacpi
SUBDIR+= libhgfs
SUBDIR+= libvassert
SUBDIR+= libvboxfs
--- /dev/null
+# Makefile for libacpi
+
+CPPFLAGS+= -D_MINIX_SYSTEM
+
+LIB = acpi
+
+SRCS = acpi.c
+
+.include <bsd.lib.mk>
--- /dev/null
+#define _SYSTEM
+
+#include <errno.h>
+#include <string.h>
+
+#include <minix/acpi.h>
+#include <minix/com.h>
+#include <minix/ds.h>
+#include <minix/ipc.h>
+#include <minix/log.h>
+#include <minix/sysutil.h>
+
+static struct log log =
+{ .name = "libacpi", .log_level = LEVEL_TRACE, .log_func = default_log };
+
+static endpoint_t acpi_ep = NONE;
+
+int
+acpi_init(void)
+{
+ int res;
+ res = ds_retrieve_label_endpt("acpi", &acpi_ep);
+ return res;
+}
+
+/*===========================================================================*
+ * IRQ handling *
+ *===========================================================================*/
+int
+acpi_get_irq(unsigned bus, unsigned dev, unsigned pin)
+{
+ int err;
+ message m;
+
+ if (acpi_ep == NONE) {
+ err = acpi_init();
+ if (OK != err) {
+ panic("libacpi: ds_retrieve_label_endpt failed for 'acpi': %d", err);
+ }
+ else {
+ log_info(&log, "resolved acpi to endpoint: %d\n", acpi_ep);
+ }
+ }
+
+ ((struct acpi_get_irq_req *)&m)->hdr.request = ACPI_REQ_GET_IRQ;
+ ((struct acpi_get_irq_req *)&m)->bus = bus;
+ ((struct acpi_get_irq_req *)&m)->dev = dev;
+ ((struct acpi_get_irq_req *)&m)->pin = pin;
+
+ if ((err = ipc_sendrec(acpi_ep, &m)) != OK)
+ panic("libacpi: error %d while receiving from ACPI\n", err);
+
+ return ((struct acpi_get_irq_resp *)&m)->irq;
+}
+
+/*
+ * tells acpi which two busses are connected by this bridge. The primary bus
+ * (pbnr) must be already known to acpi and it must map dev as the connection to
+ * the secondary (sbnr) bus
+ */
+void
+acpi_map_bridge(unsigned int pbnr, unsigned int dev, unsigned int sbnr)
+{
+ int err;
+ message m;
+
+ if (acpi_ep == NONE) {
+ err = acpi_init();
+ if (OK != err) {
+ panic("libacpi: ds_retrieve_label_endpt failed for 'acpi': %d", err);
+ }
+ }
+
+ ((struct acpi_map_bridge_req *)&m)->hdr.request = ACPI_REQ_MAP_BRIDGE;
+ ((struct acpi_map_bridge_req *)&m)->primary_bus = pbnr;
+ ((struct acpi_map_bridge_req *)&m)->secondary_bus = sbnr;
+ ((struct acpi_map_bridge_req *)&m)->device = dev;
+
+ if ((err = ipc_sendrec(acpi_ep, &m)) != OK)
+ panic("libacpi: error %d while receiving from ACPI\n", err);
+
+ if (((struct acpi_map_bridge_resp *)&m)->err != OK)
+ printf("libacpi: acpi failed to map pci (%d) to pci (%d) bridge\n",
+ pbnr, sbnr);
+}