diff --git a/src/add-ons/kernel/bus_managers/agp/agp.cpp b/src/add-ons/kernel/bus_managers/agp/agp.cpp index 27d0aaadf3..8f1d76389e 100644 --- a/src/add-ons/kernel/bus_managers/agp/agp.cpp +++ b/src/add-ons/kernel/bus_managers/agp/agp.cpp @@ -83,7 +83,7 @@ status_t init(void) INIT_BEN(pd->kernel); /* find all of our supported devices, if any */ - if (!probe_devices()) + if (probe_devices() != B_OK) { /* free the driver data */ DELETE_BEN(pd->kernel); @@ -150,6 +150,7 @@ next_device: /* note actual number of AGP devices found */ pd->count = count; + TRACE("agp_man: found %d AGP capable device(s)\n", (uint16)count); /* if we didn't find any devices no AGP bus exists */ if (!count) return B_ERROR; @@ -162,7 +163,7 @@ next_device: if ((pd->di[count - 1].agpi.interface.agp_stat & AGP_rate_rev) != (pd->di[count].agpi.interface.agp_stat & AGP_rate_rev)) { - TRACE(("agp_man: compatibility problem detected, aborting\n")); + TRACE("agp_man: compatibility problem detected, aborting\n"); return B_ERROR; } } @@ -216,13 +217,16 @@ static bool has_AGP_interface(pci_info *pcii, uint8 *adress) long get_nth_agp_info (long index, agp_info *info) { - pci_info *pcii = &(pd->di[index].pcii); + pci_info *pcii; + + TRACE("agp_man: get_nth_agp_info called with index %d\n", (uint16)index); /* check if we have a device here */ - if (index > pd->count) return B_ERROR; - + if (index >= pd->count) return B_ERROR; + /* refresh from the contents of the AGP registers from this device */ /* (note: also get agp_stat as some graphicsdriver may have been tweaking, like nvidia) */ + pcii = &(pd->di[index].pcii); pd->di[index].agpi.interface.agp_stat = get_pci(pd->di[index].agp_adress + 4, 4); pd->di[index].agpi.interface.agp_cmd = get_pci(pd->di[index].agp_adress + 8, 4); @@ -237,6 +241,8 @@ void enable_agp (uint32 *command) long count; pci_info *pcii; + TRACE("agp_man: enable_agp called\n"); + /* validate the given command: */ /* if we should set PCI mode, reset all options */ if (!(*command & AGP_enable)) *command = 0x00000000; diff --git a/src/add-ons/kernel/bus_managers/agp/agp.h b/src/add-ons/kernel/bus_managers/agp/agp.h index 7f8fcd8e32..35c4987451 100644 --- a/src/add-ons/kernel/bus_managers/agp/agp.h +++ b/src/add-ons/kernel/bus_managers/agp/agp.h @@ -2,10 +2,11 @@ #define AGP_PROTO_H +#include #include #include "AGP.h" -//#define AGP_DEBUG +#define AGP_DEBUG #ifdef AGP_DEBUG #define TRACE dprintf #else diff --git a/src/add-ons/kernel/bus_managers/agp/module.cpp b/src/add-ons/kernel/bus_managers/agp/module.cpp index 8296f66386..50b1691b08 100644 --- a/src/add-ons/kernel/bus_managers/agp/module.cpp +++ b/src/add-ons/kernel/bus_managers/agp/module.cpp @@ -36,14 +36,14 @@ bus_std_ops(int32 op, ...) { switch(op) { case B_MODULE_INIT: - TRACE(("agp_man: bus module: init\n")); + TRACE("agp_man: bus module: init\n"); if (init() != B_OK) { return ENODEV; } break; case B_MODULE_UNINIT: - TRACE(("agp_man: bus module: uninit\n")); + TRACE("agp_man: bus module: uninit\n"); uninit(); break; default: @@ -70,11 +70,11 @@ struct agp_module_info m_module_info = NULL // the rescan function } , //my functions - &get_nth_agp_info, - &enable_agp, + get_nth_agp_info, + enable_agp }; -module_info *modules[] = { +_EXPORT module_info *modules[] = { (module_info *)&m_module_info , NULL };